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 *in);
73 void ctdb_g_lock_list_push(struct ctdb_g_lock_list *in, uint8_t *buf,
75 int ctdb_g_lock_list_pull(uint8_t *buf, size_t buflen, TALLOC_CTX *mem_ctx,
76 struct ctdb_g_lock_list **out, size_t *npull);
78 /* From protocol/protocol_header.c */
80 void ctdb_req_header_fill(struct ctdb_req_header *h, uint32_t generation,
81 uint32_t operation, uint32_t destnode,
82 uint32_t srcnode, uint32_t reqid);
84 size_t ctdb_req_header_len(struct ctdb_req_header *h);
85 void ctdb_req_header_push(struct ctdb_req_header *h, uint8_t *buf);
86 int ctdb_req_header_pull(uint8_t *buf, size_t buflen,
87 struct ctdb_req_header *h);
89 int ctdb_req_header_verify(struct ctdb_req_header *h, uint32_t operation);
91 /* From protocol/protocol_call.c */
93 size_t ctdb_req_call_len(struct ctdb_req_header *h,
94 struct ctdb_req_call *c);
96 int ctdb_req_call_push(struct ctdb_req_header *h,
97 struct ctdb_req_call *c,
98 uint8_t *buf, size_t *buflen);
100 int ctdb_req_call_pull(uint8_t *buf, size_t buflen,
101 struct ctdb_req_header *h,
103 struct ctdb_req_call *c);
105 size_t ctdb_reply_call_len(struct ctdb_req_header *h,
106 struct ctdb_reply_call *c);
108 int ctdb_reply_call_push(struct ctdb_req_header *h,
109 struct ctdb_reply_call *c,
110 uint8_t *buf, size_t *buflen);
112 int ctdb_reply_call_pull(uint8_t *buf, size_t buflen,
113 struct ctdb_req_header *h,
115 struct ctdb_reply_call *c);
117 size_t ctdb_reply_error_len(struct ctdb_req_header *h,
118 struct ctdb_reply_error *c);
120 int ctdb_reply_error_push(struct ctdb_req_header *h,
121 struct ctdb_reply_error *c,
122 uint8_t *buf, size_t *buflen);
124 int ctdb_reply_error_pull(uint8_t *buf, size_t buflen,
125 struct ctdb_req_header *h,
127 struct ctdb_reply_error *c);
129 size_t ctdb_req_dmaster_len(struct ctdb_req_header *h,
130 struct ctdb_req_dmaster *c);
132 int ctdb_req_dmaster_push(struct ctdb_req_header *h,
133 struct ctdb_req_dmaster *c,
134 uint8_t *buf, size_t *buflen);
136 int ctdb_req_dmaster_pull(uint8_t *buf, size_t buflen,
137 struct ctdb_req_header *h,
139 struct ctdb_req_dmaster *c);
141 size_t ctdb_reply_dmaster_len(struct ctdb_req_header *h,
142 struct ctdb_reply_dmaster *c);
144 int ctdb_reply_dmaster_push(struct ctdb_req_header *h,
145 struct ctdb_reply_dmaster *c,
146 uint8_t *buf, size_t *buflen);
148 int ctdb_reply_dmaster_pull(uint8_t *buf, size_t buflen,
149 struct ctdb_req_header *h,
151 struct ctdb_reply_dmaster *c);
153 /* From protocol/protocol_control.c */
155 size_t ctdb_req_control_len(struct ctdb_req_header *h,
156 struct ctdb_req_control *c);
158 int ctdb_req_control_push(struct ctdb_req_header *h,
159 struct ctdb_req_control *c,
160 uint8_t *buf, size_t *buflen);
162 int ctdb_req_control_pull(uint8_t *buf, size_t buflen,
163 struct ctdb_req_header *h,
165 struct ctdb_req_control *c);
167 size_t ctdb_reply_control_len(struct ctdb_req_header *h,
168 struct ctdb_reply_control *c);
170 int ctdb_reply_control_push(struct ctdb_req_header *h,
171 struct ctdb_reply_control *c,
172 uint8_t *buf, size_t *buflen);
174 int ctdb_reply_control_pull(uint8_t *buf, size_t buflen, uint32_t opcode,
175 struct ctdb_req_header *h,
177 struct ctdb_reply_control *c);
179 /* From protocol/protocol_client.c */
181 void ctdb_req_control_process_exists(struct ctdb_req_control *request,
183 int ctdb_reply_control_process_exists(struct ctdb_reply_control *reply,
186 void ctdb_req_control_statistics(struct ctdb_req_control *request);
188 int ctdb_reply_control_statistics(struct ctdb_reply_control *reply,
190 struct ctdb_statistics **stats);
192 void ctdb_req_control_ping(struct ctdb_req_control *request);
193 int ctdb_reply_control_ping(struct ctdb_reply_control *reply,
196 void ctdb_req_control_getdbpath(struct ctdb_req_control *request,
198 int ctdb_reply_control_getdbpath(struct ctdb_reply_control *reply,
199 TALLOC_CTX *mem_ctx, const char **db_path);
201 void ctdb_req_control_getvnnmap(struct ctdb_req_control *request);
202 int ctdb_reply_control_getvnnmap(struct ctdb_reply_control *reply,
204 struct ctdb_vnn_map **vnnmap);
206 void ctdb_req_control_setvnnmap(struct ctdb_req_control *request,
207 struct ctdb_vnn_map *vnnmap);
208 int ctdb_reply_control_setvnnmap(struct ctdb_reply_control *reply);
210 void ctdb_req_control_get_debug(struct ctdb_req_control *request);
211 int ctdb_reply_control_get_debug(struct ctdb_reply_control *reply,
214 void ctdb_req_control_set_debug(struct ctdb_req_control *request,
216 int ctdb_reply_control_set_debug(struct ctdb_reply_control *reply);
218 void ctdb_req_control_get_dbmap(struct ctdb_req_control *request);
219 int ctdb_reply_control_get_dbmap(struct ctdb_reply_control *reply,
221 struct ctdb_dbid_map **dbmap);
223 void ctdb_req_control_pull_db(struct ctdb_req_control *request,
224 struct ctdb_pulldb *pulldb);
225 int ctdb_reply_control_pull_db(struct ctdb_reply_control *reply,
227 struct ctdb_rec_buffer **recbuf);
229 void ctdb_req_control_push_db(struct ctdb_req_control *request,
230 struct ctdb_rec_buffer *recbuf);
231 int ctdb_reply_control_push_db(struct ctdb_reply_control *reply);
233 void ctdb_req_control_get_recmode(struct ctdb_req_control *request);
234 int ctdb_reply_control_get_recmode(struct ctdb_reply_control *reply,
237 void ctdb_req_control_set_recmode(struct ctdb_req_control *request,
239 int ctdb_reply_control_set_recmode(struct ctdb_reply_control *reply);
241 void ctdb_req_control_statistics_reset(struct ctdb_req_control *request);
242 int ctdb_reply_control_statistics_reset(struct ctdb_reply_control *reply);
244 void ctdb_req_control_db_attach(struct ctdb_req_control *request,
245 const char *db_name);
246 int ctdb_reply_control_db_attach(struct ctdb_reply_control *reply,
249 void ctdb_req_control_traverse_start(struct ctdb_req_control *request,
250 struct ctdb_traverse_start *traverse);
251 int ctdb_reply_control_traverse_start(struct ctdb_reply_control *reply);
253 void ctdb_req_control_register_srvid(struct ctdb_req_control *request,
255 int ctdb_reply_control_register_srvid(struct ctdb_reply_control *reply);
257 void ctdb_req_control_deregister_srvid(struct ctdb_req_control *request,
259 int ctdb_reply_control_deregister_srvid(struct ctdb_reply_control *reply);
261 void ctdb_req_control_get_dbname(struct ctdb_req_control *request,
263 int ctdb_reply_control_get_dbname(struct ctdb_reply_control *reply,
264 TALLOC_CTX *mem_ctx, const char **db_name);
266 void ctdb_req_control_enable_seqnum(struct ctdb_req_control *request,
268 int ctdb_reply_control_enable_seqnum(struct ctdb_reply_control *reply);
270 void ctdb_req_control_update_seqnum(struct ctdb_req_control *request,
272 int ctdb_reply_control_update_seqnum(struct ctdb_reply_control *reply);
274 void ctdb_req_control_dump_memory(struct ctdb_req_control *request);
275 int ctdb_reply_control_dump_memory(struct ctdb_reply_control *reply,
276 TALLOC_CTX *mem_ctx, const char **mem_str);
278 void ctdb_req_control_get_pid(struct ctdb_req_control *request);
279 int ctdb_reply_control_get_pid(struct ctdb_reply_control *reply,
282 void ctdb_req_control_get_recmaster(struct ctdb_req_control *request);
283 int ctdb_reply_control_get_recmaster(struct ctdb_reply_control *reply,
284 uint32_t *recmaster);
286 void ctdb_req_control_set_recmaster(struct ctdb_req_control *request,
288 int ctdb_reply_control_set_recmaster(struct ctdb_reply_control *reply);
290 void ctdb_req_control_freeze(struct ctdb_req_control *request,
292 int ctdb_reply_control_freeze(struct ctdb_reply_control *reply);
294 void ctdb_req_control_get_pnn(struct ctdb_req_control *request);
295 int ctdb_reply_control_get_pnn(struct ctdb_reply_control *reply,
298 void ctdb_req_control_shutdown(struct ctdb_req_control *request);
299 int ctdb_reply_control_shutdown(struct ctdb_reply_control *reply);
301 void ctdb_req_control_get_monmode(struct ctdb_req_control *request);
302 int ctdb_reply_control_get_monmode(struct ctdb_reply_control *reply,
305 void ctdb_req_control_tcp_client(struct ctdb_req_control *request,
306 struct ctdb_connection *conn);
307 int ctdb_reply_control_tcp_client(struct ctdb_reply_control *reply);
309 void ctdb_req_control_tcp_add(struct ctdb_req_control *request,
310 struct ctdb_connection *conn);
311 int ctdb_reply_control_tcp_add(struct ctdb_reply_control *reply);
313 void ctdb_req_control_tcp_remove(struct ctdb_req_control *request,
314 struct ctdb_connection *conn);
315 int ctdb_reply_control_tcp_remove(struct ctdb_reply_control *reply);
317 void ctdb_req_control_startup(struct ctdb_req_control *request);
318 int ctdb_reply_control_startup(struct ctdb_reply_control *reply);
320 void ctdb_req_control_set_tunable(struct ctdb_req_control *request,
321 struct ctdb_tunable *tunable);
322 int ctdb_reply_control_set_tunable(struct ctdb_reply_control *reply);
324 void ctdb_req_control_get_tunable(struct ctdb_req_control *request,
326 int ctdb_reply_control_get_tunable(struct ctdb_reply_control *reply,
329 void ctdb_req_control_list_tunables(struct ctdb_req_control *request);
330 int ctdb_reply_control_list_tunables(struct ctdb_reply_control *reply,
332 struct ctdb_var_list **tun_var_list);
334 void ctdb_req_control_modify_flags(struct ctdb_req_control *request,
335 struct ctdb_node_flag_change *flag_change);
336 int ctdb_reply_control_modify_flags(struct ctdb_reply_control *reply);
338 void ctdb_req_control_get_all_tunables(struct ctdb_req_control *request);
339 int ctdb_reply_control_get_all_tunables(struct ctdb_reply_control *reply,
341 struct ctdb_tunable_list **tun_list);
343 void ctdb_req_control_get_tcp_tickle_list(struct ctdb_req_control *request,
344 ctdb_sock_addr *addr);
345 int ctdb_reply_control_get_tcp_tickle_list(struct ctdb_reply_control *reply,
347 struct ctdb_tickle_list **tickles);
349 void ctdb_req_control_set_tcp_tickle_list(struct ctdb_req_control *request,
350 struct ctdb_tickle_list *tickles);
351 int ctdb_reply_control_set_tcp_tickle_list(struct ctdb_reply_control *reply);
353 void ctdb_req_control_db_attach_persistent(struct ctdb_req_control *request,
355 int ctdb_reply_control_db_attach_persistent(struct ctdb_reply_control *reply,
358 void ctdb_req_control_update_record(struct ctdb_req_control *request,
359 struct ctdb_rec_buffer *recbuf);
360 int ctdb_reply_control_update_record(struct ctdb_reply_control *reply);
362 void ctdb_req_control_send_gratuitous_arp(struct ctdb_req_control *request,
363 struct ctdb_addr_info *addr_info);
364 int ctdb_reply_control_send_gratuitous_arp(struct ctdb_reply_control *reply);
366 void ctdb_req_control_wipe_database(struct ctdb_req_control *request,
367 struct ctdb_transdb *transdb);
368 int ctdb_reply_control_wipe_database(struct ctdb_reply_control *reply);
370 void ctdb_req_control_uptime(struct ctdb_req_control *request);
371 int ctdb_reply_control_uptime(struct ctdb_reply_control *reply,
373 struct ctdb_uptime **uptime);
375 void ctdb_req_control_start_recovery(struct ctdb_req_control *request);
376 int ctdb_reply_control_start_recovery(struct ctdb_reply_control *reply);
378 void ctdb_req_control_end_recovery(struct ctdb_req_control *request);
379 int ctdb_reply_control_end_recovery(struct ctdb_reply_control *reply);
381 void ctdb_req_control_reload_nodes_file(struct ctdb_req_control *request);
382 int ctdb_reply_control_reload_nodes_file(struct ctdb_reply_control *reply);
384 void ctdb_req_control_try_delete_records(struct ctdb_req_control *request,
385 struct ctdb_rec_buffer *recbuf);
386 int ctdb_reply_control_try_delete_records(struct ctdb_reply_control *reply,
388 struct ctdb_rec_buffer **recbuf);
390 void ctdb_req_control_enable_monitor(struct ctdb_req_control *request);
391 int ctdb_reply_control_enable_monitor(struct ctdb_reply_control *reply);
393 void ctdb_req_control_disable_monitor(struct ctdb_req_control *request);
394 int ctdb_reply_control_disable_monitor(struct ctdb_reply_control *reply);
396 void ctdb_req_control_add_public_ip(struct ctdb_req_control *request,
397 struct ctdb_addr_info *addr_info);
398 int ctdb_reply_control_add_public_ip(struct ctdb_reply_control *reply);
400 void ctdb_req_control_del_public_ip(struct ctdb_req_control *request,
401 struct ctdb_addr_info *addr_info);
402 int ctdb_reply_control_del_public_ip(struct ctdb_reply_control *reply);
404 void ctdb_req_control_get_capabilities(struct ctdb_req_control *request);
405 int ctdb_reply_control_get_capabilities(struct ctdb_reply_control *reply,
408 void ctdb_req_control_recd_ping(struct ctdb_req_control *request);
409 int ctdb_reply_control_recd_ping(struct ctdb_reply_control *reply);
411 void ctdb_req_control_release_ip(struct ctdb_req_control *request,
412 struct ctdb_public_ip *pubip);
413 int ctdb_reply_control_release_ip(struct ctdb_reply_control *reply);
415 void ctdb_req_control_takeover_ip(struct ctdb_req_control *request,
416 struct ctdb_public_ip *pubip);
417 int ctdb_reply_control_takeover_ip(struct ctdb_reply_control *reply);
419 void ctdb_req_control_get_public_ips(struct ctdb_req_control *request,
420 bool available_only);
421 int ctdb_reply_control_get_public_ips(struct ctdb_reply_control *reply,
423 struct ctdb_public_ip_list **pubip_list);
425 void ctdb_req_control_get_nodemap(struct ctdb_req_control *request);
426 int ctdb_reply_control_get_nodemap(struct ctdb_reply_control *reply,
428 struct ctdb_node_map **nodemap);
430 void ctdb_req_control_traverse_kill(struct ctdb_req_control *request,
431 struct ctdb_traverse_start *traverse);
432 int ctdb_reply_control_traverse_kill(struct ctdb_reply_control *reply);
434 void ctdb_req_control_recd_reclock_latency(struct ctdb_req_control *request,
435 double reclock_latency);
436 int ctdb_reply_control_recd_reclock_latency(struct ctdb_reply_control *reply);
438 void ctdb_req_control_get_reclock_file(struct ctdb_req_control *request);
439 int ctdb_reply_control_get_reclock_file(struct ctdb_reply_control *reply,
441 const char **reclock_file);
443 void ctdb_req_control_stop_node(struct ctdb_req_control *request);
444 int ctdb_reply_control_stop_node(struct ctdb_reply_control *reply);
446 void ctdb_req_control_continue_node(struct ctdb_req_control *request);
447 int ctdb_reply_control_continue_node(struct ctdb_reply_control *reply);
449 void ctdb_req_control_set_lmasterrole(struct ctdb_req_control *request,
450 uint32_t lmaster_role);
451 int ctdb_reply_control_set_lmasterrole(struct ctdb_reply_control *reply);
453 void ctdb_req_control_set_recmasterrole(struct ctdb_req_control *request,
454 uint32_t recmaster_role);
455 int ctdb_reply_control_set_recmasterrole(struct ctdb_reply_control *reply);
457 void ctdb_req_control_set_ban_state(struct ctdb_req_control *request,
458 struct ctdb_ban_state *ban_state);
459 int ctdb_reply_control_set_ban_state(struct ctdb_reply_control *reply);
461 void ctdb_req_control_get_ban_state(struct ctdb_req_control *request);
462 int ctdb_reply_control_get_ban_state(struct ctdb_reply_control *reply,
464 struct ctdb_ban_state **ban_state);
466 void ctdb_req_control_register_notify(struct ctdb_req_control *request,
467 struct ctdb_notify_data *notify);
468 int ctdb_reply_control_register_notify(struct ctdb_reply_control *reply);
470 void ctdb_req_control_deregister_notify(struct ctdb_req_control *request,
472 int ctdb_reply_control_deregister_notify(struct ctdb_reply_control *reply);
474 void ctdb_req_control_trans3_commit(struct ctdb_req_control *request,
475 struct ctdb_rec_buffer *recbuf);
476 int ctdb_reply_control_trans3_commit(struct ctdb_reply_control *reply);
478 void ctdb_req_control_get_db_seqnum(struct ctdb_req_control *request,
480 int ctdb_reply_control_get_db_seqnum(struct ctdb_reply_control *reply,
483 void ctdb_req_control_db_set_healthy(struct ctdb_req_control *request,
485 int ctdb_reply_control_db_set_healthy(struct ctdb_reply_control *reply);
487 void ctdb_req_control_db_get_health(struct ctdb_req_control *request,
489 int ctdb_reply_control_db_get_health(struct ctdb_reply_control *reply,
491 const char **reason);
493 void ctdb_req_control_get_public_ip_info(struct ctdb_req_control *request,
494 ctdb_sock_addr *addr);
495 int ctdb_reply_control_get_public_ip_info(struct ctdb_reply_control *reply,
497 struct ctdb_public_ip_info **ipinfo);
499 void ctdb_req_control_get_ifaces(struct ctdb_req_control *request);
500 int ctdb_reply_control_get_ifaces(struct ctdb_reply_control *reply,
502 struct ctdb_iface_list **iface_list);
504 void ctdb_req_control_set_iface_link_state(struct ctdb_req_control *request,
505 struct ctdb_iface *iface);
506 int ctdb_reply_control_set_iface_link_state(struct ctdb_reply_control *reply);
508 void ctdb_req_control_tcp_add_delayed_update(struct ctdb_req_control *request,
509 struct ctdb_connection *conn);
510 int ctdb_reply_control_tcp_add_delayed_update(struct ctdb_reply_control *reply);
512 void ctdb_req_control_get_stat_history(struct ctdb_req_control *request);
513 int ctdb_reply_control_get_stat_history(struct ctdb_reply_control *reply,
515 struct ctdb_statistics_list **stats_list);
517 void ctdb_req_control_schedule_for_deletion(struct ctdb_req_control *request,
518 struct ctdb_key_data *key);
519 int ctdb_reply_control_schedule_for_deletion(struct ctdb_reply_control *reply);
521 void ctdb_req_control_set_db_readonly(struct ctdb_req_control *request,
523 int ctdb_reply_control_set_db_readonly(struct ctdb_reply_control *reply);
525 void ctdb_req_control_traverse_start_ext(struct ctdb_req_control *request,
526 struct ctdb_traverse_start_ext *traverse);
527 int ctdb_reply_control_traverse_start_ext(struct ctdb_reply_control *reply);
529 void ctdb_req_control_get_db_statistics(struct ctdb_req_control *request,
531 int ctdb_reply_control_get_db_statistics(struct ctdb_reply_control *reply,
533 struct ctdb_db_statistics **dbstats);
535 void ctdb_req_control_set_db_sticky(struct ctdb_req_control *request,
537 int ctdb_reply_control_set_db_sticky(struct ctdb_reply_control *reply);
539 void ctdb_req_control_reload_public_ips(struct ctdb_req_control *request);
540 int ctdb_reply_control_reload_public_ips(struct ctdb_reply_control *reply);
542 void ctdb_req_control_receive_records(struct ctdb_req_control *request,
543 struct ctdb_rec_buffer *recbuf);
544 int ctdb_reply_control_receive_records(struct ctdb_reply_control *reply,
546 struct ctdb_rec_buffer **recbuf);
548 void ctdb_req_control_ipreallocated(struct ctdb_req_control *request);
549 int ctdb_reply_control_ipreallocated(struct ctdb_reply_control *reply);
551 void ctdb_req_control_get_runstate(struct ctdb_req_control *request);
552 int ctdb_reply_control_get_runstate(struct ctdb_reply_control *reply,
553 enum ctdb_runstate *runstate);
555 void ctdb_req_control_db_detach(struct ctdb_req_control *request,
557 int ctdb_reply_control_db_detach(struct ctdb_reply_control *reply);
559 void ctdb_req_control_get_nodes_file(struct ctdb_req_control *request);
560 int ctdb_reply_control_get_nodes_file(struct ctdb_reply_control *reply,
562 struct ctdb_node_map **nodemap);
564 void ctdb_req_control_db_freeze(struct ctdb_req_control *request,
566 int ctdb_reply_control_db_freeze(struct ctdb_reply_control *reply);
568 void ctdb_req_control_db_thaw(struct ctdb_req_control *request,
570 int ctdb_reply_control_db_thaw(struct ctdb_reply_control *reply);
572 void ctdb_req_control_db_transaction_start(struct ctdb_req_control *request,
573 struct ctdb_transdb *transdb);
574 int ctdb_reply_control_db_transaction_start(struct ctdb_reply_control *reply);
576 void ctdb_req_control_db_transaction_commit(struct ctdb_req_control *request,
577 struct ctdb_transdb *transdb);
578 int ctdb_reply_control_db_transaction_commit(struct ctdb_reply_control *reply);
580 void ctdb_req_control_db_transaction_cancel(struct ctdb_req_control *request,
582 int ctdb_reply_control_db_transaction_cancel(struct ctdb_reply_control *reply);
584 void ctdb_req_control_db_pull(struct ctdb_req_control *request,
585 struct ctdb_pulldb_ext *pulldb_ext);
586 int ctdb_reply_control_db_pull(struct ctdb_reply_control *reply,
587 uint32_t *num_records);
589 void ctdb_req_control_db_push_start(struct ctdb_req_control *request,
590 struct ctdb_pulldb_ext *pulldb_ext);
591 int ctdb_reply_control_db_push_start(struct ctdb_reply_control *reply);
593 void ctdb_req_control_db_push_confirm(struct ctdb_req_control *request,
595 int ctdb_reply_control_db_push_confirm(struct ctdb_reply_control *reply,
596 uint32_t *num_records);
598 void ctdb_req_control_db_open_flags(struct ctdb_req_control *request,
600 int ctdb_reply_control_db_open_flags(struct ctdb_reply_control *reply,
603 void ctdb_req_control_db_attach_replicated(struct ctdb_req_control *request,
604 const char *db_name);
605 int ctdb_reply_control_db_attach_replicated(struct ctdb_reply_control *reply,
608 /* From protocol/protocol_debug.c */
610 void ctdb_packet_print(uint8_t *buf, size_t buflen, FILE *fp);
612 /* From protocol/protocol_message.c */
614 size_t ctdb_req_message_len(struct ctdb_req_header *h,
615 struct ctdb_req_message *c);
617 int ctdb_req_message_push(struct ctdb_req_header *h,
618 struct ctdb_req_message *c,
619 uint8_t *buf, size_t *buflen);
621 int ctdb_req_message_pull(uint8_t *buf, size_t buflen,
622 struct ctdb_req_header *h,
624 struct ctdb_req_message *c);
626 size_t ctdb_req_message_data_len(struct ctdb_req_header *h,
627 struct ctdb_req_message_data *c);
629 int ctdb_req_message_data_push(struct ctdb_req_header *h,
630 struct ctdb_req_message_data *c,
631 uint8_t *buf, size_t *buflen);
633 int ctdb_req_message_data_pull(uint8_t *buf, size_t buflen,
634 struct ctdb_req_header *h,
636 struct ctdb_req_message_data *c);
638 /* From protocol/protocol_event.c */
640 void ctdb_event_header_fill(struct ctdb_event_header *h, uint32_t reqid);
642 size_t ctdb_event_request_len(struct ctdb_event_request *in);
644 int ctdb_event_request_push(struct ctdb_event_request *in,
645 uint8_t *buf, size_t *buflen);
647 int ctdb_event_request_pull(uint8_t *buf, size_t buflen,
649 struct ctdb_event_request *out);
651 size_t ctdb_event_reply_len(struct ctdb_event_reply *in);
653 int ctdb_event_reply_push(struct ctdb_event_reply *in,
654 uint8_t *buf, size_t *buflen);
656 int ctdb_event_reply_pull(uint8_t *buf, size_t buflen,
658 struct ctdb_event_reply *out);
660 /* From protocol/protocol_packet.c */
662 int ctdb_allocate_pkt(TALLOC_CTX *mem_ctx, size_t datalen,
663 uint8_t **buf, size_t *buflen);
665 /* From protocol/protocol_util.c */
667 const char *ctdb_runstate_to_string(enum ctdb_runstate runstate);
668 enum ctdb_runstate ctdb_runstate_from_string(const char *runstate_str);
670 const char *ctdb_event_to_string(enum ctdb_event event);
671 enum ctdb_event ctdb_event_from_string(const char *event_str);
673 const char *ctdb_sock_addr_to_string(TALLOC_CTX *mem_ctx, ctdb_sock_addr *addr);
674 int ctdb_sock_addr_cmp_ip(const ctdb_sock_addr *addr1,
675 const ctdb_sock_addr *addr2);
676 int ctdb_sock_addr_cmp(const ctdb_sock_addr *addr1,
677 const ctdb_sock_addr *addr2);
678 bool ctdb_sock_addr_same_ip(const ctdb_sock_addr *addr1,
679 const ctdb_sock_addr *addr2);
680 bool ctdb_sock_addr_same(const ctdb_sock_addr *addr1,
681 const ctdb_sock_addr *addr2);
683 #endif /* __CTDB_PROTOCOL_API_H__ */