python:tests: Store keys as bytes rather than as tuples
[Samba.git] / ctdb / protocol / protocol_client.c
blob082383bc03862333029e5d362f3f0f67fe3f68c7
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 #include "replace.h"
21 #include "system/network.h"
23 #include <talloc.h>
24 #include <tdb.h>
26 #include "protocol.h"
27 #include "protocol_api.h"
28 #include "protocol_private.h"
31 void ctdb_req_call_fill(struct ctdb_req_call *c,
32 uint32_t db_id, uint32_t flags,
33 uint32_t call_id, TDB_DATA key)
35 request->flags = flags;
36 c->db_id = db_id;
37 c->call_id = call_id;
38 c->key = key;
39 c->calldata = tdb_null;
43 static int ctdb_reply_control_generic(struct ctdb_reply_control *reply,
44 uint32_t opcode)
46 if (reply->rdata.opcode != opcode) {
47 return EPROTO;
50 return reply->status;
53 /* CTDB_CONTROL_PROCESS_EXISTS */
55 void ctdb_req_control_process_exists(struct ctdb_req_control *request,
56 pid_t pid)
58 request->opcode = CTDB_CONTROL_PROCESS_EXISTS;
59 request->pad = 0;
60 request->srvid = 0;
61 request->client_id = 0;
62 request->flags = 0;
64 request->rdata.opcode = CTDB_CONTROL_PROCESS_EXISTS;
65 request->rdata.data.pid = pid;
69 int ctdb_reply_control_process_exists(struct ctdb_reply_control *reply,
70 int *status)
72 if (reply->rdata.opcode != CTDB_CONTROL_PROCESS_EXISTS) {
73 return EPROTO;
76 *status = reply->status;
77 reply->status = 0;
79 return reply->status;
82 /* CTDB_CONTROL_STATISTICS */
84 void ctdb_req_control_statistics(struct ctdb_req_control *request)
86 request->opcode = CTDB_CONTROL_STATISTICS;
87 request->pad = 0;
88 request->srvid = 0;
89 request->client_id = 0;
90 request->flags = 0;
92 request->rdata.opcode = CTDB_CONTROL_STATISTICS;
95 int ctdb_reply_control_statistics(struct ctdb_reply_control *reply,
96 TALLOC_CTX *mem_ctx,
97 struct ctdb_statistics **stats)
99 if (reply->rdata.opcode != CTDB_CONTROL_STATISTICS) {
100 return EPROTO;
103 if (reply->status == 0) {
104 *stats = talloc_steal(mem_ctx, reply->rdata.data.stats);
106 return reply->status;
109 /* CTDB_CONTROL_PING */
111 void ctdb_req_control_ping(struct ctdb_req_control *request)
113 request->opcode = CTDB_CONTROL_PING;
114 request->pad = 0;
115 request->srvid = 0;
116 request->client_id = 0;
117 request->flags = 0;
119 request->rdata.opcode = CTDB_CONTROL_PING;
122 int ctdb_reply_control_ping(struct ctdb_reply_control *reply,
123 int *num_clients)
125 if (reply->rdata.opcode != CTDB_CONTROL_PING) {
126 return EPROTO;
129 if (reply->status >= 0) {
130 *num_clients = reply->status;
131 reply->status = 0;
133 return reply->status;
136 /* CTDB_CONTROL_GETDBPATH */
138 void ctdb_req_control_getdbpath(struct ctdb_req_control *request,
139 uint32_t db_id)
141 request->opcode = CTDB_CONTROL_GETDBPATH;
142 request->pad = 0;
143 request->srvid = 0;
144 request->client_id = 0;
145 request->flags = 0;
147 request->rdata.opcode = CTDB_CONTROL_GETDBPATH;
148 request->rdata.data.db_id = db_id;
151 int ctdb_reply_control_getdbpath(struct ctdb_reply_control *reply,
152 TALLOC_CTX *mem_ctx, const char **db_path)
154 if (reply->rdata.opcode != CTDB_CONTROL_GETDBPATH) {
155 return EPROTO;
158 if (reply->status == 0) {
159 *db_path = talloc_steal(mem_ctx, reply->rdata.data.db_path);
161 return reply->status;
164 /* CTDB_CONTROL_GETVNNMAP */
166 void ctdb_req_control_getvnnmap(struct ctdb_req_control *request)
168 request->opcode = CTDB_CONTROL_GETVNNMAP;
169 request->pad = 0;
170 request->srvid = 0;
171 request->client_id = 0;
172 request->flags = 0;
174 request->rdata.opcode = CTDB_CONTROL_GETVNNMAP;
177 int ctdb_reply_control_getvnnmap(struct ctdb_reply_control *reply,
178 TALLOC_CTX *mem_ctx,
179 struct ctdb_vnn_map **vnnmap)
181 if (reply->rdata.opcode != CTDB_CONTROL_GETVNNMAP) {
182 return EPROTO;
185 if (reply->status == 0) {
186 *vnnmap = talloc_steal(mem_ctx, reply->rdata.data.vnnmap);
188 return reply->status;
191 /* CTDB_CONTROL_SETVNNMAP */
193 void ctdb_req_control_setvnnmap(struct ctdb_req_control *request,
194 struct ctdb_vnn_map *vnnmap)
196 request->opcode = CTDB_CONTROL_SETVNNMAP;
197 request->pad = 0;
198 request->srvid = 0;
199 request->client_id = 0;
200 request->flags = 0;
202 request->rdata.opcode = CTDB_CONTROL_SETVNNMAP;
203 request->rdata.data.vnnmap = vnnmap;
206 int ctdb_reply_control_setvnnmap(struct ctdb_reply_control *reply)
208 return ctdb_reply_control_generic(reply, CTDB_CONTROL_SETVNNMAP);
211 /* CTDB_CONTROL_GET_DEBUG */
213 void ctdb_req_control_get_debug(struct ctdb_req_control *request)
215 request->opcode = CTDB_CONTROL_GET_DEBUG;
216 request->pad = 0;
217 request->srvid = 0;
218 request->client_id = 0;
219 request->flags = 0;
221 request->rdata.opcode = CTDB_CONTROL_GET_DEBUG;
224 int ctdb_reply_control_get_debug(struct ctdb_reply_control *reply,
225 int *loglevel)
227 if (reply->rdata.opcode != CTDB_CONTROL_GET_DEBUG) {
228 return EPROTO;
231 if (reply->status == 0) {
232 *loglevel = (int)reply->rdata.data.loglevel;
234 return reply->status;
237 /* CTDB_CONTROL_SET_DEBUG */
239 void ctdb_req_control_set_debug(struct ctdb_req_control *request,
240 int loglevel)
242 request->opcode = CTDB_CONTROL_SET_DEBUG;
243 request->pad = 0;
244 request->srvid = 0;
245 request->client_id = 0;
246 request->flags = 0;
248 request->rdata.opcode = CTDB_CONTROL_SET_DEBUG;
249 request->rdata.data.loglevel = (uint32_t)loglevel;
252 int ctdb_reply_control_set_debug(struct ctdb_reply_control *reply)
254 return ctdb_reply_control_generic(reply, CTDB_CONTROL_SET_DEBUG);
257 /* CTDB_CONTROL_GET_DBMAP */
259 void ctdb_req_control_get_dbmap(struct ctdb_req_control *request)
261 request->opcode = CTDB_CONTROL_GET_DBMAP;
262 request->pad = 0;
263 request->srvid = 0;
264 request->client_id = 0;
265 request->flags = 0;
267 request->rdata.opcode = CTDB_CONTROL_GET_DBMAP;
270 int ctdb_reply_control_get_dbmap(struct ctdb_reply_control *reply,
271 TALLOC_CTX *mem_ctx,
272 struct ctdb_dbid_map **dbmap)
274 if (reply->rdata.opcode != CTDB_CONTROL_GET_DBMAP) {
275 return EPROTO;
278 if (reply->status == 0) {
279 *dbmap = talloc_steal(mem_ctx, reply->rdata.data.dbmap);
281 return reply->status;
284 /* CTDB_CONTROL_GET_RECMODE */
286 void ctdb_req_control_get_recmode(struct ctdb_req_control *request)
288 request->opcode = CTDB_CONTROL_GET_RECMODE;
289 request->pad = 0;
290 request->srvid = 0;
291 request->client_id = 0;
292 request->flags = 0;
294 request->rdata.opcode = CTDB_CONTROL_GET_RECMODE;
297 int ctdb_reply_control_get_recmode(struct ctdb_reply_control *reply,
298 int *recmode)
300 if (reply->rdata.opcode != CTDB_CONTROL_GET_RECMODE) {
301 return EPROTO;
304 if (reply->status >= 0) {
305 *recmode = reply->status;
306 reply->status = 0;
308 return reply->status;
311 /* CTDB_CONTROL_SET_RECMODE */
313 void ctdb_req_control_set_recmode(struct ctdb_req_control *request,
314 int recmode)
316 request->opcode = CTDB_CONTROL_SET_RECMODE;
317 request->pad = 0;
318 request->srvid = 0;
319 request->client_id = 0;
320 request->flags = 0;
322 request->rdata.opcode = CTDB_CONTROL_SET_RECMODE;
323 request->rdata.data.recmode = recmode;
326 int ctdb_reply_control_set_recmode(struct ctdb_reply_control *reply)
328 return ctdb_reply_control_generic(reply, CTDB_CONTROL_SET_RECMODE);
331 /* CTDB_CONTROL_STATISTICS_RESET */
333 void ctdb_req_control_statistics_reset(struct ctdb_req_control *request)
335 request->opcode = CTDB_CONTROL_STATISTICS_RESET;
336 request->pad = 0;
337 request->srvid = 0;
338 request->client_id = 0;
339 request->flags = 0;
341 request->rdata.opcode = CTDB_CONTROL_STATISTICS_RESET;
344 int ctdb_reply_control_statistics_reset(struct ctdb_reply_control *reply)
346 return ctdb_reply_control_generic(reply,
347 CTDB_CONTROL_STATISTICS_RESET);
350 /* CTDB_CONTROL_DB_ATTACH */
352 void ctdb_req_control_db_attach(struct ctdb_req_control *request,
353 const char *db_name)
355 request->opcode = CTDB_CONTROL_DB_ATTACH;
356 request->pad = 0;
357 request->srvid = 0;
358 request->client_id = 0;
359 request->flags = 0;
361 request->rdata.opcode = CTDB_CONTROL_DB_ATTACH;
362 request->rdata.data.db_name = db_name;
365 int ctdb_reply_control_db_attach(struct ctdb_reply_control *reply,
366 uint32_t *db_id)
368 if (reply->rdata.opcode != CTDB_CONTROL_DB_ATTACH) {
369 return EPROTO;
372 if (reply->status == 0) {
373 *db_id = reply->rdata.data.db_id;
375 return reply->status;
378 /* CTDB_CONTROL_TRAVERSE_START */
380 void ctdb_req_control_traverse_start(struct ctdb_req_control *request,
381 struct ctdb_traverse_start *traverse)
383 request->opcode = CTDB_CONTROL_TRAVERSE_START;
384 request->pad = 0;
385 request->srvid = 0;
386 request->client_id = 0;
387 request->flags = 0;
389 request->rdata.opcode = CTDB_CONTROL_TRAVERSE_START;
390 request->rdata.data.traverse_start = traverse;
393 int ctdb_reply_control_traverse_start(struct ctdb_reply_control *reply)
395 return ctdb_reply_control_generic(reply, CTDB_CONTROL_TRAVERSE_START);
398 /* CTDB_CONTROL_TRAVERSE_ALL */
399 /* CTDB_CONTROL_TRAVERSE_DATA */
401 /* CTDB_CONTROL_REGISTER_SRVID */
403 void ctdb_req_control_register_srvid(struct ctdb_req_control *request,
404 uint64_t srvid)
406 request->opcode = CTDB_CONTROL_REGISTER_SRVID;
407 request->pad = 0;
408 request->srvid = srvid;
409 request->client_id = 0;
410 request->flags = 0;
412 request->rdata.opcode = CTDB_CONTROL_REGISTER_SRVID;
415 int ctdb_reply_control_register_srvid(struct ctdb_reply_control *reply)
417 return ctdb_reply_control_generic(reply, CTDB_CONTROL_REGISTER_SRVID);
420 /* CTDB_CONTROL_DEREGISTER_SRVID */
422 void ctdb_req_control_deregister_srvid(struct ctdb_req_control *request,
423 uint64_t srvid)
425 request->opcode = CTDB_CONTROL_DEREGISTER_SRVID;
426 request->pad = 0;
427 request->srvid = srvid;
428 request->client_id = 0;
429 request->flags = 0;
431 request->rdata.opcode = CTDB_CONTROL_DEREGISTER_SRVID;
434 int ctdb_reply_control_deregister_srvid(struct ctdb_reply_control *reply)
436 return ctdb_reply_control_generic(reply,
437 CTDB_CONTROL_DEREGISTER_SRVID);
440 /* CTDB_CONTROL_GET_DBNAME */
442 void ctdb_req_control_get_dbname(struct ctdb_req_control *request,
443 uint32_t db_id)
445 request->opcode = CTDB_CONTROL_GET_DBNAME;
446 request->pad = 0;
447 request->srvid = 0;
448 request->client_id = 0;
449 request->flags = 0;
451 request->rdata.opcode = CTDB_CONTROL_GET_DBNAME;
452 request->rdata.data.db_id = db_id;
455 int ctdb_reply_control_get_dbname(struct ctdb_reply_control *reply,
456 TALLOC_CTX *mem_ctx, const char **db_name)
458 if (reply->rdata.opcode != CTDB_CONTROL_GET_DBNAME) {
459 return EPROTO;
462 if (reply->status == 0) {
463 *db_name = talloc_steal(mem_ctx, reply->rdata.data.db_name);
465 return reply->status;
468 /* CTDB_CONTROL_ENABLE_SEQNUM */
470 void ctdb_req_control_enable_seqnum(struct ctdb_req_control *request,
471 uint32_t db_id)
473 request->opcode = CTDB_CONTROL_ENABLE_SEQNUM;
474 request->pad = 0;
475 request->srvid = 0;
476 request->client_id = 0;
477 request->flags = 0;
479 request->rdata.opcode = CTDB_CONTROL_ENABLE_SEQNUM;
480 request->rdata.data.db_id = db_id;
483 int ctdb_reply_control_enable_seqnum(struct ctdb_reply_control *reply)
485 return ctdb_reply_control_generic(reply, CTDB_CONTROL_ENABLE_SEQNUM);
488 /* CTDB_CONTROL_UPDATE_SEQNUM */
490 void ctdb_req_control_update_seqnum(struct ctdb_req_control *request,
491 uint32_t db_id)
493 request->opcode = CTDB_CONTROL_UPDATE_SEQNUM;
494 request->pad = 0;
495 request->srvid = 0;
496 request->client_id = 0;
497 request->flags = 0;
499 request->rdata.opcode = CTDB_CONTROL_UPDATE_SEQNUM;
500 request->rdata.data.db_id = db_id;
503 int ctdb_reply_control_update_seqnum(struct ctdb_reply_control *reply)
505 return ctdb_reply_control_generic(reply, CTDB_CONTROL_UPDATE_SEQNUM);
508 /* CTDB_CONTROL_DUMP_MEMORY */
510 void ctdb_req_control_dump_memory(struct ctdb_req_control *request)
512 request->opcode = CTDB_CONTROL_DUMP_MEMORY;
513 request->pad = 0;
514 request->srvid = 0;
515 request->client_id = 0;
516 request->flags = 0;
518 request->rdata.opcode = CTDB_CONTROL_DUMP_MEMORY;
521 int ctdb_reply_control_dump_memory(struct ctdb_reply_control *reply,
522 TALLOC_CTX *mem_ctx, const char **mem_str)
524 if (reply->rdata.opcode != CTDB_CONTROL_DUMP_MEMORY) {
525 return EPROTO;
528 if (reply->status == 0) {
529 *mem_str = talloc_steal(mem_ctx, reply->rdata.data.mem_str);
531 return reply->status;
534 /* CTDB_CONTROL_GET_PID */
536 void ctdb_req_control_get_pid(struct ctdb_req_control *request)
538 request->opcode = CTDB_CONTROL_GET_PID;
539 request->pad = 0;
540 request->srvid = 0;
541 request->client_id = 0;
542 request->flags = 0;
544 request->rdata.opcode = CTDB_CONTROL_GET_PID;
547 int ctdb_reply_control_get_pid(struct ctdb_reply_control *reply,
548 pid_t *pid)
550 if (reply->rdata.opcode != CTDB_CONTROL_GET_PID) {
551 return EPROTO;
554 *pid = reply->status;
555 reply->status = 0;
557 return reply->status;
560 /* CTDB_CONTROL_FREEZE */
562 void ctdb_req_control_freeze(struct ctdb_req_control *request,
563 uint32_t priority)
565 request->opcode = CTDB_CONTROL_FREEZE;
566 request->pad = 0;
567 request->srvid = priority;
568 request->client_id = 0;
569 request->flags = 0;
571 request->rdata.opcode = CTDB_CONTROL_FREEZE;
574 int ctdb_reply_control_freeze(struct ctdb_reply_control *reply)
576 return ctdb_reply_control_generic(reply, CTDB_CONTROL_FREEZE);
579 /* CTDB_CONTROL_GET_PNN */
581 void ctdb_req_control_get_pnn(struct ctdb_req_control *request)
583 request->opcode = CTDB_CONTROL_GET_PNN;
584 request->pad = 0;
585 request->srvid = 0;
586 request->client_id = 0;
587 request->flags = 0;
589 request->rdata.opcode = CTDB_CONTROL_GET_PNN;
592 int ctdb_reply_control_get_pnn(struct ctdb_reply_control *reply,
593 uint32_t *pnn)
595 if (reply->rdata.opcode != CTDB_CONTROL_GET_PNN) {
596 return EPROTO;
599 if (reply->status >= 0) {
600 *pnn = reply->status;
601 reply->status = 0;
603 return reply->status;
606 /* CTDB_CONTROL_SHUTDOWN */
608 void ctdb_req_control_shutdown(struct ctdb_req_control *request)
610 request->opcode = CTDB_CONTROL_SHUTDOWN;
611 request->pad = 0;
612 request->srvid = 0;
613 request->client_id = 0;
614 request->flags = CTDB_CTRL_FLAG_NOREPLY;
616 request->rdata.opcode = CTDB_CONTROL_SHUTDOWN;
619 int ctdb_reply_control_shutdown(struct ctdb_reply_control *reply)
621 return ctdb_reply_control_generic(reply, CTDB_CONTROL_SHUTDOWN);
624 /* CTDB_CONTROL_TCP_CLIENT */
626 void ctdb_req_control_tcp_client(struct ctdb_req_control *request,
627 struct ctdb_connection *conn)
629 request->opcode = CTDB_CONTROL_TCP_CLIENT;
630 request->pad = 0;
631 request->srvid = 0;
632 request->client_id = 0;
633 request->flags = 0;
635 request->rdata.opcode = CTDB_CONTROL_TCP_CLIENT;
636 request->rdata.data.conn = conn;
639 int ctdb_reply_control_tcp_client(struct ctdb_reply_control *reply)
641 return ctdb_reply_control_generic(reply, CTDB_CONTROL_TCP_CLIENT);
644 /* CTDB_CONTROL_TCP_ADD */
646 void ctdb_req_control_tcp_add(struct ctdb_req_control *request,
647 struct ctdb_connection *conn)
649 request->opcode = CTDB_CONTROL_TCP_ADD;
650 request->pad = 0;
651 request->srvid = 0;
652 request->client_id = 0;
653 request->flags = 0;
655 request->rdata.opcode = CTDB_CONTROL_TCP_ADD;
656 request->rdata.data.conn = conn;
659 int ctdb_reply_control_tcp_add(struct ctdb_reply_control *reply)
661 return ctdb_reply_control_generic(reply, CTDB_CONTROL_TCP_ADD);
664 /* CTDB_CONTROL_TCP_REMOVE */
666 void ctdb_req_control_tcp_remove(struct ctdb_req_control *request,
667 struct ctdb_connection *conn)
669 request->opcode = CTDB_CONTROL_TCP_REMOVE;
670 request->pad = 0;
671 request->srvid = 0;
672 request->client_id = 0;
673 request->flags = 0;
675 request->rdata.opcode = CTDB_CONTROL_TCP_REMOVE;
676 request->rdata.data.conn = conn;
679 int ctdb_reply_control_tcp_remove(struct ctdb_reply_control *reply)
681 return ctdb_reply_control_generic(reply, CTDB_CONTROL_TCP_REMOVE);
684 /* CTDB_CONTROL_STARTUP */
686 void ctdb_req_control_startup(struct ctdb_req_control *request)
688 request->opcode = CTDB_CONTROL_STARTUP;
689 request->pad = 0;
690 request->srvid = 0;
691 request->client_id = 0;
692 request->flags = 0;
694 request->rdata.opcode = CTDB_CONTROL_STARTUP;
697 int ctdb_reply_control_startup(struct ctdb_reply_control *reply)
699 return ctdb_reply_control_generic(reply, CTDB_CONTROL_STARTUP);
702 /* CTDB_CONTROL_SET_TUNABLE */
704 void ctdb_req_control_set_tunable(struct ctdb_req_control *request,
705 struct ctdb_tunable *tunable)
707 request->opcode = CTDB_CONTROL_SET_TUNABLE;
708 request->pad = 0;
709 request->srvid = 0;
710 request->client_id = 0;
711 request->flags = 0;
713 request->rdata.opcode = CTDB_CONTROL_SET_TUNABLE;
714 request->rdata.data.tunable = tunable;
717 int ctdb_reply_control_set_tunable(struct ctdb_reply_control *reply)
719 return ctdb_reply_control_generic(reply, CTDB_CONTROL_SET_TUNABLE);
722 /* CTDB_CONTROL_GET_TUNABLE */
724 void ctdb_req_control_get_tunable(struct ctdb_req_control *request,
725 const char *name)
727 request->opcode = CTDB_CONTROL_GET_TUNABLE;
728 request->pad = 0;
729 request->srvid = 0;
730 request->client_id = 0;
731 request->flags = 0;
733 request->rdata.opcode = CTDB_CONTROL_GET_TUNABLE;
734 request->rdata.data.tun_var = discard_const(name);
737 int ctdb_reply_control_get_tunable(struct ctdb_reply_control *reply,
738 uint32_t *value)
740 if (reply->rdata.opcode != CTDB_CONTROL_GET_TUNABLE) {
741 return EPROTO;
744 if (reply->status == 0) {
745 *value = reply->rdata.data.tun_value;
747 return reply->status;
750 /* CTDB_CONTROL_LIST_TUNABLES */
752 void ctdb_req_control_list_tunables(struct ctdb_req_control *request)
754 request->opcode = CTDB_CONTROL_LIST_TUNABLES;
755 request->pad = 0;
756 request->srvid = 0;
757 request->client_id = 0;
758 request->flags = 0;
760 request->rdata.opcode = CTDB_CONTROL_LIST_TUNABLES;
763 int ctdb_reply_control_list_tunables(struct ctdb_reply_control *reply,
764 TALLOC_CTX *mem_ctx,
765 struct ctdb_var_list **tun_var_list)
767 if (reply->rdata.opcode != CTDB_CONTROL_LIST_TUNABLES) {
768 return EPROTO;
771 if (reply->status == 0) {
772 *tun_var_list = talloc_steal(mem_ctx,
773 reply->rdata.data.tun_var_list);
775 return reply->status;
778 /* CTDB_CONTROL_MODIFY_FLAGS */
780 void ctdb_req_control_modify_flags(struct ctdb_req_control *request,
781 struct ctdb_node_flag_change *flag_change)
783 request->opcode = CTDB_CONTROL_MODIFY_FLAGS;
784 request->pad = 0;
785 request->srvid = 0;
786 request->client_id = 0;
787 request->flags = 0;
789 request->rdata.opcode = CTDB_CONTROL_MODIFY_FLAGS;
790 request->rdata.data.flag_change = flag_change;
793 int ctdb_reply_control_modify_flags(struct ctdb_reply_control *reply)
795 return ctdb_reply_control_generic(reply, CTDB_CONTROL_MODIFY_FLAGS);
798 /* CTDB_CONTROL_GET_ALL_TUNABLES */
800 void ctdb_req_control_get_all_tunables(struct ctdb_req_control *request)
802 request->opcode = CTDB_CONTROL_GET_ALL_TUNABLES;
803 request->pad = 0;
804 request->srvid = 0;
805 request->client_id = 0;
806 request->flags = 0;
808 request->rdata.opcode = CTDB_CONTROL_GET_ALL_TUNABLES;
811 int ctdb_reply_control_get_all_tunables(struct ctdb_reply_control *reply,
812 TALLOC_CTX *mem_ctx,
813 struct ctdb_tunable_list **tun_list)
815 if (reply->rdata.opcode != CTDB_CONTROL_GET_ALL_TUNABLES) {
816 return EPROTO;
819 if (reply->status == 0) {
820 *tun_list = talloc_steal(mem_ctx, reply->rdata.data.tun_list);
822 return reply->status;
825 /* CTDB_CONTROL_GET_TCP_TICKLE_LIST */
827 void ctdb_req_control_get_tcp_tickle_list(struct ctdb_req_control *request,
828 ctdb_sock_addr *addr)
830 request->opcode = CTDB_CONTROL_GET_TCP_TICKLE_LIST;
831 request->pad = 0;
832 request->srvid = 0;
833 request->client_id = 0;
834 request->flags = 0;
836 request->rdata.opcode = CTDB_CONTROL_GET_TCP_TICKLE_LIST;
837 request->rdata.data.addr = addr;
840 int ctdb_reply_control_get_tcp_tickle_list(struct ctdb_reply_control *reply,
841 TALLOC_CTX *mem_ctx,
842 struct ctdb_tickle_list **tickles)
844 if (reply->rdata.opcode != CTDB_CONTROL_GET_TCP_TICKLE_LIST) {
845 return EPROTO;
848 if (reply->status == 0) {
849 *tickles = talloc_steal(mem_ctx, reply->rdata.data.tickles);
851 return reply->status;
854 /* CTDB_CONTROL_SET_TCP_TICKLE_LIST */
856 void ctdb_req_control_set_tcp_tickle_list(struct ctdb_req_control *request,
857 struct ctdb_tickle_list *tickles)
859 request->opcode = CTDB_CONTROL_SET_TCP_TICKLE_LIST;
860 request->pad = 0;
861 request->srvid = 0;
862 request->client_id = 0;
863 request->flags = 0;
865 request->rdata.opcode = CTDB_CONTROL_SET_TCP_TICKLE_LIST;
866 request->rdata.data.tickles = tickles;
869 int ctdb_reply_control_set_tcp_tickle_list(struct ctdb_reply_control *reply)
871 return ctdb_reply_control_generic(reply,
872 CTDB_CONTROL_SET_TCP_TICKLE_LIST);
875 /* CTDB_CONTROL_DB_ATTACH_PERSISTENT */
877 void ctdb_req_control_db_attach_persistent(struct ctdb_req_control *request,
878 const char *db_name)
880 request->opcode = CTDB_CONTROL_DB_ATTACH_PERSISTENT;
881 request->pad = 0;
882 request->srvid = 0;
883 request->client_id = 0;
884 request->flags = 0;
886 request->rdata.opcode = CTDB_CONTROL_DB_ATTACH_PERSISTENT;
887 request->rdata.data.db_name = db_name;
890 int ctdb_reply_control_db_attach_persistent(struct ctdb_reply_control *reply,
891 uint32_t *db_id)
893 if (reply->rdata.opcode != CTDB_CONTROL_DB_ATTACH_PERSISTENT) {
894 return EPROTO;
897 if (reply->status == 0) {
898 *db_id = reply->rdata.data.db_id;
900 return reply->status;
903 /* CTDB_CONTROL_UPDATE_RECORD */
905 void ctdb_req_control_update_record(struct ctdb_req_control *request,
906 struct ctdb_rec_buffer *recbuf)
908 request->opcode = CTDB_CONTROL_UPDATE_RECORD;
909 request->pad = 0;
910 request->srvid = 0;
911 request->client_id = 0;
912 request->flags = 0;
914 request->rdata.opcode = CTDB_CONTROL_UPDATE_RECORD;
915 request->rdata.data.recbuf = recbuf;
918 int ctdb_reply_control_update_record(struct ctdb_reply_control *reply)
920 return ctdb_reply_control_generic(reply, CTDB_CONTROL_UPDATE_RECORD);
923 /* CTDB_CONTROL_SEND_GRATUITOUS_ARP */
925 void ctdb_req_control_send_gratuitous_arp(struct ctdb_req_control *request,
926 struct ctdb_addr_info *addr_info)
928 request->opcode = CTDB_CONTROL_SEND_GRATUITOUS_ARP;
929 request->pad = 0;
930 request->srvid = 0;
931 request->client_id = 0;
932 request->flags = 0;
934 request->rdata.opcode = CTDB_CONTROL_SEND_GRATUITOUS_ARP;
935 request->rdata.data.addr_info = addr_info;
938 int ctdb_reply_control_send_gratuitous_arp(struct ctdb_reply_control *reply)
940 return ctdb_reply_control_generic(reply,
941 CTDB_CONTROL_SEND_GRATUITOUS_ARP);
944 /* CTDB_CONTROL_WIPE_DATABASE */
946 void ctdb_req_control_wipe_database(struct ctdb_req_control *request,
947 struct ctdb_transdb *transdb)
949 request->opcode = CTDB_CONTROL_WIPE_DATABASE;
950 request->pad = 0;
951 request->srvid = 0;
952 request->client_id = 0;
953 request->flags = 0;
955 request->rdata.opcode = CTDB_CONTROL_WIPE_DATABASE;
956 request->rdata.data.transdb = transdb;
959 int ctdb_reply_control_wipe_database(struct ctdb_reply_control *reply)
961 return ctdb_reply_control_generic(reply, CTDB_CONTROL_WIPE_DATABASE);
964 /* CTDB_CONTROL_UPTIME */
966 void ctdb_req_control_uptime(struct ctdb_req_control *request)
968 request->opcode = CTDB_CONTROL_UPTIME;
969 request->pad = 0;
970 request->srvid = 0;
971 request->client_id = 0;
972 request->flags = 0;
974 request->rdata.opcode = CTDB_CONTROL_UPTIME;
977 int ctdb_reply_control_uptime(struct ctdb_reply_control *reply,
978 TALLOC_CTX *mem_ctx, struct ctdb_uptime **uptime)
980 if (reply->rdata.opcode != CTDB_CONTROL_UPTIME) {
981 return EPROTO;
984 if (reply->status == 0) {
985 *uptime = talloc_steal(mem_ctx, reply->rdata.data.uptime);
987 return reply->status;
990 /* CTDB_CONTROL_START_RECOVERY */
992 void ctdb_req_control_start_recovery(struct ctdb_req_control *request)
994 request->opcode = CTDB_CONTROL_START_RECOVERY;
995 request->pad = 0;
996 request->srvid = 0;
997 request->client_id = 0;
998 request->flags = 0;
1000 request->rdata.opcode = CTDB_CONTROL_START_RECOVERY;
1003 int ctdb_reply_control_start_recovery(struct ctdb_reply_control *reply)
1005 return ctdb_reply_control_generic(reply, CTDB_CONTROL_START_RECOVERY);
1008 /* CTDB_CONTROL_END_RECOVERY */
1010 void ctdb_req_control_end_recovery(struct ctdb_req_control *request)
1012 request->opcode = CTDB_CONTROL_END_RECOVERY;
1013 request->pad = 0;
1014 request->srvid = 0;
1015 request->client_id = 0;
1016 request->flags = 0;
1018 request->rdata.opcode = CTDB_CONTROL_END_RECOVERY;
1021 int ctdb_reply_control_end_recovery(struct ctdb_reply_control *reply)
1023 return ctdb_reply_control_generic(reply, CTDB_CONTROL_END_RECOVERY);
1026 /* CTDB_CONTROL_RELOAD_NODES_FILE */
1028 void ctdb_req_control_reload_nodes_file(struct ctdb_req_control *request)
1030 request->opcode = CTDB_CONTROL_RELOAD_NODES_FILE;
1031 request->pad = 0;
1032 request->srvid = 0;
1033 request->client_id = 0;
1034 request->flags = 0;
1036 request->rdata.opcode = CTDB_CONTROL_RELOAD_NODES_FILE;
1039 int ctdb_reply_control_reload_nodes_file(struct ctdb_reply_control *reply)
1041 return ctdb_reply_control_generic(reply,
1042 CTDB_CONTROL_RELOAD_NODES_FILE);
1045 /* CTDB_CONTROL_TRY_DELETE_RECORDS */
1047 void ctdb_req_control_try_delete_records(struct ctdb_req_control *request,
1048 struct ctdb_rec_buffer *recbuf)
1050 request->opcode = CTDB_CONTROL_TRY_DELETE_RECORDS;
1051 request->pad = 0;
1052 request->srvid = 0;
1053 request->client_id = 0;
1054 request->flags = 0;
1056 request->rdata.opcode = CTDB_CONTROL_TRY_DELETE_RECORDS;
1057 request->rdata.data.recbuf = recbuf;
1060 int ctdb_reply_control_try_delete_records(struct ctdb_reply_control *reply,
1061 TALLOC_CTX *mem_ctx,
1062 struct ctdb_rec_buffer **recbuf)
1064 if (reply->rdata.opcode != CTDB_CONTROL_TRY_DELETE_RECORDS) {
1065 return EPROTO;
1068 if (reply->status == 0) {
1069 *recbuf = talloc_steal(mem_ctx, reply->rdata.data.recbuf);
1071 return reply->status;
1074 /* CTDB_CONTROL_ADD_PUBLIC_IP */
1076 void ctdb_req_control_add_public_ip(struct ctdb_req_control *request,
1077 struct ctdb_addr_info *addr_info)
1079 request->opcode = CTDB_CONTROL_ADD_PUBLIC_IP;
1080 request->pad = 0;
1081 request->srvid = 0;
1082 request->client_id = 0;
1083 request->flags = 0;
1085 request->rdata.opcode = CTDB_CONTROL_ADD_PUBLIC_IP;
1086 request->rdata.data.addr_info = addr_info;
1089 int ctdb_reply_control_add_public_ip(struct ctdb_reply_control *reply)
1091 return ctdb_reply_control_generic(reply, CTDB_CONTROL_ADD_PUBLIC_IP);
1094 /* CTDB_CONTROL_DEL_PUBLIC_IP */
1096 void ctdb_req_control_del_public_ip(struct ctdb_req_control *request,
1097 struct ctdb_addr_info *addr_info)
1099 request->opcode = CTDB_CONTROL_DEL_PUBLIC_IP;
1100 request->pad = 0;
1101 request->srvid = 0;
1102 request->client_id = 0;
1103 request->flags = 0;
1105 request->rdata.opcode = CTDB_CONTROL_DEL_PUBLIC_IP;
1106 request->rdata.data.addr_info = addr_info;
1109 int ctdb_reply_control_del_public_ip(struct ctdb_reply_control *reply)
1111 return ctdb_reply_control_generic(reply, CTDB_CONTROL_DEL_PUBLIC_IP);
1114 /* CTDB_CONTROL_GET_CAPABILITIES */
1116 void ctdb_req_control_get_capabilities(struct ctdb_req_control *request)
1118 request->opcode = CTDB_CONTROL_GET_CAPABILITIES;
1119 request->pad = 0;
1120 request->srvid = 0;
1121 request->client_id = 0;
1122 request->flags = 0;
1124 request->rdata.opcode = CTDB_CONTROL_GET_CAPABILITIES;
1127 int ctdb_reply_control_get_capabilities(struct ctdb_reply_control *reply,
1128 uint32_t *caps)
1130 if (reply->rdata.opcode != CTDB_CONTROL_GET_CAPABILITIES) {
1131 return EPROTO;
1134 if (reply->status == 0) {
1135 *caps = reply->rdata.data.caps;
1137 return reply->status;
1140 /* CTDB_CONTROL_RECD_PING */
1142 void ctdb_req_control_recd_ping(struct ctdb_req_control *request)
1144 request->opcode = CTDB_CONTROL_RECD_PING;
1145 request->pad = 0;
1146 request->srvid = 0;
1147 request->client_id = 0;
1148 request->flags = 0;
1150 request->rdata.opcode = CTDB_CONTROL_RECD_PING;
1153 int ctdb_reply_control_recd_ping(struct ctdb_reply_control *reply)
1155 return ctdb_reply_control_generic(reply, CTDB_CONTROL_RECD_PING);
1158 /* CTDB_CONTROL_RELEASE_IP */
1160 void ctdb_req_control_release_ip(struct ctdb_req_control *request,
1161 struct ctdb_public_ip *pubip)
1163 request->opcode = CTDB_CONTROL_RELEASE_IP;
1164 request->pad = 0;
1165 request->srvid = 0;
1166 request->client_id = 0;
1167 request->flags = 0;
1169 request->rdata.opcode = CTDB_CONTROL_RELEASE_IP;
1170 request->rdata.data.pubip = pubip;
1173 int ctdb_reply_control_release_ip(struct ctdb_reply_control *reply)
1175 return ctdb_reply_control_generic(reply, CTDB_CONTROL_RELEASE_IP);
1178 /* CTDB_CONTROL_TAKEOVER_IP */
1180 void ctdb_req_control_takeover_ip(struct ctdb_req_control *request,
1181 struct ctdb_public_ip *pubip)
1183 request->opcode = CTDB_CONTROL_TAKEOVER_IP;
1184 request->pad = 0;
1185 request->srvid = 0;
1186 request->client_id = 0;
1187 request->flags = 0;
1189 request->rdata.opcode = CTDB_CONTROL_TAKEOVER_IP;
1190 request->rdata.data.pubip = pubip;
1193 int ctdb_reply_control_takeover_ip(struct ctdb_reply_control *reply)
1195 return ctdb_reply_control_generic(reply, CTDB_CONTROL_TAKEOVER_IP);
1198 /* CTDB_CONTROL_GET_PUBLIC_IPS */
1200 void ctdb_req_control_get_public_ips(struct ctdb_req_control *request,
1201 bool available_only)
1203 request->opcode = CTDB_CONTROL_GET_PUBLIC_IPS;
1204 request->pad = 0;
1205 request->srvid = 0;
1206 request->client_id = 0;
1207 request->flags = 0;
1209 request->rdata.opcode = CTDB_CONTROL_GET_PUBLIC_IPS;
1210 if (available_only) {
1211 request->flags = CTDB_PUBLIC_IP_FLAGS_ONLY_AVAILABLE;
1215 int ctdb_reply_control_get_public_ips(struct ctdb_reply_control *reply,
1216 TALLOC_CTX *mem_ctx,
1217 struct ctdb_public_ip_list **pubip_list)
1219 if (reply->rdata.opcode != CTDB_CONTROL_GET_PUBLIC_IPS) {
1220 return EPROTO;
1223 if (reply->status == 0) {
1224 *pubip_list = talloc_steal(mem_ctx,
1225 reply->rdata.data.pubip_list);
1227 return reply->status;
1230 /* CTDB_CONTROL_GET_NODEMAP */
1232 void ctdb_req_control_get_nodemap(struct ctdb_req_control *request)
1234 request->opcode = CTDB_CONTROL_GET_NODEMAP;
1235 request->pad = 0;
1236 request->srvid = 0;
1237 request->client_id = 0;
1238 request->flags = 0;
1240 request->rdata.opcode = CTDB_CONTROL_GET_NODEMAP;
1243 int ctdb_reply_control_get_nodemap(struct ctdb_reply_control *reply,
1244 TALLOC_CTX *mem_ctx,
1245 struct ctdb_node_map **nodemap)
1247 if (reply->rdata.opcode != CTDB_CONTROL_GET_NODEMAP) {
1248 return EPROTO;
1251 if (reply->status == 0) {
1252 *nodemap = talloc_steal(mem_ctx, reply->rdata.data.nodemap);
1254 return reply->status;
1257 /* CTDB_CONTROL_TRAVERSE_KILL */
1259 void ctdb_req_control_traverse_kill(struct ctdb_req_control *request,
1260 struct ctdb_traverse_start *traverse)
1262 request->opcode = CTDB_CONTROL_TRAVERSE_KILL;
1263 request->pad = 0;
1264 request->srvid = 0;
1265 request->client_id = 0;
1266 request->flags = 0;
1268 request->rdata.opcode = CTDB_CONTROL_TRAVERSE_KILL;
1269 request->rdata.data.traverse_start = traverse;
1272 int ctdb_reply_control_traverse_kill(struct ctdb_reply_control *reply)
1274 return ctdb_reply_control_generic(reply, CTDB_CONTROL_TRAVERSE_KILL);
1277 /* CTDB_CONTROL_RECD_RECLOCK_LATENCY */
1279 void ctdb_req_control_recd_reclock_latency(struct ctdb_req_control *request,
1280 double reclock_latency)
1282 request->opcode = CTDB_CONTROL_RECD_RECLOCK_LATENCY;
1283 request->pad = 0;
1284 request->srvid = 0;
1285 request->client_id = 0;
1286 request->flags = 0;
1288 request->rdata.opcode = CTDB_CONTROL_RECD_RECLOCK_LATENCY;
1289 request->rdata.data.reclock_latency = reclock_latency;
1292 int ctdb_reply_control_recd_reclock_latency(struct ctdb_reply_control *reply)
1294 return ctdb_reply_control_generic(reply,
1295 CTDB_CONTROL_RECD_RECLOCK_LATENCY);
1298 /* CTDB_CONTROL_GET_RECLOCK_FILE */
1300 void ctdb_req_control_get_reclock_file(struct ctdb_req_control *request)
1302 request->opcode = CTDB_CONTROL_GET_RECLOCK_FILE;
1303 request->pad = 0;
1304 request->srvid = 0;
1305 request->client_id = 0;
1306 request->flags = 0;
1308 request->rdata.opcode = CTDB_CONTROL_GET_RECLOCK_FILE;
1311 int ctdb_reply_control_get_reclock_file(struct ctdb_reply_control *reply,
1312 TALLOC_CTX *mem_ctx,
1313 const char **reclock_file)
1315 if (reply->rdata.opcode != CTDB_CONTROL_GET_RECLOCK_FILE) {
1316 return EPROTO;
1319 if (reply->status == 0) {
1320 *reclock_file = talloc_steal(mem_ctx,
1321 reply->rdata.data.reclock_file);
1323 return reply->status;
1326 /* CTDB_CONTROL_STOP_NODE */
1328 void ctdb_req_control_stop_node(struct ctdb_req_control *request)
1330 request->opcode = CTDB_CONTROL_STOP_NODE;
1331 request->pad = 0;
1332 request->srvid = 0;
1333 request->client_id = 0;
1334 request->flags = 0;
1336 request->rdata.opcode = CTDB_CONTROL_STOP_NODE;
1339 int ctdb_reply_control_stop_node(struct ctdb_reply_control *reply)
1341 return ctdb_reply_control_generic(reply, CTDB_CONTROL_STOP_NODE);
1344 /* CTDB_CONTROL_CONTINUE_NODE */
1346 void ctdb_req_control_continue_node(struct ctdb_req_control *request)
1348 request->opcode = CTDB_CONTROL_CONTINUE_NODE;
1349 request->pad = 0;
1350 request->srvid = 0;
1351 request->client_id = 0;
1352 request->flags = 0;
1354 request->rdata.opcode = CTDB_CONTROL_CONTINUE_NODE;
1357 int ctdb_reply_control_continue_node(struct ctdb_reply_control *reply)
1359 return ctdb_reply_control_generic(reply, CTDB_CONTROL_CONTINUE_NODE);
1362 /* CTDB_CONTROL_SET_LMASTERROLE */
1364 void ctdb_req_control_set_lmasterrole(struct ctdb_req_control *request,
1365 uint32_t lmaster_role)
1367 request->opcode = CTDB_CONTROL_SET_LMASTERROLE;
1368 request->pad = 0;
1369 request->srvid = 0;
1370 request->client_id = 0;
1371 request->flags = 0;
1373 request->rdata.opcode = CTDB_CONTROL_SET_LMASTERROLE;
1374 request->rdata.data.role = lmaster_role;
1377 int ctdb_reply_control_set_lmasterrole(struct ctdb_reply_control *reply)
1379 return ctdb_reply_control_generic(reply, CTDB_CONTROL_SET_LMASTERROLE);
1382 /* CTDB_CONTROL_SET_RECMASTERROLE */
1384 void ctdb_req_control_set_recmasterrole(struct ctdb_req_control *request,
1385 uint32_t recmaster_role)
1387 request->opcode = CTDB_CONTROL_SET_RECMASTERROLE;
1388 request->pad = 0;
1389 request->srvid = 0;
1390 request->client_id = 0;
1391 request->flags = 0;
1393 request->rdata.opcode = CTDB_CONTROL_SET_RECMASTERROLE;
1394 request->rdata.data.role = recmaster_role;
1397 int ctdb_reply_control_set_recmasterrole(struct ctdb_reply_control *reply)
1399 return ctdb_reply_control_generic(reply,
1400 CTDB_CONTROL_SET_RECMASTERROLE);
1403 /* CTDB_CONTROL_SET_BAN_STATE */
1405 void ctdb_req_control_set_ban_state(struct ctdb_req_control *request,
1406 struct ctdb_ban_state *ban_state)
1408 request->opcode = CTDB_CONTROL_SET_BAN_STATE;
1409 request->pad = 0;
1410 request->srvid = 0;
1411 request->client_id = 0;
1412 request->flags = 0;
1414 request->rdata.opcode = CTDB_CONTROL_SET_BAN_STATE;
1415 request->rdata.data.ban_state = ban_state;
1418 int ctdb_reply_control_set_ban_state(struct ctdb_reply_control *reply)
1420 return ctdb_reply_control_generic(reply, CTDB_CONTROL_SET_BAN_STATE);
1423 /* CTDB_CONTROL_GET_BAN_STATE */
1425 void ctdb_req_control_get_ban_state(struct ctdb_req_control *request)
1427 request->opcode = CTDB_CONTROL_GET_BAN_STATE;
1428 request->pad = 0;
1429 request->srvid = 0;
1430 request->client_id = 0;
1431 request->flags = 0;
1433 request->rdata.opcode = CTDB_CONTROL_GET_BAN_STATE;
1436 int ctdb_reply_control_get_ban_state(struct ctdb_reply_control *reply,
1437 TALLOC_CTX *mem_ctx,
1438 struct ctdb_ban_state **ban_state)
1440 if (reply->rdata.opcode != CTDB_CONTROL_GET_BAN_STATE) {
1441 return EPROTO;
1444 if (reply->status == 0) {
1445 *ban_state = talloc_steal(mem_ctx,
1446 reply->rdata.data.ban_state);
1448 return reply->status;
1451 /* CTDB_CONTROL_REGISTER_NOTIFY */
1453 void ctdb_req_control_register_notify(struct ctdb_req_control *request,
1454 struct ctdb_notify_data *notify)
1456 request->opcode = CTDB_CONTROL_REGISTER_NOTIFY;
1457 request->pad = 0;
1458 request->srvid = 0;
1459 request->client_id = 0;
1460 request->flags = 0;
1462 request->rdata.opcode = CTDB_CONTROL_REGISTER_NOTIFY;
1463 request->rdata.data.notify = notify;
1466 int ctdb_reply_control_register_notify(struct ctdb_reply_control *reply)
1468 return ctdb_reply_control_generic(reply, CTDB_CONTROL_REGISTER_NOTIFY);
1471 /* CTDB_CONTROL_DEREGISTER_NOTIFY */
1473 void ctdb_req_control_deregister_notify(struct ctdb_req_control *request,
1474 uint64_t srvid)
1476 request->opcode = CTDB_CONTROL_DEREGISTER_NOTIFY;
1477 request->pad = 0;
1478 request->srvid = 0;
1479 request->client_id = 0;
1480 request->flags = 0;
1482 request->rdata.opcode = CTDB_CONTROL_DEREGISTER_NOTIFY;
1483 request->rdata.data.srvid = srvid;
1486 int ctdb_reply_control_deregister_notify(struct ctdb_reply_control *reply)
1488 return ctdb_reply_control_generic(reply,
1489 CTDB_CONTROL_DEREGISTER_NOTIFY);
1492 /* CTDB_CONTROL_TRANS3_COMMIT */
1494 void ctdb_req_control_trans3_commit(struct ctdb_req_control *request,
1495 struct ctdb_rec_buffer *recbuf)
1497 request->opcode = CTDB_CONTROL_TRANS3_COMMIT;
1498 request->pad = 0;
1499 request->srvid = 0;
1500 request->client_id = 0;
1501 request->flags = 0;
1503 request->rdata.opcode = CTDB_CONTROL_TRANS3_COMMIT;
1504 request->rdata.data.recbuf = recbuf;
1507 int ctdb_reply_control_trans3_commit(struct ctdb_reply_control *reply)
1509 return ctdb_reply_control_generic(reply, CTDB_CONTROL_TRANS3_COMMIT);
1512 /* CTDB_CONTROL_GET_DB_SEQNUM */
1514 void ctdb_req_control_get_db_seqnum(struct ctdb_req_control *request,
1515 uint32_t db_id)
1517 request->opcode = CTDB_CONTROL_GET_DB_SEQNUM;
1518 request->pad = 0;
1519 request->srvid = 0;
1520 request->client_id = 0;
1521 request->flags = 0;
1523 request->rdata.opcode = CTDB_CONTROL_GET_DB_SEQNUM;
1524 request->rdata.data.db_id = db_id;
1527 int ctdb_reply_control_get_db_seqnum(struct ctdb_reply_control *reply,
1528 uint64_t *seqnum)
1530 if (reply->rdata.opcode != CTDB_CONTROL_GET_DB_SEQNUM) {
1531 return EPROTO;
1534 if (reply->status == 0) {
1535 *seqnum = reply->rdata.data.seqnum;
1537 return reply->status;
1540 /* CTDB_CONTROL_DB_SET_HEALTHY */
1542 void ctdb_req_control_db_set_healthy(struct ctdb_req_control *request,
1543 uint32_t db_id)
1545 request->opcode = CTDB_CONTROL_DB_SET_HEALTHY;
1546 request->pad = 0;
1547 request->srvid = 0;
1548 request->client_id = 0;
1549 request->flags = 0;
1551 request->rdata.opcode = CTDB_CONTROL_DB_SET_HEALTHY;
1552 request->rdata.data.db_id = db_id;
1555 int ctdb_reply_control_db_set_healthy(struct ctdb_reply_control *reply)
1557 return ctdb_reply_control_generic(reply, CTDB_CONTROL_DB_SET_HEALTHY);
1560 /* CTDB_CONTROL_DB_GET_HEALTH */
1562 void ctdb_req_control_db_get_health(struct ctdb_req_control *request,
1563 uint32_t db_id)
1565 request->opcode = CTDB_CONTROL_DB_GET_HEALTH;
1566 request->pad = 0;
1567 request->srvid = 0;
1568 request->client_id = 0;
1569 request->flags = 0;
1571 request->rdata.opcode = CTDB_CONTROL_DB_GET_HEALTH;
1572 request->rdata.data.db_id = db_id;
1575 int ctdb_reply_control_db_get_health(struct ctdb_reply_control *reply,
1576 TALLOC_CTX *mem_ctx, const char **reason)
1578 if (reply->rdata.opcode != CTDB_CONTROL_DB_GET_HEALTH) {
1579 return EPROTO;
1582 if (reply->status == 0) {
1583 *reason = talloc_steal(mem_ctx, reply->rdata.data.reason);
1585 return reply->status;
1588 /* CTDB_CONTROL_GET_PUBLIC_IP_INFO */
1590 void ctdb_req_control_get_public_ip_info(struct ctdb_req_control *request,
1591 ctdb_sock_addr *addr)
1593 request->opcode = CTDB_CONTROL_GET_PUBLIC_IP_INFO;
1594 request->pad = 0;
1595 request->srvid = 0;
1596 request->client_id = 0;
1597 request->flags = 0;
1599 request->rdata.opcode = CTDB_CONTROL_GET_PUBLIC_IP_INFO;
1600 request->rdata.data.addr = addr;
1603 int ctdb_reply_control_get_public_ip_info(struct ctdb_reply_control *reply,
1604 TALLOC_CTX *mem_ctx,
1605 struct ctdb_public_ip_info **ipinfo)
1607 if (reply->rdata.opcode != CTDB_CONTROL_GET_PUBLIC_IP_INFO) {
1608 return EPROTO;
1611 if (reply->status == 0) {
1612 *ipinfo = talloc_steal(mem_ctx, reply->rdata.data.ipinfo);
1614 return reply->status;
1617 /* CTDB_CONTROL_GET_IFACES */
1619 void ctdb_req_control_get_ifaces(struct ctdb_req_control *request)
1621 request->opcode = CTDB_CONTROL_GET_IFACES;
1622 request->pad = 0;
1623 request->srvid = 0;
1624 request->client_id = 0;
1625 request->flags = 0;
1627 request->rdata.opcode = CTDB_CONTROL_GET_IFACES;
1630 int ctdb_reply_control_get_ifaces(struct ctdb_reply_control *reply,
1631 TALLOC_CTX *mem_ctx,
1632 struct ctdb_iface_list **iface_list)
1634 if (reply->rdata.opcode != CTDB_CONTROL_GET_IFACES) {
1635 return EPROTO;
1638 if (reply->status == 0) {
1639 *iface_list = talloc_steal(mem_ctx,
1640 reply->rdata.data.iface_list);
1642 return reply->status;
1645 /* CTDB_CONTROL_SET_IFACE_LINK_STATE */
1647 void ctdb_req_control_set_iface_link_state(struct ctdb_req_control *request,
1648 struct ctdb_iface *iface)
1650 request->opcode = CTDB_CONTROL_SET_IFACE_LINK_STATE;
1651 request->pad = 0;
1652 request->srvid = 0;
1653 request->client_id = 0;
1654 request->flags = 0;
1656 request->rdata.opcode = CTDB_CONTROL_SET_IFACE_LINK_STATE;
1657 request->rdata.data.iface = iface;
1660 int ctdb_reply_control_set_iface_link_state(struct ctdb_reply_control *reply)
1662 return ctdb_reply_control_generic(reply,
1663 CTDB_CONTROL_SET_IFACE_LINK_STATE);
1666 /* CTDB_CONTROL_TCP_ADD_DELAYED_UPDATE */
1668 void ctdb_req_control_tcp_add_delayed_update(struct ctdb_req_control *request,
1669 struct ctdb_connection *conn)
1671 request->opcode = CTDB_CONTROL_TCP_ADD_DELAYED_UPDATE;
1672 request->pad = 0;
1673 request->srvid = 0;
1674 request->client_id = 0;
1675 request->flags = 0;
1677 request->rdata.opcode = CTDB_CONTROL_TCP_ADD_DELAYED_UPDATE;
1678 request->rdata.data.conn = conn;
1681 int ctdb_reply_control_tcp_add_delayed_update(struct ctdb_reply_control *reply)
1683 return ctdb_reply_control_generic(reply,
1684 CTDB_CONTROL_TCP_ADD_DELAYED_UPDATE);
1687 /* CTDB_CONTROL_GET_STAT_HISTORY */
1689 void ctdb_req_control_get_stat_history(struct ctdb_req_control *request)
1691 request->opcode = CTDB_CONTROL_GET_STAT_HISTORY;
1692 request->pad = 0;
1693 request->srvid = 0;
1694 request->client_id = 0;
1695 request->flags = 0;
1697 request->rdata.opcode = CTDB_CONTROL_GET_STAT_HISTORY;
1700 int ctdb_reply_control_get_stat_history(struct ctdb_reply_control *reply,
1701 TALLOC_CTX *mem_ctx,
1702 struct ctdb_statistics_list **stats_list)
1704 if (reply->rdata.opcode != CTDB_CONTROL_GET_STAT_HISTORY) {
1705 return EPROTO;
1708 if (reply->status == 0) {
1709 *stats_list = talloc_steal(mem_ctx,
1710 reply->rdata.data.stats_list);
1712 return reply->status;
1715 /* CTDB_CONTROL_SCHEDULE_FOR_DELETION */
1717 void ctdb_req_control_schedule_for_deletion(struct ctdb_req_control *request,
1718 struct ctdb_key_data *key)
1720 request->opcode = CTDB_CONTROL_SCHEDULE_FOR_DELETION;
1721 request->pad = 0;
1722 request->srvid = 0;
1723 request->client_id = 0;
1724 request->flags = 0;
1726 request->rdata.opcode = CTDB_CONTROL_SCHEDULE_FOR_DELETION;
1727 request->rdata.data.key = key;
1730 int ctdb_reply_control_schedule_for_deletion(struct ctdb_reply_control *reply)
1732 return ctdb_reply_control_generic(reply,
1733 CTDB_CONTROL_SCHEDULE_FOR_DELETION);
1736 /* CTDB_CONTROL_SET_DB_READONLY */
1738 void ctdb_req_control_set_db_readonly(struct ctdb_req_control *request,
1739 uint32_t db_id)
1741 request->opcode = CTDB_CONTROL_SET_DB_READONLY;
1742 request->pad = 0;
1743 request->srvid = 0;
1744 request->client_id = 0;
1745 request->flags = 0;
1747 request->rdata.opcode = CTDB_CONTROL_SET_DB_READONLY;
1748 request->rdata.data.db_id = db_id;
1751 int ctdb_reply_control_set_db_readonly(struct ctdb_reply_control *reply)
1753 return ctdb_reply_control_generic(reply, CTDB_CONTROL_SET_DB_READONLY);
1756 /* CTDB_CONTROL_TRAVERSE_START_EXT */
1758 void ctdb_req_control_traverse_start_ext(struct ctdb_req_control *request,
1759 struct ctdb_traverse_start_ext *traverse)
1761 request->opcode = CTDB_CONTROL_TRAVERSE_START_EXT;
1762 request->pad = 0;
1763 request->srvid = 0;
1764 request->client_id = 0;
1765 request->flags = 0;
1767 request->rdata.opcode = CTDB_CONTROL_TRAVERSE_START_EXT;
1768 request->rdata.data.traverse_start_ext = traverse;
1771 int ctdb_reply_control_traverse_start_ext(struct ctdb_reply_control *reply)
1773 return ctdb_reply_control_generic(reply,
1774 CTDB_CONTROL_TRAVERSE_START_EXT);
1777 /* CTDB_CONTROL_GET_DB_STATISTICS */
1779 void ctdb_req_control_get_db_statistics(struct ctdb_req_control *request,
1780 uint32_t db_id)
1782 request->opcode = CTDB_CONTROL_GET_DB_STATISTICS;
1783 request->pad = 0;
1784 request->srvid = 0;
1785 request->client_id = 0;
1786 request->flags = 0;
1788 request->rdata.opcode = CTDB_CONTROL_GET_DB_STATISTICS;
1789 request->rdata.data.db_id = db_id;
1792 int ctdb_reply_control_get_db_statistics(struct ctdb_reply_control *reply,
1793 TALLOC_CTX *mem_ctx,
1794 struct ctdb_db_statistics **dbstats)
1796 if (reply->rdata.opcode != CTDB_CONTROL_GET_DB_STATISTICS) {
1797 return EPROTO;
1800 if (reply->status == 0) {
1801 *dbstats = talloc_steal(mem_ctx, reply->rdata.data.dbstats);
1803 return reply->status;
1806 /* CTDB_CONTROL_SET_DB_STICKY */
1808 void ctdb_req_control_set_db_sticky(struct ctdb_req_control *request,
1809 uint32_t db_id)
1811 request->opcode = CTDB_CONTROL_SET_DB_STICKY;
1812 request->pad = 0;
1813 request->srvid = 0;
1814 request->client_id = 0;
1815 request->flags = 0;
1817 request->rdata.opcode = CTDB_CONTROL_SET_DB_STICKY;
1818 request->rdata.data.db_id = db_id;
1821 int ctdb_reply_control_set_db_sticky(struct ctdb_reply_control *reply)
1823 return ctdb_reply_control_generic(reply, CTDB_CONTROL_SET_DB_STICKY);
1826 /* CTDB_CONTROL_RELOAD_PUBLIC_IPS */
1828 void ctdb_req_control_reload_public_ips(struct ctdb_req_control *request)
1830 request->opcode = CTDB_CONTROL_RELOAD_PUBLIC_IPS;
1831 request->pad = 0;
1832 request->srvid = 0;
1833 request->client_id = 0;
1834 request->flags = 0;
1836 request->rdata.opcode = CTDB_CONTROL_RELOAD_PUBLIC_IPS;
1839 int ctdb_reply_control_reload_public_ips(struct ctdb_reply_control *reply)
1841 return ctdb_reply_control_generic(reply,
1842 CTDB_CONTROL_RELOAD_PUBLIC_IPS);
1845 /* CTDB_CONTROL_TRAVERSE_ALL_EXT */
1847 /* CTDB_CONTROL_IPREALLOCATED */
1849 void ctdb_req_control_ipreallocated(struct ctdb_req_control *request)
1851 request->opcode = CTDB_CONTROL_IPREALLOCATED;
1852 request->pad = 0;
1853 request->srvid = 0;
1854 request->client_id = 0;
1855 request->flags = 0;
1857 request->rdata.opcode = CTDB_CONTROL_IPREALLOCATED;
1860 int ctdb_reply_control_ipreallocated(struct ctdb_reply_control *reply)
1862 return ctdb_reply_control_generic(reply, CTDB_CONTROL_IPREALLOCATED);
1865 /* CTDB_CONTROL_GET_RUNSTATE */
1867 void ctdb_req_control_get_runstate(struct ctdb_req_control *request)
1869 request->opcode = CTDB_CONTROL_GET_RUNSTATE;
1870 request->pad = 0;
1871 request->srvid = 0;
1872 request->client_id = 0;
1873 request->flags = 0;
1875 request->rdata.opcode = CTDB_CONTROL_GET_RUNSTATE;
1878 int ctdb_reply_control_get_runstate(struct ctdb_reply_control *reply,
1879 enum ctdb_runstate *runstate)
1881 if (reply->rdata.opcode != CTDB_CONTROL_GET_RUNSTATE) {
1882 return EPROTO;
1885 if (reply->status == 0) {
1886 *runstate = reply->rdata.data.runstate;
1888 return reply->status;
1891 /* CTDB_CONTROL_DB_DETACH */
1893 void ctdb_req_control_db_detach(struct ctdb_req_control *request,
1894 uint32_t db_id)
1896 request->opcode = CTDB_CONTROL_DB_DETACH;
1897 request->pad = 0;
1898 request->srvid = 0;
1899 request->client_id = 0;
1900 request->flags = 0;
1902 request->rdata.opcode = CTDB_CONTROL_DB_DETACH;
1903 request->rdata.data.db_id = db_id;
1906 int ctdb_reply_control_db_detach(struct ctdb_reply_control *reply)
1908 return ctdb_reply_control_generic(reply, CTDB_CONTROL_DB_DETACH);
1911 /* CTDB_CONTROL_GET_NODES_FILE */
1913 void ctdb_req_control_get_nodes_file(struct ctdb_req_control *request)
1915 request->opcode = CTDB_CONTROL_GET_NODES_FILE;
1916 request->pad = 0;
1917 request->srvid = 0;
1918 request->client_id = 0;
1919 request->flags = 0;
1921 request->rdata.opcode = CTDB_CONTROL_GET_NODES_FILE;
1924 int ctdb_reply_control_get_nodes_file(struct ctdb_reply_control *reply,
1925 TALLOC_CTX *mem_ctx,
1926 struct ctdb_node_map **nodemap)
1928 if (reply->rdata.opcode != CTDB_CONTROL_GET_NODES_FILE) {
1929 return EPROTO;
1932 if (reply->status == 0) {
1933 *nodemap = talloc_steal(mem_ctx, reply->rdata.data.nodemap);
1935 return reply->status;
1938 /* CTDB_CONTROL_DB_FREEZE */
1940 void ctdb_req_control_db_freeze(struct ctdb_req_control *request,
1941 uint32_t db_id)
1943 request->opcode = CTDB_CONTROL_DB_FREEZE;
1944 request->pad = 0;
1945 request->srvid = 0;
1946 request->client_id = 0;
1947 request->flags = 0;
1949 request->rdata.opcode = CTDB_CONTROL_DB_FREEZE;
1950 request->rdata.data.db_id = db_id;
1953 int ctdb_reply_control_db_freeze(struct ctdb_reply_control *reply)
1955 return ctdb_reply_control_generic(reply, CTDB_CONTROL_DB_FREEZE);
1958 /* CTDB_CONTROL_DB_THAW */
1960 void ctdb_req_control_db_thaw(struct ctdb_req_control *request,
1961 uint32_t db_id)
1963 request->opcode = CTDB_CONTROL_DB_THAW;
1964 request->pad = 0;
1965 request->srvid = 0;
1966 request->client_id = 0;
1967 request->flags = 0;
1969 request->rdata.opcode = CTDB_CONTROL_DB_THAW;
1970 request->rdata.data.db_id = db_id;
1973 int ctdb_reply_control_db_thaw(struct ctdb_reply_control *reply)
1975 return ctdb_reply_control_generic(reply, CTDB_CONTROL_DB_THAW);
1978 /* CTDB_CONTROL_DB_TRANSACTION_START */
1980 void ctdb_req_control_db_transaction_start(struct ctdb_req_control *request,
1981 struct ctdb_transdb *transdb)
1983 request->opcode = CTDB_CONTROL_DB_TRANSACTION_START;
1984 request->pad = 0;
1985 request->srvid = 0;
1986 request->client_id = 0;
1987 request->flags = 0;
1989 request->rdata.opcode = CTDB_CONTROL_DB_TRANSACTION_START;
1990 request->rdata.data.transdb = transdb;
1993 int ctdb_reply_control_db_transaction_start(struct ctdb_reply_control *reply)
1995 return ctdb_reply_control_generic(reply,
1996 CTDB_CONTROL_DB_TRANSACTION_START);
1999 /* CTDB_CONTROL_DB_TRANSACTION_COMMIT */
2001 void ctdb_req_control_db_transaction_commit(struct ctdb_req_control *request,
2002 struct ctdb_transdb *transdb)
2004 request->opcode = CTDB_CONTROL_DB_TRANSACTION_COMMIT;
2005 request->pad = 0;
2006 request->srvid = 0;
2007 request->client_id = 0;
2008 request->flags = 0;
2010 request->rdata.opcode = CTDB_CONTROL_DB_TRANSACTION_COMMIT;
2011 request->rdata.data.transdb = transdb;
2014 int ctdb_reply_control_db_transaction_commit(struct ctdb_reply_control *reply)
2016 return ctdb_reply_control_generic(reply,
2017 CTDB_CONTROL_DB_TRANSACTION_COMMIT);
2020 /* CTDB_CONTROL_DB_TRANSACTION_CANCEL */
2022 void ctdb_req_control_db_transaction_cancel(struct ctdb_req_control *request,
2023 uint32_t db_id)
2025 request->opcode = CTDB_CONTROL_DB_TRANSACTION_CANCEL;
2026 request->pad = 0;
2027 request->srvid = 0;
2028 request->client_id = 0;
2029 request->flags = 0;
2031 request->rdata.opcode = CTDB_CONTROL_DB_TRANSACTION_CANCEL;
2032 request->rdata.data.db_id = db_id;
2035 int ctdb_reply_control_db_transaction_cancel(struct ctdb_reply_control *reply)
2037 return ctdb_reply_control_generic(reply,
2038 CTDB_CONTROL_DB_TRANSACTION_CANCEL);
2041 /* CTDB_CONTROL_DB_PULL */
2043 void ctdb_req_control_db_pull(struct ctdb_req_control *request,
2044 struct ctdb_pulldb_ext *pulldb_ext)
2046 request->opcode = CTDB_CONTROL_DB_PULL;
2047 request->pad = 0;
2048 request->srvid = 0;
2049 request->client_id = 0;
2050 request->flags = 0;
2052 request->rdata.opcode = CTDB_CONTROL_DB_PULL;
2053 request->rdata.data.pulldb_ext = pulldb_ext;
2056 int ctdb_reply_control_db_pull(struct ctdb_reply_control *reply,
2057 uint32_t *num_records)
2059 if (reply->rdata.opcode != CTDB_CONTROL_DB_PULL) {
2060 return EPROTO;
2063 if (reply->status == 0) {
2064 *num_records = reply->rdata.data.num_records;
2066 return reply->status;
2069 /* CTDB_CONTROL_DB_PUSH_START */
2071 void ctdb_req_control_db_push_start(struct ctdb_req_control *request,
2072 struct ctdb_pulldb_ext *pulldb_ext)
2074 request->opcode = CTDB_CONTROL_DB_PUSH_START;
2075 request->pad = 0;
2076 request->srvid = 0;
2077 request->client_id = 0;
2078 request->flags = 0;
2080 request->rdata.opcode = CTDB_CONTROL_DB_PUSH_START;
2081 request->rdata.data.pulldb_ext = pulldb_ext;
2084 int ctdb_reply_control_db_push_start(struct ctdb_reply_control *reply)
2086 return ctdb_reply_control_generic(reply, CTDB_CONTROL_DB_PUSH_START);
2089 /* CTDB_CONTROL_DB_PUSH_CONFIRM */
2091 void ctdb_req_control_db_push_confirm(struct ctdb_req_control *request,
2092 uint32_t db_id)
2094 request->opcode = CTDB_CONTROL_DB_PUSH_CONFIRM;
2095 request->pad = 0;
2096 request->srvid = 0;
2097 request->client_id = 0;
2098 request->flags = 0;
2100 request->rdata.opcode = CTDB_CONTROL_DB_PUSH_CONFIRM;
2101 request->rdata.data.db_id = db_id;
2104 int ctdb_reply_control_db_push_confirm(struct ctdb_reply_control *reply,
2105 uint32_t *num_records)
2107 if (reply->rdata.opcode != CTDB_CONTROL_DB_PUSH_CONFIRM) {
2108 return EPROTO;
2111 if (reply->status == 0) {
2112 *num_records = reply->rdata.data.num_records;
2114 return reply->status;
2117 /* CTDB_CONTROL_DB_OPEN_FLAGS */
2119 void ctdb_req_control_db_open_flags(struct ctdb_req_control *request,
2120 uint32_t db_id)
2122 request->opcode = CTDB_CONTROL_DB_OPEN_FLAGS;
2123 request->pad = 0;
2124 request->srvid = 0;
2125 request->client_id = 0;
2126 request->flags = 0;
2128 request->rdata.opcode = CTDB_CONTROL_DB_OPEN_FLAGS;
2129 request->rdata.data.db_id = db_id;
2132 int ctdb_reply_control_db_open_flags(struct ctdb_reply_control *reply,
2133 int *tdb_flags)
2135 if (reply->rdata.opcode != CTDB_CONTROL_DB_OPEN_FLAGS) {
2136 return EPROTO;
2139 if (reply->status == 0) {
2140 *tdb_flags = reply->rdata.data.tdb_flags;
2142 return reply->status;
2145 /* CTDB_CONTROL_DB_ATTACH_REPLICATED */
2147 void ctdb_req_control_db_attach_replicated(struct ctdb_req_control *request,
2148 const char *db_name)
2150 request->opcode = CTDB_CONTROL_DB_ATTACH_REPLICATED;
2151 request->pad = 0;
2152 request->srvid = 0;
2153 request->client_id = 0;
2154 request->flags = 0;
2156 request->rdata.opcode = CTDB_CONTROL_DB_ATTACH_REPLICATED;
2157 request->rdata.data.db_name = db_name;
2160 int ctdb_reply_control_db_attach_replicated(struct ctdb_reply_control *reply,
2161 uint32_t *db_id)
2163 if (reply->rdata.opcode != CTDB_CONTROL_DB_ATTACH_REPLICATED) {
2164 return EPROTO;
2166 if (reply->status == 0) {
2167 *db_id = reply->rdata.data.db_id;
2169 return reply->status;
2172 /* CTDB_CONTROL_CHECK_PID_SRVID */
2174 void ctdb_req_control_check_pid_srvid(struct ctdb_req_control *request,
2175 struct ctdb_pid_srvid *pid_srvid)
2177 request->opcode = CTDB_CONTROL_CHECK_PID_SRVID;
2178 request->pad = 0;
2179 request->srvid = 0;
2180 request->client_id = 0;
2181 request->flags = 0;
2183 request->rdata.opcode = CTDB_CONTROL_CHECK_PID_SRVID;
2184 request->rdata.data.pid_srvid = pid_srvid;
2187 int ctdb_reply_control_check_pid_srvid(struct ctdb_reply_control *reply,
2188 int *status)
2190 if (reply->rdata.opcode != CTDB_CONTROL_CHECK_PID_SRVID) {
2191 return EPROTO;
2194 *status = reply->status;
2195 reply->status = 0;
2197 return reply->status;
2200 /* CTDB_CONTROL_TUNNEL_REGISTER */
2202 void ctdb_req_control_tunnel_register(struct ctdb_req_control *request,
2203 uint64_t tunnel_id)
2205 request->opcode = CTDB_CONTROL_TUNNEL_REGISTER;
2206 request->pad = 0;
2207 request->srvid = tunnel_id;
2208 request->client_id = 0;
2209 request->flags = 0;
2211 request->rdata.opcode = CTDB_CONTROL_TUNNEL_REGISTER;
2214 int ctdb_reply_control_tunnel_register(struct ctdb_reply_control *reply)
2216 if (reply->rdata.opcode != CTDB_CONTROL_TUNNEL_REGISTER) {
2217 return EPROTO;
2220 return reply->status;
2223 /* CTDB_CONTROL_TUNNEL_DEREGISTER */
2225 void ctdb_req_control_tunnel_deregister(struct ctdb_req_control *request,
2226 uint64_t tunnel_id)
2228 request->opcode = CTDB_CONTROL_TUNNEL_DEREGISTER;
2229 request->pad = 0;
2230 request->srvid = tunnel_id;
2231 request->client_id = 0;
2232 request->flags = 0;
2234 request->rdata.opcode = CTDB_CONTROL_TUNNEL_DEREGISTER;
2237 int ctdb_reply_control_tunnel_deregister(struct ctdb_reply_control *reply)
2239 if (reply->rdata.opcode != CTDB_CONTROL_TUNNEL_DEREGISTER) {
2240 return EPROTO;
2243 return reply->status;
2246 /* CTDB_CONTROL_VACUUM_FETCH */
2248 void ctdb_req_control_vacuum_fetch(struct ctdb_req_control *request,
2249 struct ctdb_rec_buffer *recbuf)
2251 request->opcode = CTDB_CONTROL_VACUUM_FETCH;
2252 request->pad = 0;
2253 request->srvid = 0;
2254 request->client_id = 0;
2255 request->flags = 0;
2257 request->rdata.opcode = CTDB_CONTROL_VACUUM_FETCH;
2258 request->rdata.data.recbuf = recbuf;
2261 int ctdb_reply_control_vacuum_fetch(struct ctdb_reply_control *reply)
2263 if (reply->rdata.opcode != CTDB_CONTROL_VACUUM_FETCH) {
2264 return EPROTO;
2267 return reply->status;
2270 /* CTDB_CONTROL_DB_VACUUM */
2272 void ctdb_req_control_db_vacuum(struct ctdb_req_control *request,
2273 struct ctdb_db_vacuum *db_vacuum)
2275 request->opcode = CTDB_CONTROL_DB_VACUUM;
2276 request->pad = 0;
2277 request->srvid = 0;
2278 request->client_id = 0;
2279 request->flags = 0;
2281 request->rdata.opcode = CTDB_CONTROL_DB_VACUUM;
2282 request->rdata.data.db_vacuum = db_vacuum;
2285 int ctdb_reply_control_db_vacuum(struct ctdb_reply_control *reply)
2287 if (reply->rdata.opcode != CTDB_CONTROL_DB_VACUUM) {
2288 return EPROTO;
2291 return reply->status;
2294 /* CTDB_CONTROL_ECHO_DATA */
2296 void ctdb_req_control_echo_data(struct ctdb_req_control *request,
2297 struct ctdb_echo_data *echo_data)
2299 request->opcode = CTDB_CONTROL_ECHO_DATA;
2300 request->pad = 0;
2301 request->srvid = 0;
2302 request->client_id = 0;
2303 request->flags = 0;
2305 request->rdata.opcode = CTDB_CONTROL_ECHO_DATA;
2306 request->rdata.data.echo_data = echo_data;
2309 int ctdb_reply_control_echo_data(struct ctdb_reply_control *reply)
2311 if (reply->rdata.opcode != CTDB_CONTROL_ECHO_DATA) {
2312 return EPROTO;
2315 return reply->status;
2318 /* CTDB_CONTROL_DISABLE_NODE */
2320 void ctdb_req_control_disable_node(struct ctdb_req_control *request)
2322 request->opcode = CTDB_CONTROL_DISABLE_NODE;
2323 request->pad = 0;
2324 request->srvid = 0;
2325 request->client_id = 0;
2326 request->flags = 0;
2328 request->rdata.opcode = CTDB_CONTROL_DISABLE_NODE;
2331 int ctdb_reply_control_disable_node(struct ctdb_reply_control *reply)
2333 return ctdb_reply_control_generic(reply, CTDB_CONTROL_DISABLE_NODE);
2336 /* CTDB_CONTROL_ENABLE_NODE */
2338 void ctdb_req_control_enable_node(struct ctdb_req_control *request)
2340 request->opcode = CTDB_CONTROL_ENABLE_NODE;
2341 request->pad = 0;
2342 request->srvid = 0;
2343 request->client_id = 0;
2344 request->flags = 0;
2346 request->rdata.opcode = CTDB_CONTROL_ENABLE_NODE;
2349 int ctdb_reply_control_enable_node(struct ctdb_reply_control *reply)
2351 return ctdb_reply_control_generic(reply, CTDB_CONTROL_ENABLE_NODE);
2354 /* CTDB_CONTROL_START_IPREALLOCATE */
2356 void ctdb_req_control_start_ipreallocate(struct ctdb_req_control *request)
2358 request->opcode = CTDB_CONTROL_START_IPREALLOCATE;
2359 request->pad = 0;
2360 request->srvid = 0;
2361 request->client_id = 0;
2362 request->flags = 0;
2364 request->rdata.opcode = CTDB_CONTROL_START_IPREALLOCATE;
2367 int ctdb_reply_control_start_ipreallocate(struct ctdb_reply_control *reply)
2369 return ctdb_reply_control_generic(reply,
2370 CTDB_CONTROL_START_IPREALLOCATE);