vfs_aio_pthread: fix segfault if samba-tool ntacl get
[samba.git] / ctdb / include / ctdb_protocol.h
blob31af4201040a3f83f074cc7e3f50158f9de75f7d
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>
24 #include "protocol/protocol.h"
26 /* define ctdb port number */
27 #define CTDB_PORT 4379
29 /* we must align packets to ensure ctdb works on all architectures (eg. sparc) */
30 #define CTDB_DS_ALIGNMENT 8
33 structure passed to a ctdb call backend function
35 struct ctdb_call_info {
36 TDB_DATA key; /* record key */
37 struct ctdb_ltdb_header *header;
38 TDB_DATA record_data; /* current data in the record */
39 TDB_DATA *new_data; /* optionally updated record data */
40 TDB_DATA *call_data; /* optionally passed from caller */
41 TDB_DATA *reply_data; /* optionally returned by function */
42 uint32_t status; /* optional reply status - defaults to zero */
46 ctdb flags
48 #define CTDB_FLAG_TORTURE (1<<1)
50 struct ctdb_script_list_old {
51 uint32_t num_scripts;
52 struct ctdb_script scripts[1];
55 /* Mapping from enum to names. */
56 extern const char *ctdb_eventscript_call_names[];
59 packet structures
61 struct ctdb_req_call_old {
62 struct ctdb_req_header hdr;
63 uint32_t flags;
64 uint32_t db_id;
65 uint32_t callid;
66 uint32_t hopcount;
67 uint32_t keylen;
68 uint32_t calldatalen;
69 uint8_t data[1]; /* key[] followed by calldata[] */
72 struct ctdb_reply_call_old {
73 struct ctdb_req_header hdr;
74 uint32_t status;
75 uint32_t datalen;
76 uint8_t data[1];
79 struct ctdb_reply_error_old {
80 struct ctdb_req_header hdr;
81 uint32_t status;
82 uint32_t msglen;
83 uint8_t msg[1];
86 struct ctdb_req_dmaster_old {
87 struct ctdb_req_header hdr;
88 uint32_t db_id;
89 uint64_t rsn;
90 uint32_t dmaster;
91 uint32_t keylen;
92 uint32_t datalen;
93 uint8_t data[1];
96 struct ctdb_reply_dmaster_old {
97 struct ctdb_req_header hdr;
98 uint32_t db_id;
99 uint64_t rsn;
100 uint32_t keylen;
101 uint32_t datalen;
102 uint8_t data[1];
105 struct ctdb_req_message_old {
106 struct ctdb_req_header hdr;
107 uint64_t srvid;
108 uint32_t datalen;
109 uint8_t data[1];
112 struct ctdb_req_control_old {
113 struct ctdb_req_header hdr;
114 uint32_t opcode;
115 uint32_t pad;
116 uint64_t srvid;
117 uint32_t client_id;
118 uint32_t flags;
119 uint32_t datalen;
120 uint8_t data[1];
123 struct ctdb_reply_control_old {
124 struct ctdb_req_header hdr;
125 int32_t status;
126 uint32_t datalen;
127 uint32_t errorlen;
128 uint8_t data[1];
131 struct ctdb_req_keepalive_old {
132 struct ctdb_req_header hdr;
133 uint32_t version;
134 uint32_t uptime;
137 struct ctdb_req_tunnel_old {
138 struct ctdb_req_header hdr;
139 uint64_t tunnel_id;
140 uint32_t flags;
141 uint32_t datalen;
142 uint8_t data[1];
146 Structure used for a nodemap.
147 The nodemap is the structure containing a list of all nodes
148 known to the cluster and their associated flags.
150 struct ctdb_node_map_old {
151 uint32_t num;
152 struct ctdb_node_and_flags nodes[1];
155 struct ctdb_public_ip_list_old {
156 uint32_t num;
157 struct ctdb_public_ip ips[1];
161 structure used to pass record data between the child and parent
163 struct ctdb_rec_data_old {
164 uint32_t length;
165 uint32_t reqid;
166 uint32_t keylen;
167 uint32_t datalen;
168 uint8_t data[1];
172 * wire format for statistics history
174 struct ctdb_statistics_list_old {
175 uint32_t num;
176 struct ctdb_statistics stats[1];
180 * db statistics
182 struct ctdb_db_statistics_old {
183 struct {
184 uint32_t num_calls;
185 uint32_t num_current;
186 uint32_t num_pending;
187 uint32_t num_failed;
188 struct ctdb_latency_counter latency;
189 uint32_t buckets[MAX_COUNT_BUCKETS];
190 } locks;
191 struct {
192 struct ctdb_latency_counter latency;
193 } vacuum;
194 uint32_t db_ro_delegations;
195 uint32_t db_ro_revokes;
196 uint32_t hop_count_bucket[MAX_COUNT_BUCKETS];
197 uint32_t num_hot_keys;
198 struct {
199 uint32_t count;
200 TDB_DATA key;
201 } hot_keys[MAX_HOT_KEYS];
202 char hot_keys_wire[1];
206 a wire representation of the vnn map
208 struct ctdb_vnn_map_wire {
209 uint32_t generation;
210 uint32_t size;
211 uint32_t map[1];
214 struct ctdb_notify_data_old {
215 uint64_t srvid;
216 uint32_t len;
217 uint8_t notify_data[1];
220 /* table that contains a list of all dbids on a node
222 struct ctdb_dbid_map_old {
223 uint32_t num;
224 struct ctdb_dbid dbs[1];
227 /* the list of tcp tickles used by get/set tcp tickle list */
228 struct ctdb_tickle_list_old {
229 ctdb_sock_addr addr;
230 uint32_t num;
231 struct ctdb_connection connections[1];
235 struct holding a ctdb_sock_addr and an interface name,
236 used to add/remove public addresses and gratuitous arp
238 struct ctdb_addr_info_old {
239 ctdb_sock_addr addr;
240 uint32_t mask;
241 uint32_t len;
242 char iface[1];
245 /* structure used for sending lists of records */
246 struct ctdb_marshall_buffer {
247 uint32_t db_id;
248 uint32_t count;
249 uint8_t data[1];
253 structure for setting a tunable
255 struct ctdb_tunable_old {
256 uint32_t value;
257 uint32_t length;
258 uint8_t name[1];
262 structure for getting a tunable
264 struct ctdb_control_get_tunable {
265 uint32_t length;
266 uint8_t name[1];
270 structure for listing tunables
272 struct ctdb_control_list_tunable {
273 uint32_t length;
274 /* returns a : separated list of tunable names */
275 uint8_t data[1];
279 struct ctdb_public_ip_info_old {
280 struct ctdb_public_ip ip;
281 uint32_t active_idx;
282 uint32_t num;
283 struct ctdb_iface ifaces[1];
286 struct ctdb_iface_list_old {
287 uint32_t num;
288 struct ctdb_iface ifaces[1];
292 * structure to pass to a schedule_for_deletion_control
294 struct ctdb_control_schedule_for_deletion {
295 uint32_t db_id;
296 struct ctdb_ltdb_header hdr;
297 uint32_t keylen;
298 uint8_t key[1]; /* key[] */
301 #endif