summaryrefslogtreecommitdiff
path: root/source4/cluster/ctdb/include
diff options
context:
space:
mode:
Diffstat (limited to 'source4/cluster/ctdb/include')
-rw-r--r--source4/cluster/ctdb/include/ctdb.h10
-rw-r--r--source4/cluster/ctdb/include/ctdb_private.h14
2 files changed, 23 insertions, 1 deletions
diff --git a/source4/cluster/ctdb/include/ctdb.h b/source4/cluster/ctdb/include/ctdb.h
index 7eebcb83db..335af83215 100644
--- a/source4/cluster/ctdb/include/ctdb.h
+++ b/source4/cluster/ctdb/include/ctdb.h
@@ -127,4 +127,14 @@ void ctdb_wait_loop(struct ctdb_context *ctdb);
/* return vnn of this node */
uint32_t ctdb_get_vnn(struct ctdb_context *ctdb);
+/* setup a handler for ctdb messages */
+typedef void (*ctdb_message_fn_t)(struct ctdb_context *, uint32_t srvid,
+ TDB_DATA data, void *);
+int ctdb_set_message_handler(struct ctdb_context *ctdb, ctdb_message_fn_t handler,
+ void *private);
+
+/* send a ctdb message */
+int ctdb_send_message(struct ctdb_context *ctdb, uint32_t vnn,
+ uint32_t srvid, uint32_t msg_type, TDB_DATA data);
+
#endif
diff --git a/source4/cluster/ctdb/include/ctdb_private.h b/source4/cluster/ctdb/include/ctdb_private.h
index 977206f400..c863781c50 100644
--- a/source4/cluster/ctdb/include/ctdb_private.h
+++ b/source4/cluster/ctdb/include/ctdb_private.h
@@ -94,6 +94,8 @@ struct ctdb_context {
const struct ctdb_upcalls *upcalls; /* transport upcalls */
void *private; /* private to transport */
unsigned max_lacount;
+ ctdb_message_fn_t message_handler;
+ void *message_private;
};
#define CTDB_NO_MEMORY(ctdb, p) do { if (!(p)) { \
@@ -138,7 +140,8 @@ enum ctdb_operation {
CTDB_REPLY_REDIRECT = 2,
CTDB_REQ_DMASTER = 3,
CTDB_REPLY_DMASTER = 4,
- CTDB_REPLY_ERROR = 5
+ CTDB_REPLY_ERROR = 5,
+ CTDB_REQ_MESSAGE = 6
};
/*
@@ -193,6 +196,13 @@ struct ctdb_reply_dmaster {
uint8_t data[1];
};
+struct ctdb_req_message {
+ struct ctdb_req_header hdr;
+ uint32_t srvid;
+ uint32_t datalen;
+ uint8_t data[1];
+};
+
/* internal prototypes */
void ctdb_set_error(struct ctdb_context *ctdb, const char *fmt, ...) PRINTF_ATTRIBUTE(2,3);
void ctdb_fatal(struct ctdb_context *ctdb, const char *msg);
@@ -203,6 +213,7 @@ int ctdb_parse_address(struct ctdb_context *ctdb,
uint32_t ctdb_hash(const TDB_DATA *key);
void ctdb_request_call(struct ctdb_context *ctdb, struct ctdb_req_header *hdr);
void ctdb_request_dmaster(struct ctdb_context *ctdb, struct ctdb_req_header *hdr);
+void ctdb_request_message(struct ctdb_context *ctdb, struct ctdb_req_header *hdr);
void ctdb_reply_dmaster(struct ctdb_context *ctdb, struct ctdb_req_header *hdr);
void ctdb_reply_call(struct ctdb_context *ctdb, struct ctdb_req_header *hdr);
void ctdb_reply_error(struct ctdb_context *ctdb, struct ctdb_req_header *hdr);
@@ -213,6 +224,7 @@ int ctdb_ltdb_fetch(struct ctdb_context *ctdb,
TDB_DATA key, struct ctdb_ltdb_header *header, TDB_DATA *data);
int ctdb_ltdb_store(struct ctdb_context *ctdb, TDB_DATA key,
struct ctdb_ltdb_header *header, TDB_DATA data);
+void ctdb_queue_packet(struct ctdb_context *ctdb, struct ctdb_req_header *hdr);
#endif