corosync  3.1.0
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 
123 
124 extern void totemnet_stats_clear (void *net_context);
125 
126 extern const char *totemnet_iface_print (void *net_context);
127 
128 extern int totemnet_ifaces_get (
129  void *net_context,
130  char ***status,
131  unsigned int *iface_count);
132 
133 extern int totemnet_token_target_set (
134  void *net_context,
135  unsigned int target_nodeid);
136 
137 extern int totemnet_crypto_set (
138  void *net_context,
139  const char *cipher_type,
140  const char *hash_type);
141 
142 extern int totemnet_recv_mcast_empty (
143  void *net_context);
144 
145 extern int totemnet_member_add (
146  void *net_context,
147  const struct totem_ip_address *local,
148  const struct totem_ip_address *member,
149  int ring_no);
150 
151 extern int totemnet_member_remove (
152  void *net_context,
153  const struct totem_ip_address *member,
154  int ring_no);
155 
156 extern int totemnet_member_set_active (
157  void *net_context,
158  const struct totem_ip_address *member,
159  int active);
160 
161 #endif /* TOTEMNET_H_DEFINED */
The totem_ip_address struct.
Definition: coroapi.h:111
unsigned int target_nodeid
Definition: totem.h:5
cfg_message_crypto_reconfig_phase_t
Definition: totem.h:154
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:463
int totemnet_member_remove(void *net_context, const struct totem_ip_address *member, int ring_no)
Definition: totemnet.c:532
int totemnet_token_send(void *net_context, const void *msg, unsigned int msg_len)
Definition: totemnet.c:406
int totemnet_send_flush(void *net_context)
Definition: totemnet.c:396
const char * totemnet_iface_print(void *net_context)
void totemnet_buffer_release(void *net_context, void *ptr)
Definition: totemnet.c:367
int totemnet_mcast_flush_send(void *net_context, const void *msg, unsigned int msg_len)
Definition: totemnet.c:418
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:512
int totemnet_finalize(void *net_context)
Definition: totemnet.c:298
int totemnet_crypto_set(void *net_context, const char *cipher_type, const char *hash_type)
Definition: totemnet.c:284
int totemnet_ifaces_get(void *net_context, char ***status, unsigned int *iface_count)
Definition: totemnet.c:476
int totemnet_processor_count_set(void *net_context, int processor_count)
Definition: totemnet.c:375
int totemnet_token_target_set(void *net_context, unsigned int target_nodeid)
Definition: totemnet.c:489
int totemnet_recv_flush(void *net_context)
Definition: totemnet.c:386
int totemnet_iface_check(void *net_context)
Definition: totemnet.c:444
int totemnet_mcast_noflush_send(void *net_context, const void *msg, unsigned int msg_len)
Definition: totemnet.c:431
int totemnet_recv_mcast_empty(void *net_context)
Definition: totemnet.c:501
int totemnet_net_mtu_adjust(void *net_context, struct totem_config *totem_config)
Definition: totemnet.c:454
void totemnet_stats_clear(void *net_context)
Definition: totemnet.c:598
int totemnet_reconfigure(void *net_context, struct totem_config *totem_config)
Definition: totemnet.c:568
int totemnet_member_set_active(void *net_context, const struct totem_ip_address *member, int active)
Definition: totemnet.c:550
void * totemnet_buffer_alloc(void *net_context)
Definition: totemnet.c:359
int totemnet_crypto_reconfigure_phase(void *net_context, struct totem_config *totem_config, cfg_message_crypto_reconfig_phase_t phase)
Definition: totemnet.c:582
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.
struct srp_addr system_from
Definition: totemsrp.c:1