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_GET_RECMODE */
286 void ctdb_req_control_get_recmode(struct ctdb_req_control
*request
)
288 request
->opcode
= CTDB_CONTROL_GET_RECMODE
;
291 request
->client_id
= 0;
294 request
->rdata
.opcode
= CTDB_CONTROL_GET_RECMODE
;
297 int ctdb_reply_control_get_recmode(struct ctdb_reply_control
*reply
,
300 if (reply
->rdata
.opcode
!= CTDB_CONTROL_GET_RECMODE
) {
304 if (reply
->status
>= 0) {
305 *recmode
= reply
->status
;
308 return reply
->status
;
311 /* CTDB_CONTROL_SET_RECMODE */
313 void ctdb_req_control_set_recmode(struct ctdb_req_control
*request
,
316 request
->opcode
= CTDB_CONTROL_SET_RECMODE
;
319 request
->client_id
= 0;
322 request
->rdata
.opcode
= CTDB_CONTROL_SET_RECMODE
;
323 request
->rdata
.data
.recmode
= recmode
;
326 int ctdb_reply_control_set_recmode(struct ctdb_reply_control
*reply
)
328 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_SET_RECMODE
);
331 /* CTDB_CONTROL_STATISTICS_RESET */
333 void ctdb_req_control_statistics_reset(struct ctdb_req_control
*request
)
335 request
->opcode
= CTDB_CONTROL_STATISTICS_RESET
;
338 request
->client_id
= 0;
341 request
->rdata
.opcode
= CTDB_CONTROL_STATISTICS_RESET
;
344 int ctdb_reply_control_statistics_reset(struct ctdb_reply_control
*reply
)
346 return ctdb_reply_control_generic(reply
,
347 CTDB_CONTROL_STATISTICS_RESET
);
350 /* CTDB_CONTROL_DB_ATTACH */
352 void ctdb_req_control_db_attach(struct ctdb_req_control
*request
,
355 request
->opcode
= CTDB_CONTROL_DB_ATTACH
;
358 request
->client_id
= 0;
361 request
->rdata
.opcode
= CTDB_CONTROL_DB_ATTACH
;
362 request
->rdata
.data
.db_name
= db_name
;
365 int ctdb_reply_control_db_attach(struct ctdb_reply_control
*reply
,
368 if (reply
->rdata
.opcode
!= CTDB_CONTROL_DB_ATTACH
) {
372 if (reply
->status
== 0) {
373 *db_id
= reply
->rdata
.data
.db_id
;
375 return reply
->status
;
378 /* CTDB_CONTROL_TRAVERSE_START */
380 void ctdb_req_control_traverse_start(struct ctdb_req_control
*request
,
381 struct ctdb_traverse_start
*traverse
)
383 request
->opcode
= CTDB_CONTROL_TRAVERSE_START
;
386 request
->client_id
= 0;
389 request
->rdata
.opcode
= CTDB_CONTROL_TRAVERSE_START
;
390 request
->rdata
.data
.traverse_start
= traverse
;
393 int ctdb_reply_control_traverse_start(struct ctdb_reply_control
*reply
)
395 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_TRAVERSE_START
);
398 /* CTDB_CONTROL_TRAVERSE_ALL */
399 /* CTDB_CONTROL_TRAVERSE_DATA */
401 /* CTDB_CONTROL_REGISTER_SRVID */
403 void ctdb_req_control_register_srvid(struct ctdb_req_control
*request
,
406 request
->opcode
= CTDB_CONTROL_REGISTER_SRVID
;
408 request
->srvid
= srvid
;
409 request
->client_id
= 0;
412 request
->rdata
.opcode
= CTDB_CONTROL_REGISTER_SRVID
;
415 int ctdb_reply_control_register_srvid(struct ctdb_reply_control
*reply
)
417 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_REGISTER_SRVID
);
420 /* CTDB_CONTROL_DEREGISTER_SRVID */
422 void ctdb_req_control_deregister_srvid(struct ctdb_req_control
*request
,
425 request
->opcode
= CTDB_CONTROL_DEREGISTER_SRVID
;
427 request
->srvid
= srvid
;
428 request
->client_id
= 0;
431 request
->rdata
.opcode
= CTDB_CONTROL_DEREGISTER_SRVID
;
434 int ctdb_reply_control_deregister_srvid(struct ctdb_reply_control
*reply
)
436 return ctdb_reply_control_generic(reply
,
437 CTDB_CONTROL_DEREGISTER_SRVID
);
440 /* CTDB_CONTROL_GET_DBNAME */
442 void ctdb_req_control_get_dbname(struct ctdb_req_control
*request
,
445 request
->opcode
= CTDB_CONTROL_GET_DBNAME
;
448 request
->client_id
= 0;
451 request
->rdata
.opcode
= CTDB_CONTROL_GET_DBNAME
;
452 request
->rdata
.data
.db_id
= db_id
;
455 int ctdb_reply_control_get_dbname(struct ctdb_reply_control
*reply
,
456 TALLOC_CTX
*mem_ctx
, const char **db_name
)
458 if (reply
->rdata
.opcode
!= CTDB_CONTROL_GET_DBNAME
) {
462 if (reply
->status
== 0) {
463 *db_name
= talloc_steal(mem_ctx
, reply
->rdata
.data
.db_name
);
465 return reply
->status
;
468 /* CTDB_CONTROL_ENABLE_SEQNUM */
470 void ctdb_req_control_enable_seqnum(struct ctdb_req_control
*request
,
473 request
->opcode
= CTDB_CONTROL_ENABLE_SEQNUM
;
476 request
->client_id
= 0;
479 request
->rdata
.opcode
= CTDB_CONTROL_ENABLE_SEQNUM
;
480 request
->rdata
.data
.db_id
= db_id
;
483 int ctdb_reply_control_enable_seqnum(struct ctdb_reply_control
*reply
)
485 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_ENABLE_SEQNUM
);
488 /* CTDB_CONTROL_UPDATE_SEQNUM */
490 void ctdb_req_control_update_seqnum(struct ctdb_req_control
*request
,
493 request
->opcode
= CTDB_CONTROL_UPDATE_SEQNUM
;
496 request
->client_id
= 0;
499 request
->rdata
.opcode
= CTDB_CONTROL_UPDATE_SEQNUM
;
500 request
->rdata
.data
.db_id
= db_id
;
503 int ctdb_reply_control_update_seqnum(struct ctdb_reply_control
*reply
)
505 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_UPDATE_SEQNUM
);
508 /* CTDB_CONTROL_DUMP_MEMORY */
510 void ctdb_req_control_dump_memory(struct ctdb_req_control
*request
)
512 request
->opcode
= CTDB_CONTROL_DUMP_MEMORY
;
515 request
->client_id
= 0;
518 request
->rdata
.opcode
= CTDB_CONTROL_DUMP_MEMORY
;
521 int ctdb_reply_control_dump_memory(struct ctdb_reply_control
*reply
,
522 TALLOC_CTX
*mem_ctx
, const char **mem_str
)
524 if (reply
->rdata
.opcode
!= CTDB_CONTROL_DUMP_MEMORY
) {
528 if (reply
->status
== 0) {
529 *mem_str
= talloc_steal(mem_ctx
, reply
->rdata
.data
.mem_str
);
531 return reply
->status
;
534 /* CTDB_CONTROL_GET_PID */
536 void ctdb_req_control_get_pid(struct ctdb_req_control
*request
)
538 request
->opcode
= CTDB_CONTROL_GET_PID
;
541 request
->client_id
= 0;
544 request
->rdata
.opcode
= CTDB_CONTROL_GET_PID
;
547 int ctdb_reply_control_get_pid(struct ctdb_reply_control
*reply
,
550 if (reply
->rdata
.opcode
!= CTDB_CONTROL_GET_PID
) {
554 *pid
= reply
->status
;
557 return reply
->status
;
560 /* CTDB_CONTROL_FREEZE */
562 void ctdb_req_control_freeze(struct ctdb_req_control
*request
,
565 request
->opcode
= CTDB_CONTROL_FREEZE
;
567 request
->srvid
= priority
;
568 request
->client_id
= 0;
571 request
->rdata
.opcode
= CTDB_CONTROL_FREEZE
;
574 int ctdb_reply_control_freeze(struct ctdb_reply_control
*reply
)
576 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_FREEZE
);
579 /* CTDB_CONTROL_GET_PNN */
581 void ctdb_req_control_get_pnn(struct ctdb_req_control
*request
)
583 request
->opcode
= CTDB_CONTROL_GET_PNN
;
586 request
->client_id
= 0;
589 request
->rdata
.opcode
= CTDB_CONTROL_GET_PNN
;
592 int ctdb_reply_control_get_pnn(struct ctdb_reply_control
*reply
,
595 if (reply
->rdata
.opcode
!= CTDB_CONTROL_GET_PNN
) {
599 if (reply
->status
>= 0) {
600 *pnn
= reply
->status
;
603 return reply
->status
;
606 /* CTDB_CONTROL_SHUTDOWN */
608 void ctdb_req_control_shutdown(struct ctdb_req_control
*request
)
610 request
->opcode
= CTDB_CONTROL_SHUTDOWN
;
613 request
->client_id
= 0;
614 request
->flags
= CTDB_CTRL_FLAG_NOREPLY
;
616 request
->rdata
.opcode
= CTDB_CONTROL_SHUTDOWN
;
619 int ctdb_reply_control_shutdown(struct ctdb_reply_control
*reply
)
621 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_SHUTDOWN
);
624 /* CTDB_CONTROL_TCP_CLIENT */
626 void ctdb_req_control_tcp_client(struct ctdb_req_control
*request
,
627 struct ctdb_connection
*conn
)
629 request
->opcode
= CTDB_CONTROL_TCP_CLIENT
;
632 request
->client_id
= 0;
635 request
->rdata
.opcode
= CTDB_CONTROL_TCP_CLIENT
;
636 request
->rdata
.data
.conn
= conn
;
639 int ctdb_reply_control_tcp_client(struct ctdb_reply_control
*reply
)
641 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_TCP_CLIENT
);
644 /* CTDB_CONTROL_TCP_ADD */
646 void ctdb_req_control_tcp_add(struct ctdb_req_control
*request
,
647 struct ctdb_connection
*conn
)
649 request
->opcode
= CTDB_CONTROL_TCP_ADD
;
652 request
->client_id
= 0;
655 request
->rdata
.opcode
= CTDB_CONTROL_TCP_ADD
;
656 request
->rdata
.data
.conn
= conn
;
659 int ctdb_reply_control_tcp_add(struct ctdb_reply_control
*reply
)
661 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_TCP_ADD
);
664 /* CTDB_CONTROL_TCP_REMOVE */
666 void ctdb_req_control_tcp_remove(struct ctdb_req_control
*request
,
667 struct ctdb_connection
*conn
)
669 request
->opcode
= CTDB_CONTROL_TCP_REMOVE
;
672 request
->client_id
= 0;
675 request
->rdata
.opcode
= CTDB_CONTROL_TCP_REMOVE
;
676 request
->rdata
.data
.conn
= conn
;
679 int ctdb_reply_control_tcp_remove(struct ctdb_reply_control
*reply
)
681 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_TCP_REMOVE
);
684 /* CTDB_CONTROL_STARTUP */
686 void ctdb_req_control_startup(struct ctdb_req_control
*request
)
688 request
->opcode
= CTDB_CONTROL_STARTUP
;
691 request
->client_id
= 0;
694 request
->rdata
.opcode
= CTDB_CONTROL_STARTUP
;
697 int ctdb_reply_control_startup(struct ctdb_reply_control
*reply
)
699 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_STARTUP
);
702 /* CTDB_CONTROL_SET_TUNABLE */
704 void ctdb_req_control_set_tunable(struct ctdb_req_control
*request
,
705 struct ctdb_tunable
*tunable
)
707 request
->opcode
= CTDB_CONTROL_SET_TUNABLE
;
710 request
->client_id
= 0;
713 request
->rdata
.opcode
= CTDB_CONTROL_SET_TUNABLE
;
714 request
->rdata
.data
.tunable
= tunable
;
717 int ctdb_reply_control_set_tunable(struct ctdb_reply_control
*reply
)
719 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_SET_TUNABLE
);
722 /* CTDB_CONTROL_GET_TUNABLE */
724 void ctdb_req_control_get_tunable(struct ctdb_req_control
*request
,
727 request
->opcode
= CTDB_CONTROL_GET_TUNABLE
;
730 request
->client_id
= 0;
733 request
->rdata
.opcode
= CTDB_CONTROL_GET_TUNABLE
;
734 request
->rdata
.data
.tun_var
= discard_const(name
);
737 int ctdb_reply_control_get_tunable(struct ctdb_reply_control
*reply
,
740 if (reply
->rdata
.opcode
!= CTDB_CONTROL_GET_TUNABLE
) {
744 if (reply
->status
== 0) {
745 *value
= reply
->rdata
.data
.tun_value
;
747 return reply
->status
;
750 /* CTDB_CONTROL_LIST_TUNABLES */
752 void ctdb_req_control_list_tunables(struct ctdb_req_control
*request
)
754 request
->opcode
= CTDB_CONTROL_LIST_TUNABLES
;
757 request
->client_id
= 0;
760 request
->rdata
.opcode
= CTDB_CONTROL_LIST_TUNABLES
;
763 int ctdb_reply_control_list_tunables(struct ctdb_reply_control
*reply
,
765 struct ctdb_var_list
**tun_var_list
)
767 if (reply
->rdata
.opcode
!= CTDB_CONTROL_LIST_TUNABLES
) {
771 if (reply
->status
== 0) {
772 *tun_var_list
= talloc_steal(mem_ctx
,
773 reply
->rdata
.data
.tun_var_list
);
775 return reply
->status
;
778 /* CTDB_CONTROL_MODIFY_FLAGS */
780 void ctdb_req_control_modify_flags(struct ctdb_req_control
*request
,
781 struct ctdb_node_flag_change
*flag_change
)
783 request
->opcode
= CTDB_CONTROL_MODIFY_FLAGS
;
786 request
->client_id
= 0;
789 request
->rdata
.opcode
= CTDB_CONTROL_MODIFY_FLAGS
;
790 request
->rdata
.data
.flag_change
= flag_change
;
793 int ctdb_reply_control_modify_flags(struct ctdb_reply_control
*reply
)
795 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_MODIFY_FLAGS
);
798 /* CTDB_CONTROL_GET_ALL_TUNABLES */
800 void ctdb_req_control_get_all_tunables(struct ctdb_req_control
*request
)
802 request
->opcode
= CTDB_CONTROL_GET_ALL_TUNABLES
;
805 request
->client_id
= 0;
808 request
->rdata
.opcode
= CTDB_CONTROL_GET_ALL_TUNABLES
;
811 int ctdb_reply_control_get_all_tunables(struct ctdb_reply_control
*reply
,
813 struct ctdb_tunable_list
**tun_list
)
815 if (reply
->rdata
.opcode
!= CTDB_CONTROL_GET_ALL_TUNABLES
) {
819 if (reply
->status
== 0) {
820 *tun_list
= talloc_steal(mem_ctx
, reply
->rdata
.data
.tun_list
);
822 return reply
->status
;
825 /* CTDB_CONTROL_GET_TCP_TICKLE_LIST */
827 void ctdb_req_control_get_tcp_tickle_list(struct ctdb_req_control
*request
,
828 ctdb_sock_addr
*addr
)
830 request
->opcode
= CTDB_CONTROL_GET_TCP_TICKLE_LIST
;
833 request
->client_id
= 0;
836 request
->rdata
.opcode
= CTDB_CONTROL_GET_TCP_TICKLE_LIST
;
837 request
->rdata
.data
.addr
= addr
;
840 int ctdb_reply_control_get_tcp_tickle_list(struct ctdb_reply_control
*reply
,
842 struct ctdb_tickle_list
**tickles
)
844 if (reply
->rdata
.opcode
!= CTDB_CONTROL_GET_TCP_TICKLE_LIST
) {
848 if (reply
->status
== 0) {
849 *tickles
= talloc_steal(mem_ctx
, reply
->rdata
.data
.tickles
);
851 return reply
->status
;
854 /* CTDB_CONTROL_SET_TCP_TICKLE_LIST */
856 void ctdb_req_control_set_tcp_tickle_list(struct ctdb_req_control
*request
,
857 struct ctdb_tickle_list
*tickles
)
859 request
->opcode
= CTDB_CONTROL_SET_TCP_TICKLE_LIST
;
862 request
->client_id
= 0;
865 request
->rdata
.opcode
= CTDB_CONTROL_SET_TCP_TICKLE_LIST
;
866 request
->rdata
.data
.tickles
= tickles
;
869 int ctdb_reply_control_set_tcp_tickle_list(struct ctdb_reply_control
*reply
)
871 return ctdb_reply_control_generic(reply
,
872 CTDB_CONTROL_SET_TCP_TICKLE_LIST
);
875 /* CTDB_CONTROL_DB_ATTACH_PERSISTENT */
877 void ctdb_req_control_db_attach_persistent(struct ctdb_req_control
*request
,
880 request
->opcode
= CTDB_CONTROL_DB_ATTACH_PERSISTENT
;
883 request
->client_id
= 0;
886 request
->rdata
.opcode
= CTDB_CONTROL_DB_ATTACH_PERSISTENT
;
887 request
->rdata
.data
.db_name
= db_name
;
890 int ctdb_reply_control_db_attach_persistent(struct ctdb_reply_control
*reply
,
893 if (reply
->rdata
.opcode
!= CTDB_CONTROL_DB_ATTACH_PERSISTENT
) {
897 if (reply
->status
== 0) {
898 *db_id
= reply
->rdata
.data
.db_id
;
900 return reply
->status
;
903 /* CTDB_CONTROL_UPDATE_RECORD */
905 void ctdb_req_control_update_record(struct ctdb_req_control
*request
,
906 struct ctdb_rec_buffer
*recbuf
)
908 request
->opcode
= CTDB_CONTROL_UPDATE_RECORD
;
911 request
->client_id
= 0;
914 request
->rdata
.opcode
= CTDB_CONTROL_UPDATE_RECORD
;
915 request
->rdata
.data
.recbuf
= recbuf
;
918 int ctdb_reply_control_update_record(struct ctdb_reply_control
*reply
)
920 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_UPDATE_RECORD
);
923 /* CTDB_CONTROL_SEND_GRATUITOUS_ARP */
925 void ctdb_req_control_send_gratuitous_arp(struct ctdb_req_control
*request
,
926 struct ctdb_addr_info
*addr_info
)
928 request
->opcode
= CTDB_CONTROL_SEND_GRATUITOUS_ARP
;
931 request
->client_id
= 0;
934 request
->rdata
.opcode
= CTDB_CONTROL_SEND_GRATUITOUS_ARP
;
935 request
->rdata
.data
.addr_info
= addr_info
;
938 int ctdb_reply_control_send_gratuitous_arp(struct ctdb_reply_control
*reply
)
940 return ctdb_reply_control_generic(reply
,
941 CTDB_CONTROL_SEND_GRATUITOUS_ARP
);
944 /* CTDB_CONTROL_WIPE_DATABASE */
946 void ctdb_req_control_wipe_database(struct ctdb_req_control
*request
,
947 struct ctdb_transdb
*transdb
)
949 request
->opcode
= CTDB_CONTROL_WIPE_DATABASE
;
952 request
->client_id
= 0;
955 request
->rdata
.opcode
= CTDB_CONTROL_WIPE_DATABASE
;
956 request
->rdata
.data
.transdb
= transdb
;
959 int ctdb_reply_control_wipe_database(struct ctdb_reply_control
*reply
)
961 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_WIPE_DATABASE
);
964 /* CTDB_CONTROL_UPTIME */
966 void ctdb_req_control_uptime(struct ctdb_req_control
*request
)
968 request
->opcode
= CTDB_CONTROL_UPTIME
;
971 request
->client_id
= 0;
974 request
->rdata
.opcode
= CTDB_CONTROL_UPTIME
;
977 int ctdb_reply_control_uptime(struct ctdb_reply_control
*reply
,
978 TALLOC_CTX
*mem_ctx
, struct ctdb_uptime
**uptime
)
980 if (reply
->rdata
.opcode
!= CTDB_CONTROL_UPTIME
) {
984 if (reply
->status
== 0) {
985 *uptime
= talloc_steal(mem_ctx
, reply
->rdata
.data
.uptime
);
987 return reply
->status
;
990 /* CTDB_CONTROL_START_RECOVERY */
992 void ctdb_req_control_start_recovery(struct ctdb_req_control
*request
)
994 request
->opcode
= CTDB_CONTROL_START_RECOVERY
;
997 request
->client_id
= 0;
1000 request
->rdata
.opcode
= CTDB_CONTROL_START_RECOVERY
;
1003 int ctdb_reply_control_start_recovery(struct ctdb_reply_control
*reply
)
1005 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_START_RECOVERY
);
1008 /* CTDB_CONTROL_END_RECOVERY */
1010 void ctdb_req_control_end_recovery(struct ctdb_req_control
*request
)
1012 request
->opcode
= CTDB_CONTROL_END_RECOVERY
;
1015 request
->client_id
= 0;
1018 request
->rdata
.opcode
= CTDB_CONTROL_END_RECOVERY
;
1021 int ctdb_reply_control_end_recovery(struct ctdb_reply_control
*reply
)
1023 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_END_RECOVERY
);
1026 /* CTDB_CONTROL_RELOAD_NODES_FILE */
1028 void ctdb_req_control_reload_nodes_file(struct ctdb_req_control
*request
)
1030 request
->opcode
= CTDB_CONTROL_RELOAD_NODES_FILE
;
1033 request
->client_id
= 0;
1036 request
->rdata
.opcode
= CTDB_CONTROL_RELOAD_NODES_FILE
;
1039 int ctdb_reply_control_reload_nodes_file(struct ctdb_reply_control
*reply
)
1041 return ctdb_reply_control_generic(reply
,
1042 CTDB_CONTROL_RELOAD_NODES_FILE
);
1045 /* CTDB_CONTROL_TRY_DELETE_RECORDS */
1047 void ctdb_req_control_try_delete_records(struct ctdb_req_control
*request
,
1048 struct ctdb_rec_buffer
*recbuf
)
1050 request
->opcode
= CTDB_CONTROL_TRY_DELETE_RECORDS
;
1053 request
->client_id
= 0;
1056 request
->rdata
.opcode
= CTDB_CONTROL_TRY_DELETE_RECORDS
;
1057 request
->rdata
.data
.recbuf
= recbuf
;
1060 int ctdb_reply_control_try_delete_records(struct ctdb_reply_control
*reply
,
1061 TALLOC_CTX
*mem_ctx
,
1062 struct ctdb_rec_buffer
**recbuf
)
1064 if (reply
->rdata
.opcode
!= CTDB_CONTROL_TRY_DELETE_RECORDS
) {
1068 if (reply
->status
== 0) {
1069 *recbuf
= talloc_steal(mem_ctx
, reply
->rdata
.data
.recbuf
);
1071 return reply
->status
;
1074 /* CTDB_CONTROL_ADD_PUBLIC_IP */
1076 void ctdb_req_control_add_public_ip(struct ctdb_req_control
*request
,
1077 struct ctdb_addr_info
*addr_info
)
1079 request
->opcode
= CTDB_CONTROL_ADD_PUBLIC_IP
;
1082 request
->client_id
= 0;
1085 request
->rdata
.opcode
= CTDB_CONTROL_ADD_PUBLIC_IP
;
1086 request
->rdata
.data
.addr_info
= addr_info
;
1089 int ctdb_reply_control_add_public_ip(struct ctdb_reply_control
*reply
)
1091 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_ADD_PUBLIC_IP
);
1094 /* CTDB_CONTROL_DEL_PUBLIC_IP */
1096 void ctdb_req_control_del_public_ip(struct ctdb_req_control
*request
,
1097 struct ctdb_addr_info
*addr_info
)
1099 request
->opcode
= CTDB_CONTROL_DEL_PUBLIC_IP
;
1102 request
->client_id
= 0;
1105 request
->rdata
.opcode
= CTDB_CONTROL_DEL_PUBLIC_IP
;
1106 request
->rdata
.data
.addr_info
= addr_info
;
1109 int ctdb_reply_control_del_public_ip(struct ctdb_reply_control
*reply
)
1111 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_DEL_PUBLIC_IP
);
1114 /* CTDB_CONTROL_GET_CAPABILITIES */
1116 void ctdb_req_control_get_capabilities(struct ctdb_req_control
*request
)
1118 request
->opcode
= CTDB_CONTROL_GET_CAPABILITIES
;
1121 request
->client_id
= 0;
1124 request
->rdata
.opcode
= CTDB_CONTROL_GET_CAPABILITIES
;
1127 int ctdb_reply_control_get_capabilities(struct ctdb_reply_control
*reply
,
1130 if (reply
->rdata
.opcode
!= CTDB_CONTROL_GET_CAPABILITIES
) {
1134 if (reply
->status
== 0) {
1135 *caps
= reply
->rdata
.data
.caps
;
1137 return reply
->status
;
1140 /* CTDB_CONTROL_RECD_PING */
1142 void ctdb_req_control_recd_ping(struct ctdb_req_control
*request
)
1144 request
->opcode
= CTDB_CONTROL_RECD_PING
;
1147 request
->client_id
= 0;
1150 request
->rdata
.opcode
= CTDB_CONTROL_RECD_PING
;
1153 int ctdb_reply_control_recd_ping(struct ctdb_reply_control
*reply
)
1155 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_RECD_PING
);
1158 /* CTDB_CONTROL_RELEASE_IP */
1160 void ctdb_req_control_release_ip(struct ctdb_req_control
*request
,
1161 struct ctdb_public_ip
*pubip
)
1163 request
->opcode
= CTDB_CONTROL_RELEASE_IP
;
1166 request
->client_id
= 0;
1169 request
->rdata
.opcode
= CTDB_CONTROL_RELEASE_IP
;
1170 request
->rdata
.data
.pubip
= pubip
;
1173 int ctdb_reply_control_release_ip(struct ctdb_reply_control
*reply
)
1175 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_RELEASE_IP
);
1178 /* CTDB_CONTROL_TAKEOVER_IP */
1180 void ctdb_req_control_takeover_ip(struct ctdb_req_control
*request
,
1181 struct ctdb_public_ip
*pubip
)
1183 request
->opcode
= CTDB_CONTROL_TAKEOVER_IP
;
1186 request
->client_id
= 0;
1189 request
->rdata
.opcode
= CTDB_CONTROL_TAKEOVER_IP
;
1190 request
->rdata
.data
.pubip
= pubip
;
1193 int ctdb_reply_control_takeover_ip(struct ctdb_reply_control
*reply
)
1195 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_TAKEOVER_IP
);
1198 /* CTDB_CONTROL_GET_PUBLIC_IPS */
1200 void ctdb_req_control_get_public_ips(struct ctdb_req_control
*request
,
1201 bool available_only
)
1203 request
->opcode
= CTDB_CONTROL_GET_PUBLIC_IPS
;
1206 request
->client_id
= 0;
1209 request
->rdata
.opcode
= CTDB_CONTROL_GET_PUBLIC_IPS
;
1210 if (available_only
) {
1211 request
->flags
= CTDB_PUBLIC_IP_FLAGS_ONLY_AVAILABLE
;
1215 int ctdb_reply_control_get_public_ips(struct ctdb_reply_control
*reply
,
1216 TALLOC_CTX
*mem_ctx
,
1217 struct ctdb_public_ip_list
**pubip_list
)
1219 if (reply
->rdata
.opcode
!= CTDB_CONTROL_GET_PUBLIC_IPS
) {
1223 if (reply
->status
== 0) {
1224 *pubip_list
= talloc_steal(mem_ctx
,
1225 reply
->rdata
.data
.pubip_list
);
1227 return reply
->status
;
1230 /* CTDB_CONTROL_GET_NODEMAP */
1232 void ctdb_req_control_get_nodemap(struct ctdb_req_control
*request
)
1234 request
->opcode
= CTDB_CONTROL_GET_NODEMAP
;
1237 request
->client_id
= 0;
1240 request
->rdata
.opcode
= CTDB_CONTROL_GET_NODEMAP
;
1243 int ctdb_reply_control_get_nodemap(struct ctdb_reply_control
*reply
,
1244 TALLOC_CTX
*mem_ctx
,
1245 struct ctdb_node_map
**nodemap
)
1247 if (reply
->rdata
.opcode
!= CTDB_CONTROL_GET_NODEMAP
) {
1251 if (reply
->status
== 0) {
1252 *nodemap
= talloc_steal(mem_ctx
, reply
->rdata
.data
.nodemap
);
1254 return reply
->status
;
1257 /* CTDB_CONTROL_TRAVERSE_KILL */
1259 void ctdb_req_control_traverse_kill(struct ctdb_req_control
*request
,
1260 struct ctdb_traverse_start
*traverse
)
1262 request
->opcode
= CTDB_CONTROL_TRAVERSE_KILL
;
1265 request
->client_id
= 0;
1268 request
->rdata
.opcode
= CTDB_CONTROL_TRAVERSE_KILL
;
1269 request
->rdata
.data
.traverse_start
= traverse
;
1272 int ctdb_reply_control_traverse_kill(struct ctdb_reply_control
*reply
)
1274 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_TRAVERSE_KILL
);
1277 /* CTDB_CONTROL_RECD_RECLOCK_LATENCY */
1279 void ctdb_req_control_recd_reclock_latency(struct ctdb_req_control
*request
,
1280 double reclock_latency
)
1282 request
->opcode
= CTDB_CONTROL_RECD_RECLOCK_LATENCY
;
1285 request
->client_id
= 0;
1288 request
->rdata
.opcode
= CTDB_CONTROL_RECD_RECLOCK_LATENCY
;
1289 request
->rdata
.data
.reclock_latency
= reclock_latency
;
1292 int ctdb_reply_control_recd_reclock_latency(struct ctdb_reply_control
*reply
)
1294 return ctdb_reply_control_generic(reply
,
1295 CTDB_CONTROL_RECD_RECLOCK_LATENCY
);
1298 /* CTDB_CONTROL_GET_RECLOCK_FILE */
1300 void ctdb_req_control_get_reclock_file(struct ctdb_req_control
*request
)
1302 request
->opcode
= CTDB_CONTROL_GET_RECLOCK_FILE
;
1305 request
->client_id
= 0;
1308 request
->rdata
.opcode
= CTDB_CONTROL_GET_RECLOCK_FILE
;
1311 int ctdb_reply_control_get_reclock_file(struct ctdb_reply_control
*reply
,
1312 TALLOC_CTX
*mem_ctx
,
1313 const char **reclock_file
)
1315 if (reply
->rdata
.opcode
!= CTDB_CONTROL_GET_RECLOCK_FILE
) {
1319 if (reply
->status
== 0) {
1320 *reclock_file
= talloc_steal(mem_ctx
,
1321 reply
->rdata
.data
.reclock_file
);
1323 return reply
->status
;
1326 /* CTDB_CONTROL_STOP_NODE */
1328 void ctdb_req_control_stop_node(struct ctdb_req_control
*request
)
1330 request
->opcode
= CTDB_CONTROL_STOP_NODE
;
1333 request
->client_id
= 0;
1336 request
->rdata
.opcode
= CTDB_CONTROL_STOP_NODE
;
1339 int ctdb_reply_control_stop_node(struct ctdb_reply_control
*reply
)
1341 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_STOP_NODE
);
1344 /* CTDB_CONTROL_CONTINUE_NODE */
1346 void ctdb_req_control_continue_node(struct ctdb_req_control
*request
)
1348 request
->opcode
= CTDB_CONTROL_CONTINUE_NODE
;
1351 request
->client_id
= 0;
1354 request
->rdata
.opcode
= CTDB_CONTROL_CONTINUE_NODE
;
1357 int ctdb_reply_control_continue_node(struct ctdb_reply_control
*reply
)
1359 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_CONTINUE_NODE
);
1362 /* CTDB_CONTROL_SET_LMASTERROLE */
1364 void ctdb_req_control_set_lmasterrole(struct ctdb_req_control
*request
,
1365 uint32_t lmaster_role
)
1367 request
->opcode
= CTDB_CONTROL_SET_LMASTERROLE
;
1370 request
->client_id
= 0;
1373 request
->rdata
.opcode
= CTDB_CONTROL_SET_LMASTERROLE
;
1374 request
->rdata
.data
.role
= lmaster_role
;
1377 int ctdb_reply_control_set_lmasterrole(struct ctdb_reply_control
*reply
)
1379 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_SET_LMASTERROLE
);
1382 /* CTDB_CONTROL_SET_RECMASTERROLE */
1384 void ctdb_req_control_set_recmasterrole(struct ctdb_req_control
*request
,
1385 uint32_t recmaster_role
)
1387 request
->opcode
= CTDB_CONTROL_SET_RECMASTERROLE
;
1390 request
->client_id
= 0;
1393 request
->rdata
.opcode
= CTDB_CONTROL_SET_RECMASTERROLE
;
1394 request
->rdata
.data
.role
= recmaster_role
;
1397 int ctdb_reply_control_set_recmasterrole(struct ctdb_reply_control
*reply
)
1399 return ctdb_reply_control_generic(reply
,
1400 CTDB_CONTROL_SET_RECMASTERROLE
);
1403 /* CTDB_CONTROL_SET_BAN_STATE */
1405 void ctdb_req_control_set_ban_state(struct ctdb_req_control
*request
,
1406 struct ctdb_ban_state
*ban_state
)
1408 request
->opcode
= CTDB_CONTROL_SET_BAN_STATE
;
1411 request
->client_id
= 0;
1414 request
->rdata
.opcode
= CTDB_CONTROL_SET_BAN_STATE
;
1415 request
->rdata
.data
.ban_state
= ban_state
;
1418 int ctdb_reply_control_set_ban_state(struct ctdb_reply_control
*reply
)
1420 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_SET_BAN_STATE
);
1423 /* CTDB_CONTROL_GET_BAN_STATE */
1425 void ctdb_req_control_get_ban_state(struct ctdb_req_control
*request
)
1427 request
->opcode
= CTDB_CONTROL_GET_BAN_STATE
;
1430 request
->client_id
= 0;
1433 request
->rdata
.opcode
= CTDB_CONTROL_GET_BAN_STATE
;
1436 int ctdb_reply_control_get_ban_state(struct ctdb_reply_control
*reply
,
1437 TALLOC_CTX
*mem_ctx
,
1438 struct ctdb_ban_state
**ban_state
)
1440 if (reply
->rdata
.opcode
!= CTDB_CONTROL_GET_BAN_STATE
) {
1444 if (reply
->status
== 0) {
1445 *ban_state
= talloc_steal(mem_ctx
,
1446 reply
->rdata
.data
.ban_state
);
1448 return reply
->status
;
1451 /* CTDB_CONTROL_REGISTER_NOTIFY */
1453 void ctdb_req_control_register_notify(struct ctdb_req_control
*request
,
1454 struct ctdb_notify_data
*notify
)
1456 request
->opcode
= CTDB_CONTROL_REGISTER_NOTIFY
;
1459 request
->client_id
= 0;
1462 request
->rdata
.opcode
= CTDB_CONTROL_REGISTER_NOTIFY
;
1463 request
->rdata
.data
.notify
= notify
;
1466 int ctdb_reply_control_register_notify(struct ctdb_reply_control
*reply
)
1468 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_REGISTER_NOTIFY
);
1471 /* CTDB_CONTROL_DEREGISTER_NOTIFY */
1473 void ctdb_req_control_deregister_notify(struct ctdb_req_control
*request
,
1476 request
->opcode
= CTDB_CONTROL_DEREGISTER_NOTIFY
;
1479 request
->client_id
= 0;
1482 request
->rdata
.opcode
= CTDB_CONTROL_DEREGISTER_NOTIFY
;
1483 request
->rdata
.data
.srvid
= srvid
;
1486 int ctdb_reply_control_deregister_notify(struct ctdb_reply_control
*reply
)
1488 return ctdb_reply_control_generic(reply
,
1489 CTDB_CONTROL_DEREGISTER_NOTIFY
);
1492 /* CTDB_CONTROL_TRANS3_COMMIT */
1494 void ctdb_req_control_trans3_commit(struct ctdb_req_control
*request
,
1495 struct ctdb_rec_buffer
*recbuf
)
1497 request
->opcode
= CTDB_CONTROL_TRANS3_COMMIT
;
1500 request
->client_id
= 0;
1503 request
->rdata
.opcode
= CTDB_CONTROL_TRANS3_COMMIT
;
1504 request
->rdata
.data
.recbuf
= recbuf
;
1507 int ctdb_reply_control_trans3_commit(struct ctdb_reply_control
*reply
)
1509 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_TRANS3_COMMIT
);
1512 /* CTDB_CONTROL_GET_DB_SEQNUM */
1514 void ctdb_req_control_get_db_seqnum(struct ctdb_req_control
*request
,
1517 request
->opcode
= CTDB_CONTROL_GET_DB_SEQNUM
;
1520 request
->client_id
= 0;
1523 request
->rdata
.opcode
= CTDB_CONTROL_GET_DB_SEQNUM
;
1524 request
->rdata
.data
.db_id
= db_id
;
1527 int ctdb_reply_control_get_db_seqnum(struct ctdb_reply_control
*reply
,
1530 if (reply
->rdata
.opcode
!= CTDB_CONTROL_GET_DB_SEQNUM
) {
1534 if (reply
->status
== 0) {
1535 *seqnum
= reply
->rdata
.data
.seqnum
;
1537 return reply
->status
;
1540 /* CTDB_CONTROL_DB_SET_HEALTHY */
1542 void ctdb_req_control_db_set_healthy(struct ctdb_req_control
*request
,
1545 request
->opcode
= CTDB_CONTROL_DB_SET_HEALTHY
;
1548 request
->client_id
= 0;
1551 request
->rdata
.opcode
= CTDB_CONTROL_DB_SET_HEALTHY
;
1552 request
->rdata
.data
.db_id
= db_id
;
1555 int ctdb_reply_control_db_set_healthy(struct ctdb_reply_control
*reply
)
1557 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_DB_SET_HEALTHY
);
1560 /* CTDB_CONTROL_DB_GET_HEALTH */
1562 void ctdb_req_control_db_get_health(struct ctdb_req_control
*request
,
1565 request
->opcode
= CTDB_CONTROL_DB_GET_HEALTH
;
1568 request
->client_id
= 0;
1571 request
->rdata
.opcode
= CTDB_CONTROL_DB_GET_HEALTH
;
1572 request
->rdata
.data
.db_id
= db_id
;
1575 int ctdb_reply_control_db_get_health(struct ctdb_reply_control
*reply
,
1576 TALLOC_CTX
*mem_ctx
, const char **reason
)
1578 if (reply
->rdata
.opcode
!= CTDB_CONTROL_DB_GET_HEALTH
) {
1582 if (reply
->status
== 0) {
1583 *reason
= talloc_steal(mem_ctx
, reply
->rdata
.data
.reason
);
1585 return reply
->status
;
1588 /* CTDB_CONTROL_GET_PUBLIC_IP_INFO */
1590 void ctdb_req_control_get_public_ip_info(struct ctdb_req_control
*request
,
1591 ctdb_sock_addr
*addr
)
1593 request
->opcode
= CTDB_CONTROL_GET_PUBLIC_IP_INFO
;
1596 request
->client_id
= 0;
1599 request
->rdata
.opcode
= CTDB_CONTROL_GET_PUBLIC_IP_INFO
;
1600 request
->rdata
.data
.addr
= addr
;
1603 int ctdb_reply_control_get_public_ip_info(struct ctdb_reply_control
*reply
,
1604 TALLOC_CTX
*mem_ctx
,
1605 struct ctdb_public_ip_info
**ipinfo
)
1607 if (reply
->rdata
.opcode
!= CTDB_CONTROL_GET_PUBLIC_IP_INFO
) {
1611 if (reply
->status
== 0) {
1612 *ipinfo
= talloc_steal(mem_ctx
, reply
->rdata
.data
.ipinfo
);
1614 return reply
->status
;
1617 /* CTDB_CONTROL_GET_IFACES */
1619 void ctdb_req_control_get_ifaces(struct ctdb_req_control
*request
)
1621 request
->opcode
= CTDB_CONTROL_GET_IFACES
;
1624 request
->client_id
= 0;
1627 request
->rdata
.opcode
= CTDB_CONTROL_GET_IFACES
;
1630 int ctdb_reply_control_get_ifaces(struct ctdb_reply_control
*reply
,
1631 TALLOC_CTX
*mem_ctx
,
1632 struct ctdb_iface_list
**iface_list
)
1634 if (reply
->rdata
.opcode
!= CTDB_CONTROL_GET_IFACES
) {
1638 if (reply
->status
== 0) {
1639 *iface_list
= talloc_steal(mem_ctx
,
1640 reply
->rdata
.data
.iface_list
);
1642 return reply
->status
;
1645 /* CTDB_CONTROL_SET_IFACE_LINK_STATE */
1647 void ctdb_req_control_set_iface_link_state(struct ctdb_req_control
*request
,
1648 struct ctdb_iface
*iface
)
1650 request
->opcode
= CTDB_CONTROL_SET_IFACE_LINK_STATE
;
1653 request
->client_id
= 0;
1656 request
->rdata
.opcode
= CTDB_CONTROL_SET_IFACE_LINK_STATE
;
1657 request
->rdata
.data
.iface
= iface
;
1660 int ctdb_reply_control_set_iface_link_state(struct ctdb_reply_control
*reply
)
1662 return ctdb_reply_control_generic(reply
,
1663 CTDB_CONTROL_SET_IFACE_LINK_STATE
);
1666 /* CTDB_CONTROL_TCP_ADD_DELAYED_UPDATE */
1668 void ctdb_req_control_tcp_add_delayed_update(struct ctdb_req_control
*request
,
1669 struct ctdb_connection
*conn
)
1671 request
->opcode
= CTDB_CONTROL_TCP_ADD_DELAYED_UPDATE
;
1674 request
->client_id
= 0;
1677 request
->rdata
.opcode
= CTDB_CONTROL_TCP_ADD_DELAYED_UPDATE
;
1678 request
->rdata
.data
.conn
= conn
;
1681 int ctdb_reply_control_tcp_add_delayed_update(struct ctdb_reply_control
*reply
)
1683 return ctdb_reply_control_generic(reply
,
1684 CTDB_CONTROL_TCP_ADD_DELAYED_UPDATE
);
1687 /* CTDB_CONTROL_GET_STAT_HISTORY */
1689 void ctdb_req_control_get_stat_history(struct ctdb_req_control
*request
)
1691 request
->opcode
= CTDB_CONTROL_GET_STAT_HISTORY
;
1694 request
->client_id
= 0;
1697 request
->rdata
.opcode
= CTDB_CONTROL_GET_STAT_HISTORY
;
1700 int ctdb_reply_control_get_stat_history(struct ctdb_reply_control
*reply
,
1701 TALLOC_CTX
*mem_ctx
,
1702 struct ctdb_statistics_list
**stats_list
)
1704 if (reply
->rdata
.opcode
!= CTDB_CONTROL_GET_STAT_HISTORY
) {
1708 if (reply
->status
== 0) {
1709 *stats_list
= talloc_steal(mem_ctx
,
1710 reply
->rdata
.data
.stats_list
);
1712 return reply
->status
;
1715 /* CTDB_CONTROL_SCHEDULE_FOR_DELETION */
1717 void ctdb_req_control_schedule_for_deletion(struct ctdb_req_control
*request
,
1718 struct ctdb_key_data
*key
)
1720 request
->opcode
= CTDB_CONTROL_SCHEDULE_FOR_DELETION
;
1723 request
->client_id
= 0;
1726 request
->rdata
.opcode
= CTDB_CONTROL_SCHEDULE_FOR_DELETION
;
1727 request
->rdata
.data
.key
= key
;
1730 int ctdb_reply_control_schedule_for_deletion(struct ctdb_reply_control
*reply
)
1732 return ctdb_reply_control_generic(reply
,
1733 CTDB_CONTROL_SCHEDULE_FOR_DELETION
);
1736 /* CTDB_CONTROL_SET_DB_READONLY */
1738 void ctdb_req_control_set_db_readonly(struct ctdb_req_control
*request
,
1741 request
->opcode
= CTDB_CONTROL_SET_DB_READONLY
;
1744 request
->client_id
= 0;
1747 request
->rdata
.opcode
= CTDB_CONTROL_SET_DB_READONLY
;
1748 request
->rdata
.data
.db_id
= db_id
;
1751 int ctdb_reply_control_set_db_readonly(struct ctdb_reply_control
*reply
)
1753 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_SET_DB_READONLY
);
1756 /* CTDB_CONTROL_TRAVERSE_START_EXT */
1758 void ctdb_req_control_traverse_start_ext(struct ctdb_req_control
*request
,
1759 struct ctdb_traverse_start_ext
*traverse
)
1761 request
->opcode
= CTDB_CONTROL_TRAVERSE_START_EXT
;
1764 request
->client_id
= 0;
1767 request
->rdata
.opcode
= CTDB_CONTROL_TRAVERSE_START_EXT
;
1768 request
->rdata
.data
.traverse_start_ext
= traverse
;
1771 int ctdb_reply_control_traverse_start_ext(struct ctdb_reply_control
*reply
)
1773 return ctdb_reply_control_generic(reply
,
1774 CTDB_CONTROL_TRAVERSE_START_EXT
);
1777 /* CTDB_CONTROL_GET_DB_STATISTICS */
1779 void ctdb_req_control_get_db_statistics(struct ctdb_req_control
*request
,
1782 request
->opcode
= CTDB_CONTROL_GET_DB_STATISTICS
;
1785 request
->client_id
= 0;
1788 request
->rdata
.opcode
= CTDB_CONTROL_GET_DB_STATISTICS
;
1789 request
->rdata
.data
.db_id
= db_id
;
1792 int ctdb_reply_control_get_db_statistics(struct ctdb_reply_control
*reply
,
1793 TALLOC_CTX
*mem_ctx
,
1794 struct ctdb_db_statistics
**dbstats
)
1796 if (reply
->rdata
.opcode
!= CTDB_CONTROL_GET_DB_STATISTICS
) {
1800 if (reply
->status
== 0) {
1801 *dbstats
= talloc_steal(mem_ctx
, reply
->rdata
.data
.dbstats
);
1803 return reply
->status
;
1806 /* CTDB_CONTROL_SET_DB_STICKY */
1808 void ctdb_req_control_set_db_sticky(struct ctdb_req_control
*request
,
1811 request
->opcode
= CTDB_CONTROL_SET_DB_STICKY
;
1814 request
->client_id
= 0;
1817 request
->rdata
.opcode
= CTDB_CONTROL_SET_DB_STICKY
;
1818 request
->rdata
.data
.db_id
= db_id
;
1821 int ctdb_reply_control_set_db_sticky(struct ctdb_reply_control
*reply
)
1823 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_SET_DB_STICKY
);
1826 /* CTDB_CONTROL_RELOAD_PUBLIC_IPS */
1828 void ctdb_req_control_reload_public_ips(struct ctdb_req_control
*request
)
1830 request
->opcode
= CTDB_CONTROL_RELOAD_PUBLIC_IPS
;
1833 request
->client_id
= 0;
1836 request
->rdata
.opcode
= CTDB_CONTROL_RELOAD_PUBLIC_IPS
;
1839 int ctdb_reply_control_reload_public_ips(struct ctdb_reply_control
*reply
)
1841 return ctdb_reply_control_generic(reply
,
1842 CTDB_CONTROL_RELOAD_PUBLIC_IPS
);
1845 /* CTDB_CONTROL_TRAVERSE_ALL_EXT */
1847 /* CTDB_CONTROL_IPREALLOCATED */
1849 void ctdb_req_control_ipreallocated(struct ctdb_req_control
*request
)
1851 request
->opcode
= CTDB_CONTROL_IPREALLOCATED
;
1854 request
->client_id
= 0;
1857 request
->rdata
.opcode
= CTDB_CONTROL_IPREALLOCATED
;
1860 int ctdb_reply_control_ipreallocated(struct ctdb_reply_control
*reply
)
1862 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_IPREALLOCATED
);
1865 /* CTDB_CONTROL_GET_RUNSTATE */
1867 void ctdb_req_control_get_runstate(struct ctdb_req_control
*request
)
1869 request
->opcode
= CTDB_CONTROL_GET_RUNSTATE
;
1872 request
->client_id
= 0;
1875 request
->rdata
.opcode
= CTDB_CONTROL_GET_RUNSTATE
;
1878 int ctdb_reply_control_get_runstate(struct ctdb_reply_control
*reply
,
1879 enum ctdb_runstate
*runstate
)
1881 if (reply
->rdata
.opcode
!= CTDB_CONTROL_GET_RUNSTATE
) {
1885 if (reply
->status
== 0) {
1886 *runstate
= reply
->rdata
.data
.runstate
;
1888 return reply
->status
;
1891 /* CTDB_CONTROL_DB_DETACH */
1893 void ctdb_req_control_db_detach(struct ctdb_req_control
*request
,
1896 request
->opcode
= CTDB_CONTROL_DB_DETACH
;
1899 request
->client_id
= 0;
1902 request
->rdata
.opcode
= CTDB_CONTROL_DB_DETACH
;
1903 request
->rdata
.data
.db_id
= db_id
;
1906 int ctdb_reply_control_db_detach(struct ctdb_reply_control
*reply
)
1908 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_DB_DETACH
);
1911 /* CTDB_CONTROL_GET_NODES_FILE */
1913 void ctdb_req_control_get_nodes_file(struct ctdb_req_control
*request
)
1915 request
->opcode
= CTDB_CONTROL_GET_NODES_FILE
;
1918 request
->client_id
= 0;
1921 request
->rdata
.opcode
= CTDB_CONTROL_GET_NODES_FILE
;
1924 int ctdb_reply_control_get_nodes_file(struct ctdb_reply_control
*reply
,
1925 TALLOC_CTX
*mem_ctx
,
1926 struct ctdb_node_map
**nodemap
)
1928 if (reply
->rdata
.opcode
!= CTDB_CONTROL_GET_NODES_FILE
) {
1932 if (reply
->status
== 0) {
1933 *nodemap
= talloc_steal(mem_ctx
, reply
->rdata
.data
.nodemap
);
1935 return reply
->status
;
1938 /* CTDB_CONTROL_DB_FREEZE */
1940 void ctdb_req_control_db_freeze(struct ctdb_req_control
*request
,
1943 request
->opcode
= CTDB_CONTROL_DB_FREEZE
;
1946 request
->client_id
= 0;
1949 request
->rdata
.opcode
= CTDB_CONTROL_DB_FREEZE
;
1950 request
->rdata
.data
.db_id
= db_id
;
1953 int ctdb_reply_control_db_freeze(struct ctdb_reply_control
*reply
)
1955 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_DB_FREEZE
);
1958 /* CTDB_CONTROL_DB_THAW */
1960 void ctdb_req_control_db_thaw(struct ctdb_req_control
*request
,
1963 request
->opcode
= CTDB_CONTROL_DB_THAW
;
1966 request
->client_id
= 0;
1969 request
->rdata
.opcode
= CTDB_CONTROL_DB_THAW
;
1970 request
->rdata
.data
.db_id
= db_id
;
1973 int ctdb_reply_control_db_thaw(struct ctdb_reply_control
*reply
)
1975 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_DB_THAW
);
1978 /* CTDB_CONTROL_DB_TRANSACTION_START */
1980 void ctdb_req_control_db_transaction_start(struct ctdb_req_control
*request
,
1981 struct ctdb_transdb
*transdb
)
1983 request
->opcode
= CTDB_CONTROL_DB_TRANSACTION_START
;
1986 request
->client_id
= 0;
1989 request
->rdata
.opcode
= CTDB_CONTROL_DB_TRANSACTION_START
;
1990 request
->rdata
.data
.transdb
= transdb
;
1993 int ctdb_reply_control_db_transaction_start(struct ctdb_reply_control
*reply
)
1995 return ctdb_reply_control_generic(reply
,
1996 CTDB_CONTROL_DB_TRANSACTION_START
);
1999 /* CTDB_CONTROL_DB_TRANSACTION_COMMIT */
2001 void ctdb_req_control_db_transaction_commit(struct ctdb_req_control
*request
,
2002 struct ctdb_transdb
*transdb
)
2004 request
->opcode
= CTDB_CONTROL_DB_TRANSACTION_COMMIT
;
2007 request
->client_id
= 0;
2010 request
->rdata
.opcode
= CTDB_CONTROL_DB_TRANSACTION_COMMIT
;
2011 request
->rdata
.data
.transdb
= transdb
;
2014 int ctdb_reply_control_db_transaction_commit(struct ctdb_reply_control
*reply
)
2016 return ctdb_reply_control_generic(reply
,
2017 CTDB_CONTROL_DB_TRANSACTION_COMMIT
);
2020 /* CTDB_CONTROL_DB_TRANSACTION_CANCEL */
2022 void ctdb_req_control_db_transaction_cancel(struct ctdb_req_control
*request
,
2025 request
->opcode
= CTDB_CONTROL_DB_TRANSACTION_CANCEL
;
2028 request
->client_id
= 0;
2031 request
->rdata
.opcode
= CTDB_CONTROL_DB_TRANSACTION_CANCEL
;
2032 request
->rdata
.data
.db_id
= db_id
;
2035 int ctdb_reply_control_db_transaction_cancel(struct ctdb_reply_control
*reply
)
2037 return ctdb_reply_control_generic(reply
,
2038 CTDB_CONTROL_DB_TRANSACTION_CANCEL
);
2041 /* CTDB_CONTROL_DB_PULL */
2043 void ctdb_req_control_db_pull(struct ctdb_req_control
*request
,
2044 struct ctdb_pulldb_ext
*pulldb_ext
)
2046 request
->opcode
= CTDB_CONTROL_DB_PULL
;
2049 request
->client_id
= 0;
2052 request
->rdata
.opcode
= CTDB_CONTROL_DB_PULL
;
2053 request
->rdata
.data
.pulldb_ext
= pulldb_ext
;
2056 int ctdb_reply_control_db_pull(struct ctdb_reply_control
*reply
,
2057 uint32_t *num_records
)
2059 if (reply
->rdata
.opcode
!= CTDB_CONTROL_DB_PULL
) {
2063 if (reply
->status
== 0) {
2064 *num_records
= reply
->rdata
.data
.num_records
;
2066 return reply
->status
;
2069 /* CTDB_CONTROL_DB_PUSH_START */
2071 void ctdb_req_control_db_push_start(struct ctdb_req_control
*request
,
2072 struct ctdb_pulldb_ext
*pulldb_ext
)
2074 request
->opcode
= CTDB_CONTROL_DB_PUSH_START
;
2077 request
->client_id
= 0;
2080 request
->rdata
.opcode
= CTDB_CONTROL_DB_PUSH_START
;
2081 request
->rdata
.data
.pulldb_ext
= pulldb_ext
;
2084 int ctdb_reply_control_db_push_start(struct ctdb_reply_control
*reply
)
2086 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_DB_PUSH_START
);
2089 /* CTDB_CONTROL_DB_PUSH_CONFIRM */
2091 void ctdb_req_control_db_push_confirm(struct ctdb_req_control
*request
,
2094 request
->opcode
= CTDB_CONTROL_DB_PUSH_CONFIRM
;
2097 request
->client_id
= 0;
2100 request
->rdata
.opcode
= CTDB_CONTROL_DB_PUSH_CONFIRM
;
2101 request
->rdata
.data
.db_id
= db_id
;
2104 int ctdb_reply_control_db_push_confirm(struct ctdb_reply_control
*reply
,
2105 uint32_t *num_records
)
2107 if (reply
->rdata
.opcode
!= CTDB_CONTROL_DB_PUSH_CONFIRM
) {
2111 if (reply
->status
== 0) {
2112 *num_records
= reply
->rdata
.data
.num_records
;
2114 return reply
->status
;
2117 /* CTDB_CONTROL_DB_OPEN_FLAGS */
2119 void ctdb_req_control_db_open_flags(struct ctdb_req_control
*request
,
2122 request
->opcode
= CTDB_CONTROL_DB_OPEN_FLAGS
;
2125 request
->client_id
= 0;
2128 request
->rdata
.opcode
= CTDB_CONTROL_DB_OPEN_FLAGS
;
2129 request
->rdata
.data
.db_id
= db_id
;
2132 int ctdb_reply_control_db_open_flags(struct ctdb_reply_control
*reply
,
2135 if (reply
->rdata
.opcode
!= CTDB_CONTROL_DB_OPEN_FLAGS
) {
2139 if (reply
->status
== 0) {
2140 *tdb_flags
= reply
->rdata
.data
.tdb_flags
;
2142 return reply
->status
;
2145 /* CTDB_CONTROL_DB_ATTACH_REPLICATED */
2147 void ctdb_req_control_db_attach_replicated(struct ctdb_req_control
*request
,
2148 const char *db_name
)
2150 request
->opcode
= CTDB_CONTROL_DB_ATTACH_REPLICATED
;
2153 request
->client_id
= 0;
2156 request
->rdata
.opcode
= CTDB_CONTROL_DB_ATTACH_REPLICATED
;
2157 request
->rdata
.data
.db_name
= db_name
;
2160 int ctdb_reply_control_db_attach_replicated(struct ctdb_reply_control
*reply
,
2163 if (reply
->rdata
.opcode
!= CTDB_CONTROL_DB_ATTACH_REPLICATED
) {
2166 if (reply
->status
== 0) {
2167 *db_id
= reply
->rdata
.data
.db_id
;
2169 return reply
->status
;
2172 /* CTDB_CONTROL_CHECK_PID_SRVID */
2174 void ctdb_req_control_check_pid_srvid(struct ctdb_req_control
*request
,
2175 struct ctdb_pid_srvid
*pid_srvid
)
2177 request
->opcode
= CTDB_CONTROL_CHECK_PID_SRVID
;
2180 request
->client_id
= 0;
2183 request
->rdata
.opcode
= CTDB_CONTROL_CHECK_PID_SRVID
;
2184 request
->rdata
.data
.pid_srvid
= pid_srvid
;
2187 int ctdb_reply_control_check_pid_srvid(struct ctdb_reply_control
*reply
,
2190 if (reply
->rdata
.opcode
!= CTDB_CONTROL_CHECK_PID_SRVID
) {
2194 *status
= reply
->status
;
2197 return reply
->status
;
2200 /* CTDB_CONTROL_TUNNEL_REGISTER */
2202 void ctdb_req_control_tunnel_register(struct ctdb_req_control
*request
,
2205 request
->opcode
= CTDB_CONTROL_TUNNEL_REGISTER
;
2207 request
->srvid
= tunnel_id
;
2208 request
->client_id
= 0;
2211 request
->rdata
.opcode
= CTDB_CONTROL_TUNNEL_REGISTER
;
2214 int ctdb_reply_control_tunnel_register(struct ctdb_reply_control
*reply
)
2216 if (reply
->rdata
.opcode
!= CTDB_CONTROL_TUNNEL_REGISTER
) {
2220 return reply
->status
;
2223 /* CTDB_CONTROL_TUNNEL_DEREGISTER */
2225 void ctdb_req_control_tunnel_deregister(struct ctdb_req_control
*request
,
2228 request
->opcode
= CTDB_CONTROL_TUNNEL_DEREGISTER
;
2230 request
->srvid
= tunnel_id
;
2231 request
->client_id
= 0;
2234 request
->rdata
.opcode
= CTDB_CONTROL_TUNNEL_DEREGISTER
;
2237 int ctdb_reply_control_tunnel_deregister(struct ctdb_reply_control
*reply
)
2239 if (reply
->rdata
.opcode
!= CTDB_CONTROL_TUNNEL_DEREGISTER
) {
2243 return reply
->status
;
2246 /* CTDB_CONTROL_VACUUM_FETCH */
2248 void ctdb_req_control_vacuum_fetch(struct ctdb_req_control
*request
,
2249 struct ctdb_rec_buffer
*recbuf
)
2251 request
->opcode
= CTDB_CONTROL_VACUUM_FETCH
;
2254 request
->client_id
= 0;
2257 request
->rdata
.opcode
= CTDB_CONTROL_VACUUM_FETCH
;
2258 request
->rdata
.data
.recbuf
= recbuf
;
2261 int ctdb_reply_control_vacuum_fetch(struct ctdb_reply_control
*reply
)
2263 if (reply
->rdata
.opcode
!= CTDB_CONTROL_VACUUM_FETCH
) {
2267 return reply
->status
;
2270 /* CTDB_CONTROL_DB_VACUUM */
2272 void ctdb_req_control_db_vacuum(struct ctdb_req_control
*request
,
2273 struct ctdb_db_vacuum
*db_vacuum
)
2275 request
->opcode
= CTDB_CONTROL_DB_VACUUM
;
2278 request
->client_id
= 0;
2281 request
->rdata
.opcode
= CTDB_CONTROL_DB_VACUUM
;
2282 request
->rdata
.data
.db_vacuum
= db_vacuum
;
2285 int ctdb_reply_control_db_vacuum(struct ctdb_reply_control
*reply
)
2287 if (reply
->rdata
.opcode
!= CTDB_CONTROL_DB_VACUUM
) {
2291 return reply
->status
;
2294 /* CTDB_CONTROL_ECHO_DATA */
2296 void ctdb_req_control_echo_data(struct ctdb_req_control
*request
,
2297 struct ctdb_echo_data
*echo_data
)
2299 request
->opcode
= CTDB_CONTROL_ECHO_DATA
;
2302 request
->client_id
= 0;
2305 request
->rdata
.opcode
= CTDB_CONTROL_ECHO_DATA
;
2306 request
->rdata
.data
.echo_data
= echo_data
;
2309 int ctdb_reply_control_echo_data(struct ctdb_reply_control
*reply
)
2311 if (reply
->rdata
.opcode
!= CTDB_CONTROL_ECHO_DATA
) {
2315 return reply
->status
;
2318 /* CTDB_CONTROL_DISABLE_NODE */
2320 void ctdb_req_control_disable_node(struct ctdb_req_control
*request
)
2322 request
->opcode
= CTDB_CONTROL_DISABLE_NODE
;
2325 request
->client_id
= 0;
2328 request
->rdata
.opcode
= CTDB_CONTROL_DISABLE_NODE
;
2331 int ctdb_reply_control_disable_node(struct ctdb_reply_control
*reply
)
2333 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_DISABLE_NODE
);
2336 /* CTDB_CONTROL_ENABLE_NODE */
2338 void ctdb_req_control_enable_node(struct ctdb_req_control
*request
)
2340 request
->opcode
= CTDB_CONTROL_ENABLE_NODE
;
2343 request
->client_id
= 0;
2346 request
->rdata
.opcode
= CTDB_CONTROL_ENABLE_NODE
;
2349 int ctdb_reply_control_enable_node(struct ctdb_reply_control
*reply
)
2351 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_ENABLE_NODE
);
2354 /* CTDB_CONTROL_START_IPREALLOCATE */
2356 void ctdb_req_control_start_ipreallocate(struct ctdb_req_control
*request
)
2358 request
->opcode
= CTDB_CONTROL_START_IPREALLOCATE
;
2361 request
->client_id
= 0;
2364 request
->rdata
.opcode
= CTDB_CONTROL_START_IPREALLOCATE
;
2367 int ctdb_reply_control_start_ipreallocate(struct ctdb_reply_control
*reply
)
2369 return ctdb_reply_control_generic(reply
,
2370 CTDB_CONTROL_START_IPREALLOCATE
);