ldb_tdb: Use mem_ctx and so avoid leak onto long-term memory on duplicated add.
[Samba.git] / ctdb / protocol / protocol_api.h
blob8b40d1d8c0e9c959a2078d8a364036c0a56dd624
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 *in);
30 void ctdb_ltdb_header_push(struct ctdb_ltdb_header *in, uint8_t *buf,
31 size_t *npush);
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,
44 size_t *npush);
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,
49 uint32_t db_id);
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,
55 void *private_data);
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,
63 size_t *npush);
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,
70 size_t *npull);
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,
74 size_t *npush);
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 *in);
85 void ctdb_req_header_push(struct ctdb_req_header *in, uint8_t *buf,
86 size_t *npush);
87 int ctdb_req_header_pull(uint8_t *buf, size_t buflen,
88 struct ctdb_req_header *out, size_t *npull);
90 int ctdb_req_header_verify(struct ctdb_req_header *h, uint32_t operation);
92 /* From protocol/protocol_call.c */
94 size_t ctdb_req_call_len(struct ctdb_req_header *h,
95 struct ctdb_req_call *c);
97 int ctdb_req_call_push(struct ctdb_req_header *h,
98 struct ctdb_req_call *c,
99 uint8_t *buf, size_t *buflen);
101 int ctdb_req_call_pull(uint8_t *buf, size_t buflen,
102 struct ctdb_req_header *h,
103 TALLOC_CTX *mem_ctx,
104 struct ctdb_req_call *c);
106 size_t ctdb_reply_call_len(struct ctdb_req_header *h,
107 struct ctdb_reply_call *c);
109 int ctdb_reply_call_push(struct ctdb_req_header *h,
110 struct ctdb_reply_call *c,
111 uint8_t *buf, size_t *buflen);
113 int ctdb_reply_call_pull(uint8_t *buf, size_t buflen,
114 struct ctdb_req_header *h,
115 TALLOC_CTX *mem_ctx,
116 struct ctdb_reply_call *c);
118 size_t ctdb_reply_error_len(struct ctdb_req_header *h,
119 struct ctdb_reply_error *c);
121 int ctdb_reply_error_push(struct ctdb_req_header *h,
122 struct ctdb_reply_error *c,
123 uint8_t *buf, size_t *buflen);
125 int ctdb_reply_error_pull(uint8_t *buf, size_t buflen,
126 struct ctdb_req_header *h,
127 TALLOC_CTX *mem_ctx,
128 struct ctdb_reply_error *c);
130 size_t ctdb_req_dmaster_len(struct ctdb_req_header *h,
131 struct ctdb_req_dmaster *c);
133 int ctdb_req_dmaster_push(struct ctdb_req_header *h,
134 struct ctdb_req_dmaster *c,
135 uint8_t *buf, size_t *buflen);
137 int ctdb_req_dmaster_pull(uint8_t *buf, size_t buflen,
138 struct ctdb_req_header *h,
139 TALLOC_CTX *mem_ctx,
140 struct ctdb_req_dmaster *c);
142 size_t ctdb_reply_dmaster_len(struct ctdb_req_header *h,
143 struct ctdb_reply_dmaster *c);
145 int ctdb_reply_dmaster_push(struct ctdb_req_header *h,
146 struct ctdb_reply_dmaster *c,
147 uint8_t *buf, size_t *buflen);
149 int ctdb_reply_dmaster_pull(uint8_t *buf, size_t buflen,
150 struct ctdb_req_header *h,
151 TALLOC_CTX *mem_ctx,
152 struct ctdb_reply_dmaster *c);
154 /* From protocol/protocol_control.c */
156 size_t ctdb_req_control_len(struct ctdb_req_header *h,
157 struct ctdb_req_control *c);
159 int ctdb_req_control_push(struct ctdb_req_header *h,
160 struct ctdb_req_control *c,
161 uint8_t *buf, size_t *buflen);
163 int ctdb_req_control_pull(uint8_t *buf, size_t buflen,
164 struct ctdb_req_header *h,
165 TALLOC_CTX *mem_ctx,
166 struct ctdb_req_control *c);
168 size_t ctdb_reply_control_len(struct ctdb_req_header *h,
169 struct ctdb_reply_control *c);
171 int ctdb_reply_control_push(struct ctdb_req_header *h,
172 struct ctdb_reply_control *c,
173 uint8_t *buf, size_t *buflen);
175 int ctdb_reply_control_pull(uint8_t *buf, size_t buflen, uint32_t opcode,
176 struct ctdb_req_header *h,
177 TALLOC_CTX *mem_ctx,
178 struct ctdb_reply_control *c);
180 /* From protocol/protocol_client.c */
182 void ctdb_req_control_process_exists(struct ctdb_req_control *request,
183 pid_t pid);
184 int ctdb_reply_control_process_exists(struct ctdb_reply_control *reply,
185 int *status);
187 void ctdb_req_control_statistics(struct ctdb_req_control *request);
189 int ctdb_reply_control_statistics(struct ctdb_reply_control *reply,
190 TALLOC_CTX *mem_ctx,
191 struct ctdb_statistics **stats);
193 void ctdb_req_control_ping(struct ctdb_req_control *request);
194 int ctdb_reply_control_ping(struct ctdb_reply_control *reply,
195 int *num_clients);
197 void ctdb_req_control_getdbpath(struct ctdb_req_control *request,
198 uint32_t db_id);
199 int ctdb_reply_control_getdbpath(struct ctdb_reply_control *reply,
200 TALLOC_CTX *mem_ctx, const char **db_path);
202 void ctdb_req_control_getvnnmap(struct ctdb_req_control *request);
203 int ctdb_reply_control_getvnnmap(struct ctdb_reply_control *reply,
204 TALLOC_CTX *mem_ctx,
205 struct ctdb_vnn_map **vnnmap);
207 void ctdb_req_control_setvnnmap(struct ctdb_req_control *request,
208 struct ctdb_vnn_map *vnnmap);
209 int ctdb_reply_control_setvnnmap(struct ctdb_reply_control *reply);
211 void ctdb_req_control_get_debug(struct ctdb_req_control *request);
212 int ctdb_reply_control_get_debug(struct ctdb_reply_control *reply,
213 int *debug_level);
215 void ctdb_req_control_set_debug(struct ctdb_req_control *request,
216 int debug_level);
217 int ctdb_reply_control_set_debug(struct ctdb_reply_control *reply);
219 void ctdb_req_control_get_dbmap(struct ctdb_req_control *request);
220 int ctdb_reply_control_get_dbmap(struct ctdb_reply_control *reply,
221 TALLOC_CTX *mem_ctx,
222 struct ctdb_dbid_map **dbmap);
224 void ctdb_req_control_pull_db(struct ctdb_req_control *request,
225 struct ctdb_pulldb *pulldb);
226 int ctdb_reply_control_pull_db(struct ctdb_reply_control *reply,
227 TALLOC_CTX *mem_ctx,
228 struct ctdb_rec_buffer **recbuf);
230 void ctdb_req_control_push_db(struct ctdb_req_control *request,
231 struct ctdb_rec_buffer *recbuf);
232 int ctdb_reply_control_push_db(struct ctdb_reply_control *reply);
234 void ctdb_req_control_get_recmode(struct ctdb_req_control *request);
235 int ctdb_reply_control_get_recmode(struct ctdb_reply_control *reply,
236 int *recmode);
238 void ctdb_req_control_set_recmode(struct ctdb_req_control *request,
239 int recmode);
240 int ctdb_reply_control_set_recmode(struct ctdb_reply_control *reply);
242 void ctdb_req_control_statistics_reset(struct ctdb_req_control *request);
243 int ctdb_reply_control_statistics_reset(struct ctdb_reply_control *reply);
245 void ctdb_req_control_db_attach(struct ctdb_req_control *request,
246 const char *db_name);
247 int ctdb_reply_control_db_attach(struct ctdb_reply_control *reply,
248 uint32_t *db_id);
250 void ctdb_req_control_traverse_start(struct ctdb_req_control *request,
251 struct ctdb_traverse_start *traverse);
252 int ctdb_reply_control_traverse_start(struct ctdb_reply_control *reply);
254 void ctdb_req_control_register_srvid(struct ctdb_req_control *request,
255 uint64_t srvid);
256 int ctdb_reply_control_register_srvid(struct ctdb_reply_control *reply);
258 void ctdb_req_control_deregister_srvid(struct ctdb_req_control *request,
259 uint64_t srvid);
260 int ctdb_reply_control_deregister_srvid(struct ctdb_reply_control *reply);
262 void ctdb_req_control_get_dbname(struct ctdb_req_control *request,
263 uint32_t db_id);
264 int ctdb_reply_control_get_dbname(struct ctdb_reply_control *reply,
265 TALLOC_CTX *mem_ctx, const char **db_name);
267 void ctdb_req_control_enable_seqnum(struct ctdb_req_control *request,
268 uint32_t db_id);
269 int ctdb_reply_control_enable_seqnum(struct ctdb_reply_control *reply);
271 void ctdb_req_control_update_seqnum(struct ctdb_req_control *request,
272 uint32_t db_id);
273 int ctdb_reply_control_update_seqnum(struct ctdb_reply_control *reply);
275 void ctdb_req_control_dump_memory(struct ctdb_req_control *request);
276 int ctdb_reply_control_dump_memory(struct ctdb_reply_control *reply,
277 TALLOC_CTX *mem_ctx, const char **mem_str);
279 void ctdb_req_control_get_pid(struct ctdb_req_control *request);
280 int ctdb_reply_control_get_pid(struct ctdb_reply_control *reply,
281 pid_t *pid);
283 void ctdb_req_control_get_recmaster(struct ctdb_req_control *request);
284 int ctdb_reply_control_get_recmaster(struct ctdb_reply_control *reply,
285 uint32_t *recmaster);
287 void ctdb_req_control_set_recmaster(struct ctdb_req_control *request,
288 int recmaster);
289 int ctdb_reply_control_set_recmaster(struct ctdb_reply_control *reply);
291 void ctdb_req_control_freeze(struct ctdb_req_control *request,
292 uint32_t priority);
293 int ctdb_reply_control_freeze(struct ctdb_reply_control *reply);
295 void ctdb_req_control_get_pnn(struct ctdb_req_control *request);
296 int ctdb_reply_control_get_pnn(struct ctdb_reply_control *reply,
297 uint32_t *pnn);
299 void ctdb_req_control_shutdown(struct ctdb_req_control *request);
300 int ctdb_reply_control_shutdown(struct ctdb_reply_control *reply);
302 void ctdb_req_control_tcp_client(struct ctdb_req_control *request,
303 struct ctdb_connection *conn);
304 int ctdb_reply_control_tcp_client(struct ctdb_reply_control *reply);
306 void ctdb_req_control_tcp_add(struct ctdb_req_control *request,
307 struct ctdb_connection *conn);
308 int ctdb_reply_control_tcp_add(struct ctdb_reply_control *reply);
310 void ctdb_req_control_tcp_remove(struct ctdb_req_control *request,
311 struct ctdb_connection *conn);
312 int ctdb_reply_control_tcp_remove(struct ctdb_reply_control *reply);
314 void ctdb_req_control_startup(struct ctdb_req_control *request);
315 int ctdb_reply_control_startup(struct ctdb_reply_control *reply);
317 void ctdb_req_control_set_tunable(struct ctdb_req_control *request,
318 struct ctdb_tunable *tunable);
319 int ctdb_reply_control_set_tunable(struct ctdb_reply_control *reply);
321 void ctdb_req_control_get_tunable(struct ctdb_req_control *request,
322 const char *name);
323 int ctdb_reply_control_get_tunable(struct ctdb_reply_control *reply,
324 uint32_t *value);
326 void ctdb_req_control_list_tunables(struct ctdb_req_control *request);
327 int ctdb_reply_control_list_tunables(struct ctdb_reply_control *reply,
328 TALLOC_CTX *mem_ctx,
329 struct ctdb_var_list **tun_var_list);
331 void ctdb_req_control_modify_flags(struct ctdb_req_control *request,
332 struct ctdb_node_flag_change *flag_change);
333 int ctdb_reply_control_modify_flags(struct ctdb_reply_control *reply);
335 void ctdb_req_control_get_all_tunables(struct ctdb_req_control *request);
336 int ctdb_reply_control_get_all_tunables(struct ctdb_reply_control *reply,
337 TALLOC_CTX *mem_ctx,
338 struct ctdb_tunable_list **tun_list);
340 void ctdb_req_control_get_tcp_tickle_list(struct ctdb_req_control *request,
341 ctdb_sock_addr *addr);
342 int ctdb_reply_control_get_tcp_tickle_list(struct ctdb_reply_control *reply,
343 TALLOC_CTX *mem_ctx,
344 struct ctdb_tickle_list **tickles);
346 void ctdb_req_control_set_tcp_tickle_list(struct ctdb_req_control *request,
347 struct ctdb_tickle_list *tickles);
348 int ctdb_reply_control_set_tcp_tickle_list(struct ctdb_reply_control *reply);
350 void ctdb_req_control_db_attach_persistent(struct ctdb_req_control *request,
351 const char *name);
352 int ctdb_reply_control_db_attach_persistent(struct ctdb_reply_control *reply,
353 uint32_t *db_id);
355 void ctdb_req_control_update_record(struct ctdb_req_control *request,
356 struct ctdb_rec_buffer *recbuf);
357 int ctdb_reply_control_update_record(struct ctdb_reply_control *reply);
359 void ctdb_req_control_send_gratuitous_arp(struct ctdb_req_control *request,
360 struct ctdb_addr_info *addr_info);
361 int ctdb_reply_control_send_gratuitous_arp(struct ctdb_reply_control *reply);
363 void ctdb_req_control_wipe_database(struct ctdb_req_control *request,
364 struct ctdb_transdb *transdb);
365 int ctdb_reply_control_wipe_database(struct ctdb_reply_control *reply);
367 void ctdb_req_control_uptime(struct ctdb_req_control *request);
368 int ctdb_reply_control_uptime(struct ctdb_reply_control *reply,
369 TALLOC_CTX *mem_ctx,
370 struct ctdb_uptime **uptime);
372 void ctdb_req_control_start_recovery(struct ctdb_req_control *request);
373 int ctdb_reply_control_start_recovery(struct ctdb_reply_control *reply);
375 void ctdb_req_control_end_recovery(struct ctdb_req_control *request);
376 int ctdb_reply_control_end_recovery(struct ctdb_reply_control *reply);
378 void ctdb_req_control_reload_nodes_file(struct ctdb_req_control *request);
379 int ctdb_reply_control_reload_nodes_file(struct ctdb_reply_control *reply);
381 void ctdb_req_control_try_delete_records(struct ctdb_req_control *request,
382 struct ctdb_rec_buffer *recbuf);
383 int ctdb_reply_control_try_delete_records(struct ctdb_reply_control *reply,
384 TALLOC_CTX *mem_ctx,
385 struct ctdb_rec_buffer **recbuf);
387 void ctdb_req_control_add_public_ip(struct ctdb_req_control *request,
388 struct ctdb_addr_info *addr_info);
389 int ctdb_reply_control_add_public_ip(struct ctdb_reply_control *reply);
391 void ctdb_req_control_del_public_ip(struct ctdb_req_control *request,
392 struct ctdb_addr_info *addr_info);
393 int ctdb_reply_control_del_public_ip(struct ctdb_reply_control *reply);
395 void ctdb_req_control_get_capabilities(struct ctdb_req_control *request);
396 int ctdb_reply_control_get_capabilities(struct ctdb_reply_control *reply,
397 uint32_t *caps);
399 void ctdb_req_control_recd_ping(struct ctdb_req_control *request);
400 int ctdb_reply_control_recd_ping(struct ctdb_reply_control *reply);
402 void ctdb_req_control_release_ip(struct ctdb_req_control *request,
403 struct ctdb_public_ip *pubip);
404 int ctdb_reply_control_release_ip(struct ctdb_reply_control *reply);
406 void ctdb_req_control_takeover_ip(struct ctdb_req_control *request,
407 struct ctdb_public_ip *pubip);
408 int ctdb_reply_control_takeover_ip(struct ctdb_reply_control *reply);
410 void ctdb_req_control_get_public_ips(struct ctdb_req_control *request,
411 bool available_only);
412 int ctdb_reply_control_get_public_ips(struct ctdb_reply_control *reply,
413 TALLOC_CTX *mem_ctx,
414 struct ctdb_public_ip_list **pubip_list);
416 void ctdb_req_control_get_nodemap(struct ctdb_req_control *request);
417 int ctdb_reply_control_get_nodemap(struct ctdb_reply_control *reply,
418 TALLOC_CTX *mem_ctx,
419 struct ctdb_node_map **nodemap);
421 void ctdb_req_control_traverse_kill(struct ctdb_req_control *request,
422 struct ctdb_traverse_start *traverse);
423 int ctdb_reply_control_traverse_kill(struct ctdb_reply_control *reply);
425 void ctdb_req_control_recd_reclock_latency(struct ctdb_req_control *request,
426 double reclock_latency);
427 int ctdb_reply_control_recd_reclock_latency(struct ctdb_reply_control *reply);
429 void ctdb_req_control_get_reclock_file(struct ctdb_req_control *request);
430 int ctdb_reply_control_get_reclock_file(struct ctdb_reply_control *reply,
431 TALLOC_CTX *mem_ctx,
432 const char **reclock_file);
434 void ctdb_req_control_stop_node(struct ctdb_req_control *request);
435 int ctdb_reply_control_stop_node(struct ctdb_reply_control *reply);
437 void ctdb_req_control_continue_node(struct ctdb_req_control *request);
438 int ctdb_reply_control_continue_node(struct ctdb_reply_control *reply);
440 void ctdb_req_control_set_lmasterrole(struct ctdb_req_control *request,
441 uint32_t lmaster_role);
442 int ctdb_reply_control_set_lmasterrole(struct ctdb_reply_control *reply);
444 void ctdb_req_control_set_recmasterrole(struct ctdb_req_control *request,
445 uint32_t recmaster_role);
446 int ctdb_reply_control_set_recmasterrole(struct ctdb_reply_control *reply);
448 void ctdb_req_control_set_ban_state(struct ctdb_req_control *request,
449 struct ctdb_ban_state *ban_state);
450 int ctdb_reply_control_set_ban_state(struct ctdb_reply_control *reply);
452 void ctdb_req_control_get_ban_state(struct ctdb_req_control *request);
453 int ctdb_reply_control_get_ban_state(struct ctdb_reply_control *reply,
454 TALLOC_CTX *mem_ctx,
455 struct ctdb_ban_state **ban_state);
457 void ctdb_req_control_register_notify(struct ctdb_req_control *request,
458 struct ctdb_notify_data *notify);
459 int ctdb_reply_control_register_notify(struct ctdb_reply_control *reply);
461 void ctdb_req_control_deregister_notify(struct ctdb_req_control *request,
462 uint64_t srvid);
463 int ctdb_reply_control_deregister_notify(struct ctdb_reply_control *reply);
465 void ctdb_req_control_trans3_commit(struct ctdb_req_control *request,
466 struct ctdb_rec_buffer *recbuf);
467 int ctdb_reply_control_trans3_commit(struct ctdb_reply_control *reply);
469 void ctdb_req_control_get_db_seqnum(struct ctdb_req_control *request,
470 uint32_t db_id);
471 int ctdb_reply_control_get_db_seqnum(struct ctdb_reply_control *reply,
472 uint64_t *seqnum);
474 void ctdb_req_control_db_set_healthy(struct ctdb_req_control *request,
475 uint32_t db_id);
476 int ctdb_reply_control_db_set_healthy(struct ctdb_reply_control *reply);
478 void ctdb_req_control_db_get_health(struct ctdb_req_control *request,
479 uint32_t db_id);
480 int ctdb_reply_control_db_get_health(struct ctdb_reply_control *reply,
481 TALLOC_CTX *mem_ctx,
482 const char **reason);
484 void ctdb_req_control_get_public_ip_info(struct ctdb_req_control *request,
485 ctdb_sock_addr *addr);
486 int ctdb_reply_control_get_public_ip_info(struct ctdb_reply_control *reply,
487 TALLOC_CTX *mem_ctx,
488 struct ctdb_public_ip_info **ipinfo);
490 void ctdb_req_control_get_ifaces(struct ctdb_req_control *request);
491 int ctdb_reply_control_get_ifaces(struct ctdb_reply_control *reply,
492 TALLOC_CTX *mem_ctx,
493 struct ctdb_iface_list **iface_list);
495 void ctdb_req_control_set_iface_link_state(struct ctdb_req_control *request,
496 struct ctdb_iface *iface);
497 int ctdb_reply_control_set_iface_link_state(struct ctdb_reply_control *reply);
499 void ctdb_req_control_tcp_add_delayed_update(struct ctdb_req_control *request,
500 struct ctdb_connection *conn);
501 int ctdb_reply_control_tcp_add_delayed_update(struct ctdb_reply_control *reply);
503 void ctdb_req_control_get_stat_history(struct ctdb_req_control *request);
504 int ctdb_reply_control_get_stat_history(struct ctdb_reply_control *reply,
505 TALLOC_CTX *mem_ctx,
506 struct ctdb_statistics_list **stats_list);
508 void ctdb_req_control_schedule_for_deletion(struct ctdb_req_control *request,
509 struct ctdb_key_data *key);
510 int ctdb_reply_control_schedule_for_deletion(struct ctdb_reply_control *reply);
512 void ctdb_req_control_set_db_readonly(struct ctdb_req_control *request,
513 uint32_t db_id);
514 int ctdb_reply_control_set_db_readonly(struct ctdb_reply_control *reply);
516 void ctdb_req_control_traverse_start_ext(struct ctdb_req_control *request,
517 struct ctdb_traverse_start_ext *traverse);
518 int ctdb_reply_control_traverse_start_ext(struct ctdb_reply_control *reply);
520 void ctdb_req_control_get_db_statistics(struct ctdb_req_control *request,
521 uint32_t db_id);
522 int ctdb_reply_control_get_db_statistics(struct ctdb_reply_control *reply,
523 TALLOC_CTX *mem_ctx,
524 struct ctdb_db_statistics **dbstats);
526 void ctdb_req_control_set_db_sticky(struct ctdb_req_control *request,
527 uint32_t db_id);
528 int ctdb_reply_control_set_db_sticky(struct ctdb_reply_control *reply);
530 void ctdb_req_control_reload_public_ips(struct ctdb_req_control *request);
531 int ctdb_reply_control_reload_public_ips(struct ctdb_reply_control *reply);
533 void ctdb_req_control_receive_records(struct ctdb_req_control *request,
534 struct ctdb_rec_buffer *recbuf);
535 int ctdb_reply_control_receive_records(struct ctdb_reply_control *reply,
536 TALLOC_CTX *mem_ctx,
537 struct ctdb_rec_buffer **recbuf);
539 void ctdb_req_control_ipreallocated(struct ctdb_req_control *request);
540 int ctdb_reply_control_ipreallocated(struct ctdb_reply_control *reply);
542 void ctdb_req_control_get_runstate(struct ctdb_req_control *request);
543 int ctdb_reply_control_get_runstate(struct ctdb_reply_control *reply,
544 enum ctdb_runstate *runstate);
546 void ctdb_req_control_db_detach(struct ctdb_req_control *request,
547 uint32_t db_id);
548 int ctdb_reply_control_db_detach(struct ctdb_reply_control *reply);
550 void ctdb_req_control_get_nodes_file(struct ctdb_req_control *request);
551 int ctdb_reply_control_get_nodes_file(struct ctdb_reply_control *reply,
552 TALLOC_CTX *mem_ctx,
553 struct ctdb_node_map **nodemap);
555 void ctdb_req_control_db_freeze(struct ctdb_req_control *request,
556 uint32_t db_id);
557 int ctdb_reply_control_db_freeze(struct ctdb_reply_control *reply);
559 void ctdb_req_control_db_thaw(struct ctdb_req_control *request,
560 uint32_t db_id);
561 int ctdb_reply_control_db_thaw(struct ctdb_reply_control *reply);
563 void ctdb_req_control_db_transaction_start(struct ctdb_req_control *request,
564 struct ctdb_transdb *transdb);
565 int ctdb_reply_control_db_transaction_start(struct ctdb_reply_control *reply);
567 void ctdb_req_control_db_transaction_commit(struct ctdb_req_control *request,
568 struct ctdb_transdb *transdb);
569 int ctdb_reply_control_db_transaction_commit(struct ctdb_reply_control *reply);
571 void ctdb_req_control_db_transaction_cancel(struct ctdb_req_control *request,
572 uint32_t db_id);
573 int ctdb_reply_control_db_transaction_cancel(struct ctdb_reply_control *reply);
575 void ctdb_req_control_db_pull(struct ctdb_req_control *request,
576 struct ctdb_pulldb_ext *pulldb_ext);
577 int ctdb_reply_control_db_pull(struct ctdb_reply_control *reply,
578 uint32_t *num_records);
580 void ctdb_req_control_db_push_start(struct ctdb_req_control *request,
581 struct ctdb_pulldb_ext *pulldb_ext);
582 int ctdb_reply_control_db_push_start(struct ctdb_reply_control *reply);
584 void ctdb_req_control_db_push_confirm(struct ctdb_req_control *request,
585 uint32_t db_id);
586 int ctdb_reply_control_db_push_confirm(struct ctdb_reply_control *reply,
587 uint32_t *num_records);
589 void ctdb_req_control_db_open_flags(struct ctdb_req_control *request,
590 uint32_t db_id);
591 int ctdb_reply_control_db_open_flags(struct ctdb_reply_control *reply,
592 int *tdb_flags);
594 void ctdb_req_control_db_attach_replicated(struct ctdb_req_control *request,
595 const char *db_name);
596 int ctdb_reply_control_db_attach_replicated(struct ctdb_reply_control *reply,
597 uint32_t *db_id);
599 void ctdb_req_control_check_pid_srvid(struct ctdb_req_control *request,
600 struct ctdb_pid_srvid *pid_srvid);
601 int ctdb_reply_control_check_pid_srvid(struct ctdb_reply_control *reply,
602 int *status);
604 void ctdb_req_control_tunnel_register(struct ctdb_req_control *request,
605 uint64_t tunnel_id);
606 int ctdb_reply_control_tunnel_register(struct ctdb_reply_control *reply);
608 void ctdb_req_control_tunnel_deregister(struct ctdb_req_control *request,
609 uint64_t tunnel_id);
610 int ctdb_reply_control_tunnel_deregister(struct ctdb_reply_control *reply);
612 /* From protocol/protocol_debug.c */
614 void ctdb_packet_print(uint8_t *buf, size_t buflen, FILE *fp);
616 /* From protocol/protocol_message.c */
618 size_t ctdb_req_message_len(struct ctdb_req_header *h,
619 struct ctdb_req_message *c);
621 int ctdb_req_message_push(struct ctdb_req_header *h,
622 struct ctdb_req_message *c,
623 uint8_t *buf, size_t *buflen);
625 int ctdb_req_message_pull(uint8_t *buf, size_t buflen,
626 struct ctdb_req_header *h,
627 TALLOC_CTX *mem_ctx,
628 struct ctdb_req_message *c);
630 size_t ctdb_req_message_data_len(struct ctdb_req_header *h,
631 struct ctdb_req_message_data *c);
633 int ctdb_req_message_data_push(struct ctdb_req_header *h,
634 struct ctdb_req_message_data *c,
635 uint8_t *buf, size_t *buflen);
637 int ctdb_req_message_data_pull(uint8_t *buf, size_t buflen,
638 struct ctdb_req_header *h,
639 TALLOC_CTX *mem_ctx,
640 struct ctdb_req_message_data *c);
642 /* From protocol/protocol_keepalive.c */
644 size_t ctdb_req_keepalive_len(struct ctdb_req_header *h,
645 struct ctdb_req_keepalive *c);
647 int ctdb_req_keepalive_push(struct ctdb_req_header *h,
648 struct ctdb_req_keepalive *c,
649 uint8_t *buf, size_t *buflen);
651 int ctdb_req_keepalive_pull(uint8_t *buf, size_t buflen,
652 struct ctdb_req_header *h,
653 TALLOC_CTX *mem_ctx,
654 struct ctdb_req_keepalive *c);
656 /* From protocol/protocol_tunnel.c */
658 size_t ctdb_req_tunnel_len(struct ctdb_req_header *h,
659 struct ctdb_req_tunnel *c);
661 int ctdb_req_tunnel_push(struct ctdb_req_header *h,
662 struct ctdb_req_tunnel *c,
663 uint8_t *buf, size_t *buflen);
665 int ctdb_req_tunnel_pull(uint8_t *buf, size_t buflen,
666 struct ctdb_req_header *h,
667 TALLOC_CTX *mem_ctx,
668 struct ctdb_req_tunnel *c);
670 /* From protocol/protocol_event.c */
672 size_t ctdb_event_request_len(struct ctdb_event_request *in);
674 int ctdb_event_request_push(struct ctdb_event_request *in,
675 uint8_t *buf, size_t *buflen);
677 int ctdb_event_request_pull(uint8_t *buf, size_t buflen,
678 TALLOC_CTX *mem_ctx,
679 struct ctdb_event_request *out);
681 size_t ctdb_event_reply_len(struct ctdb_event_reply *in);
683 int ctdb_event_reply_push(struct ctdb_event_reply *in,
684 uint8_t *buf, size_t *buflen);
686 int ctdb_event_reply_pull(uint8_t *buf, size_t buflen,
687 TALLOC_CTX *mem_ctx,
688 struct ctdb_event_reply *out);
690 /* From protocol/protocol_packet.c */
692 int ctdb_allocate_pkt(TALLOC_CTX *mem_ctx, size_t datalen,
693 uint8_t **buf, size_t *buflen);
695 /* From protocol/protocol_sock.c */
697 size_t sock_packet_header_len(struct sock_packet_header *in);
698 void sock_packet_header_push(struct sock_packet_header *in, uint8_t *buf,
699 size_t *npush);
700 int sock_packet_header_pull(uint8_t *buf, size_t buflen,
701 struct sock_packet_header *out, size_t *npull);
703 void sock_packet_header_set_reqid(struct sock_packet_header *h,
704 uint32_t reqid);
705 void sock_packet_header_set_length(struct sock_packet_header *h,
706 uint32_t length);
708 #endif /* __CTDB_PROTOCOL_API_H__ */