corosync  3.0.2
totemnet.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 TOTEMNET_H_DEFINED
44 #define TOTEMNET_H_DEFINED
45 
46 #include <sys/types.h>
47 #include <sys/socket.h>
48 
49 #include <corosync/totem/totem.h>
50 
51 #define TOTEMNET_NOFLUSH 0
52 #define TOTEMNET_FLUSH 1
53 
57 extern int totemnet_initialize (
58  qb_loop_t *poll_handle,
59  void **net_context,
60  struct totem_config *totem_config,
61  totemsrp_stats_t *stats,
62  void *context,
63 
64  void (*deliver_fn) (
65  void *context,
66  const void *msg,
67  unsigned int msg_len,
68  const struct sockaddr_storage *system_from),
69 
70  void (*iface_change_fn) (
71  void *context,
72  const struct totem_ip_address *iface_address,
73  unsigned int iface_no),
74 
75  void (*mtu_changed) (
76  void *context,
77  int net_mtu),
78 
79  void (*target_set_completed) (
80  void *context));
81 
82 extern void *totemnet_buffer_alloc (void *net_context);
83 
84 extern void totemnet_buffer_release (void *net_context, void *ptr);
85 
87  void *net_context,
88  int processor_count);
89 
90 extern int totemnet_token_send (
91  void *net_context,
92  const void *msg,
93  unsigned int msg_len);
94 
95 extern int totemnet_mcast_flush_send (
96  void *net_context,
97  const void *msg,
98  unsigned int msg_len);
99 
100 extern int totemnet_mcast_noflush_send (
101  void *net_context,
102  const void *msg,
103  unsigned int msg_len);
104 
105 extern int totemnet_recv_flush (void *net_context);
106 
107 extern int totemnet_send_flush (void *net_context);
108 
109 extern int totemnet_iface_set (void *net_context,
110  const struct totem_ip_address *interface_addr,
111  unsigned short ip_port,
112  unsigned int iface_no);
113 
114 extern int totemnet_iface_check (void *net_context);
115 
116 extern int totemnet_finalize (void *net_context);
117 
118 extern int totemnet_net_mtu_adjust (void *net_context, struct totem_config *totem_config);
119 
120 extern int totemnet_reconfigure (void *net_context, struct totem_config *totem_config);
121 
122 extern void totemnet_stats_clear (void *net_context);
123 
124 extern const char *totemnet_iface_print (void *net_context);
125 
126 extern int totemnet_ifaces_get (
127  void *net_context,
128  char ***status,
129  unsigned int *iface_count);
130 
131 extern int totemnet_token_target_set (
132  void *net_context,
133  unsigned int target_nodeid);
134 
135 extern int totemnet_crypto_set (
136  void *net_context,
137  const char *cipher_type,
138  const char *hash_type);
139 
140 extern int totemnet_recv_mcast_empty (
141  void *net_context);
142 
143 extern int totemnet_member_add (
144  void *net_context,
145  const struct totem_ip_address *local,
146  const struct totem_ip_address *member,
147  int ring_no);
148 
149 extern int totemnet_member_remove (
150  void *net_context,
151  const struct totem_ip_address *member,
152  int ring_no);
153 
154 extern int totemnet_member_set_active (
155  void *net_context,
156  const struct totem_ip_address *member,
157  int active);
158 
159 #endif /* TOTEMNET_H_DEFINED */
int totemnet_mcast_flush_send(void *net_context, const void *msg, unsigned int msg_len)
Definition: totemnet.c:410
int totemnet_member_remove(void *net_context, const struct totem_ip_address *member, int ring_no)
Definition: totemnet.c:524
int totemnet_initialize(qb_loop_t *poll_handle, void **net_context, struct totem_config *totem_config, totemsrp_stats_t *stats, void *context, void(*deliver_fn)(void *context, const void *msg, unsigned int msg_len, const struct sockaddr_storage *system_from), void(*iface_change_fn)(void *context, const struct totem_ip_address *iface_address, unsigned int iface_no), void(*mtu_changed)(void *context, int net_mtu), void(*target_set_completed)(void *context))
Create an instance.
int totemnet_recv_mcast_empty(void *net_context)
Definition: totemnet.c:493
The totem_ip_address struct.
Definition: coroapi.h:111
int totemnet_token_target_set(void *net_context, unsigned int target_nodeid)
Definition: totemnet.c:481
int totemnet_iface_check(void *net_context)
Definition: totemnet.c:436
void * totemnet_buffer_alloc(void *net_context)
Definition: totemnet.c:351
int totemnet_finalize(void *net_context)
Definition: totemnet.c:290
int totemnet_net_mtu_adjust(void *net_context, struct totem_config *totem_config)
Definition: totemnet.c:446
int totemnet_recv_flush(void *net_context)
Definition: totemnet.c:378
int totemnet_ifaces_get(void *net_context, char ***status, unsigned int *iface_count)
Definition: totemnet.c:468
const char * totemnet_iface_print(void *net_context)
int totemnet_mcast_noflush_send(void *net_context, const void *msg, unsigned int msg_len)
Definition: totemnet.c:423
int totemnet_member_add(void *net_context, const struct totem_ip_address *local, const struct totem_ip_address *member, int ring_no)
Definition: totemnet.c:504
int totemnet_reconfigure(void *net_context, struct totem_config *totem_config)
Definition: totemnet.c:560
int totemnet_token_send(void *net_context, const void *msg, unsigned int msg_len)
Definition: totemnet.c:398
int totemnet_member_set_active(void *net_context, const struct totem_ip_address *member, int active)
Definition: totemnet.c:542
void totemnet_stats_clear(void *net_context)
Definition: totemnet.c:574
int totemnet_send_flush(void *net_context)
Definition: totemnet.c:388
int totemnet_iface_set(void *net_context, const struct totem_ip_address *interface_addr, unsigned short ip_port, unsigned int iface_no)
Definition: totemnet.c:455
int totemnet_processor_count_set(void *net_context, int processor_count)
Definition: totemnet.c:367
struct srp_addr system_from
Definition: totemsrp.c:261
int totemnet_crypto_set(void *net_context, const char *cipher_type, const char *hash_type)
Definition: totemnet.c:276
unsigned int target_nodeid
Definition: totem.h:58
void totemnet_buffer_release(void *net_context, void *ptr)
Definition: totemnet.c:359