corosync  2.4.6
totem.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2005 MontaVista Software, Inc.
3  * Copyright (c) 2006-2012 Red Hat, Inc.
4  *
5  * Author: Steven Dake (sdake@redhat.com)
6  *
7  * All rights reserved.
8  *
9  * This software licensed under BSD license, the text of which follows:
10  *
11  * Redistribution and use in source and binary forms, with or without
12  * modification, are permitted provided that the following conditions are met:
13  *
14  * - Redistributions of source code must retain the above copyright notice,
15  * this list of conditions and the following disclaimer.
16  * - Redistributions in binary form must reproduce the above copyright notice,
17  * this list of conditions and the following disclaimer in the documentation
18  * and/or other materials provided with the distribution.
19  * - Neither the name of the MontaVista Software, Inc. nor the names of its
20  * contributors may be used to endorse or promote products derived from this
21  * software without specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
27  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
33  * THE POSSIBILITY OF SUCH DAMAGE.
34  */
35 #ifndef TOTEM_H_DEFINED
36 #define TOTEM_H_DEFINED
37 #include "totemip.h"
38 #include <corosync/hdb.h>
39 
40 #ifdef HAVE_SMALL_MEMORY_FOOTPRINT
41 #define PROCESSOR_COUNT_MAX 16
42 #define MESSAGE_SIZE_MAX 1024*64
43 #define MESSAGE_QUEUE_MAX 512
44 #else
45 #define PROCESSOR_COUNT_MAX 384
46 #define MESSAGE_SIZE_MAX 1024*1024 /* (1MB) */
47 #define MESSAGE_QUEUE_MAX ((4 * MESSAGE_SIZE_MAX) / totem_config->net_mtu)
48 #endif /* HAVE_SMALL_MEMORY_FOOTPRINT */
49 
50 #define FRAME_SIZE_MAX 10000
51 #define TRANSMITS_ALLOWED 16
52 #define SEND_THREADS_MAX 16
53 #define INTERFACE_MAX 2
54 
55 #define BIND_MAX_RETRIES 10
56 #define BIND_RETRIES_INTERVAL 100
57 
61 #define MAX_NO_CONT_GATHER 3
62 /*
63  * Maximum number of continuous failures get from sendmsg call
64  */
65 #define MAX_NO_CONT_SENDMSG_FAILURES 30
66 
71  uint16_t ip_port;
72  uint16_t ttl;
75 };
76 
78  void (*log_printf) (
79  int level,
80  int subsys,
81  const char *function_name,
82  const char *file_name,
83  int file_line,
84  const char *format,
85  ...) __attribute__((format(printf, 6, 7)));
86 
94 };
95 
96 enum { TOTEM_PRIVATE_KEY_LEN = 128 };
97 enum { TOTEM_RRP_MODE_BYTES = 64 };
98 
99 typedef enum {
104 
105 #define MEMB_RING_ID
106 struct memb_ring_id {
107  struct totem_ip_address rep;
108  unsigned long long seq;
109 } __attribute__((packed));
110 
111 struct totem_config {
112  int version;
113 
114  /*
115  * network
116  */
118  unsigned int interface_count;
119  unsigned int node_id;
120  unsigned int clear_node_high_bit;
121 
122  /*
123  * key information
124  */
126 
127  unsigned int private_key_len;
128 
129  /*
130  * Totem configuration parameters
131  */
132  unsigned int token_timeout;
133 
135 
136  unsigned int token_hold_timeout;
137 
139 
140  unsigned int join_timeout;
141 
142  unsigned int send_join_timeout;
143 
144  unsigned int consensus_timeout;
145 
146  unsigned int merge_timeout;
147 
148  unsigned int downcheck_timeout;
149 
150  unsigned int fail_to_recv_const;
151 
152  unsigned int seqno_unchanged_const;
153 
155 
157 
159 
161 
163 
165 
167 
168  unsigned int net_mtu;
169 
170  unsigned int threads;
171 
173 
174  unsigned int max_network_delay;
175 
176  unsigned int window_size;
177 
178  unsigned int max_messages;
179 
180  const char *vsf_type;
181 
182  unsigned int broadcast_use;
183 
185 
187 
189 
190  unsigned int miss_count_const;
191 
193 
194  unsigned int block_unlisted_ips;
195 
197 
199  struct memb_ring_id *memb_ring_id,
200  const struct totem_ip_address *addr);
201 
203  const struct memb_ring_id *memb_ring_id,
204  const struct totem_ip_address *addr);
205 };
206 
207 #define TOTEM_CONFIGURATION_TYPE
211 };
212 
213 #define TOTEM_CALLBACK_TOKEN_TYPE
217 };
218 
222 };
223 
224 typedef struct {
225  int is_dirty;
226  time_t last_updated;
228 
229 typedef struct {
231  uint32_t iface_changes;
233 
234 typedef struct {
237  char *algo_name;
238  uint8_t *faulty;
239  uint32_t interface_count;
241 
242 
243 typedef struct {
244  uint32_t rx;
245  uint32_t tx;
248 
249 typedef struct {
252  uint64_t orf_token_tx;
253  uint64_t orf_token_rx;
256  uint64_t memb_join_tx;
257  uint64_t memb_join_rx;
258  uint64_t mcast_tx;
259  uint64_t mcast_retx;
260  uint64_t mcast_rx;
267  uint64_t gather_entered;
269  uint64_t commit_entered;
274  uint64_t rx_msg_dropped;
277 
280 #define TOTEM_TOKEN_STATS_MAX 100
282 
284 
285 
286  #define TOTEM_CONFIGURATION_TYPE
287 
288 typedef struct {
292 
293 typedef struct {
296  uint32_t msg_reserved;
297  uint32_t msg_queue_avail;
299 
300 #endif /* TOTEM_H_DEFINED */
unsigned int clear_node_high_bit
Definition: totem.h:120
uint64_t gather_entered
Definition: totem.h:267
uint64_t memb_commit_token_rx
Definition: totem.h:262
const char * vsf_type
Definition: totem.h:180
struct totem_interface * interfaces
Definition: totem.h:117
unsigned int interface_count
Definition: totem.h:118
uint64_t memb_join_tx
Definition: totem.h:256
The totem_ip_address struct.
Definition: coroapi.h:111
totem_transport_t transport_number
Definition: totem.h:188
uint64_t mcast_rx
Definition: totem.h:260
totem_transport_t
Definition: totem.h:99
unsigned int token_hold_timeout
Definition: totem.h:136
int member_count
Definition: totem.h:73
struct totem_ip_address member_list[PROCESSOR_COUNT_MAX]
Definition: totem.h:74
totem_stats_header_t hdr
Definition: totem.h:250
totem_configuration_type
The totem_configuration_type enum.
Definition: coroapi.h:132
totem_stats_header_t hdr
Definition: totem.h:230
unsigned char private_key[TOTEM_PRIVATE_KEY_LEN]
Definition: totem.h:125
char rrp_mode[TOTEM_RRP_MODE_BYTES]
Definition: totem.h:164
uint64_t memb_merge_detect_rx
Definition: totem.h:255
unsigned char addr[TOTEMIP_ADDRLEN]
Definition: coroapi.h:77
unsigned int rrp_problem_count_timeout
Definition: totem.h:156
int earliest_token
Definition: totem.h:278
uint64_t orf_token_tx
Definition: totem.h:252
uint64_t gather_token_lost
Definition: totem.h:268
unsigned int downcheck_timeout
Definition: totem.h:148
unsigned int private_key_len
Definition: totem.h:127
uint64_t memb_commit_token_tx
Definition: totem.h:261
unsigned int max_network_delay
Definition: totem.h:174
unsigned int heartbeat_failures_allowed
Definition: totem.h:172
time_t last_updated
Definition: totem.h:226
#define TOTEM_TOKEN_STATS_MAX
Definition: totem.h:280
unsigned int send_join_timeout
Definition: totem.h:142
unsigned int window_size
Definition: totem.h:176
unsigned int rrp_problem_count_threshold
Definition: totem.h:158
char * algo_name
Definition: totem.h:237
uint64_t operational_entered
Definition: totem.h:265
void(*) in log_level_security)
Definition: totem.h:85
unsigned int block_unlisted_ips
Definition: totem.h:194
int latest_token
Definition: totem.h:279
uint64_t operational_token_lost
Definition: totem.h:266
uint64_t consensus_timeouts
Definition: totem.h:273
uint16_t ttl
Definition: totem.h:72
unsigned int node_id
Definition: totem.h:119
uint64_t recovery_token_lost
Definition: totem.h:272
unsigned int token_retransmits_before_loss_const
Definition: totem.h:138
unsigned int seqno_unchanged_const
Definition: totem.h:152
uint64_t commit_token_lost
Definition: totem.h:270
unsigned int miss_count_const
Definition: totem.h:190
uint64_t token_hold_cancel_rx
Definition: totem.h:264
unsigned int join_timeout
Definition: totem.h:140
char * crypto_hash_type
Definition: totem.h:186
struct totem_ip_address mcast_addr
Definition: totem.h:70
struct totem_config __attribute__
unsigned int rrp_autorecovery_check_timeout
Definition: totem.h:162
uint64_t mcast_retx
Definition: totem.h:259
unsigned int fail_to_recv_const
Definition: totem.h:150
totemmrp_stats_t * mrp
Definition: totem.h:295
struct totem_ip_address boundto
Definition: totem.h:69
#define PROCESSOR_COUNT_MAX
Definition: totem.h:45
uint32_t msg_queue_avail
Definition: totem.h:297
totem_event_type
Definition: totem.h:219
uint64_t rx_msg_dropped
Definition: totem.h:274
void(* log_printf)(int level, int subsys, const char *function_name, const char *file_name, int file_line, const char *format,...) __attribute__((format(printf
Definition: totem.h:78
uint16_t ip_port
Definition: totem.h:71
uint32_t iface_changes
Definition: totem.h:231
int version
Definition: totem.h:112
uint32_t continuous_gather
Definition: totem.h:275
totemrrp_stats_t * rrp
Definition: totem.h:251
unsigned int net_mtu
Definition: totem.h:168
totemnet_stats_t * net
Definition: totem.h:236
uint64_t token_hold_cancel_tx
Definition: totem.h:263
void(* totem_memb_ring_id_create_or_load)(struct memb_ring_id *memb_ring_id, const struct totem_ip_address *addr)
Definition: totem.h:198
int ip_version
Definition: totem.h:192
unsigned int token_timeout
Definition: totem.h:132
unsigned int consensus_timeout
Definition: totem.h:144
uint64_t mcast_tx
Definition: totem.h:258
The memb_ring_id struct.
Definition: coroapi.h:122
unsigned int broadcast_use
Definition: totem.h:182
uint64_t memb_merge_detect_tx
Definition: totem.h:254
uint32_t msg_reserved
Definition: totem.h:296
totem_stats_header_t hdr
Definition: totem.h:294
totemsrp_stats_t * srp
Definition: totem.h:290
unsigned int rrp_problem_count_mcast_threshold
Definition: totem.h:160
uint64_t memb_join_rx
Definition: totem.h:257
unsigned int cancel_token_hold_on_retransmit
Definition: totem.h:196
totem_stats_header_t hdr
Definition: totem.h:235
unsigned long long seq
Definition: coroapi.h:124
unsigned int max_messages
Definition: totem.h:178
uint64_t recovery_entered
Definition: totem.h:271
char * crypto_cipher_type
Definition: totem.h:184
unsigned int merge_timeout
Definition: totem.h:146
uint32_t interface_count
Definition: totem.h:239
unsigned int token_retransmit_timeout
Definition: totem.h:134
struct totem_ip_address bindnet
Definition: totem.h:68
uint32_t continuous_sendmsg_failures
Definition: totem.h:276
uint8_t * faulty
Definition: totem.h:238
totem_stats_header_t hdr
Definition: totem.h:289
uint64_t commit_entered
Definition: totem.h:269
unsigned int rrp_token_expired_timeout
Definition: totem.h:154
uint64_t orf_token_rx
Definition: totem.h:253
unsigned int threads
Definition: totem.h:170
void(* totem_memb_ring_id_store)(const struct memb_ring_id *memb_ring_id, const struct totem_ip_address *addr)
Definition: totem.h:202
totem_callback_token_type
The totem_callback_token_type enum.
Definition: coroapi.h:142