uint8_t *result);
+/**
+ * ctdb_getcapabilities_send - read the capabilities of a node
+ * @ctdb: the ctdb_connection from ctdb_connect.
+ * @destnode: the destination node (see below)
+ * @callback: the callback when ctdb replies to our message (typesafe)
+ * @cbdata: the argument to callback()
+ *
+ * There are several special values for destnode, detailed in
+ * ctdb_protocol.h, particularly CTDB_CURRENT_NODE which means the
+ * local ctdbd.
+ */
+struct ctdb_request *
+ctdb_getcapabilities_send(struct ctdb_connection *ctdb,
+ uint32_t destnode,
+ ctdb_callback_t callback, void *cbdata);
+
+/**
+ * ctdb_getcapabilities_recv - read an ctdb_getcapabilities reply from ctdbd
+ * @ctdb: the ctdb_connection from ctdb_connect.
+ * @req: the completed request.
+ * @capabilities: a pointer to the capabilities to fill in
+ *
+ * This returns false if something went wrong, or otherwise fills in
+ * capabilities.
+ */
+bool ctdb_getcapabilities_recv(struct ctdb_connection *ctdb,
+ struct ctdb_request *handle,
+ uint32_t *capabilities);
+
/**
* ctdb_getdbseqnum_send - read the sequence number off a db
* @ctdb: the ctdb_connection from ctdb_connect.
uint64_t *mhs,
uint8_t *result);
+/**
+ * ctdb_getcapabilities - read the capabilities of a node (synchronous)
+ * @ctdb: the ctdb_connection from ctdb_connect.
+ * @destnode: the destination node (see below)
+ * @capabilities: a pointer to the capabilities to fill in
+ *
+ * There are several special values for destnode, detailed in
+ * ctdb_protocol.h, particularly CTDB_CURRENT_NODE which means the
+ * local ctdbd.
+ *
+ * Returns true and fills in *capabilities on success.
+ */
+bool ctdb_getcapabilities(struct ctdb_connection *ctdb,
+ uint32_t destnode,
+ uint32_t *capabilities);
+
+
/**
* ctdb_getdbseqnum - read the seqnum of a database
* @ctdb: the ctdb_connection from ctdb_connect.
ctdb_getpnn_send((ctdb), (destnode), \
ctdb_sendcb((cb), (cbdata)), (cbdata))
+#define ctdb_getcapabilities_send(ctdb, destnode, cb, cbdata) \
+ ctdb_getcapabilities_send((ctdb), (destnode), \
+ ctdb_sendcb((cb), (cbdata)), (cbdata))
+
#define ctdb_getdbstat_send(ctdb, destnode, db_id, cb, cbdata) \
ctdb_getdbstat_send((ctdb), (destnode), (db_id), \
ctdb_sendcb((cb), (cbdata)), (cbdata))
#define CTDB_MONITORING_ACTIVE 0
#define CTDB_MONITORING_DISABLED 1
-/* The different capabilities of the ctdb daemon. */
-#define CTDB_CAP_RECMASTER 0x00000001
-#define CTDB_CAP_LMASTER 0x00000002
-/* This capability is set if CTDB_LVS_PUBLIC_IP is set */
-#define CTDB_CAP_LVS 0x00000004
-/* This capability is set if NATGW is enabled */
-#define CTDB_CAP_NATGW 0x00000008
-
#define NUM_DB_PRIORITIES 3
/* main state of the ctdb daemon */
struct ctdb_context {
#undef ctdb_getdbseqnum_send
#undef ctdb_getifaces_send
#undef ctdb_getvnnmap_send
+#undef ctdb_getcapabilities_send
bool ctdb_getrecmaster_recv(struct ctdb_connection *ctdb,
struct ctdb_request *req, uint32_t *recmaster)
NULL, 0, callback, private_data);
}
+bool ctdb_getcapabilities_recv(struct ctdb_connection *ctdb,
+ struct ctdb_request *req, uint32_t *capabilities)
+{
+ struct ctdb_reply_control *reply;
+
+ reply = unpack_reply_control(req, CTDB_CONTROL_GET_CAPABILITIES);
+ if (!reply) {
+ return false;
+ }
+ if (reply->status == -1) {
+ DEBUG(ctdb, LOG_ERR, "ctdb_getcapabilities_recv: status -1");
+ return false;
+ }
+ *capabilities = *((uint32_t *)reply->data);
+ return true;
+}
+
+struct ctdb_request *ctdb_getcapabilities_send(struct ctdb_connection *ctdb,
+ uint32_t destnode,
+ ctdb_callback_t callback,
+ void *private_data)
+{
+ return new_ctdb_control_request(ctdb, CTDB_CONTROL_GET_CAPABILITIES,
+ destnode,
+ NULL, 0, callback, private_data);
+}
+
return ret;
}
+bool ctdb_getcapabilities(struct ctdb_connection *ctdb,
+ uint32_t destnode, uint32_t *capabilities)
+{
+ struct ctdb_request *req;
+ bool done = false;
+ bool ret = false;
+
+ req = synchronous(ctdb,
+ ctdb_getcapabilities_send(ctdb, destnode, set, &done),
+ &done);
+ if (req != NULL) {
+ ret = ctdb_getcapabilities_recv(ctdb, req, capabilities);
+ ctdb_request_free(req);
+ }
+ return ret;
+}
+