corosync  3.0.1
coroapi.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008-2012 Red Hat, Inc.
3  *
4  * All rights reserved.
5  *
6  * Author: Steven Dake (sdake@redhat.com)
7  *
8  * This software licensed under BSD license, the text of which follows:
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions are met:
12  *
13  * - Redistributions of source code must retain the above copyright notice,
14  * this list of conditions and the following disclaimer.
15  * - Redistributions in binary form must reproduce the above copyright notice,
16  * this list of conditions and the following disclaimer in the documentation
17  * and/or other materials provided with the distribution.
18  * - Neither the name of the MontaVista Software, Inc. nor the names of its
19  * contributors may be used to endorse or promote products derived from this
20  * software without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
26  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
32  * THE POSSIBILITY OF SUCH DAMAGE.
33  */
34 #ifndef COROAPI_H_DEFINED
35 #define COROAPI_H_DEFINED
36 
37 #include <config.h>
38 
39 #include <stdio.h>
40 #ifdef HAVE_SYS_UIO_H
41 #include <sys/uio.h>
42 #endif
43 #include <corosync/hdb.h>
44 #include <qb/qbloop.h>
45 #include <corosync/swab.h>
46 
50 typedef struct {
51  uint32_t nodeid __attribute__((aligned(8)));
52  void *conn __attribute__((aligned(8)));
53 } mar_message_source_t __attribute__((aligned(8)));
54 
59 static inline void swab_mar_message_source_t (mar_message_source_t *to_swab)
60 {
61  swab32 (to_swab->nodeid);
62  /*
63  * if it is from a byteswapped machine, then we can safely
64  * ignore its conn info data structure since this is only
65  * local to the machine
66  */
67  to_swab->conn = NULL;
68 }
69 
70 #ifndef TIMER_HANDLE_T
71 
74 typedef qb_loop_timer_handle corosync_timer_handle_t;
75 #define TIMER_HANDLE_T 1
76 #endif
77 
82  const void *group;
83  size_t group_len;
84 };
85 
86 #define TOTEMIP_ADDRLEN (sizeof(struct in6_addr))
87 
88 #define INTERFACE_MAX 8
89 
90 #ifndef MESSAGE_QUEUE_MAX
91 #ifdef HAVE_SMALL_MEMORY_FOOTPRINT
92 #define PROCESSOR_COUNT_MAX 16
93 #define MESSAGE_SIZE_MAX 1024*64
94 #define MESSAGE_QUEUE_MAX 512
95 #else
96 #define PROCESSOR_COUNT_MAX 384
97 #define MESSAGE_SIZE_MAX 1024*1024
98 #define MESSAGE_QUEUE_MAX ((4 * MESSAGE_SIZE_MAX) / totem_config->net_mtu)
99 #endif /* HAVE_SMALL_MEMORY_FOOTPRINT */
100 #endif /* MESSAGE_QUEUE_MAX */
101 
102 #define TOTEM_AGREED 0
103 #define TOTEM_SAFE 1
104 
105 #define MILLI_2_NANO_SECONDS 1000000ULL
106 
107 #if !defined(TOTEM_IP_ADDRESS)
108 
112  unsigned int nodeid;
113  unsigned short family;
114  unsigned char addr[TOTEMIP_ADDRLEN];
115 } __attribute__((packed));
116 #endif
117 
118 #if !defined(MEMB_RING_ID)
119 
122 struct memb_ring_id {
123  unsigned int nodeid;
124  unsigned long long seq;
125 } __attribute__((packed));
126 #endif
127 
128 #if !defined(TOTEM_CONFIGURATION_TYPE)
129 
135 };
136 #endif
137 
138 #if !defined(TOTEM_CALLBACK_TOKEN_TYPE)
139 
145 };
146 #endif
147 
154 };
155 #define corosync_lib_flow_control cs_lib_flow_control
156 #define COROSYNC_LIB_FLOW_CONTROL_REQUIRED CS_LIB_FLOW_CONTROL_REQUIRED
157 #define COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED CS_LIB_FLOW_CONTROL_NOT_REQUIRED
158 
163  CS_LIB_DISALLOW_INQUORATE = 0, /* default */
165 };
166 
167 #if !defined (COROSYNC_FLOW_CONTROL_STATE)
168 
174 };
175 #define corosync_flow_control_state cs_flow_control_state
176 #define CS_FLOW_CONTROL_STATE_DISABLED CS_FLOW_CONTROL_STATE_DISABLED
177 #define CS_FLOW_CONTROL_STATE_ENABLED CS_FLOW_CONTROL_STATE_ENABLED
178 
179 #endif /* COROSYNC_FLOW_CONTROL_STATE */
180 
183 typedef enum {
193 #define corosync_fatal_error_t cs_fatal_error_t;
194 
195 #ifndef QUORUM_H_DEFINED
196 
199 typedef void (*quorum_callback_fn_t) (int quorate, void *context);
200 
205  int (*quorate) (void);
206  int (*register_callback) (quorum_callback_fn_t callback_fn, void *contexxt);
207  int (*unregister_callback) (quorum_callback_fn_t callback_fn, void *context);
208 };
209 
213 typedef void (*sync_callback_fn_t) (
214  const unsigned int *view_list,
215  size_t view_list_entries,
216  int primary_designated,
217  struct memb_ring_id *ring_id);
218 
219 #endif /* QUORUM_H_DEFINED */
220 
221 
226  /*
227  * Time and timer APIs
228  */
229  int (*timer_add_duration) (
230  unsigned long long nanoseconds_in_future,
231  void *data,
232  void (*timer_nf) (void *data),
233  corosync_timer_handle_t *handle);
234 
235  int (*timer_add_absolute) (
236  unsigned long long nanoseconds_from_epoch,
237  void *data,
238  void (*timer_fn) (void *data),
239  corosync_timer_handle_t *handle);
240 
241  void (*timer_delete) (
242  corosync_timer_handle_t timer_handle);
243 
244  unsigned long long (*timer_time_get) (void);
245 
246  unsigned long long (*timer_expire_time_get) (
247  corosync_timer_handle_t timer_handle);
248 
249  /*
250  * IPC APIs
251  */
252  void (*ipc_source_set) (mar_message_source_t *source, void *conn);
253 
254  int (*ipc_source_is_local) (const mar_message_source_t *source);
255 
256  void *(*ipc_private_data_get) (void *conn);
257 
258  int (*ipc_response_send) (void *conn, const void *msg, size_t mlen);
258 
#ifn" rel="stylesheet" type="text/css" /> 248 <="l00249">totem_logging_configuration< name="l00252">#ifn" rel="stylesheet" type="text/css" /> coroapi.h.

