1 | /*
|
---|
2 | CTDB protocol marshalling
|
---|
3 |
|
---|
4 | Copyright (C) Amitay Isaacs 2015
|
---|
5 |
|
---|
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.
|
---|
10 |
|
---|
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.
|
---|
15 |
|
---|
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/>.
|
---|
18 | */
|
---|
19 |
|
---|
20 | #ifndef __PROTOCOL_PRIVATE_H__
|
---|
21 | #define __PROTOCOL_PRIVATE_H__
|
---|
22 |
|
---|
23 | #include "protocol.h"
|
---|
24 |
|
---|
25 | int allocate_pkt(TALLOC_CTX *mem_ctx, size_t length,
|
---|
26 | uint8_t **buf, size_t *buflen);
|
---|
27 |
|
---|
28 | size_t ctdb_uint32_len(uint32_t val);
|
---|
29 | void ctdb_uint32_push(uint32_t val, uint8_t *buf);
|
---|
30 | int ctdb_uint32_pull(uint8_t *buf, size_t buflen, TALLOC_CTX *mem_ctx,
|
---|
31 | uint32_t *out);
|
---|
32 |
|
---|
33 | size_t ctdb_uint64_len(uint64_t val);
|
---|
34 | void ctdb_uint64_push(uint64_t val, uint8_t *buf);
|
---|
35 | int ctdb_uint64_pull(uint8_t *buf, size_t buflen, TALLOC_CTX *mem_ctx,
|
---|
36 | uint64_t *out);
|
---|
37 |
|
---|
38 | size_t ctdb_double_len(double val);
|
---|
39 | void ctdb_double_push(double val, uint8_t *buf);
|
---|
40 | int ctdb_double_pull(uint8_t *buf, size_t buflen, TALLOC_CTX *mem_ctx,
|
---|
41 | double *out);
|
---|
42 |
|
---|
43 | size_t ctdb_uint8_array_len(struct ctdb_uint8_array *array);
|
---|
44 | void ctdb_uint8_array_push(struct ctdb_uint8_array *array, uint8_t *buf);
|
---|
45 | int ctdb_uint8_array_pull(uint8_t *buf, size_t buflen, TALLOC_CTX *mem_ctx,
|
---|
46 | struct ctdb_uint8_array **out);
|
---|
47 |
|
---|
48 | size_t ctdb_uint64_array_len(struct ctdb_uint64_array *array);
|
---|
49 | void ctdb_uint64_array_push(struct ctdb_uint64_array *array, uint8_t *buf);
|
---|
50 | int ctdb_uint64_array_pull(uint8_t *buf, size_t buflen, TALLOC_CTX *mem_ctx,
|
---|
51 | struct ctdb_uint64_array **out);
|
---|
52 |
|
---|
53 | size_t ctdb_pid_len(pid_t pid);
|
---|
54 | void ctdb_pid_push(pid_t pid, uint8_t *buf);
|
---|
55 | int ctdb_pid_pull(uint8_t *buf, size_t buflen, TALLOC_CTX *mem_ctx,
|
---|
56 | pid_t *out);
|
---|
57 |
|
---|
58 | size_t ctdb_string_len(const char *str);
|
---|
59 | void ctdb_string_push(const char *str, uint8_t *buf);
|
---|
60 | int ctdb_string_pull(uint8_t *buf, size_t buflen, TALLOC_CTX *mem_ctx,
|
---|
61 | const char **out);
|
---|
62 |
|
---|
63 | size_t ctdb_stringn_len(const char *str);
|
---|
64 | void ctdb_stringn_push(const char *str, uint8_t *buf);
|
---|
65 | int ctdb_stringn_pull(uint8_t *buf, size_t buflen, TALLOC_CTX *mem_ctx,
|
---|
66 | const char **out);
|
---|
67 |
|
---|
68 | size_t ctdb_statistics_len(struct ctdb_statistics *stats);
|
---|
69 | void ctdb_statistics_push(struct ctdb_statistics *stats, uint8_t *buf);
|
---|
70 | int ctdb_statistics_pull(uint8_t *buf, size_t buflen, TALLOC_CTX *mem_ctx,
|
---|
71 | struct ctdb_statistics **out);
|
---|
72 |
|
---|
73 | size_t ctdb_statistics_list_len(struct ctdb_statistics_list *stats_list);
|
---|
74 | void ctdb_statistics_list_push(struct ctdb_statistics_list *stats_list,
|
---|
75 | uint8_t *buf);
|
---|
76 | int ctdb_statistics_list_pull(uint8_t *buf, size_t buflen, TALLOC_CTX *mem_ctx,
|
---|
77 | struct ctdb_statistics_list **out);
|
---|
78 |
|
---|
79 | size_t ctdb_vnn_map_len(struct ctdb_vnn_map *vnnmap);
|
---|
80 | void ctdb_vnn_map_push(struct ctdb_vnn_map *vnnmap, uint8_t *buf);
|
---|
81 | int ctdb_vnn_map_pull(uint8_t *buf, size_t buflen, TALLOC_CTX *mem_ctx,
|
---|
82 | struct ctdb_vnn_map **out);
|
---|
83 |
|
---|
84 | size_t ctdb_dbid_map_len(struct ctdb_dbid_map *dbmap);
|
---|
85 | void ctdb_dbid_map_push(struct ctdb_dbid_map *dbmap, uint8_t *buf);
|
---|
86 | int ctdb_dbid_map_pull(uint8_t *buf, size_t buflen, TALLOC_CTX *mem_ctx,
|
---|
87 | struct ctdb_dbid_map **out);
|
---|
88 |
|
---|
89 | size_t ctdb_pulldb_len(struct ctdb_pulldb *pulldb);
|
---|
90 | void ctdb_pulldb_push(struct ctdb_pulldb *pulldb, uint8_t *buf);
|
---|
91 | int ctdb_pulldb_pull(uint8_t *buf, size_t buflen, TALLOC_CTX *mem_ctx,
|
---|
92 | struct ctdb_pulldb **out);
|
---|
93 |
|
---|
94 | size_t ctdb_pulldb_ext_len(struct ctdb_pulldb_ext *pulldb);
|
---|
95 | void ctdb_pulldb_ext_push(struct ctdb_pulldb_ext *pulldb, uint8_t *buf);
|
---|
96 | int ctdb_pulldb_ext_pull(uint8_t *buf, size_t buflen, TALLOC_CTX *mem_ctx,
|
---|
97 | struct ctdb_pulldb_ext **out);
|
---|
98 |
|
---|
99 | size_t ctdb_traverse_start_len(struct ctdb_traverse_start *traverse);
|
---|
100 | void ctdb_traverse_start_push(struct ctdb_traverse_start *traverse,
|
---|
101 | uint8_t *buf);
|
---|
102 | int ctdb_traverse_start_pull(uint8_t *buf, size_t buflen, TALLOC_CTX *mem_ctx,
|
---|
103 | struct ctdb_traverse_start **out);
|
---|
104 |
|
---|
105 | size_t ctdb_traverse_all_len(struct ctdb_traverse_all *traverse);
|
---|
106 | void ctdb_traverse_all_push(struct ctdb_traverse_all *traverse, uint8_t *buf);
|
---|
107 | int ctdb_traverse_all_pull(uint8_t *buf, size_t buflen, TALLOC_CTX *mem_ctx,
|
---|
108 | struct ctdb_traverse_all **out);
|
---|
109 |
|
---|
110 | size_t ctdb_traverse_start_ext_len(struct ctdb_traverse_start_ext *traverse);
|
---|
111 | void ctdb_traverse_start_ext_push(struct ctdb_traverse_start_ext *traverse,
|
---|
112 | uint8_t *buf);
|
---|
113 | int ctdb_traverse_start_ext_pull(uint8_t *buf, size_t buflen,
|
---|
114 | TALLOC_CTX *mem_ctx,
|
---|
115 | struct ctdb_traverse_start_ext **out);
|
---|
116 |
|
---|
117 | size_t ctdb_traverse_all_ext_len(struct ctdb_traverse_all_ext *traverse);
|
---|
118 | void ctdb_traverse_all_ext_push(struct ctdb_traverse_all_ext *traverse,
|
---|
119 | uint8_t *buf);
|
---|
120 | int ctdb_traverse_all_ext_pull(uint8_t *buf, size_t buflen,
|
---|
121 | TALLOC_CTX *mem_ctx,
|
---|
122 | struct ctdb_traverse_all_ext **out);
|
---|
123 |
|
---|
124 | size_t ctdb_sock_addr_len(ctdb_sock_addr *addr);
|
---|
125 | void ctdb_sock_addr_push(ctdb_sock_addr *addr, uint8_t *buf);
|
---|
126 | int ctdb_sock_addr_pull(uint8_t *buf, size_t buflen, TALLOC_CTX *mem_ctx,
|
---|
127 | ctdb_sock_addr **out);
|
---|
128 |
|
---|
129 | size_t ctdb_connection_len(struct ctdb_connection *conn);
|
---|
130 | void ctdb_connection_push(struct ctdb_connection *conn, uint8_t *buf);
|
---|
131 | int ctdb_connection_pull(uint8_t *buf, size_t buflen, TALLOC_CTX *mem_ctx,
|
---|
132 | struct ctdb_connection **out);
|
---|
133 |
|
---|
134 | size_t ctdb_tunable_len(struct ctdb_tunable *tunable);
|
---|
135 | void ctdb_tunable_push(struct ctdb_tunable *tunable, uint8_t *buf);
|
---|
136 | int ctdb_tunable_pull(uint8_t *buf, size_t buflen, TALLOC_CTX *mem_ctx,
|
---|
137 | struct ctdb_tunable **out);
|
---|
138 |
|
---|
139 | size_t ctdb_node_flag_change_len(struct ctdb_node_flag_change *flag_change);
|
---|
140 | void ctdb_node_flag_change_push(struct ctdb_node_flag_change *flag_change,
|
---|
141 | uint8_t *buf);
|
---|
142 | int ctdb_node_flag_change_pull(uint8_t *buf, size_t buflen, TALLOC_CTX *mem_ctx,
|
---|
143 | struct ctdb_node_flag_change **out);
|
---|
144 |
|
---|
145 | size_t ctdb_var_list_len(struct ctdb_var_list *var_list);
|
---|
146 | void ctdb_var_list_push(struct ctdb_var_list *var_list, uint8_t *buf);
|
---|
147 | int ctdb_var_list_pull(uint8_t *buf, size_t buflen, TALLOC_CTX *mem_ctx,
|
---|
148 | struct ctdb_var_list **out);
|
---|
149 |
|
---|
150 | size_t ctdb_tunable_list_len(struct ctdb_tunable_list *tun_list);
|
---|
151 | void ctdb_tunable_list_push(struct ctdb_tunable_list *tun_list, uint8_t *buf);
|
---|
152 | int ctdb_tunable_list_pull(uint8_t *buf, size_t buflen, TALLOC_CTX *mem_ctx,
|
---|
153 | struct ctdb_tunable_list **out);
|
---|
154 |
|
---|
155 | size_t ctdb_tickle_list_len(struct ctdb_tickle_list *tickles);
|
---|
156 | void ctdb_tickle_list_push(struct ctdb_tickle_list *tickles, uint8_t *buf);
|
---|
157 | int ctdb_tickle_list_pull(uint8_t *buf, size_t buflen, TALLOC_CTX *mem_ctx,
|
---|
158 | struct ctdb_tickle_list **out);
|
---|
159 |
|
---|
160 | size_t ctdb_client_id_len(struct ctdb_client_id *cid);
|
---|
161 | void ctdb_client_id_push(struct ctdb_client_id *cid, uint8_t *buf);
|
---|
162 | int ctdb_client_id_pull(uint8_t *buf, size_t buflen, TALLOC_CTX *mem_ctx,
|
---|
163 | struct ctdb_client_id **out);
|
---|
164 |
|
---|
165 | size_t ctdb_client_id_list_len(struct ctdb_client_id_list *cid_list);
|
---|
166 | void ctdb_client_id_list_push(struct ctdb_client_id_list *cid_list,
|
---|
167 | uint8_t *buf);
|
---|
168 | int ctdb_client_id_list_pull(uint8_t *buf, size_t buflen, TALLOC_CTX *mem_ctx,
|
---|
169 | struct ctdb_client_id_list **out);
|
---|
170 |
|
---|
171 | size_t ctdb_client_id_map_len(struct ctdb_client_id_map *cid_map);
|
---|
172 | void ctdb_client_id_map_push(struct ctdb_client_id_map *cid_map, uint8_t *buf);
|
---|
173 | int ctdb_client_id_map_pull(uint8_t *buf, size_t buflen, TALLOC_CTX *mem_ctx,
|
---|
174 | struct ctdb_client_id_map **out);
|
---|
175 |
|
---|
176 | size_t ctdb_addr_info_len(struct ctdb_addr_info *addr_info);
|
---|
177 | void ctdb_addr_info_push(struct ctdb_addr_info *addr_info, uint8_t *buf);
|
---|
178 | int ctdb_addr_info_pull(uint8_t *buf, size_t buflen, TALLOC_CTX *mem_ctx,
|
---|
179 | struct ctdb_addr_info **out);
|
---|
180 |
|
---|
181 | size_t ctdb_transdb_len(struct ctdb_transdb *transdb);
|
---|
182 | void ctdb_transdb_push(struct ctdb_transdb *transdb, uint8_t *buf);
|
---|
183 | int ctdb_transdb_pull(uint8_t *buf, size_t buflen, TALLOC_CTX *mem_ctx,
|
---|
184 | struct ctdb_transdb **out);
|
---|
185 |
|
---|
186 | size_t ctdb_uptime_len(struct ctdb_uptime *uptime);
|
---|
187 | void ctdb_uptime_push(struct ctdb_uptime *uptime, uint8_t *buf);
|
---|
188 | int ctdb_uptime_pull(uint8_t *buf, size_t buflen, TALLOC_CTX *mem_ctx,
|
---|
189 | struct ctdb_uptime **out);
|
---|
190 |
|
---|
191 | size_t ctdb_public_ip_len(struct ctdb_public_ip *public_ip);
|
---|
192 | void ctdb_public_ip_push(struct ctdb_public_ip *public_ip, uint8_t *buf);
|
---|
193 | int ctdb_public_ip_pull(uint8_t *buf, size_t buflen, TALLOC_CTX *mem_ctx,
|
---|
194 | struct ctdb_public_ip **out);
|
---|
195 |
|
---|
196 | size_t ctdb_public_ip_list_len(struct ctdb_public_ip_list *pubip_list);
|
---|
197 | void ctdb_public_ip_list_push(struct ctdb_public_ip_list *pubip_list,
|
---|
198 | uint8_t *buf);
|
---|
199 | int ctdb_public_ip_list_pull(uint8_t *buf, size_t buflen, TALLOC_CTX *mem_ctx,
|
---|
200 | struct ctdb_public_ip_list **out);
|
---|
201 |
|
---|
202 | size_t ctdb_node_and_flags_len(struct ctdb_node_and_flags *node);
|
---|
203 | void ctdb_node_and_flags_push(struct ctdb_node_and_flags *node, uint8_t *buf);
|
---|
204 | int ctdb_node_and_flags_pull(uint8_t *buf, size_t buflen, TALLOC_CTX *mem_ctx,
|
---|
205 | struct ctdb_node_and_flags **out);
|
---|
206 |
|
---|
207 | size_t ctdb_node_map_len(struct ctdb_node_map *nodemap);
|
---|
208 | void ctdb_node_map_push(struct ctdb_node_map *nodemap, uint8_t *buf);
|
---|
209 | int ctdb_node_map_pull(uint8_t *buf, size_t buflen, TALLOC_CTX *mem_ctx,
|
---|
210 | struct ctdb_node_map **out);
|
---|
211 |
|
---|
212 | size_t ctdb_script_len(struct ctdb_script *script);
|
---|
213 | void ctdb_script_push(struct ctdb_script *script, uint8_t *buf);
|
---|
214 | int ctdb_script_pull(uint8_t *buf, size_t buflen, TALLOC_CTX *mem_ctx,
|
---|
215 | struct ctdb_script **out);
|
---|
216 |
|
---|
217 | size_t ctdb_script_list_len(struct ctdb_script_list *script_list);
|
---|
218 | void ctdb_script_list_push(struct ctdb_script_list *script_list, uint8_t *buf);
|
---|
219 | int ctdb_script_list_pull(uint8_t *buf, size_t buflen, TALLOC_CTX *mem_ctx,
|
---|
220 | struct ctdb_script_list **out);
|
---|
221 |
|
---|
222 | size_t ctdb_ban_state_len(struct ctdb_ban_state *ban_state);
|
---|
223 | void ctdb_ban_state_push(struct ctdb_ban_state *ban_state, uint8_t *buf);
|
---|
224 | int ctdb_ban_state_pull(uint8_t *buf, size_t buflen, TALLOC_CTX *mem_ctx,
|
---|
225 | struct ctdb_ban_state **out);
|
---|
226 |
|
---|
227 | size_t ctdb_db_priority_len(struct ctdb_db_priority *db_prio);
|
---|
228 | void ctdb_db_priority_push(struct ctdb_db_priority *db_prio, uint8_t *buf);
|
---|
229 | int ctdb_db_priority_pull(uint8_t *buf, size_t buflen, TALLOC_CTX *mem_ctx,
|
---|
230 | struct ctdb_db_priority **out);
|
---|
231 |
|
---|
232 | size_t ctdb_notify_data_len(struct ctdb_notify_data *notify);
|
---|
233 | void ctdb_notify_data_push(struct ctdb_notify_data *notify, uint8_t *buf);
|
---|
234 | int ctdb_notify_data_pull(uint8_t *buf, size_t buflen, TALLOC_CTX *mem_ctx,
|
---|
235 | struct ctdb_notify_data **out);
|
---|
236 |
|
---|
237 | size_t ctdb_iface_len(struct ctdb_iface *iface);
|
---|
238 | void ctdb_iface_push(struct ctdb_iface *iface, uint8_t *buf);
|
---|
239 | int ctdb_iface_pull(uint8_t *buf, size_t buflen, TALLOC_CTX *mem_ctx,
|
---|
240 | struct ctdb_iface **out);
|
---|
241 |
|
---|
242 | size_t ctdb_iface_list_len(struct ctdb_iface_list *iface_list);
|
---|
243 | void ctdb_iface_list_push(struct ctdb_iface_list *iface_list, uint8_t *buf);
|
---|
244 | int ctdb_iface_list_pull(uint8_t *buf, size_t buflen, TALLOC_CTX *mem_ctx,
|
---|
245 | struct ctdb_iface_list **out);
|
---|
246 |
|
---|
247 | size_t ctdb_public_ip_info_len(struct ctdb_public_ip_info *ipinfo);
|
---|
248 | void ctdb_public_ip_info_push(struct ctdb_public_ip_info *ipinfo, uint8_t *buf);
|
---|
249 | int ctdb_public_ip_info_pull(uint8_t *buf, size_t buflen, TALLOC_CTX *mem_ctx,
|
---|
250 | struct ctdb_public_ip_info **out);
|
---|
251 |
|
---|
252 | size_t ctdb_key_data_len(struct ctdb_key_data *key);
|
---|
253 | void ctdb_key_data_push(struct ctdb_key_data *key, uint8_t *buf);
|
---|
254 | int ctdb_key_data_pull(uint8_t *buf, size_t buflen, TALLOC_CTX *mem_ctx,
|
---|
255 | struct ctdb_key_data **out);
|
---|
256 |
|
---|
257 | size_t ctdb_db_statistics_len(struct ctdb_db_statistics *dbstats);
|
---|
258 | void ctdb_db_statistics_push(struct ctdb_db_statistics *dbstats, void *buf);
|
---|
259 | int ctdb_db_statistics_pull(uint8_t *buf, size_t buflen, TALLOC_CTX *mem_ctx,
|
---|
260 | struct ctdb_db_statistics **out);
|
---|
261 |
|
---|
262 | size_t ctdb_election_message_len(struct ctdb_election_message *election);
|
---|
263 | void ctdb_election_message_push(struct ctdb_election_message *election,
|
---|
264 | uint8_t *buf);
|
---|
265 | int ctdb_election_message_pull(uint8_t *buf, size_t buflen, TALLOC_CTX *mem_ctx,
|
---|
266 | struct ctdb_election_message **out);
|
---|
267 |
|
---|
268 | size_t ctdb_srvid_message_len(struct ctdb_srvid_message *msg);
|
---|
269 | void ctdb_srvid_message_push(struct ctdb_srvid_message *msg, uint8_t *buf);
|
---|
270 | int ctdb_srvid_message_pull(uint8_t *buf, size_t buflen, TALLOC_CTX *mem_ctx,
|
---|
271 | struct ctdb_srvid_message **out);
|
---|
272 |
|
---|
273 | size_t ctdb_tdb_data_len(TDB_DATA data);
|
---|
274 | void ctdb_tdb_data_push(TDB_DATA data, uint8_t *buf);
|
---|
275 | int ctdb_tdb_data_pull(uint8_t *buf, size_t buflen, TALLOC_CTX *mem_ctx,
|
---|
276 | TDB_DATA *out);
|
---|
277 |
|
---|
278 | size_t ctdb_disable_message_len(struct ctdb_disable_message *disable);
|
---|
279 | void ctdb_disable_message_push(struct ctdb_disable_message *disable,
|
---|
280 | uint8_t *buf);
|
---|
281 | int ctdb_disable_message_pull(uint8_t *buf, size_t buflen, TALLOC_CTX *mem_ctx,
|
---|
282 | struct ctdb_disable_message **out);
|
---|
283 |
|
---|
284 | #endif /* __PROTOCOL_PRIVATE_H__ */
|
---|