4 Copyright (C) Martin Schwenke 2011
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, see <http://www.gnu.org/licenses/>.
23 #ifdef CTDB_TEST_OVERRIDE_MAIN
25 /* Define our own main() and usage() functions */
26 #define main(argc, argv) main_foobar(argc, argv)
27 int main_foobar(int argc
, const char **argv
);
28 #define usage usage_foobar
30 #endif /* CTDB_TEST_USE_MAIN */
32 #define ctdb_cmdline_client(x, y) \
33 ctdb_cmdline_client_stub(x, y)
34 #define tevent_context_init(x) \
35 tevent_context_init_stub(x)
36 #define ctdb_ctrl_getnodemap(ctdb, timelimit, pnn, tmp_ctx, nodemap) \
37 ctdb_ctrl_getnodemap_stub(ctdb, timelimit, pnn, tmp_ctx, nodemap)
38 #define ctdb_ctrl_getnodesfile(ctdb, timeout, destnode, mem_ctx, nodemap) \
39 ctdb_ctrl_getnodesfile_stub(ctdb, timeout, destnode, mem_ctx, nodemap)
40 #define ctdb_ctrl_get_ifaces(ctdb, timelimit, pnn, tmp_ctx, ifaces) \
41 ctdb_ctrl_get_ifaces_stub(ctdb, timelimit, pnn, tmp_ctx, ifaces)
42 #define ctdb_ctrl_getpnn(ctdb, timelimit, pnn) \
43 ctdb_ctrl_getpnn_stub(ctdb, timelimit, pnn)
44 #define ctdb_ctrl_getrecmode(ctdb, tmp_ctx, timelimit, pnn, recmode) \
45 ctdb_ctrl_getrecmode_stub(ctdb, tmp_ctx, timelimit, pnn, recmode)
46 #define ctdb_ctrl_setrecmode(ctdb, timeout, destnode, recmode) \
47 ctdb_ctrl_setrecmode_stub(ctdb, timeout, destnode, recmode)
48 #define ctdb_ctrl_getrecmaster(ctdb, tmp_ctx, timelimit, pnn, recmaster) \
49 ctdb_ctrl_getrecmaster_stub(ctdb, tmp_ctx, timelimit, pnn, recmaster)
50 #define ctdb_ctrl_getvnnmap(ctdb, timelimit, pnn, tmp_ctx, vnnmap) \
51 ctdb_ctrl_getvnnmap_stub(ctdb, timelimit, pnn, tmp_ctx, vnnmap)
52 #define ctdb_ctrl_getdebseqnum(ctdb, timelimit, pnn, db_id, seqnum) \
53 ctdb_ctrl_getvnnmap_stub(ctdb, timelimit, pnn, db_id, seqnum)
54 #define ctdb_client_set_message_handler(ctdb, srvid, handler, private_data) \
55 ctdb_client_set_message_handler_stub(ctdb, srvid, handler, private_data)
56 #define ctdb_client_remove_message_handler(ctdb, srvid, private_data) \
57 ctdb_client_remove_message_handler_stub(ctdb, srvid, private_data)
58 #define ctdb_client_send_message(ctdb, pnn, srvid, data) \
59 ctdb_client_send_message_stub(ctdb, pnn, srvid, data)
60 #define ctdb_client_check_message_handlers(ctdb, ids, argc, result) \
61 ctdb_client_check_message_handlers_stub(ctdb, ids, argc, result)
62 #define ctdb_ctrl_getcapabilities(ctdb, timeout, destnode, capabilities) \
63 ctdb_ctrl_getcapabilities_stub(ctdb, timeout, destnode, capabilities)
64 #define ctdb_ctrl_reload_nodes_file(ctdb, timeout, destnode) \
65 ctdb_ctrl_reload_nodes_file_stub(ctdb, timeout, destnode)
66 #define ctdb_sys_have_ip(addr) \
67 ctdb_sys_have_ip_stub(addr)
68 #define ctdb_client_async_control(ctdb, opcode, nodes, srvid, timeout, dont_log_errors, data, client_callback, fail_callback, callback_data) \
69 ctdb_client_async_control_stub(ctdb, opcode, nodes, srvid, timeout, dont_log_errors, data, client_callback, fail_callback, callback_data)
70 #define ctdb_get_capabilities(ctdb, mem_ctx, timeout, nodemap) \
71 ctdb_get_capabilities_stub(ctdb, mem_ctx, timeout, nodemap)
73 #include "tools/ctdb.c"
75 #ifndef CTDB_TEST_USE_MAIN
78 #endif /* CTDB_TEST_USE_MAIN */
80 #undef ctdb_cmdline_client
81 #undef tevent_context_init
82 /* This is called in client/ctdb_client.c so needs a declaration... */
83 struct ctdb_context
*ctdb_cmdline_client(struct tevent_context
*ev
,
84 struct timeval req_timeout
);
85 struct tevent_context
*tevent_context_init(TALLOC_CTX
*mem_ctx
);
86 #include "common/cmdline.c"
88 #undef ctdb_ctrl_getnodemap
89 #undef ctdb_ctrl_getnodesfile
90 #undef ctdb_ctrl_get_ifaces
91 #undef ctdb_ctrl_getpnn
92 #undef ctdb_ctrl_getrecmode
93 #undef ctdb_ctrl_setrecmode
94 #undef ctdb_ctrl_getrecmaster
95 #undef ctdb_ctrl_getvnnmap
96 #undef ctdb_ctrl_getdebseqnum
97 #undef ctdb_client_set_message_handler
98 #undef ctdb_client_remove_message_handler
99 #undef ctdb_client_send_message
100 #undef ctdb_client_check_message_handlers
101 #undef ctdb_ctrl_getcapabilities
102 #undef ctdb_ctrl_reload_nodes_file
103 #undef ctdb_sys_have_ip
104 #undef ctdb_client_async_control
105 #undef ctdb_get_capabilities
107 int ctdb_ctrl_getnodemap(struct ctdb_context
*ctdb
,
108 struct timeval timeout
, uint32_t destnode
,
109 TALLOC_CTX
*mem_ctx
, struct ctdb_node_map
**nodemap
);
110 int ctdb_ctrl_getnodesfile(struct ctdb_context
*ctdb
,
111 struct timeval timeout
, uint32_t destnode
,
113 struct ctdb_node_map
**nodemap
);
114 int ctdb_ctrl_get_ifaces(struct ctdb_context
*ctdb
,
115 struct timeval timeout
, uint32_t destnode
,
117 struct ctdb_control_get_ifaces
**ifaces
);
118 int ctdb_ctrl_getpnn(struct ctdb_context
*ctdb
, struct timeval timeout
,
120 int ctdb_ctrl_getrecmode(struct ctdb_context
*ctdb
,
121 TALLOC_CTX
*mem_ctx
, struct timeval timeout
,
122 uint32_t destnode
, uint32_t *recmode
);
123 int ctdb_ctrl_setrecmode(struct ctdb_context
*ctdb
, struct timeval timeout
,
124 uint32_t destnode
, uint32_t recmode
);
125 int ctdb_ctrl_getrecmaster(struct ctdb_context
*ctdb
,
126 TALLOC_CTX
*mem_ctx
, struct timeval timeout
,
127 uint32_t destnode
, uint32_t *recmaster
);
128 int ctdb_ctrl_getvnnmap(struct ctdb_context
*ctdb
,
129 struct timeval timeout
, uint32_t destnode
,
130 TALLOC_CTX
*mem_ctx
, struct ctdb_vnn_map
**vnnmap
);
131 int ctdb_ctrl_getdbseqnum(struct ctdb_context
*ctdb
, struct timeval timeout
,
132 uint32_t destnode
, uint32_t dbid
, uint64_t *seqnum
);
133 int ctdb_client_set_message_handler(struct ctdb_context
*ctdb
,
135 ctdb_msg_fn_t handler
,
137 int ctdb_client_remove_message_handler(struct ctdb_context
*ctdb
,
140 int ctdb_client_send_message(struct ctdb_context
*ctdb
,
142 uint64_t srvid
, TDB_DATA data
);
143 int ctdb_client_check_message_handlers(struct ctdb_context
*ctdb
,
144 uint64_t *ids
, uint32_t num
,
146 int ctdb_ctrl_getcapabilities(struct ctdb_context
*ctdb
,
147 struct timeval timeout
, uint32_t destnode
,
148 uint32_t *capabilities
);
149 int ctdb_ctrl_reload_nodes_file(struct ctdb_context
*ctdb
,
150 struct timeval timeout
, uint32_t destnode
);
151 bool ctdb_sys_have_ip(ctdb_sock_addr
*addr
);
153 ctdb_client_async_control(struct ctdb_context
*ctdb
,
154 enum ctdb_controls opcode
,
157 struct timeval timeout
,
158 bool dont_log_errors
,
160 client_async_callback client_callback
,
161 client_async_callback fail_callback
,
162 void *callback_data
);
163 struct ctdb_node_capabilities
*
164 ctdb_get_capabilities(struct ctdb_context
*ctdb
,
166 struct timeval timeout
,
167 struct ctdb_node_map
*nodemap
);
170 #include "tools/ctdb_vacuum.c"
172 /* CTDB_COMMON_OBJ */
173 #include "common/ctdb_io.c"
174 #include "common/ctdb_util.c"
175 #include "common/ctdb_ltdb.c"
176 #include "common/ctdb_message.c"
177 #include "common/rb_tree.c"
178 #include "common/system_common.c"
179 #include "common/ctdb_logging.c"
180 #include "common/ctdb_fork.c"
181 #include "common/system_util.c"
183 /* CTDB_CLIENT_OBJ */
184 #include "client/ctdb_client.c"
187 #include "ctdb_test_stubs.c"
189 #endif /* _CTDBD_TEST_C */