2 CTDB protocol marshalling
4 Copyright (C) Amitay Isaacs 2015
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, see <http://www.gnu.org/licenses/>.
20 #ifndef __PROTOCOL_PRIVATE_H__
21 #define __PROTOCOL_PRIVATE_H__
25 size_t ctdb_int32_len(int32_t val
);
26 void ctdb_int32_push(int32_t val
, uint8_t *buf
);
27 int ctdb_int32_pull(uint8_t *buf
, size_t buflen
, TALLOC_CTX
*mem_ctx
,
30 size_t ctdb_uint32_len(uint32_t val
);
31 void ctdb_uint32_push(uint32_t val
, uint8_t *buf
);
32 int ctdb_uint32_pull(uint8_t *buf
, size_t buflen
, TALLOC_CTX
*mem_ctx
,
35 size_t ctdb_uint64_len(uint64_t val
);
36 void ctdb_uint64_push(uint64_t val
, uint8_t *buf
);
37 int ctdb_uint64_pull(uint8_t *buf
, size_t buflen
, TALLOC_CTX
*mem_ctx
,
40 size_t ctdb_double_len(double val
);
41 void ctdb_double_push(double val
, uint8_t *buf
);
42 int ctdb_double_pull(uint8_t *buf
, size_t buflen
, TALLOC_CTX
*mem_ctx
,
45 size_t ctdb_uint8_array_len(struct ctdb_uint8_array
*array
);
46 void ctdb_uint8_array_push(struct ctdb_uint8_array
*array
, uint8_t *buf
);
47 int ctdb_uint8_array_pull(uint8_t *buf
, size_t buflen
, TALLOC_CTX
*mem_ctx
,
48 struct ctdb_uint8_array
**out
);
50 size_t ctdb_uint64_array_len(struct ctdb_uint64_array
*array
);
51 void ctdb_uint64_array_push(struct ctdb_uint64_array
*array
, uint8_t *buf
);
52 int ctdb_uint64_array_pull(uint8_t *buf
, size_t buflen
, TALLOC_CTX
*mem_ctx
,
53 struct ctdb_uint64_array
**out
);
55 size_t ctdb_pid_len(pid_t pid
);
56 void ctdb_pid_push(pid_t pid
, uint8_t *buf
);
57 int ctdb_pid_pull(uint8_t *buf
, size_t buflen
, TALLOC_CTX
*mem_ctx
,
60 size_t ctdb_string_len(const char *str
);
61 void ctdb_string_push(const char *str
, uint8_t *buf
);
62 int ctdb_string_pull(uint8_t *buf
, size_t buflen
, TALLOC_CTX
*mem_ctx
,
65 size_t ctdb_stringn_len(const char *str
);
66 void ctdb_stringn_push(const char *str
, uint8_t *buf
);
67 int ctdb_stringn_pull(uint8_t *buf
, size_t buflen
, TALLOC_CTX
*mem_ctx
,
70 size_t ctdb_statistics_len(struct ctdb_statistics
*stats
);
71 void ctdb_statistics_push(struct ctdb_statistics
*stats
, uint8_t *buf
);
72 int ctdb_statistics_pull(uint8_t *buf
, size_t buflen
, TALLOC_CTX
*mem_ctx
,
73 struct ctdb_statistics
**out
);
75 size_t ctdb_statistics_list_len(struct ctdb_statistics_list
*stats_list
);
76 void ctdb_statistics_list_push(struct ctdb_statistics_list
*stats_list
,
78 int ctdb_statistics_list_pull(uint8_t *buf
, size_t buflen
, TALLOC_CTX
*mem_ctx
,
79 struct ctdb_statistics_list
**out
);
81 size_t ctdb_vnn_map_len(struct ctdb_vnn_map
*vnnmap
);
82 void ctdb_vnn_map_push(struct ctdb_vnn_map
*vnnmap
, uint8_t *buf
);
83 int ctdb_vnn_map_pull(uint8_t *buf
, size_t buflen
, TALLOC_CTX
*mem_ctx
,
84 struct ctdb_vnn_map
**out
);
86 size_t ctdb_dbid_map_len(struct ctdb_dbid_map
*dbmap
);
87 void ctdb_dbid_map_push(struct ctdb_dbid_map
*dbmap
, uint8_t *buf
);
88 int ctdb_dbid_map_pull(uint8_t *buf
, size_t buflen
, TALLOC_CTX
*mem_ctx
,
89 struct ctdb_dbid_map
**out
);
91 size_t ctdb_pulldb_len(struct ctdb_pulldb
*pulldb
);
92 void ctdb_pulldb_push(struct ctdb_pulldb
*pulldb
, uint8_t *buf
);
93 int ctdb_pulldb_pull(uint8_t *buf
, size_t buflen
, TALLOC_CTX
*mem_ctx
,
94 struct ctdb_pulldb
**out
);
96 size_t ctdb_pulldb_ext_len(struct ctdb_pulldb_ext
*pulldb
);
97 void ctdb_pulldb_ext_push(struct ctdb_pulldb_ext
*pulldb
, uint8_t *buf
);
98 int ctdb_pulldb_ext_pull(uint8_t *buf
, size_t buflen
, TALLOC_CTX
*mem_ctx
,
99 struct ctdb_pulldb_ext
**out
);
101 size_t ctdb_traverse_start_len(struct ctdb_traverse_start
*traverse
);
102 void ctdb_traverse_start_push(struct ctdb_traverse_start
*traverse
,
104 int ctdb_traverse_start_pull(uint8_t *buf
, size_t buflen
, TALLOC_CTX
*mem_ctx
,
105 struct ctdb_traverse_start
**out
);
107 size_t ctdb_traverse_all_len(struct ctdb_traverse_all
*traverse
);
108 void ctdb_traverse_all_push(struct ctdb_traverse_all
*traverse
, uint8_t *buf
);
109 int ctdb_traverse_all_pull(uint8_t *buf
, size_t buflen
, TALLOC_CTX
*mem_ctx
,
110 struct ctdb_traverse_all
**out
);
112 size_t ctdb_traverse_start_ext_len(struct ctdb_traverse_start_ext
*traverse
);
113 void ctdb_traverse_start_ext_push(struct ctdb_traverse_start_ext
*traverse
,
115 int ctdb_traverse_start_ext_pull(uint8_t *buf
, size_t buflen
,
117 struct ctdb_traverse_start_ext
**out
);
119 size_t ctdb_traverse_all_ext_len(struct ctdb_traverse_all_ext
*traverse
);
120 void ctdb_traverse_all_ext_push(struct ctdb_traverse_all_ext
*traverse
,
122 int ctdb_traverse_all_ext_pull(uint8_t *buf
, size_t buflen
,
124 struct ctdb_traverse_all_ext
**out
);
126 size_t ctdb_sock_addr_len(ctdb_sock_addr
*addr
);
127 void ctdb_sock_addr_push(ctdb_sock_addr
*addr
, uint8_t *buf
);
128 int ctdb_sock_addr_pull(uint8_t *buf
, size_t buflen
, TALLOC_CTX
*mem_ctx
,
129 ctdb_sock_addr
**out
);
131 size_t ctdb_connection_len(struct ctdb_connection
*conn
);
132 void ctdb_connection_push(struct ctdb_connection
*conn
, uint8_t *buf
);
133 int ctdb_connection_pull(uint8_t *buf
, size_t buflen
, TALLOC_CTX
*mem_ctx
,
134 struct ctdb_connection
**out
);
136 size_t ctdb_tunable_len(struct ctdb_tunable
*tunable
);
137 void ctdb_tunable_push(struct ctdb_tunable
*tunable
, uint8_t *buf
);
138 int ctdb_tunable_pull(uint8_t *buf
, size_t buflen
, TALLOC_CTX
*mem_ctx
,
139 struct ctdb_tunable
**out
);
141 size_t ctdb_node_flag_change_len(struct ctdb_node_flag_change
*flag_change
);
142 void ctdb_node_flag_change_push(struct ctdb_node_flag_change
*flag_change
,
144 int ctdb_node_flag_change_pull(uint8_t *buf
, size_t buflen
, TALLOC_CTX
*mem_ctx
,
145 struct ctdb_node_flag_change
**out
);
147 size_t ctdb_var_list_len(struct ctdb_var_list
*var_list
);
148 void ctdb_var_list_push(struct ctdb_var_list
*var_list
, uint8_t *buf
);
149 int ctdb_var_list_pull(uint8_t *buf
, size_t buflen
, TALLOC_CTX
*mem_ctx
,
150 struct ctdb_var_list
**out
);
152 size_t ctdb_tunable_list_len(struct ctdb_tunable_list
*tun_list
);
153 void ctdb_tunable_list_push(struct ctdb_tunable_list
*tun_list
, uint8_t *buf
);
154 int ctdb_tunable_list_pull(uint8_t *buf
, size_t buflen
, TALLOC_CTX
*mem_ctx
,
155 struct ctdb_tunable_list
**out
);
157 size_t ctdb_tickle_list_len(struct ctdb_tickle_list
*tickles
);
158 void ctdb_tickle_list_push(struct ctdb_tickle_list
*tickles
, uint8_t *buf
);
159 int ctdb_tickle_list_pull(uint8_t *buf
, size_t buflen
, TALLOC_CTX
*mem_ctx
,
160 struct ctdb_tickle_list
**out
);
162 size_t ctdb_addr_info_len(struct ctdb_addr_info
*addr_info
);
163 void ctdb_addr_info_push(struct ctdb_addr_info
*addr_info
, uint8_t *buf
);
164 int ctdb_addr_info_pull(uint8_t *buf
, size_t buflen
, TALLOC_CTX
*mem_ctx
,
165 struct ctdb_addr_info
**out
);
167 size_t ctdb_transdb_len(struct ctdb_transdb
*transdb
);
168 void ctdb_transdb_push(struct ctdb_transdb
*transdb
, uint8_t *buf
);
169 int ctdb_transdb_pull(uint8_t *buf
, size_t buflen
, TALLOC_CTX
*mem_ctx
,
170 struct ctdb_transdb
**out
);
172 size_t ctdb_uptime_len(struct ctdb_uptime
*uptime
);
173 void ctdb_uptime_push(struct ctdb_uptime
*uptime
, uint8_t *buf
);
174 int ctdb_uptime_pull(uint8_t *buf
, size_t buflen
, TALLOC_CTX
*mem_ctx
,
175 struct ctdb_uptime
**out
);
177 size_t ctdb_public_ip_len(struct ctdb_public_ip
*public_ip
);
178 void ctdb_public_ip_push(struct ctdb_public_ip
*public_ip
, uint8_t *buf
);
179 int ctdb_public_ip_pull(uint8_t *buf
, size_t buflen
, TALLOC_CTX
*mem_ctx
,
180 struct ctdb_public_ip
**out
);
182 size_t ctdb_public_ip_list_len(struct ctdb_public_ip_list
*pubip_list
);
183 void ctdb_public_ip_list_push(struct ctdb_public_ip_list
*pubip_list
,
185 int ctdb_public_ip_list_pull(uint8_t *buf
, size_t buflen
, TALLOC_CTX
*mem_ctx
,
186 struct ctdb_public_ip_list
**out
);
188 size_t ctdb_node_and_flags_len(struct ctdb_node_and_flags
*node
);
189 void ctdb_node_and_flags_push(struct ctdb_node_and_flags
*node
, uint8_t *buf
);
190 int ctdb_node_and_flags_pull(uint8_t *buf
, size_t buflen
, TALLOC_CTX
*mem_ctx
,
191 struct ctdb_node_and_flags
**out
);
193 size_t ctdb_node_map_len(struct ctdb_node_map
*nodemap
);
194 void ctdb_node_map_push(struct ctdb_node_map
*nodemap
, uint8_t *buf
);
195 int ctdb_node_map_pull(uint8_t *buf
, size_t buflen
, TALLOC_CTX
*mem_ctx
,
196 struct ctdb_node_map
**out
);
198 size_t ctdb_script_len(struct ctdb_script
*script
);
199 void ctdb_script_push(struct ctdb_script
*script
, uint8_t *buf
);
200 int ctdb_script_pull(uint8_t *buf
, size_t buflen
, TALLOC_CTX
*mem_ctx
,
201 struct ctdb_script
**out
);
203 size_t ctdb_script_list_len(struct ctdb_script_list
*script_list
);
204 void ctdb_script_list_push(struct ctdb_script_list
*script_list
, uint8_t *buf
);
205 int ctdb_script_list_pull(uint8_t *buf
, size_t buflen
, TALLOC_CTX
*mem_ctx
,
206 struct ctdb_script_list
**out
);
208 size_t ctdb_ban_state_len(struct ctdb_ban_state
*ban_state
);
209 void ctdb_ban_state_push(struct ctdb_ban_state
*ban_state
, uint8_t *buf
);
210 int ctdb_ban_state_pull(uint8_t *buf
, size_t buflen
, TALLOC_CTX
*mem_ctx
,
211 struct ctdb_ban_state
**out
);
213 size_t ctdb_notify_data_len(struct ctdb_notify_data
*notify
);
214 void ctdb_notify_data_push(struct ctdb_notify_data
*notify
, uint8_t *buf
);
215 int ctdb_notify_data_pull(uint8_t *buf
, size_t buflen
, TALLOC_CTX
*mem_ctx
,
216 struct ctdb_notify_data
**out
);
218 size_t ctdb_iface_len(struct ctdb_iface
*iface
);
219 void ctdb_iface_push(struct ctdb_iface
*iface
, uint8_t *buf
);
220 int ctdb_iface_pull(uint8_t *buf
, size_t buflen
, TALLOC_CTX
*mem_ctx
,
221 struct ctdb_iface
**out
);
223 size_t ctdb_iface_list_len(struct ctdb_iface_list
*iface_list
);
224 void ctdb_iface_list_push(struct ctdb_iface_list
*iface_list
, uint8_t *buf
);
225 int ctdb_iface_list_pull(uint8_t *buf
, size_t buflen
, TALLOC_CTX
*mem_ctx
,
226 struct ctdb_iface_list
**out
);
228 size_t ctdb_public_ip_info_len(struct ctdb_public_ip_info
*ipinfo
);
229 void ctdb_public_ip_info_push(struct ctdb_public_ip_info
*ipinfo
, uint8_t *buf
);
230 int ctdb_public_ip_info_pull(uint8_t *buf
, size_t buflen
, TALLOC_CTX
*mem_ctx
,
231 struct ctdb_public_ip_info
**out
);
233 size_t ctdb_key_data_len(struct ctdb_key_data
*key
);
234 void ctdb_key_data_push(struct ctdb_key_data
*key
, uint8_t *buf
);
235 int ctdb_key_data_pull(uint8_t *buf
, size_t buflen
, TALLOC_CTX
*mem_ctx
,
236 struct ctdb_key_data
**out
);
238 size_t ctdb_db_statistics_len(struct ctdb_db_statistics
*dbstats
);
239 void ctdb_db_statistics_push(struct ctdb_db_statistics
*dbstats
, void *buf
);
240 int ctdb_db_statistics_pull(uint8_t *buf
, size_t buflen
, TALLOC_CTX
*mem_ctx
,
241 struct ctdb_db_statistics
**out
);
243 size_t ctdb_election_message_len(struct ctdb_election_message
*election
);
244 void ctdb_election_message_push(struct ctdb_election_message
*election
,
246 int ctdb_election_message_pull(uint8_t *buf
, size_t buflen
, TALLOC_CTX
*mem_ctx
,
247 struct ctdb_election_message
**out
);
249 size_t ctdb_srvid_message_len(struct ctdb_srvid_message
*msg
);
250 void ctdb_srvid_message_push(struct ctdb_srvid_message
*msg
, uint8_t *buf
);
251 int ctdb_srvid_message_pull(uint8_t *buf
, size_t buflen
, TALLOC_CTX
*mem_ctx
,
252 struct ctdb_srvid_message
**out
);
254 size_t ctdb_tdb_data_len(TDB_DATA data
);
255 void ctdb_tdb_data_push(TDB_DATA data
, uint8_t *buf
);
256 int ctdb_tdb_data_pull(uint8_t *buf
, size_t buflen
, TALLOC_CTX
*mem_ctx
,
259 size_t ctdb_disable_message_len(struct ctdb_disable_message
*disable
);
260 void ctdb_disable_message_push(struct ctdb_disable_message
*disable
,
262 int ctdb_disable_message_pull(uint8_t *buf
, size_t buflen
, TALLOC_CTX
*mem_ctx
,
263 struct ctdb_disable_message
**out
);
265 #endif /* __PROTOCOL_PRIVATE_H__ */