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