ctdb-test: Adding test case to verify queue resizeing
[vlendec/samba-autobuild/.git] / ctdb / protocol / protocol_api.h
index cc00b44574b3a1561e929edb9119f509a989342b..6104c10e7b5a269ff914cd894d3897e47ae68f72 100644 (file)
 #ifndef __CTDB_PROTOCOL_API_H__
 #define __CTDB_PROTOCOL_API_H__
 
+#include <talloc.h>
+
 #include "protocol/protocol.h"
 
 /* From protocol/protocol_types.c */
 
-size_t ctdb_ltdb_header_len(struct ctdb_ltdb_header *header);
-void ctdb_ltdb_header_push(struct ctdb_ltdb_header *header, uint8_t *buf);
+size_t ctdb_ltdb_header_len(struct ctdb_ltdb_header *in);
+void ctdb_ltdb_header_push(struct ctdb_ltdb_header *in, uint8_t *buf,
+                          size_t *npush);
 int ctdb_ltdb_header_pull(uint8_t *buf, size_t buflen,
-                         struct ctdb_ltdb_header *header);
+                         struct ctdb_ltdb_header *out, size_t *npull);
+
+int ctdb_ltdb_header_extract(TDB_DATA *data, struct ctdb_ltdb_header *header);
 
-size_t ctdb_rec_data_len(struct ctdb_rec_data *rec);
-void ctdb_rec_data_push(struct ctdb_rec_data *rec, uint8_t *buf);
+size_t ctdb_rec_data_len(struct ctdb_rec_data *in);
+void ctdb_rec_data_push(struct ctdb_rec_data *in, uint8_t *buf, size_t *npush);
 int ctdb_rec_data_pull(uint8_t *buf, size_t buflen, TALLOC_CTX *mem_ctx,
-                      struct ctdb_rec_data **out);
+                      struct ctdb_rec_data **out, size_t *npull);
 
-size_t ctdb_rec_buffer_len(struct ctdb_rec_buffer *recbuf);
-void ctdb_rec_buffer_push(struct ctdb_rec_buffer *recbuf, uint8_t *buf);
+size_t ctdb_rec_buffer_len(struct ctdb_rec_buffer *in);
+void ctdb_rec_buffer_push(struct ctdb_rec_buffer *in, uint8_t *buf,
+                         size_t *npush);
 int ctdb_rec_buffer_pull(uint8_t *buf, size_t buflen, TALLOC_CTX *mem_ctx,
-                     struct ctdb_rec_buffer **out);
+                        struct ctdb_rec_buffer **out, size_t *npull);
 
 struct ctdb_rec_buffer *ctdb_rec_buffer_init(TALLOC_CTX *mem_ctx,
                                             uint32_t db_id);
@@ -48,19 +54,26 @@ int ctdb_rec_buffer_traverse(struct ctdb_rec_buffer *recbuf,
                             ctdb_rec_parser_func_t func,
                             void *private_data);
 
-size_t ctdb_server_id_len(struct ctdb_server_id *sid);
-void ctdb_server_id_push(struct ctdb_server_id *sid, uint8_t *buf);
+int ctdb_rec_buffer_write(struct ctdb_rec_buffer *recbuf, int fd);
+int ctdb_rec_buffer_read(int fd, TALLOC_CTX *mem_ctx,
+                        struct ctdb_rec_buffer **out);
+
+size_t ctdb_server_id_len(struct ctdb_server_id *in);
+void ctdb_server_id_push(struct ctdb_server_id *in, uint8_t *buf,
+                        size_t *npush);
 int ctdb_server_id_pull(uint8_t *buf, size_t buflen,
-                        struct ctdb_server_id *sid);
+                       struct ctdb_server_id *out, size_t *npull);
 
-size_t ctdb_g_lock_len(struct ctdb_g_lock *lock);
-void ctdb_g_lock_push(struct ctdb_g_lock *lock, uint8_t *buf);
-int ctdb_g_lock_pull(uint8_t *buf, size_t buflen, struct ctdb_g_lock *lock);
+size_t ctdb_g_lock_len(struct ctdb_g_lock *in);
+void ctdb_g_lock_push(struct ctdb_g_lock *in, uint8_t *buf, size_t *npush);
+int ctdb_g_lock_pull(uint8_t *buf, size_t buflen, struct ctdb_g_lock *out,
+                    size_t *npull);
 