<0035">35 of file config.h.

#GaիXz߿C~֨*"> 437 corosync_tpg_group {
config.h.

Definitiona c>  Ts="memItemRight" valign="bottom"> 190  corosync_tpg_group {
.

#define corosync_lib_flow_control   >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*0247"> Definitiona c>96>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>1>>>>>>>>>*0247"> <"> 286 <1div> Definitiona c>96>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>1>>>>>b4511f2aa7a5702d845bf573"p class="definition">Definitiona c>96>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>9"el" hrep class="definition">Definitiona c>96>>>>>>>>h.html#a9e9b6764b88acb4369adda0216ae8b((((lineno"> ThKunsigned shor 5v> Definitiona c>96>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>1>>>>>b4511f2aa7a5702d b./usr/share/doc/corosync/api/html/corgcagab20 hrep clZss="definition">Definitiona c>970>>>>>>>h.htc32165cda71fad0c6a">enum   12  * *msg, *msg, 327  doxygen 1.8.13 "comment"> * 1.8.13  

Definilass="footer" src="doxygen.png" [reprocessor">#ifndef COROAPI_H_DEFINED

35 

Definilb4s="footer" src="doxygen.png" [r>>>>>>>>>>>>>>>>>83547ac7a45bf573">

75  doxygenpan> <span class= such a type exists and the standard inclocessor">#include <sys/uio.h> *msg, size_t mlepi_8h_source.html#l00151">151 of file 155896#2c?png" alt="doxygenpan>  l_error_t cs_fatal_error_t;#include <sys/uio.h>Definitiona c>970>>>>>>>h.htc3216le el" href="group__cmap__corosync.html#ga10dc45ss="definition">Definilass="footer" src="doxygen.png" [reprocessor"e) 12  *

102  .ipc_source_is_local =   enu160;fma"> such a type exists and the standard inclocessor">#include <sys/uio.h> size_t s="line" href="config_8h.html#adca0e8e7c3827189abcd6ceae6f60c330>,bf160;

<> " href="coroapi_8h.html#ab6ac9ab27caf75c5e066c05a042026e1"> 183 

*/
67  to_swab->con <sys/uio.h>Definitiona c>970>>>>>>>h.htc3216le el" href=e89ff10923f9emitem:ga04bb01d31554a4292442b0081bccc813">

enu160; 1.8.13 *<
quorum_car> Definition at line 76 of file @IW]By1b=0fc5"c436a71ab18e11aM#ooter"> Ger class=on Fri Mar 6 2020 10:27:50 for aorosync by   doxygen j24> 1.8.13 +l160; 92html#a8b0920370f0b6d298aa7ef83642195eoxygen.org/indix.html">   190<1d13*33d6daa0e0 e prefix is tracked, instead of key only (so "totem.pan class="lineno"> 12$#91line" h2a08a5e23cdb3c7903c2723d8">COROSYNC_corosync.html#gadbc3204b4cf5f9n class="lineno"> 130  lass="fieldname">35 of fil1101ine"><> #160;  
382 en2ass="memproto"> api_8h.html#a30f3443d4a2be8__cfg__node__address__t.html">corosync_cfg_node_address_t *  <&d71fka2b6369c2d99d23cH
#define TIMER_HANDLE_T   1