2 * Copyright (c) 2008-2012 Red Hat, Inc.
6 * Author: Steven Dake (sdake@redhat.com)
8 * This software licensed under BSD license, the text of which follows:
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions are met:
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.
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.
40 #include <qb/qbutil.h>
41 #include <qb/qbloop.h>
42 #include <qb/qbipcs.h>
44 #include <corosync/corotypes.h>
45 #include <corosync/totem/totempg.h>
46 #include <corosync/totem/totemip.h>
47 #include <corosync/totem/totem.h>
48 #include <corosync/logsys.h>
57 LOGSYS_DECLARE_SUBSYS ("APIDEF");
60 * Remove compile warnings about type name changes in corosync_tpg_group
62 typedef int (*typedef_tpg_join
) (
64 const struct corosync_tpg_group
*,
67 typedef int (*typedef_tpg_leave
) (void *,
68 const struct corosync_tpg_group
*,
71 typedef int (*typedef_tpg_groups_mcast_groups
) (
73 const struct corosync_tpg_group
*,
78 typedef int (*typedef_tpg_groups_send_ok
) (
80 const struct corosync_tpg_group
*,
85 static inline void _corosync_public_exit_error (cs_fatal_error_t err
,
88 __attribute__((noreturn
));
89 static inline void _corosync_public_exit_error (
90 cs_fatal_error_t err
, const char *file
, unsigned int line
)
92 _corosync_exit_error (err
, file
, line
);
95 static struct corosync_api_v1 apidef_corosync_api_v1
= {
96 .timer_add_duration
= corosync_timer_add_duration
,
97 .timer_add_absolute
= corosync_timer_add_absolute
,
98 .timer_delete
= corosync_timer_delete
,
99 .timer_time_get
= cs_timer_time_get
,
100 .timer_expire_time_get
= corosync_timer_expire_time_get
,
101 .ipc_source_set
= message_source_set
,
102 .ipc_source_is_local
= message_source_is_local
,
103 .ipc_private_data_get
= cs_ipcs_private_data_get
,
104 .ipc_response_iov_send
= cs_ipcs_response_iov_send
,
105 .ipc_response_send
= cs_ipcs_response_send
,
106 .ipc_dispatch_send
= cs_ipcs_dispatch_send
,
107 .ipc_dispatch_iov_send
= cs_ipcs_dispatch_iov_send
,
108 .ipc_refcnt_inc
= cs_ipc_refcnt_inc
,
109 .ipc_refcnt_dec
= cs_ipc_refcnt_dec
,
110 .totem_nodeid_get
= totempg_my_nodeid_get
,
111 .totem_family_get
= totempg_my_family_get
,
112 .totem_mcast
= main_mcast
,
113 .totem_ifaces_get
= totempg_ifaces_get
,
114 .totem_ifaces_print
= totempg_ifaces_print
,
115 .totem_ip_print
= totemip_print
,
116 .totem_crypto_set
= totempg_crypto_set
,
117 .totem_callback_token_create
= totempg_callback_token_create
,
118 .totem_get_stats
= totempg_get_stats
,
119 .tpg_init
= totempg_groups_initialize
,
120 .tpg_exit
= NULL
, /* missing from totempg api */
121 .tpg_join
= (typedef_tpg_join
)totempg_groups_join
,
122 .tpg_leave
= (typedef_tpg_leave
)totempg_groups_leave
,
123 .tpg_joined_mcast
= totempg_groups_mcast_joined
,
124 .tpg_joined_reserve
= totempg_groups_joined_reserve
,
125 .tpg_joined_release
= totempg_groups_joined_release
,
126 .tpg_groups_mcast
= (typedef_tpg_groups_mcast_groups
)totempg_groups_mcast_groups
,
127 .tpg_groups_reserve
= NULL
,
128 .tpg_groups_release
= NULL
,
129 .schedwrk_create
= schedwrk_create
,
130 .schedwrk_create_nolock
= schedwrk_create_nolock
,
131 .schedwrk_destroy
= schedwrk_destroy
,
132 .sync_request
= NULL
, //sync_request,
133 .quorum_is_quorate
= corosync_quorum_is_quorate
,
134 .quorum_register_callback
= corosync_quorum_register_callback
,
135 .quorum_unregister_callback
= corosync_quorum_unregister_callback
,
136 .quorum_initialize
= corosync_quorum_initialize
,
137 .error_memory_failure
= _corosync_out_of_memory_error
,
138 .fatal_error
= _corosync_public_exit_error
,
139 .shutdown_request
= corosync_shutdown_request
,
140 .state_dump
= corosync_state_dump
,
141 .poll_handle_get
= cs_poll_handle_get
,
142 .poll_dispatch_add
= cs_poll_dispatch_add
,
143 .poll_dispatch_delete
= cs_poll_dispatch_delete
146 struct corosync_api_v1
*apidef_get (void)
148 return (&apidef_corosync_api_v1
);