LIBCTDB: add support for traverse
[sahlberg/ctdb.git] / include / ctdb_protocol.h
1 /*
2    ctdb database library
3
4    Copyright (C) Andrew Tridgell  2006
5
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.
10
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.
15
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/>.
18 */
19
20 #ifndef _CTDB_PROTOCOL_H
21 #define _CTDB_PROTOCOL_H
22
23 /* location of daemon socket */
24 #define CTDB_PATH       "/tmp/ctdb.socket"
25
26 /* default ctdb port number */
27 #define CTDB_PORT 4379
28
29 /* we must align packets to ensure ctdb works on all architectures (eg. sparc) */
30 #define CTDB_DS_ALIGNMENT 8
31
32
33 #define CTDB_NULL_FUNC      0xFF000001
34 #define CTDB_FETCH_FUNC     0xFF000002
35
36
37 #define CTDB_IMMEDIATE_MIGRATION        0x00000001
38 struct ctdb_call {
39         int call_id;
40         TDB_DATA key;
41         TDB_DATA call_data;
42         TDB_DATA reply_data;
43         uint32_t status;
44         uint32_t flags;
45 };
46
47 /*
48   structure passed to a ctdb call backend function
49 */
50 struct ctdb_call_info {
51         TDB_DATA key;          /* record key */
52         TDB_DATA record_data;  /* current data in the record */
53         TDB_DATA *new_data;    /* optionally updated record data */
54         TDB_DATA *call_data;   /* optionally passed from caller */
55         TDB_DATA *reply_data;  /* optionally returned by function */
56         uint32_t status;       /* optional reply status - defaults to zero */
57 };
58
59 #define CTDB_ERR_INVALID 1
60 #define CTDB_ERR_NOMEM 2
61
62 /*
63   ctdb flags
64 */
65 #define CTDB_FLAG_TORTURE      (1<<1)
66
67 /*
68    a message handler ID meaning "give me all messages"
69  */
70 #define CTDB_SRVID_ALL (~(uint64_t)0)
71
72 /*
73   srvid type : RECOVERY
74 */
75 #define CTDB_SRVID_RECOVERY     0xF100000000000000LL
76
77 /*
78    a message handler ID meaning that the cluster has been reconfigured
79  */
80 #define CTDB_SRVID_RECONFIGURE 0xF200000000000000LL
81
82 /*
83    a message handler ID meaning that an IP address has been released
84  */
85 #define CTDB_SRVID_RELEASE_IP 0xF300000000000000LL
86
87 /*
88    a message handler ID meaning that an IP address has been taken
89  */
90 #define CTDB_SRVID_TAKE_IP 0xF301000000000000LL
91
92 /*
93    a message ID to set the node flags in the recovery daemon
94  */
95 #define CTDB_SRVID_SET_NODE_FLAGS 0xF400000000000000LL
96
97 /*
98    a message ID to ask the recovery daemon to update the expected node
99    assignment for a public ip
100  */
101 #define CTDB_SRVID_RECD_UPDATE_IP 0xF500000000000000LL
102
103 /*
104   a message to tell the recovery daemon to fetch a set of records
105  */
106 #define CTDB_SRVID_VACUUM_FETCH 0xF700000000000000LL
107
108 /*
109   a message to tell the recovery daemon to write a talloc memdump
110   to the log
111  */
112 #define CTDB_SRVID_MEM_DUMP 0xF800000000000000LL
113
114 /*
115    a message ID to get the recovery daemon to push the node flags out
116  */
117 #define CTDB_SRVID_PUSH_NODE_FLAGS 0xF900000000000000LL
118
119 /*
120    a message ID to get the recovery daemon to reload the nodes file
121  */
122 #define CTDB_SRVID_RELOAD_NODES 0xFA00000000000000LL
123
124 /*
125    a message ID to get the recovery daemon to perform a takeover run
126  */
127 #define CTDB_SRVID_TAKEOVER_RUN 0xFB00000000000000LL
128
129 /* A message id to ask the recovery daemon to temporarily disable the
130    public ip checks
131 */
132 #define CTDB_SRVID_DISABLE_IP_CHECK  0xFC00000000000000LL
133
134 /* A dummy port used for sending back ipreallocate resposnes to the main
135    daemon
136 */
137 #define CTDB_SRVID_TAKEOVER_RUN_RESPONSE  0xFD00000000000000LL
138
139 /* A range of ports reserved for samba (top 32 bits)
140  * All ports matching the 32 top bits are reserved for exclusive use by
141  * CIFS server
142  */
143 #define CTDB_SRVID_SAMBA_NOTIFY  0xFE00000000000000LL
144 #define CTDB_SRVID_SAMBA_RANGE   0xFE00000000000000LL
145
146 /* A range of ports reserved for a CTDB NFS server (top 32 bits)
147  * All ports matching the 32 top bits are reserved for exclusive use by
148  * NFS server
149  */
150 #define CTDB_SRVID_NFSD_RANGE  0xFE01000000000000LL
151
152 /* A range of ports reserved for a CTDB ISCSI server (top 32 bits)
153  * All ports matching the 32 top bits are reserved for exclusive use by
154  * ISCSI server
155  */
156 #define CTDB_SRVID_ISCSID_RANGE  0xFE02000000000000LL
157
158 /* A range of ports reserved for testing (top 32 bits)
159  * All ports matching the 32 top bits are reserved for exclusive use by
160  * test applications
161  */
162 #define CTDB_SRVID_TEST_RANGE  0xFE03000000000000LL
163
164 /* Range of ports reserved for traversals */
165 #define CTDB_SRVID_TRAVERSE_RANGE  0xFE04000000000000LL
166
167 /* used on the domain socket, send a pdu to the local daemon */
168 #define CTDB_CURRENT_NODE     0xF0000001
169 /* send a broadcast to all nodes in the cluster, active or not */
170 #define CTDB_BROADCAST_ALL    0xF0000002
171 /* send a broadcast to all nodes in the current vnn map */
172 #define CTDB_BROADCAST_VNNMAP 0xF0000003
173 /* send a broadcast to all connected nodes */
174 #define CTDB_BROADCAST_CONNECTED 0xF0000004
175
176 /* the key used for transaction locking on persistent databases */
177 #define CTDB_TRANSACTION_LOCK_KEY "__transaction_lock__"
178
179 /* the key used to store persistent db sequence number */
180 #define CTDB_DB_SEQNUM_KEY "__db_sequence_number__"
181
182 #define MONITOR_SCRIPT_OK      0
183 #define MONITOR_SCRIPT_TIMEOUT 1
184
185 #define MAX_SCRIPT_NAME 31
186 #define MAX_SCRIPT_OUTPUT 511
187 struct ctdb_script_wire {
188         char name[MAX_SCRIPT_NAME+1];
189         struct timeval start;
190         struct timeval finished;
191         int32_t status;
192         char output[MAX_SCRIPT_OUTPUT+1];
193 };
194
195 struct ctdb_scripts_wire {
196         uint32_t num_scripts;
197         struct ctdb_script_wire scripts[1];
198 };
199
200 /* different calls to event scripts. */
201 enum ctdb_eventscript_call {
202         CTDB_EVENT_INIT,                /* CTDB starting up: no args */
203         CTDB_EVENT_SETUP,               /* CTDB starting up after transport is readdy: no args. */
204         CTDB_EVENT_STARTUP,             /* CTDB starting up after initial recovery: no args. */
205         CTDB_EVENT_START_RECOVERY,      /* CTDB recovery starting: no args. */
206         CTDB_EVENT_RECOVERED,           /* CTDB recovery finished: no args. */
207         CTDB_EVENT_TAKE_IP,             /* IP taken: interface, IP address, netmask bits. */
208         CTDB_EVENT_RELEASE_IP,          /* IP released: interface, IP address, netmask bits. */
209         CTDB_EVENT_STOPPED,             /* This node is stopped: no args. */
210         CTDB_EVENT_MONITOR,             /* Please check if service is healthy: no args. */
211         CTDB_EVENT_STATUS,              /* Report service status: no args. */
212         CTDB_EVENT_SHUTDOWN,            /* CTDB shutting down: no args. */
213         CTDB_EVENT_RELOAD,              /* magic */
214         CTDB_EVENT_UPDATE_IP,           /* IP updating: old interface, new interface, IP address, netmask bits. */
215         CTDB_EVENT_IPREALLOCATED,       /* when a takeover_run() completes */
216         CTDB_EVENT_MAX
217 };
218
219 /* Mapping from enum to names. */
220 extern const char *ctdb_eventscript_call_names[];
221
222 /*
223   operation IDs
224 */
225 enum ctdb_operation {
226         CTDB_REQ_CALL           = 0,
227         CTDB_REPLY_CALL         = 1,
228         CTDB_REQ_DMASTER        = 2,
229         CTDB_REPLY_DMASTER      = 3,
230         CTDB_REPLY_ERROR        = 4,
231         CTDB_REQ_MESSAGE        = 5,
232         /* #6 removed */
233         CTDB_REQ_CONTROL        = 7,
234         CTDB_REPLY_CONTROL      = 8,
235         CTDB_REQ_KEEPALIVE      = 9,
236 };
237
238 #define CTDB_MAGIC 0x43544442 /* CTDB */
239 #define CTDB_VERSION 1
240
241 enum ctdb_controls {CTDB_CONTROL_PROCESS_EXISTS          = 0,
242                     CTDB_CONTROL_STATISTICS              = 1,
243                     /* #2 removed */
244                     CTDB_CONTROL_PING                    = 3,
245                     CTDB_CONTROL_GETDBPATH               = 4,
246                     CTDB_CONTROL_GETVNNMAP               = 5,
247                     CTDB_CONTROL_SETVNNMAP               = 6,
248                     CTDB_CONTROL_GET_DEBUG               = 7,
249                     CTDB_CONTROL_SET_DEBUG               = 8,
250                     CTDB_CONTROL_GET_DBMAP               = 9,
251                     CTDB_CONTROL_GET_NODEMAPv4           = 10, /* obsolete */
252                     CTDB_CONTROL_SET_DMASTER             = 11,
253                     /* #12 removed */
254                     CTDB_CONTROL_PULL_DB                 = 13,
255                     CTDB_CONTROL_PUSH_DB                 = 14,
256                     CTDB_CONTROL_GET_RECMODE             = 15,
257                     CTDB_CONTROL_SET_RECMODE             = 16,
258                     CTDB_CONTROL_STATISTICS_RESET        = 17,
259                     CTDB_CONTROL_DB_ATTACH               = 18,
260                     CTDB_CONTROL_SET_CALL                = 19,
261                     CTDB_CONTROL_TRAVERSE_START          = 20,
262                     CTDB_CONTROL_TRAVERSE_ALL            = 21,
263                     CTDB_CONTROL_TRAVERSE_DATA           = 22,
264                     CTDB_CONTROL_REGISTER_SRVID          = 23,
265                     CTDB_CONTROL_DEREGISTER_SRVID        = 24,
266                     CTDB_CONTROL_GET_DBNAME              = 25,
267                     CTDB_CONTROL_ENABLE_SEQNUM           = 26,
268                     CTDB_CONTROL_UPDATE_SEQNUM           = 27,
269                     /* #28 removed */
270                     CTDB_CONTROL_DUMP_MEMORY             = 29,
271                     CTDB_CONTROL_GET_PID                 = 30,
272                     CTDB_CONTROL_GET_RECMASTER           = 31,
273                     CTDB_CONTROL_SET_RECMASTER           = 32,
274                     CTDB_CONTROL_FREEZE                  = 33,
275                     CTDB_CONTROL_THAW                    = 34,
276                     CTDB_CONTROL_GET_PNN                 = 35,
277                     CTDB_CONTROL_SHUTDOWN                = 36,
278                     CTDB_CONTROL_GET_MONMODE             = 37,
279                     /* #38 removed */
280                     /* #39 removed */
281                     /* #40 removed */
282                     /* #41 removed */
283                     CTDB_CONTROL_TAKEOVER_IPv4           = 42, /* obsolete */
284                     CTDB_CONTROL_RELEASE_IPv4            = 43, /* obsolete */
285                     CTDB_CONTROL_TCP_CLIENT              = 44,
286                     CTDB_CONTROL_TCP_ADD                 = 45,
287                     CTDB_CONTROL_TCP_REMOVE              = 46,
288                     CTDB_CONTROL_STARTUP                 = 47,
289                     CTDB_CONTROL_SET_TUNABLE             = 48,
290                     CTDB_CONTROL_GET_TUNABLE             = 49,
291                     CTDB_CONTROL_LIST_TUNABLES           = 50,
292                     CTDB_CONTROL_GET_PUBLIC_IPSv4        = 51, /* obsolete */
293                     CTDB_CONTROL_MODIFY_FLAGS            = 52,
294                     CTDB_CONTROL_GET_ALL_TUNABLES        = 53,
295                     CTDB_CONTROL_KILL_TCP                = 54,
296                     CTDB_CONTROL_GET_TCP_TICKLE_LIST     = 55,
297                     CTDB_CONTROL_SET_TCP_TICKLE_LIST     = 56,
298                     CTDB_CONTROL_REGISTER_SERVER_ID      = 57,
299                     CTDB_CONTROL_UNREGISTER_SERVER_ID    = 58,
300                     CTDB_CONTROL_CHECK_SERVER_ID         = 59,
301                     CTDB_CONTROL_GET_SERVER_ID_LIST      = 60,
302                     CTDB_CONTROL_DB_ATTACH_PERSISTENT    = 61,
303                     CTDB_CONTROL_PERSISTENT_STORE        = 62,
304                     CTDB_CONTROL_UPDATE_RECORD           = 63,
305                     CTDB_CONTROL_SEND_GRATIOUS_ARP       = 64,
306                     CTDB_CONTROL_TRANSACTION_START       = 65,
307                     CTDB_CONTROL_TRANSACTION_COMMIT      = 66,
308                     CTDB_CONTROL_WIPE_DATABASE           = 67,
309                     /* #68 removed */
310                     CTDB_CONTROL_UPTIME                  = 69,
311                     CTDB_CONTROL_START_RECOVERY          = 70,
312                     CTDB_CONTROL_END_RECOVERY            = 71,
313                     CTDB_CONTROL_RELOAD_NODES_FILE       = 72,
314                     /* #73 removed */
315                     CTDB_CONTROL_TRY_DELETE_RECORDS      = 74,
316                     CTDB_CONTROL_ENABLE_MONITOR          = 75,
317                     CTDB_CONTROL_DISABLE_MONITOR         = 76,
318                     CTDB_CONTROL_ADD_PUBLIC_IP           = 77,
319                     CTDB_CONTROL_DEL_PUBLIC_IP           = 78,
320                     CTDB_CONTROL_RUN_EVENTSCRIPTS        = 79,
321                     CTDB_CONTROL_GET_CAPABILITIES        = 80,
322                     CTDB_CONTROL_START_PERSISTENT_UPDATE = 81,
323                     CTDB_CONTROL_CANCEL_PERSISTENT_UPDATE= 82,
324                     CTDB_CONTROL_TRANS2_COMMIT           = 83,
325                     CTDB_CONTROL_TRANS2_FINISHED         = 84,
326                     CTDB_CONTROL_TRANS2_ERROR            = 85,
327                     CTDB_CONTROL_TRANS2_COMMIT_RETRY     = 86,
328                     CTDB_CONTROL_RECD_PING               = 87,
329                     CTDB_CONTROL_RELEASE_IP              = 88,
330                     CTDB_CONTROL_TAKEOVER_IP             = 89,
331                     CTDB_CONTROL_GET_PUBLIC_IPS          = 90,
332                     CTDB_CONTROL_GET_NODEMAP             = 91,
333                     CTDB_CONTROL_GET_EVENT_SCRIPT_STATUS = 96,
334                     CTDB_CONTROL_TRAVERSE_KILL           = 97,
335                     CTDB_CONTROL_RECD_RECLOCK_LATENCY    = 98,
336                     CTDB_CONTROL_GET_RECLOCK_FILE        = 99,
337                     CTDB_CONTROL_SET_RECLOCK_FILE        = 100,
338                     CTDB_CONTROL_STOP_NODE               = 101,
339                     CTDB_CONTROL_CONTINUE_NODE           = 102,
340                     CTDB_CONTROL_SET_NATGWSTATE          = 103,
341                     CTDB_CONTROL_SET_LMASTERROLE         = 104,
342                     CTDB_CONTROL_SET_RECMASTERROLE       = 105,
343                     CTDB_CONTROL_ENABLE_SCRIPT           = 107,
344                     CTDB_CONTROL_DISABLE_SCRIPT          = 108,
345                     CTDB_CONTROL_SET_BAN_STATE           = 109,
346                     CTDB_CONTROL_GET_BAN_STATE           = 110,
347                     CTDB_CONTROL_SET_DB_PRIORITY         = 111,
348                     CTDB_CONTROL_GET_DB_PRIORITY         = 112,
349                     CTDB_CONTROL_TRANSACTION_CANCEL      = 113,
350                     CTDB_CONTROL_REGISTER_NOTIFY         = 114,
351                     CTDB_CONTROL_DEREGISTER_NOTIFY       = 115,
352                     CTDB_CONTROL_TRANS2_ACTIVE           = 116,
353                     CTDB_CONTROL_GET_LOG                 = 117,
354                     CTDB_CONTROL_CLEAR_LOG               = 118,
355                     CTDB_CONTROL_TRANS3_COMMIT           = 119,
356                     CTDB_CONTROL_GET_DB_SEQNUM           = 120,
357                     CTDB_CONTROL_DB_SET_HEALTHY          = 121,
358                     CTDB_CONTROL_DB_GET_HEALTH           = 122,
359                     CTDB_CONTROL_GET_PUBLIC_IP_INFO      = 123,
360                     CTDB_CONTROL_GET_IFACES              = 124,
361                     CTDB_CONTROL_SET_IFACE_LINK_STATE    = 125,
362                     CTDB_CONTROL_TCP_ADD_DELAYED_UPDATE  = 126,
363                     CTDB_CONTROL_GET_STAT_HISTORY        = 127,
364 };
365
366 /*
367   packet structures
368 */
369 struct ctdb_req_header {
370         uint32_t length;
371         uint32_t ctdb_magic;
372         uint32_t ctdb_version;
373         uint32_t generation;
374         uint32_t operation;
375         uint32_t destnode;
376         uint32_t srcnode;
377         uint32_t reqid;
378 };
379
380 struct ctdb_req_call {
381         struct ctdb_req_header hdr;
382         uint32_t flags;
383         uint32_t db_id;
384         uint32_t callid;
385         uint32_t hopcount;
386         uint32_t keylen;
387         uint32_t calldatalen;
388         uint8_t data[1]; /* key[] followed by calldata[] */
389 };
390
391 struct ctdb_reply_call {
392         struct ctdb_req_header hdr;
393         uint32_t status;
394         uint32_t datalen;
395         uint8_t  data[1];
396 };
397
398 struct ctdb_reply_error {
399         struct ctdb_req_header hdr;
400         uint32_t status;
401         uint32_t msglen;
402         uint8_t  msg[1];
403 };
404
405 struct ctdb_req_dmaster {
406         struct ctdb_req_header hdr;
407         uint32_t db_id;
408         uint64_t rsn;
409         uint32_t dmaster;
410         uint32_t keylen;
411         uint32_t datalen;
412         uint8_t  data[1];
413 };
414
415 struct ctdb_reply_dmaster {
416         struct ctdb_req_header hdr;
417         uint32_t db_id;
418         uint64_t rsn;
419         uint32_t keylen;
420         uint32_t datalen;
421         uint8_t  data[1];
422 };
423
424 struct ctdb_req_message {
425         struct ctdb_req_header hdr;
426         uint64_t srvid;
427         uint32_t datalen;
428         uint8_t data[1];
429 };
430
431 struct ctdb_req_getdbpath {
432         struct ctdb_req_header hdr;
433         uint32_t db_id;
434 };
435
436 struct ctdb_reply_getdbpath {
437         struct ctdb_req_header hdr;
438         uint32_t datalen;
439         uint8_t data[1];
440 };
441
442 struct ctdb_req_control {
443         struct ctdb_req_header hdr;
444         uint32_t opcode;
445         uint32_t pad;
446         uint64_t srvid;
447         uint32_t client_id;
448 #define CTDB_CTRL_FLAG_NOREPLY   1
449 #define CTDB_CTRL_FLAG_OPCODE_SPECIFIC   0xFFFF0000
450         uint32_t flags;
451         uint32_t datalen;
452         uint8_t data[1];
453 };
454
455 struct ctdb_reply_control {
456         struct ctdb_req_header hdr;
457         int32_t  status;
458         uint32_t datalen;
459         uint32_t errorlen;
460         uint8_t data[1];
461 };
462
463 struct ctdb_req_keepalive {
464         struct ctdb_req_header hdr;
465 };
466
467
468 /* types of failures possible from TRANS2_COMMIT */
469 enum ctdb_trans2_commit_error {
470         CTDB_TRANS2_COMMIT_SUCCESS=0, /* all nodes committed successfully */
471         CTDB_TRANS2_COMMIT_TIMEOUT=1, /* at least one node timed out */
472         CTDB_TRANS2_COMMIT_ALLFAIL=2, /* all nodes failed the commit */
473         CTDB_TRANS2_COMMIT_SOMEFAIL=3 /* some nodes failed the commit, some allowed it */
474 };
475
476 /*
477   the extended header for records in the ltdb
478 */
479 struct ctdb_ltdb_header {
480         uint64_t rsn;
481         uint32_t dmaster;
482         uint32_t reserved1;
483 #define CTDB_REC_FLAG_DEFAULT                   0x00000000
484 #define CTDB_REC_FLAG_MIGRATED_WITH_DATA        0x00010000
485         uint32_t flags;
486 };
487
488
489 /*
490   definitions for different socket structures
491  */
492 typedef struct sockaddr_in ctdb_addr_in;
493 typedef struct sockaddr_in6 ctdb_addr_in6;
494 typedef union {
495         struct sockaddr sa;
496         ctdb_addr_in    ip;
497         ctdb_addr_in6   ip6;
498 } ctdb_sock_addr;
499
500 /*
501    A structure describing a single node, its flags and its address
502 */
503 struct ctdb_node_and_flags {
504         uint32_t pnn;
505         uint32_t flags;
506         ctdb_sock_addr addr;
507 };
508
509
510 /*
511    Structure used for a nodemap. 
512    The nodemap is the structure containing a list of all nodes
513    known to the cluster and their associated flags.
514 */
515 struct ctdb_node_map {
516         uint32_t num;
517         struct ctdb_node_and_flags nodes[1];
518 };
519
520 /*
521  * Node flags
522  */
523 #define NODE_FLAGS_DISCONNECTED         0x00000001 /* node isn't connected */
524 #define NODE_FLAGS_UNHEALTHY            0x00000002 /* monitoring says node is unhealthy */
525 #define NODE_FLAGS_PERMANENTLY_DISABLED 0x00000004 /* administrator has disabled node */
526 #define NODE_FLAGS_BANNED               0x00000008 /* recovery daemon has banned the node */
527 #define NODE_FLAGS_DELETED              0x00000010 /* this node has been deleted */
528 #define NODE_FLAGS_STOPPED              0x00000020 /* this node has been stopped */
529 #define NODE_FLAGS_DISABLED             (NODE_FLAGS_UNHEALTHY|NODE_FLAGS_PERMANENTLY_DISABLED)
530 #define NODE_FLAGS_INACTIVE             (NODE_FLAGS_DELETED|NODE_FLAGS_DISCONNECTED|NODE_FLAGS_BANNED|NODE_FLAGS_STOPPED)
531
532
533 struct ctdb_public_ip {
534         uint32_t pnn;
535         ctdb_sock_addr addr;
536 };
537
538 struct ctdb_all_public_ips {
539         uint32_t num;
540         struct ctdb_public_ip ips[1];
541 };
542
543
544 struct latency_counter {
545         int num;
546         double min;
547         double max;
548         double total;
549 };
550
551 /*
552   structure used to pass record data between the child and parent
553  */
554 struct ctdb_rec_data {
555         uint32_t length;
556         uint32_t reqid;
557         uint32_t keylen;
558         uint32_t datalen;
559         uint8_t  data[1];
560 };
561
562 struct ctdb_traverse_start {
563         uint32_t db_id;
564         uint32_t reqid;
565         uint64_t srvid;
566 };
567
568 /*
569   ctdb statistics information
570  */
571 struct ctdb_statistics {
572         uint32_t num_clients;
573         uint32_t frozen;
574         uint32_t recovering;
575         uint32_t client_packets_sent;
576         uint32_t client_packets_recv;
577         uint32_t node_packets_sent;
578         uint32_t node_packets_recv;
579         uint32_t keepalive_packets_sent;
580         uint32_t keepalive_packets_recv;
581         struct {
582                 uint32_t req_call;
583                 uint32_t reply_call;
584                 uint32_t req_dmaster;
585                 uint32_t reply_dmaster;
586                 uint32_t reply_error;
587                 uint32_t req_message;
588                 uint32_t req_control;
589                 uint32_t reply_control;
590         } node;
591         struct {
592                 uint32_t req_call;
593                 uint32_t req_message;
594                 uint32_t req_control;
595         } client;
596         struct {
597                 uint32_t call;
598                 uint32_t control;
599                 uint32_t traverse;
600         } timeouts;
601         struct {
602                 struct latency_counter ctdbd;
603                 struct latency_counter recd;
604         } reclock;
605         uint32_t total_calls;
606         uint32_t pending_calls;
607         uint32_t lockwait_calls;
608         uint32_t pending_lockwait_calls;
609         uint32_t childwrite_calls;
610         uint32_t pending_childwrite_calls;
611         uint32_t memory_used;
612         uint32_t __last_counter; /* hack for control_statistics_all */
613         uint32_t max_hop_count;
614         struct latency_counter call_latency;
615         struct latency_counter lockwait_latency;
616         struct latency_counter childwrite_latency;
617         uint32_t num_recoveries;
618         struct timeval statistics_start_time;
619         struct timeval statistics_current_time;
620 };
621
622 /*
623  * wire format for statistics history
624  */
625 struct ctdb_statistics_wire {
626         uint32_t num;
627         struct ctdb_statistics stats[1];
628 };
629
630
631 #endif