samba-tool: Ensure that samba-tool processes --name=not-existing does not error
[Samba.git] / ctdb / protocol / protocol_client.c
blobfe65a8a02c0526d909d8ee99b6f7ce45587d2e85
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_PULL_DB */
286 void ctdb_req_control_pull_db(struct ctdb_req_control *request,
287 struct ctdb_pulldb *pulldb)
289 request->opcode = CTDB_CONTROL_PULL_DB;
290 request->pad = 0;
291 request->srvid = 0;
292 request->client_id = 0;
293 request->flags = 0;
295 request->rdata.opcode = CTDB_CONTROL_PULL_DB;
296 request->rdata.data.pulldb = pulldb;
299 int ctdb_reply_control_pull_db(struct ctdb_reply_control *reply,
300 TALLOC_CTX *mem_ctx,
301 struct ctdb_rec_buffer **recbuf)
303 if (reply->rdata.opcode != CTDB_CONTROL_PULL_DB) {
304 return EPROTO;
307 if (reply->status == 0) {
308 *recbuf = talloc_steal(mem_ctx, reply->rdata.data.recbuf);
310 return reply->status;
313 /* CTDB_CONTROL_PUSH_DB */
315 void ctdb_req_control_push_db(struct ctdb_req_control *request,
316 struct ctdb_rec_buffer *recbuf)
318 request->opcode = CTDB_CONTROL_PUSH_DB;
319 request->pad = 0;
320 request->srvid = 0;
321 request->client_id = 0;
322 request->flags = 0;
324 request->rdata.opcode = CTDB_CONTROL_PUSH_DB;
325 request->rdata.data.recbuf = recbuf;
328 int ctdb_reply_control_push_db(struct ctdb_reply_control *reply)
330 return ctdb_reply_control_generic(reply, CTDB_CONTROL_PUSH_DB);
333 /* CTDB_CONTROL_GET_RECMODE */
335 void ctdb_req_control_get_recmode(struct ctdb_req_control *request)
337 request->opcode = CTDB_CONTROL_GET_RECMODE;
338 request->pad = 0;
339 request->srvid = 0;
340 request->client_id = 0;
341 request->flags = 0;
343 request->rdata.opcode = CTDB_CONTROL_GET_RECMODE;
346 int ctdb_reply_control_get_recmode(struct ctdb_reply_control *reply,
347 int *recmode)
349 if (reply->rdata.opcode != CTDB_CONTROL_GET_RECMODE) {
350 return EPROTO;
353 if (reply->status >= 0) {
354 *recmode = reply->status;
355 reply->status = 0;
357 return reply->status;
360 /* CTDB_CONTROL_SET_RECMODE */
362 void ctdb_req_control_set_recmode(struct ctdb_req_control *request,
363 int recmode)
365 request->opcode = CTDB_CONTROL_SET_RECMODE;
366 request->pad = 0;
367 request->srvid = 0;
368 request->client_id = 0;
369 request->flags = 0;
371 request->rdata.opcode = CTDB_CONTROL_SET_RECMODE;
372 request->rdata.data.recmode = recmode;
375 int ctdb_reply_control_set_recmode(struct ctdb_reply_control *reply)
377 return ctdb_reply_control_generic(reply, CTDB_CONTROL_SET_RECMODE);
380 /* CTDB_CONTROL_STATISTICS_RESET */
382 void ctdb_req_control_statistics_reset(struct ctdb_req_control *request)
384 request->opcode = CTDB_CONTROL_STATISTICS_RESET;
385 request->pad = 0;
386 request->srvid = 0;
387 request->client_id = 0;
388 request->flags = 0;
390 request->rdata.opcode = CTDB_CONTROL_STATISTICS_RESET;
393 int ctdb_reply_control_statistics_reset(struct ctdb_reply_control *reply)
395 return ctdb_reply_control_generic(reply,
396 CTDB_CONTROL_STATISTICS_RESET);
399 /* CTDB_CONTROL_DB_ATTACH */
401 void ctdb_req_control_db_attach(struct ctdb_req_control *request,
402 const char *db_name, uint32_t tdb_flags)
404 request->opcode = CTDB_CONTROL_DB_ATTACH;
405 request->pad = 0;
406 request->srvid = tdb_flags;
407 request->client_id = 0;
408 request->flags = 0;
410 request->rdata.opcode = CTDB_CONTROL_DB_ATTACH;
411 request->rdata.data.db_name = db_name;
414 int ctdb_reply_control_db_attach(struct ctdb_reply_control *reply,
415 uint32_t *db_id)
417 if (reply->rdata.opcode != CTDB_CONTROL_DB_ATTACH) {
418 return EPROTO;
421 if (reply->status == 0) {
422 *db_id = reply->rdata.data.db_id;
424 return reply->status;
427 /* CTDB_CONTROL_SET_CALL */
429 /* CTDB_CONTROL_TRAVERSE_START */
431 void ctdb_req_control_traverse_start(struct ctdb_req_control *request,
432 struct ctdb_traverse_start *traverse)
434 request->opcode = CTDB_CONTROL_TRAVERSE_START;
435 request->pad = 0;
436 request->srvid = 0;
437 request->client_id = 0;
438 request->flags = 0;
440 request->rdata.opcode = CTDB_CONTROL_TRAVERSE_START;
441 request->rdata.data.traverse_start = traverse;
444 int ctdb_reply_control_traverse_start(struct ctdb_reply_control *reply)
446 return ctdb_reply_control_generic(reply, CTDB_CONTROL_TRAVERSE_START);
449 /* CTDB_CONTROL_TRAVERSE_ALL */
450 /* CTDB_CONTROL_TRAVERSE_DATA */
452 /* CTDB_CONTROL_REGISTER_SRVID */
454 void ctdb_req_control_register_srvid(struct ctdb_req_control *request,
455 uint64_t srvid)
457 request->opcode = CTDB_CONTROL_REGISTER_SRVID;
458 request->pad = 0;
459 request->srvid = srvid;
460 request->client_id = 0;
461 request->flags = 0;
463 request->rdata.opcode = CTDB_CONTROL_REGISTER_SRVID;
466 int ctdb_reply_control_register_srvid(struct ctdb_reply_control *reply)
468 return ctdb_reply_control_generic(reply, CTDB_CONTROL_REGISTER_SRVID);
471 /* CTDB_CONTROL_DEREGISTER_SRVID */
473 void ctdb_req_control_deregister_srvid(struct ctdb_req_control *request,
474 uint64_t srvid)
476 request->opcode = CTDB_CONTROL_DEREGISTER_SRVID;
477 request->pad = 0;
478 request->srvid = srvid;
479 request->client_id = 0;
480 request->flags = 0;
482 request->rdata.opcode = CTDB_CONTROL_DEREGISTER_SRVID;
485 int ctdb_reply_control_deregister_srvid(struct ctdb_reply_control *reply)
487 return ctdb_reply_control_generic(reply,
488 CTDB_CONTROL_DEREGISTER_SRVID);
491 /* CTDB_CONTROL_GET_DBNAME */
493 void ctdb_req_control_get_dbname(struct ctdb_req_control *request,
494 uint32_t db_id)
496 request->opcode = CTDB_CONTROL_GET_DBNAME;
497 request->pad = 0;
498 request->srvid = 0;
499 request->client_id = 0;
500 request->flags = 0;
502 request->rdata.opcode = CTDB_CONTROL_GET_DBNAME;
503 request->rdata.data.db_id = db_id;
506 int ctdb_reply_control_get_dbname(struct ctdb_reply_control *reply,
507 TALLOC_CTX *mem_ctx, const char **db_name)
509 if (reply->rdata.opcode != CTDB_CONTROL_GET_DBNAME) {
510 return EPROTO;
513 if (reply->status == 0) {
514 *db_name = talloc_steal(mem_ctx, reply->rdata.data.db_name);
516 return reply->status;
519 /* CTDB_CONTROL_ENABLE_SEQNUM */
521 void ctdb_req_control_enable_seqnum(struct ctdb_req_control *request,
522 uint32_t db_id)
524 request->opcode = CTDB_CONTROL_ENABLE_SEQNUM;
525 request->pad = 0;
526 request->srvid = 0;
527 request->client_id = 0;
528 request->flags = 0;
530 request->rdata.opcode = CTDB_CONTROL_ENABLE_SEQNUM;
531 request->rdata.data.db_id = db_id;
534 int ctdb_reply_control_enable_seqnum(struct ctdb_reply_control *reply)
536 return ctdb_reply_control_generic(reply, CTDB_CONTROL_ENABLE_SEQNUM);
539 /* CTDB_CONTROL_UPDATE_SEQNUM */
541 void ctdb_req_control_update_seqnum(struct ctdb_req_control *request,
542 uint32_t db_id)
544 request->opcode = CTDB_CONTROL_UPDATE_SEQNUM;
545 request->pad = 0;
546 request->srvid = 0;
547 request->client_id = 0;
548 request->flags = 0;
550 request->rdata.opcode = CTDB_CONTROL_UPDATE_SEQNUM;
551 request->rdata.data.db_id = db_id;
554 int ctdb_reply_control_update_seqnum(struct ctdb_reply_control *reply)
556 return ctdb_reply_control_generic(reply, CTDB_CONTROL_UPDATE_SEQNUM);
559 /* CTDB_CONTROL_DUMP_MEMORY */
561 void ctdb_req_control_dump_memory(struct ctdb_req_control *request)
563 request->opcode = CTDB_CONTROL_DUMP_MEMORY;
564 request->pad = 0;
565 request->srvid = 0;
566 request->client_id = 0;
567 request->flags = 0;
569 request->rdata.opcode = CTDB_CONTROL_DUMP_MEMORY;
572 int ctdb_reply_control_dump_memory(struct ctdb_reply_control *reply,
573 TALLOC_CTX *mem_ctx, const char **mem_str)
575 if (reply->rdata.opcode != CTDB_CONTROL_DUMP_MEMORY) {
576 return EPROTO;
579 if (reply->status == 0) {
580 *mem_str = talloc_steal(mem_ctx, reply->rdata.data.mem_str);
582 return reply->status;
585 /* CTDB_CONTROL_GET_PID */
587 void ctdb_req_control_get_pid(struct ctdb_req_control *request)
589 request->opcode = CTDB_CONTROL_GET_PID;
590 request->pad = 0;
591 request->srvid = 0;
592 request->client_id = 0;
593 request->flags = 0;
595 request->rdata.opcode = CTDB_CONTROL_GET_PID;
598 int ctdb_reply_control_get_pid(struct ctdb_reply_control *reply,
599 pid_t *pid)
601 if (reply->rdata.opcode != CTDB_CONTROL_GET_PID) {
602 return EPROTO;
605 *pid = reply->status;
606 reply->status = 0;
608 return reply->status;
611 /* CTDB_CONTROL_GET_RECMASTER */
613 void ctdb_req_control_get_recmaster(struct ctdb_req_control *request)
615 request->opcode = CTDB_CONTROL_GET_RECMASTER;
616 request->pad = 0;
617 request->srvid = 0;
618 request->client_id = 0;
619 request->flags = 0;
621 request->rdata.opcode = CTDB_CONTROL_GET_RECMASTER;
624 int ctdb_reply_control_get_recmaster(struct ctdb_reply_control *reply,
625 uint32_t *recmaster)
627 if (reply->rdata.opcode != CTDB_CONTROL_GET_RECMASTER) {
628 return EPROTO;
631 *recmaster = reply->status;
632 reply->status = 0;
634 return reply->status;
637 /* CTDB_CONTROL_SET_RECMASTER */
639 void ctdb_req_control_set_recmaster(struct ctdb_req_control *request,
640 int recmaster)
642 request->opcode = CTDB_CONTROL_SET_RECMASTER;
643 request->pad = 0;
644 request->srvid = 0;
645 request->client_id = 0;
646 request->flags = 0;
648 request->rdata.opcode = CTDB_CONTROL_SET_RECMASTER;
649 request->rdata.data.recmaster = recmaster;
652 int ctdb_reply_control_set_recmaster(struct ctdb_reply_control *reply)
654 return ctdb_reply_control_generic(reply, CTDB_CONTROL_SET_RECMASTER);
657 /* CTDB_CONTROL_FREEZE */
659 void ctdb_req_control_freeze(struct ctdb_req_control *request,
660 uint32_t priority)
662 request->opcode = CTDB_CONTROL_FREEZE;
663 request->pad = 0;
664 request->srvid = priority;
665 request->client_id = 0;
666 request->flags = 0;
668 request->rdata.opcode = CTDB_CONTROL_FREEZE;
671 int ctdb_reply_control_freeze(struct ctdb_reply_control *reply)
673 return ctdb_reply_control_generic(reply, CTDB_CONTROL_FREEZE);
676 /* CTDB_CONTROL_GET_PNN */
678 void ctdb_req_control_get_pnn(struct ctdb_req_control *request)
680 request->opcode = CTDB_CONTROL_GET_PNN;
681 request->pad = 0;
682 request->srvid = 0;
683 request->client_id = 0;
684 request->flags = 0;
686 request->rdata.opcode = CTDB_CONTROL_GET_PNN;
689 int ctdb_reply_control_get_pnn(struct ctdb_reply_control *reply,
690 uint32_t *pnn)
692 if (reply->rdata.opcode != CTDB_CONTROL_GET_PNN) {
693 return EPROTO;
696 if (reply->status >= 0) {
697 *pnn = reply->status;
698 reply->status = 0;
700 return reply->status;
703 /* CTDB_CONTROL_SHUTDOWN */
705 void ctdb_req_control_shutdown(struct ctdb_req_control *request)
707 request->opcode = CTDB_CONTROL_SHUTDOWN;
708 request->pad = 0;
709 request->srvid = 0;
710 request->client_id = 0;
711 request->flags = CTDB_CTRL_FLAG_NOREPLY;
713 request->rdata.opcode = CTDB_CONTROL_SHUTDOWN;
716 int ctdb_reply_control_shutdown(struct ctdb_reply_control *reply)
718 return ctdb_reply_control_generic(reply, CTDB_CONTROL_SHUTDOWN);
721 /* CTDB_CONTROL_GET_MONMODE */
723 void ctdb_req_control_get_monmode(struct ctdb_req_control *request)
725 request->opcode = CTDB_CONTROL_GET_MONMODE;
726 request->pad = 0;
727 request->srvid = 0;
728 request->client_id = 0;
729 request->flags = 0;
731 request->rdata.opcode = CTDB_CONTROL_GET_MONMODE;
734 int ctdb_reply_control_get_monmode(struct ctdb_reply_control *reply,
735 int *mon_mode)
737 if (reply->rdata.opcode != CTDB_CONTROL_GET_MONMODE) {
738 return EPROTO;
741 if (reply->status >= 0) {
742 *mon_mode = reply->status;
743 reply->status = 0;
745 return reply->status;
748 /* CTDB_CONTROL_TCP_CLIENT */
750 void ctdb_req_control_tcp_client(struct ctdb_req_control *request,
751 struct ctdb_connection *conn)
753 request->opcode = CTDB_CONTROL_TCP_CLIENT;
754 request->pad = 0;
755 request->srvid = 0;
756 request->client_id = 0;
757 request->flags = 0;
759 request->rdata.opcode = CTDB_CONTROL_TCP_CLIENT;
760 request->rdata.data.conn = conn;
763 int ctdb_reply_control_tcp_client(struct ctdb_reply_control *reply)
765 return ctdb_reply_control_generic(reply, CTDB_CONTROL_TCP_CLIENT);
768 /* CTDB_CONTROL_TCP_ADD */
770 void ctdb_req_control_tcp_add(struct ctdb_req_control *request,
771 struct ctdb_connection *conn)
773 request->opcode = CTDB_CONTROL_TCP_ADD;
774 request->pad = 0;
775 request->srvid = 0;
776 request->client_id = 0;
777 request->flags = 0;
779 request->rdata.opcode = CTDB_CONTROL_TCP_ADD;
780 request->rdata.data.conn = conn;
783 int ctdb_reply_control_tcp_add(struct ctdb_reply_control *reply)
785 return ctdb_reply_control_generic(reply, CTDB_CONTROL_TCP_ADD);
788 /* CTDB_CONTROL_TCP_REMOVE */
790 void ctdb_req_control_tcp_remove(struct ctdb_req_control *request,
791 struct ctdb_connection *conn)
793 request->opcode = CTDB_CONTROL_TCP_REMOVE;
794 request->pad = 0;
795 request->srvid = 0;
796 request->client_id = 0;
797 request->flags = 0;
799 request->rdata.opcode = CTDB_CONTROL_TCP_REMOVE;
800 request->rdata.data.conn = conn;
803 int ctdb_reply_control_tcp_remove(struct ctdb_reply_control *reply)
805 return ctdb_reply_control_generic(reply, CTDB_CONTROL_TCP_REMOVE);
808 /* CTDB_CONTROL_STARTUP */
810 void ctdb_req_control_startup(struct ctdb_req_control *request)
812 request->opcode = CTDB_CONTROL_STARTUP;
813 request->pad = 0;
814 request->srvid = 0;
815 request->client_id = 0;
816 request->flags = 0;
818 request->rdata.opcode = CTDB_CONTROL_STARTUP;
821 int ctdb_reply_control_startup(struct ctdb_reply_control *reply)
823 return ctdb_reply_control_generic(reply, CTDB_CONTROL_STARTUP);
826 /* CTDB_CONTROL_SET_TUNABLE */
828 void ctdb_req_control_set_tunable(struct ctdb_req_control *request,
829 struct ctdb_tunable *tunable)
831 request->opcode = CTDB_CONTROL_SET_TUNABLE;
832 request->pad = 0;
833 request->srvid = 0;
834 request->client_id = 0;
835 request->flags = 0;
837 request->rdata.opcode = CTDB_CONTROL_SET_TUNABLE;
838 request->rdata.data.tunable = tunable;
841 int ctdb_reply_control_set_tunable(struct ctdb_reply_control *reply)
843 return ctdb_reply_control_generic(reply, CTDB_CONTROL_SET_TUNABLE);
846 /* CTDB_CONTROL_GET_TUNABLE */
848 void ctdb_req_control_get_tunable(struct ctdb_req_control *request,
849 const char *name)
851 request->opcode = CTDB_CONTROL_GET_TUNABLE;
852 request->pad = 0;
853 request->srvid = 0;
854 request->client_id = 0;
855 request->flags = 0;
857 request->rdata.opcode = CTDB_CONTROL_GET_TUNABLE;
858 request->rdata.data.tun_var = discard_const(name);
861 int ctdb_reply_control_get_tunable(struct ctdb_reply_control *reply,
862 uint32_t *value)
864 if (reply->rdata.opcode != CTDB_CONTROL_GET_TUNABLE) {
865 return EPROTO;
868 if (reply->status == 0) {
869 *value = reply->rdata.data.tun_value;
871 return reply->status;
874 /* CTDB_CONTROL_LIST_TUNABLES */
876 void ctdb_req_control_list_tunables(struct ctdb_req_control *request)
878 request->opcode = CTDB_CONTROL_LIST_TUNABLES;
879 request->pad = 0;
880 request->srvid = 0;
881 request->client_id = 0;
882 request->flags = 0;
884 request->rdata.opcode = CTDB_CONTROL_LIST_TUNABLES;
887 int ctdb_reply_control_list_tunables(struct ctdb_reply_control *reply,
888 TALLOC_CTX *mem_ctx,
889 struct ctdb_var_list **tun_var_list)
891 if (reply->rdata.opcode != CTDB_CONTROL_LIST_TUNABLES) {
892 return EPROTO;
895 if (reply->status == 0) {
896 *tun_var_list = talloc_steal(mem_ctx,
897 reply->rdata.data.tun_var_list);
899 return reply->status;
902 /* CTDB_CONTROL_MODIFY_FLAGS */
904 void ctdb_req_control_modify_flags(struct ctdb_req_control *request,
905 struct ctdb_node_flag_change *flag_change)
907 request->opcode = CTDB_CONTROL_MODIFY_FLAGS;
908 request->pad = 0;
909 request->srvid = 0;
910 request->client_id = 0;
911 request->flags = 0;
913 request->rdata.opcode = CTDB_CONTROL_MODIFY_FLAGS;
914 request->rdata.data.flag_change = flag_change;
917 int ctdb_reply_control_modify_flags(struct ctdb_reply_control *reply)
919 return ctdb_reply_control_generic(reply, CTDB_CONTROL_MODIFY_FLAGS);
922 /* CTDB_CONTROL_GET_ALL_TUNABLES */
924 void ctdb_req_control_get_all_tunables(struct ctdb_req_control *request)
926 request->opcode = CTDB_CONTROL_GET_ALL_TUNABLES;
927 request->pad = 0;
928 request->srvid = 0;
929 request->client_id = 0;
930 request->flags = 0;
932 request->rdata.opcode = CTDB_CONTROL_GET_ALL_TUNABLES;
935 int ctdb_reply_control_get_all_tunables(struct ctdb_reply_control *reply,
936 TALLOC_CTX *mem_ctx,
937 struct ctdb_tunable_list **tun_list)
939 if (reply->rdata.opcode != CTDB_CONTROL_GET_ALL_TUNABLES) {
940 return EPROTO;
943 if (reply->status == 0) {
944 *tun_list = talloc_steal(mem_ctx, reply->rdata.data.tun_list);
946 return reply->status;
949 /* CTDB_CONTROL_GET_TCP_TICKLE_LIST */
951 void ctdb_req_control_get_tcp_tickle_list(struct ctdb_req_control *request,
952 ctdb_sock_addr *addr)
954 request->opcode = CTDB_CONTROL_GET_TCP_TICKLE_LIST;
955 request->pad = 0;
956 request->srvid = 0;
957 request->client_id = 0;
958 request->flags = 0;
960 request->rdata.opcode = CTDB_CONTROL_GET_TCP_TICKLE_LIST;
961 request->rdata.data.addr = addr;
964 int ctdb_reply_control_get_tcp_tickle_list(struct ctdb_reply_control *reply,
965 TALLOC_CTX *mem_ctx,
966 struct ctdb_tickle_list **tickles)
968 if (reply->rdata.opcode != CTDB_CONTROL_GET_TCP_TICKLE_LIST) {
969 return EPROTO;
972 if (reply->status == 0) {
973 *tickles = talloc_steal(mem_ctx, reply->rdata.data.tickles);
975 return reply->status;
978 /* CTDB_CONTROL_SET_TCP_TICKLE_LIST */
980 void ctdb_req_control_set_tcp_tickle_list(struct ctdb_req_control *request,
981 struct ctdb_tickle_list *tickles)
983 request->opcode = CTDB_CONTROL_SET_TCP_TICKLE_LIST;
984 request->pad = 0;
985 request->srvid = 0;
986 request->client_id = 0;
987 request->flags = 0;
989 request->rdata.opcode = CTDB_CONTROL_SET_TCP_TICKLE_LIST;
990 request->rdata.data.tickles = tickles;
993 int ctdb_reply_control_set_tcp_tickle_list(struct ctdb_reply_control *reply)
995 return ctdb_reply_control_generic(reply,
996 CTDB_CONTROL_SET_TCP_TICKLE_LIST);
999 /* CTDB_CONTROL_DB_ATTACH_PERSISTENT */
1001 void ctdb_req_control_db_attach_persistent(struct ctdb_req_control *request,
1002 const char *db_name,
1003 uint32_t tdb_flags)
1005 request->opcode = CTDB_CONTROL_DB_ATTACH_PERSISTENT;
1006 request->pad = 0;
1007 request->srvid = tdb_flags;
1008 request->client_id = 0;
1009 request->flags = 0;
1011 request->rdata.opcode = CTDB_CONTROL_DB_ATTACH_PERSISTENT;
1012 request->rdata.data.db_name = db_name;
1015 int ctdb_reply_control_db_attach_persistent(struct ctdb_reply_control *reply,
1016 uint32_t *db_id)
1018 if (reply->rdata.opcode != CTDB_CONTROL_DB_ATTACH_PERSISTENT) {
1019 return EPROTO;
1022 if (reply->status == 0) {
1023 *db_id = reply->rdata.data.db_id;
1025 return reply->status;
1028 /* CTDB_CONTROL_UPDATE_RECORD */
1030 void ctdb_req_control_update_record(struct ctdb_req_control *request,
1031 struct ctdb_rec_buffer *recbuf)
1033 request->opcode = CTDB_CONTROL_UPDATE_RECORD;
1034 request->pad = 0;
1035 request->srvid = 0;
1036 request->client_id = 0;
1037 request->flags = 0;
1039 request->rdata.opcode = CTDB_CONTROL_UPDATE_RECORD;
1040 request->rdata.data.recbuf = recbuf;
1043 int ctdb_reply_control_update_record(struct ctdb_reply_control *reply)
1045 return ctdb_reply_control_generic(reply, CTDB_CONTROL_UPDATE_RECORD);
1048 /* CTDB_CONTROL_SEND_GRATUITOUS_ARP */
1050 void ctdb_req_control_send_gratuitous_arp(struct ctdb_req_control *request,
1051 struct ctdb_addr_info *addr_info)
1053 request->opcode = CTDB_CONTROL_SEND_GRATUITOUS_ARP;
1054 request->pad = 0;
1055 request->srvid = 0;
1056 request->client_id = 0;
1057 request->flags = 0;
1059 request->rdata.opcode = CTDB_CONTROL_SEND_GRATUITOUS_ARP;
1060 request->rdata.data.addr_info = addr_info;
1063 int ctdb_reply_control_send_gratuitous_arp(struct ctdb_reply_control *reply)
1065 return ctdb_reply_control_generic(reply,
1066 CTDB_CONTROL_SEND_GRATUITOUS_ARP);
1069 /* CTDB_CONTROL_WIPE_DATABASE */
1071 void ctdb_req_control_wipe_database(struct ctdb_req_control *request,
1072 struct ctdb_transdb *transdb)
1074 request->opcode = CTDB_CONTROL_WIPE_DATABASE;
1075 request->pad = 0;
1076 request->srvid = 0;
1077 request->client_id = 0;
1078 request->flags = 0;
1080 request->rdata.opcode = CTDB_CONTROL_WIPE_DATABASE;
1081 request->rdata.data.transdb = transdb;
1084 int ctdb_reply_control_wipe_database(struct ctdb_reply_control *reply)
1086 return ctdb_reply_control_generic(reply, CTDB_CONTROL_WIPE_DATABASE);
1089 /* CTDB_CONTROL_UPTIME */
1091 void ctdb_req_control_uptime(struct ctdb_req_control *request)
1093 request->opcode = CTDB_CONTROL_UPTIME;
1094 request->pad = 0;
1095 request->srvid = 0;
1096 request->client_id = 0;
1097 request->flags = 0;
1099 request->rdata.opcode = CTDB_CONTROL_UPTIME;
1102 int ctdb_reply_control_uptime(struct ctdb_reply_control *reply,
1103 TALLOC_CTX *mem_ctx, struct ctdb_uptime **uptime)
1105 if (reply->rdata.opcode != CTDB_CONTROL_UPTIME) {
1106 return EPROTO;
1109 if (reply->status == 0) {
1110 *uptime = talloc_steal(mem_ctx, reply->rdata.data.uptime);
1112 return reply->status;
1115 /* CTDB_CONTROL_START_RECOVERY */
1117 void ctdb_req_control_start_recovery(struct ctdb_req_control *request)
1119 request->opcode = CTDB_CONTROL_START_RECOVERY;
1120 request->pad = 0;
1121 request->srvid = 0;
1122 request->client_id = 0;
1123 request->flags = 0;
1125 request->rdata.opcode = CTDB_CONTROL_START_RECOVERY;
1128 int ctdb_reply_control_start_recovery(struct ctdb_reply_control *reply)
1130 return ctdb_reply_control_generic(reply, CTDB_CONTROL_START_RECOVERY);
1133 /* CTDB_CONTROL_END_RECOVERY */
1135 void ctdb_req_control_end_recovery(struct ctdb_req_control *request)
1137 request->opcode = CTDB_CONTROL_END_RECOVERY;
1138 request->pad = 0;
1139 request->srvid = 0;
1140 request->client_id = 0;
1141 request->flags = 0;
1143 request->rdata.opcode = CTDB_CONTROL_END_RECOVERY;
1146 int ctdb_reply_control_end_recovery(struct ctdb_reply_control *reply)
1148 return ctdb_reply_control_generic(reply, CTDB_CONTROL_END_RECOVERY);
1151 /* CTDB_CONTROL_RELOAD_NODES_FILE */
1153 void ctdb_req_control_reload_nodes_file(struct ctdb_req_control *request)
1155 request->opcode = CTDB_CONTROL_RELOAD_NODES_FILE;
1156 request->pad = 0;
1157 request->srvid = 0;
1158 request->client_id = 0;
1159 request->flags = 0;
1161 request->rdata.opcode = CTDB_CONTROL_RELOAD_NODES_FILE;
1164 int ctdb_reply_control_reload_nodes_file(struct ctdb_reply_control *reply)
1166 return ctdb_reply_control_generic(reply,
1167 CTDB_CONTROL_RELOAD_NODES_FILE);
1170 /* CTDB_CONTROL_TRY_DELETE_RECORDS */
1172 void ctdb_req_control_try_delete_records(struct ctdb_req_control *request,
1173 struct ctdb_rec_buffer *recbuf)
1175 request->opcode = CTDB_CONTROL_TRY_DELETE_RECORDS;
1176 request->pad = 0;
1177 request->srvid = 0;
1178 request->client_id = 0;
1179 request->flags = 0;
1181 request->rdata.opcode = CTDB_CONTROL_TRY_DELETE_RECORDS;
1182 request->rdata.data.recbuf = recbuf;
1185 int ctdb_reply_control_try_delete_records(struct ctdb_reply_control *reply,
1186 TALLOC_CTX *mem_ctx,
1187 struct ctdb_rec_buffer **recbuf)
1189 if (reply->rdata.opcode != CTDB_CONTROL_TRY_DELETE_RECORDS) {
1190 return EPROTO;
1193 if (reply->status == 0) {
1194 *recbuf = talloc_steal(mem_ctx, reply->rdata.data.recbuf);
1196 return reply->status;
1199 /* CTDB_CONTROL_ENABLE_MONITOR */
1201 void ctdb_req_control_enable_monitor(struct ctdb_req_control *request)
1203 request->opcode = CTDB_CONTROL_ENABLE_MONITOR;
1204 request->pad = 0;
1205 request->srvid = 0;
1206 request->client_id = 0;
1207 request->flags = 0;
1209 request->rdata.opcode = CTDB_CONTROL_ENABLE_MONITOR;
1212 int ctdb_reply_control_enable_monitor(struct ctdb_reply_control *reply)
1214 return ctdb_reply_control_generic(reply, CTDB_CONTROL_ENABLE_MONITOR);
1217 /* CTDB_CONTROL_DISABLE_MONITOR */
1219 void ctdb_req_control_disable_monitor(struct ctdb_req_control *request)
1221 request->opcode = CTDB_CONTROL_DISABLE_MONITOR;
1222 request->pad = 0;
1223 request->srvid = 0;
1224 request->client_id = 0;
1225 request->flags = 0;
1227 request->rdata.opcode = CTDB_CONTROL_DISABLE_MONITOR;
1230 int ctdb_reply_control_disable_monitor(struct ctdb_reply_control *reply)
1232 return ctdb_reply_control_generic(reply, CTDB_CONTROL_DISABLE_MONITOR);
1235 /* CTDB_CONTROL_ADD_PUBLIC_IP */
1237 void ctdb_req_control_add_public_ip(struct ctdb_req_control *request,
1238 struct ctdb_addr_info *addr_info)
1240 request->opcode = CTDB_CONTROL_ADD_PUBLIC_IP;
1241 request->pad = 0;
1242 request->srvid = 0;
1243 request->client_id = 0;
1244 request->flags = 0;
1246 request->rdata.opcode = CTDB_CONTROL_ADD_PUBLIC_IP;
1247 request->rdata.data.addr_info = addr_info;
1250 int ctdb_reply_control_add_public_ip(struct ctdb_reply_control *reply)
1252 return ctdb_reply_control_generic(reply, CTDB_CONTROL_ADD_PUBLIC_IP);
1255 /* CTDB_CONTROL_DEL_PUBLIC_IP */
1257 void ctdb_req_control_del_public_ip(struct ctdb_req_control *request,
1258 struct ctdb_addr_info *addr_info)
1260 request->opcode = CTDB_CONTROL_DEL_PUBLIC_IP;
1261 request->pad = 0;
1262 request->srvid = 0;
1263 request->client_id = 0;
1264 request->flags = 0;
1266 request->rdata.opcode = CTDB_CONTROL_DEL_PUBLIC_IP;
1267 request->rdata.data.addr_info = addr_info;
1270 int ctdb_reply_control_del_public_ip(struct ctdb_reply_control *reply)
1272 return ctdb_reply_control_generic(reply, CTDB_CONTROL_DEL_PUBLIC_IP);
1275 /* CTDB_CONTROL_GET_CAPABILITIES */
1277 void ctdb_req_control_get_capabilities(struct ctdb_req_control *request)
1279 request->opcode = CTDB_CONTROL_GET_CAPABILITIES;
1280 request->pad = 0;
1281 request->srvid = 0;
1282 request->client_id = 0;
1283 request->flags = 0;
1285 request->rdata.opcode = CTDB_CONTROL_GET_CAPABILITIES;
1288 int ctdb_reply_control_get_capabilities(struct ctdb_reply_control *reply,
1289 uint32_t *caps)
1291 if (reply->rdata.opcode != CTDB_CONTROL_GET_CAPABILITIES) {
1292 return EPROTO;
1295 if (reply->status == 0) {
1296 *caps = reply->rdata.data.caps;
1298 return reply->status;
1301 /* CTDB_CONTROL_RECD_PING */
1303 void ctdb_req_control_recd_ping(struct ctdb_req_control *request)
1305 request->opcode = CTDB_CONTROL_RECD_PING;
1306 request->pad = 0;
1307 request->srvid = 0;
1308 request->client_id = 0;
1309 request->flags = 0;
1311 request->rdata.opcode = CTDB_CONTROL_RECD_PING;
1314 int ctdb_reply_control_recd_ping(struct ctdb_reply_control *reply)
1316 return ctdb_reply_control_generic(reply, CTDB_CONTROL_RECD_PING);
1319 /* CTDB_CONTROL_RELEASE_IP */
1321 void ctdb_req_control_release_ip(struct ctdb_req_control *request,
1322 struct ctdb_public_ip *pubip)
1324 request->opcode = CTDB_CONTROL_RELEASE_IP;
1325 request->pad = 0;
1326 request->srvid = 0;
1327 request->client_id = 0;
1328 request->flags = 0;
1330 request->rdata.opcode = CTDB_CONTROL_RELEASE_IP;
1331 request->rdata.data.pubip = pubip;
1334 int ctdb_reply_control_release_ip(struct ctdb_reply_control *reply)
1336 return ctdb_reply_control_generic(reply, CTDB_CONTROL_RELEASE_IP);
1339 /* CTDB_CONTROL_TAKEOVER_IP */
1341 void ctdb_req_control_takeover_ip(struct ctdb_req_control *request,
1342 struct ctdb_public_ip *pubip)
1344 request->opcode = CTDB_CONTROL_TAKEOVER_IP;
1345 request->pad = 0;
1346 request->srvid = 0;
1347 request->client_id = 0;
1348 request->flags = 0;
1350 request->rdata.opcode = CTDB_CONTROL_TAKEOVER_IP;
1351 request->rdata.data.pubip = pubip;
1354 int ctdb_reply_control_takeover_ip(struct ctdb_reply_control *reply)
1356 return ctdb_reply_control_generic(reply, CTDB_CONTROL_TAKEOVER_IP);
1359 /* CTDB_CONTROL_GET_PUBLIC_IPS */
1361 void ctdb_req_control_get_public_ips(struct ctdb_req_control *request,
1362 bool available_only)
1364 request->opcode = CTDB_CONTROL_GET_PUBLIC_IPS;
1365 request->pad = 0;
1366 request->srvid = 0;
1367 request->client_id = 0;
1368 request->flags = 0;
1370 request->rdata.opcode = CTDB_CONTROL_GET_PUBLIC_IPS;
1371 if (available_only) {
1372 request->flags = CTDB_PUBLIC_IP_FLAGS_ONLY_AVAILABLE;
1376 int ctdb_reply_control_get_public_ips(struct ctdb_reply_control *reply,
1377 TALLOC_CTX *mem_ctx,
1378 struct ctdb_public_ip_list **pubip_list)
1380 if (reply->rdata.opcode != CTDB_CONTROL_GET_PUBLIC_IPS) {
1381 return EPROTO;
1384 if (reply->status == 0) {
1385 *pubip_list = talloc_steal(mem_ctx,
1386 reply->rdata.data.pubip_list);
1388 return reply->status;
1391 /* CTDB_CONTROL_GET_NODEMAP */
1393 void ctdb_req_control_get_nodemap(struct ctdb_req_control *request)
1395 request->opcode = CTDB_CONTROL_GET_NODEMAP;
1396 request->pad = 0;
1397 request->srvid = 0;
1398 request->client_id = 0;
1399 request->flags = 0;
1401 request->rdata.opcode = CTDB_CONTROL_GET_NODEMAP;
1404 int ctdb_reply_control_get_nodemap(struct ctdb_reply_control *reply,
1405 TALLOC_CTX *mem_ctx,
1406 struct ctdb_node_map **nodemap)
1408 if (reply->rdata.opcode != CTDB_CONTROL_GET_NODEMAP) {
1409 return EPROTO;
1412 if (reply->status == 0) {
1413 *nodemap = talloc_steal(mem_ctx, reply->rdata.data.nodemap);
1415 return reply->status;
1418 /* CTDB_CONTROL_TRAVERSE_KILL */
1420 void ctdb_req_control_traverse_kill(struct ctdb_req_control *request,
1421 struct ctdb_traverse_start *traverse)
1423 request->opcode = CTDB_CONTROL_TRAVERSE_KILL;
1424 request->pad = 0;
1425 request->srvid = 0;
1426 request->client_id = 0;
1427 request->flags = 0;
1429 request->rdata.opcode = CTDB_CONTROL_TRAVERSE_KILL;
1430 request->rdata.data.traverse_start = traverse;
1433 int ctdb_reply_control_traverse_kill(struct ctdb_reply_control *reply)
1435 return ctdb_reply_control_generic(reply, CTDB_CONTROL_TRAVERSE_KILL);
1438 /* CTDB_CONTROL_RECD_RECLOCK_LATENCY */
1440 void ctdb_req_control_recd_reclock_latency(struct ctdb_req_control *request,
1441 double reclock_latency)
1443 request->opcode = CTDB_CONTROL_RECD_RECLOCK_LATENCY;
1444 request->pad = 0;
1445 request->srvid = 0;
1446 request->client_id = 0;
1447 request->flags = 0;
1449 request->rdata.opcode = CTDB_CONTROL_RECD_RECLOCK_LATENCY;
1450 request->rdata.data.reclock_latency = reclock_latency;
1453 int ctdb_reply_control_recd_reclock_latency(struct ctdb_reply_control *reply)
1455 return ctdb_reply_control_generic(reply,
1456 CTDB_CONTROL_RECD_RECLOCK_LATENCY);
1459 /* CTDB_CONTROL_GET_RECLOCK_FILE */
1461 void ctdb_req_control_get_reclock_file(struct ctdb_req_control *request)
1463 request->opcode = CTDB_CONTROL_GET_RECLOCK_FILE;
1464 request->pad = 0;
1465 request->srvid = 0;
1466 request->client_id = 0;
1467 request->flags = 0;
1469 request->rdata.opcode = CTDB_CONTROL_GET_RECLOCK_FILE;
1472 int ctdb_reply_control_get_reclock_file(struct ctdb_reply_control *reply,
1473 TALLOC_CTX *mem_ctx,
1474 const char **reclock_file)
1476 if (reply->rdata.opcode != CTDB_CONTROL_GET_RECLOCK_FILE) {
1477 return EPROTO;
1480 if (reply->status == 0) {
1481 *reclock_file = talloc_steal(mem_ctx,
1482 reply->rdata.data.reclock_file);
1484 return reply->status;
1487 /* CTDB_CONTROL_STOP_NODE */
1489 void ctdb_req_control_stop_node(struct ctdb_req_control *request)
1491 request->opcode = CTDB_CONTROL_STOP_NODE;
1492 request->pad = 0;
1493 request->srvid = 0;
1494 request->client_id = 0;
1495 request->flags = 0;
1497 request->rdata.opcode = CTDB_CONTROL_STOP_NODE;
1500 int ctdb_reply_control_stop_node(struct ctdb_reply_control *reply)
1502 return ctdb_reply_control_generic(reply, CTDB_CONTROL_STOP_NODE);
1505 /* CTDB_CONTROL_CONTINUE_NODE */
1507 void ctdb_req_control_continue_node(struct ctdb_req_control *request)
1509 request->opcode = CTDB_CONTROL_CONTINUE_NODE;
1510 request->pad = 0;
1511 request->srvid = 0;
1512 request->client_id = 0;
1513 request->flags = 0;
1515 request->rdata.opcode = CTDB_CONTROL_CONTINUE_NODE;
1518 int ctdb_reply_control_continue_node(struct ctdb_reply_control *reply)
1520 return ctdb_reply_control_generic(reply, CTDB_CONTROL_CONTINUE_NODE);
1523 /* CTDB_CONTROL_SET_LMASTERROLE */
1525 void ctdb_req_control_set_lmasterrole(struct ctdb_req_control *request,
1526 uint32_t lmaster_role)
1528 request->opcode = CTDB_CONTROL_SET_LMASTERROLE;
1529 request->pad = 0;
1530 request->srvid = 0;
1531 request->client_id = 0;
1532 request->flags = 0;
1534 request->rdata.opcode = CTDB_CONTROL_SET_LMASTERROLE;
1535 request->rdata.data.role = lmaster_role;
1538 int ctdb_reply_control_set_lmasterrole(struct ctdb_reply_control *reply)
1540 return ctdb_reply_control_generic(reply, CTDB_CONTROL_SET_LMASTERROLE);
1543 /* CTDB_CONTROL_SET_RECMASTERROLE */
1545 void ctdb_req_control_set_recmasterrole(struct ctdb_req_control *request,
1546 uint32_t recmaster_role)
1548 request->opcode = CTDB_CONTROL_SET_RECMASTERROLE;
1549 request->pad = 0;
1550 request->srvid = 0;
1551 request->client_id = 0;
1552 request->flags = 0;
1554 request->rdata.opcode = CTDB_CONTROL_SET_RECMASTERROLE;
1555 request->rdata.data.role = recmaster_role;
1558 int ctdb_reply_control_set_recmasterrole(struct ctdb_reply_control *reply)
1560 return ctdb_reply_control_generic(reply,
1561 CTDB_CONTROL_SET_RECMASTERROLE);
1564 /* CTDB_CONTROL_SET_BAN_STATE */
1566 void ctdb_req_control_set_ban_state(struct ctdb_req_control *request,
1567 struct ctdb_ban_state *ban_state)
1569 request->opcode = CTDB_CONTROL_SET_BAN_STATE;
1570 request->pad = 0;
1571 request->srvid = 0;
1572 request->client_id = 0;
1573 request->flags = 0;
1575 request->rdata.opcode = CTDB_CONTROL_SET_BAN_STATE;
1576 request->rdata.data.ban_state = ban_state;
1579 int ctdb_reply_control_set_ban_state(struct ctdb_reply_control *reply)
1581 return ctdb_reply_control_generic(reply, CTDB_CONTROL_SET_BAN_STATE);
1584 /* CTDB_CONTROL_GET_BAN_STATE */
1586 void ctdb_req_control_get_ban_state(struct ctdb_req_control *request)
1588 request->opcode = CTDB_CONTROL_GET_BAN_STATE;
1589 request->pad = 0;
1590 request->srvid = 0;
1591 request->client_id = 0;
1592 request->flags = 0;
1594 request->rdata.opcode = CTDB_CONTROL_GET_BAN_STATE;
1597 int ctdb_reply_control_get_ban_state(struct ctdb_reply_control *reply,
1598 TALLOC_CTX *mem_ctx,
1599 struct ctdb_ban_state **ban_state)
1601 if (reply->rdata.opcode != CTDB_CONTROL_GET_BAN_STATE) {
1602 return EPROTO;
1605 if (reply->status == 0) {
1606 *ban_state = talloc_steal(mem_ctx,
1607 reply->rdata.data.ban_state);
1609 return reply->status;
1612 /* CTDB_CONTROL_REGISTER_NOTIFY */
1614 void ctdb_req_control_register_notify(struct ctdb_req_control *request,
1615 struct ctdb_notify_data *notify)
1617 request->opcode = CTDB_CONTROL_REGISTER_NOTIFY;
1618 request->pad = 0;
1619 request->srvid = 0;
1620 request->client_id = 0;
1621 request->flags = 0;
1623 request->rdata.opcode = CTDB_CONTROL_REGISTER_NOTIFY;
1624 request->rdata.data.notify = notify;
1627 int ctdb_reply_control_register_notify(struct ctdb_reply_control *reply)
1629 return ctdb_reply_control_generic(reply, CTDB_CONTROL_REGISTER_NOTIFY);
1632 /* CTDB_CONTROL_DEREGISTER_NOTIFY */
1634 void ctdb_req_control_deregister_notify(struct ctdb_req_control *request,
1635 uint64_t srvid)
1637 request->opcode = CTDB_CONTROL_DEREGISTER_NOTIFY;
1638 request->pad = 0;
1639 request->srvid = 0;
1640 request->client_id = 0;
1641 request->flags = 0;
1643 request->rdata.opcode = CTDB_CONTROL_DEREGISTER_NOTIFY;
1644 request->rdata.data.srvid = srvid;
1647 int ctdb_reply_control_deregister_notify(struct ctdb_reply_control *reply)
1649 return ctdb_reply_control_generic(reply,
1650 CTDB_CONTROL_DEREGISTER_NOTIFY);
1653 /* CTDB_CONTROL_TRANS3_COMMIT */
1655 void ctdb_req_control_trans3_commit(struct ctdb_req_control *request,
1656 struct ctdb_rec_buffer *recbuf)
1658 request->opcode = CTDB_CONTROL_TRANS3_COMMIT;
1659 request->pad = 0;
1660 request->srvid = 0;
1661 request->client_id = 0;
1662 request->flags = 0;
1664 request->rdata.opcode = CTDB_CONTROL_TRANS3_COMMIT;
1665 request->rdata.data.recbuf = recbuf;
1668 int ctdb_reply_control_trans3_commit(struct ctdb_reply_control *reply)
1670 return ctdb_reply_control_generic(reply, CTDB_CONTROL_TRANS3_COMMIT);
1673 /* CTDB_CONTROL_GET_DB_SEQNUM */
1675 void ctdb_req_control_get_db_seqnum(struct ctdb_req_control *request,
1676 uint32_t db_id)
1678 request->opcode = CTDB_CONTROL_GET_DB_SEQNUM;
1679 request->pad = 0;
1680 request->srvid = 0;
1681 request->client_id = 0;
1682 request->flags = 0;
1684 request->rdata.opcode = CTDB_CONTROL_GET_DB_SEQNUM;
1685 request->rdata.data.db_id = db_id;
1688 int ctdb_reply_control_get_db_seqnum(struct ctdb_reply_control *reply,
1689 uint64_t *seqnum)
1691 if (reply->rdata.opcode != CTDB_CONTROL_GET_DB_SEQNUM) {
1692 return EPROTO;
1695 if (reply->status == 0) {
1696 *seqnum = reply->rdata.data.seqnum;
1698 return reply->status;
1701 /* CTDB_CONTROL_DB_SET_HEALTHY */
1703 void ctdb_req_control_db_set_healthy(struct ctdb_req_control *request,
1704 uint32_t db_id)
1706 request->opcode = CTDB_CONTROL_DB_SET_HEALTHY;
1707 request->pad = 0;
1708 request->srvid = 0;
1709 request->client_id = 0;
1710 request->flags = 0;
1712 request->rdata.opcode = CTDB_CONTROL_DB_SET_HEALTHY;
1713 request->rdata.data.db_id = db_id;
1716 int ctdb_reply_control_db_set_healthy(struct ctdb_reply_control *reply)
1718 return ctdb_reply_control_generic(reply, CTDB_CONTROL_DB_SET_HEALTHY);
1721 /* CTDB_CONTROL_DB_GET_HEALTH */
1723 void ctdb_req_control_db_get_health(struct ctdb_req_control *request,
1724 uint32_t db_id)
1726 request->opcode = CTDB_CONTROL_DB_GET_HEALTH;
1727 request->pad = 0;
1728 request->srvid = 0;
1729 request->client_id = 0;
1730 request->flags = 0;
1732 request->rdata.opcode = CTDB_CONTROL_DB_GET_HEALTH;
1733 request->rdata.data.db_id = db_id;
1736 int ctdb_reply_control_db_get_health(struct ctdb_reply_control *reply,
1737 TALLOC_CTX *mem_ctx, const char **reason)
1739 if (reply->rdata.opcode != CTDB_CONTROL_DB_GET_HEALTH) {
1740 return EPROTO;
1743 if (reply->status == 0) {
1744 *reason = talloc_steal(mem_ctx, reply->rdata.data.reason);
1746 return reply->status;
1749 /* CTDB_CONTROL_GET_PUBLIC_IP_INFO */
1751 void ctdb_req_control_get_public_ip_info(struct ctdb_req_control *request,
1752 ctdb_sock_addr *addr)
1754 request->opcode = CTDB_CONTROL_GET_PUBLIC_IP_INFO;
1755 request->pad = 0;
1756 request->srvid = 0;
1757 request->client_id = 0;
1758 request->flags = 0;
1760 request->rdata.opcode = CTDB_CONTROL_GET_PUBLIC_IP_INFO;
1761 request->rdata.data.addr = addr;
1764 int ctdb_reply_control_get_public_ip_info(struct ctdb_reply_control *reply,
1765 TALLOC_CTX *mem_ctx,
1766 struct ctdb_public_ip_info **ipinfo)
1768 if (reply->rdata.opcode != CTDB_CONTROL_GET_PUBLIC_IP_INFO) {
1769 return EPROTO;
1772 if (reply->status == 0) {
1773 *ipinfo = talloc_steal(mem_ctx, reply->rdata.data.ipinfo);
1775 return reply->status;
1778 /* CTDB_CONTROL_GET_IFACES */
1780 void ctdb_req_control_get_ifaces(struct ctdb_req_control *request)
1782 request->opcode = CTDB_CONTROL_GET_IFACES;
1783 request->pad = 0;
1784 request->srvid = 0;
1785 request->client_id = 0;
1786 request->flags = 0;
1788 request->rdata.opcode = CTDB_CONTROL_GET_IFACES;
1791 int ctdb_reply_control_get_ifaces(struct ctdb_reply_control *reply,
1792 TALLOC_CTX *mem_ctx,
1793 struct ctdb_iface_list **iface_list)
1795 if (reply->rdata.opcode != CTDB_CONTROL_GET_IFACES) {
1796 return EPROTO;
1799 if (reply->status == 0) {
1800 *iface_list = talloc_steal(mem_ctx,
1801 reply->rdata.data.iface_list);
1803 return reply->status;
1806 /* CTDB_CONTROL_SET_IFACE_LINK_STATE */
1808 void ctdb_req_control_set_iface_link_state(struct ctdb_req_control *request,
1809 struct ctdb_iface *iface)
1811 request->opcode = CTDB_CONTROL_SET_IFACE_LINK_STATE;
1812 request->pad = 0;
1813 request->srvid = 0;
1814 request->client_id = 0;
1815 request->flags = 0;
1817 request->rdata.opcode = CTDB_CONTROL_SET_IFACE_LINK_STATE;
1818 request->rdata.data.iface = iface;
1821 int ctdb_reply_control_set_iface_link_state(struct ctdb_reply_control *reply)
1823 return ctdb_reply_control_generic(reply,
1824 CTDB_CONTROL_SET_IFACE_LINK_STATE);
1827 /* CTDB_CONTROL_TCP_ADD_DELAYED_UPDATE */
1829 void ctdb_req_control_tcp_add_delayed_update(struct ctdb_req_control *request,
1830 struct ctdb_connection *conn)
1832 request->opcode = CTDB_CONTROL_TCP_ADD_DELAYED_UPDATE;
1833 request->pad = 0;
1834 request->srvid = 0;
1835 request->client_id = 0;
1836 request->flags = 0;
1838 request->rdata.opcode = CTDB_CONTROL_TCP_ADD_DELAYED_UPDATE;
1839 request->rdata.data.conn = conn;
1842 int ctdb_reply_control_tcp_add_delayed_update(struct ctdb_reply_control *reply)
1844 return ctdb_reply_control_generic(reply,
1845 CTDB_CONTROL_TCP_ADD_DELAYED_UPDATE);
1848 /* CTDB_CONTROL_GET_STAT_HISTORY */
1850 void ctdb_req_control_get_stat_history(struct ctdb_req_control *request)
1852 request->opcode = CTDB_CONTROL_GET_STAT_HISTORY;
1853 request->pad = 0;
1854 request->srvid = 0;
1855 request->client_id = 0;
1856 request->flags = 0;
1858 request->rdata.opcode = CTDB_CONTROL_GET_STAT_HISTORY;
1861 int ctdb_reply_control_get_stat_history(struct ctdb_reply_control *reply,
1862 TALLOC_CTX *mem_ctx,
1863 struct ctdb_statistics_list **stats_list)
1865 if (reply->rdata.opcode != CTDB_CONTROL_GET_STAT_HISTORY) {
1866 return EPROTO;
1869 if (reply->status == 0) {
1870 *stats_list = talloc_steal(mem_ctx,
1871 reply->rdata.data.stats_list);
1873 return reply->status;
1876 /* CTDB_CONTROL_SCHEDULE_FOR_DELETION */
1878 void ctdb_req_control_schedule_for_deletion(struct ctdb_req_control *request,
1879 struct ctdb_key_data *key)
1881 request->opcode = CTDB_CONTROL_SCHEDULE_FOR_DELETION;
1882 request->pad = 0;
1883 request->srvid = 0;
1884 request->client_id = 0;
1885 request->flags = 0;
1887 request->rdata.opcode = CTDB_CONTROL_SCHEDULE_FOR_DELETION;
1888 request->rdata.data.key = key;
1891 int ctdb_reply_control_schedule_for_deletion(struct ctdb_reply_control *reply)
1893 return ctdb_reply_control_generic(reply,
1894 CTDB_CONTROL_SCHEDULE_FOR_DELETION);
1897 /* CTDB_CONTROL_SET_DB_READONLY */
1899 void ctdb_req_control_set_db_readonly(struct ctdb_req_control *request,
1900 uint32_t db_id)
1902 request->opcode = CTDB_CONTROL_SET_DB_READONLY;
1903 request->pad = 0;
1904 request->srvid = 0;
1905 request->client_id = 0;
1906 request->flags = 0;
1908 request->rdata.opcode = CTDB_CONTROL_SET_DB_READONLY;
1909 request->rdata.data.db_id = db_id;
1912 int ctdb_reply_control_set_db_readonly(struct ctdb_reply_control *reply)
1914 return ctdb_reply_control_generic(reply, CTDB_CONTROL_SET_DB_READONLY);
1917 /* CTDB_CONTROL_CHECK_SRVIDS */
1919 void ctdb_req_control_check_srvids(struct ctdb_req_control *request,
1920 struct ctdb_uint64_array *u64_array)
1922 request->opcode = CTDB_CONTROL_CHECK_SRVIDS;
1923 request->pad = 0;
1924 request->srvid = 0;
1925 request->client_id = 0;
1926 request->flags = 0;
1928 request->rdata.opcode = CTDB_CONTROL_CHECK_SRVIDS;
1929 request->rdata.data.u64_array = u64_array;
1932 int ctdb_reply_control_check_srvids(struct ctdb_reply_control *reply,
1933 TALLOC_CTX *mem_ctx,
1934 struct ctdb_uint8_array **u8_array)
1936 if (reply->rdata.opcode != CTDB_CONTROL_CHECK_SRVIDS) {
1937 return EPROTO;
1940 if (reply->status == 0) {
1941 *u8_array = talloc_steal(mem_ctx, reply->rdata.data.u8_array);
1943 return reply->status;
1946 /* CTDB_CONTROL_TRAVERSE_START_EXT */
1948 void ctdb_req_control_traverse_start_ext(struct ctdb_req_control *request,
1949 struct ctdb_traverse_start_ext *traverse)
1951 request->opcode = CTDB_CONTROL_TRAVERSE_START_EXT;
1952 request->pad = 0;
1953 request->srvid = 0;
1954 request->client_id = 0;
1955 request->flags = 0;
1957 request->rdata.opcode = CTDB_CONTROL_TRAVERSE_START_EXT;
1958 request->rdata.data.traverse_start_ext = traverse;
1961 int ctdb_reply_control_traverse_start_ext(struct ctdb_reply_control *reply)
1963 return ctdb_reply_control_generic(reply,
1964 CTDB_CONTROL_TRAVERSE_START_EXT);
1967 /* CTDB_CONTROL_GET_DB_STATISTICS */
1969 void ctdb_req_control_get_db_statistics(struct ctdb_req_control *request,
1970 uint32_t db_id)
1972 request->opcode = CTDB_CONTROL_GET_DB_STATISTICS;
1973 request->pad = 0;
1974 request->srvid = 0;
1975 request->client_id = 0;
1976 request->flags = 0;
1978 request->rdata.opcode = CTDB_CONTROL_GET_DB_STATISTICS;
1979 request->rdata.data.db_id = db_id;
1982 int ctdb_reply_control_get_db_statistics(struct ctdb_reply_control *reply,
1983 TALLOC_CTX *mem_ctx,
1984 struct ctdb_db_statistics **dbstats)
1986 if (reply->rdata.opcode != CTDB_CONTROL_GET_DB_STATISTICS) {
1987 return EPROTO;
1990 if (reply->status == 0) {
1991 *dbstats = talloc_steal(mem_ctx, reply->rdata.data.dbstats);
1993 return reply->status;
1996 /* CTDB_CONTROL_SET_DB_STICKY */
1998 void ctdb_req_control_set_db_sticky(struct ctdb_req_control *request,
1999 uint32_t db_id)
2001 request->opcode = CTDB_CONTROL_SET_DB_STICKY;
2002 request->pad = 0;
2003 request->srvid = 0;
2004 request->client_id = 0;
2005 request->flags = 0;
2007 request->rdata.opcode = CTDB_CONTROL_SET_DB_STICKY;
2008 request->rdata.data.db_id = db_id;
2011 int ctdb_reply_control_set_db_sticky(struct ctdb_reply_control *reply)
2013 return ctdb_reply_control_generic(reply, CTDB_CONTROL_SET_DB_STICKY);
2016 /* CTDB_CONTROL_RELOAD_PUBLIC_IPS */
2018 void ctdb_req_control_reload_public_ips(struct ctdb_req_control *request)
2020 request->opcode = CTDB_CONTROL_RELOAD_PUBLIC_IPS;
2021 request->pad = 0;
2022 request->srvid = 0;
2023 request->client_id = 0;
2024 request->flags = 0;
2026 request->rdata.opcode = CTDB_CONTROL_RELOAD_PUBLIC_IPS;
2029 int ctdb_reply_control_reload_public_ips(struct ctdb_reply_control *reply)
2031 return ctdb_reply_control_generic(reply,
2032 CTDB_CONTROL_RELOAD_PUBLIC_IPS);
2035 /* CTDB_CONTROL_TRAVERSE_ALL_EXT */
2037 /* CTDB_CONTROL_RECEIVE_RECORDS */
2039 void ctdb_req_control_receive_records(struct ctdb_req_control *request,
2040 struct ctdb_rec_buffer *recbuf)
2042 request->opcode = CTDB_CONTROL_RECEIVE_RECORDS;
2043 request->pad = 0;
2044 request->srvid = 0;
2045 request->client_id = 0;
2046 request->flags = 0;
2048 request->rdata.opcode = CTDB_CONTROL_RECEIVE_RECORDS;
2049 request->rdata.data.recbuf = recbuf;
2052 int ctdb_reply_control_receive_records(struct ctdb_reply_control *reply,
2053 TALLOC_CTX *mem_ctx,
2054 struct ctdb_rec_buffer **recbuf)
2056 if (reply->rdata.opcode != CTDB_CONTROL_RECEIVE_RECORDS) {
2057 return EPROTO;
2060 if (reply->status == 0) {
2061 *recbuf = talloc_steal(mem_ctx, reply->rdata.data.recbuf);
2063 return reply->status;
2066 /* CTDB_CONTROL_IPREALLOCATED */
2068 void ctdb_req_control_ipreallocated(struct ctdb_req_control *request)
2070 request->opcode = CTDB_CONTROL_IPREALLOCATED;
2071 request->pad = 0;
2072 request->srvid = 0;
2073 request->client_id = 0;
2074 request->flags = 0;
2076 request->rdata.opcode = CTDB_CONTROL_IPREALLOCATED;
2079 int ctdb_reply_control_ipreallocated(struct ctdb_reply_control *reply)
2081 return ctdb_reply_control_generic(reply, CTDB_CONTROL_IPREALLOCATED);
2084 /* CTDB_CONTROL_GET_RUNSTATE */
2086 void ctdb_req_control_get_runstate(struct ctdb_req_control *request)
2088 request->opcode = CTDB_CONTROL_GET_RUNSTATE;
2089 request->pad = 0;
2090 request->srvid = 0;
2091 request->client_id = 0;
2092 request->flags = 0;
2094 request->rdata.opcode = CTDB_CONTROL_GET_RUNSTATE;
2097 int ctdb_reply_control_get_runstate(struct ctdb_reply_control *reply,
2098 enum ctdb_runstate *runstate)
2100 if (reply->rdata.opcode != CTDB_CONTROL_GET_RUNSTATE) {
2101 return EPROTO;
2104 if (reply->status == 0) {
2105 *runstate = reply->rdata.data.runstate;
2107 return reply->status;
2110 /* CTDB_CONTROL_DB_DETACH */
2112 void ctdb_req_control_db_detach(struct ctdb_req_control *request,
2113 uint32_t db_id)
2115 request->opcode = CTDB_CONTROL_DB_DETACH;
2116 request->pad = 0;
2117 request->srvid = 0;
2118 request->client_id = 0;
2119 request->flags = 0;
2121 request->rdata.opcode = CTDB_CONTROL_DB_DETACH;
2122 request->rdata.data.db_id = db_id;
2125 int ctdb_reply_control_db_detach(struct ctdb_reply_control *reply)
2127 return ctdb_reply_control_generic(reply, CTDB_CONTROL_DB_DETACH);
2130 /* CTDB_CONTROL_GET_NODES_FILE */
2132 void ctdb_req_control_get_nodes_file(struct ctdb_req_control *request)
2134 request->opcode = CTDB_CONTROL_GET_NODES_FILE;
2135 request->pad = 0;
2136 request->srvid = 0;
2137 request->client_id = 0;
2138 request->flags = 0;
2140 request->rdata.opcode = CTDB_CONTROL_GET_NODES_FILE;
2143 int ctdb_reply_control_get_nodes_file(struct ctdb_reply_control *reply,
2144 TALLOC_CTX *mem_ctx,
2145 struct ctdb_node_map **nodemap)
2147 if (reply->rdata.opcode != CTDB_CONTROL_GET_NODES_FILE) {
2148 return EPROTO;
2151 if (reply->status == 0) {
2152 *nodemap = talloc_steal(mem_ctx, reply->rdata.data.nodemap);
2154 return reply->status;
2157 /* CTDB_CONTROL_DB_FREEZE */
2159 void ctdb_req_control_db_freeze(struct ctdb_req_control *request,
2160 uint32_t db_id)
2162 request->opcode = CTDB_CONTROL_DB_FREEZE;
2163 request->pad = 0;
2164 request->srvid = 0;
2165 request->client_id = 0;
2166 request->flags = 0;
2168 request->rdata.opcode = CTDB_CONTROL_DB_FREEZE;
2169 request->rdata.data.db_id = db_id;
2172 int ctdb_reply_control_db_freeze(struct ctdb_reply_control *reply)
2174 return ctdb_reply_control_generic(reply, CTDB_CONTROL_DB_FREEZE);
2177 /* CTDB_CONTROL_DB_THAW */
2179 void ctdb_req_control_db_thaw(struct ctdb_req_control *request,
2180 uint32_t db_id)
2182 request->opcode = CTDB_CONTROL_DB_THAW;
2183 request->pad = 0;
2184 request->srvid = 0;
2185 request->client_id = 0;
2186 request->flags = 0;
2188 request->rdata.opcode = CTDB_CONTROL_DB_THAW;
2189 request->rdata.data.db_id = db_id;
2192 int ctdb_reply_control_db_thaw(struct ctdb_reply_control *reply)
2194 return ctdb_reply_control_generic(reply, CTDB_CONTROL_DB_THAW);
2197 /* CTDB_CONTROL_DB_TRANSACTION_START */
2199 void ctdb_req_control_db_transaction_start(struct ctdb_req_control *request,
2200 struct ctdb_transdb *transdb)
2202 request->opcode = CTDB_CONTROL_DB_TRANSACTION_START;
2203 request->pad = 0;
2204 request->srvid = 0;
2205 request->client_id = 0;
2206 request->flags = 0;
2208 request->rdata.opcode = CTDB_CONTROL_DB_TRANSACTION_START;
2209 request->rdata.data.transdb = transdb;
2212 int ctdb_reply_control_db_transaction_start(struct ctdb_reply_control *reply)
2214 return ctdb_reply_control_generic(reply,
2215 CTDB_CONTROL_DB_TRANSACTION_START);
2218 /* CTDB_CONTROL_DB_TRANSACTION_COMMIT */
2220 void ctdb_req_control_db_transaction_commit(struct ctdb_req_control *request,
2221 struct ctdb_transdb *transdb)
2223 request->opcode = CTDB_CONTROL_DB_TRANSACTION_COMMIT;
2224 request->pad = 0;
2225 request->srvid = 0;
2226 request->client_id = 0;
2227 request->flags = 0;
2229 request->rdata.opcode = CTDB_CONTROL_DB_TRANSACTION_COMMIT;
2230 request->rdata.data.transdb = transdb;
2233 int ctdb_reply_control_db_transaction_commit(struct ctdb_reply_control *reply)
2235 return ctdb_reply_control_generic(reply,
2236 CTDB_CONTROL_DB_TRANSACTION_COMMIT);
2239 /* CTDB_CONTROL_DB_TRANSACTION_CANCEL */
2241 void ctdb_req_control_db_transaction_cancel(struct ctdb_req_control *request,
2242 uint32_t db_id)
2244 request->opcode = CTDB_CONTROL_DB_TRANSACTION_CANCEL;
2245 request->pad = 0;
2246 request->srvid = 0;
2247 request->client_id = 0;
2248 request->flags = 0;
2250 request->rdata.opcode = CTDB_CONTROL_DB_TRANSACTION_CANCEL;
2251 request->rdata.data.db_id = db_id;
2254 int ctdb_reply_control_db_transaction_cancel(struct ctdb_reply_control *reply)
2256 return ctdb_reply_control_generic(reply,
2257 CTDB_CONTROL_DB_TRANSACTION_CANCEL);
2260 /* CTDB_CONTROL_DB_PULL */
2262 void ctdb_req_control_db_pull(struct ctdb_req_control *request,
2263 struct ctdb_pulldb_ext *pulldb_ext)
2265 request->opcode = CTDB_CONTROL_DB_PULL;
2266 request->pad = 0;
2267 request->srvid = 0;
2268 request->client_id = 0;
2269 request->flags = 0;
2271 request->rdata.opcode = CTDB_CONTROL_DB_PULL;
2272 request->rdata.data.pulldb_ext = pulldb_ext;
2275 int ctdb_reply_control_db_pull(struct ctdb_reply_control *reply,
2276 uint32_t *num_records)
2278 if (reply->rdata.opcode != CTDB_CONTROL_DB_PULL) {
2279 return EPROTO;
2282 if (reply->status == 0) {
2283 *num_records = reply->rdata.data.num_records;
2285 return reply->status;
2288 /* CTDB_CONTROL_DB_PUSH_START */
2290 void ctdb_req_control_db_push_start(struct ctdb_req_control *request,
2291 struct ctdb_pulldb_ext *pulldb_ext)
2293 request->opcode = CTDB_CONTROL_DB_PUSH_START;
2294 request->pad = 0;
2295 request->srvid = 0;
2296 request->client_id = 0;
2297 request->flags = 0;
2299 request->rdata.opcode = CTDB_CONTROL_DB_PUSH_START;
2300 request->rdata.data.pulldb_ext = pulldb_ext;
2303 int ctdb_reply_control_db_push_start(struct ctdb_reply_control *reply)
2305 return ctdb_reply_control_generic(reply, CTDB_CONTROL_DB_PUSH_START);
2308 /* CTDB_CONTROL_DB_PUSH_CONFIRM */
2310 void ctdb_req_control_db_push_confirm(struct ctdb_req_control *request,
2311 uint32_t db_id)
2313 request->opcode = CTDB_CONTROL_DB_PUSH_CONFIRM;
2314 request->pad = 0;
2315 request->srvid = 0;
2316 request->client_id = 0;
2317 request->flags = 0;
2319 request->rdata.opcode = CTDB_CONTROL_DB_PUSH_CONFIRM;
2320 request->rdata.data.db_id = db_id;
2323 int ctdb_reply_control_db_push_confirm(struct ctdb_reply_control *reply,
2324 uint32_t *num_records)
2326 if (reply->rdata.opcode != CTDB_CONTROL_DB_PUSH_CONFIRM) {
2327 return EPROTO;
2330 if (reply->status == 0) {
2331 *num_records = reply->rdata.data.num_records;
2333 return reply->status;