corosync  2.3.6
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  int interface_no,
63  void *context,
64 
65  void (*deliver_fn) (
66  void *context,
67  const void *msg,
68  unsigned int msg_len),
69 
70  void (*iface_change_fn) (
71  void *context,
72  const struct totem_ip_address *iface_address),
73 
74  void (*target_set_completed) (
75  void *context));
76 
77 extern void *totemnet_buffer_alloc (void *net_context);
78 
79 extern void totemnet_buffer_release (void *net_context, void *ptr);
80 
82  void *net_context,
83  int processor_count);
84 
85 extern int totemnet_token_send (
86  void *net_context,
87  const void *msg,
88  unsigned int msg_len);
89 
90 extern int totemnet_mcast_flush_send (
91  void *net_context,
92  const void *msg,
93  unsigned int msg_len);
94 
95 extern int totemnet_mcast_noflush_send (
96  void *net_context,
97  const void *msg,
98  unsigned int msg_len);
99 
100 extern int totemnet_recv_flush (void *net_context);
101 
102 extern int totemnet_send_flush (void *net_context);
103 
104 extern int totemnet_iface_check (void *net_context);
105 
106 extern int totemnet_finalize (void *net_context);
107 
108 extern int totemnet_net_mtu_adjust (void *net_context, struct totem_config *totem_config);
109 
110 extern const char *totemnet_iface_print (void *net_context);
111 
112 extern int totemnet_iface_get (
113  void *net_context,
114  struct totem_ip_address *addr);
115 
116 extern int totemnet_token_target_set (
117  void *net_context,
118  const struct totem_ip_address *token_target);
119 
120 extern int totemnet_crypto_set (
121  void *net_context,
122  const char *cipher_type,
123  const char *hash_type);
124 
125 extern int totemnet_recv_mcast_empty (
126  void *net_context);
127 
128 extern int totemnet_member_add (
129  void *net_context,
130  const struct totem_ip_address *member);
131 
132 extern int totemnet_member_remove (
133  void *net_context,
134  const struct totem_ip_address *member);
135 
136 extern int totemnet_member_set_active (
137  void *net_context,
138  const struct totem_ip_address *member,
139  int active);
140 
141 #endif /* TOTEMNET_H_DEFINED */
int totemnet_mcast_flush_send(void *net_context, const void *msg, unsigned int msg_len)
Definition: totemnet.c:382
int totemnet_recv_mcast_empty(void *net_context)
Definition: totemnet.c:459
The totem_ip_address struct.
Definition: coroapi.h:111
unsigned char addr[TOTEMIP_ADDRLEN]
Definition: coroapi.h:77
int totemnet_iface_check(void *net_context)
Definition: totemnet.c:408
void * totemnet_buffer_alloc(void *net_context)
Definition: totemnet.c:323
int totemnet_finalize(void *net_context)
Definition: totemnet.c:267
int totemnet_net_mtu_adjust(void *net_context, struct totem_config *totem_config)
Definition: totemnet.c:418
int totemnet_recv_flush(void *net_context)
Definition: totemnet.c:350
const char * totemnet_iface_print(void *net_context)
Definition: totemnet.c:427
int totemnet_mcast_noflush_send(void *net_context, const void *msg, unsigned int msg_len)
Definition: totemnet.c:395
int totemnet_token_send(void *net_context, const void *msg, unsigned int msg_len)
Definition: totemnet.c:370
int totemnet_member_set_active(void *net_context, const struct totem_ip_address *member, int active)
Definition: totemnet.c:502
int totemnet_token_target_set(void *net_context, const struct totem_ip_address *token_target)
Definition: totemnet.c:447
int totemnet_iface_get(void *net_context, struct totem_ip_address *addr)
Definition: totemnet.c:435
int totemnet_member_remove(void *net_context, const struct totem_ip_address *member)
Definition: totemnet.c:486
int totemnet_send_flush(void *net_context)
Definition: totemnet.c:360
int totemnet_initialize(qb_loop_t *poll_handle, void **net_context, struct totem_config *totem_config, totemsrp_stats_t *stats, int interface_no, 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_address), void(*target_set_completed)(void *context))
Create an instance.
Definition: totemnet.c:278
int totemnet_processor_count_set(void *net_context, int processor_count)
Definition: totemnet.c:339
int totemnet_crypto_set(void *net_context, const char *cipher_type, const char *hash_type)
Definition: totemnet.c:253
int totemnet_member_add(void *net_context, const struct totem_ip_address *member)
Definition: totemnet.c:470
void totemnet_buffer_release(void *net_context, void *ptr)
Definition: totemnet.c:331