90 #include <sys/types.h>
91 #include <sys/socket.h>
92 #include <netinet/in.h>
93 #include <arpa/inet.h>
105 #include <qb/qbloop.h>
106 #include <qb/qbipcs.h>
108 #define LOGSYS_UTILS_ONLY 1
114 #define min(a,b) ((a) < (b)) ? a : b
121 #if !(defined(__i386__) || defined(__x86_64__))
125 #define TOTEMPG_NEED_ALIGN 1
155 #define TOTEMPG_PACKET_SIZE (totempg_totem_config->net_mtu - \
156 sizeof (struct totempg_mcast))
163 static int mcast_packed_msg_count = 0;
165 static int totempg_reserved = 1;
167 static unsigned int totempg_size_limit;
171 static uint32_t totempg_threaded_mode = 0;
176 static int totempg_log_level_security;
177 static int totempg_log_level_error;
178 static int totempg_log_level_warning;
179 static int totempg_log_level_notice;
180 static int totempg_log_level_debug;
181 static int totempg_subsys_id;
182 static void (*totempg_log_printf) (
185 const char *
function,
188 const char *format, ...)
__attribute__((format(printf, 6, 7)));
234 static unsigned char *fragmentation_data;
236 static int fragment_size = 0;
238 static int fragment_continuation = 0;
240 static int totempg_waiting_transack = 0;
246 unsigned int msg_len,
247 int endian_conversion_required);
251 const unsigned int *member_list,
size_t member_list_entries,
252 const unsigned int *left_list,
size_t left_list_entries,
253 const unsigned int *joined_list,
size_t joined_list_entries,
264 static unsigned char next_fragment = 1;
266 static pthread_mutex_t totempg_mutex = PTHREAD_MUTEX_INITIALIZER;
268 static pthread_mutex_t callback_token_mutex = PTHREAD_MUTEX_INITIALIZER;
270 static pthread_mutex_t mcast_msg_mutex = PTHREAD_MUTEX_INITIALIZER;
272 #define log_printf(level, format, args...) \
274 totempg_log_printf(level, \
276 __FUNCTION__, __FILE__, __LINE__, \
280 static int msg_count_send_ok (
int msg_count);
282 static int byte_count_send_ok (
int byte_count);
284 static void totempg_waiting_trans_ack_cb (
int waiting_trans_ack)
286 log_printf(LOG_DEBUG,
"waiting_trans_ack changed to %u", waiting_trans_ack);
287 totempg_waiting_transack = waiting_trans_ack;
294 struct list_head *active_assembly_list_inuse;
296 if (totempg_waiting_transack) {
297 active_assembly_list_inuse = &assembly_list_inuse_trans;
299 active_assembly_list_inuse = &assembly_list_inuse;
305 for (list = active_assembly_list_inuse->
next;
306 list != active_assembly_list_inuse;
309 assembly =
list_entry (list,
struct assembly, list);
311 if (nodeid == assembly->
nodeid) {
319 if (list_empty (&assembly_list_free) == 0) {
320 assembly =
list_entry (assembly_list_free.next,
struct assembly, list);
321 list_del (&assembly->
list);
322 list_add (&assembly->
list, active_assembly_list_inuse);
333 assembly = malloc (
sizeof (
struct assembly));
339 assembly->
data[0] = 0;
343 list_init (&assembly->
list);
344 list_add (&assembly->
list, active_assembly_list_inuse);
349 static void assembly_deref (
struct assembly *assembly)
352 list_del (&assembly->
list);
353 list_add (&assembly->
list, &assembly_list_free);
356 static void assembly_deref_from_normal_and_trans (
int nodeid)
360 struct list_head *active_assembly_list_inuse;
361 struct assembly *assembly;
363 for (j = 0; j < 2; j++) {
365 active_assembly_list_inuse = &assembly_list_inuse;
367 active_assembly_list_inuse = &assembly_list_inuse_trans;
370 for (list = active_assembly_list_inuse->
next;
371 list != active_assembly_list_inuse;
374 list_next = list->
next;
375 assembly =
list_entry (list,
struct assembly, list);
377 if (nodeid == assembly->
nodeid) {
378 list_del (&assembly->
list);
379 list_add (&assembly->
list, &assembly_list_free);
386 static inline void app_confchg_fn (
388 const unsigned int *member_list,
size_t member_list_entries,
389 const unsigned int *left_list,
size_t left_list_entries,
390 const unsigned int *joined_list,
size_t joined_list_entries,
402 for (i = 0; i < left_list_entries; i++) {
403 assembly_deref_from_normal_and_trans (left_list[i]);
406 for (list = totempg_groups_list.
next;
407 list != &totempg_groups_list;
426 static inline void group_endian_convert (
430 unsigned short *group_len;
434 #ifdef TOTEMPG_NEED_ALIGN
438 if ((
size_t)msg % 4 != 0) {
439 aligned_msg = alloca(msg_len);
440 memcpy(aligned_msg, msg, msg_len);
448 group_len = (
unsigned short *)aligned_msg;
449 group_len[0] =
swab16(group_len[0]);
450 for (i = 1; i < group_len[0] + 1; i++) {
451 group_len[i] =
swab16(group_len[i]);
454 if (aligned_msg != msg) {
455 memcpy(msg, aligned_msg, msg_len);
459 static inline int group_matches (
461 unsigned int iov_len,
463 unsigned int group_b_cnt,
464 unsigned int *adjust_iovec)
466 unsigned short *group_len;
470 #ifdef TOTEMPG_NEED_ALIGN
471 struct iovec iovec_aligned = { NULL, 0 };
474 assert (iov_len == 1);
476 #ifdef TOTEMPG_NEED_ALIGN
480 if ((
size_t)iovec->iov_base % 4 != 0) {
481 iovec_aligned.iov_base = alloca(iovec->iov_len);
482 memcpy(iovec_aligned.iov_base, iovec->iov_base, iovec->iov_len);
483 iovec_aligned.iov_len = iovec->iov_len;
484 iovec = &iovec_aligned;
488 group_len = (
unsigned short *)iovec->iov_base;
489 group_name = ((
char *)iovec->iov_base) +
490 sizeof (
unsigned short) * (group_len[0] + 1);
496 *adjust_iovec =
sizeof (
unsigned short) * (group_len[0] + 1);
497 for (i = 1; i < group_len[0] + 1; i++) {
498 *adjust_iovec += group_len[i];
504 for (i = 1; i < group_len[0] + 1; i++) {
505 for (j = 0; j < group_b_cnt; j++) {
506 if ((group_len[i] == groups_b[j].group_len) &&
507 (memcmp (groups_b[j].group, group_name, group_len[i]) == 0)) {
511 group_name += group_len[i];
517 static inline void app_deliver_fn (
520 unsigned int msg_len,
521 int endian_conversion_required)
524 struct iovec stripped_iovec;
525 unsigned int adjust_iovec;
529 struct iovec aligned_iovec = { NULL, 0 };
531 if (endian_conversion_required) {
532 group_endian_convert (msg, msg_len);
541 #ifdef TOTEMPG_NEED_ALIGN
545 aligned_iovec.iov_base = alloca(msg_len);
546 aligned_iovec.iov_len = msg_len;
547 memcpy(aligned_iovec.iov_base, msg, msg_len);
549 aligned_iovec.iov_base = msg;
550 aligned_iovec.iov_len = msg_len;
553 iovec = &aligned_iovec;
555 for (list = totempg_groups_list.
next;
556 list != &totempg_groups_list;
560 if (group_matches (iovec, 1, instance->
groups, instance->
groups_cnt, &adjust_iovec)) {
561 stripped_iovec.iov_len = iovec->iov_len - adjust_iovec;
562 stripped_iovec.iov_base = (
char *)iovec->iov_base + adjust_iovec;
568 if ((
char *)iovec->iov_base + adjust_iovec % 4 != 0) {
572 stripped_iovec.iov_base =
573 alloca (stripped_iovec.iov_len);
574 memcpy (stripped_iovec.iov_base,
575 (
char *)iovec->iov_base + adjust_iovec,
576 stripped_iovec.iov_len);
581 stripped_iovec.iov_base,
582 stripped_iovec.iov_len,
583 endian_conversion_required);
588 static void totempg_confchg_fn (
590 const unsigned int *member_list,
size_t member_list_entries,
591 const unsigned int *left_list,
size_t left_list_entries,
592 const unsigned int *joined_list,
size_t joined_list_entries,
596 app_confchg_fn (configuration_type,
597 member_list, member_list_entries,
598 left_list, left_list_entries,
599 joined_list, joined_list_entries,
603 static void totempg_deliver_fn (
606 unsigned int msg_len,
607 int endian_conversion_required)
610 unsigned short *msg_lens;
612 struct assembly *assembly;
619 struct iovec iov_delv;
621 assembly = assembly_ref (nodeid);
630 if (endian_conversion_required) {
636 msg_count *
sizeof (
unsigned short);
638 memcpy (header, msg, datasize);
641 msg_lens = (
unsigned short *) (header +
sizeof (
struct totempg_mcast));
642 if (endian_conversion_required) {
644 msg_lens[i] =
swab16 (msg_lens[i]);
648 memcpy (&assembly->data[assembly->index], &data[datasize],
659 iov_delv.iov_base = (
void *)&assembly->data[0];
660 iov_delv.iov_len = assembly->index + msg_lens[0];
679 assembly->index += msg_lens[0];
680 iov_delv.iov_base = (
void *)&assembly->data[assembly->index];
681 iov_delv.iov_len = msg_lens[1];
686 if (continuation == assembly->last_frag_num) {
689 app_deliver_fn(nodeid, iov_delv.iov_base, iov_delv.iov_len,
690 endian_conversion_required);
691 assembly->index += msg_lens[i];
692 iov_delv.iov_base = (
void *)&assembly->data[assembly->index];
693 if (i < (msg_count - 1)) {
694 iov_delv.iov_len = msg_lens[i + 1];
698 log_printf (LOG_DEBUG,
"fragmented continuation %u is not equal to assembly last_frag_num %u",
699 continuation, assembly->last_frag_num);
708 assembly->last_frag_num = 0;
710 assembly_deref (assembly);
716 memmove (&assembly->data[0],
717 &assembly->data[assembly->index],
718 msg_lens[msg_count]);
737 struct iovec iovecs[3];
739 if (totempg_threaded_mode == 1) {
740 pthread_mutex_lock (&mcast_msg_mutex);
742 if (mcast_packed_msg_count == 0) {
743 if (totempg_threaded_mode == 1) {
744 pthread_mutex_unlock (&mcast_msg_mutex);
749 if (totempg_threaded_mode == 1) {
750 pthread_mutex_unlock (&mcast_msg_mutex);
763 fragment_continuation = 0;
765 mcast.
msg_count = mcast_packed_msg_count;
767 iovecs[0].iov_base = (
void *)&mcast;
769 iovecs[1].iov_base = (
void *)mcast_packed_msg_lens;
770 iovecs[1].iov_len = mcast_packed_msg_count *
sizeof (
unsigned short);
771 iovecs[2].iov_base = (
void *)&fragmentation_data[0];
772 iovecs[2].iov_len = fragment_size;
775 mcast_packed_msg_count = 0;
778 if (totempg_threaded_mode == 1) {
779 pthread_mutex_unlock (&mcast_msg_mutex);
788 qb_loop_t *poll_handle,
793 totempg_totem_config = totem_config;
803 if (fragmentation_data == 0) {
815 totempg_waiting_trans_ack_cb);
822 &callback_token_received_handle,
825 callback_token_received_fn,
829 (totempg_totem_config->
net_mtu -
832 list_init (&totempg_groups_list);
840 if (totempg_threaded_mode == 1) {
841 pthread_mutex_lock (&totempg_mutex);
844 if (totempg_threaded_mode == 1) {
845 pthread_mutex_unlock (&totempg_mutex);
852 static int mcast_msg (
853 struct iovec *iovec_in,
854 unsigned int iov_len,
859 struct iovec iovecs[3];
860 struct iovec iovec[64];
863 int max_packet_size = 0;
868 if (totempg_threaded_mode == 1) {
869 pthread_mutex_lock (&mcast_msg_mutex);
876 assert (iov_len < 64);
877 for (dest = 0, src = 0; src < iov_len; src++) {
878 if (iovec_in[src].iov_len) {
879 memcpy (&iovec[dest++], &iovec_in[src],
880 sizeof (
struct iovec));
886 (
sizeof (
unsigned short) * (mcast_packed_msg_count + 1));
888 mcast_packed_msg_lens[mcast_packed_msg_count] = 0;
893 for (i = 0; i < iov_len; i++) {
894 total_size += iovec[i].iov_len;
897 if (byte_count_send_ok (total_size +
sizeof(
unsigned short) *
898 (mcast_packed_msg_count)) == 0) {
900 if (totempg_threaded_mode == 1) {
901 pthread_mutex_unlock (&mcast_msg_mutex);
907 for (i = 0; i < iov_len; ) {
910 copy_len = iovec[i].iov_len - copy_base;
918 if ((iovec[i].iov_len + fragment_size) <
919 (max_packet_size -
sizeof (
unsigned short))) {
921 memcpy (&fragmentation_data[fragment_size],
922 (
char *)iovec[i].iov_base + copy_base, copy_len);
923 fragment_size += copy_len;
924 mcast_packed_msg_lens[mcast_packed_msg_count] += copy_len;
935 unsigned char *data_ptr;
937 copy_len =
min(copy_len, max_packet_size - fragment_size);
938 if( copy_len == max_packet_size )
939 data_ptr = (
unsigned char *)iovec[i].iov_base + copy_base;
941 data_ptr = fragmentation_data;
944 memcpy (&fragmentation_data[fragment_size],
945 (
unsigned char *)iovec[i].iov_base + copy_base, copy_len);
946 mcast_packed_msg_lens[mcast_packed_msg_count] += copy_len;
953 if ((i < (iov_len - 1)) ||
954 ((copy_base + copy_len) < iovec[i].iov_len)) {
955 if (!next_fragment) {
958 fragment_continuation = next_fragment;
960 assert(fragment_continuation != 0);
963 fragment_continuation = 0;
969 mcast.
msg_count = ++mcast_packed_msg_count;
970 iovecs[0].iov_base = (
void *)&mcast;
972 iovecs[1].iov_base = (
void *)mcast_packed_msg_lens;
973 iovecs[1].iov_len = mcast_packed_msg_count *
974 sizeof(
unsigned short);
975 iovecs[2].iov_base = (
void *)data_ptr;
976 iovecs[2].iov_len = fragment_size + copy_len;
986 mcast_packed_msg_lens[0] = 0;
987 mcast_packed_msg_count = 0;
994 if ((copy_base + copy_len) == iovec[i].iov_len) {
1003 copy_base += copy_len;
1013 if (mcast_packed_msg_lens[mcast_packed_msg_count]) {
1014 mcast_packed_msg_count++;
1018 if (totempg_threaded_mode == 1) {
1019 pthread_mutex_unlock (&mcast_msg_mutex);
1027 static int msg_count_send_ok (
1035 return ((avail - totempg_reserved) > msg_count);
1038 static int byte_count_send_ok (
1041 unsigned int msg_count = 0;
1046 msg_count = (byte_count / (totempg_totem_config->
net_mtu -
sizeof (
struct totempg_mcast) - 16)) + 1;
1048 return (avail >= msg_count);
1051 static int send_reserve (
1054 unsigned int msg_count = 0;
1056 msg_count = (msg_size / (totempg_totem_config->
net_mtu -
sizeof (
struct totempg_mcast) - 16)) + 1;
1063 static void send_release (
1070 #ifndef HAVE_SMALL_MEMORY_FOOTPRINT
1071 #undef MESSAGE_QUEUE_MAX
1072 #define MESSAGE_QUEUE_MAX ((4 * MESSAGE_SIZE_MAX) / totempg_totem_config->net_mtu)
1075 static uint32_t q_level_precent_used(
void)
1088 if (totempg_threaded_mode == 1) {
1089 pthread_mutex_lock (&callback_token_mutex);
1093 if (totempg_threaded_mode == 1) {
1094 pthread_mutex_unlock (&callback_token_mutex);
1102 if (totempg_threaded_mode == 1) {
1103 pthread_mutex_lock (&callback_token_mutex);
1106 if (totempg_threaded_mode == 1) {
1107 pthread_mutex_unlock (&callback_token_mutex);
1116 void **totempg_groups_instance,
1118 void (*deliver_fn) (
1119 unsigned int nodeid,
1121 unsigned int msg_len,
1122 int endian_conversion_required),
1124 void (*confchg_fn) (
1126 const unsigned int *member_list,
size_t member_list_entries,
1127 const unsigned int *left_list,
size_t left_list_entries,
1128 const unsigned int *joined_list,
size_t joined_list_entries,
1133 if (totempg_threaded_mode == 1) {
1134 pthread_mutex_lock (&totempg_mutex);
1138 if (instance == NULL) {
1146 instance->
q_level = QB_LOOP_MED;
1147 list_init (&instance->
list);
1148 list_add (&instance->
list, &totempg_groups_list);
1150 if (totempg_threaded_mode == 1) {
1151 pthread_mutex_unlock (&totempg_mutex);
1153 *totempg_groups_instance = instance;
1157 if (totempg_threaded_mode == 1) {
1158 pthread_mutex_unlock (&totempg_mutex);
1164 void *totempg_groups_instance,
1170 unsigned int res = 0;
1172 if (totempg_threaded_mode == 1) {
1173 pthread_mutex_lock (&totempg_mutex);
1176 new_groups = realloc (instance->
groups,
1179 if (new_groups == 0) {
1185 instance->
groups = new_groups;
1189 if (totempg_threaded_mode == 1) {
1190 pthread_mutex_unlock (&totempg_mutex);
1196 void *totempg_groups_instance,
1200 if (totempg_threaded_mode == 1) {
1201 pthread_mutex_lock (&totempg_mutex);
1204 if (totempg_threaded_mode == 1) {
1205 pthread_mutex_unlock (&totempg_mutex);
1210 #define MAX_IOVECS_FROM_APP 32
1211 #define MAX_GROUPS_PER_MSG 32
1214 void *totempg_groups_instance,
1215 const struct iovec *iovec,
1216 unsigned int iov_len,
1221 struct iovec iovec_mcast[MAX_GROUPS_PER_MSG + 1 + MAX_IOVECS_FROM_APP];
1225 if (totempg_threaded_mode == 1) {
1226 pthread_mutex_lock (&totempg_mutex);
1236 iovec_mcast[i + 1].iov_base = (
void *) instance->
groups[i].
group;
1238 iovec_mcast[0].iov_len = (instance->
groups_cnt + 1) *
sizeof (
unsigned short);
1239 iovec_mcast[0].iov_base = group_len;
1240 for (i = 0; i < iov_len; i++) {
1241 iovec_mcast[i + instance->
groups_cnt + 1].iov_len = iovec[i].iov_len;
1242 iovec_mcast[i + instance->
groups_cnt + 1].iov_base = iovec[i].iov_base;
1245 res = mcast_msg (iovec_mcast, iov_len + instance->
groups_cnt + 1, guarantee);
1247 if (totempg_threaded_mode == 1) {
1248 pthread_mutex_unlock (&totempg_mutex);
1254 static void check_q_level(
1255 void *totempg_groups_instance)
1258 int32_t old_level = instance->
q_level;
1259 int32_t percent_used = q_level_precent_used();
1270 if (totem_queue_level_changed && old_level != instance->
q_level) {
1271 totem_queue_level_changed(instance->
q_level);
1276 void *totempg_groups_instance)
1280 check_q_level(instance);
1284 void *totempg_groups_instance,
1285 const struct iovec *iovec,
1286 unsigned int iov_len)
1289 unsigned int size = 0;
1291 unsigned int reserved = 0;
1293 if (totempg_threaded_mode == 1) {
1294 pthread_mutex_lock (&totempg_mutex);
1295 pthread_mutex_lock (&mcast_msg_mutex);
1301 for (i = 0; i < iov_len; i++) {
1302 size += iovec[i].iov_len;
1305 if (size >= totempg_size_limit) {
1310 if (byte_count_send_ok (size)) {
1311 reserved = send_reserve (size);
1317 check_q_level(instance);
1319 if (totempg_threaded_mode == 1) {
1320 pthread_mutex_unlock (&mcast_msg_mutex);
1321 pthread_mutex_unlock (&totempg_mutex);
1329 if (totempg_threaded_mode == 1) {
1330 pthread_mutex_lock (&totempg_mutex);
1331 pthread_mutex_lock (&mcast_msg_mutex);
1333 send_release (msg_count);
1334 if (totempg_threaded_mode == 1) {
1335 pthread_mutex_unlock (&mcast_msg_mutex);
1336 pthread_mutex_unlock (&totempg_mutex);
1342 void *totempg_groups_instance,
1346 const struct iovec *iovec,
1347 unsigned int iov_len)
1350 struct iovec iovec_mcast[MAX_GROUPS_PER_MSG + 1 + MAX_IOVECS_FROM_APP];
1354 if (totempg_threaded_mode == 1) {
1355 pthread_mutex_lock (&totempg_mutex);
1361 group_len[0] = groups_cnt;
1362 for (i = 0; i < groups_cnt; i++) {
1364 iovec_mcast[i + 1].iov_len = groups[i].
group_len;
1365 iovec_mcast[i + 1].iov_base = (
void *) groups[i].group;
1367 iovec_mcast[0].iov_len = (groups_cnt + 1) *
sizeof (
unsigned short);
1368 iovec_mcast[0].iov_base = group_len;
1369 for (i = 0; i < iov_len; i++) {
1370 iovec_mcast[i + groups_cnt + 1].iov_len = iovec[i].iov_len;
1371 iovec_mcast[i + groups_cnt + 1].iov_base = iovec[i].iov_base;
1374 res = mcast_msg (iovec_mcast, iov_len + groups_cnt + 1, guarantee);
1376 if (totempg_threaded_mode == 1) {
1377 pthread_mutex_unlock (&totempg_mutex);
1386 void *totempg_groups_instance,
1389 const struct iovec *iovec,
1390 unsigned int iov_len)
1392 unsigned int size = 0;
1396 if (totempg_threaded_mode == 1) {
1397 pthread_mutex_lock (&totempg_mutex);
1400 for (i = 0; i < groups_cnt; i++) {
1403 for (i = 0; i < iov_len; i++) {
1404 size += iovec[i].iov_len;
1407 res = msg_count_send_ok (size);
1409 if (totempg_threaded_mode == 1) {
1410 pthread_mutex_unlock (&totempg_mutex);
1416 unsigned int nodeid,
1418 unsigned int interfaces_size,
1420 unsigned int *iface_count)
1441 return &totempg_stats;
1445 const char *cipher_type,
1446 const char *hash_type)
1464 #define ONE_IFACE_LEN 63
1471 unsigned int iface_count;
1475 iface_string[0] =
'\0';
1479 return (
"no interface found for nodeid");
1484 for (i = 0; i < iface_count; i++) {
1488 strcat (iface_string, one_iface);
1490 return (iface_string);
1503 void (*totem_service_ready) (
void))
1510 totem_queue_level_changed = fn;
1529 totempg_threaded_mode = 1;
unsigned char last_frag_num
int totempg_initialize(qb_loop_t *poll_handle, struct totem_config *totem_config)
Initialize the totem process groups abstraction.
void(*) in log_level_security)
int totemmrp_ifaces_get(unsigned int nodeid, struct totem_ip_address *interfaces, unsigned int interfaces_size, char ***status, unsigned int *iface_count)
void totemmrp_finalize(void)
Totem Single Ring Protocol.
#define TOTEMPG_NEED_ALIGN
int totempg_groups_initialize(void **totempg_groups_instance, void(*deliver_fn)(unsigned int nodeid, const void *msg, unsigned int msg_len, int endian_conversion_required), void(*confchg_fn)(enum totem_configuration_type configuration_type, const unsigned int *member_list, size_t member_list_entries, const unsigned int *left_list, size_t left_list_entries, const unsigned int *joined_list, size_t joined_list_entries, const struct memb_ring_id *ring_id))
Initialize a groups instance.
void totemmrp_callback_token_destroy(void *handle_out)
void * totempg_get_stats(void)
The totem_ip_address struct.
const char * totemip_print(const struct totem_ip_address *addr)
Totem Single Ring Protocol.
int totempg_groups_join(void *totempg_groups_instance, const struct totempg_group *groups, size_t group_cnt)
void totempg_queue_level_register_callback(totem_queue_level_changed_fn fn)
#define TOTEMPG_PACKET_SIZE
totem_configuration_type
The totem_configuration_type enum.
struct totempg_group * groups
int totemmrp_initialize(qb_loop_t *poll_handle, struct totem_config *totem_config, totempg_stats_t *stats, void(*deliver_fn)(unsigned int nodeid, const void *msg, unsigned int msg_len, int endian_conversion_required), void(*confchg_fn)(enum totem_configuration_type configuration_type, const unsigned int *member_list, size_t member_list_entries, const unsigned int *left_list, size_t left_list_entries, const unsigned int *joined_list, size_t joined_list_entries, const struct memb_ring_id *ring_id), void(*waiting_trans_ack_cb_fn)(int waiting_trans_ack))
Initialize the group messaging interface.
void totempg_trans_ack(void)
void totemsrp_net_mtu_adjust(struct totem_config *totem_config)
int totemmrp_member_add(const struct totem_ip_address *member, int ring_no)
int totemmrp_avail(void)
Return number of available messages that can be queued.
struct message_header header
#define log_printf(level, format, args...)
int totemmrp_my_family_get(void)
int totemmrp_crypto_set(const char *cipher_type, const char *hash_type)
void totemmrp_trans_ack(void)
void(* totem_queue_level_changed_fn)(enum totem_q_level level)
int totempg_groups_send_ok_groups(void *totempg_groups_instance, const struct totempg_group *groups, size_t groups_cnt, const struct iovec *iovec, unsigned int iov_len)
unsigned char data[MESSAGE_SIZE_MAX]
int totempg_groups_mcast_groups(void *totempg_groups_instance, int guarantee, const struct totempg_group *groups, size_t groups_cnt, const struct iovec *iovec, unsigned int iov_len)
int totempg_ifaces_get(unsigned int nodeid, struct totem_ip_address *interfaces, unsigned int interfaces_size, char ***status, unsigned int *iface_count)
#define MAX_GROUPS_PER_MSG
const char * totempg_ifaces_print(unsigned int nodeid)
void(* deliver_fn)(unsigned int nodeid, const void *msg, unsigned int msg_len, int endian_conversion_required)
void totempg_threaded_mode_enable(void)
DECLARE_LIST_INIT(assembly_list_inuse)
int totemmrp_member_remove(const struct totem_ip_address *member, int ring_no)
void(* confchg_fn)(enum totem_configuration_type configuration_type, const unsigned int *member_list, size_t member_list_entries, const unsigned int *left_list, size_t left_list_entries, const unsigned int *joined_list, size_t joined_list_entries, const struct memb_ring_id *ring_id)
int totempg_groups_leave(void *totempg_groups_instance, const struct totempg_group *groups, size_t group_cnt)
int totemmrp_mcast(struct iovec *iovec, unsigned int iov_len, int priority)
Multicast a message.
int totempg_my_family_get(void)
unsigned char continuation
void * callback_token_received_handle
int totemmrp_callback_token_create(void **handle_out, enum totem_callback_token_type type, int delete, int(*callback_fn)(enum totem_callback_token_type type, const void *), const void *data)
int totemmrp_ring_reenable(void)
int totempg_groups_mcast_joined(void *totempg_groups_instance, const struct iovec *iovec, unsigned int iov_len, int guarantee)
void(* log_printf)(int level, int subsys, const char *function_name, const char *file_name, int file_line, const char *format,...) __attribute__((format(printf
void totempg_check_q_level(void *totempg_groups_instance)
unsigned int totempg_my_nodeid_get(void)
int totempg_groups_joined_release(int msg_count)
void totempg_event_signal(enum totem_event_type type, int value)
int totempg_member_remove(const struct totem_ip_address *member, int ring_no)
unsigned int totemmrp_my_nodeid_get(void)
void totempg_callback_token_destroy(void *handle_out)
void totemmrp_service_ready_register(void(*totem_service_ready)(void))
int totempg_groups_joined_reserve(void *totempg_groups_instance, const struct iovec *iovec, unsigned int iov_len)
int totempg_ring_reenable(void)
#define MESSAGE_QUEUE_MAX
#define swab16(x)
The swab16 macro.
void totemmrp_threaded_mode_enable(void)
void totempg_service_ready_register(void(*totem_service_ready)(void))
#define list_entry(ptr, type, member)
struct totem_logging_configuration totem_logging_configuration
enum throw_away_mode throw_away_mode
int totempg_crypto_set(const char *cipher_type, const char *hash_type)
void totemmrp_event_signal(enum totem_event_type type, int value)
void totempg_finalize(void)
struct memb_ring_id ring_id
int totempg_member_add(const struct totem_ip_address *member, int ring_no)
Totem Single Ring Protocol.
int totempg_callback_token_create(void **handle_out, enum totem_callback_token_type type, int delete, int(*callback_fn)(enum totem_callback_token_type type, const void *), const void *data)
static void(*) struct totem_config totempg_totem_config)
struct totempg_mcast_header header
totem_callback_token_type
The totem_callback_token_type enum.