-size_t ctdb_g_lock_list_len(struct ctdb_g_lock_list *lock_list);
-void ctdb_g_lock_list_push(struct ctdb_g_lock_list *lock_list, uint8_t *buf);
+size_t ctdb_g_lock_list_len(struct ctdb_g_lock_list *in);
+void ctdb_g_lock_list_push(struct ctdb_g_lock_list *in, uint8_t *buf,
+                          size_t *npush);
 int ctdb_g_lock_list_pull(uint8_t *buf, size_t buflen, TALLOC_CTX *mem_ctx,
-                         struct ctdb_g_lock_list **out);
+                         struct ctdb_g_lock_list **out, size_t *npull);
 
 /* From protocol/protocol_header.c */
 
@@ -68,81 +81,98 @@ void ctdb_req_header_fill(struct ctdb_req_header *h, uint32_t generation,
                          uint32_t operation, uint32_t destnode,
                          uint32_t srcnode, uint32_t reqid);
 
-int ctdb_req_header_pull(uint8_t *pkt, size_t pkt_len,
-                        struct ctdb_req_header *h);
+size_t ctdb_req_header_len(struct ctdb_req_header *in);
+void ctdb_req_header_push(struct ctdb_req_header *in, uint8_t *buf,
+                         size_t *npush);
+int ctdb_req_header_pull(uint8_t *buf, size_t buflen,
+                        struct ctdb_req_header *out, size_t *npull);
 
 int ctdb_req_header_verify(struct ctdb_req_header *h, uint32_t operation);
 
 /* From protocol/protocol_call.c */
 
+size_t ctdb_req_call_len(struct ctdb_req_header *h,
+                        struct ctdb_req_call *c);
+
 int ctdb_req_call_push(struct ctdb_req_header *h,
                       struct ctdb_req_call *c,
-                      TALLOC_CTX *mem_ctx,
-                      uint8_t **pkt, size_t *pkt_len);
+                      uint8_t *buf, size_t *buflen);
 
-int ctdb_req_call_pull(uint8_t *pkt, size_t pkt_len,
+int ctdb_req_call_pull(uint8_t *buf, size_t buflen,
                       struct ctdb_req_header *h,
                       TALLOC_CTX *mem_ctx,
                       struct ctdb_req_call *c);
 
+size_t ctdb_reply_call_len(struct ctdb_req_header *h,
+                          struct ctdb_reply_call *c);
+
 int ctdb_reply_call_push(struct ctdb_req_header *h,
                         struct ctdb_reply_call *c,
-                        TALLOC_CTX *mem_ctx,
-                        uint8_t **pkt, size_t *pkt_len);
+                        uint8_t *buf, size_t *buflen);
 
-int ctdb_reply_call_pull(uint8_t *pkt, size_t pkt_len,
+int ctdb_reply_call_pull(uint8_t *buf, size_t buflen,
                         struct ctdb_req_header *h,
                         TALLOC_CTX *mem_ctx,
                         struct ctdb_reply_call *c);
 
+size_t ctdb_reply_error_len(struct ctdb_req_header *h,
+                           struct ctdb_reply_error *c);
+
 int ctdb_reply_error_push(struct ctdb_req_header *h,
                          struct ctdb_reply_error *c,
-                         TALLOC_CTX *mem_ctx,
-                         uint8_t **pkt, size_t *pkt_len);
+                         uint8_t *buf, size_t *buflen);
 
-int ctdb_reply_error_pull(uint8_t *pkt, size_t pkt_len,
+int ctdb_reply_error_pull(uint8_t *buf, size_t buflen,
                          struct ctdb_req_header *h,
                          TALLOC_CTX *mem_ctx,
                          struct ctdb_reply_error *c);
 
+size_t ctdb_req_dmaster_len(struct ctdb_req_header *h,
+                           struct ctdb_req_dmaster *c);
+
 int ctdb_req_dmaster_push(struct ctdb_req_header *h,
                          struct ctdb_req_dmaster *c,
-                         TALLOC_CTX *mem_ctx,
-                         uint8_t **pkt, size_t *pkt_len);
+                         uint8_t *buf, size_t *buflen);
 
