2 * Copyright (c) 2005 MontaVista Software, Inc.
3 * Copyright (c) 2006 Red Hat, Inc.
4 * Copyright (c) 2006 Sun Microsystems, Inc.
6 * Author: Steven Dake (sdake@mvista.com)
10 * This software licensed under BSD license, the text of which follows:
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions are met:
15 * - Redistributions of source code must retain the above copyright notice,
16 * this list of conditions and the following disclaimer.
17 * - Redistributions in binary form must reproduce the above copyright notice,
18 * this list of conditions and the following disclaimer in the documentation
19 * and/or other materials provided with the distribution.
20 * - Neither the name of the MontaVista Software, Inc. nor the names of its
21 * contributors may be used to endorse or promote products derived from this
22 * software without specific prior written permission.
24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
28 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
34 * THE POSSIBILITY OF SUCH DAMAGE.
36 #ifndef TOTEM_H_DEFINED
37 #define TOTEM_H_DEFINED
40 #define MESSAGE_SIZE_MAX 1024*1024 /* (1MB) */
41 #define PROCESSOR_COUNT_MAX 384
42 #define FRAME_SIZE_MAX 9000
43 #define TRANSMITS_ALLOWED 16
44 #define SEND_THREADS_MAX 16
45 #define INTERFACE_MAX 2
48 * Array location of various timeouts as
49 * specified in openais.conf. The last enum
50 * specifies the size of the timeouts array and
51 * needs to remain the last item in the list.
54 TOTEM_RETRANSMITS_BEFORE_LOSS
,
56 TOTEM_RETRANSMIT_TOKEN
,
62 TOTEM_FAIL_RECV_CONST
,
64 MAX_TOTEM_TIMEOUTS
/* Last item */
65 } totem_timeout_types
;
67 struct totem_interface
{
68 struct totem_ip_address bindnet
;
69 struct totem_ip_address boundto
;
70 struct totem_ip_address mcast_addr
;
74 struct totem_logging_configuration
{
75 void (*log_printf
) (char *, int, int, char *, ...) __attribute__((format(printf
, 4, 5)));
76 int log_level_security
;
78 int log_level_warning
;
89 struct totem_interface
*interfaces
;
96 unsigned char private_key
[128];
101 * Totem configuration parameters
103 unsigned int token_timeout
;
105 unsigned int token_retransmit_timeout
;
107 unsigned int token_hold_timeout
;
109 unsigned int token_retransmits_before_loss_const
;
111 unsigned int join_timeout
;
113 unsigned int send_join_timeout
;
115 unsigned int consensus_timeout
;
117 unsigned int merge_timeout
;
119 unsigned int downcheck_timeout
;
121 unsigned int fail_to_recv_const
;
123 unsigned int seqno_unchanged_const
;
125 unsigned int rrp_token_expired_timeout
;
127 unsigned int rrp_problem_count_timeout
;
129 unsigned int rrp_problem_count_threshold
;
133 struct totem_logging_configuration totem_logging_configuration
;
135 unsigned int secauth
;
137 unsigned int net_mtu
;
139 unsigned int threads
;
141 unsigned int heartbeat_failures_allowed
;
143 unsigned int max_network_delay
;
145 unsigned int window_size
;
147 unsigned int max_messages
;
152 enum totem_configuration_type
{
153 TOTEM_CONFIGURATION_REGULAR
,
154 TOTEM_CONFIGURATION_TRANSITIONAL
157 enum totem_callback_token_type
{
158 TOTEM_CALLBACK_TOKEN_RECEIVED
= 1,
159 TOTEM_CALLBACK_TOKEN_SENT
= 2
162 struct memb_ring_id
{
163 struct totem_ip_address rep
;
164 unsigned long long seq
;
165 } __attribute__((packed
));
167 typedef struct memb_ring_id memb_ring_id_t
;
169 static inline void swab_memb_ring_id_t (memb_ring_id_t
*to_swab
)
171 swab_totem_ip_address_t (&to_swab
->rep
);
172 to_swab
->seq
= swab64 (to_swab
->seq
);
175 static inline void memb_ring_id_copy(
176 memb_ring_id_t
*out
, memb_ring_id_t
*in
)
178 totemip_copy (&out
->rep
, &in
->rep
);
182 static inline void memb_ring_id_copy_endian_convert(
183 memb_ring_id_t
*out
, memb_ring_id_t
*in
)
185 totemip_copy_endian_convert (&out
->rep
, &in
->rep
);
186 out
->seq
= swab64 (in
->seq
);
189 #endif /* TOTEM_H_DEFINED */