move the special addresses like CTDB_CURRENT_NODE from ctdb_protocol.h to ctdb.h
int ctdb_service(struct ctdb_context *ctdb);
+/*
+ * Special node addresses :
+ */
+/* used on the domain socket, send a pdu to the local daemon */
+#define CTDB_CURRENT_NODE 0xF0000001
+/* send a broadcast to all nodes in the cluster, active or not */
+#define CTDB_BROADCAST_ALL 0xF0000002
+/* send a broadcast to all nodes in the current vnn map */
+#define CTDB_BROADCAST_VNNMAP 0xF0000003
+/* send a broadcast to all connected nodes */
+#define CTDB_BROADCAST_CONNECTED 0xF0000004
+
+
+
+
typedef void ctdb_handle;
ctdb_handle *
ctdb_getpnn_send(struct ctdb_context *ctdb,
+ uint32_t destnode,
ctdb_getpnn_cb callback,
void *private_data);
int ctdb_getpnn_recv(struct ctdb_context *ctdb,
ctdb_handle *handle,
uint32_t *pnn);
int ctdb_getpnn(struct ctdb_context *ctdb,
+ uint32_t destnode,
uint32_t *pnn);
*/
#define CTDB_SRVID_SAMBA_NOTIFY 0xFE00000000000000LL
-/* used on the domain socket, send a pdu to the local daemon */
-#define CTDB_CURRENT_NODE 0xF0000001
-/* send a broadcast to all nodes in the cluster, active or not */
-#define CTDB_BROADCAST_ALL 0xF0000002
-/* send a broadcast to all nodes in the current vnn map */
-#define CTDB_BROADCAST_VNNMAP 0xF0000003
-/* send a broadcast to all connected nodes */
-#define CTDB_BROADCAST_CONNECTED 0xF0000004
/* the key used for transaction locking on persistent databases */
#define CTDB_TRANSACTION_LOCK_KEY "__transaction_lock__"
ctdb_handle *
ctdb_getpnn_send(struct ctdb_context *ctdb,
+ uint32_t destnode,
ctdb_getpnn_cb callback,
void *private_data)
{
struct ctdb_client_control_state *state;
struct ctdb_control_cb_data *cb_data;
- state = ctdb_control_send(ctdb, CTDB_CURRENT_NODE, 0,
+ state = ctdb_control_send(ctdb, destnode, 0,
CTDB_CONTROL_GET_PNN, 0, tdb_null,
ctdb, NULL);
return state->status;
}
-int ctdb_getpnn(struct ctdb_context *ctdb, uint32_t *pnn)
+int ctdb_getpnn(struct ctdb_context *ctdb, uint32_t destnode, uint32_t *pnn)
{
struct ctdb_client_control_state *state;
- state = ctdb_getpnn_send(ctdb, NULL, NULL);
+ state = ctdb_getpnn_send(ctdb, destnode, NULL, NULL);
if (state == NULL) {
DEBUG(DEBUG_ERR,(__location__ " ctdb_getpnn_send() failed.\n"));
return -1;
exit(10);
}
- handle = ctdb_getpnn_send(ctdb_context, pnn_cb, NULL);
+ handle = ctdb_getpnn_send(ctdb_context, CTDB_CURRENT_NODE, pnn_cb, NULL);
if (handle == NULL) {
printf("Failed to send get_pnn control\n");
exit(10);
}
- handle = ctdb_getrecmaster_send(ctdb_context, 0, rm_cb, NULL);
+ handle = ctdb_getrecmaster_send(ctdb_context, CTDB_CURRENT_NODE, rm_cb, NULL);
if (handle == NULL) {
printf("Failed to send get_recmaster control\n");
exit(10);