-int ctdb_req_dmaster_pull(uint8_t *pkt, size_t pkt_len,
+int ctdb_req_dmaster_pull(uint8_t *buf, size_t buflen,
                          struct ctdb_req_header *h,
                          TALLOC_CTX *mem_ctx,
                          struct ctdb_req_dmaster *c);
 
+size_t ctdb_reply_dmaster_len(struct ctdb_req_header *h,
+                             struct ctdb_reply_dmaster *c);
+
 int ctdb_reply_dmaster_push(struct ctdb_req_header *h,
                            struct ctdb_reply_dmaster *c,
-                           TALLOC_CTX *mem_ctx,
-                           uint8_t **pkt, size_t *pkt_len);
+                           uint8_t *buf, size_t *buflen);
 
-int ctdb_reply_dmaster_pull(uint8_t *pkt, size_t pkt_len,
+int ctdb_reply_dmaster_pull(uint8_t *buf, size_t buflen,
                            struct ctdb_req_header *h,
                            TALLOC_CTX *mem_ctx,
                            struct ctdb_reply_dmaster *c);
 
 /* From protocol/protocol_control.c */
 
+size_t ctdb_req_control_len(struct ctdb_req_header *h,
+                           struct ctdb_req_control *c);
+
 int ctdb_req_control_push(struct ctdb_req_header *h,
                          struct ctdb_req_control *c,
-                         TALLOC_CTX *mem_ctx,
-                         uint8_t **pkt, size_t *pkt_len);
+                         uint8_t *buf, size_t *buflen);
 
-int ctdb_req_control_pull(uint8_t *pkt, size_t pkt_len,
+int ctdb_req_control_pull(uint8_t *buf, size_t buflen,
                          struct ctdb_req_header *h,
                          TALLOC_CTX *mem_ctx,
                          struct ctdb_req_control *c);
 
+size_t ctdb_reply_control_len(struct ctdb_req_header *h,
+                             struct ctdb_reply_control *c);
+
 int ctdb_reply_control_push(struct ctdb_req_header *h,
                            struct ctdb_reply_control *c,
-                           TALLOC_CTX *mem_ctx,
-                           uint8_t **pkt, size_t *pkt_len);
+                           uint8_t *buf, size_t *buflen);
 
-int ctdb_reply_control_pull(uint8_t *pkt, size_t pkt_len, uint32_t opcode,
+int ctdb_reply_control_pull(uint8_t *buf, size_t buflen, uint32_t opcode,
                            struct ctdb_req_header *h,
                            TALLOC_CTX *mem_ctx,
                            struct ctdb_reply_control *c);
@@ -180,10 +210,10 @@ int ctdb_reply_control_setvnnmap(struct ctdb_reply_control *reply);
 
 void ctdb_req_control_get_debug(struct ctdb_req_control *request);
 int ctdb_reply_control_get_debug(struct ctdb_reply_control *reply,
-                                uint32_t *debug_level);
+                                int *debug_level);
 
 void ctdb_req_control_set_debug(struct ctdb_req_control *request,
-                               uint32_t debug_level);
+                               int debug_level);
 int ctdb_reply_control_set_debug(struct ctdb_reply_control *reply);
 
 void ctdb_req_control_get_dbmap(struct ctdb_req_control *request);
@@ -213,7 +243,7 @@ void ctdb_req_control_statistics_reset(struct ctdb_req_control *request);
 int ctdb_reply_control_statistics_reset(struct ctdb_reply_control *reply);
 
 void ctdb_req_control_db_attach(struct ctdb_req_control *request,
-                               const char *db_name, uint32_t tdb_flags);
+                               const char *db_name);
 int ctdb_reply_control_db_attach(struct ctdb_reply_control *reply,
                                 uint32_t *db_id);
 
@@ -262,10 +292,6 @@ void ctdb_req_control_freeze(struct ctdb_req_control *request,
                             uint32_t priority);
 int ctdb_reply_control_freeze(struct ctdb_reply_control *reply);
 
-void ctdb_req_control_thaw(struct ctdb_req_control *request,
-                          uint32_t priority);
-int ctdb_reply_control_thaw(struct ctdb_reply_control *reply);
-
 void ctdb_req_control_get_pnn(struct ctdb_req_control *request);
 int ctdb_reply_control_get_pnn(struct ctdb_reply_control *reply,
                               uint32_t *pnn);
