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__
26 * From protocol/protocol_basic.c
29 size_t ctdb_uint8_len(uint8_t *in
);
30 void ctdb_uint8_push(uint8_t *in
, uint8_t *buf
, size_t *npush
);
31 int ctdb_uint8_pull(uint8_t *buf
, size_t buflen
, uint8_t *out
, size_t *npull
);
33 size_t ctdb_uint16_len(uint16_t *in
);
34 void ctdb_uint16_push(uint16_t *in
, uint8_t *buf
, size_t *npush
);
35 int ctdb_uint16_pull(uint8_t *buf
, size_t buflen
, uint16_t *out
,
38 size_t ctdb_int32_len(int32_t *in
);
39 void ctdb_int32_push(int32_t *in
, uint8_t *buf
, size_t *npush
);
40 int ctdb_int32_pull(uint8_t *buf
, size_t buflen
, int32_t *out
, size_t *npull
);
42 size_t ctdb_uint32_len(uint32_t *in
);
43 void ctdb_uint32_push(uint32_t *in
, uint8_t *buf
, size_t *npush
);
44 int ctdb_uint32_pull(uint8_t *buf
, size_t buflen
, uint32_t *out
,
47 size_t ctdb_uint64_len(uint64_t *in
);
48 void ctdb_uint64_push(uint64_t *in
, uint8_t *buf
, size_t *npush
);
49 int ctdb_uint64_pull(uint8_t *buf
, size_t buflen
, uint64_t *out
,
52 size_t ctdb_double_len(double *in
);
53 void ctdb_double_push(double *in
, uint8_t *buf
, size_t *npush
);
54 int ctdb_double_pull(uint8_t *buf
, size_t buflen
, double *out
, size_t *npull
);
56 size_t ctdb_bool_len(bool *in
);
57 void ctdb_bool_push(bool *in
, uint8_t *buf
, size_t *npush
);
58 int ctdb_bool_pull(uint8_t *buf
, size_t buflen
, bool *out
, size_t *npull
);
60 size_t ctdb_chararray_len(char *in
, size_t len
);
61 void ctdb_chararray_push(char *in
, size_t len
, uint8_t *buf
, size_t *npush
);
62 int ctdb_chararray_pull(uint8_t *buf
, size_t buflen
, char *out
, size_t len
,
65 size_t ctdb_string_len(const char **in
);
66 void ctdb_string_push(const char **in
, uint8_t *buf
, size_t *npush
);
67 int ctdb_string_pull(uint8_t *buf
, size_t buflen
, TALLOC_CTX
*mem_ctx
,
68 const char **out
, size_t *npull
);
70 size_t ctdb_stringn_len(const char **in
);
71 void ctdb_stringn_push(const char **in
, uint8_t *buf
, size_t *npush
);
72 int ctdb_stringn_pull(uint8_t *buf
, size_t buflen
, TALLOC_CTX
*mem_ctx
,
73 const char **out
, size_t *npull
);
75 size_t ctdb_pid_len(pid_t
*in
);
76 void ctdb_pid_push(pid_t
*in
, uint8_t *buf
, size_t *npush
);
77 int ctdb_pid_pull(uint8_t *buf
, size_t buflen
, pid_t
*out
, size_t *npull
);
79 size_t ctdb_timeval_len(struct timeval
*in
);
80 void ctdb_timeval_push(struct timeval
*in
, uint8_t *buf
, size_t *npush
);
81 int ctdb_timeval_pull(uint8_t *buf
, size_t buflen
, struct timeval
*out
,
84 size_t ctdb_padding_len(int count
);
85 void ctdb_padding_push(int count
, uint8_t *buf
, size_t *npush
);
86 int ctdb_padding_pull(uint8_t *buf
, size_t buflen
, int count
, size_t *npull
);
89 * From protocol/protocol_types.c
92 size_t ctdb_tdb_data_len(TDB_DATA
*in
);
93 void ctdb_tdb_data_push(TDB_DATA
*in
, uint8_t *buf
, size_t *npush
);
94 int ctdb_tdb_data_pull(uint8_t *buf
, size_t buflen
, TALLOC_CTX
*mem_ctx
,
95 TDB_DATA
*out
, size_t *npull
);
97 size_t ctdb_tdb_datan_len(TDB_DATA
*in
);
98 void ctdb_tdb_datan_push(TDB_DATA
*in
, uint8_t *buf
, size_t *npush
);
99 int ctdb_tdb_datan_pull(uint8_t *buf
, size_t buflen
, TALLOC_CTX
*mem_ctx
,
100 TDB_DATA
*out
, size_t *npull
);
102 size_t ctdb_latency_counter_len(struct ctdb_latency_counter
*in
);
103 void ctdb_latency_counter_push(struct ctdb_latency_counter
*in
, uint8_t *buf
,
105 int ctdb_latency_counter_pull(uint8_t *buf
, size_t buflen
,
106 struct ctdb_latency_counter
*out
, size_t *npull
);
108 size_t ctdb_statistics_len(struct ctdb_statistics
*in
);
109 void ctdb_statistics_push(struct ctdb_statistics
*in
, uint8_t *buf
,
111 int ctdb_statistics_pull(uint8_t *buf
, size_t buflen
, TALLOC_CTX
*mem_ctx
,
112 struct ctdb_statistics
**out
, size_t *npull
);
114 size_t ctdb_statistics_list_len(struct ctdb_statistics_list
*in
);
115 void ctdb_statistics_list_push(struct ctdb_statistics_list
*in
,
116 uint8_t *buf
, size_t *npull
);
117 int ctdb_statistics_list_pull(uint8_t *buf
, size_t buflen
, TALLOC_CTX
*mem_ctx
,
118 struct ctdb_statistics_list
**out
,
121 size_t ctdb_vnn_map_len(struct ctdb_vnn_map
*in
);
122 void ctdb_vnn_map_push(struct ctdb_vnn_map
*in
, uint8_t *buf
, size_t *npush
);
123 int ctdb_vnn_map_pull(uint8_t *buf
, size_t buflen
, TALLOC_CTX
*mem_ctx
,
124 struct ctdb_vnn_map
**out
, size_t *npull
);
126 size_t ctdb_dbid_len(struct ctdb_dbid
*in
);
127 void ctdb_dbid_push(struct ctdb_dbid
*in
, uint8_t *buf
, size_t *npush
);
128 int ctdb_dbid_pull(uint8_t *buf
, size_t buflen
, TALLOC_CTX
*mem_ctx
,
129 struct ctdb_dbid
**out
, size_t *npull
);
131 size_t ctdb_dbid_map_len(struct ctdb_dbid_map
*in
);
132 void ctdb_dbid_map_push(struct ctdb_dbid_map
*in
, uint8_t *buf
,
134 int ctdb_dbid_map_pull(uint8_t *buf
, size_t buflen
, TALLOC_CTX
*mem_ctx
,
135 struct ctdb_dbid_map
**out
, size_t *npull
);
137 size_t ctdb_pulldb_len(struct ctdb_pulldb
*in
);
138 void ctdb_pulldb_push(struct ctdb_pulldb
*in
, uint8_t *buf
, size_t *npush
);
139 int ctdb_pulldb_pull(uint8_t *buf
, size_t buflen
, TALLOC_CTX
*mem_ctx
,
140 struct ctdb_pulldb
**out
, size_t *npull
);
142 size_t ctdb_pulldb_ext_len(struct ctdb_pulldb_ext
*in
);
143 void ctdb_pulldb_ext_push(struct ctdb_pulldb_ext
*in
, uint8_t *buf
,
145 int ctdb_pulldb_ext_pull(uint8_t *buf
, size_t buflen
, TALLOC_CTX
*mem_ctx
,
146 struct ctdb_pulldb_ext
**out
, size_t *npull
);
148 size_t ctdb_traverse_start_len(struct ctdb_traverse_start
*in
);
149 void ctdb_traverse_start_push(struct ctdb_traverse_start
*in
, uint8_t *buf
,
151 int ctdb_traverse_start_pull(uint8_t *buf
, size_t buflen
, TALLOC_CTX
*mem_ctx
,
152 struct ctdb_traverse_start
**out
, size_t *npull
);
154 size_t ctdb_traverse_all_len(struct ctdb_traverse_all
*in
);
155 void ctdb_traverse_all_push(struct ctdb_traverse_all
*in
, uint8_t *buf
,
157 int ctdb_traverse_all_pull(uint8_t *buf
, size_t buflen
, TALLOC_CTX
*mem_ctx
,
158 struct ctdb_traverse_all
**out
, size_t *npull
);
160 size_t ctdb_traverse_start_ext_len(struct ctdb_traverse_start_ext
*in
);
161 void ctdb_traverse_start_ext_push(struct ctdb_traverse_start_ext
*in
,
162 uint8_t *buf
, size_t *npush
);
163 int ctdb_traverse_start_ext_pull(uint8_t *buf
, size_t buflen
,
165 struct ctdb_traverse_start_ext
**out
,
168 size_t ctdb_traverse_all_ext_len(struct ctdb_traverse_all_ext
*in
);
169 void ctdb_traverse_all_ext_push(struct ctdb_traverse_all_ext
*in
,
170 uint8_t *buf
, size_t *npush
);
171 int ctdb_traverse_all_ext_pull(uint8_t *buf
, size_t buflen
,
173 struct ctdb_traverse_all_ext
**out
,
176 size_t ctdb_sock_addr_len(ctdb_sock_addr
*in
);
177 void ctdb_sock_addr_push(ctdb_sock_addr
*in
, uint8_t *buf
, size_t *npush
);
178 int ctdb_sock_addr_pull_elems(uint8_t *buf
, size_t buflen
,
179 TALLOC_CTX
*mem_ctx
, ctdb_sock_addr
*out
,
181 int ctdb_sock_addr_pull(uint8_t *buf
, size_t buflen
, TALLOC_CTX
*mem_ctx
,
182 ctdb_sock_addr
**out
, size_t *npull
);
184 size_t ctdb_connection_len(struct ctdb_connection
*in
);
185 void ctdb_connection_push(struct ctdb_connection
*in
, uint8_t *buf
,
187 int ctdb_connection_pull(uint8_t *buf
, size_t buflen
, TALLOC_CTX
*mem_ctx
,
188 struct ctdb_connection
**out
, size_t *npull
);
190 size_t ctdb_connection_list_len(struct ctdb_connection_list
*in
);
191 void ctdb_connection_list_push(struct ctdb_connection_list
*in
, uint8_t *buf
,
193 int ctdb_connection_list_pull(uint8_t *buf
, size_t buflen
, TALLOC_CTX
*mem_ctx
,
194 struct ctdb_connection_list
**out
, size_t *npull
);
196 size_t ctdb_tunable_len(struct ctdb_tunable
*in
);
197 void ctdb_tunable_push(struct ctdb_tunable
*in
, uint8_t *buf
, size_t *npush
);
198 int ctdb_tunable_pull(uint8_t *buf
, size_t buflen
, TALLOC_CTX
*mem_ctx
,
199 struct ctdb_tunable
**out
, size_t *npull
);
201 size_t ctdb_node_flag_change_len(struct ctdb_node_flag_change
*in
);
202 void ctdb_node_flag_change_push(struct ctdb_node_flag_change
*in
,
203 uint8_t *buf
, size_t *npush
);
204 int ctdb_node_flag_change_pull(uint8_t *buf
, size_t buflen
, TALLOC_CTX
*mem_ctx
,
205 struct ctdb_node_flag_change
**out
,
208 size_t ctdb_var_list_len(struct ctdb_var_list
*in
);
209 void ctdb_var_list_push(struct ctdb_var_list
*in
, uint8_t *buf
, size_t *npush
);
210 int ctdb_var_list_pull(uint8_t *buf
, size_t buflen
, TALLOC_CTX
*mem_ctx
,
211 struct ctdb_var_list
**out
, size_t *npull
);
213 size_t ctdb_tunable_list_len(struct ctdb_tunable_list
*in
);
214 void ctdb_tunable_list_push(struct ctdb_tunable_list
*in
, uint8_t *buf
,
216 int ctdb_tunable_list_pull(uint8_t *buf
, size_t buflen
, TALLOC_CTX
*mem_ctx
,
217 struct ctdb_tunable_list
**out
, size_t *npull
);
219 size_t ctdb_tickle_list_len(struct ctdb_tickle_list
*in
);
220 void ctdb_tickle_list_push(struct ctdb_tickle_list
*in
, uint8_t *buf
,
222 int ctdb_tickle_list_pull(uint8_t *buf
, size_t buflen
, TALLOC_CTX
*mem_ctx
,
223 struct ctdb_tickle_list
**out
, size_t *npull
);
225 size_t ctdb_addr_info_len(struct ctdb_addr_info
*in
);
226 void ctdb_addr_info_push(struct ctdb_addr_info
*in
, uint8_t *buf
,
228 int ctdb_addr_info_pull(uint8_t *buf
, size_t buflen
, TALLOC_CTX
*mem_ctx
,
229 struct ctdb_addr_info
**out
, size_t *npull
);
231 size_t ctdb_transdb_len(struct ctdb_transdb
*in
);
232 void ctdb_transdb_push(struct ctdb_transdb
*in
, uint8_t *buf
, size_t *npush
);
233 int ctdb_transdb_pull(uint8_t *buf
, size_t buflen
, TALLOC_CTX
*mem_ctx
,
234 struct ctdb_transdb
**out
, size_t *npull
);
236 size_t ctdb_uptime_len(struct ctdb_uptime
*in
);
237 void ctdb_uptime_push(struct ctdb_uptime
*in
, uint8_t *buf
, size_t *npush
);
238 int ctdb_uptime_pull(uint8_t *buf
, size_t buflen
, TALLOC_CTX
*mem_ctx
,
239 struct ctdb_uptime
**out
, size_t *npull
);
241 size_t ctdb_public_ip_len(struct ctdb_public_ip
*in
);
242 void ctdb_public_ip_push(struct ctdb_public_ip
*in
, uint8_t *buf
,
244 int ctdb_public_ip_pull(uint8_t *buf
, size_t buflen
, TALLOC_CTX
*mem_ctx
,
245 struct ctdb_public_ip
**out
, size_t *npull
);
247 size_t ctdb_public_ip_list_len(struct ctdb_public_ip_list
*in
);
248 void ctdb_public_ip_list_push(struct ctdb_public_ip_list
*in
, uint8_t *buf
,
250 int ctdb_public_ip_list_pull(uint8_t *buf
, size_t buflen
, TALLOC_CTX
*mem_ctx
,
251 struct ctdb_public_ip_list
**out
, size_t *npull
);
253 size_t ctdb_node_and_flags_len(struct ctdb_node_and_flags
*in
);
254 void ctdb_node_and_flags_push(struct ctdb_node_and_flags
*in
, uint8_t *buf
,
256 int ctdb_node_and_flags_pull(uint8_t *buf
, size_t buflen
, TALLOC_CTX
*mem_ctx
,
257 struct ctdb_node_and_flags
**out
, size_t *npull
);
259 size_t ctdb_node_map_len(struct ctdb_node_map
*in
);
260 void ctdb_node_map_push(struct ctdb_node_map
*in
, uint8_t *buf
, size_t *npush
);
261 int ctdb_node_map_pull(uint8_t *buf
, size_t buflen
, TALLOC_CTX
*mem_ctx
,
262 struct ctdb_node_map
**out
, size_t *npull
);
264 size_t ctdb_script_len(struct ctdb_script
*in
);
265 void ctdb_script_push(struct ctdb_script
*in
, uint8_t *buf
, size_t *npush
);
266 int ctdb_script_pull(uint8_t *buf
, size_t buflen
, TALLOC_CTX
*mem_ctx
,
267 struct ctdb_script
**out
, size_t *npull
);
269 size_t ctdb_script_list_len(struct ctdb_script_list
*in
);
270 void ctdb_script_list_push(struct ctdb_script_list
*in
, uint8_t *buf
,
272 int ctdb_script_list_pull(uint8_t *buf
, size_t buflen
, TALLOC_CTX
*mem_ctx
,
273 struct ctdb_script_list
**out
, size_t *npull
);
275 size_t ctdb_ban_state_len(struct ctdb_ban_state
*in
);
276 void ctdb_ban_state_push(struct ctdb_ban_state
*in
, uint8_t *buf
,
278 int ctdb_ban_state_pull(uint8_t *buf
, size_t buflen
, TALLOC_CTX
*mem_ctx
,
279 struct ctdb_ban_state
**out
, size_t *npull
);
281 size_t ctdb_notify_data_len(struct ctdb_notify_data
*in
);
282 void ctdb_notify_data_push(struct ctdb_notify_data
*in
, uint8_t *buf
,
284 int ctdb_notify_data_pull(uint8_t *buf
, size_t buflen
, TALLOC_CTX
*mem_ctx
,
285 struct ctdb_notify_data
**out
, size_t *npull
);
287 size_t ctdb_iface_len(struct ctdb_iface
*in
);
288 void ctdb_iface_push(struct ctdb_iface
*in
, uint8_t *buf
, size_t *npush
);
289 int ctdb_iface_pull(uint8_t *buf
, size_t buflen
, TALLOC_CTX
*mem_ctx
,
290 struct ctdb_iface
**out
, size_t *npull
);
292 size_t ctdb_iface_list_len(struct ctdb_iface_list
*in
);
293 void ctdb_iface_list_push(struct ctdb_iface_list
*in
, uint8_t *buf
,
295 int ctdb_iface_list_pull(uint8_t *buf
, size_t buflen
, TALLOC_CTX
*mem_ctx
,
296 struct ctdb_iface_list
**out
, size_t *npull
);
298 size_t ctdb_public_ip_info_len(struct ctdb_public_ip_info
*in
);
299 void ctdb_public_ip_info_push(struct ctdb_public_ip_info
*in
, uint8_t *buf
,
301 int ctdb_public_ip_info_pull(uint8_t *buf
, size_t buflen
, TALLOC_CTX
*mem_ctx
,
302 struct ctdb_public_ip_info
**out
, size_t *npull
);
304 size_t ctdb_key_data_len(struct ctdb_key_data
*in
);
305 void ctdb_key_data_push(struct ctdb_key_data
*in
, uint8_t *buf
, size_t *npush
);
306 int ctdb_key_data_pull(uint8_t *buf
, size_t buflen
, TALLOC_CTX
*mem_ctx
,
307 struct ctdb_key_data
**out
, size_t *npull
);
309 size_t ctdb_db_statistics_len(struct ctdb_db_statistics
*in
);
310 void ctdb_db_statistics_push(struct ctdb_db_statistics
*in
, uint8_t *buf
,
312 int ctdb_db_statistics_pull(uint8_t *buf
, size_t buflen
, TALLOC_CTX
*mem_ctx
,
313 struct ctdb_db_statistics
**out
, size_t *npull
);
315 size_t ctdb_pid_srvid_len(struct ctdb_pid_srvid
*in
);
316 void ctdb_pid_srvid_push(struct ctdb_pid_srvid
*in
, uint8_t *buf
,
318 int ctdb_pid_srvid_pull(uint8_t *buf
, size_t buflen
, TALLOC_CTX
*mem_ctx
,
319 struct ctdb_pid_srvid
**out
, size_t *npull
);
321 size_t ctdb_election_message_len(struct ctdb_election_message
*in
);
322 void ctdb_election_message_push(struct ctdb_election_message
*in
,
323 uint8_t *buf
, size_t *npush
);
324 int ctdb_election_message_pull(uint8_t *buf
, size_t buflen
,
326 struct ctdb_election_message
**out
,
329 size_t ctdb_srvid_message_len(struct ctdb_srvid_message
*in
);
330 void ctdb_srvid_message_push(struct ctdb_srvid_message
*in
, uint8_t *buf
,
332 int ctdb_srvid_message_pull(uint8_t *buf
, size_t buflen
, TALLOC_CTX
*mem_ctx
,
333 struct ctdb_srvid_message
**out
, size_t *npull
);
335 size_t ctdb_disable_message_len(struct ctdb_disable_message
*in
);
336 void ctdb_disable_message_push(struct ctdb_disable_message
*in
, uint8_t *buf
,
338 int ctdb_disable_message_pull(uint8_t *buf
, size_t buflen
, TALLOC_CTX
*mem_ctx
,
339 struct ctdb_disable_message
**out
,
342 #endif /* __PROTOCOL_PRIVATE_H__ */