testprogs: use texpect instead of rkpty.
[Samba.git] / ctdb / include / ctdb_protocol.h
blob629c91c0cd307222f1fe7990c4929c15ed0b8f5b
1 /*
2 ctdb database library
4 Copyright (C) Andrew Tridgell 2006
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, see <http://www.gnu.org/licenses/>.
20 #ifndef _CTDB_PROTOCOL_H
21 #define _CTDB_PROTOCOL_H
23 /* location of daemon socket, set at configure time */
24 #ifdef SOCKPATH
25 #define CTDB_PATH SOCKPATH
26 #else
27 #define CTDB_PATH "/var/run/ctdb/ctdbd.socket"
28 #endif
30 /* default ctdb port number */
31 #define CTDB_PORT 4379
33 /* we must align packets to ensure ctdb works on all architectures (eg. sparc) */
34 #define CTDB_DS_ALIGNMENT 8
37 #define CTDB_NULL_FUNC 0xFF000001
38 #define CTDB_FETCH_FUNC 0xFF000002
39 #define CTDB_FETCH_WITH_HEADER_FUNC 0xFF000003
42 struct ctdb_call {
43 int call_id;
44 TDB_DATA key;
45 TDB_DATA call_data;
46 TDB_DATA reply_data;
47 uint32_t status;
48 #define CTDB_IMMEDIATE_MIGRATION 0x00000001
49 #define CTDB_CALL_FLAG_VACUUM_MIGRATION 0x00000002
50 #define CTDB_WANT_READONLY 0x00000004
51 uint32_t flags;
55 structure passed to a ctdb call backend function
57 struct ctdb_call_info {
58 TDB_DATA key; /* record key */
59 struct ctdb_ltdb_header *header;
60 TDB_DATA record_data; /* current data in the record */
61 TDB_DATA *new_data; /* optionally updated record data */
62 TDB_DATA *call_data; /* optionally passed from caller */
63 TDB_DATA *reply_data; /* optionally returned by function */
64 uint32_t status; /* optional reply status - defaults to zero */
67 #define CTDB_ERR_INVALID 1
68 #define CTDB_ERR_NOMEM 2
71 ctdb flags
73 #define CTDB_FLAG_TORTURE (1<<1)
76 a message handler ID meaning "give me all messages"
78 #define CTDB_SRVID_ALL (~(uint64_t)0)
81 srvid type : RECOVERY
83 #define CTDB_SRVID_RECOVERY 0xF100000000000000LL
86 a message handler ID meaning that the cluster has been reconfigured
88 #define CTDB_SRVID_RECONFIGURE 0xF200000000000000LL
91 a message handler ID meaning that an IP address has been released
93 #define CTDB_SRVID_RELEASE_IP 0xF300000000000000LL
96 a message handler ID meaning that an IP address has been taken
98 #define CTDB_SRVID_TAKE_IP 0xF301000000000000LL
101 a message ID to set the node flags in the recovery daemon
103 #define CTDB_SRVID_SET_NODE_FLAGS 0xF400000000000000LL
106 a message ID to ask the recovery daemon to update the expected node
107 assignment for a public ip
109 #define CTDB_SRVID_RECD_UPDATE_IP 0xF500000000000000LL
112 a message to tell the recovery daemon to fetch a set of records
114 #define CTDB_SRVID_VACUUM_FETCH 0xF700000000000000LL
117 * a message to tell recovery daemon to detach a database
119 #define CTDB_SRVID_DETACH_DATABASE 0xF701000000000000LL
121 a message to tell the recovery daemon to write a talloc memdump
122 to the log
124 #define CTDB_SRVID_MEM_DUMP 0xF800000000000000LL
126 /* A message id used to ask the recover daemon to send logs
128 #define CTDB_SRVID_GETLOG 0xF801000000000000LL
130 /* A message id used to ask the recover daemon to send logs
132 #define CTDB_SRVID_CLEARLOG 0xF802000000000000LL
135 a message ID to get the recovery daemon to push the node flags out
137 #define CTDB_SRVID_PUSH_NODE_FLAGS 0xF900000000000000LL
140 a message ID to get the recovery daemon to reload the nodes file
142 #define CTDB_SRVID_RELOAD_NODES 0xFA00000000000000LL
145 a message ID to get the recovery daemon to perform a takeover run
147 #define CTDB_SRVID_TAKEOVER_RUN 0xFB00000000000000LL
149 /* request recovery daemon to rebalance ips for a node.
150 input is uint32_t for the node id.
152 #define CTDB_SRVID_REBALANCE_NODE 0xFB01000000000000LL
154 /* A message handler ID to stop takeover runs from occurring */
155 #define CTDB_SRVID_DISABLE_TAKEOVER_RUNS 0xFB03000000000000LL
157 /* A message id to ask the recovery daemon to temporarily disable the
158 public ip checks
160 #define CTDB_SRVID_DISABLE_IP_CHECK 0xFC00000000000000LL
162 /* A dummy port used for sending back ipreallocate resposnes to the main
163 daemon
165 #define CTDB_SRVID_TAKEOVER_RUN_RESPONSE 0xFD00000000000000LL
167 /* A range of ports reserved for registering a PID (top 8 bits)
168 * All ports matching the 8 top bits are reserved for exclusive use by
169 * registering a SRVID that matches the process-id of the requesting process
171 #define CTDB_SRVID_PID_RANGE 0x0000000000000000LL
173 /* A range of ports reserved for samba (top 8 bits)
174 * All ports matching the 8 top bits are reserved for exclusive use by
175 * CIFS server
177 #define CTDB_SRVID_SAMBA_NOTIFY 0xFE00000000000000LL
178 #define CTDB_SRVID_SAMBA_RANGE 0xFE00000000000000LL
180 /* A range of ports reserved for a CTDB NFS server (top 8 bits)
181 * All ports matching the 8 top bits are reserved for exclusive use by
182 * NFS server
184 #define CTDB_SRVID_NFSD_RANGE 0xEE00000000000000LL
186 /* A range of ports reserved for a CTDB ISCSI server (top 8 bits)
187 * All ports matching the 8 top bits are reserved for exclusive use by
188 * ISCSI server
190 #define CTDB_SRVID_ISCSID_RANGE 0xDE00000000000000LL
192 /* A range of ports reserved for testing (top 8 bits)
193 * All ports matching the 8 top bits are reserved for exclusive use by
194 * test applications
196 #define CTDB_SRVID_TEST_RANGE 0xCE00000000000000LL
198 /* Range of ports reserved for traversals */
199 #define CTDB_SRVID_TRAVERSE_RANGE 0xBE00000000000000LL
201 /* used on the domain socket, send a pdu to the local daemon */
202 #define CTDB_CURRENT_NODE 0xF0000001
203 /* send a broadcast to all nodes in the cluster, active or not */
204 #define CTDB_BROADCAST_ALL 0xF0000002
205 /* send a broadcast to all nodes in the current vnn map */
206 #define CTDB_BROADCAST_VNNMAP 0xF0000003
207 /* send a broadcast to all connected nodes */
208 #define CTDB_BROADCAST_CONNECTED 0xF0000004
209 /* send a broadcast to selected connected nodes */
210 #define CTDB_MULTICAST 0xF0000005
212 /* the key used for transaction locking on persistent databases */
213 #define CTDB_TRANSACTION_LOCK_KEY "__transaction_lock__"
215 /* the key used to store persistent db sequence number */
216 #define CTDB_DB_SEQNUM_KEY "__db_sequence_number__"
218 #define MONITOR_SCRIPT_OK 0
219 #define MONITOR_SCRIPT_TIMEOUT 1
221 #define MAX_SCRIPT_NAME 31
222 #define MAX_SCRIPT_OUTPUT 511
223 struct ctdb_script_wire {
224 char name[MAX_SCRIPT_NAME+1];
225 struct timeval start;
226 struct timeval finished;
227 int32_t status;
228 char output[MAX_SCRIPT_OUTPUT+1];
231 struct ctdb_scripts_wire {
232 uint32_t num_scripts;
233 struct ctdb_script_wire scripts[1];
236 /* different calls to event scripts. */
237 enum ctdb_eventscript_call {
238 CTDB_EVENT_INIT, /* CTDB starting up: no args */
239 CTDB_EVENT_SETUP, /* CTDB starting up after transport is readdy: no args. */
240 CTDB_EVENT_STARTUP, /* CTDB starting up after initial recovery: no args. */
241 CTDB_EVENT_START_RECOVERY, /* CTDB recovery starting: no args. */
242 CTDB_EVENT_RECOVERED, /* CTDB recovery finished: no args. */
243 CTDB_EVENT_TAKE_IP, /* IP taken: interface, IP address, netmask bits. */
244 CTDB_EVENT_RELEASE_IP, /* IP released: interface, IP address, netmask bits. */
245 CTDB_EVENT_STOPPED, /* Deprecated, do not use. */
246 CTDB_EVENT_MONITOR, /* Please check if service is healthy: no args. */
247 CTDB_EVENT_STATUS, /* Deprecated, do not use. */
248 CTDB_EVENT_SHUTDOWN, /* CTDB shutting down: no args. */
249 CTDB_EVENT_RELOAD, /* Deprecated, do not use */
250 CTDB_EVENT_UPDATE_IP, /* IP updating: old interface, new interface, IP address, netmask bits. */
251 CTDB_EVENT_IPREALLOCATED, /* when a takeover_run() completes */
252 CTDB_EVENT_MAX
255 /* Mapping from enum to names. */
256 extern const char *ctdb_eventscript_call_names[];
259 operation IDs
261 enum ctdb_operation {
262 CTDB_REQ_CALL = 0,
263 CTDB_REPLY_CALL = 1,
264 CTDB_REQ_DMASTER = 2,
265 CTDB_REPLY_DMASTER = 3,
266 CTDB_REPLY_ERROR = 4,
267 CTDB_REQ_MESSAGE = 5,
268 /* #6 removed */
269 CTDB_REQ_CONTROL = 7,
270 CTDB_REPLY_CONTROL = 8,
271 CTDB_REQ_KEEPALIVE = 9,
274 #define CTDB_MAGIC 0x43544442 /* CTDB */
275 #define CTDB_VERSION 1
277 enum ctdb_controls {CTDB_CONTROL_PROCESS_EXISTS = 0,
278 CTDB_CONTROL_STATISTICS = 1,
279 /* #2 removed */
280 CTDB_CONTROL_PING = 3,
281 CTDB_CONTROL_GETDBPATH = 4,
282 CTDB_CONTROL_GETVNNMAP = 5,
283 CTDB_CONTROL_SETVNNMAP = 6,
284 CTDB_CONTROL_GET_DEBUG = 7,
285 CTDB_CONTROL_SET_DEBUG = 8,
286 CTDB_CONTROL_GET_DBMAP = 9,
287 CTDB_CONTROL_GET_NODEMAPv4 = 10, /* obsolete */
288 CTDB_CONTROL_SET_DMASTER = 11, /* obsolete */
289 /* #12 removed */
290 CTDB_CONTROL_PULL_DB = 13,
291 CTDB_CONTROL_PUSH_DB = 14,
292 CTDB_CONTROL_GET_RECMODE = 15,
293 CTDB_CONTROL_SET_RECMODE = 16,
294 CTDB_CONTROL_STATISTICS_RESET = 17,
295 CTDB_CONTROL_DB_ATTACH = 18,
296 CTDB_CONTROL_SET_CALL = 19,
297 CTDB_CONTROL_TRAVERSE_START = 20,
298 CTDB_CONTROL_TRAVERSE_ALL = 21,
299 CTDB_CONTROL_TRAVERSE_DATA = 22,
300 CTDB_CONTROL_REGISTER_SRVID = 23,
301 CTDB_CONTROL_DEREGISTER_SRVID = 24,
302 CTDB_CONTROL_GET_DBNAME = 25,
303 CTDB_CONTROL_ENABLE_SEQNUM = 26,
304 CTDB_CONTROL_UPDATE_SEQNUM = 27,
305 /* #28 removed */
306 CTDB_CONTROL_DUMP_MEMORY = 29,
307 CTDB_CONTROL_GET_PID = 30,
308 CTDB_CONTROL_GET_RECMASTER = 31,
309 CTDB_CONTROL_SET_RECMASTER = 32,
310 CTDB_CONTROL_FREEZE = 33,
311 CTDB_CONTROL_THAW = 34,
312 CTDB_CONTROL_GET_PNN = 35,
313 CTDB_CONTROL_SHUTDOWN = 36,
314 CTDB_CONTROL_GET_MONMODE = 37,
315 /* #38 removed */
316 /* #39 removed */
317 /* #40 removed */
318 /* #41 removed */
319 CTDB_CONTROL_TAKEOVER_IPv4 = 42, /* obsolete */
320 CTDB_CONTROL_RELEASE_IPv4 = 43, /* obsolete */
321 CTDB_CONTROL_TCP_CLIENT = 44,
322 CTDB_CONTROL_TCP_ADD = 45,
323 CTDB_CONTROL_TCP_REMOVE = 46,
324 CTDB_CONTROL_STARTUP = 47,
325 CTDB_CONTROL_SET_TUNABLE = 48,
326 CTDB_CONTROL_GET_TUNABLE = 49,
327 CTDB_CONTROL_LIST_TUNABLES = 50,
328 CTDB_CONTROL_GET_PUBLIC_IPSv4 = 51, /* obsolete */
329 CTDB_CONTROL_MODIFY_FLAGS = 52,
330 CTDB_CONTROL_GET_ALL_TUNABLES = 53,
331 CTDB_CONTROL_KILL_TCP = 54,
332 CTDB_CONTROL_GET_TCP_TICKLE_LIST = 55,
333 CTDB_CONTROL_SET_TCP_TICKLE_LIST = 56,
334 CTDB_CONTROL_REGISTER_SERVER_ID = 57,
335 CTDB_CONTROL_UNREGISTER_SERVER_ID = 58,
336 CTDB_CONTROL_CHECK_SERVER_ID = 59,
337 CTDB_CONTROL_GET_SERVER_ID_LIST = 60,
338 CTDB_CONTROL_DB_ATTACH_PERSISTENT = 61,
339 CTDB_CONTROL_PERSISTENT_STORE = 62, /* obsolete */
340 CTDB_CONTROL_UPDATE_RECORD = 63,
341 CTDB_CONTROL_SEND_GRATIOUS_ARP = 64,
342 CTDB_CONTROL_TRANSACTION_START = 65,
343 CTDB_CONTROL_TRANSACTION_COMMIT = 66,
344 CTDB_CONTROL_WIPE_DATABASE = 67,
345 /* #68 removed */
346 CTDB_CONTROL_UPTIME = 69,
347 CTDB_CONTROL_START_RECOVERY = 70,
348 CTDB_CONTROL_END_RECOVERY = 71,
349 CTDB_CONTROL_RELOAD_NODES_FILE = 72,
350 /* #73 removed */
351 CTDB_CONTROL_TRY_DELETE_RECORDS = 74,
352 CTDB_CONTROL_ENABLE_MONITOR = 75,
353 CTDB_CONTROL_DISABLE_MONITOR = 76,
354 CTDB_CONTROL_ADD_PUBLIC_IP = 77,
355 CTDB_CONTROL_DEL_PUBLIC_IP = 78,
356 CTDB_CONTROL_RUN_EVENTSCRIPTS = 79,
357 CTDB_CONTROL_GET_CAPABILITIES = 80,
358 CTDB_CONTROL_START_PERSISTENT_UPDATE = 81,
359 CTDB_CONTROL_CANCEL_PERSISTENT_UPDATE= 82,
360 CTDB_CONTROL_TRANS2_COMMIT = 83, /* obsolete */
361 CTDB_CONTROL_TRANS2_FINISHED = 84, /* obsolete */
362 CTDB_CONTROL_TRANS2_ERROR = 85, /* obsolete */
363 CTDB_CONTROL_TRANS2_COMMIT_RETRY = 86, /* obsolete */
364 CTDB_CONTROL_RECD_PING = 87,
365 CTDB_CONTROL_RELEASE_IP = 88,
366 CTDB_CONTROL_TAKEOVER_IP = 89,
367 CTDB_CONTROL_GET_PUBLIC_IPS = 90,
368 CTDB_CONTROL_GET_NODEMAP = 91,
369 CTDB_CONTROL_GET_EVENT_SCRIPT_STATUS = 96,
370 CTDB_CONTROL_TRAVERSE_KILL = 97,
371 CTDB_CONTROL_RECD_RECLOCK_LATENCY = 98,
372 CTDB_CONTROL_GET_RECLOCK_FILE = 99,
373 CTDB_CONTROL_SET_RECLOCK_FILE = 100,
374 CTDB_CONTROL_STOP_NODE = 101,
375 CTDB_CONTROL_CONTINUE_NODE = 102,
376 CTDB_CONTROL_SET_NATGWSTATE = 103,
377 CTDB_CONTROL_SET_LMASTERROLE = 104,
378 CTDB_CONTROL_SET_RECMASTERROLE = 105,
379 CTDB_CONTROL_ENABLE_SCRIPT = 107,
380 CTDB_CONTROL_DISABLE_SCRIPT = 108,
381 CTDB_CONTROL_SET_BAN_STATE = 109,
382 CTDB_CONTROL_GET_BAN_STATE = 110,
383 CTDB_CONTROL_SET_DB_PRIORITY = 111,
384 CTDB_CONTROL_GET_DB_PRIORITY = 112,
385 CTDB_CONTROL_TRANSACTION_CANCEL = 113,
386 CTDB_CONTROL_REGISTER_NOTIFY = 114,
387 CTDB_CONTROL_DEREGISTER_NOTIFY = 115,
388 CTDB_CONTROL_TRANS2_ACTIVE = 116, /* obsolete */
389 CTDB_CONTROL_GET_LOG = 117,
390 CTDB_CONTROL_CLEAR_LOG = 118,
391 CTDB_CONTROL_TRANS3_COMMIT = 119,
392 CTDB_CONTROL_GET_DB_SEQNUM = 120,
393 CTDB_CONTROL_DB_SET_HEALTHY = 121,
394 CTDB_CONTROL_DB_GET_HEALTH = 122,
395 CTDB_CONTROL_GET_PUBLIC_IP_INFO = 123,
396 CTDB_CONTROL_GET_IFACES = 124,
397 CTDB_CONTROL_SET_IFACE_LINK_STATE = 125,
398 CTDB_CONTROL_TCP_ADD_DELAYED_UPDATE = 126,
399 CTDB_CONTROL_GET_STAT_HISTORY = 127,
400 CTDB_CONTROL_SCHEDULE_FOR_DELETION = 128,
401 CTDB_CONTROL_SET_DB_READONLY = 129,
402 CTDB_CONTROL_CHECK_SRVIDS = 130,
403 CTDB_CONTROL_TRAVERSE_START_EXT = 131,
404 CTDB_CONTROL_GET_DB_STATISTICS = 132,
405 CTDB_CONTROL_SET_DB_STICKY = 133,
406 CTDB_CONTROL_RELOAD_PUBLIC_IPS = 134,
407 CTDB_CONTROL_TRAVERSE_ALL_EXT = 135,
408 CTDB_CONTROL_RECEIVE_RECORDS = 136,
409 CTDB_CONTROL_IPREALLOCATED = 137,
410 CTDB_CONTROL_GET_RUNSTATE = 138,
411 CTDB_CONTROL_DB_DETACH = 139,
415 packet structures
417 struct ctdb_req_header {
418 uint32_t length;
419 uint32_t ctdb_magic;
420 uint32_t ctdb_version;
421 uint32_t generation;
422 uint32_t operation;
423 uint32_t destnode;
424 uint32_t srcnode;
425 uint32_t reqid;
428 struct ctdb_req_call {
429 struct ctdb_req_header hdr;
430 uint32_t flags;
431 uint32_t db_id;
432 uint32_t callid;
433 uint32_t hopcount;
434 uint32_t keylen;
435 uint32_t calldatalen;
436 uint8_t data[1]; /* key[] followed by calldata[] */
439 struct ctdb_reply_call {
440 struct ctdb_req_header hdr;
441 uint32_t status;
442 uint32_t datalen;
443 uint8_t data[1];
446 struct ctdb_reply_error {
447 struct ctdb_req_header hdr;
448 uint32_t status;
449 uint32_t msglen;
450 uint8_t msg[1];
453 struct ctdb_req_dmaster {
454 struct ctdb_req_header hdr;
455 uint32_t db_id;
456 uint64_t rsn;
457 uint32_t dmaster;
458 uint32_t keylen;
459 uint32_t datalen;
460 uint8_t data[1];
463 struct ctdb_reply_dmaster {
464 struct ctdb_req_header hdr;
465 uint32_t db_id;
466 uint64_t rsn;
467 uint32_t keylen;
468 uint32_t datalen;
469 uint8_t data[1];
472 struct ctdb_req_message {
473 struct ctdb_req_header hdr;
474 uint64_t srvid;
475 uint32_t datalen;
476 uint8_t data[1];
479 struct ctdb_req_getdbpath {
480 struct ctdb_req_header hdr;
481 uint32_t db_id;
484 struct ctdb_reply_getdbpath {
485 struct ctdb_req_header hdr;
486 uint32_t datalen;
487 uint8_t data[1];
490 struct ctdb_req_control {
491 struct ctdb_req_header hdr;
492 uint32_t opcode;
493 uint32_t pad;
494 uint64_t srvid;
495 uint32_t client_id;
496 #define CTDB_CTRL_FLAG_NOREPLY 1
497 #define CTDB_CTRL_FLAG_OPCODE_SPECIFIC 0xFFFF0000
498 uint32_t flags;
499 uint32_t datalen;
500 uint8_t data[1];
503 struct ctdb_reply_control {
504 struct ctdb_req_header hdr;
505 int32_t status;
506 uint32_t datalen;
507 uint32_t errorlen;
508 uint8_t data[1];
511 struct ctdb_req_keepalive {
512 struct ctdb_req_header hdr;
517 the extended header for records in the ltdb
519 struct ctdb_ltdb_header {
520 uint64_t rsn;
521 uint32_t dmaster;
522 uint32_t reserved1;
523 #define CTDB_REC_FLAG_DEFAULT 0x00000000
524 #define CTDB_REC_FLAG_MIGRATED_WITH_DATA 0x00010000
525 #define CTDB_REC_FLAG_VACUUM_MIGRATED 0x00020000
526 #define CTDB_REC_FLAG_AUTOMATIC 0x00040000
527 #define CTDB_REC_RO_HAVE_DELEGATIONS 0x01000000
528 #define CTDB_REC_RO_HAVE_READONLY 0x02000000
529 #define CTDB_REC_RO_REVOKING_READONLY 0x04000000
530 #define CTDB_REC_RO_REVOKE_COMPLETE 0x08000000
531 #define CTDB_REC_RO_FLAGS (CTDB_REC_RO_HAVE_DELEGATIONS|\
532 CTDB_REC_RO_HAVE_READONLY|\
533 CTDB_REC_RO_REVOKING_READONLY|\
534 CTDB_REC_RO_REVOKE_COMPLETE)
535 uint32_t flags;
540 definitions for different socket structures
542 typedef struct sockaddr_in ctdb_addr_in;
543 typedef struct sockaddr_in6 ctdb_addr_in6;
544 typedef union {
545 struct sockaddr sa;
546 ctdb_addr_in ip;
547 ctdb_addr_in6 ip6;
548 } ctdb_sock_addr;
551 A structure describing a single node, its flags and its address
553 struct ctdb_node_and_flags {
554 uint32_t pnn;
555 uint32_t flags;
556 ctdb_sock_addr addr;
561 Structure used for a nodemap.
562 The nodemap is the structure containing a list of all nodes
563 known to the cluster and their associated flags.
565 struct ctdb_node_map {
566 uint32_t num;
567 struct ctdb_node_and_flags nodes[1];
571 * Node flags
573 #define NODE_FLAGS_DISCONNECTED 0x00000001 /* node isn't connected */
574 #define NODE_FLAGS_UNHEALTHY 0x00000002 /* monitoring says node is unhealthy */
575 #define NODE_FLAGS_PERMANENTLY_DISABLED 0x00000004 /* administrator has disabled node */
576 #define NODE_FLAGS_BANNED 0x00000008 /* recovery daemon has banned the node */
577 #define NODE_FLAGS_DELETED 0x00000010 /* this node has been deleted */
578 #define NODE_FLAGS_STOPPED 0x00000020 /* this node has been stopped */
579 #define NODE_FLAGS_DISABLED (NODE_FLAGS_UNHEALTHY|NODE_FLAGS_PERMANENTLY_DISABLED)
580 #define NODE_FLAGS_INACTIVE (NODE_FLAGS_DELETED|NODE_FLAGS_DISCONNECTED|NODE_FLAGS_BANNED|NODE_FLAGS_STOPPED)
583 * Node capabilities
585 #define CTDB_CAP_RECMASTER 0x00000001
586 #define CTDB_CAP_LMASTER 0x00000002
587 /* This capability is set if CTDB_LVS_PUBLIC_IP is set */
588 #define CTDB_CAP_LVS 0x00000004
589 /* This capability is set if NATGW is enabled */
590 #define CTDB_CAP_NATGW 0x00000008
593 struct ctdb_public_ip {
594 uint32_t pnn;
595 ctdb_sock_addr addr;
598 struct ctdb_all_public_ips {
599 uint32_t num;
600 struct ctdb_public_ip ips[1];
604 struct latency_counter {
605 int num;
606 double min;
607 double max;
608 double total;
612 structure used to pass record data between the child and parent
614 struct ctdb_rec_data {
615 uint32_t length;
616 uint32_t reqid;
617 uint32_t keylen;
618 uint32_t datalen;
619 uint8_t data[1];
622 struct ctdb_traverse_start {
623 uint32_t db_id;
624 uint32_t reqid;
625 uint64_t srvid;
628 struct ctdb_traverse_start_ext {
629 uint32_t db_id;
630 uint32_t reqid;
631 uint64_t srvid;
632 bool withemptyrecords;
636 ctdb statistics information
638 #define MAX_COUNT_BUCKETS 16
639 #define MAX_HOT_KEYS 10
641 struct ctdb_statistics {
642 uint32_t num_clients;
643 uint32_t frozen;
644 uint32_t recovering;
645 uint32_t client_packets_sent;
646 uint32_t client_packets_recv;
647 uint32_t node_packets_sent;
648 uint32_t node_packets_recv;
649 uint32_t keepalive_packets_sent;
650 uint32_t keepalive_packets_recv;
651 struct {
652 uint32_t req_call;
653 uint32_t reply_call;
654 uint32_t req_dmaster;
655 uint32_t reply_dmaster;
656 uint32_t reply_error;
657 uint32_t req_message;
658 uint32_t req_control;
659 uint32_t reply_control;
660 } node;
661 struct {
662 uint32_t req_call;
663 uint32_t req_message;
664 uint32_t req_control;
665 } client;
666 struct {
667 uint32_t call;
668 uint32_t control;
669 uint32_t traverse;
670 } timeouts;
671 struct {
672 struct latency_counter ctdbd;
673 struct latency_counter recd;
674 } reclock;
675 struct {
676 uint32_t num_calls;
677 uint32_t num_current;
678 uint32_t num_pending;
679 uint32_t num_failed;
680 struct latency_counter latency;
681 uint32_t buckets[MAX_COUNT_BUCKETS];
682 } locks;
683 uint32_t total_calls;
684 uint32_t pending_calls;
685 uint32_t childwrite_calls;
686 uint32_t pending_childwrite_calls;
687 uint32_t memory_used;
688 uint32_t __last_counter; /* hack for control_statistics_all */
689 uint32_t max_hop_count;
690 uint32_t hop_count_bucket[MAX_COUNT_BUCKETS];
691 struct latency_counter call_latency;
692 struct latency_counter childwrite_latency;
693 uint32_t num_recoveries;
694 struct timeval statistics_start_time;
695 struct timeval statistics_current_time;
696 uint32_t total_ro_delegations;
697 uint32_t total_ro_revokes;
701 * wire format for statistics history
703 struct ctdb_statistics_wire {
704 uint32_t num;
705 struct ctdb_statistics stats[1];
709 * db statistics
711 struct ctdb_db_statistics {
712 struct {
713 uint32_t num_calls;
714 uint32_t num_current;
715 uint32_t num_pending;
716 uint32_t num_failed;
717 struct latency_counter latency;
718 uint32_t buckets[MAX_COUNT_BUCKETS];
719 } locks;
720 uint32_t db_ro_delegations;
721 uint32_t db_ro_revokes;
722 uint32_t hop_count_bucket[MAX_COUNT_BUCKETS];
723 uint32_t num_hot_keys;
724 struct {
725 uint32_t count;
726 TDB_DATA key;
727 } hot_keys[MAX_HOT_KEYS];
728 char hot_keys_wire[1];
732 * wire format for interface list
734 #ifdef IFNAMSIZ
735 #define CTDB_IFACE_SIZE IFNAMSIZ
736 #else
737 #define CTDB_IFACE_SIZE 16
738 #endif
740 struct ctdb_iface_info {
741 char name[CTDB_IFACE_SIZE+2];
742 uint16_t link_state;
743 uint32_t references;
746 struct ctdb_ifaces_list {
747 uint32_t num;
748 struct ctdb_iface_info ifaces[1];
751 #define INVALID_GENERATION 1
752 /* table that contains the mapping between a hash value and lmaster
754 struct ctdb_vnn_map {
755 uint32_t generation;
756 uint32_t size;
757 uint32_t *map;
761 a wire representation of the vnn map
763 struct ctdb_vnn_map_wire {
764 uint32_t generation;
765 uint32_t size;
766 uint32_t map[1];
769 #endif