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