corosync  2.4.4
totemrrp.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2005 MontaVista Software, Inc.
3  * Copyright (c) 2006-2007, 2009 Red Hat, Inc.
4  *
5  * All rights reserved.
6  *
7  * Author: Steven Dake (sdake@redhat.com)
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 
43 #ifndef TOTEMRRP_H_DEFINED
44 #define TOTEMRRP_H_DEFINED
45 
46 #include <sys/types.h>
47 #include <sys/socket.h>
48 #include <qb/qbloop.h>
49 #include <corosync/totem/totem.h>
50 
51 #define TOTEMRRP_NOFLUSH 0
52 #define TOTEMRRP_FLUSH 1
53 
54 /*
55  * SRP address. Used mainly in totemsrp.c, but we need it here to inform RRP about
56  * membership change.
57  */
58 struct srp_addr {
59  uint8_t no_addrs;
61 };
62 
66 extern int totemrrp_initialize (
67  qb_loop_t *poll_handle,
68  void **rrp_context,
69  struct totem_config *totem_config,
70  totemsrp_stats_t *stats,
71  void *context,
72 
73  void (*deliver_fn) (
74  void *context,
75  const void *msg,
76  unsigned int msg_len),
77 
78  void (*iface_change_fn) (
79  void *context,
80  const struct totem_ip_address *iface_addr,
81  unsigned int iface_no),
82 
83  void (*token_seqid_get) (
84  const void *msg,
85  unsigned int *seqid,
86  unsigned int *token_is),
87 
88  unsigned int (*msgs_missing) (void),
89 
90  void (*target_set_completed) (
91  void *context)
92  );
93 
94 extern void *totemrrp_buffer_alloc (
95  void *rrp_context);
96 
97 extern void totemrrp_buffer_release (
98  void *rrp_context,
99  void *ptr);
100 
101 extern int totemrrp_processor_count_set (
102  void *rrp_context,
103  unsigned int processor_count);
104 
105 extern int totemrrp_token_send (
106  void *rrp_context,
107  const void *msg,
108  unsigned int msg_len);
109 
110 extern int totemrrp_mcast_noflush_send (
111  void *rrp_context,
112  const void *msg,
113  unsigned int msg_len);
114 
115 extern int totemrrp_mcast_flush_send (
116  void *rrp_context,
117  const void *msg,
118  unsigned int msg_len);
119 
120 extern int totemrrp_recv_flush (
121  void *rrp_context);
122 
123 extern int totemrrp_send_flush (
124  void *rrp_context);
125 
126 extern int totemrrp_token_target_set (
127  void *rrp_context,
128  struct totem_ip_address *target,
129  unsigned int iface_no);
130 
131 extern int totemrrp_iface_check (void *rrp_context);
132 
133 extern int totemrrp_finalize (void *rrp_context);
134 
135 extern int totemrrp_ifaces_get (
136  void *rrp_context,
137  char ***status,
138  unsigned int *iface_count);
139 
140 extern int totemrrp_crypto_set (
141  void *rrp_context,
142  const char *cipher_type,
143  const char *hash_type);
144 
145 extern int totemrrp_ring_reenable (
146  void *rrp_context,
147  unsigned int iface_no);
148 
149 extern int totemrrp_mcast_recv_empty (
150  void *rrp_context);
151 
152 extern int totemrrp_member_add (
153  void *net_context,
154  const struct totem_ip_address *member,
155  int iface_no);
156 
157 extern int totemrrp_member_remove (
158  void *net_context,
159  const struct totem_ip_address *member,
160  int iface_no);
161 
162 extern void totemrrp_membership_changed (
163  void *rrp_context,
164  enum totem_configuration_type configuration_type,
165  const struct srp_addr *member_list, size_t member_list_entries,
166  const struct srp_addr *left_list, size_t left_list_entries,
167  const struct srp_addr *joined_list, size_t joined_list_entries,
168  const struct memb_ring_id *ring_id);
169 
170 #endif /* TOTEMRRP_H_DEFINED */
void totemrrp_membership_changed(void *rrp_context, enum totem_configuration_type configuration_type, const struct srp_addr *member_list, size_t member_list_entries, const struct srp_addr *left_list, size_t left_list_entries, const struct srp_addr *joined_list, size_t joined_list_entries, const struct memb_ring_id *ring_id)
Definition: totemrrp.c:2380
uint8_t no_addrs
Definition: totemrrp.h:59
int totemrrp_mcast_noflush_send(void *rrp_context, const void *msg, unsigned int msg_len)
Definition: totemrrp.c:2257
int totemrrp_crypto_set(void *rrp_context, const char *cipher_type, const char *hash_type)
Definition: totemrrp.c:2301
int totemrrp_ifaces_get(void *rrp_context, char ***status, unsigned int *iface_count)
Definition: totemrrp.c:2286
int totemrrp_recv_flush(void *rrp_context)
Definition: totemrrp.c:2215
int totemrrp_member_add(void *net_context, const struct totem_ip_address *member, int iface_no)
Definition: totemrrp.c:2354
int totemrrp_member_remove(void *net_context, const struct totem_ip_address *member, int iface_no)
Definition: totemrrp.c:2367
The totem_ip_address struct.
Definition: coroapi.h:111
void * totemrrp_buffer_alloc(void *rrp_context)
Definition: totemrrp.c:2179
totem_configuration_type
The totem_configuration_type enum.
Definition: coroapi.h:132
int totemrrp_mcast_flush_send(void *rrp_context, const void *msg, unsigned int msg_len)
Definition: totemrrp.c:2243
int totemrrp_iface_check(void *rrp_context)
Definition: totemrrp.c:2277
#define INTERFACE_MAX
Definition: coroapi.h:88
int totemrrp_token_send(void *rrp_context, const void *msg, unsigned int msg_len)
Definition: totemrrp.c:2232
int totemrrp_initialize(qb_loop_t *poll_handle, void **rrp_context, struct totem_config *totem_config, totemsrp_stats_t *stats, void *context, void(*deliver_fn)(void *context, const void *msg, unsigned int msg_len), void(*iface_change_fn)(void *context, const struct totem_ip_address *iface_addr, unsigned int iface_no), void(*token_seqid_get)(const void *msg, unsigned int *seqid, unsigned int *token_is), unsigned int(*msgs_missing)(void), void(*target_set_completed)(void *context))
Create an instance.
Definition: totemrrp.c:2060
int totemrrp_send_flush(void *rrp_context)
Definition: totemrrp.c:2224
int totemrrp_processor_count_set(void *rrp_context, unsigned int processor_count)
Definition: totemrrp.c:2193
int totemrrp_finalize(void *rrp_context)
Definition: totemrrp.c:2031
The memb_ring_id struct.
Definition: coroapi.h:122
int totemrrp_token_target_set(void *rrp_context, struct totem_ip_address *target, unsigned int iface_no)
Definition: totemrrp.c:2205
void totemrrp_buffer_release(void *rrp_context, void *ptr)
Definition: totemrrp.c:2186
int totemrrp_mcast_recv_empty(void *rrp_context)
Definition: totemrrp.c:2343
struct memb_ring_id ring_id
Definition: totemsrp.c:64
struct totem_ip_address addr[INTERFACE_MAX]
Definition: totemrrp.h:60
int totemrrp_ring_reenable(void *rrp_context, unsigned int iface_no)
Definition: totemrrp.c:2320