s3:smbd_smb2_reauth_generic_return: make use of smb2req->xconn
[obnox/samba/samba-obnox.git] / ctdb / 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 #include <sys/socket.h>
24 #include "protocol/protocol.h"
25
26 /* define 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   structure passed to a ctdb call backend function
34 */
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 */
43 };
44
45 /*
46   ctdb flags
47 */
48 #define CTDB_FLAG_TORTURE      (1<<1)
49
50 struct ctdb_script_list_old {
51         uint32_t num_scripts;
52         struct ctdb_script scripts[1];
53 };
54
55 /* Mapping from enum to names. */
56 extern const char *ctdb_eventscript_call_names[];
57
58 /*
59   packet structures
60 */
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[] */
70 };
71
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];
77 };
78
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];
84 };
85
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];
94 };
95
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];
103 };
104
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];
110 };
111
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];
121 };
122
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];
129 };
130
131 struct ctdb_req_keepalive_old {
132         struct ctdb_req_header hdr;
133 };
134
135 /*
136    Structure used for a nodemap. 
137    The nodemap is the structure containing a list of all nodes
138    known to the cluster and their associated flags.
139 */
140 struct ctdb_node_map_old {
141         uint32_t num;
142         struct ctdb_node_and_flags nodes[1];
143 };
144
145 struct ctdb_public_ip_list_old {
146         uint32_t num;
147         struct ctdb_public_ip ips[1];
148 };
149
150 /*
151   structure used to pass record data between the child and parent
152  */
153 struct ctdb_rec_data_old {
154         uint32_t length;
155         uint32_t reqid;
156         uint32_t keylen;
157         uint32_t datalen;
158         uint8_t  data[1];
159 };
160
161 /*
162  * wire format for statistics history
163  */
164 struct ctdb_statistics_list_old {
165         uint32_t num;
166         struct ctdb_statistics stats[1];
167 };
168
169 /*
170  * db statistics
171  */
172 struct ctdb_db_statistics_old {
173         struct {
174                 uint32_t num_calls;
175                 uint32_t num_current;
176                 uint32_t num_pending;
177                 uint32_t num_failed;
178                 struct ctdb_latency_counter latency;
179                 uint32_t buckets[MAX_COUNT_BUCKETS];
180         } locks;
181         struct {
182                 struct ctdb_latency_counter latency;
183         } vacuum;
184         uint32_t db_ro_delegations;
185         uint32_t db_ro_revokes;
186         uint32_t hop_count_bucket[MAX_COUNT_BUCKETS];
187         uint32_t num_hot_keys;
188         struct {
189                 uint32_t count;
190                 TDB_DATA key;
191         } hot_keys[MAX_HOT_KEYS];
192         char hot_keys_wire[1];
193 };
194
195 /* 
196    a wire representation of the vnn map
197  */
198 struct ctdb_vnn_map_wire {
199         uint32_t generation;
200         uint32_t size;
201         uint32_t map[1];
202 };
203
204 struct ctdb_notify_data_old {
205         uint64_t srvid;
206         uint32_t len;
207         uint8_t notify_data[1];
208 };
209
210 /* table that contains a list of all dbids on a node
211  */
212 struct ctdb_dbid_map_old {
213         uint32_t num;
214         struct ctdb_dbid dbs[1];
215 };
216
217 struct ctdb_client_id_list_old {
218         uint32_t num;
219         struct ctdb_client_id server_ids[1];
220 };
221
222 /* the list of tcp tickles used by get/set tcp tickle list */
223 struct ctdb_tickle_list_old {
224         ctdb_sock_addr addr;
225         uint32_t num;
226         struct ctdb_connection connections[1];
227 };
228
229 /*
230   struct holding a ctdb_sock_addr and an interface name,
231   used to add/remove public addresses and grat arp
232  */
233 struct ctdb_addr_info_old {
234         ctdb_sock_addr addr;
235         uint32_t mask;
236         uint32_t len;
237         char iface[1];
238 };
239
240 /* structure used for sending lists of records */
241 struct ctdb_marshall_buffer {
242         uint32_t db_id;
243         uint32_t count;
244         uint8_t data[1];
245 };
246
247 /*
248   structure for setting a tunable
249  */
250 struct ctdb_tunable_old {
251         uint32_t value;
252         uint32_t length;
253         uint8_t  name[1];
254 };
255
256 /*
257   structure for getting a tunable
258  */
259 struct ctdb_control_get_tunable {
260         uint32_t length;
261         uint8_t  name[1];
262 };
263
264 /*
265   structure for listing tunables
266  */
267 struct ctdb_control_list_tunable {
268         uint32_t length;
269         /* returns a : separated list of tunable names */
270         uint8_t  data[1];
271 };
272
273
274 #define CTDB_PUBLIC_IP_FLAGS_ONLY_AVAILABLE 0x00010000
275
276 struct ctdb_public_ip_info_old {
277         struct ctdb_public_ip ip;
278         uint32_t active_idx;
279         uint32_t num;
280         struct ctdb_iface ifaces[1];
281 };
282
283 struct ctdb_iface_list_old {
284         uint32_t num;
285         struct ctdb_iface ifaces[1];
286 };
287
288 /**
289  * structure to pass to a schedule_for_deletion_control
290  */
291 struct ctdb_control_schedule_for_deletion {
292         uint32_t db_id;
293         struct ctdb_ltdb_header hdr;
294         uint32_t keylen;
295         uint8_t key[1]; /* key[] */
296 };
297
298 #endif