2 CTDB protocol marshalling
4 Copyright (C) Amitay Isaacs 2015
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/>.
20 #ifndef __CTDB_PROTOCOL_API_H__
21 #define __CTDB_PROTOCOL_API_H__
25 #include "protocol/protocol.h"
27 /* From protocol/protocol_types.c */
29 size_t ctdb_ltdb_header_len(struct ctdb_ltdb_header
*header
);
30 void ctdb_ltdb_header_push(struct ctdb_ltdb_header
*header
, uint8_t *buf
);
31 int ctdb_ltdb_header_pull(uint8_t *buf
, size_t buflen
,
32 struct ctdb_ltdb_header
*header
);
34 int ctdb_ltdb_header_extract(TDB_DATA
*data
, struct ctdb_ltdb_header
*header
);
36 size_t ctdb_rec_data_len(struct ctdb_rec_data
*rec
);
37 void ctdb_rec_data_push(struct ctdb_rec_data
*rec
, uint8_t *buf
);
38 int ctdb_rec_data_pull(uint8_t *buf
, size_t buflen
, TALLOC_CTX
*mem_ctx
,
39 struct ctdb_rec_data
**out
);
41 size_t ctdb_rec_buffer_len(struct ctdb_rec_buffer
*recbuf
);
42 void ctdb_rec_buffer_push(struct ctdb_rec_buffer
*recbuf
, uint8_t *buf
);
43 int ctdb_rec_buffer_pull(uint8_t *buf
, size_t buflen
, TALLOC_CTX
*mem_ctx
,
44 struct ctdb_rec_buffer
**out
);
46 struct ctdb_rec_buffer
*ctdb_rec_buffer_init(TALLOC_CTX
*mem_ctx
,
48 int ctdb_rec_buffer_add(TALLOC_CTX
*mem_ctx
, struct ctdb_rec_buffer
*recbuf
,
49 uint32_t reqid
, struct ctdb_ltdb_header
*header
,
50 TDB_DATA key
, TDB_DATA data
);
51 int ctdb_rec_buffer_traverse(struct ctdb_rec_buffer
*recbuf
,
52 ctdb_rec_parser_func_t func
,
55 int ctdb_rec_buffer_write(struct ctdb_rec_buffer
*recbuf
, int fd
);
56 int ctdb_rec_buffer_read(int fd
, TALLOC_CTX
*mem_ctx
,
57 struct ctdb_rec_buffer
**out
);
59 size_t ctdb_server_id_len(struct ctdb_server_id
*sid
);
60 void ctdb_server_id_push(struct ctdb_server_id
*sid
, uint8_t *buf
);
61 int ctdb_server_id_pull(uint8_t *buf
, size_t buflen
,
62 struct ctdb_server_id
*sid
);
64 size_t ctdb_g_lock_len(struct ctdb_g_lock
*lock
);
65 void ctdb_g_lock_push(struct ctdb_g_lock
*lock
, uint8_t *buf
);
66 int ctdb_g_lock_pull(uint8_t *buf
, size_t buflen
, struct ctdb_g_lock
*lock
);
68 size_t ctdb_g_lock_list_len(struct ctdb_g_lock_list
*lock_list
);
69 void ctdb_g_lock_list_push(struct ctdb_g_lock_list
*lock_list
, uint8_t *buf
);
70 int ctdb_g_lock_list_pull(uint8_t *buf
, size_t buflen
, TALLOC_CTX
*mem_ctx
,
71 struct ctdb_g_lock_list
**out
);
73 /* From protocol/protocol_header.c */
75 void ctdb_req_header_fill(struct ctdb_req_header
*h
, uint32_t generation
,
76 uint32_t operation
, uint32_t destnode
,
77 uint32_t srcnode
, uint32_t reqid
);
79 size_t ctdb_req_header_len(struct ctdb_req_header
*h
);
80 void ctdb_req_header_push(struct ctdb_req_header
*h
, uint8_t *buf
);
81 int ctdb_req_header_pull(uint8_t *buf
, size_t buflen
,
82 struct ctdb_req_header
*h
);
84 int ctdb_req_header_verify(struct ctdb_req_header
*h
, uint32_t operation
);
86 /* From protocol/protocol_call.c */
88 size_t ctdb_req_call_len(struct ctdb_req_header
*h
,
89 struct ctdb_req_call
*c
);
91 int ctdb_req_call_push(struct ctdb_req_header
*h
,
92 struct ctdb_req_call
*c
,
93 uint8_t *buf
, size_t *buflen
);
95 int ctdb_req_call_pull(uint8_t *buf
, size_t buflen
,
96 struct ctdb_req_header
*h
,
98 struct ctdb_req_call
*c
);
100 size_t ctdb_reply_call_len(struct ctdb_req_header
*h
,
101 struct ctdb_reply_call
*c
);
103 int ctdb_reply_call_push(struct ctdb_req_header
*h
,
104 struct ctdb_reply_call
*c
,
105 uint8_t *buf
, size_t *buflen
);
107 int ctdb_reply_call_pull(uint8_t *buf
, size_t buflen
,
108 struct ctdb_req_header
*h
,
110 struct ctdb_reply_call
*c
);
112 size_t ctdb_reply_error_len(struct ctdb_req_header
*h
,
113 struct ctdb_reply_error
*c
);
115 int ctdb_reply_error_push(struct ctdb_req_header
*h
,
116 struct ctdb_reply_error
*c
,
117 uint8_t *buf
, size_t *buflen
);
119 int ctdb_reply_error_pull(uint8_t *buf
, size_t buflen
,
120 struct ctdb_req_header
*h
,
122 struct ctdb_reply_error
*c
);
124 size_t ctdb_req_dmaster_len(struct ctdb_req_header
*h
,
125 struct ctdb_req_dmaster
*c
);
127 int ctdb_req_dmaster_push(struct ctdb_req_header
*h
,
128 struct ctdb_req_dmaster
*c
,
129 uint8_t *buf
, size_t *buflen
);
131 int ctdb_req_dmaster_pull(uint8_t *buf
, size_t buflen
,
132 struct ctdb_req_header
*h
,
134 struct ctdb_req_dmaster
*c
);
136 size_t ctdb_reply_dmaster_len(struct ctdb_req_header
*h
,
137 struct ctdb_reply_dmaster
*c
);
139 int ctdb_reply_dmaster_push(struct ctdb_req_header
*h
,
140 struct ctdb_reply_dmaster
*c
,
141 uint8_t *buf
, size_t *buflen
);
143 int ctdb_reply_dmaster_pull(uint8_t *buf
, size_t buflen
,
144 struct ctdb_req_header
*h
,
146 struct ctdb_reply_dmaster
*c
);
148 /* From protocol/protocol_control.c */
150 size_t ctdb_req_control_len(struct ctdb_req_header
*h
,
151 struct ctdb_req_control
*c
);
153 int ctdb_req_control_push(struct ctdb_req_header
*h
,
154 struct ctdb_req_control
*c
,
155 uint8_t *buf
, size_t *buflen
);
157 int ctdb_req_control_pull(uint8_t *buf
, size_t buflen
,
158 struct ctdb_req_header
*h
,
160 struct ctdb_req_control
*c
);
162 size_t ctdb_reply_control_len(struct ctdb_req_header
*h
,
163 struct ctdb_reply_control
*c
);
165 int ctdb_reply_control_push(struct ctdb_req_header
*h
,
166 struct ctdb_reply_control
*c
,
167 uint8_t *buf
, size_t *buflen
);
169 int ctdb_reply_control_pull(uint8_t *buf
, size_t buflen
, uint32_t opcode
,
170 struct ctdb_req_header
*h
,
172 struct ctdb_reply_control
*c
);
174 /* From protocol/protocol_client.c */
176 void ctdb_req_control_process_exists(struct ctdb_req_control
*request
,
178 int ctdb_reply_control_process_exists(struct ctdb_reply_control
*reply
,
181 void ctdb_req_control_statistics(struct ctdb_req_control
*request
);
183 int ctdb_reply_control_statistics(struct ctdb_reply_control
*reply
,
185 struct ctdb_statistics
**stats
);
187 void ctdb_req_control_ping(struct ctdb_req_control
*request
);
188 int ctdb_reply_control_ping(struct ctdb_reply_control
*reply
,
191 void ctdb_req_control_getdbpath(struct ctdb_req_control
*request
,
193 int ctdb_reply_control_getdbpath(struct ctdb_reply_control
*reply
,
194 TALLOC_CTX
*mem_ctx
, const char **db_path
);
196 void ctdb_req_control_getvnnmap(struct ctdb_req_control
*request
);
197 int ctdb_reply_control_getvnnmap(struct ctdb_reply_control
*reply
,
199 struct ctdb_vnn_map
**vnnmap
);
201 void ctdb_req_control_setvnnmap(struct ctdb_req_control
*request
,
202 struct ctdb_vnn_map
*vnnmap
);
203 int ctdb_reply_control_setvnnmap(struct ctdb_reply_control
*reply
);
205 void ctdb_req_control_get_debug(struct ctdb_req_control
*request
);
206 int ctdb_reply_control_get_debug(struct ctdb_reply_control
*reply
,
209 void ctdb_req_control_set_debug(struct ctdb_req_control
*request
,
211 int ctdb_reply_control_set_debug(struct ctdb_reply_control
*reply
);
213 void ctdb_req_control_get_dbmap(struct ctdb_req_control
*request
);
214 int ctdb_reply_control_get_dbmap(struct ctdb_reply_control
*reply
,
216 struct ctdb_dbid_map
**dbmap
);
218 void ctdb_req_control_pull_db(struct ctdb_req_control
*request
,
219 struct ctdb_pulldb
*pulldb
);
220 int ctdb_reply_control_pull_db(struct ctdb_reply_control
*reply
,
222 struct ctdb_rec_buffer
**recbuf
);
224 void ctdb_req_control_push_db(struct ctdb_req_control
*request
,
225 struct ctdb_rec_buffer
*recbuf
);
226 int ctdb_reply_control_push_db(struct ctdb_reply_control
*reply
);
228 void ctdb_req_control_get_recmode(struct ctdb_req_control
*request
);
229 int ctdb_reply_control_get_recmode(struct ctdb_reply_control
*reply
,
232 void ctdb_req_control_set_recmode(struct ctdb_req_control
*request
,
234 int ctdb_reply_control_set_recmode(struct ctdb_reply_control
*reply
);
236 void ctdb_req_control_statistics_reset(struct ctdb_req_control
*request
);
237 int ctdb_reply_control_statistics_reset(struct ctdb_reply_control
*reply
);
239 void ctdb_req_control_db_attach(struct ctdb_req_control
*request
,
240 const char *db_name
);
241 int ctdb_reply_control_db_attach(struct ctdb_reply_control
*reply
,
244 void ctdb_req_control_traverse_start(struct ctdb_req_control
*request
,
245 struct ctdb_traverse_start
*traverse
);
246 int ctdb_reply_control_traverse_start(struct ctdb_reply_control
*reply
);
248 void ctdb_req_control_register_srvid(struct ctdb_req_control
*request
,
250 int ctdb_reply_control_register_srvid(struct ctdb_reply_control
*reply
);
252 void ctdb_req_control_deregister_srvid(struct ctdb_req_control
*request
,
254 int ctdb_reply_control_deregister_srvid(struct ctdb_reply_control
*reply
);
256 void ctdb_req_control_get_dbname(struct ctdb_req_control
*request
,
258 int ctdb_reply_control_get_dbname(struct ctdb_reply_control
*reply
,
259 TALLOC_CTX
*mem_ctx
, const char **db_name
);
261 void ctdb_req_control_enable_seqnum(struct ctdb_req_control
*request
,
263 int ctdb_reply_control_enable_seqnum(struct ctdb_reply_control
*reply
);
265 void ctdb_req_control_update_seqnum(struct ctdb_req_control
*request
,
267 int ctdb_reply_control_update_seqnum(struct ctdb_reply_control
*reply
);
269 void ctdb_req_control_dump_memory(struct ctdb_req_control
*request
);
270 int ctdb_reply_control_dump_memory(struct ctdb_reply_control
*reply
,
271 TALLOC_CTX
*mem_ctx
, const char **mem_str
);
273 void ctdb_req_control_get_pid(struct ctdb_req_control
*request
);
274 int ctdb_reply_control_get_pid(struct ctdb_reply_control
*reply
,
277 void ctdb_req_control_get_recmaster(struct ctdb_req_control
*request
);
278 int ctdb_reply_control_get_recmaster(struct ctdb_reply_control
*reply
,
279 uint32_t *recmaster
);
281 void ctdb_req_control_set_recmaster(struct ctdb_req_control
*request
,
283 int ctdb_reply_control_set_recmaster(struct ctdb_reply_control
*reply
);
285 void ctdb_req_control_freeze(struct ctdb_req_control
*request
,
287 int ctdb_reply_control_freeze(struct ctdb_reply_control
*reply
);
289 void ctdb_req_control_get_pnn(struct ctdb_req_control
*request
);
290 int ctdb_reply_control_get_pnn(struct ctdb_reply_control
*reply
,
293 void ctdb_req_control_shutdown(struct ctdb_req_control
*request
);
294 int ctdb_reply_control_shutdown(struct ctdb_reply_control
*reply
);
296 void ctdb_req_control_get_monmode(struct ctdb_req_control
*request
);
297 int ctdb_reply_control_get_monmode(struct ctdb_reply_control
*reply
,
300 void ctdb_req_control_tcp_client(struct ctdb_req_control
*request
,
301 struct ctdb_connection
*conn
);
302 int ctdb_reply_control_tcp_client(struct ctdb_reply_control
*reply
);
304 void ctdb_req_control_tcp_add(struct ctdb_req_control
*request
,
305 struct ctdb_connection
*conn
);
306 int ctdb_reply_control_tcp_add(struct ctdb_reply_control
*reply
);
308 void ctdb_req_control_tcp_remove(struct ctdb_req_control
*request
,
309 struct ctdb_connection
*conn
);
310 int ctdb_reply_control_tcp_remove(struct ctdb_reply_control
*reply
);
312 void ctdb_req_control_startup(struct ctdb_req_control
*request
);
313 int ctdb_reply_control_startup(struct ctdb_reply_control
*reply
);
315 void ctdb_req_control_set_tunable(struct ctdb_req_control
*request
,
316 struct ctdb_tunable
*tunable
);
317 int ctdb_reply_control_set_tunable(struct ctdb_reply_control
*reply
);
319 void ctdb_req_control_get_tunable(struct ctdb_req_control
*request
,
321 int ctdb_reply_control_get_tunable(struct ctdb_reply_control
*reply
,
324 void ctdb_req_control_list_tunables(struct ctdb_req_control
*request
);
325 int ctdb_reply_control_list_tunables(struct ctdb_reply_control
*reply
,
327 struct ctdb_var_list
**tun_var_list
);
329 void ctdb_req_control_modify_flags(struct ctdb_req_control
*request
,
330 struct ctdb_node_flag_change
*flag_change
);
331 int ctdb_reply_control_modify_flags(struct ctdb_reply_control
*reply
);
333 void ctdb_req_control_get_all_tunables(struct ctdb_req_control
*request
);
334 int ctdb_reply_control_get_all_tunables(struct ctdb_reply_control
*reply
,
336 struct ctdb_tunable_list
**tun_list
);
338 void ctdb_req_control_get_tcp_tickle_list(struct ctdb_req_control
*request
,
339 ctdb_sock_addr
*addr
);
340 int ctdb_reply_control_get_tcp_tickle_list(struct ctdb_reply_control
*reply
,
342 struct ctdb_tickle_list
**tickles
);
344 void ctdb_req_control_set_tcp_tickle_list(struct ctdb_req_control
*request
,
345 struct ctdb_tickle_list
*tickles
);
346 int ctdb_reply_control_set_tcp_tickle_list(struct ctdb_reply_control
*reply
);
348 void ctdb_req_control_db_attach_persistent(struct ctdb_req_control
*request
,
350 int ctdb_reply_control_db_attach_persistent(struct ctdb_reply_control
*reply
,
353 void ctdb_req_control_update_record(struct ctdb_req_control
*request
,
354 struct ctdb_rec_buffer
*recbuf
);
355 int ctdb_reply_control_update_record(struct ctdb_reply_control
*reply
);
357 void ctdb_req_control_send_gratuitous_arp(struct ctdb_req_control
*request
,
358 struct ctdb_addr_info
*addr_info
);
359 int ctdb_reply_control_send_gratuitous_arp(struct ctdb_reply_control
*reply
);
361 void ctdb_req_control_wipe_database(struct ctdb_req_control
*request
,
362 struct ctdb_transdb
*transdb
);
363 int ctdb_reply_control_wipe_database(struct ctdb_reply_control
*reply
);
365 void ctdb_req_control_uptime(struct ctdb_req_control
*request
);
366 int ctdb_reply_control_uptime(struct ctdb_reply_control
*reply
,
368 struct ctdb_uptime
**uptime
);
370 void ctdb_req_control_start_recovery(struct ctdb_req_control
*request
);
371 int ctdb_reply_control_start_recovery(struct ctdb_reply_control
*reply
);
373 void ctdb_req_control_end_recovery(struct ctdb_req_control
*request
);
374 int ctdb_reply_control_end_recovery(struct ctdb_reply_control
*reply
);
376 void ctdb_req_control_reload_nodes_file(struct ctdb_req_control
*request
);
377 int ctdb_reply_control_reload_nodes_file(struct ctdb_reply_control
*reply
);
379 void ctdb_req_control_try_delete_records(struct ctdb_req_control
*request
,
380 struct ctdb_rec_buffer
*recbuf
);
381 int ctdb_reply_control_try_delete_records(struct ctdb_reply_control
*reply
,
383 struct ctdb_rec_buffer
**recbuf
);
385 void ctdb_req_control_enable_monitor(struct ctdb_req_control
*request
);
386 int ctdb_reply_control_enable_monitor(struct ctdb_reply_control
*reply
);
388 void ctdb_req_control_disable_monitor(struct ctdb_req_control
*request
);
389 int ctdb_reply_control_disable_monitor(struct ctdb_reply_control
*reply
);
391 void ctdb_req_control_add_public_ip(struct ctdb_req_control
*request
,
392 struct ctdb_addr_info
*addr_info
);
393 int ctdb_reply_control_add_public_ip(struct ctdb_reply_control
*reply
);
395 void ctdb_req_control_del_public_ip(struct ctdb_req_control
*request
,
396 struct ctdb_addr_info
*addr_info
);
397 int ctdb_reply_control_del_public_ip(struct ctdb_reply_control
*reply
);
399 void ctdb_req_control_get_capabilities(struct ctdb_req_control
*request
);
400 int ctdb_reply_control_get_capabilities(struct ctdb_reply_control
*reply
,
403 void ctdb_req_control_recd_ping(struct ctdb_req_control
*request
);
404 int ctdb_reply_control_recd_ping(struct ctdb_reply_control
*reply
);
406 void ctdb_req_control_release_ip(struct ctdb_req_control
*request
,
407 struct ctdb_public_ip
*pubip
);
408 int ctdb_reply_control_release_ip(struct ctdb_reply_control
*reply
);
410 void ctdb_req_control_takeover_ip(struct ctdb_req_control
*request
,
411 struct ctdb_public_ip
*pubip
);
412 int ctdb_reply_control_takeover_ip(struct ctdb_reply_control
*reply
);
414 void ctdb_req_control_get_public_ips(struct ctdb_req_control
*request
,
415 bool available_only
);
416 int ctdb_reply_control_get_public_ips(struct ctdb_reply_control
*reply
,
418 struct ctdb_public_ip_list
**pubip_list
);
420 void ctdb_req_control_get_nodemap(struct ctdb_req_control
*request
);
421 int ctdb_reply_control_get_nodemap(struct ctdb_reply_control
*reply
,
423 struct ctdb_node_map
**nodemap
);
425 void ctdb_req_control_traverse_kill(struct ctdb_req_control
*request
,
426 struct ctdb_traverse_start
*traverse
);
427 int ctdb_reply_control_traverse_kill(struct ctdb_reply_control
*reply
);
429 void ctdb_req_control_recd_reclock_latency(struct ctdb_req_control
*request
,
430 double reclock_latency
);
431 int ctdb_reply_control_recd_reclock_latency(struct ctdb_reply_control
*reply
);
433 void ctdb_req_control_get_reclock_file(struct ctdb_req_control
*request
);
434 int ctdb_reply_control_get_reclock_file(struct ctdb_reply_control
*reply
,
436 const char **reclock_file
);
438 void ctdb_req_control_stop_node(struct ctdb_req_control
*request
);
439 int ctdb_reply_control_stop_node(struct ctdb_reply_control
*reply
);
441 void ctdb_req_control_continue_node(struct ctdb_req_control
*request
);
442 int ctdb_reply_control_continue_node(struct ctdb_reply_control
*reply
);
444 void ctdb_req_control_set_lmasterrole(struct ctdb_req_control
*request
,
445 uint32_t lmaster_role
);
446 int ctdb_reply_control_set_lmasterrole(struct ctdb_reply_control
*reply
);
448 void ctdb_req_control_set_recmasterrole(struct ctdb_req_control
*request
,
449 uint32_t recmaster_role
);
450 int ctdb_reply_control_set_recmasterrole(struct ctdb_reply_control
*reply
);
452 void ctdb_req_control_set_ban_state(struct ctdb_req_control
*request
,
453 struct ctdb_ban_state
*ban_state
);
454 int ctdb_reply_control_set_ban_state(struct ctdb_reply_control
*reply
);
456 void ctdb_req_control_get_ban_state(struct ctdb_req_control
*request
);
457 int ctdb_reply_control_get_ban_state(struct ctdb_reply_control
*reply
,
459 struct ctdb_ban_state
**ban_state
);
461 void ctdb_req_control_register_notify(struct ctdb_req_control
*request
,
462 struct ctdb_notify_data
*notify
);
463 int ctdb_reply_control_register_notify(struct ctdb_reply_control
*reply
);
465 void ctdb_req_control_deregister_notify(struct ctdb_req_control
*request
,
467 int ctdb_reply_control_deregister_notify(struct ctdb_reply_control
*reply
);
469 void ctdb_req_control_trans3_commit(struct ctdb_req_control
*request
,
470 struct ctdb_rec_buffer
*recbuf
);
471 int ctdb_reply_control_trans3_commit(struct ctdb_reply_control
*reply
);
473 void ctdb_req_control_get_db_seqnum(struct ctdb_req_control
*request
,
475 int ctdb_reply_control_get_db_seqnum(struct ctdb_reply_control
*reply
,
478 void ctdb_req_control_db_set_healthy(struct ctdb_req_control
*request
,
480 int ctdb_reply_control_db_set_healthy(struct ctdb_reply_control
*reply
);
482 void ctdb_req_control_db_get_health(struct ctdb_req_control
*request
,
484 int ctdb_reply_control_db_get_health(struct ctdb_reply_control
*reply
,
486 const char **reason
);
488 void ctdb_req_control_get_public_ip_info(struct ctdb_req_control
*request
,
489 ctdb_sock_addr
*addr
);
490 int ctdb_reply_control_get_public_ip_info(struct ctdb_reply_control
*reply
,
492 struct ctdb_public_ip_info
**ipinfo
);
494 void ctdb_req_control_get_ifaces(struct ctdb_req_control
*request
);
495 int ctdb_reply_control_get_ifaces(struct ctdb_reply_control
*reply
,
497 struct ctdb_iface_list
**iface_list
);
499 void ctdb_req_control_set_iface_link_state(struct ctdb_req_control
*request
,
500 struct ctdb_iface
*iface
);
501 int ctdb_reply_control_set_iface_link_state(struct ctdb_reply_control
*reply
);
503 void ctdb_req_control_tcp_add_delayed_update(struct ctdb_req_control
*request
,
504 struct ctdb_connection
*conn
);
505 int ctdb_reply_control_tcp_add_delayed_update(struct ctdb_reply_control
*reply
);
507 void ctdb_req_control_get_stat_history(struct ctdb_req_control
*request
);
508 int ctdb_reply_control_get_stat_history(struct ctdb_reply_control
*reply
,
510 struct ctdb_statistics_list
**stats_list
);
512 void ctdb_req_control_schedule_for_deletion(struct ctdb_req_control
*request
,
513 struct ctdb_key_data
*key
);
514 int ctdb_reply_control_schedule_for_deletion(struct ctdb_reply_control
*reply
);
516 void ctdb_req_control_set_db_readonly(struct ctdb_req_control
*request
,
518 int ctdb_reply_control_set_db_readonly(struct ctdb_reply_control
*reply
);
520 void ctdb_req_control_traverse_start_ext(struct ctdb_req_control
*request
,
521 struct ctdb_traverse_start_ext
*traverse
);
522 int ctdb_reply_control_traverse_start_ext(struct ctdb_reply_control
*reply
);
524 void ctdb_req_control_get_db_statistics(struct ctdb_req_control
*request
,
526 int ctdb_reply_control_get_db_statistics(struct ctdb_reply_control
*reply
,
528 struct ctdb_db_statistics
**dbstats
);
530 void ctdb_req_control_set_db_sticky(struct ctdb_req_control
*request
,
532 int ctdb_reply_control_set_db_sticky(struct ctdb_reply_control
*reply
);
534 void ctdb_req_control_reload_public_ips(struct ctdb_req_control
*request
);
535 int ctdb_reply_control_reload_public_ips(struct ctdb_reply_control
*reply
);
537 void ctdb_req_control_receive_records(struct ctdb_req_control
*request
,
538 struct ctdb_rec_buffer
*recbuf
);
539 int ctdb_reply_control_receive_records(struct ctdb_reply_control
*reply
,
541 struct ctdb_rec_buffer
**recbuf
);
543 void ctdb_req_control_ipreallocated(struct ctdb_req_control
*request
);
544 int ctdb_reply_control_ipreallocated(struct ctdb_reply_control
*reply
);
546 void ctdb_req_control_get_runstate(struct ctdb_req_control
*request
);
547 int ctdb_reply_control_get_runstate(struct ctdb_reply_control
*reply
,
548 enum ctdb_runstate
*runstate
);
550 void ctdb_req_control_db_detach(struct ctdb_req_control
*request
,
552 int ctdb_reply_control_db_detach(struct ctdb_reply_control
*reply
);
554 void ctdb_req_control_get_nodes_file(struct ctdb_req_control
*request
);
555 int ctdb_reply_control_get_nodes_file(struct ctdb_reply_control
*reply
,
557 struct ctdb_node_map
**nodemap
);
559 void ctdb_req_control_db_freeze(struct ctdb_req_control
*request
,
561 int ctdb_reply_control_db_freeze(struct ctdb_reply_control
*reply
);
563 void ctdb_req_control_db_thaw(struct ctdb_req_control
*request
,
565 int ctdb_reply_control_db_thaw(struct ctdb_reply_control
*reply
);
567 void ctdb_req_control_db_transaction_start(struct ctdb_req_control
*request
,
568 struct ctdb_transdb
*transdb
);
569 int ctdb_reply_control_db_transaction_start(struct ctdb_reply_control
*reply
);
571 void ctdb_req_control_db_transaction_commit(struct ctdb_req_control
*request
,
572 struct ctdb_transdb
*transdb
);
573 int ctdb_reply_control_db_transaction_commit(struct ctdb_reply_control
*reply
);
575 void ctdb_req_control_db_transaction_cancel(struct ctdb_req_control
*request
,
577 int ctdb_reply_control_db_transaction_cancel(struct ctdb_reply_control
*reply
);
579 void ctdb_req_control_db_pull(struct ctdb_req_control
*request
,
580 struct ctdb_pulldb_ext
*pulldb_ext
);
581 int ctdb_reply_control_db_pull(struct ctdb_reply_control
*reply
,
582 uint32_t *num_records
);
584 void ctdb_req_control_db_push_start(struct ctdb_req_control
*request
,
585 struct ctdb_pulldb_ext
*pulldb_ext
);
586 int ctdb_reply_control_db_push_start(struct ctdb_reply_control
*reply
);
588 void ctdb_req_control_db_push_confirm(struct ctdb_req_control
*request
,
590 int ctdb_reply_control_db_push_confirm(struct ctdb_reply_control
*reply
,
591 uint32_t *num_records
);
593 void ctdb_req_control_db_open_flags(struct ctdb_req_control
*request
,
595 int ctdb_reply_control_db_open_flags(struct ctdb_reply_control
*reply
,
598 void ctdb_req_control_db_attach_replicated(struct ctdb_req_control
*request
,
599 const char *db_name
);
600 int ctdb_reply_control_db_attach_replicated(struct ctdb_reply_control
*reply
,
603 /* From protocol/protocol_debug.c */
605 void ctdb_packet_print(uint8_t *buf
, size_t buflen
, FILE *fp
);
607 /* From protocol/protocol_message.c */
609 size_t ctdb_req_message_len(struct ctdb_req_header
*h
,
610 struct ctdb_req_message
*c
);
612 int ctdb_req_message_push(struct ctdb_req_header
*h
,
613 struct ctdb_req_message
*c
,
614 uint8_t *buf
, size_t *buflen
);
616 int ctdb_req_message_pull(uint8_t *buf
, size_t buflen
,
617 struct ctdb_req_header
*h
,
619 struct ctdb_req_message
*c
);
621 size_t ctdb_req_message_data_len(struct ctdb_req_header
*h
,
622 struct ctdb_req_message_data
*c
);
624 int ctdb_req_message_data_push(struct ctdb_req_header
*h
,
625 struct ctdb_req_message_data
*c
,
626 uint8_t *buf
, size_t *buflen
);
628 int ctdb_req_message_data_pull(uint8_t *buf
, size_t buflen
,
629 struct ctdb_req_header
*h
,
631 struct ctdb_req_message_data
*c
);
633 /* From protocol/protocol_event.c */
635 void ctdb_event_header_fill(struct ctdb_event_header
*h
, uint32_t reqid
);
637 size_t ctdb_event_request_len(struct ctdb_event_request
*in
);
639 int ctdb_event_request_push(struct ctdb_event_request
*in
,
640 uint8_t *buf
, size_t *buflen
);
642 int ctdb_event_request_pull(uint8_t *buf
, size_t buflen
,
644 struct ctdb_event_request
*out
);
646 size_t ctdb_event_reply_len(struct ctdb_event_reply
*in
);
648 int ctdb_event_reply_push(struct ctdb_event_reply
*in
,
649 uint8_t *buf
, size_t *buflen
);
651 int ctdb_event_reply_pull(uint8_t *buf
, size_t buflen
,
653 struct ctdb_event_reply
*out
);
655 /* From protocol/protocol_packet.c */
657 int ctdb_allocate_pkt(TALLOC_CTX
*mem_ctx
, size_t datalen
,
658 uint8_t **buf
, size_t *buflen
);
660 /* From protocol/protocol_util.c */
662 const char *ctdb_runstate_to_string(enum ctdb_runstate runstate
);
663 enum ctdb_runstate
ctdb_runstate_from_string(const char *runstate_str
);
665 const char *ctdb_event_to_string(enum ctdb_event event
);
666 enum ctdb_event
ctdb_event_from_string(const char *event_str
);
668 const char *ctdb_sock_addr_to_string(TALLOC_CTX
*mem_ctx
, ctdb_sock_addr
*addr
);
669 int ctdb_sock_addr_cmp_ip(const ctdb_sock_addr
*addr1
,
670 const ctdb_sock_addr
*addr2
);
671 int ctdb_sock_addr_cmp(const ctdb_sock_addr
*addr1
,
672 const ctdb_sock_addr
*addr2
);
673 bool ctdb_sock_addr_same_ip(const ctdb_sock_addr
*addr1
,
674 const ctdb_sock_addr
*addr2
);
675 bool ctdb_sock_addr_same(const ctdb_sock_addr
*addr1
,
676 const ctdb_sock_addr
*addr2
);
678 #endif /* __CTDB_PROTOCOL_API_H__ */