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/>.
21 #include "system/network.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;
39 c->calldata = tdb_null;
43 static int ctdb_reply_control_generic(struct ctdb_reply_control
*reply
,
46 if (reply
->rdata
.opcode
!= opcode
) {
53 /* CTDB_CONTROL_PROCESS_EXISTS */
55 void ctdb_req_control_process_exists(struct ctdb_req_control
*request
,
58 request
->opcode
= CTDB_CONTROL_PROCESS_EXISTS
;
61 request
->client_id
= 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
,
72 if (reply
->rdata
.opcode
!= CTDB_CONTROL_PROCESS_EXISTS
) {
76 *status
= reply
->status
;
82 /* CTDB_CONTROL_STATISTICS */
84 void ctdb_req_control_statistics(struct ctdb_req_control
*request
)
86 request
->opcode
= CTDB_CONTROL_STATISTICS
;
89 request
->client_id
= 0;
92 request
->rdata
.opcode
= CTDB_CONTROL_STATISTICS
;
95 int ctdb_reply_control_statistics(struct ctdb_reply_control
*reply
,
97 struct ctdb_statistics
**stats
)
99 if (reply
->rdata
.opcode
!= CTDB_CONTROL_STATISTICS
) {
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
;
116 request
->client_id
= 0;
119 request
->rdata
.opcode
= CTDB_CONTROL_PING
;
122 int ctdb_reply_control_ping(struct ctdb_reply_control
*reply
,
125 if (reply
->rdata
.opcode
!= CTDB_CONTROL_PING
) {
129 if (reply
->status
>= 0) {
130 *num_clients
= reply
->status
;
133 return reply
->status
;
136 /* CTDB_CONTROL_GETDBPATH */
138 void ctdb_req_control_getdbpath(struct ctdb_req_control
*request
,
141 request
->opcode
= CTDB_CONTROL_GETDBPATH
;
144 request
->client_id
= 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
) {
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
;
171 request
->client_id
= 0;
174 request
->rdata
.opcode
= CTDB_CONTROL_GETVNNMAP
;
177 int ctdb_reply_control_getvnnmap(struct ctdb_reply_control
*reply
,
179 struct ctdb_vnn_map
**vnnmap
)
181 if (reply
->rdata
.opcode
!= CTDB_CONTROL_GETVNNMAP
) {
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
;
199 request
->client_id
= 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
;
218 request
->client_id
= 0;
221 request
->rdata
.opcode
= CTDB_CONTROL_GET_DEBUG
;
224 int ctdb_reply_control_get_debug(struct ctdb_reply_control
*reply
,
227 if (reply
->rdata
.opcode
!= CTDB_CONTROL_GET_DEBUG
) {
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
,
242 request
->opcode
= CTDB_CONTROL_SET_DEBUG
;
245 request
->client_id
= 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
;
264 request
->client_id
= 0;
267 request
->rdata
.opcode
= CTDB_CONTROL_GET_DBMAP
;
270 int ctdb_reply_control_get_dbmap(struct ctdb_reply_control
*reply
,
272 struct ctdb_dbid_map
**dbmap
)
274 if (reply
->rdata
.opcode
!= CTDB_CONTROL_GET_DBMAP
) {
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
;
292 request
->client_id
= 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
,
301 struct ctdb_rec_buffer
**recbuf
)
303 if (reply
->rdata
.opcode
!= CTDB_CONTROL_PULL_DB
) {
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
;
321 request
->client_id
= 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
;
340 request
->client_id
= 0;
343 request
->rdata
.opcode
= CTDB_CONTROL_GET_RECMODE
;
346 int ctdb_reply_control_get_recmode(struct ctdb_reply_control
*reply
,
349 if (reply
->rdata
.opcode
!= CTDB_CONTROL_GET_RECMODE
) {
353 if (reply
->status
>= 0) {
354 *recmode
= reply
->status
;
357 return reply
->status
;
360 /* CTDB_CONTROL_SET_RECMODE */
362 void ctdb_req_control_set_recmode(struct ctdb_req_control
*request
,
365 request
->opcode
= CTDB_CONTROL_SET_RECMODE
;
368 request
->client_id
= 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
;
387 request
->client_id
= 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
,
404 request
->opcode
= CTDB_CONTROL_DB_ATTACH
;
407 request
->client_id
= 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
,
417 if (reply
->rdata
.opcode
!= CTDB_CONTROL_DB_ATTACH
) {
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
;
437 request
->client_id
= 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
,
457 request
->opcode
= CTDB_CONTROL_REGISTER_SRVID
;
459 request
->srvid
= srvid
;
460 request
->client_id
= 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
,
476 request
->opcode
= CTDB_CONTROL_DEREGISTER_SRVID
;
478 request
->srvid
= srvid
;
479 request
->client_id
= 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
,
496 request
->opcode
= CTDB_CONTROL_GET_DBNAME
;
499 request
->client_id
= 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
) {
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
,
524 request
->opcode
= CTDB_CONTROL_ENABLE_SEQNUM
;
527 request
->client_id
= 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
,
544 request
->opcode
= CTDB_CONTROL_UPDATE_SEQNUM
;
547 request
->client_id
= 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
;
566 request
->client_id
= 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
) {
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
;
592 request
->client_id
= 0;
595 request
->rdata
.opcode
= CTDB_CONTROL_GET_PID
;
598 int ctdb_reply_control_get_pid(struct ctdb_reply_control
*reply
,
601 if (reply
->rdata
.opcode
!= CTDB_CONTROL_GET_PID
) {
605 *pid
= reply
->status
;
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
;
618 request
->client_id
= 0;
621 request
->rdata
.opcode
= CTDB_CONTROL_GET_RECMASTER
;
624 int ctdb_reply_control_get_recmaster(struct ctdb_reply_control
*reply
,
627 if (reply
->rdata
.opcode
!= CTDB_CONTROL_GET_RECMASTER
) {
631 *recmaster
= reply
->status
;
634 return reply
->status
;
637 /* CTDB_CONTROL_SET_RECMASTER */
639 void ctdb_req_control_set_recmaster(struct ctdb_req_control
*request
,
642 request
->opcode
= CTDB_CONTROL_SET_RECMASTER
;
645 request
->client_id
= 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
,
662 request
->opcode
= CTDB_CONTROL_FREEZE
;
664 request
->srvid
= priority
;
665 request
->client_id
= 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
;
683 request
->client_id
= 0;
686 request
->rdata
.opcode
= CTDB_CONTROL_GET_PNN
;
689 int ctdb_reply_control_get_pnn(struct ctdb_reply_control
*reply
,
692 if (reply
->rdata
.opcode
!= CTDB_CONTROL_GET_PNN
) {
696 if (reply
->status
>= 0) {
697 *pnn
= reply
->status
;
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
;
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 /* CTDB_CONTROL_TCP_CLIENT */
725 void ctdb_req_control_tcp_client(struct ctdb_req_control
*request
,
726 struct ctdb_connection
*conn
)
728 request
->opcode
= CTDB_CONTROL_TCP_CLIENT
;
731 request
->client_id
= 0;
734 request
->rdata
.opcode
= CTDB_CONTROL_TCP_CLIENT
;
735 request
->rdata
.data
.conn
= conn
;
738 int ctdb_reply_control_tcp_client(struct ctdb_reply_control
*reply
)
740 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_TCP_CLIENT
);
743 /* CTDB_CONTROL_TCP_ADD */
745 void ctdb_req_control_tcp_add(struct ctdb_req_control
*request
,
746 struct ctdb_connection
*conn
)
748 request
->opcode
= CTDB_CONTROL_TCP_ADD
;
751 request
->client_id
= 0;
754 request
->rdata
.opcode
= CTDB_CONTROL_TCP_ADD
;
755 request
->rdata
.data
.conn
= conn
;
758 int ctdb_reply_control_tcp_add(struct ctdb_reply_control
*reply
)
760 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_TCP_ADD
);
763 /* CTDB_CONTROL_TCP_REMOVE */
765 void ctdb_req_control_tcp_remove(struct ctdb_req_control
*request
,
766 struct ctdb_connection
*conn
)
768 request
->opcode
= CTDB_CONTROL_TCP_REMOVE
;
771 request
->client_id
= 0;
774 request
->rdata
.opcode
= CTDB_CONTROL_TCP_REMOVE
;
775 request
->rdata
.data
.conn
= conn
;
778 int ctdb_reply_control_tcp_remove(struct ctdb_reply_control
*reply
)
780 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_TCP_REMOVE
);
783 /* CTDB_CONTROL_STARTUP */
785 void ctdb_req_control_startup(struct ctdb_req_control
*request
)
787 request
->opcode
= CTDB_CONTROL_STARTUP
;
790 request
->client_id
= 0;
793 request
->rdata
.opcode
= CTDB_CONTROL_STARTUP
;
796 int ctdb_reply_control_startup(struct ctdb_reply_control
*reply
)
798 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_STARTUP
);
801 /* CTDB_CONTROL_SET_TUNABLE */
803 void ctdb_req_control_set_tunable(struct ctdb_req_control
*request
,
804 struct ctdb_tunable
*tunable
)
806 request
->opcode
= CTDB_CONTROL_SET_TUNABLE
;
809 request
->client_id
= 0;
812 request
->rdata
.opcode
= CTDB_CONTROL_SET_TUNABLE
;
813 request
->rdata
.data
.tunable
= tunable
;
816 int ctdb_reply_control_set_tunable(struct ctdb_reply_control
*reply
)
818 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_SET_TUNABLE
);
821 /* CTDB_CONTROL_GET_TUNABLE */
823 void ctdb_req_control_get_tunable(struct ctdb_req_control
*request
,
826 request
->opcode
= CTDB_CONTROL_GET_TUNABLE
;
829 request
->client_id
= 0;
832 request
->rdata
.opcode
= CTDB_CONTROL_GET_TUNABLE
;
833 request
->rdata
.data
.tun_var
= discard_const(name
);
836 int ctdb_reply_control_get_tunable(struct ctdb_reply_control
*reply
,
839 if (reply
->rdata
.opcode
!= CTDB_CONTROL_GET_TUNABLE
) {
843 if (reply
->status
== 0) {
844 *value
= reply
->rdata
.data
.tun_value
;
846 return reply
->status
;
849 /* CTDB_CONTROL_LIST_TUNABLES */
851 void ctdb_req_control_list_tunables(struct ctdb_req_control
*request
)
853 request
->opcode
= CTDB_CONTROL_LIST_TUNABLES
;
856 request
->client_id
= 0;
859 request
->rdata
.opcode
= CTDB_CONTROL_LIST_TUNABLES
;
862 int ctdb_reply_control_list_tunables(struct ctdb_reply_control
*reply
,
864 struct ctdb_var_list
**tun_var_list
)
866 if (reply
->rdata
.opcode
!= CTDB_CONTROL_LIST_TUNABLES
) {
870 if (reply
->status
== 0) {
871 *tun_var_list
= talloc_steal(mem_ctx
,
872 reply
->rdata
.data
.tun_var_list
);
874 return reply
->status
;
877 /* CTDB_CONTROL_MODIFY_FLAGS */
879 void ctdb_req_control_modify_flags(struct ctdb_req_control
*request
,
880 struct ctdb_node_flag_change
*flag_change
)
882 request
->opcode
= CTDB_CONTROL_MODIFY_FLAGS
;
885 request
->client_id
= 0;
888 request
->rdata
.opcode
= CTDB_CONTROL_MODIFY_FLAGS
;
889 request
->rdata
.data
.flag_change
= flag_change
;
892 int ctdb_reply_control_modify_flags(struct ctdb_reply_control
*reply
)
894 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_MODIFY_FLAGS
);
897 /* CTDB_CONTROL_GET_ALL_TUNABLES */
899 void ctdb_req_control_get_all_tunables(struct ctdb_req_control
*request
)
901 request
->opcode
= CTDB_CONTROL_GET_ALL_TUNABLES
;
904 request
->client_id
= 0;
907 request
->rdata
.opcode
= CTDB_CONTROL_GET_ALL_TUNABLES
;
910 int ctdb_reply_control_get_all_tunables(struct ctdb_reply_control
*reply
,
912 struct ctdb_tunable_list
**tun_list
)
914 if (reply
->rdata
.opcode
!= CTDB_CONTROL_GET_ALL_TUNABLES
) {
918 if (reply
->status
== 0) {
919 *tun_list
= talloc_steal(mem_ctx
, reply
->rdata
.data
.tun_list
);
921 return reply
->status
;
924 /* CTDB_CONTROL_GET_TCP_TICKLE_LIST */
926 void ctdb_req_control_get_tcp_tickle_list(struct ctdb_req_control
*request
,
927 ctdb_sock_addr
*addr
)
929 request
->opcode
= CTDB_CONTROL_GET_TCP_TICKLE_LIST
;
932 request
->client_id
= 0;
935 request
->rdata
.opcode
= CTDB_CONTROL_GET_TCP_TICKLE_LIST
;
936 request
->rdata
.data
.addr
= addr
;
939 int ctdb_reply_control_get_tcp_tickle_list(struct ctdb_reply_control
*reply
,
941 struct ctdb_tickle_list
**tickles
)
943 if (reply
->rdata
.opcode
!= CTDB_CONTROL_GET_TCP_TICKLE_LIST
) {
947 if (reply
->status
== 0) {
948 *tickles
= talloc_steal(mem_ctx
, reply
->rdata
.data
.tickles
);
950 return reply
->status
;
953 /* CTDB_CONTROL_SET_TCP_TICKLE_LIST */
955 void ctdb_req_control_set_tcp_tickle_list(struct ctdb_req_control
*request
,
956 struct ctdb_tickle_list
*tickles
)
958 request
->opcode
= CTDB_CONTROL_SET_TCP_TICKLE_LIST
;
961 request
->client_id
= 0;
964 request
->rdata
.opcode
= CTDB_CONTROL_SET_TCP_TICKLE_LIST
;
965 request
->rdata
.data
.tickles
= tickles
;
968 int ctdb_reply_control_set_tcp_tickle_list(struct ctdb_reply_control
*reply
)
970 return ctdb_reply_control_generic(reply
,
971 CTDB_CONTROL_SET_TCP_TICKLE_LIST
);
974 /* CTDB_CONTROL_DB_ATTACH_PERSISTENT */
976 void ctdb_req_control_db_attach_persistent(struct ctdb_req_control
*request
,
979 request
->opcode
= CTDB_CONTROL_DB_ATTACH_PERSISTENT
;
982 request
->client_id
= 0;
985 request
->rdata
.opcode
= CTDB_CONTROL_DB_ATTACH_PERSISTENT
;
986 request
->rdata
.data
.db_name
= db_name
;
989 int ctdb_reply_control_db_attach_persistent(struct ctdb_reply_control
*reply
,
992 if (reply
->rdata
.opcode
!= CTDB_CONTROL_DB_ATTACH_PERSISTENT
) {
996 if (reply
->status
== 0) {
997 *db_id
= reply
->rdata
.data
.db_id
;
999 return reply
->status
;
1002 /* CTDB_CONTROL_UPDATE_RECORD */
1004 void ctdb_req_control_update_record(struct ctdb_req_control
*request
,
1005 struct ctdb_rec_buffer
*recbuf
)
1007 request
->opcode
= CTDB_CONTROL_UPDATE_RECORD
;
1010 request
->client_id
= 0;
1013 request
->rdata
.opcode
= CTDB_CONTROL_UPDATE_RECORD
;
1014 request
->rdata
.data
.recbuf
= recbuf
;
1017 int ctdb_reply_control_update_record(struct ctdb_reply_control
*reply
)
1019 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_UPDATE_RECORD
);
1022 /* CTDB_CONTROL_SEND_GRATUITOUS_ARP */
1024 void ctdb_req_control_send_gratuitous_arp(struct ctdb_req_control
*request
,
1025 struct ctdb_addr_info
*addr_info
)
1027 request
->opcode
= CTDB_CONTROL_SEND_GRATUITOUS_ARP
;
1030 request
->client_id
= 0;
1033 request
->rdata
.opcode
= CTDB_CONTROL_SEND_GRATUITOUS_ARP
;
1034 request
->rdata
.data
.addr_info
= addr_info
;
1037 int ctdb_reply_control_send_gratuitous_arp(struct ctdb_reply_control
*reply
)
1039 return ctdb_reply_control_generic(reply
,
1040 CTDB_CONTROL_SEND_GRATUITOUS_ARP
);
1043 /* CTDB_CONTROL_WIPE_DATABASE */
1045 void ctdb_req_control_wipe_database(struct ctdb_req_control
*request
,
1046 struct ctdb_transdb
*transdb
)
1048 request
->opcode
= CTDB_CONTROL_WIPE_DATABASE
;
1051 request
->client_id
= 0;
1054 request
->rdata
.opcode
= CTDB_CONTROL_WIPE_DATABASE
;
1055 request
->rdata
.data
.transdb
= transdb
;
1058 int ctdb_reply_control_wipe_database(struct ctdb_reply_control
*reply
)
1060 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_WIPE_DATABASE
);
1063 /* CTDB_CONTROL_UPTIME */
1065 void ctdb_req_control_uptime(struct ctdb_req_control
*request
)
1067 request
->opcode
= CTDB_CONTROL_UPTIME
;
1070 request
->client_id
= 0;
1073 request
->rdata
.opcode
= CTDB_CONTROL_UPTIME
;
1076 int ctdb_reply_control_uptime(struct ctdb_reply_control
*reply
,
1077 TALLOC_CTX
*mem_ctx
, struct ctdb_uptime
**uptime
)
1079 if (reply
->rdata
.opcode
!= CTDB_CONTROL_UPTIME
) {
1083 if (reply
->status
== 0) {
1084 *uptime
= talloc_steal(mem_ctx
, reply
->rdata
.data
.uptime
);
1086 return reply
->status
;
1089 /* CTDB_CONTROL_START_RECOVERY */
1091 void ctdb_req_control_start_recovery(struct ctdb_req_control
*request
)
1093 request
->opcode
= CTDB_CONTROL_START_RECOVERY
;
1096 request
->client_id
= 0;
1099 request
->rdata
.opcode
= CTDB_CONTROL_START_RECOVERY
;
1102 int ctdb_reply_control_start_recovery(struct ctdb_reply_control
*reply
)
1104 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_START_RECOVERY
);
1107 /* CTDB_CONTROL_END_RECOVERY */
1109 void ctdb_req_control_end_recovery(struct ctdb_req_control
*request
)
1111 request
->opcode
= CTDB_CONTROL_END_RECOVERY
;
1114 request
->client_id
= 0;
1117 request
->rdata
.opcode
= CTDB_CONTROL_END_RECOVERY
;
1120 int ctdb_reply_control_end_recovery(struct ctdb_reply_control
*reply
)
1122 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_END_RECOVERY
);
1125 /* CTDB_CONTROL_RELOAD_NODES_FILE */
1127 void ctdb_req_control_reload_nodes_file(struct ctdb_req_control
*request
)
1129 request
->opcode
= CTDB_CONTROL_RELOAD_NODES_FILE
;
1132 request
->client_id
= 0;
1135 request
->rdata
.opcode
= CTDB_CONTROL_RELOAD_NODES_FILE
;
1138 int ctdb_reply_control_reload_nodes_file(struct ctdb_reply_control
*reply
)
1140 return ctdb_reply_control_generic(reply
,
1141 CTDB_CONTROL_RELOAD_NODES_FILE
);
1144 /* CTDB_CONTROL_TRY_DELETE_RECORDS */
1146 void ctdb_req_control_try_delete_records(struct ctdb_req_control
*request
,
1147 struct ctdb_rec_buffer
*recbuf
)
1149 request
->opcode
= CTDB_CONTROL_TRY_DELETE_RECORDS
;
1152 request
->client_id
= 0;
1155 request
->rdata
.opcode
= CTDB_CONTROL_TRY_DELETE_RECORDS
;
1156 request
->rdata
.data
.recbuf
= recbuf
;
1159 int ctdb_reply_control_try_delete_records(struct ctdb_reply_control
*reply
,
1160 TALLOC_CTX
*mem_ctx
,
1161 struct ctdb_rec_buffer
**recbuf
)
1163 if (reply
->rdata
.opcode
!= CTDB_CONTROL_TRY_DELETE_RECORDS
) {
1167 if (reply
->status
== 0) {
1168 *recbuf
= talloc_steal(mem_ctx
, reply
->rdata
.data
.recbuf
);
1170 return reply
->status
;
1173 /* CTDB_CONTROL_ENABLE_MONITOR */
1174 /* CTDB_CONTROL_DISABLE_MONITOR */
1176 /* CTDB_CONTROL_ADD_PUBLIC_IP */
1178 void ctdb_req_control_add_public_ip(struct ctdb_req_control
*request
,
1179 struct ctdb_addr_info
*addr_info
)
1181 request
->opcode
= CTDB_CONTROL_ADD_PUBLIC_IP
;
1184 request
->client_id
= 0;
1187 request
->rdata
.opcode
= CTDB_CONTROL_ADD_PUBLIC_IP
;
1188 request
->rdata
.data
.addr_info
= addr_info
;
1191 int ctdb_reply_control_add_public_ip(struct ctdb_reply_control
*reply
)
1193 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_ADD_PUBLIC_IP
);
1196 /* CTDB_CONTROL_DEL_PUBLIC_IP */
1198 void ctdb_req_control_del_public_ip(struct ctdb_req_control
*request
,
1199 struct ctdb_addr_info
*addr_info
)
1201 request
->opcode
= CTDB_CONTROL_DEL_PUBLIC_IP
;
1204 request
->client_id
= 0;
1207 request
->rdata
.opcode
= CTDB_CONTROL_DEL_PUBLIC_IP
;
1208 request
->rdata
.data
.addr_info
= addr_info
;
1211 int ctdb_reply_control_del_public_ip(struct ctdb_reply_control
*reply
)
1213 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_DEL_PUBLIC_IP
);
1216 /* CTDB_CONTROL_GET_CAPABILITIES */
1218 void ctdb_req_control_get_capabilities(struct ctdb_req_control
*request
)
1220 request
->opcode
= CTDB_CONTROL_GET_CAPABILITIES
;
1223 request
->client_id
= 0;
1226 request
->rdata
.opcode
= CTDB_CONTROL_GET_CAPABILITIES
;
1229 int ctdb_reply_control_get_capabilities(struct ctdb_reply_control
*reply
,
1232 if (reply
->rdata
.opcode
!= CTDB_CONTROL_GET_CAPABILITIES
) {
1236 if (reply
->status
== 0) {
1237 *caps
= reply
->rdata
.data
.caps
;
1239 return reply
->status
;
1242 /* CTDB_CONTROL_RECD_PING */
1244 void ctdb_req_control_recd_ping(struct ctdb_req_control
*request
)
1246 request
->opcode
= CTDB_CONTROL_RECD_PING
;
1249 request
->client_id
= 0;
1252 request
->rdata
.opcode
= CTDB_CONTROL_RECD_PING
;
1255 int ctdb_reply_control_recd_ping(struct ctdb_reply_control
*reply
)
1257 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_RECD_PING
);
1260 /* CTDB_CONTROL_RELEASE_IP */
1262 void ctdb_req_control_release_ip(struct ctdb_req_control
*request
,
1263 struct ctdb_public_ip
*pubip
)
1265 request
->opcode
= CTDB_CONTROL_RELEASE_IP
;
1268 request
->client_id
= 0;
1271 request
->rdata
.opcode
= CTDB_CONTROL_RELEASE_IP
;
1272 request
->rdata
.data
.pubip
= pubip
;
1275 int ctdb_reply_control_release_ip(struct ctdb_reply_control
*reply
)
1277 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_RELEASE_IP
);
1280 /* CTDB_CONTROL_TAKEOVER_IP */
1282 void ctdb_req_control_takeover_ip(struct ctdb_req_control
*request
,
1283 struct ctdb_public_ip
*pubip
)
1285 request
->opcode
= CTDB_CONTROL_TAKEOVER_IP
;
1288 request
->client_id
= 0;
1291 request
->rdata
.opcode
= CTDB_CONTROL_TAKEOVER_IP
;
1292 request
->rdata
.data
.pubip
= pubip
;
1295 int ctdb_reply_control_takeover_ip(struct ctdb_reply_control
*reply
)
1297 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_TAKEOVER_IP
);
1300 /* CTDB_CONTROL_GET_PUBLIC_IPS */
1302 void ctdb_req_control_get_public_ips(struct ctdb_req_control
*request
,
1303 bool available_only
)
1305 request
->opcode
= CTDB_CONTROL_GET_PUBLIC_IPS
;
1308 request
->client_id
= 0;
1311 request
->rdata
.opcode
= CTDB_CONTROL_GET_PUBLIC_IPS
;
1312 if (available_only
) {
1313 request
->flags
= CTDB_PUBLIC_IP_FLAGS_ONLY_AVAILABLE
;
1317 int ctdb_reply_control_get_public_ips(struct ctdb_reply_control
*reply
,
1318 TALLOC_CTX
*mem_ctx
,
1319 struct ctdb_public_ip_list
**pubip_list
)
1321 if (reply
->rdata
.opcode
!= CTDB_CONTROL_GET_PUBLIC_IPS
) {
1325 if (reply
->status
== 0) {
1326 *pubip_list
= talloc_steal(mem_ctx
,
1327 reply
->rdata
.data
.pubip_list
);
1329 return reply
->status
;
1332 /* CTDB_CONTROL_GET_NODEMAP */
1334 void ctdb_req_control_get_nodemap(struct ctdb_req_control
*request
)
1336 request
->opcode
= CTDB_CONTROL_GET_NODEMAP
;
1339 request
->client_id
= 0;
1342 request
->rdata
.opcode
= CTDB_CONTROL_GET_NODEMAP
;
1345 int ctdb_reply_control_get_nodemap(struct ctdb_reply_control
*reply
,
1346 TALLOC_CTX
*mem_ctx
,
1347 struct ctdb_node_map
**nodemap
)
1349 if (reply
->rdata
.opcode
!= CTDB_CONTROL_GET_NODEMAP
) {
1353 if (reply
->status
== 0) {
1354 *nodemap
= talloc_steal(mem_ctx
, reply
->rdata
.data
.nodemap
);
1356 return reply
->status
;
1359 /* CTDB_CONTROL_TRAVERSE_KILL */
1361 void ctdb_req_control_traverse_kill(struct ctdb_req_control
*request
,
1362 struct ctdb_traverse_start
*traverse
)
1364 request
->opcode
= CTDB_CONTROL_TRAVERSE_KILL
;
1367 request
->client_id
= 0;
1370 request
->rdata
.opcode
= CTDB_CONTROL_TRAVERSE_KILL
;
1371 request
->rdata
.data
.traverse_start
= traverse
;
1374 int ctdb_reply_control_traverse_kill(struct ctdb_reply_control
*reply
)
1376 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_TRAVERSE_KILL
);
1379 /* CTDB_CONTROL_RECD_RECLOCK_LATENCY */
1381 void ctdb_req_control_recd_reclock_latency(struct ctdb_req_control
*request
,
1382 double reclock_latency
)
1384 request
->opcode
= CTDB_CONTROL_RECD_RECLOCK_LATENCY
;
1387 request
->client_id
= 0;
1390 request
->rdata
.opcode
= CTDB_CONTROL_RECD_RECLOCK_LATENCY
;
1391 request
->rdata
.data
.reclock_latency
= reclock_latency
;
1394 int ctdb_reply_control_recd_reclock_latency(struct ctdb_reply_control
*reply
)
1396 return ctdb_reply_control_generic(reply
,
1397 CTDB_CONTROL_RECD_RECLOCK_LATENCY
);
1400 /* CTDB_CONTROL_GET_RECLOCK_FILE */
1402 void ctdb_req_control_get_reclock_file(struct ctdb_req_control
*request
)
1404 request
->opcode
= CTDB_CONTROL_GET_RECLOCK_FILE
;
1407 request
->client_id
= 0;
1410 request
->rdata
.opcode
= CTDB_CONTROL_GET_RECLOCK_FILE
;
1413 int ctdb_reply_control_get_reclock_file(struct ctdb_reply_control
*reply
,
1414 TALLOC_CTX
*mem_ctx
,
1415 const char **reclock_file
)
1417 if (reply
->rdata
.opcode
!= CTDB_CONTROL_GET_RECLOCK_FILE
) {
1421 if (reply
->status
== 0) {
1422 *reclock_file
= talloc_steal(mem_ctx
,
1423 reply
->rdata
.data
.reclock_file
);
1425 return reply
->status
;
1428 /* CTDB_CONTROL_STOP_NODE */
1430 void ctdb_req_control_stop_node(struct ctdb_req_control
*request
)
1432 request
->opcode
= CTDB_CONTROL_STOP_NODE
;
1435 request
->client_id
= 0;
1438 request
->rdata
.opcode
= CTDB_CONTROL_STOP_NODE
;
1441 int ctdb_reply_control_stop_node(struct ctdb_reply_control
*reply
)
1443 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_STOP_NODE
);
1446 /* CTDB_CONTROL_CONTINUE_NODE */
1448 void ctdb_req_control_continue_node(struct ctdb_req_control
*request
)
1450 request
->opcode
= CTDB_CONTROL_CONTINUE_NODE
;
1453 request
->client_id
= 0;
1456 request
->rdata
.opcode
= CTDB_CONTROL_CONTINUE_NODE
;
1459 int ctdb_reply_control_continue_node(struct ctdb_reply_control
*reply
)
1461 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_CONTINUE_NODE
);
1464 /* CTDB_CONTROL_SET_LMASTERROLE */
1466 void ctdb_req_control_set_lmasterrole(struct ctdb_req_control
*request
,
1467 uint32_t lmaster_role
)
1469 request
->opcode
= CTDB_CONTROL_SET_LMASTERROLE
;
1472 request
->client_id
= 0;
1475 request
->rdata
.opcode
= CTDB_CONTROL_SET_LMASTERROLE
;
1476 request
->rdata
.data
.role
= lmaster_role
;
1479 int ctdb_reply_control_set_lmasterrole(struct ctdb_reply_control
*reply
)
1481 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_SET_LMASTERROLE
);
1484 /* CTDB_CONTROL_SET_RECMASTERROLE */
1486 void ctdb_req_control_set_recmasterrole(struct ctdb_req_control
*request
,
1487 uint32_t recmaster_role
)
1489 request
->opcode
= CTDB_CONTROL_SET_RECMASTERROLE
;
1492 request
->client_id
= 0;
1495 request
->rdata
.opcode
= CTDB_CONTROL_SET_RECMASTERROLE
;
1496 request
->rdata
.data
.role
= recmaster_role
;
1499 int ctdb_reply_control_set_recmasterrole(struct ctdb_reply_control
*reply
)
1501 return ctdb_reply_control_generic(reply
,
1502 CTDB_CONTROL_SET_RECMASTERROLE
);
1505 /* CTDB_CONTROL_SET_BAN_STATE */
1507 void ctdb_req_control_set_ban_state(struct ctdb_req_control
*request
,
1508 struct ctdb_ban_state
*ban_state
)
1510 request
->opcode
= CTDB_CONTROL_SET_BAN_STATE
;
1513 request
->client_id
= 0;
1516 request
->rdata
.opcode
= CTDB_CONTROL_SET_BAN_STATE
;
1517 request
->rdata
.data
.ban_state
= ban_state
;
1520 int ctdb_reply_control_set_ban_state(struct ctdb_reply_control
*reply
)
1522 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_SET_BAN_STATE
);
1525 /* CTDB_CONTROL_GET_BAN_STATE */
1527 void ctdb_req_control_get_ban_state(struct ctdb_req_control
*request
)
1529 request
->opcode
= CTDB_CONTROL_GET_BAN_STATE
;
1532 request
->client_id
= 0;
1535 request
->rdata
.opcode
= CTDB_CONTROL_GET_BAN_STATE
;
1538 int ctdb_reply_control_get_ban_state(struct ctdb_reply_control
*reply
,
1539 TALLOC_CTX
*mem_ctx
,
1540 struct ctdb_ban_state
**ban_state
)
1542 if (reply
->rdata
.opcode
!= CTDB_CONTROL_GET_BAN_STATE
) {
1546 if (reply
->status
== 0) {
1547 *ban_state
= talloc_steal(mem_ctx
,
1548 reply
->rdata
.data
.ban_state
);
1550 return reply
->status
;
1553 /* CTDB_CONTROL_REGISTER_NOTIFY */
1555 void ctdb_req_control_register_notify(struct ctdb_req_control
*request
,
1556 struct ctdb_notify_data
*notify
)
1558 request
->opcode
= CTDB_CONTROL_REGISTER_NOTIFY
;
1561 request
->client_id
= 0;
1564 request
->rdata
.opcode
= CTDB_CONTROL_REGISTER_NOTIFY
;
1565 request
->rdata
.data
.notify
= notify
;
1568 int ctdb_reply_control_register_notify(struct ctdb_reply_control
*reply
)
1570 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_REGISTER_NOTIFY
);
1573 /* CTDB_CONTROL_DEREGISTER_NOTIFY */
1575 void ctdb_req_control_deregister_notify(struct ctdb_req_control
*request
,
1578 request
->opcode
= CTDB_CONTROL_DEREGISTER_NOTIFY
;
1581 request
->client_id
= 0;
1584 request
->rdata
.opcode
= CTDB_CONTROL_DEREGISTER_NOTIFY
;
1585 request
->rdata
.data
.srvid
= srvid
;
1588 int ctdb_reply_control_deregister_notify(struct ctdb_reply_control
*reply
)
1590 return ctdb_reply_control_generic(reply
,
1591 CTDB_CONTROL_DEREGISTER_NOTIFY
);
1594 /* CTDB_CONTROL_TRANS3_COMMIT */
1596 void ctdb_req_control_trans3_commit(struct ctdb_req_control
*request
,
1597 struct ctdb_rec_buffer
*recbuf
)
1599 request
->opcode
= CTDB_CONTROL_TRANS3_COMMIT
;
1602 request
->client_id
= 0;
1605 request
->rdata
.opcode
= CTDB_CONTROL_TRANS3_COMMIT
;
1606 request
->rdata
.data
.recbuf
= recbuf
;
1609 int ctdb_reply_control_trans3_commit(struct ctdb_reply_control
*reply
)
1611 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_TRANS3_COMMIT
);
1614 /* CTDB_CONTROL_GET_DB_SEQNUM */
1616 void ctdb_req_control_get_db_seqnum(struct ctdb_req_control
*request
,
1619 request
->opcode
= CTDB_CONTROL_GET_DB_SEQNUM
;
1622 request
->client_id
= 0;
1625 request
->rdata
.opcode
= CTDB_CONTROL_GET_DB_SEQNUM
;
1626 request
->rdata
.data
.db_id
= db_id
;
1629 int ctdb_reply_control_get_db_seqnum(struct ctdb_reply_control
*reply
,
1632 if (reply
->rdata
.opcode
!= CTDB_CONTROL_GET_DB_SEQNUM
) {
1636 if (reply
->status
== 0) {
1637 *seqnum
= reply
->rdata
.data
.seqnum
;
1639 return reply
->status
;
1642 /* CTDB_CONTROL_DB_SET_HEALTHY */
1644 void ctdb_req_control_db_set_healthy(struct ctdb_req_control
*request
,
1647 request
->opcode
= CTDB_CONTROL_DB_SET_HEALTHY
;
1650 request
->client_id
= 0;
1653 request
->rdata
.opcode
= CTDB_CONTROL_DB_SET_HEALTHY
;
1654 request
->rdata
.data
.db_id
= db_id
;
1657 int ctdb_reply_control_db_set_healthy(struct ctdb_reply_control
*reply
)
1659 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_DB_SET_HEALTHY
);
1662 /* CTDB_CONTROL_DB_GET_HEALTH */
1664 void ctdb_req_control_db_get_health(struct ctdb_req_control
*request
,
1667 request
->opcode
= CTDB_CONTROL_DB_GET_HEALTH
;
1670 request
->client_id
= 0;
1673 request
->rdata
.opcode
= CTDB_CONTROL_DB_GET_HEALTH
;
1674 request
->rdata
.data
.db_id
= db_id
;
1677 int ctdb_reply_control_db_get_health(struct ctdb_reply_control
*reply
,
1678 TALLOC_CTX
*mem_ctx
, const char **reason
)
1680 if (reply
->rdata
.opcode
!= CTDB_CONTROL_DB_GET_HEALTH
) {
1684 if (reply
->status
== 0) {
1685 *reason
= talloc_steal(mem_ctx
, reply
->rdata
.data
.reason
);
1687 return reply
->status
;
1690 /* CTDB_CONTROL_GET_PUBLIC_IP_INFO */
1692 void ctdb_req_control_get_public_ip_info(struct ctdb_req_control
*request
,
1693 ctdb_sock_addr
*addr
)
1695 request
->opcode
= CTDB_CONTROL_GET_PUBLIC_IP_INFO
;
1698 request
->client_id
= 0;
1701 request
->rdata
.opcode
= CTDB_CONTROL_GET_PUBLIC_IP_INFO
;
1702 request
->rdata
.data
.addr
= addr
;
1705 int ctdb_reply_control_get_public_ip_info(struct ctdb_reply_control
*reply
,
1706 TALLOC_CTX
*mem_ctx
,
1707 struct ctdb_public_ip_info
**ipinfo
)
1709 if (reply
->rdata
.opcode
!= CTDB_CONTROL_GET_PUBLIC_IP_INFO
) {
1713 if (reply
->status
== 0) {
1714 *ipinfo
= talloc_steal(mem_ctx
, reply
->rdata
.data
.ipinfo
);
1716 return reply
->status
;
1719 /* CTDB_CONTROL_GET_IFACES */
1721 void ctdb_req_control_get_ifaces(struct ctdb_req_control
*request
)
1723 request
->opcode
= CTDB_CONTROL_GET_IFACES
;
1726 request
->client_id
= 0;
1729 request
->rdata
.opcode
= CTDB_CONTROL_GET_IFACES
;
1732 int ctdb_reply_control_get_ifaces(struct ctdb_reply_control
*reply
,
1733 TALLOC_CTX
*mem_ctx
,
1734 struct ctdb_iface_list
**iface_list
)
1736 if (reply
->rdata
.opcode
!= CTDB_CONTROL_GET_IFACES
) {
1740 if (reply
->status
== 0) {
1741 *iface_list
= talloc_steal(mem_ctx
,
1742 reply
->rdata
.data
.iface_list
);
1744 return reply
->status
;
1747 /* CTDB_CONTROL_SET_IFACE_LINK_STATE */
1749 void ctdb_req_control_set_iface_link_state(struct ctdb_req_control
*request
,
1750 struct ctdb_iface
*iface
)
1752 request
->opcode
= CTDB_CONTROL_SET_IFACE_LINK_STATE
;
1755 request
->client_id
= 0;
1758 request
->rdata
.opcode
= CTDB_CONTROL_SET_IFACE_LINK_STATE
;
1759 request
->rdata
.data
.iface
= iface
;
1762 int ctdb_reply_control_set_iface_link_state(struct ctdb_reply_control
*reply
)
1764 return ctdb_reply_control_generic(reply
,
1765 CTDB_CONTROL_SET_IFACE_LINK_STATE
);
1768 /* CTDB_CONTROL_TCP_ADD_DELAYED_UPDATE */
1770 void ctdb_req_control_tcp_add_delayed_update(struct ctdb_req_control
*request
,
1771 struct ctdb_connection
*conn
)
1773 request
->opcode
= CTDB_CONTROL_TCP_ADD_DELAYED_UPDATE
;
1776 request
->client_id
= 0;
1779 request
->rdata
.opcode
= CTDB_CONTROL_TCP_ADD_DELAYED_UPDATE
;
1780 request
->rdata
.data
.conn
= conn
;
1783 int ctdb_reply_control_tcp_add_delayed_update(struct ctdb_reply_control
*reply
)
1785 return ctdb_reply_control_generic(reply
,
1786 CTDB_CONTROL_TCP_ADD_DELAYED_UPDATE
);
1789 /* CTDB_CONTROL_GET_STAT_HISTORY */
1791 void ctdb_req_control_get_stat_history(struct ctdb_req_control
*request
)
1793 request
->opcode
= CTDB_CONTROL_GET_STAT_HISTORY
;
1796 request
->client_id
= 0;
1799 request
->rdata
.opcode
= CTDB_CONTROL_GET_STAT_HISTORY
;
1802 int ctdb_reply_control_get_stat_history(struct ctdb_reply_control
*reply
,
1803 TALLOC_CTX
*mem_ctx
,
1804 struct ctdb_statistics_list
**stats_list
)
1806 if (reply
->rdata
.opcode
!= CTDB_CONTROL_GET_STAT_HISTORY
) {
1810 if (reply
->status
== 0) {
1811 *stats_list
= talloc_steal(mem_ctx
,
1812 reply
->rdata
.data
.stats_list
);
1814 return reply
->status
;
1817 /* CTDB_CONTROL_SCHEDULE_FOR_DELETION */
1819 void ctdb_req_control_schedule_for_deletion(struct ctdb_req_control
*request
,
1820 struct ctdb_key_data
*key
)
1822 request
->opcode
= CTDB_CONTROL_SCHEDULE_FOR_DELETION
;
1825 request
->client_id
= 0;
1828 request
->rdata
.opcode
= CTDB_CONTROL_SCHEDULE_FOR_DELETION
;
1829 request
->rdata
.data
.key
= key
;
1832 int ctdb_reply_control_schedule_for_deletion(struct ctdb_reply_control
*reply
)
1834 return ctdb_reply_control_generic(reply
,
1835 CTDB_CONTROL_SCHEDULE_FOR_DELETION
);
1838 /* CTDB_CONTROL_SET_DB_READONLY */
1840 void ctdb_req_control_set_db_readonly(struct ctdb_req_control
*request
,
1843 request
->opcode
= CTDB_CONTROL_SET_DB_READONLY
;
1846 request
->client_id
= 0;
1849 request
->rdata
.opcode
= CTDB_CONTROL_SET_DB_READONLY
;
1850 request
->rdata
.data
.db_id
= db_id
;
1853 int ctdb_reply_control_set_db_readonly(struct ctdb_reply_control
*reply
)
1855 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_SET_DB_READONLY
);
1858 /* CTDB_CONTROL_CHECK_SRVIDS */
1860 /* CTDB_CONTROL_TRAVERSE_START_EXT */
1862 void ctdb_req_control_traverse_start_ext(struct ctdb_req_control
*request
,
1863 struct ctdb_traverse_start_ext
*traverse
)
1865 request
->opcode
= CTDB_CONTROL_TRAVERSE_START_EXT
;
1868 request
->client_id
= 0;
1871 request
->rdata
.opcode
= CTDB_CONTROL_TRAVERSE_START_EXT
;
1872 request
->rdata
.data
.traverse_start_ext
= traverse
;
1875 int ctdb_reply_control_traverse_start_ext(struct ctdb_reply_control
*reply
)
1877 return ctdb_reply_control_generic(reply
,
1878 CTDB_CONTROL_TRAVERSE_START_EXT
);
1881 /* CTDB_CONTROL_GET_DB_STATISTICS */
1883 void ctdb_req_control_get_db_statistics(struct ctdb_req_control
*request
,
1886 request
->opcode
= CTDB_CONTROL_GET_DB_STATISTICS
;
1889 request
->client_id
= 0;
1892 request
->rdata
.opcode
= CTDB_CONTROL_GET_DB_STATISTICS
;
1893 request
->rdata
.data
.db_id
= db_id
;
1896 int ctdb_reply_control_get_db_statistics(struct ctdb_reply_control
*reply
,
1897 TALLOC_CTX
*mem_ctx
,
1898 struct ctdb_db_statistics
**dbstats
)
1900 if (reply
->rdata
.opcode
!= CTDB_CONTROL_GET_DB_STATISTICS
) {
1904 if (reply
->status
== 0) {
1905 *dbstats
= talloc_steal(mem_ctx
, reply
->rdata
.data
.dbstats
);
1907 return reply
->status
;
1910 /* CTDB_CONTROL_SET_DB_STICKY */
1912 void ctdb_req_control_set_db_sticky(struct ctdb_req_control
*request
,
1915 request
->opcode
= CTDB_CONTROL_SET_DB_STICKY
;
1918 request
->client_id
= 0;
1921 request
->rdata
.opcode
= CTDB_CONTROL_SET_DB_STICKY
;
1922 request
->rdata
.data
.db_id
= db_id
;
1925 int ctdb_reply_control_set_db_sticky(struct ctdb_reply_control
*reply
)
1927 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_SET_DB_STICKY
);
1930 /* CTDB_CONTROL_RELOAD_PUBLIC_IPS */
1932 void ctdb_req_control_reload_public_ips(struct ctdb_req_control
*request
)
1934 request
->opcode
= CTDB_CONTROL_RELOAD_PUBLIC_IPS
;
1937 request
->client_id
= 0;
1940 request
->rdata
.opcode
= CTDB_CONTROL_RELOAD_PUBLIC_IPS
;
1943 int ctdb_reply_control_reload_public_ips(struct ctdb_reply_control
*reply
)
1945 return ctdb_reply_control_generic(reply
,
1946 CTDB_CONTROL_RELOAD_PUBLIC_IPS
);
1949 /* CTDB_CONTROL_TRAVERSE_ALL_EXT */
1951 /* CTDB_CONTROL_IPREALLOCATED */
1953 void ctdb_req_control_ipreallocated(struct ctdb_req_control
*request
)
1955 request
->opcode
= CTDB_CONTROL_IPREALLOCATED
;
1958 request
->client_id
= 0;
1961 request
->rdata
.opcode
= CTDB_CONTROL_IPREALLOCATED
;
1964 int ctdb_reply_control_ipreallocated(struct ctdb_reply_control
*reply
)
1966 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_IPREALLOCATED
);
1969 /* CTDB_CONTROL_GET_RUNSTATE */
1971 void ctdb_req_control_get_runstate(struct ctdb_req_control
*request
)
1973 request
->opcode
= CTDB_CONTROL_GET_RUNSTATE
;
1976 request
->client_id
= 0;
1979 request
->rdata
.opcode
= CTDB_CONTROL_GET_RUNSTATE
;
1982 int ctdb_reply_control_get_runstate(struct ctdb_reply_control
*reply
,
1983 enum ctdb_runstate
*runstate
)
1985 if (reply
->rdata
.opcode
!= CTDB_CONTROL_GET_RUNSTATE
) {
1989 if (reply
->status
== 0) {
1990 *runstate
= reply
->rdata
.data
.runstate
;
1992 return reply
->status
;
1995 /* CTDB_CONTROL_DB_DETACH */
1997 void ctdb_req_control_db_detach(struct ctdb_req_control
*request
,
2000 request
->opcode
= CTDB_CONTROL_DB_DETACH
;
2003 request
->client_id
= 0;
2006 request
->rdata
.opcode
= CTDB_CONTROL_DB_DETACH
;
2007 request
->rdata
.data
.db_id
= db_id
;
2010 int ctdb_reply_control_db_detach(struct ctdb_reply_control
*reply
)
2012 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_DB_DETACH
);
2015 /* CTDB_CONTROL_GET_NODES_FILE */
2017 void ctdb_req_control_get_nodes_file(struct ctdb_req_control
*request
)
2019 request
->opcode
= CTDB_CONTROL_GET_NODES_FILE
;
2022 request
->client_id
= 0;
2025 request
->rdata
.opcode
= CTDB_CONTROL_GET_NODES_FILE
;
2028 int ctdb_reply_control_get_nodes_file(struct ctdb_reply_control
*reply
,
2029 TALLOC_CTX
*mem_ctx
,
2030 struct ctdb_node_map
**nodemap
)
2032 if (reply
->rdata
.opcode
!= CTDB_CONTROL_GET_NODES_FILE
) {
2036 if (reply
->status
== 0) {
2037 *nodemap
= talloc_steal(mem_ctx
, reply
->rdata
.data
.nodemap
);
2039 return reply
->status
;
2042 /* CTDB_CONTROL_DB_FREEZE */
2044 void ctdb_req_control_db_freeze(struct ctdb_req_control
*request
,
2047 request
->opcode
= CTDB_CONTROL_DB_FREEZE
;
2050 request
->client_id
= 0;
2053 request
->rdata
.opcode
= CTDB_CONTROL_DB_FREEZE
;
2054 request
->rdata
.data
.db_id
= db_id
;
2057 int ctdb_reply_control_db_freeze(struct ctdb_reply_control
*reply
)
2059 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_DB_FREEZE
);
2062 /* CTDB_CONTROL_DB_THAW */
2064 void ctdb_req_control_db_thaw(struct ctdb_req_control
*request
,
2067 request
->opcode
= CTDB_CONTROL_DB_THAW
;
2070 request
->client_id
= 0;
2073 request
->rdata
.opcode
= CTDB_CONTROL_DB_THAW
;
2074 request
->rdata
.data
.db_id
= db_id
;
2077 int ctdb_reply_control_db_thaw(struct ctdb_reply_control
*reply
)
2079 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_DB_THAW
);
2082 /* CTDB_CONTROL_DB_TRANSACTION_START */
2084 void ctdb_req_control_db_transaction_start(struct ctdb_req_control
*request
,
2085 struct ctdb_transdb
*transdb
)
2087 request
->opcode
= CTDB_CONTROL_DB_TRANSACTION_START
;
2090 request
->client_id
= 0;
2093 request
->rdata
.opcode
= CTDB_CONTROL_DB_TRANSACTION_START
;
2094 request
->rdata
.data
.transdb
= transdb
;
2097 int ctdb_reply_control_db_transaction_start(struct ctdb_reply_control
*reply
)
2099 return ctdb_reply_control_generic(reply
,
2100 CTDB_CONTROL_DB_TRANSACTION_START
);
2103 /* CTDB_CONTROL_DB_TRANSACTION_COMMIT */
2105 void ctdb_req_control_db_transaction_commit(struct ctdb_req_control
*request
,
2106 struct ctdb_transdb
*transdb
)
2108 request
->opcode
= CTDB_CONTROL_DB_TRANSACTION_COMMIT
;
2111 request
->client_id
= 0;
2114 request
->rdata
.opcode
= CTDB_CONTROL_DB_TRANSACTION_COMMIT
;
2115 request
->rdata
.data
.transdb
= transdb
;
2118 int ctdb_reply_control_db_transaction_commit(struct ctdb_reply_control
*reply
)
2120 return ctdb_reply_control_generic(reply
,
2121 CTDB_CONTROL_DB_TRANSACTION_COMMIT
);
2124 /* CTDB_CONTROL_DB_TRANSACTION_CANCEL */
2126 void ctdb_req_control_db_transaction_cancel(struct ctdb_req_control
*request
,
2129 request
->opcode
= CTDB_CONTROL_DB_TRANSACTION_CANCEL
;
2132 request
->client_id
= 0;
2135 request
->rdata
.opcode
= CTDB_CONTROL_DB_TRANSACTION_CANCEL
;
2136 request
->rdata
.data
.db_id
= db_id
;
2139 int ctdb_reply_control_db_transaction_cancel(struct ctdb_reply_control
*reply
)
2141 return ctdb_reply_control_generic(reply
,
2142 CTDB_CONTROL_DB_TRANSACTION_CANCEL
);
2145 /* CTDB_CONTROL_DB_PULL */
2147 void ctdb_req_control_db_pull(struct ctdb_req_control
*request
,
2148 struct ctdb_pulldb_ext
*pulldb_ext
)
2150 request
->opcode
= CTDB_CONTROL_DB_PULL
;
2153 request
->client_id
= 0;
2156 request
->rdata
.opcode
= CTDB_CONTROL_DB_PULL
;
2157 request
->rdata
.data
.pulldb_ext
= pulldb_ext
;
2160 int ctdb_reply_control_db_pull(struct ctdb_reply_control
*reply
,
2161 uint32_t *num_records
)
2163 if (reply
->rdata
.opcode
!= CTDB_CONTROL_DB_PULL
) {
2167 if (reply
->status
== 0) {
2168 *num_records
= reply
->rdata
.data
.num_records
;
2170 return reply
->status
;
2173 /* CTDB_CONTROL_DB_PUSH_START */
2175 void ctdb_req_control_db_push_start(struct ctdb_req_control
*request
,
2176 struct ctdb_pulldb_ext
*pulldb_ext
)
2178 request
->opcode
= CTDB_CONTROL_DB_PUSH_START
;
2181 request
->client_id
= 0;
2184 request
->rdata
.opcode
= CTDB_CONTROL_DB_PUSH_START
;
2185 request
->rdata
.data
.pulldb_ext
= pulldb_ext
;
2188 int ctdb_reply_control_db_push_start(struct ctdb_reply_control
*reply
)
2190 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_DB_PUSH_START
);
2193 /* CTDB_CONTROL_DB_PUSH_CONFIRM */
2195 void ctdb_req_control_db_push_confirm(struct ctdb_req_control
*request
,
2198 request
->opcode
= CTDB_CONTROL_DB_PUSH_CONFIRM
;
2201 request
->client_id
= 0;
2204 request
->rdata
.opcode
= CTDB_CONTROL_DB_PUSH_CONFIRM
;
2205 request
->rdata
.data
.db_id
= db_id
;
2208 int ctdb_reply_control_db_push_confirm(struct ctdb_reply_control
*reply
,
2209 uint32_t *num_records
)
2211 if (reply
->rdata
.opcode
!= CTDB_CONTROL_DB_PUSH_CONFIRM
) {
2215 if (reply
->status
== 0) {
2216 *num_records
= reply
->rdata
.data
.num_records
;
2218 return reply
->status
;
2221 /* CTDB_CONTROL_DB_OPEN_FLAGS */
2223 void ctdb_req_control_db_open_flags(struct ctdb_req_control
*request
,
2226 request
->opcode
= CTDB_CONTROL_DB_OPEN_FLAGS
;
2229 request
->client_id
= 0;
2232 request
->rdata
.opcode
= CTDB_CONTROL_DB_OPEN_FLAGS
;
2233 request
->rdata
.data
.db_id
= db_id
;
2236 int ctdb_reply_control_db_open_flags(struct ctdb_reply_control
*reply
,
2239 if (reply
->rdata
.opcode
!= CTDB_CONTROL_DB_OPEN_FLAGS
) {
2243 if (reply
->status
== 0) {
2244 *tdb_flags
= reply
->rdata
.data
.tdb_flags
;
2246 return reply
->status
;
2249 /* CTDB_CONTROL_DB_ATTACH_REPLICATED */
2251 void ctdb_req_control_db_attach_replicated(struct ctdb_req_control
*request
,
2252 const char *db_name
)
2254 request
->opcode
= CTDB_CONTROL_DB_ATTACH_REPLICATED
;
2257 request
->client_id
= 0;
2260 request
->rdata
.opcode
= CTDB_CONTROL_DB_ATTACH_REPLICATED
;
2261 request
->rdata
.data
.db_name
= db_name
;
2264 int ctdb_reply_control_db_attach_replicated(struct ctdb_reply_control
*reply
,
2267 if (reply
->rdata
.opcode
!= CTDB_CONTROL_DB_ATTACH_REPLICATED
) {
2270 if (reply
->status
== 0) {
2271 *db_id
= reply
->rdata
.data
.db_id
;
2273 return reply
->status
;
2276 /* CTDB_CONTROL_CHECK_PID_SRVID */
2278 void ctdb_req_control_check_pid_srvid(struct ctdb_req_control
*request
,
2279 struct ctdb_pid_srvid
*pid_srvid
)
2281 request
->opcode
= CTDB_CONTROL_CHECK_PID_SRVID
;
2284 request
->client_id
= 0;
2287 request
->rdata
.opcode
= CTDB_CONTROL_CHECK_PID_SRVID
;
2288 request
->rdata
.data
.pid_srvid
= pid_srvid
;
2291 int ctdb_reply_control_check_pid_srvid(struct ctdb_reply_control
*reply
,
2294 if (reply
->rdata
.opcode
!= CTDB_CONTROL_CHECK_PID_SRVID
) {
2298 *status
= reply
->status
;
2301 return reply
->status
;
2304 /* CTDB_CONTROL_TUNNEL_REGISTER */
2306 void ctdb_req_control_tunnel_register(struct ctdb_req_control
*request
,
2309 request
->opcode
= CTDB_CONTROL_TUNNEL_REGISTER
;
2311 request
->srvid
= tunnel_id
;
2312 request
->client_id
= 0;
2316 int ctdb_reply_control_tunnel_register(struct ctdb_reply_control
*reply
)
2318 if (reply
->rdata
.opcode
!= CTDB_CONTROL_TUNNEL_REGISTER
) {
2322 return reply
->status
;
2325 /* CTDB_CONTROL_TUNNEL_DEREGISTER */
2327 void ctdb_req_control_tunnel_deregister(struct ctdb_req_control
*request
,
2330 request
->opcode
= CTDB_CONTROL_TUNNEL_DEREGISTER
;
2332 request
->srvid
= tunnel_id
;
2333 request
->client_id
= 0;
2337 int ctdb_reply_control_tunnel_deregister(struct ctdb_reply_control
*reply
)
2339 if (reply
->rdata
.opcode
!= CTDB_CONTROL_TUNNEL_DEREGISTER
) {
2343 return reply
->status
;