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