1 #ifndef _LIBCTDB_PRIVATE_H
2 #define _LIBCTDB_PRIVATE_H
8 #include <ctdb_protocol.h>
11 #define offsetof(t,f) ((unsigned int)&((t *)0)->f)
14 struct message_handler_info;
15 struct ctdb_reply_call;
18 struct ctdb_connection *ctdb;
19 struct ctdb_request *next, *prev;
24 struct ctdb_req_header *hdr;
25 struct ctdb_req_call *call;
26 struct ctdb_req_control *control;
27 struct ctdb_req_message *message;
30 struct io_elem *reply;
32 ctdb_callback_t callback;
35 /* Extra per-request info. */
36 void (*extra_destructor)(struct ctdb_connection *,
37 struct ctdb_request *);
41 struct ctdb_connection {
42 /* Socket to ctdbd. */
44 /* Currently our failure mode is simple; return -1 from ctdb_service */
46 /* Linked list of pending outgoings. */
47 struct ctdb_request *outq;
48 /* Finished outgoings (awaiting response) */
49 struct ctdb_request *doneq;
50 /* Current incoming. */
52 /* Guess at a good reqid to try next. */
54 /* List of messages */
55 struct message_handler_info *message_handlers;
56 /* PNN of this ctdb: valid by the time we do our first db connection. */
61 struct ctdb_request *new_ctdb_request(size_t len, ctdb_callback_t, void *);
62 struct ctdb_request *new_ctdb_control_request(struct ctdb_connection *ctdb,
65 const void *extra_data,
67 ctdb_callback_t, void *);
68 uint32_t new_reqid(struct ctdb_connection *ctdb);
70 struct ctdb_reply_control *unpack_reply_control(struct ctdb_connection *ctdb,
71 struct ctdb_request *req,
72 enum ctdb_controls control);
73 void ctdb_cancel_callback(struct ctdb_connection *ctdb,
74 struct ctdb_request *req,
76 #endif /* _LIBCTDB_PRIVATE_H */