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
, uint32_t tdb_flags
);
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
,
351 int ctdb_reply_control_db_attach_persistent(struct ctdb_reply_control
*reply
,
354 void ctdb_req_control_update_record(struct ctdb_req_control
*request
,
355 struct ctdb_rec_buffer
*recbuf
);
356 int ctdb_reply_control_update_record(struct ctdb_reply_control
*reply
);
358 void ctdb_req_control_send_gratuitous_arp(struct ctdb_req_control
*request
,
359 struct ctdb_addr_info
*addr_info
);
360 int ctdb_reply_control_send_gratuitous_arp(struct ctdb_reply_control
*reply
);
362 void ctdb_req_control_wipe_database(struct ctdb_req_control
*request
,
363 struct ctdb_transdb
*transdb
);
364 int ctdb_reply_control_wipe_database(struct ctdb_reply_control
*reply
);
366 void ctdb_req_control_uptime(struct ctdb_req_control
*request
);
367 int ctdb_reply_control_uptime(struct ctdb_reply_control
*reply
,
369 struct ctdb_uptime
**uptime
);
371 void ctdb_req_control_start_recovery(struct ctdb_req_control
*request
);
372 int ctdb_reply_control_start_recovery(struct ctdb_reply_control
*reply
);
374 void ctdb_req_control_end_recovery(struct ctdb_req_control
*request
);
375 int ctdb_reply_control_end_recovery(struct ctdb_reply_control
*reply
);
377 void ctdb_req_control_reload_nodes_file(struct ctdb_req_control
*request
);
378 int ctdb_reply_control_reload_nodes_file(struct ctdb_reply_control
*reply
);
380 void ctdb_req_control_try_delete_records(struct ctdb_req_control
*request
,
381 struct ctdb_rec_buffer
*recbuf
);
382 int ctdb_reply_control_try_delete_records(struct ctdb_reply_control
*reply
,
384 struct ctdb_rec_buffer
**recbuf
);
386 void ctdb_req_control_enable_monitor(struct ctdb_req_control
*request
);
387 int ctdb_reply_control_enable_monitor(struct ctdb_reply_control
*reply
);
389 void ctdb_req_control_disable_monitor(struct ctdb_req_control
*request
);
390 int ctdb_reply_control_disable_monitor(struct ctdb_reply_control
*reply
);
392 void ctdb_req_control_add_public_ip(struct ctdb_req_control
*request
,
393 struct ctdb_addr_info
*addr_info
);
394 int ctdb_reply_control_add_public_ip(struct ctdb_reply_control
*reply
);
396 void ctdb_req_control_del_public_ip(struct ctdb_req_control
*request
,
397 struct ctdb_addr_info
*addr_info
);
398 int ctdb_reply_control_del_public_ip(struct ctdb_reply_control
*reply
);
400 void ctdb_req_control_get_capabilities(struct ctdb_req_control
*request
);
401 int ctdb_reply_control_get_capabilities(struct ctdb_reply_control
*reply
,
404 void ctdb_req_control_recd_ping(struct ctdb_req_control
*request
);
405 int ctdb_reply_control_recd_ping(struct ctdb_reply_control
*reply
);
407 void ctdb_req_control_release_ip(struct ctdb_req_control
*request
,
408 struct ctdb_public_ip
*pubip
);
409 int ctdb_reply_control_release_ip(struct ctdb_reply_control
*reply
);
411 void ctdb_req_control_takeover_ip(struct ctdb_req_control
*request
,
412 struct ctdb_public_ip
*pubip
);
413 int ctdb_reply_control_takeover_ip(struct ctdb_reply_control
*reply
);
415 void ctdb_req_control_get_public_ips(struct ctdb_req_control
*request
,
416 bool available_only
);
417 int ctdb_reply_control_get_public_ips(struct ctdb_reply_control
*reply
,
419 struct ctdb_public_ip_list
**pubip_list
);
421 void ctdb_req_control_get_nodemap(struct ctdb_req_control
*request
);
422 int ctdb_reply_control_get_nodemap(struct ctdb_reply_control
*reply
,
424 struct ctdb_node_map
**nodemap
);
426 void ctdb_req_control_traverse_kill(struct ctdb_req_control
*request
,
427 struct ctdb_traverse_start
*traverse
);
428 int ctdb_reply_control_traverse_kill(struct ctdb_reply_control
*reply
);
430 void ctdb_req_control_recd_reclock_latency(struct ctdb_req_control
*request
,
431 double reclock_latency
);
432 int ctdb_reply_control_recd_reclock_latency(struct ctdb_reply_control
*reply
);
434 void ctdb_req_control_get_reclock_file(struct ctdb_req_control
*request
);
435 int ctdb_reply_control_get_reclock_file(struct ctdb_reply_control
*reply
,
437 const char **reclock_file
);
439 void ctdb_req_control_stop_node(struct ctdb_req_control
*request
);
440 int ctdb_reply_control_stop_node(struct ctdb_reply_control
*reply
);
442 void ctdb_req_control_continue_node(struct ctdb_req_control
*request
);
443 int ctdb_reply_control_continue_node(struct ctdb_reply_control
*reply
);
445 void ctdb_req_control_set_lmasterrole(struct ctdb_req_control
*request
,
446 uint32_t lmaster_role
);
447 int ctdb_reply_control_set_lmasterrole(struct ctdb_reply_control
*reply
);
449 void ctdb_req_control_set_recmasterrole(struct ctdb_req_control
*request
,
450 uint32_t recmaster_role
);
451 int ctdb_reply_control_set_recmasterrole(struct ctdb_reply_control
*reply
);
453 void ctdb_req_control_set_ban_state(struct ctdb_req_control
*request
,
454 struct ctdb_ban_state
*ban_state
);
455 int ctdb_reply_control_set_ban_state(struct ctdb_reply_control
*reply
);
457 void ctdb_req_control_get_ban_state(struct ctdb_req_control
*request
);
458 int ctdb_reply_control_get_ban_state(struct ctdb_reply_control
*reply
,
460 struct ctdb_ban_state
**ban_state
);
462 void ctdb_req_control_register_notify(struct ctdb_req_control
*request
,
463 struct ctdb_notify_data
*notify
);
464 int ctdb_reply_control_register_notify(struct ctdb_reply_control
*reply
);
466 void ctdb_req_control_deregister_notify(struct ctdb_req_control
*request
,
468 int ctdb_reply_control_deregister_notify(struct ctdb_reply_control
*reply
);
470 void ctdb_req_control_trans3_commit(struct ctdb_req_control
*request
,
471 struct ctdb_rec_buffer
*recbuf
);
472 int ctdb_reply_control_trans3_commit(struct ctdb_reply_control
*reply
);
474 void ctdb_req_control_get_db_seqnum(struct ctdb_req_control
*request
,
476 int ctdb_reply_control_get_db_seqnum(struct ctdb_reply_control
*reply
,
479 void ctdb_req_control_db_set_healthy(struct ctdb_req_control
*request
,
481 int ctdb_reply_control_db_set_healthy(struct ctdb_reply_control
*reply
);
483 void ctdb_req_control_db_get_health(struct ctdb_req_control
*request
,
485 int ctdb_reply_control_db_get_health(struct ctdb_reply_control
*reply
,
487 const char **reason
);
489 void ctdb_req_control_get_public_ip_info(struct ctdb_req_control
*request
,
490 ctdb_sock_addr
*addr
);
491 int ctdb_reply_control_get_public_ip_info(struct ctdb_reply_control
*reply
,
493 struct ctdb_public_ip_info
**ipinfo
);
495 void ctdb_req_control_get_ifaces(struct ctdb_req_control
*request
);
496 int ctdb_reply_control_get_ifaces(struct ctdb_reply_control
*reply
,
498 struct ctdb_iface_list
**iface_list
);
500 void ctdb_req_control_set_iface_link_state(struct ctdb_req_control
*request
,
501 struct ctdb_iface
*iface
);
502 int ctdb_reply_control_set_iface_link_state(struct ctdb_reply_control
*reply
);
504 void ctdb_req_control_tcp_add_delayed_update(struct ctdb_req_control
*request
,
505 struct ctdb_connection
*conn
);
506 int ctdb_reply_control_tcp_add_delayed_update(struct ctdb_reply_control
*reply
);
508 void ctdb_req_control_get_stat_history(struct ctdb_req_control
*request
);
509 int ctdb_reply_control_get_stat_history(struct ctdb_reply_control
*reply
,
511 struct ctdb_statistics_list
**stats_list
);
513 void ctdb_req_control_schedule_for_deletion(struct ctdb_req_control
*request
,
514 struct ctdb_key_data
*key
);
515 int ctdb_reply_control_schedule_for_deletion(struct ctdb_reply_control
*reply
);
517 void ctdb_req_control_set_db_readonly(struct ctdb_req_control
*request
,
519 int ctdb_reply_control_set_db_readonly(struct ctdb_reply_control
*reply
);
521 void ctdb_req_control_check_srvids(struct ctdb_req_control
*request
,
522 struct ctdb_uint64_array
*u64_array
);
523 int ctdb_reply_control_check_srvids(struct ctdb_reply_control
*reply
,
525 struct ctdb_uint8_array
**u8_array
);
527 void ctdb_req_control_traverse_start_ext(struct ctdb_req_control
*request
,
528 struct ctdb_traverse_start_ext
*traverse
);
529 int ctdb_reply_control_traverse_start_ext(struct ctdb_reply_control
*reply
);
531 void ctdb_req_control_get_db_statistics(struct ctdb_req_control
*request
,
533 int ctdb_reply_control_get_db_statistics(struct ctdb_reply_control
*reply
,
535 struct ctdb_db_statistics
**dbstats
);
537 void ctdb_req_control_set_db_sticky(struct ctdb_req_control
*request
,
539 int ctdb_reply_control_set_db_sticky(struct ctdb_reply_control
*reply
);
541 void ctdb_req_control_reload_public_ips(struct ctdb_req_control
*request
);
542 int ctdb_reply_control_reload_public_ips(struct ctdb_reply_control
*reply
);
544 void ctdb_req_control_receive_records(struct ctdb_req_control
*request
,
545 struct ctdb_rec_buffer
*recbuf
);
546 int ctdb_reply_control_receive_records(struct ctdb_reply_control
*reply
,
548 struct ctdb_rec_buffer
**recbuf
);
550 void ctdb_req_control_ipreallocated(struct ctdb_req_control
*request
);
551 int ctdb_reply_control_ipreallocated(struct ctdb_reply_control
*reply
);
553 void ctdb_req_control_get_runstate(struct ctdb_req_control
*request
);
554 int ctdb_reply_control_get_runstate(struct ctdb_reply_control
*reply
,
555 enum ctdb_runstate
*runstate
);
557 void ctdb_req_control_db_detach(struct ctdb_req_control
*request
,
559 int ctdb_reply_control_db_detach(struct ctdb_reply_control
*reply
);
561 void ctdb_req_control_get_nodes_file(struct ctdb_req_control
*request
);
562 int ctdb_reply_control_get_nodes_file(struct ctdb_reply_control
*reply
,
564 struct ctdb_node_map
**nodemap
);
566 void ctdb_req_control_db_freeze(struct ctdb_req_control
*request
,
568 int ctdb_reply_control_db_freeze(struct ctdb_reply_control
*reply
);
570 void ctdb_req_control_db_thaw(struct ctdb_req_control
*request
,
572 int ctdb_reply_control_db_thaw(struct ctdb_reply_control
*reply
);
574 void ctdb_req_control_db_transaction_start(struct ctdb_req_control
*request
,
575 struct ctdb_transdb
*transdb
);
576 int ctdb_reply_control_db_transaction_start(struct ctdb_reply_control
*reply
);
578 void ctdb_req_control_db_transaction_commit(struct ctdb_req_control
*request
,
579 struct ctdb_transdb
*transdb
);
580 int ctdb_reply_control_db_transaction_commit(struct ctdb_reply_control
*reply
);
582 void ctdb_req_control_db_transaction_cancel(struct ctdb_req_control
*request
,
584 int ctdb_reply_control_db_transaction_cancel(struct ctdb_reply_control
*reply
);
586 void ctdb_req_control_db_pull(struct ctdb_req_control
*request
,
587 struct ctdb_pulldb_ext
*pulldb_ext
);
588 int ctdb_reply_control_db_pull(struct ctdb_reply_control
*reply
,
589 uint32_t *num_records
);
591 void ctdb_req_control_db_push_start(struct ctdb_req_control
*request
,
592 struct ctdb_pulldb_ext
*pulldb_ext
);
593 int ctdb_reply_control_db_push_start(struct ctdb_reply_control
*reply
);
595 void ctdb_req_control_db_push_confirm(struct ctdb_req_control
*request
,
597 int ctdb_reply_control_db_push_confirm(struct ctdb_reply_control
*reply
,
598 uint32_t *num_records
);
600 /* From protocol/protocol_debug.c */
602 void ctdb_packet_print(uint8_t *buf
, size_t buflen
, FILE *fp
);
604 /* From protocol/protocol_message.c */
606 size_t ctdb_req_message_len(struct ctdb_req_header
*h
,
607 struct ctdb_req_message
*c
);
609 int ctdb_req_message_push(struct ctdb_req_header
*h
,
610 struct ctdb_req_message
*c
,
611 uint8_t *buf
, size_t *buflen
);
613 int ctdb_req_message_pull(uint8_t *buf
, size_t buflen
,
614 struct ctdb_req_header
*h
,
616 struct ctdb_req_message
*c
);
618 size_t ctdb_req_message_data_len(struct ctdb_req_header
*h
,
619 struct ctdb_req_message_data
*c
);
621 int ctdb_req_message_data_push(struct ctdb_req_header
*h
,
622 struct ctdb_req_message_data
*c
,
623 uint8_t *buf
, size_t *buflen
);
625 int ctdb_req_message_data_pull(uint8_t *buf
, size_t buflen
,
626 struct ctdb_req_header
*h
,
628 struct ctdb_req_message_data
*c
);
630 /* From protocol/protocol_event.c */
632 void ctdb_event_header_fill(struct ctdb_event_header
*h
, uint32_t reqid
);
634 size_t ctdb_event_request_len(struct ctdb_event_request
*in
);
636 int ctdb_event_request_push(struct ctdb_event_request
*in
,
637 uint8_t *buf
, size_t *buflen
);
639 int ctdb_event_request_pull(uint8_t *buf
, size_t buflen
,
641 struct ctdb_event_request
*out
);
643 size_t ctdb_event_reply_len(struct ctdb_event_reply
*in
);
645 int ctdb_event_reply_push(struct ctdb_event_reply
*in
,
646 uint8_t *buf
, size_t *buflen
);
648 int ctdb_event_reply_pull(uint8_t *buf
, size_t buflen
,
650 struct ctdb_event_reply
*out
);
652 /* From protocol/protocol_packet.c */
654 int ctdb_allocate_pkt(TALLOC_CTX
*mem_ctx
, size_t datalen
,
655 uint8_t **buf
, size_t *buflen
);
657 /* From protocol/protocol_util.c */
659 const char *ctdb_runstate_to_string(enum ctdb_runstate runstate
);
660 enum ctdb_runstate
ctdb_runstate_from_string(const char *runstate_str
);
662 const char *ctdb_event_to_string(enum ctdb_event event
);
663 enum ctdb_event
ctdb_event_from_string(const char *event_str
);
665 const char *ctdb_sock_addr_to_string(TALLOC_CTX
*mem_ctx
, ctdb_sock_addr
*addr
);
666 int ctdb_sock_addr_cmp_ip(const ctdb_sock_addr
*addr1
,
667 const ctdb_sock_addr
*addr2
);
668 int ctdb_sock_addr_cmp(const ctdb_sock_addr
*addr1
,
669 const ctdb_sock_addr
*addr2
);
670 bool ctdb_sock_addr_same_ip(const ctdb_sock_addr
*addr1
,
671 const ctdb_sock_addr
*addr2
);
672 bool ctdb_sock_addr_same(const ctdb_sock_addr
*addr1
,
673 const ctdb_sock_addr
*addr2
);
675 #endif /* __CTDB_PROTOCOL_API_H__ */