@@ -273,10 +299,6 @@ int ctdb_reply_control_get_pnn(struct ctdb_reply_control *reply,
 void ctdb_req_control_shutdown(struct ctdb_req_control *request);
 int ctdb_reply_control_shutdown(struct ctdb_reply_control *reply);
 
-void ctdb_req_control_get_monmode(struct ctdb_req_control *request);
-int ctdb_reply_control_get_monmode(struct ctdb_reply_control *reply,
-                                  int *mon_mode);
-
 void ctdb_req_control_tcp_client(struct ctdb_req_control *request,
                                 struct ctdb_connection *conn);
 int ctdb_reply_control_tcp_client(struct ctdb_reply_control *reply);
@@ -315,10 +337,6 @@ int ctdb_reply_control_get_all_tunables(struct ctdb_reply_control *reply,
                                        TALLOC_CTX *mem_ctx,
                                        struct ctdb_tunable_list **tun_list);
 
-void ctdb_req_control_kill_tcp(struct ctdb_req_control *request,
-                              struct ctdb_connection *conn);
-int ctdb_reply_control_kill_tcp(struct ctdb_reply_control *reply);
-
 void ctdb_req_control_get_tcp_tickle_list(struct ctdb_req_control *request,
                                          ctdb_sock_addr *addr);
 int ctdb_reply_control_get_tcp_tickle_list(struct ctdb_reply_control *reply,
@@ -329,26 +347,8 @@ void ctdb_req_control_set_tcp_tickle_list(struct ctdb_req_control *request,
                                          struct ctdb_tickle_list *tickles);
 int ctdb_reply_control_set_tcp_tickle_list(struct ctdb_reply_control *reply);
 
-void ctdb_req_control_register_server_id(struct ctdb_req_control *request,
-                                        struct ctdb_client_id *sid);
-int ctdb_reply_control_register_server_id(struct ctdb_reply_control *reply);
-
-void ctdb_req_control_unregister_server_id(struct ctdb_req_control *request,
-                                          struct ctdb_client_id *sid);
-int ctdb_reply_control_unregister_server_id(struct ctdb_reply_control *reply);
-
-void ctdb_req_control_check_server_id(struct ctdb_req_control *request,
-                                     struct ctdb_client_id *sid);
-int ctdb_reply_control_check_server_id(struct ctdb_reply_control *reply);
-
-void ctdb_req_control_get_server_id_list(struct ctdb_req_control *request);
-int ctdb_reply_control_get_server_id_list(struct ctdb_reply_control *reply,
-                                         TALLOC_CTX *mem_ctx,
-                                         struct ctdb_client_id_map **cid_map);
-
 void ctdb_req_control_db_attach_persistent(struct ctdb_req_control *request,
-                                          const char *name,
-                                          uint32_t tdb_flags);
+                                          const char *name);
 int ctdb_reply_control_db_attach_persistent(struct ctdb_reply_control *reply,
                                            uint32_t *db_id);
 
@@ -360,14 +360,6 @@ void ctdb_req_control_send_gratuitous_arp(struct ctdb_req_control *request,
                                          struct ctdb_addr_info *addr_info);
 int ctdb_reply_control_send_gratuitous_arp(struct ctdb_reply_control *reply);
 
-void ctdb_req_control_transaction_start(struct ctdb_req_control *request,
-                                       uint32_t tid);
-int ctdb_reply_control_transaction_start(struct ctdb_reply_control *reply);
-
-void ctdb_req_control_transaction_commit(struct ctdb_req_control *request,
-                                        uint32_t tid);
-int ctdb_reply_control_transaction_commit(struct ctdb_reply_control *reply);
-
 void ctdb_req_control_wipe_database(struct ctdb_req_control *request,
                                    struct ctdb_transdb *transdb);
 int ctdb_reply_control_wipe_database(struct ctdb_reply_control *reply);
@@ -392,12 +384,6 @@ int ctdb_reply_control_try_delete_records(struct ctdb_reply_control *reply,
                                          TALLOC_CTX *mem_ctx,
                                          struct ctdb_rec_buffer **recbuf);
 
-void ctdb_req_control_enable_monitor(struct ctdb_req_control *request);
-int ctdb_reply_control_enable_monitor(struct ctdb_reply_control *reply);
-
-void ctdb_req_control_disable_monitor(struct ctdb_req_control *request);
-int ctdb_reply_control_disable_monitor(struct ctdb_reply_control *reply);
-
 void ctdb_req_control_add_public_ip(struct ctdb_req_control *request,
                                    struct ctdb_addr_info *addr_info);
 int ctdb_reply_control_add_public_ip(struct ctdb_reply_control *reply);
@@ -406,10 +392,6 @@ void ctdb_req_control_del_public_ip(struct ctdb_req_control *request,
                                    struct ctdb_addr_info *addr_info);
 int ctdb_reply_control_del_public_ip(struct ctdb_reply_control *reply);
 
-void ctdb_req_control_run_eventscripts(struct ctdb_req_control *request,
-                                      const char *event_str);
-int ctdb_reply_control_run_eventscripts(struct ctdb_reply_control *reply);
-
 void ctdb_req_control_get_capabilities(struct ctdb_req_control *request);
 int ctdb_reply_control_get_capabilities(struct ctdb_reply_control *reply,
                                        uint32_t *caps);
@@ -425,7 +407,8 @@ void ctdb_req_control_takeover_ip(struct ctdb_req_control *request,
                                  struct ctdb_public_ip *pubip);
 int ctdb_reply_control_takeover_ip(struct ctdb_reply_control *reply);
 
-void ctdb_req_control_get_public_ips(struct ctdb_req_control *request);
+void ctdb_req_control_get_public_ips(struct ctdb_req_control *request,
+                                    bool available_only);
 int ctdb_reply_control_get_public_ips(struct ctdb_reply_control *reply,
                                      TALLOC_CTX *mem_ctx,
                                      struct ctdb_public_ip_list **pubip_list);
@@ -435,12 +418,6 @@ int ctdb_reply_control_get_nodemap(struct ctdb_reply_control *reply,
                                   TALLOC_CTX *mem_ctx,
                                   struct ctdb_node_map **nodemap);
 
-void ctdb_req_control_get_event_script_status(struct ctdb_req_control *request,
-                                             uint32_t event);
-int ctdb_reply_control_get_event_script_status(struct ctdb_reply_control *reply,
-                                              TALLOC_CTX *mem_ctx,
-                                              struct ctdb_script_list **script_list);
-
 void ctdb_req_control_traverse_kill(struct ctdb_req_control *request,
                                    struct ctdb_traverse_start *traverse);
 int ctdb_reply_control_traverse_kill(struct ctdb_reply_control *reply);
@@ -454,20 +431,12 @@ int ctdb_reply_control_get_reclock_file(struct ctdb_reply_control *reply,
                                        TALLOC_CTX *mem_ctx,
                                        const char **reclock_file);
 
-void ctdb_req_control_set_reclock_file(struct ctdb_req_control *request,
-                                      const char *reclock_file);
-int ctdb_reply_control_set_reclock_file(struct ctdb_reply_control *reply);
-
 void ctdb_req_control_stop_node(struct ctdb_req_control *request);
 int ctdb_reply_control_stop_node(struct ctdb_reply_control *reply);
 
 void ctdb_req_control_continue_node(struct ctdb_req_control *request);
 int ctdb_reply_control_continue_node(struct ctdb_reply_control *reply);
 
-void ctdb_req_control_set_natgwstate(struct ctdb_req_control *request,
-                                    uint32_t natgw_role);
-int ctdb_reply_control_set_natgwstate(struct ctdb_reply_control *reply);
-
 void ctdb_req_control_set_lmasterrole(struct ctdb_req_control *request,
                                      uint32_t lmaster_role);
 int ctdb_reply_control_set_lmasterrole(struct ctdb_reply_control *reply);
@@ -476,14 +445,6 @@ void ctdb_req_control_set_recmasterrole(struct ctdb_req_control *request,
                                        uint32_t recmaster_role);
 int ctdb_reply_control_set_recmasterrole(struct ctdb_reply_control *reply);
 
-void ctdb_req_control_enable_script(struct ctdb_req_control *request,
-                                   const char *script);
-int ctdb_reply_control_enable_script(struct ctdb_reply_control *reply);
-
-void ctdb_req_control_disable_script(struct ctdb_req_control *request,
-                                    const char *script);
-int ctdb_reply_control_disable_script(struct ctdb_reply_control *reply);
-
 void ctdb_req_control_set_ban_state(struct ctdb_req_control *request,
                                    struct ctdb_ban_state *ban_state);
 int ctdb_reply_control_set_ban_state(struct ctdb_reply_control *reply);
@@ -493,19 +454,6 @@ int ctdb_reply_control_get_ban_state(struct ctdb_reply_control *reply,
                                     TALLOC_CTX *mem_ctx,
                                     struct ctdb_ban_state **ban_state);
 
-void ctdb_req_control_set_db_priority(struct ctdb_req_control *request,
-                                     struct ctdb_db_priority *db_prio);
-int ctdb_reply_control_set_db_priority(struct ctdb_reply_control *reply);
-
-void ctdb_req_control_get_db_priority(struct ctdb_req_control *request,
-                                     uint32_t db_id);
-int ctdb_reply_control_get_db_priority(struct ctdb_reply_control *reply,
-                                      uint32_t *priority);
-
-void ctdb_req_control_transaction_cancel(struct ctdb_req_control *request,
-                                        uint32_t tid);
-int ctdb_reply_control_transaction_cancel(struct ctdb_reply_control *reply);
-
 void ctdb_req_control_register_notify(struct ctdb_req_control *request,
                                      struct ctdb_notify_data *notify);
 int ctdb_reply_control_register_notify(struct ctdb_reply_control *reply);
@@ -565,12 +513,6 @@ void ctdb_req_control_set_db_readonly(struct ctdb_req_control *request,
                                      uint32_t db_id);
 int ctdb_reply_control_set_db_readonly(struct ctdb_reply_control *reply);
 
-void ctdb_req_control_check_srvids(struct ctdb_req_control *request,
-                                  struct ctdb_uint64_array *u64_array);
-int ctdb_reply_control_check_srvids(struct ctdb_reply_control *reply,
-                                   TALLOC_CTX *mem_ctx,
-                                   struct ctdb_uint8_array **u8_array);
-
 void ctdb_req_control_traverse_start_ext(struct ctdb_req_control *request,
                                         struct ctdb_traverse_start_ext *traverse);
 int ctdb_reply_control_traverse_start_ext(struct ctdb_reply_control *reply);
@@ -588,12 +530,6 @@ int ctdb_reply_control_set_db_sticky(struct ctdb_reply_control *reply);
 void ctdb_req_control_reload_public_ips(struct ctdb_req_control *request);
 int ctdb_reply_control_reload_public_ips(struct ctdb_reply_control *reply);
 
-void ctdb_req_control_receive_records(struct ctdb_req_control *request,
-                                     struct ctdb_rec_buffer *recbuf);
-int ctdb_reply_control_receive_records(struct ctdb_reply_control *reply,
-                                      TALLOC_CTX *mem_ctx,
-                                      struct ctdb_rec_buffer **recbuf);
-
 void ctdb_req_control_ipreallocated(struct ctdb_req_control *request);
 int ctdb_reply_control_ipreallocated(struct ctdb_reply_control *reply);
 
@@ -630,34 +566,117 @@ void ctdb_req_control_db_transaction_cancel(struct ctdb_req_control *request,
                                            uint32_t db_id);
 int ctdb_reply_control_db_transaction_cancel(struct ctdb_reply_control *reply);
 
+void ctdb_req_control_db_pull(struct ctdb_req_control *request,
+                             struct ctdb_pulldb_ext *pulldb_ext);
+int ctdb_reply_control_db_pull(struct ctdb_reply_control *reply,
+                              uint32_t *num_records);
+
+void ctdb_req_control_db_push_start(struct ctdb_req_control *request,
+                                   struct ctdb_pulldb_ext *pulldb_ext);
+int ctdb_reply_control_db_push_start(struct ctdb_reply_control *reply);
+
+void ctdb_req_control_db_push_confirm(struct ctdb_req_control *request,
+                                     uint32_t db_id);
+int ctdb_reply_control_db_push_confirm(struct ctdb_reply_control *reply,
+                                      uint32_t *num_records);
+
+void ctdb_req_control_db_open_flags(struct ctdb_req_control *request,
+                                   uint32_t db_id);
+int ctdb_reply_control_db_open_flags(struct ctdb_reply_control *reply,
+                                    int *tdb_flags);
+
+void ctdb_req_control_db_attach_replicated(struct ctdb_req_control *request,
+                                          const char *db_name);
+int ctdb_reply_control_db_attach_replicated(struct ctdb_reply_control *reply,
+                                           uint32_t *db_id);
+
+void ctdb_req_control_check_pid_srvid(struct ctdb_req_control *request,
+                                     struct ctdb_pid_srvid *pid_srvid);
+int ctdb_reply_control_check_pid_srvid(struct ctdb_reply_control *reply,
+                                      int *status);
+
+void ctdb_req_control_tunnel_register(struct ctdb_req_control *request,
+                                     uint64_t tunnel_id);
+int ctdb_reply_control_tunnel_register(struct ctdb_reply_control *reply);
+
+void ctdb_req_control_tunnel_deregister(struct ctdb_req_control *request,
+                                       uint64_t tunnel_id);
+int ctdb_reply_control_tunnel_deregister(struct ctdb_reply_control *reply);
+
+/* From protocol/protocol_debug.c */
+
+void ctdb_packet_print(uint8_t *buf, size_t buflen, FILE *fp);
+
 /* From protocol/protocol_message.c */
 
+size_t ctdb_req_message_len(struct ctdb_req_header *h,
+                           struct ctdb_req_message *c);
+
 int ctdb_req_message_push(struct ctdb_req_header *h,
                          struct ctdb_req_message *c,
-                         TALLOC_CTX *mem_ctx,
-                         uint8_t **pkt, size_t *pkt_len);
+                         uint8_t *buf, size_t *buflen);
 
