create a helper function that converts a ctdb instance in daemon mode to become
[sahlberg/ctdb.git] / include / ctdb.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_H
21 #define _CTDB_H
22
23 #define CTDB_IMMEDIATE_MIGRATION        0x00000001
24 struct ctdb_call {
25         int call_id;
26         TDB_DATA key;
27         TDB_DATA call_data;
28         TDB_DATA reply_data;
29         uint32_t status;
30         uint32_t flags;
31 };
32
33 /*
34   structure passed to a ctdb call backend function
35 */
36 struct ctdb_call_info {
37         TDB_DATA key;          /* record key */
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 #define CTDB_ERR_INVALID 1
46 #define CTDB_ERR_NOMEM 2
47
48 /*
49   ctdb flags
50 */
51 #define CTDB_FLAG_TORTURE      (1<<1)
52
53 /* 
54    a message handler ID meaning "give me all messages"
55  */
56 #define CTDB_SRVID_ALL (~(uint64_t)0)
57
58 /*
59   srvid type : RECOVERY
60 */
61 #define CTDB_SRVID_RECOVERY     0xF100000000000000LL
62
63 /* 
64    a message handler ID meaning that the cluster has been reconfigured
65  */
66 #define CTDB_SRVID_RECONFIGURE 0xF200000000000000LL
67
68 /* 
69    a message handler ID meaning that an IP address has been released
70  */
71 #define CTDB_SRVID_RELEASE_IP 0xF300000000000000LL
72
73 /* 
74    a message ID to set the node flags in the recovery daemon
75  */
76 #define CTDB_SRVID_SET_NODE_FLAGS 0xF400000000000000LL
77
78 /* 
79    a message ID meaning that a node should be banned
80  */
81 #define CTDB_SRVID_BAN_NODE 0xF500000000000000LL
82
83 /* 
84    a message ID meaning that a node should be unbanned
85  */
86 #define CTDB_SRVID_UNBAN_NODE 0xF600000000000000LL
87
88 /*
89   a message to tell the recovery daemon to fetch a set of records
90  */
91 #define CTDB_SRVID_VACUUM_FETCH 0xF700000000000000LL
92
93 /*
94   a message to tell the recovery daemon to write a talloc memdump
95   to the log
96  */
97 #define CTDB_SRVID_MEM_DUMP 0xF800000000000000LL
98
99 /* 
100    a message ID to get the recovery daemon to push the node flags out
101  */
102 #define CTDB_SRVID_PUSH_NODE_FLAGS 0xF900000000000000LL
103
104
105
106 /* used on the domain socket, send a pdu to the local daemon */
107 #define CTDB_CURRENT_NODE     0xF0000001
108 /* send a broadcast to all nodes in the cluster, active or not */
109 #define CTDB_BROADCAST_ALL    0xF0000002
110 /* send a broadcast to all nodes in the current vnn map */
111 #define CTDB_BROADCAST_VNNMAP 0xF0000003
112 /* send a broadcast to all connected nodes */
113 #define CTDB_BROADCAST_CONNECTED 0xF0000004
114
115 /* the key used for transaction locking on persistent databases */
116 #define CTDB_TRANSACTION_LOCK_KEY "__transaction_lock__"
117
118 enum control_state {CTDB_CONTROL_WAIT, CTDB_CONTROL_DONE, CTDB_CONTROL_ERROR, CTDB_CONTROL_TIMEOUT};
119
120 struct ctdb_client_control_state {
121         struct ctdb_context *ctdb;
122         uint32_t reqid;
123         int32_t status;
124         TDB_DATA outdata;
125         enum control_state state;
126         char *errormsg;
127         struct ctdb_req_control *c;
128
129         /* if we have a callback registered for the completion (or failure) of
130            this control
131            if a callback is used, it MUST talloc_free the cb_data passed to it
132         */
133         struct {
134                 void (*fn)(struct ctdb_client_control_state *);
135                 void *private_data;
136         } async;        
137 };
138
139
140 struct event_context;
141
142 /*
143   initialise ctdb subsystem
144 */
145 struct ctdb_context *ctdb_init(struct event_context *ev);
146
147 /*
148   choose the transport
149 */
150 int ctdb_set_transport(struct ctdb_context *ctdb, const char *transport);
151
152 /*
153   set the directory for the local databases
154 */
155 int ctdb_set_tdb_dir(struct ctdb_context *ctdb, const char *dir);
156 int ctdb_set_tdb_dir_persistent(struct ctdb_context *ctdb, const char *dir);
157
158 /*
159   set some flags
160 */
161 void ctdb_set_flags(struct ctdb_context *ctdb, unsigned flags);
162
163 /*
164   set max acess count before a dmaster migration
165 */
166 void ctdb_set_max_lacount(struct ctdb_context *ctdb, unsigned count);
167
168 /*
169   tell ctdb what address to listen on, in transport specific format
170 */
171 int ctdb_set_address(struct ctdb_context *ctdb, const char *address);
172
173 int ctdb_set_socketname(struct ctdb_context *ctdb, const char *socketname);
174
175 /*
176   tell ctdb what nodes are available. This takes a filename, which will contain
177   1 node address per line, in a transport specific format
178 */
179 int ctdb_set_nlist(struct ctdb_context *ctdb, const char *nlist);
180
181 /*
182   Check that a specific ip address exists in the node list and returns
183   the id for the node or -1
184 */
185 int ctdb_ip_to_nodeid(struct ctdb_context *ctdb, const char *nodeip);
186
187 /*
188   start the ctdb protocol
189 */
190 int ctdb_start(struct ctdb_context *ctdb);
191 int ctdb_start_daemon(struct ctdb_context *ctdb, bool do_fork);
192
193 /*
194   attach to a ctdb database
195 */
196 struct ctdb_db_context *ctdb_attach(struct ctdb_context *ctdb, const char *name, bool persistent, uint32_t tdb_flags);
197
198 /*
199   find an attached ctdb_db handle given a name
200  */
201 struct ctdb_db_context *ctdb_db_handle(struct ctdb_context *ctdb, const char *name);
202
203 /*
204   error string for last ctdb error
205 */
206 const char *ctdb_errstr(struct ctdb_context *);
207
208 /* a ctdb call function */
209 typedef int (*ctdb_fn_t)(struct ctdb_call_info *);
210
211 /*
212   setup a ctdb call function
213 */
214 int ctdb_set_call(struct ctdb_db_context *ctdb_db, ctdb_fn_t fn, uint32_t id);
215
216
217
218 /*
219   make a ctdb call. The associated ctdb call function will be called on the DMASTER
220   for the given record
221 */
222 int ctdb_call(struct ctdb_db_context *ctdb_db, struct ctdb_call *call);
223
224 /*
225   initiate an ordered ctdb cluster shutdown
226   this function will never return
227 */
228 void ctdb_shutdown(struct ctdb_context *ctdb);
229
230 /* return pnn of this node */
231 uint32_t ctdb_get_pnn(struct ctdb_context *ctdb);
232
233 /*
234   return the number of nodes
235 */
236 uint32_t ctdb_get_num_nodes(struct ctdb_context *ctdb);
237
238 /* setup a handler for ctdb messages */
239 typedef void (*ctdb_message_fn_t)(struct ctdb_context *, uint64_t srvid, 
240                                   TDB_DATA data, void *);
241 int ctdb_set_message_handler(struct ctdb_context *ctdb, uint64_t srvid, 
242                              ctdb_message_fn_t handler,
243                              void *private_data);
244
245
246 int ctdb_call(struct ctdb_db_context *ctdb_db, struct ctdb_call *call);
247 struct ctdb_client_call_state *ctdb_call_send(struct ctdb_db_context *ctdb_db, struct ctdb_call *call);
248 int ctdb_call_recv(struct ctdb_client_call_state *state, struct ctdb_call *call);
249
250 /* send a ctdb message */
251 int ctdb_send_message(struct ctdb_context *ctdb, uint32_t pnn,
252                       uint64_t srvid, TDB_DATA data);
253
254
255 /* 
256    Fetch a ctdb record from a remote node
257  . Underneath this will force the
258    dmaster for the record to be moved to the local node. 
259 */
260 struct ctdb_record_handle *ctdb_fetch_lock(struct ctdb_db_context *ctdb_db, TALLOC_CTX *mem_ctx, 
261                                            TDB_DATA key, TDB_DATA *data);
262
263 int ctdb_record_store(struct ctdb_record_handle *h, TDB_DATA data);
264
265 int ctdb_fetch(struct ctdb_db_context *ctdb_db, TALLOC_CTX *mem_ctx, 
266                TDB_DATA key, TDB_DATA *data);
267
268 int ctdb_register_message_handler(struct ctdb_context *ctdb, 
269                                   TALLOC_CTX *mem_ctx,
270                                   uint64_t srvid,
271                                   ctdb_message_fn_t handler,
272                                   void *private_data);
273
274 struct ctdb_db_context *find_ctdb_db(struct ctdb_context *ctdb, uint32_t id);
275
276
277 struct ctdb_context *ctdb_cmdline_client(struct event_context *ev);
278
279 struct ctdb_statistics;
280 int ctdb_ctrl_statistics(struct ctdb_context *ctdb, uint32_t destnode, struct ctdb_statistics *status);
281
282 int ctdb_ctrl_shutdown(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode);
283
284 struct ctdb_vnn_map;
285 int ctdb_ctrl_getvnnmap(struct ctdb_context *ctdb, 
286                 struct timeval timeout, uint32_t destnode, 
287                 TALLOC_CTX *mem_ctx, struct ctdb_vnn_map **vnnmap);
288 int ctdb_ctrl_setvnnmap(struct ctdb_context *ctdb,
289                 struct timeval timeout, uint32_t destnode, 
290                 TALLOC_CTX *mem_ctx, struct ctdb_vnn_map *vnnmap);
291
292 /* table that contains a list of all dbids on a node
293  */
294 struct ctdb_dbid_map {
295         uint32_t num;
296         struct ctdb_dbid {
297                 uint32_t dbid;
298                 bool persistent;
299         } dbs[1];
300 };
301 int ctdb_ctrl_getdbmap(struct ctdb_context *ctdb, 
302         struct timeval timeout, uint32_t destnode, 
303         TALLOC_CTX *mem_ctx, struct ctdb_dbid_map **dbmap);
304
305
306 struct ctdb_node_map;
307
308 int ctdb_ctrl_getnodemap(struct ctdb_context *ctdb, 
309                     struct timeval timeout, uint32_t destnode, 
310                     TALLOC_CTX *mem_ctx, struct ctdb_node_map **nodemap);
311
312 int ctdb_ctrl_getnodemapv4(struct ctdb_context *ctdb, 
313                     struct timeval timeout, uint32_t destnode, 
314                     TALLOC_CTX *mem_ctx, struct ctdb_node_map **nodemap);
315
316 int ctdb_ctrl_reload_nodes_file(struct ctdb_context *ctdb, 
317                     struct timeval timeout, uint32_t destnode);
318
319 struct ctdb_key_list {
320         uint32_t dbid;
321         uint32_t num;
322         TDB_DATA *keys;
323         struct ctdb_ltdb_header *headers;
324         TDB_DATA *data;
325 };
326
327 int ctdb_ctrl_pulldb(
328        struct ctdb_context *ctdb, uint32_t destnode, uint32_t dbid,
329        uint32_t lmaster, TALLOC_CTX *mem_ctx,
330        struct timeval timeout, TDB_DATA *outdata);
331
332 struct ctdb_client_control_state *ctdb_ctrl_pulldb_send(
333        struct ctdb_context *ctdb, uint32_t destnode, uint32_t dbid,
334        uint32_t lmaster, TALLOC_CTX *mem_ctx, struct timeval timeout);
335
336 int ctdb_ctrl_pulldb_recv(
337        struct ctdb_context *ctdb,
338        TALLOC_CTX *mem_ctx, struct ctdb_client_control_state *state,
339        TDB_DATA *outdata);
340
341 int ctdb_ctrl_pushdb(
342        struct ctdb_context *ctdb, uint32_t destnode, uint32_t dbid,
343        TALLOC_CTX *mem_ctx,
344        struct timeval timeout, TDB_DATA indata);
345
346 struct ctdb_client_control_state *ctdb_ctrl_pushdb_send(
347        struct ctdb_context *ctdb, uint32_t destnode, uint32_t dbid,
348        TALLOC_CTX *mem_ctx, struct timeval timeout,
349        TDB_DATA indata);
350
351 int ctdb_ctrl_pushdb_recv(
352        struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx,
353        struct ctdb_client_control_state *state);
354
355
356 int ctdb_ctrl_copydb(struct ctdb_context *ctdb, 
357         struct timeval timeout, uint32_t sourcenode, 
358         uint32_t destnode, uint32_t dbid, uint32_t lmaster, 
359         TALLOC_CTX *mem_ctx);
360
361 int ctdb_ctrl_getdbpath(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode, uint32_t dbid, TALLOC_CTX *mem_ctx, const char **path);
362 int ctdb_ctrl_getdbname(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode, uint32_t dbid, TALLOC_CTX *mem_ctx, const char **name);
363 int ctdb_ctrl_createdb(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode, TALLOC_CTX *mem_ctx, const char *name, bool persistent);
364
365 int ctdb_ctrl_process_exists(struct ctdb_context *ctdb, uint32_t destnode, pid_t pid);
366
367 int ctdb_ctrl_ping(struct ctdb_context *ctdb, uint32_t destnode);
368
369 int ctdb_ctrl_get_config(struct ctdb_context *ctdb);
370
371 int ctdb_ctrl_get_debuglevel(struct ctdb_context *ctdb, uint32_t destnode, int32_t *level);
372 int ctdb_ctrl_set_debuglevel(struct ctdb_context *ctdb, uint32_t destnode, int32_t level);
373
374 /*
375   change dmaster for all keys in the database to the new value
376  */
377 int ctdb_ctrl_setdmaster(struct ctdb_context *ctdb, 
378         struct timeval timeout, uint32_t destnode, 
379         TALLOC_CTX *mem_ctx, uint32_t dbid, uint32_t dmaster);
380
381 /*
382   write a record on a specific db (this implicitely updates dmaster of the record to locally be the vnn of the node where the control is executed on)
383  */
384 int ctdb_ctrl_write_record(struct ctdb_context *ctdb, uint32_t destnode, TALLOC_CTX *mem_ctx, uint32_t dbid, TDB_DATA key, TDB_DATA data);
385
386 #define CTDB_RECOVERY_NORMAL            0
387 #define CTDB_RECOVERY_ACTIVE            1
388
389 /*
390   get the recovery mode of a remote node
391  */
392 int ctdb_ctrl_getrecmode(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx, struct timeval timeout, uint32_t destnode, uint32_t *recmode);
393
394 struct ctdb_client_control_state *ctdb_ctrl_getrecmode_send(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx, struct timeval timeout, uint32_t destnode);
395
396 int ctdb_ctrl_getrecmode_recv(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx, struct ctdb_client_control_state *state, uint32_t *recmode);
397
398
399 /*
400   set the recovery mode of a remote node
401  */
402 int ctdb_ctrl_setrecmode(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode, uint32_t recmode);
403 /*
404   get the monitoring mode of a remote node
405  */
406 int ctdb_ctrl_getmonmode(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode, uint32_t *monmode);
407
408 /*
409   set the monitoring mode of a remote node to active
410  */
411 int ctdb_ctrl_enable_monmode(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode);
412
413 /*
414   set the monitoring mode of a remote node to disabled
415  */
416 int ctdb_ctrl_disable_monmode(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode);
417
418
419 /*
420   get the recovery master of a remote node
421  */
422 int ctdb_ctrl_getrecmaster(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx, struct timeval timeout, uint32_t destnode, uint32_t *recmaster);
423
424 struct ctdb_client_control_state *ctdb_ctrl_getrecmaster_send(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx, struct timeval timeout, uint32_t destnode);
425
426 int ctdb_ctrl_getrecmaster_recv(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx, struct ctdb_client_control_state *state, uint32_t *recmaster);
427
428
429
430 /*
431   set the recovery master of a remote node
432  */
433 int ctdb_ctrl_setrecmaster(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode, uint32_t recmaster);
434
435 uint32_t *ctdb_get_connected_nodes(struct ctdb_context *ctdb, 
436                                    struct timeval timeout, 
437                                    TALLOC_CTX *mem_ctx,
438                                    uint32_t *num_nodes);
439
440 int ctdb_statistics_reset(struct ctdb_context *ctdb, uint32_t destnode);
441
442 int ctdb_set_logfile(struct ctdb_context *ctdb, const char *logfile, bool use_syslog);
443
444 typedef int (*ctdb_traverse_func)(struct ctdb_context *, TDB_DATA, TDB_DATA, void *);
445 int ctdb_traverse(struct ctdb_db_context *ctdb_db, ctdb_traverse_func fn, void *private_data);
446
447 int ctdb_dump_db(struct ctdb_db_context *ctdb_db, FILE *f);
448
449 /*
450   get the pid of a ctdb daemon
451  */
452 int ctdb_ctrl_getpid(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode, uint32_t *pid);
453
454 int ctdb_ctrl_freeze(struct ctdb_context *ctdb, struct timeval timeout, 
455                         uint32_t destnode);
456
457 struct ctdb_client_control_state *
458 ctdb_ctrl_freeze_send(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx, 
459                         struct timeval timeout, uint32_t destnode);
460
461 int ctdb_ctrl_freeze_recv(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx, 
462                         struct ctdb_client_control_state *state);
463
464 int ctdb_ctrl_thaw(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode);
465
466 int ctdb_ctrl_getpnn(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode);
467
468 int ctdb_ctrl_get_tunable(struct ctdb_context *ctdb, 
469                           struct timeval timeout, 
470                           uint32_t destnode,
471                           const char *name, uint32_t *value);
472
473 int ctdb_ctrl_set_tunable(struct ctdb_context *ctdb, 
474                           struct timeval timeout, 
475                           uint32_t destnode,
476                           const char *name, uint32_t value);
477
478 int ctdb_ctrl_list_tunables(struct ctdb_context *ctdb, 
479                             struct timeval timeout, 
480                             uint32_t destnode,
481                             TALLOC_CTX *mem_ctx,
482                             const char ***list, uint32_t *count);
483
484 int ctdb_ctrl_modflags(struct ctdb_context *ctdb, 
485                        struct timeval timeout, 
486                        uint32_t destnode, 
487                        uint32_t set, uint32_t clear);
488
489 enum ctdb_server_id_type { SERVER_TYPE_SAMBA=1 };
490
491 struct ctdb_server_id {
492         enum ctdb_server_id_type type;
493         uint32_t pnn;
494         uint32_t server_id;
495 };
496
497 struct ctdb_server_id_list {
498         uint32_t num;
499         struct ctdb_server_id server_ids[1];
500 };
501
502
503 int ctdb_ctrl_register_server_id(struct ctdb_context *ctdb,
504                 struct timeval timeout,
505                 struct ctdb_server_id *id);
506 int ctdb_ctrl_unregister_server_id(struct ctdb_context *ctdb, 
507                 struct timeval timeout, 
508                 struct ctdb_server_id *id);
509 int ctdb_ctrl_check_server_id(struct ctdb_context *ctdb,
510                 struct timeval timeout, uint32_t destnode, 
511                 struct ctdb_server_id *id, uint32_t *status);
512 int ctdb_ctrl_get_server_id_list(struct ctdb_context *ctdb,
513                 TALLOC_CTX *mem_ctx,
514                 struct timeval timeout, uint32_t destnode, 
515                 struct ctdb_server_id_list **svid_list);
516
517 struct ctdb_uptime {
518         struct timeval current_time;
519         struct timeval ctdbd_start_time;
520         struct timeval last_recovery_started;
521         struct timeval last_recovery_finished;
522 };
523
524 /*
525   definitions for different socket structures
526  */
527 typedef struct sockaddr_in ctdb_addr_in;
528 typedef struct sockaddr_in6 ctdb_addr_in6;
529 typedef union {
530         struct sockaddr sa;
531         ctdb_addr_in    ip;
532         ctdb_addr_in6   ip6;
533 } ctdb_sock_addr;
534
535 /*
536   struct for tcp_client control
537   this is an ipv4 only version of this structure used by samba
538   samba will later be migrated over to use the 
539   ctdb_control_tcp_addr structure instead
540  */
541 struct ctdb_control_tcp {
542         struct sockaddr_in src; // samba uses this
543         struct sockaddr_in dest;// samba uses this
544 };
545 /* new style structure */
546 struct ctdb_control_tcp_addr {
547         ctdb_sock_addr src;
548         ctdb_sock_addr dest;
549 };
550
551 int ctdb_socket_connect(struct ctdb_context *ctdb);
552
553 /*
554   get the uptime of a remote node
555  */
556 int ctdb_ctrl_uptime(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx, struct timeval timeout, uint32_t destnode, struct ctdb_uptime **uptime);
557
558 struct ctdb_client_control_state *ctdb_ctrl_uptime_send(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx, struct timeval timeout, uint32_t destnode);
559
560 int ctdb_ctrl_uptime_recv(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx, struct ctdb_client_control_state *state, struct ctdb_uptime **uptime);
561
562 int ctdb_ctrl_end_recovery(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode);
563
564 int ctdb_ctrl_getreclock(struct ctdb_context *ctdb, 
565         struct timeval timeout, uint32_t destnode, 
566         TALLOC_CTX *mem_ctx, const char **reclock);
567
568
569 uint32_t *list_of_connected_nodes(struct ctdb_context *ctdb,
570                                 struct ctdb_node_map *node_map,
571                                 TALLOC_CTX *mem_ctx,
572                                 bool include_self);
573 uint32_t *list_of_active_nodes(struct ctdb_context *ctdb,
574                                 struct ctdb_node_map *node_map,
575                                 TALLOC_CTX *mem_ctx,
576                                 bool include_self);
577 uint32_t *list_of_vnnmap_nodes(struct ctdb_context *ctdb,
578                                 struct ctdb_vnn_map *vnn_map,
579                                 TALLOC_CTX *mem_ctx,
580                                 bool include_self);
581
582 int ctdb_read_pnn_lock(int fd, int32_t pnn);
583
584 /*
585   get capabilities of a remote node
586  */
587 int ctdb_ctrl_getcapabilities(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode, uint32_t *capabilities);
588
589 struct ctdb_client_control_state *ctdb_ctrl_getcapabilities_send(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx, struct timeval timeout, uint32_t destnode);
590
591 int ctdb_ctrl_getcapabilities_recv(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx, struct ctdb_client_control_state *state, uint32_t *capabilities);
592
593 struct ctdb_marshall_buffer *ctdb_marshall_add(TALLOC_CTX *mem_ctx, 
594                                                struct ctdb_marshall_buffer *m,
595                                                uint64_t db_id,
596                                                uint32_t reqid,
597                                                TDB_DATA key,
598                                                struct ctdb_ltdb_header *header,
599                                                TDB_DATA data);
600 TDB_DATA ctdb_marshall_finish(struct ctdb_marshall_buffer *m);
601
602 struct ctdb_transaction_handle *ctdb_transaction_start(struct ctdb_db_context *ctdb_db,
603                                                        TALLOC_CTX *mem_ctx);
604 int ctdb_transaction_fetch(struct ctdb_transaction_handle *h, 
605                            TALLOC_CTX *mem_ctx, 
606                            TDB_DATA key, TDB_DATA *data);
607 int ctdb_transaction_store(struct ctdb_transaction_handle *h, 
608                            TDB_DATA key, TDB_DATA data);
609 int ctdb_transaction_commit(struct ctdb_transaction_handle *h);
610
611 int ctdb_ctrl_recd_ping(struct ctdb_context *ctdb);
612
613 int switch_from_server_to_client(struct ctdb_context *ctdb);
614
615 #endif