ctdb-tool: Add replacement ctdb tool using new client API
[Samba.git] / ctdb / protocol / protocol_api.h
blob2c1977589f6e01362c7f025c085bbee4d45c8480
1 /*
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__
23 #include <talloc.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,
47 uint32_t db_id);
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,
53 void *private_data);
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,
97 TALLOC_CTX *mem_ctx,
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,
109 TALLOC_CTX *mem_ctx,
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,
121 TALLOC_CTX *mem_ctx,
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,
133 TALLOC_CTX *mem_ctx,
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,
145 TALLOC_CTX *mem_ctx,
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,
159 TALLOC_CTX *mem_ctx,
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,
171 TALLOC_CTX *mem_ctx,
172 struct ctdb_reply_control *c);
174 /* From protocol/protocol_client.c */
176 void ctdb_req_control_process_exists(struct ctdb_req_control *request,
177 pid_t pid);
178 int ctdb_reply_control_process_exists(struct ctdb_reply_control *reply,
179 int *status);
181 void ctdb_req_control_statistics(struct ctdb_req_control *request);
183 int ctdb_reply_control_statistics(struct ctdb_reply_control *reply,
184 TALLOC_CTX *mem_ctx,
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,
189 int *num_clients);
191 void ctdb_req_control_getdbpath(struct ctdb_req_control *request,
192 uint32_t db_id);
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,
198 TALLOC_CTX *mem_ctx,
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,
207 uint32_t *debug_level);
209 void ctdb_req_control_set_debug(struct ctdb_req_control *request,
210 uint32_t debug_level);
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,
215 TALLOC_CTX *mem_ctx,
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,
221 TALLOC_CTX *mem_ctx,
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,
230 int *recmode);
232 void ctdb_req_control_set_recmode(struct ctdb_req_control *request,
233 int recmode);
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,
242 uint32_t *db_id);
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,
249 uint64_t srvid);
250 int ctdb_reply_control_register_srvid(struct ctdb_reply_control *reply);
252 void ctdb_req_control_deregister_srvid(struct ctdb_req_control *request,
253 uint64_t srvid);
254 int ctdb_reply_control_deregister_srvid(struct ctdb_reply_control *reply);
256 void ctdb_req_control_get_dbname(struct ctdb_req_control *request,
257 uint32_t db_id);
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,
262 uint32_t db_id);
263 int ctdb_reply_control_enable_seqnum(struct ctdb_reply_control *reply);
265 void ctdb_req_control_update_seqnum(struct ctdb_req_control *request,
266 uint32_t db_id);
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,
275 pid_t *pid);
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,
282 int recmaster);
283 int ctdb_reply_control_set_recmaster(struct ctdb_reply_control *reply);
285 void ctdb_req_control_freeze(struct ctdb_req_control *request,
286 uint32_t priority);
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,
291 uint32_t *pnn);
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,
298 int *mon_mode);
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,
320 const char *name);
321 int ctdb_reply_control_get_tunable(struct ctdb_reply_control *reply,
322 uint32_t *value);
324 void ctdb_req_control_list_tunables(struct ctdb_req_control *request);
325 int ctdb_reply_control_list_tunables(struct ctdb_reply_control *reply,
326 TALLOC_CTX *mem_ctx,
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,
335 TALLOC_CTX *mem_ctx,
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,
341 TALLOC_CTX *mem_ctx,
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,
349 const char *name,
350 uint32_t tdb_flags);
351 int ctdb_reply_control_db_attach_persistent(struct ctdb_reply_control *reply,
352 uint32_t *db_id);
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_transaction_start(struct ctdb_req_control *request,
363 uint32_t tid);
364 int ctdb_reply_control_transaction_start(struct ctdb_reply_control *reply);
366 void ctdb_req_control_transaction_commit(struct ctdb_req_control *request,
367 uint32_t tid);
368 int ctdb_reply_control_transaction_commit(struct ctdb_reply_control *reply);
370 void ctdb_req_control_wipe_database(struct ctdb_req_control *request,
371 struct ctdb_transdb *transdb);
372 int ctdb_reply_control_wipe_database(struct ctdb_reply_control *reply);
374 void ctdb_req_control_uptime(struct ctdb_req_control *request);
375 int ctdb_reply_control_uptime(struct ctdb_reply_control *reply,
376 TALLOC_CTX *mem_ctx,
377 struct ctdb_uptime **uptime);
379 void ctdb_req_control_start_recovery(struct ctdb_req_control *request);
380 int ctdb_reply_control_start_recovery(struct ctdb_reply_control *reply);
382 void ctdb_req_control_end_recovery(struct ctdb_req_control *request);
383 int ctdb_reply_control_end_recovery(struct ctdb_reply_control *reply);
385 void ctdb_req_control_reload_nodes_file(struct ctdb_req_control *request);
386 int ctdb_reply_control_reload_nodes_file(struct ctdb_reply_control *reply);
388 void ctdb_req_control_try_delete_records(struct ctdb_req_control *request,
389 struct ctdb_rec_buffer *recbuf);
390 int ctdb_reply_control_try_delete_records(struct ctdb_reply_control *reply,
391 TALLOC_CTX *mem_ctx,
392 struct ctdb_rec_buffer **recbuf);
394 void ctdb_req_control_enable_monitor(struct ctdb_req_control *request);
395 int ctdb_reply_control_enable_monitor(struct ctdb_reply_control *reply);
397 void ctdb_req_control_disable_monitor(struct ctdb_req_control *request);
398 int ctdb_reply_control_disable_monitor(struct ctdb_reply_control *reply);
400 void ctdb_req_control_add_public_ip(struct ctdb_req_control *request,
401 struct ctdb_addr_info *addr_info);
402 int ctdb_reply_control_add_public_ip(struct ctdb_reply_control *reply);
404 void ctdb_req_control_del_public_ip(struct ctdb_req_control *request,
405 struct ctdb_addr_info *addr_info);
406 int ctdb_reply_control_del_public_ip(struct ctdb_reply_control *reply);
408 void ctdb_req_control_run_eventscripts(struct ctdb_req_control *request,
409 const char *event_str);
410 int ctdb_reply_control_run_eventscripts(struct ctdb_reply_control *reply);
412 void ctdb_req_control_get_capabilities(struct ctdb_req_control *request);
413 int ctdb_reply_control_get_capabilities(struct ctdb_reply_control *reply,
414 uint32_t *caps);
416 void ctdb_req_control_recd_ping(struct ctdb_req_control *request);
417 int ctdb_reply_control_recd_ping(struct ctdb_reply_control *reply);
419 void ctdb_req_control_release_ip(struct ctdb_req_control *request,
420 struct ctdb_public_ip *pubip);
421 int ctdb_reply_control_release_ip(struct ctdb_reply_control *reply);
423 void ctdb_req_control_takeover_ip(struct ctdb_req_control *request,
424 struct ctdb_public_ip *pubip);
425 int ctdb_reply_control_takeover_ip(struct ctdb_reply_control *reply);
427 void ctdb_req_control_get_public_ips(struct ctdb_req_control *request);
428 int ctdb_reply_control_get_public_ips(struct ctdb_reply_control *reply,
429 TALLOC_CTX *mem_ctx,
430 struct ctdb_public_ip_list **pubip_list);
432 void ctdb_req_control_get_nodemap(struct ctdb_req_control *request);
433 int ctdb_reply_control_get_nodemap(struct ctdb_reply_control *reply,
434 TALLOC_CTX *mem_ctx,
435 struct ctdb_node_map **nodemap);
437 void ctdb_req_control_get_event_script_status(struct ctdb_req_control *request,
438 uint32_t event);
439 int ctdb_reply_control_get_event_script_status(struct ctdb_reply_control *reply,
440 TALLOC_CTX *mem_ctx,
441 struct ctdb_script_list **script_list);
443 void ctdb_req_control_traverse_kill(struct ctdb_req_control *request,
444 struct ctdb_traverse_start *traverse);
445 int ctdb_reply_control_traverse_kill(struct ctdb_reply_control *reply);
447 void ctdb_req_control_recd_reclock_latency(struct ctdb_req_control *request,
448 double reclock_latency);
449 int ctdb_reply_control_recd_reclock_latency(struct ctdb_reply_control *reply);
451 void ctdb_req_control_get_reclock_file(struct ctdb_req_control *request);
452 int ctdb_reply_control_get_reclock_file(struct ctdb_reply_control *reply,
453 TALLOC_CTX *mem_ctx,
454 const char **reclock_file);
456 void ctdb_req_control_stop_node(struct ctdb_req_control *request);
457 int ctdb_reply_control_stop_node(struct ctdb_reply_control *reply);
459 void ctdb_req_control_continue_node(struct ctdb_req_control *request);
460 int ctdb_reply_control_continue_node(struct ctdb_reply_control *reply);
462 void ctdb_req_control_set_lmasterrole(struct ctdb_req_control *request,
463 uint32_t lmaster_role);
464 int ctdb_reply_control_set_lmasterrole(struct ctdb_reply_control *reply);
466 void ctdb_req_control_set_recmasterrole(struct ctdb_req_control *request,
467 uint32_t recmaster_role);
468 int ctdb_reply_control_set_recmasterrole(struct ctdb_reply_control *reply);
470 void ctdb_req_control_enable_script(struct ctdb_req_control *request,
471 const char *script);
472 int ctdb_reply_control_enable_script(struct ctdb_reply_control *reply);
474 void ctdb_req_control_disable_script(struct ctdb_req_control *request,
475 const char *script);
476 int ctdb_reply_control_disable_script(struct ctdb_reply_control *reply);
478 void ctdb_req_control_set_ban_state(struct ctdb_req_control *request,
479 struct ctdb_ban_state *ban_state);
480 int ctdb_reply_control_set_ban_state(struct ctdb_reply_control *reply);
482 void ctdb_req_control_get_ban_state(struct ctdb_req_control *request);
483 int ctdb_reply_control_get_ban_state(struct ctdb_reply_control *reply,
484 TALLOC_CTX *mem_ctx,
485 struct ctdb_ban_state **ban_state);
487 void ctdb_req_control_transaction_cancel(struct ctdb_req_control *request,
488 uint32_t tid);
489 int ctdb_reply_control_transaction_cancel(struct ctdb_reply_control *reply);
491 void ctdb_req_control_register_notify(struct ctdb_req_control *request,
492 struct ctdb_notify_data *notify);
493 int ctdb_reply_control_register_notify(struct ctdb_reply_control *reply);
495 void ctdb_req_control_deregister_notify(struct ctdb_req_control *request,
496 uint64_t srvid);
497 int ctdb_reply_control_deregister_notify(struct ctdb_reply_control *reply);
499 void ctdb_req_control_trans3_commit(struct ctdb_req_control *request,
500 struct ctdb_rec_buffer *recbuf);
501 int ctdb_reply_control_trans3_commit(struct ctdb_reply_control *reply);
503 void ctdb_req_control_get_db_seqnum(struct ctdb_req_control *request,
504 uint32_t db_id);
505 int ctdb_reply_control_get_db_seqnum(struct ctdb_reply_control *reply,
506 uint64_t *seqnum);
508 void ctdb_req_control_db_set_healthy(struct ctdb_req_control *request,
509 uint32_t db_id);
510 int ctdb_reply_control_db_set_healthy(struct ctdb_reply_control *reply);
512 void ctdb_req_control_db_get_health(struct ctdb_req_control *request,
513 uint32_t db_id);
514 int ctdb_reply_control_db_get_health(struct ctdb_reply_control *reply,
515 TALLOC_CTX *mem_ctx,
516 const char **reason);
518 void ctdb_req_control_get_public_ip_info(struct ctdb_req_control *request,
519 ctdb_sock_addr *addr);
520 int ctdb_reply_control_get_public_ip_info(struct ctdb_reply_control *reply,
521 TALLOC_CTX *mem_ctx,
522 struct ctdb_public_ip_info **ipinfo);
524 void ctdb_req_control_get_ifaces(struct ctdb_req_control *request);
525 int ctdb_reply_control_get_ifaces(struct ctdb_reply_control *reply,
526 TALLOC_CTX *mem_ctx,
527 struct ctdb_iface_list **iface_list);
529 void ctdb_req_control_set_iface_link_state(struct ctdb_req_control *request,
530 struct ctdb_iface *iface);
531 int ctdb_reply_control_set_iface_link_state(struct ctdb_reply_control *reply);
533 void ctdb_req_control_tcp_add_delayed_update(struct ctdb_req_control *request,
534 struct ctdb_connection *conn);
535 int ctdb_reply_control_tcp_add_delayed_update(struct ctdb_reply_control *reply);
537 void ctdb_req_control_get_stat_history(struct ctdb_req_control *request);
538 int ctdb_reply_control_get_stat_history(struct ctdb_reply_control *reply,
539 TALLOC_CTX *mem_ctx,
540 struct ctdb_statistics_list **stats_list);
542 void ctdb_req_control_schedule_for_deletion(struct ctdb_req_control *request,
543 struct ctdb_key_data *key);
544 int ctdb_reply_control_schedule_for_deletion(struct ctdb_reply_control *reply);
546 void ctdb_req_control_set_db_readonly(struct ctdb_req_control *request,
547 uint32_t db_id);
548 int ctdb_reply_control_set_db_readonly(struct ctdb_reply_control *reply);
550 void ctdb_req_control_check_srvids(struct ctdb_req_control *request,
551 struct ctdb_uint64_array *u64_array);
552 int ctdb_reply_control_check_srvids(struct ctdb_reply_control *reply,
553 TALLOC_CTX *mem_ctx,
554 struct ctdb_uint8_array **u8_array);
556 void ctdb_req_control_traverse_start_ext(struct ctdb_req_control *request,
557 struct ctdb_traverse_start_ext *traverse);
558 int ctdb_reply_control_traverse_start_ext(struct ctdb_reply_control *reply);
560 void ctdb_req_control_get_db_statistics(struct ctdb_req_control *request,
561 uint32_t db_id);
562 int ctdb_reply_control_get_db_statistics(struct ctdb_reply_control *reply,
563 TALLOC_CTX *mem_ctx,
564 struct ctdb_db_statistics **dbstats);
566 void ctdb_req_control_set_db_sticky(struct ctdb_req_control *request,
567 uint32_t db_id);
568 int ctdb_reply_control_set_db_sticky(struct ctdb_reply_control *reply);
570 void ctdb_req_control_reload_public_ips(struct ctdb_req_control *request);
571 int ctdb_reply_control_reload_public_ips(struct ctdb_reply_control *reply);
573 void ctdb_req_control_receive_records(struct ctdb_req_control *request,
574 struct ctdb_rec_buffer *recbuf);
575 int ctdb_reply_control_receive_records(struct ctdb_reply_control *reply,
576 TALLOC_CTX *mem_ctx,
577 struct ctdb_rec_buffer **recbuf);
579 void ctdb_req_control_ipreallocated(struct ctdb_req_control *request);
580 int ctdb_reply_control_ipreallocated(struct ctdb_reply_control *reply);
582 void ctdb_req_control_get_runstate(struct ctdb_req_control *request);
583 int ctdb_reply_control_get_runstate(struct ctdb_reply_control *reply,
584 enum ctdb_runstate *runstate);
586 void ctdb_req_control_db_detach(struct ctdb_req_control *request,
587 uint32_t db_id);
588 int ctdb_reply_control_db_detach(struct ctdb_reply_control *reply);
590 void ctdb_req_control_get_nodes_file(struct ctdb_req_control *request);
591 int ctdb_reply_control_get_nodes_file(struct ctdb_reply_control *reply,
592 TALLOC_CTX *mem_ctx,
593 struct ctdb_node_map **nodemap);
595 void ctdb_req_control_db_freeze(struct ctdb_req_control *request,
596 uint32_t db_id);
597 int ctdb_reply_control_db_freeze(struct ctdb_reply_control *reply);
599 void ctdb_req_control_db_thaw(struct ctdb_req_control *request,
600 uint32_t db_id);
601 int ctdb_reply_control_db_thaw(struct ctdb_reply_control *reply);
603 void ctdb_req_control_db_transaction_start(struct ctdb_req_control *request,
604 struct ctdb_transdb *transdb);
605 int ctdb_reply_control_db_transaction_start(struct ctdb_reply_control *reply);
607 void ctdb_req_control_db_transaction_commit(struct ctdb_req_control *request,
608 struct ctdb_transdb *transdb);
609 int ctdb_reply_control_db_transaction_commit(struct ctdb_reply_control *reply);
611 void ctdb_req_control_db_transaction_cancel(struct ctdb_req_control *request,
612 uint32_t db_id);
613 int ctdb_reply_control_db_transaction_cancel(struct ctdb_reply_control *reply);
615 void ctdb_req_control_db_pull(struct ctdb_req_control *request,
616 struct ctdb_pulldb_ext *pulldb_ext);
617 int ctdb_reply_control_db_pull(struct ctdb_reply_control *reply,
618 uint32_t *num_records);
620 void ctdb_req_control_db_push_start(struct ctdb_req_control *request,
621 struct ctdb_pulldb_ext *pulldb_ext);
622 int ctdb_reply_control_db_push_start(struct ctdb_reply_control *reply);
624 void ctdb_req_control_db_push_confirm(struct ctdb_req_control *request,
625 uint32_t db_id);
626 int ctdb_reply_control_db_push_confirm(struct ctdb_reply_control *reply,
627 uint32_t *num_records);
629 /* From protocol/protocol_debug.c */
631 void ctdb_packet_print(uint8_t *buf, size_t buflen, FILE *fp);
633 /* From protocol/protocol_message.c */
635 size_t ctdb_req_message_len(struct ctdb_req_header *h,
636 struct ctdb_req_message *c);
638 int ctdb_req_message_push(struct ctdb_req_header *h,
639 struct ctdb_req_message *c,
640 uint8_t *buf, size_t *buflen);
642 int ctdb_req_message_pull(uint8_t *buf, size_t buflen,
643 struct ctdb_req_header *h,
644 TALLOC_CTX *mem_ctx,
645 struct ctdb_req_message *c);
647 size_t ctdb_req_message_data_len(struct ctdb_req_header *h,
648 struct ctdb_req_message_data *c);
650 int ctdb_req_message_data_push(struct ctdb_req_header *h,
651 struct ctdb_req_message_data *c,
652 uint8_t *buf, size_t *buflen);
654 int ctdb_req_message_data_pull(uint8_t *buf, size_t buflen,
655 struct ctdb_req_header *h,
656 TALLOC_CTX *mem_ctx,
657 struct ctdb_req_message_data *c);
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 bool ctdb_sock_addr_same_ip(ctdb_sock_addr *addr1, ctdb_sock_addr *addr2);
674 bool ctdb_sock_addr_same(ctdb_sock_addr *addr1, ctdb_sock_addr *addr2);
676 #endif /* __CTDB_PROTOCOL_API_H__ */