corosync  2.4.2-dirty
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 
58 #define MAX_NO_CONT_GATHER 3
59 /*
60  * Maximum number of continuous failures get from sendmsg call
61  */
62 #define MAX_NO_CONT_SENDMSG_FAILURES 30
63 
68  uint16_t ip_port;
69  uint16_t ttl;
72 };
73 
75  void (*log_printf) (
76  int level,
77  int subsys,
78  const char *function_name,
79  const char *file_name,
80  int file_line,
81  const char *format,
82  ...) __attribute__((format(printf, 6, 7)));
83 
91 };
92 
93 enum { TOTEM_PRIVATE_KEY_LEN = 128 };
94 enum { TOTEM_RRP_MODE_BYTES = 64 };
95 
96 typedef enum {
101 
102 #define MEMB_RING_ID
103 struct memb_ring_id {
104  struct totem_ip_address rep;
105  unsigned long long seq;
106 } __attribute__((packed));
107 
108 struct totem_config {
109  int version;
110 
111  /*
112  * network
113  */
115  unsigned int interface_count;
116  unsigned int node_id;
117  unsigned int clear_node_high_bit;
118 
119  /*
120  * key information
121  */
123 
124  unsigned int private_key_len;
125 
126  /*
127  * Totem configuration parameters
128  */
129  unsigned int token_timeout;
130 
132 
133  unsigned int token_hold_timeout;
134 
136 
137  unsigned int join_timeout;
138 
139  unsigned int send_join_timeout;
140 
141  unsigned int consensus_timeout;
142 
143  unsigned int merge_timeout;
144 
145  unsigned int downcheck_timeout;
146 
147  unsigned int fail_to_recv_const;
148 
149  unsigned int seqno_unchanged_const;
150 
152 
154 
156 
158 
160 
162 
164 
165  unsigned int net_mtu;
166 
167  unsigned int threads;
168 
170 
171  unsigned int max_network_delay;
172 
173  unsigned int window_size;
174 
175  unsigned int max_messages;
176 
177  const char *vsf_type;
178 
179  unsigned int broadcast_use;
180 
182 
184 
186 
187  unsigned int miss_count_const;
188 
190 
192  struct memb_ring_id *memb_ring_id,
193  const struct totem_ip_address *addr);
194 
196  const struct memb_ring_id *memb_ring_id,
197  const struct totem_ip_address *addr);
198 };
199 
200 #define TOTEM_CONFIGURATION_TYPE
204 };
205 
206 #define TOTEM_CALLBACK_TOKEN_TYPE
210 };
211 
215 };
216 
217 typedef struct {
218  int is_dirty;
219  time_t last_updated;
221 
222 typedef struct {
224  uint32_t iface_changes;
226 
227 typedef struct {
230  char *algo_name;
231  uint8_t *faulty;
232  uint32_t interface_count;
234 
235 
236 typedef struct {
237  uint32_t rx;
238  uint32_t tx;
241 
242 typedef struct {
245  uint64_t orf_token_tx;
246  uint64_t orf_token_rx;
249  uint64_t memb_join_tx;
250  uint64_t memb_join_rx;
251  uint64_t mcast_tx;
252  uint64_t mcast_retx;
253  uint64_t mcast_rx;
260  uint64_t gather_entered;
262  uint64_t commit_entered;
267  uint64_t rx_msg_dropped;
270 
273 #define TOTEM_TOKEN_STATS_MAX 100
275 
277 
278 
279  #define TOTEM_CONFIGURATION_TYPE
280 
281 typedef struct {
285 
286 typedef struct {
289  uint32_t msg_reserved;
290  uint32_t msg_queue_avail;
292 
293 #endif /* TOTEM_H_DEFINED */
unsigned int clear_node_high_bit
Definition: totem.h:117
void(*) in log_level_security)
Definition: totem.h:82
uint64_t gather_entered
Definition: totem.h:260
uint64_t memb_commit_token_rx
Definition: totem.h:255
const char * vsf_type
Definition: totem.h:177
struct totem_interface * interfaces
Definition: totem.h:114
unsigned int interface_count
Definition: totem.h:115
uint64_t memb_join_tx
Definition: totem.h:249
The totem_ip_address struct.
Definition: coroapi.h:111
totem_transport_t transport_number
Definition: totem.h:185
uint64_t mcast_rx
Definition: totem.h:253
totem_transport_t
Definition: totem.h:96
unsigned int token_hold_timeout
Definition: totem.h:133
int member_count
Definition: totem.h:70
struct totem_ip_address member_list[PROCESSOR_COUNT_MAX]
Definition: totem.h:71
totem_stats_header_t hdr
Definition: totem.h:243
totem_configuration_type
The totem_configuration_type enum.
Definition: coroapi.h:132
totem_stats_header_t hdr
Definition: totem.h:223
unsigned char private_key[TOTEM_PRIVATE_KEY_LEN]
Definition: totem.h:122
char rrp_mode[TOTEM_RRP_MODE_BYTES]
Definition: totem.h:161
uint64_t memb_merge_detect_rx
Definition: totem.h:248
unsigned char addr[TOTEMIP_ADDRLEN]
Definition: coroapi.h:77
unsigned int rrp_problem_count_timeout
Definition: totem.h:153
int earliest_token
Definition: totem.h:271
uint64_t orf_token_tx
Definition: totem.h:245
uint64_t gather_token_lost
Definition: totem.h:261
unsigned int downcheck_timeout
Definition: totem.h:145
unsigned int private_key_len
Definition: totem.h:124
uint64_t memb_commit_token_tx
Definition: totem.h:254
unsigned int max_network_delay
Definition: totem.h:171
unsigned int heartbeat_failures_allowed
Definition: totem.h:169
time_t last_updated
Definition: totem.h:219
#define TOTEM_TOKEN_STATS_MAX
Definition: totem.h:273
unsigned int send_join_timeout
Definition: totem.h:139
unsigned int window_size
Definition: totem.h:173
unsigned int rrp_problem_count_threshold
Definition: totem.h:155
char * algo_name
Definition: totem.h:230
uint64_t operational_entered
Definition: totem.h:258
int latest_token
Definition: totem.h:272
uint64_t operational_token_lost
Definition: totem.h:259
uint64_t consensus_timeouts
Definition: totem.h:266
uint16_t ttl
Definition: totem.h:69
unsigned int node_id
Definition: totem.h:116
uint64_t recovery_token_lost
Definition: totem.h:265
unsigned int token_retransmits_before_loss_const
Definition: totem.h:135
unsigned int seqno_unchanged_const
Definition: totem.h:149
uint64_t commit_token_lost
Definition: totem.h:263
unsigned int miss_count_const
Definition: totem.h:187
uint64_t token_hold_cancel_rx
Definition: totem.h:257
unsigned int join_timeout
Definition: totem.h:137
char * crypto_hash_type
Definition: totem.h:183
struct totem_ip_address mcast_addr
Definition: totem.h:67
struct totem_config __attribute__
unsigned int rrp_autorecovery_check_timeout
Definition: totem.h:159
uint64_t mcast_retx
Definition: totem.h:252
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:75
unsigned int fail_to_recv_const
Definition: totem.h:147
totemmrp_stats_t * mrp
Definition: totem.h:288
struct totem_ip_address boundto
Definition: totem.h:66
#define PROCESSOR_COUNT_MAX
Definition: totem.h:45
uint32_t msg_queue_avail
Definition: totem.h:290
totem_event_type
Definition: totem.h:212
uint64_t rx_msg_dropped
Definition: totem.h:267
uint16_t ip_port
Definition: totem.h:68
uint32_t iface_changes
Definition: totem.h:224
int version
Definition: totem.h:109
uint32_t continuous_gather
Definition: totem.h:268
totemrrp_stats_t * rrp
Definition: totem.h:244
unsigned int net_mtu
Definition: totem.h:165
totemnet_stats_t * net
Definition: totem.h:229
uint64_t token_hold_cancel_tx
Definition: totem.h:256
int ip_version
Definition: totem.h:189
unsigned int token_timeout
Definition: totem.h:129
unsigned int consensus_timeout
Definition: totem.h:141
uint64_t mcast_tx
Definition: totem.h:251
The memb_ring_id struct.
Definition: coroapi.h:122
unsigned int broadcast_use
Definition: totem.h:179
uint64_t memb_merge_detect_tx
Definition: totem.h:247
uint32_t msg_reserved
Definition: totem.h:289
totem_stats_header_t hdr
Definition: totem.h:287
totemsrp_stats_t * srp
Definition: totem.h:283
unsigned int rrp_problem_count_mcast_threshold
Definition: totem.h:157
uint64_t memb_join_rx
Definition: totem.h:250
totem_stats_header_t hdr
Definition: totem.h:228
unsigned long long seq
Definition: coroapi.h:124
unsigned int max_messages
Definition: totem.h:175
uint64_t recovery_entered
Definition: totem.h:264
char * crypto_cipher_type
Definition: totem.h:181
unsigned int merge_timeout
Definition: totem.h:143
uint32_t interface_count
Definition: totem.h:232
unsigned int token_retransmit_timeout
Definition: totem.h:131
struct totem_ip_address bindnet
Definition: totem.h:65
uint32_t continuous_sendmsg_failures
Definition: totem.h:269
uint8_t * faulty
Definition: totem.h:231
totem_stats_header_t hdr
Definition: totem.h:282
uint64_t commit_entered
Definition: totem.h:262
unsigned int rrp_token_expired_timeout
Definition: totem.h:151
uint64_t orf_token_rx
Definition: totem.h:246
unsigned int threads
Definition: totem.h:167
void(* totem_memb_ring_id_create_or_load)(struct memb_ring_id *memb_ring_id, const struct totem_ip_address *addr)
Definition: totem.h:191
totem_callback_token_type
The totem_callback_token_type enum.
Definition: coroapi.h:142
void(* totem_memb_ring_id_store)(const struct memb_ring_id *memb_ring_id, const struct totem_ip_address *addr)
Definition: totem.h:195