ctdb-protocol: Fix marshalling for ctdb_server_id
[vlendec/samba-autobuild/.git] / ctdb / protocol / protocol_api.h
1 /*
2    CTDB protocol marshalling
3
4    Copyright (C) Amitay Isaacs  2015
5
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.
10
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.
15
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/>.
18 */
19
20 #ifndef __CTDB_PROTOCOL_API_H__
21 #define __CTDB_PROTOCOL_API_H__
22
23 #include <talloc.h>
24
25 #include "protocol/protocol.h"
26
27 /* From protocol/protocol_types.c */
28
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);
34
35 int ctdb_ltdb_header_extract(TDB_DATA *data, struct ctdb_ltdb_header *header);
36
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);
41
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);
47
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);
56
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);
60
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);
66
67 size_t ctdb_g_lock_len(struct ctdb_g_lock *lock);
68 void ctdb_g_lock_push(struct ctdb_g_lock *lock, uint8_t *buf);
69 int ctdb_g_lock_pull(uint8_t *buf, size_t buflen, struct ctdb_g_lock *lock);
70
71 size_t ctdb_g_lock_list_len(struct ctdb_g_lock_list *lock_list);
72 void ctdb_g_lock_list_push(struct ctdb_g_lock_list *lock_list, uint8_t *buf);
73 int ctdb_g_lock_list_pull(uint8_t *buf, size_t buflen, TALLOC_CTX *mem_ctx,
74                           struct ctdb_g_lock_list **out);
75
76 /* From protocol/protocol_header.c */
77
78 void ctdb_req_header_fill(struct ctdb_req_header *h, uint32_t generation,
79                           uint32_t operation, uint32_t destnode,
80                           uint32_t srcnode, uint32_t reqid);
81
82 size_t ctdb_req_header_len(struct ctdb_req_header *h);
83 void ctdb_req_header_push(struct ctdb_req_header *h, uint8_t *buf);
84 int ctdb_req_header_pull(uint8_t *buf, size_t buflen,
85                          struct ctdb_req_header *h);
86
87 int ctdb_req_header_verify(struct ctdb_req_header *h, uint32_t operation);
88
89 /* From protocol/protocol_call.c */
90
91 size_t ctdb_req_call_len(struct ctdb_req_header *h,
92                          struct ctdb_req_call *c);
93
94 int ctdb_req_call_push(struct ctdb_req_header *h,
95                        struct ctdb_req_call *c,
96                        uint8_t *buf, size_t *buflen);
97
98 int ctdb_req_call_pull(uint8_t *buf, size_t buflen,
99                        struct ctdb_req_header *h,
100                        TALLOC_CTX *mem_ctx,
101                        struct ctdb_req_call *c);
102
103 size_t ctdb_reply_call_len(struct ctdb_req_header *h,
104                            struct ctdb_reply_call *c);
105
106 int ctdb_reply_call_push(struct ctdb_req_header *h,
107                          struct ctdb_reply_call *c,
108                          uint8_t *buf, size_t *buflen);
109
110 int ctdb_reply_call_pull(uint8_t *buf, size_t buflen,
111                          struct ctdb_req_header *h,
112                          TALLOC_CTX *mem_ctx,
113                          struct ctdb_reply_call *c);
114
115 size_t ctdb_reply_error_len(struct ctdb_req_header *h,
116                             struct ctdb_reply_error *c);
117
118 int ctdb_reply_error_push(struct ctdb_req_header *h,
119                           struct ctdb_reply_error *c,
120                           uint8_t *buf, size_t *buflen);
121
122 int ctdb_reply_error_pull(uint8_t *buf, size_t buflen,
123                           struct ctdb_req_header *h,
124                           TALLOC_CTX *mem_ctx,
125                           struct ctdb_reply_error *c);
126
127 size_t ctdb_req_dmaster_len(struct ctdb_req_header *h,
128                             struct ctdb_req_dmaster *c);
129
130 int ctdb_req_dmaster_push(struct ctdb_req_header *h,
131                           struct ctdb_req_dmaster *c,
132                           uint8_t *buf, size_t *buflen);
133
134 int ctdb_req_dmaster_pull(uint8_t *buf, size_t buflen,
135                           struct ctdb_req_header *h,
136                           TALLOC_CTX *mem_ctx,
137                           struct ctdb_req_dmaster *c);
138
139 size_t ctdb_reply_dmaster_len(struct ctdb_req_header *h,
140                               struct ctdb_reply_dmaster *c);
141
142 int ctdb_reply_dmaster_push(struct ctdb_req_header *h,
143                             struct ctdb_reply_dmaster *c,
144                             uint8_t *buf, size_t *buflen);
145
146 int ctdb_reply_dmaster_pull(uint8_t *buf, size_t buflen,
147                             struct ctdb_req_header *h,
148                             TALLOC_CTX *mem_ctx,
149                             struct ctdb_reply_dmaster *c);
150
151 /* From protocol/protocol_control.c */
152
153 size_t ctdb_req_control_len(struct ctdb_req_header *h,
154                             struct ctdb_req_control *c);
155
156 int ctdb_req_control_push(struct ctdb_req_header *h,
157                           struct ctdb_req_control *c,
158                           uint8_t *buf, size_t *buflen);
159
160 int ctdb_req_control_pull(uint8_t *buf, size_t buflen,
161                           struct ctdb_req_header *h,
162                           TALLOC_CTX *mem_ctx,
163                           struct ctdb_req_control *c);
164
165 size_t ctdb_reply_control_len(struct ctdb_req_header *h,
166                               struct ctdb_reply_control *c);
167
168 int ctdb_reply_control_push(struct ctdb_req_header *h,
169                             struct ctdb_reply_control *c,
170                             uint8_t *buf, size_t *buflen);
171
172 int ctdb_reply_control_pull(uint8_t *buf, size_t buflen, uint32_t opcode,
173                             struct ctdb_req_header *h,
174                             TALLOC_CTX *mem_ctx,
175                             struct ctdb_reply_control *c);
176
177 /* From protocol/protocol_client.c */
178
179 void ctdb_req_control_process_exists(struct ctdb_req_control *request,
180                                      pid_t pid);
181 int ctdb_reply_control_process_exists(struct ctdb_reply_control *reply,
182                                       int *status);
183
184 void ctdb_req_control_statistics(struct ctdb_req_control *request);
185
186 int ctdb_reply_control_statistics(struct ctdb_reply_control *reply,
187                                   TALLOC_CTX *mem_ctx,
188                                   struct ctdb_statistics **stats);
189
190 void ctdb_req_control_ping(struct ctdb_req_control *request);
191 int ctdb_reply_control_ping(struct ctdb_reply_control *reply,
192                             int *num_clients);
193
194 void ctdb_req_control_getdbpath(struct ctdb_req_control *request,
195                                 uint32_t db_id);
196 int ctdb_reply_control_getdbpath(struct ctdb_reply_control *reply,
197                                  TALLOC_CTX *mem_ctx, const char **db_path);
198
199 void ctdb_req_control_getvnnmap(struct ctdb_req_control *request);
200 int ctdb_reply_control_getvnnmap(struct ctdb_reply_control *reply,
201                                  TALLOC_CTX *mem_ctx,
202                                  struct ctdb_vnn_map **vnnmap);
203
204 void ctdb_req_control_setvnnmap(struct ctdb_req_control *request,
205                                 struct ctdb_vnn_map *vnnmap);
206 int ctdb_reply_control_setvnnmap(struct ctdb_reply_control *reply);
207
208 void ctdb_req_control_get_debug(struct ctdb_req_control *request);
209 int ctdb_reply_control_get_debug(struct ctdb_reply_control *reply,
210                                  int *debug_level);
211
212 void ctdb_req_control_set_debug(struct ctdb_req_control *request,
213                                 int debug_level);
214 int ctdb_reply_control_set_debug(struct ctdb_reply_control *reply);
215
216 void ctdb_req_control_get_dbmap(struct ctdb_req_control *request);
217 int ctdb_reply_control_get_dbmap(struct ctdb_reply_control *reply,
218                                  TALLOC_CTX *mem_ctx,
219                                  struct ctdb_dbid_map **dbmap);
220
221 void ctdb_req_control_pull_db(struct ctdb_req_control *request,
222                               struct ctdb_pulldb *pulldb);
223 int ctdb_reply_control_pull_db(struct ctdb_reply_control *reply,
224                                TALLOC_CTX *mem_ctx,
225                                struct ctdb_rec_buffer **recbuf);
226
227 void ctdb_req_control_push_db(struct ctdb_req_control *request,
228                               struct ctdb_rec_buffer *recbuf);
229 int ctdb_reply_control_push_db(struct ctdb_reply_control *reply);
230
231 void ctdb_req_control_get_recmode(struct ctdb_req_control *request);
232 int ctdb_reply_control_get_recmode(struct ctdb_reply_control *reply,
233                                    int *recmode);
234
235 void ctdb_req_control_set_recmode(struct ctdb_req_control *request,
236                                   int recmode);
237 int ctdb_reply_control_set_recmode(struct ctdb_reply_control *reply);
238
239 void ctdb_req_control_statistics_reset(struct ctdb_req_control *request);
240 int ctdb_reply_control_statistics_reset(struct ctdb_reply_control *reply);
241
242 void ctdb_req_control_db_attach(struct ctdb_req_control *request,
243                                 const char *db_name);
244 int ctdb_reply_control_db_attach(struct ctdb_reply_control *reply,
245                                  uint32_t *db_id);
246
247 void ctdb_req_control_traverse_start(struct ctdb_req_control *request,
248                                      struct ctdb_traverse_start *traverse);
249 int ctdb_reply_control_traverse_start(struct ctdb_reply_control *reply);
250
251 void ctdb_req_control_register_srvid(struct ctdb_req_control *request,
252                                      uint64_t srvid);
253 int ctdb_reply_control_register_srvid(struct ctdb_reply_control *reply);
254
255 void ctdb_req_control_deregister_srvid(struct ctdb_req_control *request,
256                                        uint64_t srvid);
257 int ctdb_reply_control_deregister_srvid(struct ctdb_reply_control *reply);
258
259 void ctdb_req_control_get_dbname(struct ctdb_req_control *request,
260                                  uint32_t db_id);
261 int ctdb_reply_control_get_dbname(struct ctdb_reply_control *reply,
262                                   TALLOC_CTX *mem_ctx, const char **db_name);
263
264 void ctdb_req_control_enable_seqnum(struct ctdb_req_control *request,
265                                     uint32_t db_id);
266 int ctdb_reply_control_enable_seqnum(struct ctdb_reply_control *reply);
267
268 void ctdb_req_control_update_seqnum(struct ctdb_req_control *request,
269                                     uint32_t db_id);
270 int ctdb_reply_control_update_seqnum(struct ctdb_reply_control *reply);
271
272 void ctdb_req_control_dump_memory(struct ctdb_req_control *request);
273 int ctdb_reply_control_dump_memory(struct ctdb_reply_control *reply,
274                                    TALLOC_CTX *mem_ctx, const char **mem_str);
275
276 void ctdb_req_control_get_pid(struct ctdb_req_control *request);
277 int ctdb_reply_control_get_pid(struct ctdb_reply_control *reply,
278                                pid_t *pid);
279
280 void ctdb_req_control_get_recmaster(struct ctdb_req_control *request);
281 int ctdb_reply_control_get_recmaster(struct ctdb_reply_control *reply,
282                                      uint32_t *recmaster);
283
284 void ctdb_req_control_set_recmaster(struct ctdb_req_control *request,
285                                     int recmaster);
286 int ctdb_reply_control_set_recmaster(struct ctdb_reply_control *reply);
287
288 void ctdb_req_control_freeze(struct ctdb_req_control *request,
289                              uint32_t priority);
290 int ctdb_reply_control_freeze(struct ctdb_reply_control *reply);
291
292 void ctdb_req_control_get_pnn(struct ctdb_req_control *request);
293 int ctdb_reply_control_get_pnn(struct ctdb_reply_control *reply,
294                                uint32_t *pnn);
295
296 void ctdb_req_control_shutdown(struct ctdb_req_control *request);
297 int ctdb_reply_control_shutdown(struct ctdb_reply_control *reply);
298
299 void ctdb_req_control_get_monmode(struct ctdb_req_control *request);
300 int ctdb_reply_control_get_monmode(struct ctdb_reply_control *reply,
301                                    int *mon_mode);
302
303 void ctdb_req_control_tcp_client(struct ctdb_req_control *request,
304                                  struct ctdb_connection *conn);
305 int ctdb_reply_control_tcp_client(struct ctdb_reply_control *reply);
306
307 void ctdb_req_control_tcp_add(struct ctdb_req_control *request,
308                               struct ctdb_connection *conn);
309 int ctdb_reply_control_tcp_add(struct ctdb_reply_control *reply);
310
311 void ctdb_req_control_tcp_remove(struct ctdb_req_control *request,
312                                  struct ctdb_connection *conn);
313 int ctdb_reply_control_tcp_remove(struct ctdb_reply_control *reply);
314
315 void ctdb_req_control_startup(struct ctdb_req_control *request);
316 int ctdb_reply_control_startup(struct ctdb_reply_control *reply);
317
318 void ctdb_req_control_set_tunable(struct ctdb_req_control *request,
319                                   struct ctdb_tunable *tunable);
320 int ctdb_reply_control_set_tunable(struct ctdb_reply_control *reply);
321
322 void ctdb_req_control_get_tunable(struct ctdb_req_control *request,
323                                   const char *name);
324 int ctdb_reply_control_get_tunable(struct ctdb_reply_control *reply,
325                                    uint32_t *value);
326
327 void ctdb_req_control_list_tunables(struct ctdb_req_control *request);
328 int ctdb_reply_control_list_tunables(struct ctdb_reply_control *reply,
329                                      TALLOC_CTX *mem_ctx,
330                                      struct ctdb_var_list **tun_var_list);
331
332 void ctdb_req_control_modify_flags(struct ctdb_req_control *request,
333                                    struct ctdb_node_flag_change *flag_change);
334 int ctdb_reply_control_modify_flags(struct ctdb_reply_control *reply);
335
336 void ctdb_req_control_get_all_tunables(struct ctdb_req_control *request);
337 int ctdb_reply_control_get_all_tunables(struct ctdb_reply_control *reply,
338                                         TALLOC_CTX *mem_ctx,
339                                         struct ctdb_tunable_list **tun_list);
340
341 void ctdb_req_control_get_tcp_tickle_list(struct ctdb_req_control *request,
342                                           ctdb_sock_addr *addr);
343 int ctdb_reply_control_get_tcp_tickle_list(struct ctdb_reply_control *reply,
344                                            TALLOC_CTX *mem_ctx,
345                                            struct ctdb_tickle_list **tickles);
346
347 void ctdb_req_control_set_tcp_tickle_list(struct ctdb_req_control *request,
348                                           struct ctdb_tickle_list *tickles);
349 int ctdb_reply_control_set_tcp_tickle_list(struct ctdb_reply_control *reply);
350
351 void ctdb_req_control_db_attach_persistent(struct ctdb_req_control *request,
352                                            const char *name);
353 int ctdb_reply_control_db_attach_persistent(struct ctdb_reply_control *reply,
354                                             uint32_t *db_id);
355
356 void ctdb_req_control_update_record(struct ctdb_req_control *request,
357                                     struct ctdb_rec_buffer *recbuf);
358 int ctdb_reply_control_update_record(struct ctdb_reply_control *reply);
359
360 void ctdb_req_control_send_gratuitous_arp(struct ctdb_req_control *request,
361                                           struct ctdb_addr_info *addr_info);
362 int ctdb_reply_control_send_gratuitous_arp(struct ctdb_reply_control *reply);
363
364 void ctdb_req_control_wipe_database(struct ctdb_req_control *request,
365                                     struct ctdb_transdb *transdb);
366 int ctdb_reply_control_wipe_database(struct ctdb_reply_control *reply);
367
368 void ctdb_req_control_uptime(struct ctdb_req_control *request);
369 int ctdb_reply_control_uptime(struct ctdb_reply_control *reply,
370                               TALLOC_CTX *mem_ctx,
371                               struct ctdb_uptime **uptime);
372
373 void ctdb_req_control_start_recovery(struct ctdb_req_control *request);
374 int ctdb_reply_control_start_recovery(struct ctdb_reply_control *reply);
375
376 void ctdb_req_control_end_recovery(struct ctdb_req_control *request);
377 int ctdb_reply_control_end_recovery(struct ctdb_reply_control *reply);
378
379 void ctdb_req_control_reload_nodes_file(struct ctdb_req_control *request);
380 int ctdb_reply_control_reload_nodes_file(struct ctdb_reply_control *reply);
381
382 void ctdb_req_control_try_delete_records(struct ctdb_req_control *request,
383                                          struct ctdb_rec_buffer *recbuf);
384 int ctdb_reply_control_try_delete_records(struct ctdb_reply_control *reply,
385                                           TALLOC_CTX *mem_ctx,
386                                           struct ctdb_rec_buffer **recbuf);
387
388 void ctdb_req_control_enable_monitor(struct ctdb_req_control *request);
389 int ctdb_reply_control_enable_monitor(struct ctdb_reply_control *reply);
390
391 void ctdb_req_control_disable_monitor(struct ctdb_req_control *request);
392 int ctdb_reply_control_disable_monitor(struct ctdb_reply_control *reply);
393
394 void ctdb_req_control_add_public_ip(struct ctdb_req_control *request,
395                                     struct ctdb_addr_info *addr_info);
396 int ctdb_reply_control_add_public_ip(struct ctdb_reply_control *reply);
397
398 void ctdb_req_control_del_public_ip(struct ctdb_req_control *request,
399                                     struct ctdb_addr_info *addr_info);
400 int ctdb_reply_control_del_public_ip(struct ctdb_reply_control *reply);
401
402 void ctdb_req_control_get_capabilities(struct ctdb_req_control *request);
403 int ctdb_reply_control_get_capabilities(struct ctdb_reply_control *reply,
404                                         uint32_t *caps);
405
406 void ctdb_req_control_recd_ping(struct ctdb_req_control *request);
407 int ctdb_reply_control_recd_ping(struct ctdb_reply_control *reply);
408
409 void ctdb_req_control_release_ip(struct ctdb_req_control *request,
410                                  struct ctdb_public_ip *pubip);
411 int ctdb_reply_control_release_ip(struct ctdb_reply_control *reply);
412
413 void ctdb_req_control_takeover_ip(struct ctdb_req_control *request,
414                                   struct ctdb_public_ip *pubip);
415 int ctdb_reply_control_takeover_ip(struct ctdb_reply_control *reply);
416
417 void ctdb_req_control_get_public_ips(struct ctdb_req_control *request,
418                                      bool available_only);
419 int ctdb_reply_control_get_public_ips(struct ctdb_reply_control *reply,
420                                       TALLOC_CTX *mem_ctx,
421                                       struct ctdb_public_ip_list **pubip_list);
422
423 void ctdb_req_control_get_nodemap(struct ctdb_req_control *request);
424 int ctdb_reply_control_get_nodemap(struct ctdb_reply_control *reply,
425                                    TALLOC_CTX *mem_ctx,
426                                    struct ctdb_node_map **nodemap);
427
428 void ctdb_req_control_traverse_kill(struct ctdb_req_control *request,
429                                     struct ctdb_traverse_start *traverse);
430 int ctdb_reply_control_traverse_kill(struct ctdb_reply_control *reply);
431
432 void ctdb_req_control_recd_reclock_latency(struct ctdb_req_control *request,
433                                            double reclock_latency);
434 int ctdb_reply_control_recd_reclock_latency(struct ctdb_reply_control *reply);
435
436 void ctdb_req_control_get_reclock_file(struct ctdb_req_control *request);
437 int ctdb_reply_control_get_reclock_file(struct ctdb_reply_control *reply,
438                                         TALLOC_CTX *mem_ctx,
439                                         const char **reclock_file);
440
441 void ctdb_req_control_stop_node(struct ctdb_req_control *request);
442 int ctdb_reply_control_stop_node(struct ctdb_reply_control *reply);
443
444 void ctdb_req_control_continue_node(struct ctdb_req_control *request);
445 int ctdb_reply_control_continue_node(struct ctdb_reply_control *reply);
446
447 void ctdb_req_control_set_lmasterrole(struct ctdb_req_control *request,
448                                       uint32_t lmaster_role);
449 int ctdb_reply_control_set_lmasterrole(struct ctdb_reply_control *reply);
450
451 void ctdb_req_control_set_recmasterrole(struct ctdb_req_control *request,
452                                         uint32_t recmaster_role);
453 int ctdb_reply_control_set_recmasterrole(struct ctdb_reply_control *reply);
454
455 void ctdb_req_control_set_ban_state(struct ctdb_req_control *request,
456                                     struct ctdb_ban_state *ban_state);
457 int ctdb_reply_control_set_ban_state(struct ctdb_reply_control *reply);
458
459 void ctdb_req_control_get_ban_state(struct ctdb_req_control *request);
460 int ctdb_reply_control_get_ban_state(struct ctdb_reply_control *reply,
461                                      TALLOC_CTX *mem_ctx,
462                                      struct ctdb_ban_state **ban_state);
463
464 void ctdb_req_control_register_notify(struct ctdb_req_control *request,
465                                       struct ctdb_notify_data *notify);
466 int ctdb_reply_control_register_notify(struct ctdb_reply_control *reply);
467
468 void ctdb_req_control_deregister_notify(struct ctdb_req_control *request,
469                                         uint64_t srvid);
470 int ctdb_reply_control_deregister_notify(struct ctdb_reply_control *reply);
471
472 void ctdb_req_control_trans3_commit(struct ctdb_req_control *request,
473                                     struct ctdb_rec_buffer *recbuf);
474 int ctdb_reply_control_trans3_commit(struct ctdb_reply_control *reply);
475
476 void ctdb_req_control_get_db_seqnum(struct ctdb_req_control *request,
477                                     uint32_t db_id);
478 int ctdb_reply_control_get_db_seqnum(struct ctdb_reply_control *reply,
479                                      uint64_t *seqnum);
480
481 void ctdb_req_control_db_set_healthy(struct ctdb_req_control *request,
482                                      uint32_t db_id);
483 int ctdb_reply_control_db_set_healthy(struct ctdb_reply_control *reply);
484
485 void ctdb_req_control_db_get_health(struct ctdb_req_control *request,
486                                     uint32_t db_id);
487 int ctdb_reply_control_db_get_health(struct ctdb_reply_control *reply,
488                                      TALLOC_CTX *mem_ctx,
489                                      const char **reason);
490
491 void ctdb_req_control_get_public_ip_info(struct ctdb_req_control *request,
492                                          ctdb_sock_addr *addr);
493 int ctdb_reply_control_get_public_ip_info(struct ctdb_reply_control *reply,
494                                           TALLOC_CTX *mem_ctx,
495                                           struct ctdb_public_ip_info **ipinfo);
496
497 void ctdb_req_control_get_ifaces(struct ctdb_req_control *request);
498 int ctdb_reply_control_get_ifaces(struct ctdb_reply_control *reply,
499                                   TALLOC_CTX *mem_ctx,
500                                   struct ctdb_iface_list **iface_list);
501
502 void ctdb_req_control_set_iface_link_state(struct ctdb_req_control *request,
503                                            struct ctdb_iface *iface);
504 int ctdb_reply_control_set_iface_link_state(struct ctdb_reply_control *reply);
505
506 void ctdb_req_control_tcp_add_delayed_update(struct ctdb_req_control *request,
507                                              struct ctdb_connection *conn);
508 int ctdb_reply_control_tcp_add_delayed_update(struct ctdb_reply_control *reply);
509
510 void ctdb_req_control_get_stat_history(struct ctdb_req_control *request);
511 int ctdb_reply_control_get_stat_history(struct ctdb_reply_control *reply,
512                                         TALLOC_CTX *mem_ctx,
513                                         struct ctdb_statistics_list **stats_list);
514
515 void ctdb_req_control_schedule_for_deletion(struct ctdb_req_control *request,
516                                             struct ctdb_key_data *key);
517 int ctdb_reply_control_schedule_for_deletion(struct ctdb_reply_control *reply);
518
519 void ctdb_req_control_set_db_readonly(struct ctdb_req_control *request,
520                                       uint32_t db_id);
521 int ctdb_reply_control_set_db_readonly(struct ctdb_reply_control *reply);
522
523 void ctdb_req_control_traverse_start_ext(struct ctdb_req_control *request,
524                                          struct ctdb_traverse_start_ext *traverse);
525 int ctdb_reply_control_traverse_start_ext(struct ctdb_reply_control *reply);
526
527 void ctdb_req_control_get_db_statistics(struct ctdb_req_control *request,
528                                         uint32_t db_id);
529 int ctdb_reply_control_get_db_statistics(struct ctdb_reply_control *reply,
530                                          TALLOC_CTX *mem_ctx,
531                                          struct ctdb_db_statistics **dbstats);
532
533 void ctdb_req_control_set_db_sticky(struct ctdb_req_control *request,
534                                     uint32_t db_id);
535 int ctdb_reply_control_set_db_sticky(struct ctdb_reply_control *reply);
536
537 void ctdb_req_control_reload_public_ips(struct ctdb_req_control *request);
538 int ctdb_reply_control_reload_public_ips(struct ctdb_reply_control *reply);
539
540 void ctdb_req_control_receive_records(struct ctdb_req_control *request,
541                                       struct ctdb_rec_buffer *recbuf);
542 int ctdb_reply_control_receive_records(struct ctdb_reply_control *reply,
543                                        TALLOC_CTX *mem_ctx,
544                                        struct ctdb_rec_buffer **recbuf);
545
546 void ctdb_req_control_ipreallocated(struct ctdb_req_control *request);
547 int ctdb_reply_control_ipreallocated(struct ctdb_reply_control *reply);
548
549 void ctdb_req_control_get_runstate(struct ctdb_req_control *request);
550 int ctdb_reply_control_get_runstate(struct ctdb_reply_control *reply,
551                                     enum ctdb_runstate *runstate);
552
553 void ctdb_req_control_db_detach(struct ctdb_req_control *request,
554                                 uint32_t db_id);
555 int ctdb_reply_control_db_detach(struct ctdb_reply_control *reply);
556
557 void ctdb_req_control_get_nodes_file(struct ctdb_req_control *request);
558 int ctdb_reply_control_get_nodes_file(struct ctdb_reply_control *reply,
559                                       TALLOC_CTX *mem_ctx,
560                                       struct ctdb_node_map **nodemap);
561
562 void ctdb_req_control_db_freeze(struct ctdb_req_control *request,
563                                 uint32_t db_id);
564 int ctdb_reply_control_db_freeze(struct ctdb_reply_control *reply);
565
566 void ctdb_req_control_db_thaw(struct ctdb_req_control *request,
567                               uint32_t db_id);
568 int ctdb_reply_control_db_thaw(struct ctdb_reply_control *reply);
569
570 void ctdb_req_control_db_transaction_start(struct ctdb_req_control *request,
571                                            struct ctdb_transdb *transdb);
572 int ctdb_reply_control_db_transaction_start(struct ctdb_reply_control *reply);
573
574 void ctdb_req_control_db_transaction_commit(struct ctdb_req_control *request,
575                                             struct ctdb_transdb *transdb);
576 int ctdb_reply_control_db_transaction_commit(struct ctdb_reply_control *reply);
577
578 void ctdb_req_control_db_transaction_cancel(struct ctdb_req_control *request,
579                                             uint32_t db_id);
580 int ctdb_reply_control_db_transaction_cancel(struct ctdb_reply_control *reply);
581
582 void ctdb_req_control_db_pull(struct ctdb_req_control *request,
583                               struct ctdb_pulldb_ext *pulldb_ext);
584 int ctdb_reply_control_db_pull(struct ctdb_reply_control *reply,
585                                uint32_t *num_records);
586
587 void ctdb_req_control_db_push_start(struct ctdb_req_control *request,
588                                     struct ctdb_pulldb_ext *pulldb_ext);
589 int ctdb_reply_control_db_push_start(struct ctdb_reply_control *reply);
590
591 void ctdb_req_control_db_push_confirm(struct ctdb_req_control *request,
592                                       uint32_t db_id);
593 int ctdb_reply_control_db_push_confirm(struct ctdb_reply_control *reply,
594                                        uint32_t *num_records);
595
596 void ctdb_req_control_db_open_flags(struct ctdb_req_control *request,
597                                     uint32_t db_id);
598 int ctdb_reply_control_db_open_flags(struct ctdb_reply_control *reply,
599                                      int *tdb_flags);
600
601 void ctdb_req_control_db_attach_replicated(struct ctdb_req_control *request,
602                                            const char *db_name);
603 int ctdb_reply_control_db_attach_replicated(struct ctdb_reply_control *reply,
604                                             uint32_t *db_id);
605
606 /* From protocol/protocol_debug.c */
607
608 void ctdb_packet_print(uint8_t *buf, size_t buflen, FILE *fp);
609
610 /* From protocol/protocol_message.c */
611
612 size_t ctdb_req_message_len(struct ctdb_req_header *h,
613                             struct ctdb_req_message *c);
614
615 int ctdb_req_message_push(struct ctdb_req_header *h,
616                           struct ctdb_req_message *c,
617                           uint8_t *buf, size_t *buflen);
618
619 int ctdb_req_message_pull(uint8_t *buf, size_t buflen,
620                           struct ctdb_req_header *h,
621                           TALLOC_CTX *mem_ctx,
622                           struct ctdb_req_message *c);
623
624 size_t ctdb_req_message_data_len(struct ctdb_req_header *h,
625                                  struct ctdb_req_message_data *c);
626
627 int ctdb_req_message_data_push(struct ctdb_req_header *h,
628                                struct ctdb_req_message_data *c,
629                                uint8_t *buf, size_t *buflen);
630
631 int ctdb_req_message_data_pull(uint8_t *buf, size_t buflen,
632                                struct ctdb_req_header *h,
633                                TALLOC_CTX *mem_ctx,
634                                struct ctdb_req_message_data *c);
635
636 /* From protocol/protocol_event.c */
637
638 void ctdb_event_header_fill(struct ctdb_event_header *h, uint32_t reqid);
639
640 size_t ctdb_event_request_len(struct ctdb_event_request *in);
641
642 int ctdb_event_request_push(struct ctdb_event_request *in,
643                             uint8_t *buf, size_t *buflen);
644
645 int ctdb_event_request_pull(uint8_t *buf, size_t buflen,
646                             TALLOC_CTX *mem_ctx,
647                             struct ctdb_event_request *out);
648
649 size_t ctdb_event_reply_len(struct ctdb_event_reply *in);
650
651 int ctdb_event_reply_push(struct ctdb_event_reply *in,
652                           uint8_t *buf, size_t *buflen);
653
654 int ctdb_event_reply_pull(uint8_t *buf, size_t buflen,
655                           TALLOC_CTX *mem_ctx,
656                           struct ctdb_event_reply *out);
657
658 /* From protocol/protocol_packet.c */
659
660 int ctdb_allocate_pkt(TALLOC_CTX *mem_ctx, size_t datalen,
661                       uint8_t **buf, size_t *buflen);
662
663 /* From protocol/protocol_util.c */
664
665 const char *ctdb_runstate_to_string(enum ctdb_runstate runstate);
666 enum ctdb_runstate ctdb_runstate_from_string(const char *runstate_str);
667
668 const char *ctdb_event_to_string(enum ctdb_event event);
669 enum ctdb_event ctdb_event_from_string(const char *event_str);
670
671 const char *ctdb_sock_addr_to_string(TALLOC_CTX *mem_ctx, ctdb_sock_addr *addr);
672 int ctdb_sock_addr_cmp_ip(const ctdb_sock_addr *addr1,
673                           const ctdb_sock_addr *addr2);
674 int ctdb_sock_addr_cmp(const ctdb_sock_addr *addr1,
675                        const ctdb_sock_addr *addr2);
676 bool ctdb_sock_addr_same_ip(const ctdb_sock_addr *addr1,
677                             const ctdb_sock_addr *addr2);
678 bool ctdb_sock_addr_same(const ctdb_sock_addr *addr1,
679                          const ctdb_sock_addr *addr2);
680
681 #endif /* __CTDB_PROTOCOL_API_H__ */