-int ctdb_req_message_pull(uint8_t *pkt, size_t pkt_len,
+int ctdb_req_message_pull(uint8_t *buf, size_t buflen,
                          struct ctdb_req_header *h,
                          TALLOC_CTX *mem_ctx,
                          struct ctdb_req_message *c);
 
+size_t ctdb_req_message_data_len(struct ctdb_req_header *h,
+                                struct ctdb_req_message_data *c);
+
 int ctdb_req_message_data_push(struct ctdb_req_header *h,
-                              struct ctdb_req_message_data *message,
-                              TALLOC_CTX *mem_ctx,
-                              uint8_t **pkt, size_t *pkt_len);
+                              struct ctdb_req_message_data *c,
+                              uint8_t *buf, size_t *buflen);
 
-int ctdb_req_message_data_pull(uint8_t *pkt, size_t pkt_len,
+int ctdb_req_message_data_pull(uint8_t *buf, size_t buflen,
                               struct ctdb_req_header *h,
                               TALLOC_CTX *mem_ctx,
-                              struct ctdb_req_message_data *message);
+                              struct ctdb_req_message_data *c);
+
+/* From protocol/protocol_keepalive.c */
+
+size_t ctdb_req_keepalive_len(struct ctdb_req_header *h,
+                             struct ctdb_req_keepalive *c);
+
+int ctdb_req_keepalive_push(struct ctdb_req_header *h,
+                           struct ctdb_req_keepalive *c,
+                           uint8_t *buf, size_t *buflen);
+
+int ctdb_req_keepalive_pull(uint8_t *buf, size_t buflen,
+                           struct ctdb_req_header *h,
+                           TALLOC_CTX *mem_ctx,
+                           struct ctdb_req_keepalive *c);
+
+/* From protocol/protocol_tunnel.c */
+
+size_t ctdb_req_tunnel_len(struct ctdb_req_header *h,
+                          struct ctdb_req_tunnel *c);
+
+int ctdb_req_tunnel_push(struct ctdb_req_header *h,
+                        struct ctdb_req_tunnel *c,
+                        uint8_t *buf, size_t *buflen);
+
+int ctdb_req_tunnel_pull(uint8_t *buf, size_t buflen,
+                        struct ctdb_req_header *h,
+                        TALLOC_CTX *mem_ctx,
+                        struct ctdb_req_tunnel *c);
+
+/* From protocol/protocol_packet.c */
+
+int ctdb_allocate_pkt(TALLOC_CTX *mem_ctx, size_t datalen,
+                     uint8_t **buf, size_t *buflen);
 
-/* From protocol/protocol_util.c */
+/* From protocol/protocol_sock.c */
 
-const char *ctdb_runstate_to_string(enum ctdb_runstate runstate);
-enum ctdb_runstate ctdb_runstate_from_string(const char *runstate_str);
+size_t sock_packet_header_len(struct sock_packet_header *in);
+void sock_packet_header_push(struct sock_packet_header *in, uint8_t *buf,
+                            size_t *npush);
+int sock_packet_header_pull(uint8_t *buf, size_t buflen,
+                           struct sock_packet_header *out, size_t *npull);
 
-const char *ctdb_event_to_string(enum ctdb_event event);
-enum ctdb_event ctdb_event_from_string(const char *event_str);
+void sock_packet_header_set_reqid(struct sock_packet_header *h,
+                                 uint32_t reqid);
+void sock_packet_header_set_length(struct sock_packet_header *h,
+                                  uint32_t length);
 
 #endif /* __CTDB_PROTOCOL_API_H__ */