2 * Copyright (c) 2003-2005 MontaVista Software, Inc.
3 * Copyright (c) 2006-2007 Red Hat, Inc.
7 * Author: Steven Dake (sdake@mvista.com)
9 * This software licensed under BSD license, the text of which follows:
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions are met:
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.
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.
36 #ifndef TOTEMPG_H_DEFINED
37 #define TOTEMPG_H_DEFINED
39 #include <netinet/in.h>
43 typedef unsigned int totempg_groups_handle
;
45 struct totempg_group
{
50 #define TOTEMPG_AGREED 0
51 #define TOTEMPG_SAFE 1
54 * Totem Single Ring Protocol
55 * depends on poll abstraction, POSIX, IPV4
59 * Initialize the totem process groups abstraction
61 extern int totempg_initialize (
62 poll_handle poll_handle
,
63 struct totem_config
*totem_config
66 extern void totempg_finalize (void);
68 extern int totempg_callback_token_create (void **handle_out
,
69 enum totem_callback_token_type type
,
71 int (*callback_fn
) (enum totem_callback_token_type type
, void *),
74 extern void totempg_callback_token_destroy (void *handle
);
77 * Initialize a groups instance
79 extern int totempg_groups_initialize (
80 totempg_groups_handle
*handle
,
86 int endian_conversion_required
),
89 enum totem_configuration_type configuration_type
,
90 unsigned int *member_list
, int member_list_entries
,
91 unsigned int *left_list
, int left_list_entries
,
92 unsigned int *joined_list
, int joined_list_entries
,
93 struct memb_ring_id
*ring_id
));
95 extern int totempg_groups_finalize (
96 totempg_groups_handle handle
);
98 extern int totempg_groups_join (
99 totempg_groups_handle handle
,
100 struct totempg_group
*groups
,
103 extern int totempg_groups_leave (
104 totempg_groups_handle handle
,
105 struct totempg_group
*groups
,
108 extern int totempg_groups_mcast_joined (
109 totempg_groups_handle handle
,
114 extern int totempg_groups_send_ok_joined (
115 totempg_groups_handle handle
,
119 extern int totempg_groups_mcast_groups (
120 totempg_groups_handle handle
,
122 struct totempg_group
*groups
,
127 extern int totempg_groups_send_ok_groups (
128 totempg_groups_handle handle
,
129 struct totempg_group
*groups
,
134 extern int totempg_ifaces_get (
136 struct totem_ip_address
*interfaces
,
138 unsigned int *iface_count
);
140 extern char *totempg_ifaces_print (unsigned int nodeid
);
142 extern int totempg_my_nodeid_get (void);
144 extern int totempg_my_family_get (void);
146 extern int totempg_ring_reenable (void);
148 #endif /* TOTEMPG_H_DEFINED */