2010-05-20 09:48:30 +04:00
/*
ctdb database library
Copyright ( C ) Andrew Tridgell 2006
This program is free software ; you can redistribute it and / or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation ; either version 3 of the License , or
( at your option ) any later version .
This program is distributed in the hope that it will be useful ,
but WITHOUT ANY WARRANTY ; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
GNU General Public License for more details .
You should have received a copy of the GNU General Public License
along with this program ; if not , see < http : //www.gnu.org/licenses/>.
*/
# ifndef _CTDB_PROTOCOL_H
# define _CTDB_PROTOCOL_H
2014-12-03 18:02:35 +03:00
# include <sys/socket.h>
2015-10-29 09:51:52 +03:00
# include "protocol/protocol.h"
2014-12-03 18:02:35 +03:00
2015-10-29 09:51:52 +03:00
/* define ctdb port number */
2010-05-20 09:48:30 +04:00
# define CTDB_PORT 4379
/* we must align packets to ensure ctdb works on all architectures (eg. sparc) */
# define CTDB_DS_ALIGNMENT 8
/*
structure passed to a ctdb call backend function
*/
struct ctdb_call_info {
TDB_DATA key ; /* record key */
2011-07-20 05:27:05 +04:00
struct ctdb_ltdb_header * header ;
2010-05-20 09:48:30 +04:00
TDB_DATA record_data ; /* current data in the record */
TDB_DATA * new_data ; /* optionally updated record data */
TDB_DATA * call_data ; /* optionally passed from caller */
TDB_DATA * reply_data ; /* optionally returned by function */
uint32_t status ; /* optional reply status - defaults to zero */
} ;
/*
ctdb flags
*/
# define CTDB_FLAG_TORTURE (1<<1)
2015-10-28 12:02:45 +03:00
struct ctdb_script_list_old {
2010-05-20 09:48:30 +04:00
uint32_t num_scripts ;
2015-10-28 08:49:47 +03:00
struct ctdb_script scripts [ 1 ] ;
2010-05-20 09:48:30 +04:00
} ;
/* Mapping from enum to names. */
extern const char * ctdb_eventscript_call_names [ ] ;
/*
packet structures
*/
2015-10-29 08:26:29 +03:00
struct ctdb_req_call_old {
2010-05-20 09:48:30 +04:00
struct ctdb_req_header hdr ;
uint32_t flags ;
uint32_t db_id ;
uint32_t callid ;
uint32_t hopcount ;
uint32_t keylen ;
uint32_t calldatalen ;
uint8_t data [ 1 ] ; /* key[] followed by calldata[] */
} ;
2015-10-29 08:29:01 +03:00
struct ctdb_reply_call_old {
2010-05-20 09:48:30 +04:00
struct ctdb_req_header hdr ;
uint32_t status ;
uint32_t datalen ;
uint8_t data [ 1 ] ;
} ;
2015-10-29 08:30:31 +03:00
struct ctdb_reply_error_old {
2010-05-20 09:48:30 +04:00
struct ctdb_req_header hdr ;
uint32_t status ;
uint32_t msglen ;
uint8_t msg [ 1 ] ;
} ;
2015-10-29 08:32:09 +03:00
struct ctdb_req_dmaster_old {
2010-05-20 09:48:30 +04:00
struct ctdb_req_header hdr ;
uint32_t db_id ;
uint64_t rsn ;
uint32_t dmaster ;
uint32_t keylen ;
uint32_t datalen ;
uint8_t data [ 1 ] ;
} ;
2015-10-29 08:34:01 +03:00
struct ctdb_reply_dmaster_old {
2010-05-20 09:48:30 +04:00
struct ctdb_req_header hdr ;
uint32_t db_id ;
uint64_t rsn ;
uint32_t keylen ;
uint32_t datalen ;
uint8_t data [ 1 ] ;
} ;
2015-10-29 08:36:30 +03:00
struct ctdb_req_message_old {
2010-05-20 09:48:30 +04:00
struct ctdb_req_header hdr ;
uint64_t srvid ;
uint32_t datalen ;
uint8_t data [ 1 ] ;
} ;
2015-10-29 08:42:05 +03:00
struct ctdb_req_control_old {
2010-05-20 09:48:30 +04:00
struct ctdb_req_header hdr ;
uint32_t opcode ;
2010-06-02 10:49:05 +04:00
uint32_t pad ;
2010-05-20 09:48:30 +04:00
uint64_t srvid ;
uint32_t client_id ;
uint32_t flags ;
uint32_t datalen ;
uint8_t data [ 1 ] ;
} ;
2015-10-29 08:44:08 +03:00
struct ctdb_reply_control_old {
2010-05-20 09:48:30 +04:00
struct ctdb_req_header hdr ;
int32_t status ;
uint32_t datalen ;
uint32_t errorlen ;
uint8_t data [ 1 ] ;
} ;
2015-10-29 08:45:41 +03:00
struct ctdb_req_keepalive_old {
2010-05-20 09:48:30 +04:00
struct ctdb_req_header hdr ;
2017-04-21 10:55:11 +03:00
uint32_t version ;
uint32_t uptime ;
2010-05-20 09:48:30 +04:00
} ;
2017-04-06 12:03:51 +03:00
struct ctdb_req_tunnel_old {
struct ctdb_req_header hdr ;
uint64_t tunnel_id ;
uint32_t flags ;
uint32_t datalen ;
uint8_t data [ 1 ] ;
} ;
2010-09-13 08:28:11 +04:00
/*
2023-03-22 11:30:31 +03:00
Structure used for a nodemap .
2010-09-13 08:28:11 +04:00
The nodemap is the structure containing a list of all nodes
known to the cluster and their associated flags .
*/
2015-10-29 09:22:48 +03:00
struct ctdb_node_map_old {
2010-09-13 08:28:11 +04:00
uint32_t num ;
struct ctdb_node_and_flags nodes [ 1 ] ;
} ;
2015-10-28 09:16:24 +03:00
struct ctdb_public_ip_list_old {
2010-09-15 08:56:57 +04:00
uint32_t num ;
struct ctdb_public_ip ips [ 1 ] ;
} ;
2011-01-14 09:35:31 +03:00
/*
structure used to pass record data between the child and parent
*/
2015-10-29 09:30:30 +03:00
struct ctdb_rec_data_old {
2011-01-14 09:35:31 +03:00
uint32_t length ;
uint32_t reqid ;
uint32_t keylen ;
uint32_t datalen ;
uint8_t data [ 1 ] ;
} ;
2010-09-29 06:13:05 +04:00
/*
* wire format for statistics history
*/
2015-10-28 12:09:40 +03:00
struct ctdb_statistics_list_old {
2010-09-29 06:13:05 +04:00
uint32_t num ;
struct ctdb_statistics stats [ 1 ] ;
} ;
2012-02-08 08:29:27 +04:00
/*
* db statistics
*/
2015-10-29 09:33:09 +03:00
struct ctdb_db_statistics_old {
2012-10-11 04:29:29 +04:00
struct {
uint32_t num_calls ;
uint32_t num_current ;
uint32_t num_pending ;
uint32_t num_failed ;
2015-10-28 09:18:24 +03:00
struct ctdb_latency_counter latency ;
2012-10-11 04:29:29 +04:00
uint32_t buckets [ MAX_COUNT_BUCKETS ] ;
} locks ;
2014-02-11 07:23:28 +04:00
struct {
2015-10-28 09:18:24 +03:00
struct ctdb_latency_counter latency ;
2014-02-11 07:23:28 +04:00
} vacuum ;
2012-02-08 08:29:27 +04:00
uint32_t db_ro_delegations ;
uint32_t db_ro_revokes ;
2012-03-20 05:08:12 +04:00
uint32_t hop_count_bucket [ MAX_COUNT_BUCKETS ] ;
2012-06-13 10:17:18 +04:00
uint32_t num_hot_keys ;
2013-07-15 09:24:11 +04:00
struct {
uint32_t count ;
TDB_DATA key ;
} hot_keys [ MAX_HOT_KEYS ] ;
char hot_keys_wire [ 1 ] ;
2013-07-15 08:52:07 +04:00
} ;
2012-02-08 08:29:27 +04:00
2023-03-22 11:30:31 +03:00
/*
2011-12-12 09:48:10 +04:00
a wire representation of the vnn map
*/
struct ctdb_vnn_map_wire {
uint32_t generation ;
uint32_t size ;
uint32_t map [ 1 ] ;
} ;
2015-10-28 09:43:20 +03:00
struct ctdb_notify_data_old {
2015-10-27 07:32:12 +03:00
uint64_t srvid ;
uint32_t len ;
uint8_t notify_data [ 1 ] ;
} ;
/* table that contains a list of all dbids on a node
*/
2015-10-29 09:46:05 +03:00
struct ctdb_dbid_map_old {
uint32_t num ;
struct ctdb_dbid dbs [ 1 ] ;
2015-10-27 07:32:12 +03:00
} ;
2015-10-27 08:29:36 +03:00
/* the list of tcp tickles used by get/set tcp tickle list */
2015-10-28 10:44:19 +03:00
struct ctdb_tickle_list_old {
2015-10-27 08:29:36 +03:00
ctdb_sock_addr addr ;
2015-10-28 10:44:19 +03:00
uint32_t num ;
struct ctdb_connection connections [ 1 ] ;
2015-10-27 08:29:36 +03:00
} ;
/*
struct holding a ctdb_sock_addr and an interface name ,
2023-03-22 11:29:34 +03:00
used to add / remove public addresses and gratuitous arp
2015-10-27 08:29:36 +03:00
*/
2015-10-29 06:46:21 +03:00
struct ctdb_addr_info_old {
2015-10-27 08:29:36 +03:00
ctdb_sock_addr addr ;
uint32_t mask ;
uint32_t len ;
char iface [ 1 ] ;
} ;
/* structure used for sending lists of records */
struct ctdb_marshall_buffer {
uint32_t db_id ;
uint32_t count ;
uint8_t data [ 1 ] ;
} ;
/*
structure for setting a tunable
*/
2015-10-28 11:18:02 +03:00
struct ctdb_tunable_old {
2015-10-27 08:29:36 +03:00
uint32_t value ;
uint32_t length ;
uint8_t name [ 1 ] ;
} ;
/*
structure for getting a tunable
*/
struct ctdb_control_get_tunable {
uint32_t length ;
uint8_t name [ 1 ] ;
} ;
/*
structure for listing tunables
*/
struct ctdb_control_list_tunable {
uint32_t length ;
/* returns a : separated list of tunable names */
uint8_t data [ 1 ] ;
} ;
2015-10-28 11:39:51 +03:00
struct ctdb_public_ip_info_old {
2015-10-27 08:29:36 +03:00
struct ctdb_public_ip ip ;
uint32_t active_idx ;
uint32_t num ;
2015-10-28 11:37:17 +03:00
struct ctdb_iface ifaces [ 1 ] ;
2015-10-27 08:29:36 +03:00
} ;
2015-10-28 11:43:48 +03:00
struct ctdb_iface_list_old {
2015-10-27 08:29:36 +03:00
uint32_t num ;
2015-10-28 11:37:17 +03:00
struct ctdb_iface ifaces [ 1 ] ;
2015-10-27 08:29:36 +03:00
} ;
/**
* structure to pass to a schedule_for_deletion_control
*/
struct ctdb_control_schedule_for_deletion {
uint32_t db_id ;
struct ctdb_ltdb_header hdr ;
uint32_t keylen ;
uint8_t key [ 1 ] ; /* key[] */
} ;
2010-05-20 09:48:30 +04:00
# endif