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