]>
Commit | Line | Data |
---|---|---|
5613db03 SD |
1 | /* |
2 | * Copyright (c) 2005 MontaVista Software, Inc. | |
d45965ec | 3 | * Copyright (c) 2006-2007, 2009 Red Hat, Inc. |
5613db03 SD |
4 | * |
5 | * All rights reserved. | |
6 | * | |
46b01638 | 7 | * Author: Steven Dake (sdake@redhat.com) |
5613db03 SD |
8 | * |
9 | * This software licensed under BSD license, the text of which follows: | |
904a10ed | 10 | * |
5613db03 SD |
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 | */ | |
5da4d547 RB |
35 | |
36 | /** | |
37 | * @file | |
38 | * Totem Network interface - also does encryption/decryption | |
39 | * | |
40 | * depends on poll abstraction, POSIX, IPV4 | |
41 | */ | |
42 | ||
5613db03 SD |
43 | #ifndef TOTEMNET_H_DEFINED |
44 | #define TOTEMNET_H_DEFINED | |
45 | ||
46 | #include <sys/types.h> | |
47 | #include <sys/socket.h> | |
48 | ||
e1f53138 | 49 | #include <corosync/totem/totem.h> |
5613db03 | 50 | |
5613db03 SD |
51 | #define TOTEMNET_NOFLUSH 0 |
52 | #define TOTEMNET_FLUSH 1 | |
5613db03 | 53 | |
5da4d547 | 54 | /** |
5613db03 SD |
55 | * Create an instance |
56 | */ | |
57 | extern int totemnet_initialize ( | |
fce8a3c3 | 58 | qb_loop_t *poll_handle, |
5eae4c13 | 59 | void **net_context, |
5613db03 | 60 | struct totem_config *totem_config, |
b7635ab9 | 61 | totemsrp_stats_t *stats, |
5613db03 SD |
62 | void *context, |
63 | ||
64 | void (*deliver_fn) ( | |
65 | void *context, | |
d45965ec | 66 | const void *msg, |
69857efb JF |
67 | unsigned int msg_len, |
68 | const struct sockaddr_storage *system_from), | |
5613db03 SD |
69 | |
70 | void (*iface_change_fn) ( | |
71 | void *context, | |
268cde6e CC |
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), | |
f9f663f4 SD |
78 | |
79 | void (*target_set_completed) ( | |
80 | void *context)); | |
5613db03 | 81 | |
dddaeef2 ZB |
82 | extern void *totemnet_buffer_alloc (void *net_context); |
83 | ||
84 | extern void totemnet_buffer_release (void *net_context, void *ptr); | |
85 | ||
5613db03 | 86 | extern int totemnet_processor_count_set ( |
5eae4c13 | 87 | void *net_context, |
5613db03 SD |
88 | int processor_count); |
89 | ||
90 | extern int totemnet_token_send ( | |
5eae4c13 | 91 | void *net_context, |
20d1d5fa SD |
92 | const void *msg, |
93 | unsigned int msg_len); | |
5613db03 SD |
94 | |
95 | extern int totemnet_mcast_flush_send ( | |
5eae4c13 | 96 | void *net_context, |
20d1d5fa SD |
97 | const void *msg, |
98 | unsigned int msg_len); | |
5613db03 SD |
99 | |
100 | extern int totemnet_mcast_noflush_send ( | |
5eae4c13 | 101 | void *net_context, |
20d1d5fa SD |
102 | const void *msg, |
103 | unsigned int msg_len); | |
5613db03 | 104 | |
ddb5214c JF |
105 | extern int totemnet_recv_flush (void *net_context); |
106 | ||
5eae4c13 | 107 | extern int totemnet_send_flush (void *net_context); |
5613db03 | 108 | |
294a629f CC |
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 | ||
5eae4c13 | 114 | extern int totemnet_iface_check (void *net_context); |
5613db03 | 115 | |
5eae4c13 | 116 | extern int totemnet_finalize (void *net_context); |
5613db03 | 117 | |
5eae4c13 | 118 | extern int totemnet_net_mtu_adjust (void *net_context, struct totem_config *totem_config); |
5613db03 | 119 | |
16f616b6 CC |
120 | extern int totemnet_reconfigure (void *net_context, struct totem_config *totem_config); |
121 | ||
5f71445b CC |
122 | extern int totemnet_crypto_reconfigure_phase (void *net_context, struct totem_config *totem_config, cfg_message_crypto_reconfig_phase_t phase); |
123 | ||
d9dfd41e CC |
124 | extern void totemnet_stats_clear (void *net_context); |
125 | ||
5eae4c13 | 126 | extern const char *totemnet_iface_print (void *net_context); |
483a9baa | 127 | |
9e7f62d2 CC |
128 | extern int totemnet_nodestatus_get ( |
129 | void *net_context, | |
130 | unsigned int nodeid, | |
131 | struct totem_node_status *node_status); | |
132 | ||
268cde6e | 133 | extern int totemnet_ifaces_get ( |
5eae4c13 | 134 | void *net_context, |
268cde6e CC |
135 | char ***status, |
136 | unsigned int *iface_count); | |
483a9baa SD |
137 | |
138 | extern int totemnet_token_target_set ( | |
5eae4c13 | 139 | void *net_context, |
fc8580bd | 140 | unsigned int target_nodeid); |
483a9baa | 141 | |
e9660ee6 | 142 | extern int totemnet_crypto_set ( |
5eae4c13 | 143 | void *net_context, |
3b7c2f05 JF |
144 | const char *cipher_type, |
145 | const char *hash_type); | |
e9660ee6 | 146 | |
e448603f | 147 | extern int totemnet_recv_mcast_empty ( |
5eae4c13 | 148 | void *net_context); |
e448603f | 149 | |
bb05aed9 SD |
150 | extern int totemnet_member_add ( |
151 | void *net_context, | |
268cde6e CC |
152 | const struct totem_ip_address *local, |
153 | const struct totem_ip_address *member, | |
154 | int ring_no); | |
bb05aed9 SD |
155 | |
156 | extern int totemnet_member_remove ( | |
157 | void *net_context, | |
268cde6e CC |
158 | const struct totem_ip_address *member, |
159 | int ring_no); | |
bb05aed9 | 160 | |
4c717942 JF |
161 | extern int totemnet_member_set_active ( |
162 | void *net_context, | |
163 | const struct totem_ip_address *member, | |
164 | int active); | |
165 | ||
5613db03 | 166 | #endif /* TOTEMNET_H_DEFINED */ |