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 *in);
30 void ctdb_ltdb_header_push(struct ctdb_ltdb_header *in, uint8_t *buf,
32 int ctdb_ltdb_header_pull(uint8_t *buf, size_t buflen,
33 struct ctdb_ltdb_header *out, size_t *npull);
35 int ctdb_ltdb_header_extract(TDB_DATA *data, struct ctdb_ltdb_header *header);
37 size_t ctdb_rec_data_len(struct ctdb_rec_data *in);
38 void ctdb_rec_data_push(struct ctdb_rec_data *in, uint8_t *buf, size_t *npush);
39 int ctdb_rec_data_pull(uint8_t *buf, size_t buflen, TALLOC_CTX *mem_ctx,
40 struct ctdb_rec_data **out, size_t *npull);
42 size_t ctdb_rec_buffer_len(struct ctdb_rec_buffer *in);
43 void ctdb_rec_buffer_push(struct ctdb_rec_buffer *in, uint8_t *buf,
45 int ctdb_rec_buffer_pull(uint8_t *buf, size_t buflen, TALLOC_CTX *mem_ctx,
46 struct ctdb_rec_buffer **out, size_t *npull);
48 struct ctdb_rec_buffer *ctdb_rec_buffer_init(TALLOC_CTX *mem_ctx,
50 int ctdb_rec_buffer_add(TALLOC_CTX *mem_ctx, struct ctdb_rec_buffer *recbuf,
51 uint32_t reqid, struct ctdb_ltdb_header *header,
52 TDB_DATA key, TDB_DATA data);
53 int ctdb_rec_buffer_traverse(struct ctdb_rec_buffer *recbuf,
54 ctdb_rec_parser_func_t func,
57 int ctdb_rec_buffer_write(struct ctdb_rec_buffer *recbuf, int fd);
58 int ctdb_rec_buffer_read(int fd, TALLOC_CTX *mem_ctx,
59 struct ctdb_rec_buffer **out);
61 size_t ctdb_server_id_len(struct ctdb_server_id *in);
62 void ctdb_server_id_push(struct ctdb_server_id *in, uint8_t *buf,
64 int ctdb_server_id_pull(uint8_t *buf, size_t buflen,
65 struct ctdb_server_id *out, size_t *npull);
67 size_t ctdb_g_lock_len(struct ctdb_g_lock *in);
68 void ctdb_g_lock_push(struct ctdb_g_lock *in, uint8_t *buf, size_t *npush);
69 int ctdb_g_lock_pull(uint8_t *buf, size_t buflen, struct ctdb_g_lock *out,
72 size_t ctdb_g_lock_list_len(struct ctdb_g_lock_list *lock_list);
73 void ctdb_g_lock_list_push(struct ctdb_g_lock_list *lock_list, uint8_t *buf);
74 int ctdb_g_lock_list_pull(uint8_t *buf, size_t buflen, TALLOC_CTX *mem_ctx,
75 struct ctdb_g_lock_list **out);
77 /* From protocol/protocol_header.c */
79 void ctdb_req_header_fill(struct ctdb_req_header *h, uint32_t generation,
80 uint32_t operation, uint32_t destnode,
81 uint32_t srcnode, uint32_t reqid);
83 size_t ctdb_req_header_len(struct ctdb_req_header *h);
84 void ctdb_req_header_push(struct ctdb_req_header *h, uint8_t *buf);
85 int ctdb_req_header_pull(uint8_t *buf, size_t buflen,
86 struct ctdb_req_header *h);
88 int ctdb_req_header_verify(struct ctdb_req_header *h, uint32_t operation);
90 /* From protocol/protocol_call.c */
92 size_t ctdb_req_call_len(struct ctdb_req_header *h,
93 struct ctdb_req_call *c);
95 int ctdb_req_call_push(struct ctdb_req_header *h,
96 struct ctdb_req_call *c,
97 uint8_t *buf, size_t *buflen);
99 int ctdb_req_call_pull(uint8_t *buf, size_t buflen,
100 struct ctdb_req_header *h,
102 struct ctdb_req_call *c);
104 size_t ctdb_reply_call_len(struct ctdb_req_header *h,
105 struct ctdb_reply_call *c);
107 int ctdb_reply_call_push(struct ctdb_req_header *h,
108 struct ctdb_reply_call *c,
109 uint8_t *buf, size_t *buflen);
111 int ctdb_reply_call_pull(uint8_t *buf, size_t buflen,
112 struct ctdb_req_header *h,
114 struct ctdb_reply_call *c);
116 size_t ctdb_reply_error_len(struct ctdb_req_header *h,
117 struct ctdb_reply_error *c);
119 int ctdb_reply_error_push(struct ctdb_req_header *h,
120 struct ctdb_reply_error *c,
121 uint8_t *buf, size_t *buflen);
123 int ctdb_reply_error_pull(uint8_t *buf, size_t buflen,
124 struct ctdb_req_header *h,
126 struct ctdb_reply_error *c);
128 size_t ctdb_req_dmaster_len(struct ctdb_req_header *h,
129 struct ctdb_req_dmaster *c);
131 int ctdb_req_dmaster_push(struct ctdb_req_header *h,
132 struct ctdb_req_dmaster *c,
133 uint8_t *buf, size_t *buflen);
135 int ctdb_req_dmaster_pull(uint8_t *buf, size_t buflen,
136 struct ctdb_req_header *h,
138 struct ctdb_req_dmaster *c);
140 size_t ctdb_reply_dmaster_len(struct ctdb_req_header *h,
141 struct ctdb_reply_dmaster *c);
143 int ctdb_reply_dmaster_push(struct ctdb_req_header *h,
144 struct ctdb_reply_dmaster *c,
145 uint8_t *buf, size_t *buflen);
147 int ctdb_reply_dmaster_pull(uint8_t *buf, size_t buflen,
148 struct ctdb_req_header *h,
150 struct ctdb_reply_dmaster *c);
152 /* From protocol/protocol_control.c */
154 size_t ctdb_req_control_len(struct ctdb_req_header *h,
155 struct ctdb_req_control *c);
157 int ctdb_req_control_push(struct ctdb_req_header *h,
158 struct ctdb_req_control *c,
159 uint8_t *buf, size_t *buflen);
161 int ctdb_req_control_pull(uint8_t *buf, size_t buflen,
162 struct ctdb_req_header *h,
164 struct ctdb_req_control *c);
166 size_t ctdb_reply_control_len(struct ctdb_req_header *h,
167 struct ctdb_reply_control *c);
169 int ctdb_reply_control_push(struct ctdb_req_header *h,
170 struct ctdb_reply_control *c,
171 uint8_t *buf, size_t *buflen);
173 int ctdb_reply_control_pull(uint8_t *buf, size_t buflen, uint32_t opcode,
174 struct ctdb_req_header *h,
176 struct ctdb_reply_control *c);
178 /* From protocol/protocol_client.c */
180 void ctdb_req_control_process_exists(struct ctdb_req_control *request,
182 int ctdb_reply_control_process_exists(struct ctdb_reply_control *reply,
185 void ctdb_req_control_statistics(struct ctdb_req_control *request);
187 int ctdb_reply_control_statistics(struct ctdb_reply_control *reply,
189 struct ctdb_statistics **stats);
191 void ctdb_req_control_ping(struct ctdb_req_control *request);
192 int ctdb_reply_control_ping(struct ctdb_reply_control *reply,
195 void ctdb_req_control_getdbpath(struct ctdb_req_control *request,
197 int ctdb_reply_control_getdbpath(struct ctdb_reply_control *reply,
198 TALLOC_CTX *mem_ctx, const char **db_path);
200 void ctdb_req_control_getvnnmap(struct ctdb_req_control *request);
201 int ctdb_reply_control_getvnnmap(struct ctdb_reply_control *reply,
203 struct ctdb_vnn_map **vnnmap);
205 void ctdb_req_control_setvnnmap(struct ctdb_req_control *request,
206 struct ctdb_vnn_map *vnnmap);
207 int ctdb_reply_control_setvnnmap(struct ctdb_reply_control *reply);
209 void ctdb_req_control_get_debug(struct ctdb_req_control *request);
210 int ctdb_reply_control_get_debug(struct ctdb_reply_control *reply,
213 void ctdb_req_control_set_debug(struct ctdb_req_control *request,
215 int ctdb_reply_control_set_debug(struct ctdb_reply_control *reply);
217 void ctdb_req_control_get_dbmap(struct ctdb_req_control *request);
218 int ctdb_reply_control_get_dbmap(struct ctdb_reply_control *reply,
220 struct ctdb_dbid_map **dbmap);
222 void ctdb_req_control_pull_db(struct ctdb_req_control *request,
223 struct ctdb_pulldb *pulldb);
224 int ctdb_reply_control_pull_db(struct ctdb_reply_control *reply,
226 struct ctdb_rec_buffer **recbuf);
228 void ctdb_req_control_push_db(struct ctdb_req_control *request,
229 struct ctdb_rec_buffer *recbuf);
230 int ctdb_reply_control_push_db(struct ctdb_reply_control *reply);
232 void ctdb_req_control_get_recmode(struct ctdb_req_control *request);
233 int ctdb_reply_control_get_recmode(struct ctdb_reply_control *reply,
236 void ctdb_req_control_set_recmode(struct ctdb_req_control *request,
238 int ctdb_reply_control_set_recmode(struct ctdb_reply_control *reply);
240 void ctdb_req_control_statistics_reset(struct ctdb_req_control *request);
241 int ctdb_reply_control_statistics_reset(struct ctdb_reply_control *reply);
243 void ctdb_req_control_db_attach(struct ctdb_req_control *request,
244 const char *db_name);
245 int ctdb_reply_control_db_attach(struct ctdb_reply_control *reply,
248 void ctdb_req_control_traverse_start(struct ctdb_req_control *request,
249 struct ctdb_traverse_start *traverse);
250 int ctdb_reply_control_traverse_start(struct ctdb_reply_control *reply);
252 void ctdb_req_control_register_srvid(struct ctdb_req_control *request,
254 int ctdb_reply_control_register_srvid(struct ctdb_reply_control *reply);
256 void ctdb_req_control_deregister_srvid(struct ctdb_req_control *request,
258 int ctdb_reply_control_deregister_srvid(struct ctdb_reply_control *reply);
260 void ctdb_req_control_get_dbname(struct ctdb_req_control *request,
262 int ctdb_reply_control_get_dbname(struct ctdb_reply_control *reply,
263 TALLOC_CTX *mem_ctx, const char **db_name);
265 void ctdb_req_control_enable_seqnum(struct ctdb_req_control *request,
267 int ctdb_reply_control_enable_seqnum(struct ctdb_reply_control *reply);
269 void ctdb_req_control_update_seqnum(struct ctdb_req_control *request,
271 int ctdb_reply_control_update_seqnum(struct ctdb_reply_control *reply);
273 void ctdb_req_control_dump_memory(struct ctdb_req_control *request);
274 int ctdb_reply_control_dump_memory(struct ctdb_reply_control *reply,
275 TALLOC_CTX *mem_ctx, const char **mem_str);
277 void ctdb_req_control_get_pid(struct ctdb_req_control *request);
278 int ctdb_reply_control_get_pid(struct ctdb_reply_control *reply,
281 void ctdb_req_control_get_recmaster(struct ctdb_req_control *request);
282 int ctdb_reply_control_get_recmaster(struct ctdb_reply_control *reply,
283 uint32_t *recmaster);
285 void ctdb_req_control_set_recmaster(struct ctdb_req_control *request,
287 int ctdb_reply_control_set_recmaster(struct ctdb_reply_control *reply);
289 void ctdb_req_control_freeze(struct ctdb_req_control *request,
291 int ctdb_reply_control_freeze(struct ctdb_reply_control *reply);
293 void ctdb_req_control_get_pnn(struct ctdb_req_control *request);
294 int ctdb_reply_control_get_pnn(struct ctdb_reply_control *reply,
297 void ctdb_req_control_shutdown(struct ctdb_req_control *request);
298 int ctdb_reply_control_shutdown(struct ctdb_reply_control *reply);
300 void ctdb_req_control_get_monmode(struct ctdb_req_control *request);
301 int ctdb_reply_control_get_monmode(struct ctdb_reply_control *reply,
304 void ctdb_req_control_tcp_client(struct ctdb_req_control *request,
305 struct ctdb_connection *conn);
306 int ctdb_reply_control_tcp_client(struct ctdb_reply_control *reply);
308 void ctdb_req_control_tcp_add(struct ctdb_req_control *request,
309 struct ctdb_connection *conn);
310 int ctdb_reply_control_tcp_add(struct ctdb_reply_control *reply);
312 void ctdb_req_control_tcp_remove(struct ctdb_req_control *request,
313 struct ctdb_connection *conn);
314 int ctdb_reply_control_tcp_remove(struct ctdb_reply_control *reply);
316 void ctdb_req_control_startup(struct ctdb_req_control *request);
317 int ctdb_reply_control_startup(struct ctdb_reply_control *reply);
319 void ctdb_req_control_set_tunable(struct ctdb_req_control *request,
320 struct ctdb_tunable *tunable);
321 int ctdb_reply_control_set_tunable(struct ctdb_reply_control *reply);
323 void ctdb_req_control_get_tunable(struct ctdb_req_control *request,
325 int ctdb_reply_control_get_tunable(struct ctdb_reply_control *reply,
328 void ctdb_req_control_list_tunables(struct ctdb_req_control *request);
329 int ctdb_reply_control_list_tunables(struct ctdb_reply_control *reply,
331 struct ctdb_var_list **tun_var_list);
333 void ctdb_req_control_modify_flags(struct ctdb_req_control *request,
334 struct ctdb_node_flag_change *flag_change);
335 int ctdb_reply_control_modify_flags(struct ctdb_reply_control *reply);
337 void ctdb_req_control_get_all_tunables(struct ctdb_req_control *request);
338 int ctdb_reply_control_get_all_tunables(struct ctdb_reply_control *reply,
340 struct ctdb_tunable_list **tun_list);
342 void ctdb_req_control_get_tcp_tickle_list(struct ctdb_req_control *request,
343 ctdb_sock_addr *addr);
344 int ctdb_reply_control_get_tcp_tickle_list(struct ctdb_reply_control *reply,
346 struct ctdb_tickle_list **tickles);
348 void ctdb_req_control_set_tcp_tickle_list(struct ctdb_req_control *request,
349 struct ctdb_tickle_list *tickles);
350 int ctdb_reply_control_set_tcp_tickle_list(struct ctdb_reply_control *reply);
352 void ctdb_req_control_db_attach_persistent(struct ctdb_req_control *request,
354 int ctdb_reply_control_db_attach_persistent(struct ctdb_reply_control *reply,
357 void ctdb_req_control_update_record(struct ctdb_req_control *request,
358 struct ctdb_rec_buffer *recbuf);
359 int ctdb_reply_control_update_record(struct ctdb_reply_control *reply);
361 void ctdb_req_control_send_gratuitous_arp(struct ctdb_req_control *request,
362 struct ctdb_addr_info *addr_info);
363 int ctdb_reply_control_send_gratuitous_arp(struct ctdb_reply_control *reply);
365 void ctdb_req_control_wipe_database(struct ctdb_req_control *request,
366 struct ctdb_transdb *transdb);
367 int ctdb_reply_control_wipe_database(struct ctdb_reply_control *reply);
369 void ctdb_req_control_uptime(struct ctdb_req_control *request);
370 int ctdb_reply_control_uptime(struct ctdb_reply_control *reply,
372 struct ctdb_uptime **uptime);
374 void ctdb_req_control_start_recovery(struct ctdb_req_control *request);
375 int ctdb_reply_control_start_recovery(struct ctdb_reply_control *reply);
377 void ctdb_req_control_end_recovery(struct ctdb_req_control *request);
378 int ctdb_reply_control_end_recovery(struct ctdb_reply_control *reply);
380 void ctdb_req_control_reload_nodes_file(struct ctdb_req_control *request);
381 int ctdb_reply_control_reload_nodes_file(struct ctdb_reply_control *reply);
383 void ctdb_req_control_try_delete_records(struct ctdb_req_control *request,
384 struct ctdb_rec_buffer *recbuf);
385 int ctdb_reply_control_try_delete_records(struct ctdb_reply_control *reply,
387 struct ctdb_rec_buffer **recbuf);
389 void ctdb_req_control_enable_monitor(struct ctdb_req_control *request);
390 int ctdb_reply_control_enable_monitor(struct ctdb_reply_control *reply);
392 void ctdb_req_control_disable_monitor(struct ctdb_req_control *request);
393 int ctdb_reply_control_disable_monitor(struct ctdb_reply_control *reply);
395 void ctdb_req_control_add_public_ip(struct ctdb_req_control *request,
396 struct ctdb_addr_info *addr_info);
397 int ctdb_reply_control_add_public_ip(struct ctdb_reply_control *reply);
399 void ctdb_req_control_del_public_ip(struct ctdb_req_control *request,
400 struct ctdb_addr_info *addr_info);
401 int ctdb_reply_control_del_public_ip(struct ctdb_reply_control *reply);
403 void ctdb_req_control_get_capabilities(struct ctdb_req_control *request);
404 int ctdb_reply_control_get_capabilities(struct ctdb_reply_control *reply,
407 void ctdb_req_control_recd_ping(struct ctdb_req_control *request);
408 int ctdb_reply_control_recd_ping(struct ctdb_reply_control *reply);
410 void ctdb_req_control_release_ip(struct ctdb_req_control *request,
411 struct ctdb_public_ip *pubip);
412 int ctdb_reply_control_release_ip(struct ctdb_reply_control *reply);
414 void ctdb_req_control_takeover_ip(struct ctdb_req_control *request,
415 struct ctdb_public_ip *pubip);
416 int ctdb_reply_control_takeover_ip(struct ctdb_reply_control *reply);
418 void ctdb_req_control_get_public_ips(struct ctdb_req_control *request,
419 bool available_only);
420 int ctdb_reply_control_get_public_ips(struct ctdb_reply_control *reply,
422 struct ctdb_public_ip_list **pubip_list);
424 void ctdb_req_control_get_nodemap(struct ctdb_req_control *request);
425 int ctdb_reply_control_get_nodemap(struct ctdb_reply_control *reply,
427 struct ctdb_node_map **nodemap);
429 void ctdb_req_control_traverse_kill(struct ctdb_req_control *request,
430 struct ctdb_traverse_start *traverse);
431 int ctdb_reply_control_traverse_kill(struct ctdb_reply_control *reply);
433 void ctdb_req_control_recd_reclock_latency(struct ctdb_req_control *request,
434 double reclock_latency);
435 int ctdb_reply_control_recd_reclock_latency(struct ctdb_reply_control *reply);
437 void ctdb_req_control_get_reclock_file(struct ctdb_req_control *request);
438 int ctdb_reply_control_get_reclock_file(struct ctdb_reply_control *reply,
440 const char **reclock_file);
442 void ctdb_req_control_stop_node(struct ctdb_req_control *request);
443 int ctdb_reply_control_stop_node(struct ctdb_reply_control *reply);
445 void ctdb_req_control_continue_node(struct ctdb_req_control *request);
446 int ctdb_reply_control_continue_node(struct ctdb_reply_control *reply);
448 void ctdb_req_control_set_lmasterrole(struct ctdb_req_control *request,
449 uint32_t lmaster_role);
450 int ctdb_reply_control_set_lmasterrole(struct ctdb_reply_control *reply);
452 void ctdb_req_control_set_recmasterrole(struct ctdb_req_control *request,
453 uint32_t recmaster_role);
454 int ctdb_reply_control_set_recmasterrole(struct ctdb_reply_control *reply);
456 void ctdb_req_control_set_ban_state(struct ctdb_req_control *request,
457 struct ctdb_ban_state *ban_state);
458 int ctdb_reply_control_set_ban_state(struct ctdb_reply_control *reply);
460 void ctdb_req_control_get_ban_state(struct ctdb_req_control *request);
461 int ctdb_reply_control_get_ban_state(struct ctdb_reply_control *reply,
463 struct ctdb_ban_state **ban_state);
465 void ctdb_req_control_register_notify(struct ctdb_req_control *request,
466 struct ctdb_notify_data *notify);
467 int ctdb_reply_control_register_notify(struct ctdb_reply_control *reply);
469 void ctdb_req_control_deregister_notify(struct ctdb_req_control *request,
471 int ctdb_reply_control_deregister_notify(struct ctdb_reply_control *reply);
473 void ctdb_req_control_trans3_commit(struct ctdb_req_control *request,
474 struct ctdb_rec_buffer *recbuf);
475 int ctdb_reply_control_trans3_commit(struct ctdb_reply_control *reply);
477 void ctdb_req_control_get_db_seqnum(struct ctdb_req_control *request,
479 int ctdb_reply_control_get_db_seqnum(struct ctdb_reply_control *reply,
482 void ctdb_req_control_db_set_healthy(struct ctdb_req_control *request,
484 int ctdb_reply_control_db_set_healthy(struct ctdb_reply_control *reply);
486 void ctdb_req_control_db_get_health(struct ctdb_req_control *request,
488 int ctdb_reply_control_db_get_health(struct ctdb_reply_control *reply,
490 const char **reason);
492 void ctdb_req_control_get_public_ip_info(struct ctdb_req_control *request,
493 ctdb_sock_addr *addr);
494 int ctdb_reply_control_get_public_ip_info(struct ctdb_reply_control *reply,
496 struct ctdb_public_ip_info **ipinfo);
498 void ctdb_req_control_get_ifaces(struct ctdb_req_control *request);
499 int ctdb_reply_control_get_ifaces(struct ctdb_reply_control *reply,
501 struct ctdb_iface_list **iface_list);
503 void ctdb_req_control_set_iface_link_state(struct ctdb_req_control *request,
504 struct ctdb_iface *iface);
505 int ctdb_reply_control_set_iface_link_state(struct ctdb_reply_control *reply);
507 void ctdb_req_control_tcp_add_delayed_update(struct ctdb_req_control *request,
508 struct ctdb_connection *conn);
509 int ctdb_reply_control_tcp_add_delayed_update(struct ctdb_reply_control *reply);
511 void ctdb_req_control_get_stat_history(struct ctdb_req_control *request);
512 int ctdb_reply_control_get_stat_history(struct ctdb_reply_control *reply,
514 struct ctdb_statistics_list **stats_list);
516 void ctdb_req_control_schedule_for_deletion(struct ctdb_req_control *request,
517 struct ctdb_key_data *key);
518 int ctdb_reply_control_schedule_for_deletion(struct ctdb_reply_control *reply);
520 void ctdb_req_control_set_db_readonly(struct ctdb_req_control *request,
522 int ctdb_reply_control_set_db_readonly(struct ctdb_reply_control *reply);
524 void ctdb_req_control_traverse_start_ext(struct ctdb_req_control *request,
525 struct ctdb_traverse_start_ext *traverse);
526 int ctdb_reply_control_traverse_start_ext(struct ctdb_reply_control *reply);
528 void ctdb_req_control_get_db_statistics(struct ctdb_req_control *request,
530 int ctdb_reply_control_get_db_statistics(struct ctdb_reply_control *reply,
532 struct ctdb_db_statistics **dbstats);
534 void ctdb_req_control_set_db_sticky(struct ctdb_req_control *request,
536 int ctdb_reply_control_set_db_sticky(struct ctdb_reply_control *reply);
538 void ctdb_req_control_reload_public_ips(struct ctdb_req_control *request);
539 int ctdb_reply_control_reload_public_ips(struct ctdb_reply_control *reply);
541 void ctdb_req_control_receive_records(struct ctdb_req_control *request,
542 struct ctdb_rec_buffer *recbuf);
543 int ctdb_reply_control_receive_records(struct ctdb_reply_control *reply,
545 struct ctdb_rec_buffer **recbuf);
547 void ctdb_req_control_ipreallocated(struct ctdb_req_control *request);
548 int ctdb_reply_control_ipreallocated(struct ctdb_reply_control *reply);
550 void ctdb_req_control_get_runstate(struct ctdb_req_control *request);
551 int ctdb_reply_control_get_runstate(struct ctdb_reply_control *reply,
552 enum ctdb_runstate *runstate);
554 void ctdb_req_control_db_detach(struct ctdb_req_control *request,
556 int ctdb_reply_control_db_detach(struct ctdb_reply_control *reply);
558 void ctdb_req_control_get_nodes_file(struct ctdb_req_control *request);
559 int ctdb_reply_control_get_nodes_file(struct ctdb_reply_control *reply,
561 struct ctdb_node_map **nodemap);
563 void ctdb_req_control_db_freeze(struct ctdb_req_control *request,
565 int ctdb_reply_control_db_freeze(struct ctdb_reply_control *reply);
567 void ctdb_req_control_db_thaw(struct ctdb_req_control *request,
569 int ctdb_reply_control_db_thaw(struct ctdb_reply_control *reply);
571 void ctdb_req_control_db_transaction_start(struct ctdb_req_control *request,
572 struct ctdb_transdb *transdb);
573 int ctdb_reply_control_db_transaction_start(struct ctdb_reply_control *reply);
575 void ctdb_req_control_db_transaction_commit(struct ctdb_req_control *request,
576 struct ctdb_transdb *transdb);
577 int ctdb_reply_control_db_transaction_commit(struct ctdb_reply_control *reply);
579 void ctdb_req_control_db_transaction_cancel(struct ctdb_req_control *request,
581 int ctdb_reply_control_db_transaction_cancel(struct ctdb_reply_control *reply);
583 void ctdb_req_control_db_pull(struct ctdb_req_control *request,
584 struct ctdb_pulldb_ext *pulldb_ext);
585 int ctdb_reply_control_db_pull(struct ctdb_reply_control *reply,
586 uint32_t *num_records);
588 void ctdb_req_control_db_push_start(struct ctdb_req_control *request,
589 struct ctdb_pulldb_ext *pulldb_ext);
590 int ctdb_reply_control_db_push_start(struct ctdb_reply_control *reply);
592 void ctdb_req_control_db_push_confirm(struct ctdb_req_control *request,
594 int ctdb_reply_control_db_push_confirm(struct ctdb_reply_control *reply,
595 uint32_t *num_records);
597 void ctdb_req_control_db_open_flags(struct ctdb_req_control *request,
599 int ctdb_reply_control_db_open_flags(struct ctdb_reply_control *reply,
602 void ctdb_req_control_db_attach_replicated(struct ctdb_req_control *request,
603 const char *db_name);
604 int ctdb_reply_control_db_attach_replicated(struct ctdb_reply_control *reply,
607 /* From protocol/protocol_debug.c */
609 void ctdb_packet_print(uint8_t *buf, size_t buflen, FILE *fp);
611 /* From protocol/protocol_message.c */
613 size_t ctdb_req_message_len(struct ctdb_req_header *h,
614 struct ctdb_req_message *c);
616 int ctdb_req_message_push(struct ctdb_req_header *h,
617 struct ctdb_req_message *c,
618 uint8_t *buf, size_t *buflen);
620 int ctdb_req_message_pull(uint8_t *buf, size_t buflen,
621 struct ctdb_req_header *h,
623 struct ctdb_req_message *c);
625 size_t ctdb_req_message_data_len(struct ctdb_req_header *h,
626 struct ctdb_req_message_data *c);
628 int ctdb_req_message_data_push(struct ctdb_req_header *h,
629 struct ctdb_req_message_data *c,
630 uint8_t *buf, size_t *buflen);
632 int ctdb_req_message_data_pull(uint8_t *buf, size_t buflen,
633 struct ctdb_req_header *h,
635 struct ctdb_req_message_data *c);
637 /* From protocol/protocol_event.c */
639 void ctdb_event_header_fill(struct ctdb_event_header *h, uint32_t reqid);
641 size_t ctdb_event_request_len(struct ctdb_event_request *in);
643 int ctdb_event_request_push(struct ctdb_event_request *in,
644 uint8_t *buf, size_t *buflen);
646 int ctdb_event_request_pull(uint8_t *buf, size_t buflen,
648 struct ctdb_event_request *out);
650 size_t ctdb_event_reply_len(struct ctdb_event_reply *in);
652 int ctdb_event_reply_push(struct ctdb_event_reply *in,
653 uint8_t *buf, size_t *buflen);
655 int ctdb_event_reply_pull(uint8_t *buf, size_t buflen,
657 struct ctdb_event_reply *out);
659 /* From protocol/protocol_packet.c */
661 int ctdb_allocate_pkt(TALLOC_CTX *mem_ctx, size_t datalen,
662 uint8_t **buf, size_t *buflen);
664 /* From protocol/protocol_util.c */
666 const char *ctdb_runstate_to_string(enum ctdb_runstate runstate);
667 enum ctdb_runstate ctdb_runstate_from_string(const char *runstate_str);
669 const char *ctdb_event_to_string(enum ctdb_event event);
670 enum ctdb_event ctdb_event_from_string(const char *event_str);
672 const char *ctdb_sock_addr_to_string(TALLOC_CTX *mem_ctx, ctdb_sock_addr *addr);
673 int ctdb_sock_addr_cmp_ip(const ctdb_sock_addr *addr1,
674 const ctdb_sock_addr *addr2);
675 int ctdb_sock_addr_cmp(const ctdb_sock_addr *addr1,
676 const ctdb_sock_addr *addr2);
677 bool ctdb_sock_addr_same_ip(const ctdb_sock_addr *addr1,
678 const ctdb_sock_addr *addr2);
679 bool ctdb_sock_addr_same(const ctdb_sock_addr *addr1,
680 const ctdb_sock_addr *addr2);
682 #endif /* __CTDB_PROTOCOL_API_H__ */