1 /*
2 protocol tests - ctdb protocol
3
4 Copyright (C) Amitay Isaacs 2017
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 __CTDB_PROTOCOL_COMMON_CTDB_H__
21 #define __CTDB_PROTOCOL_COMMON_CTDB_H__
22
23 #include "replace.h"
24 #include "system/network.h"
25
26 #include <talloc.h>
27 #include <tdb.h>
28
29 #include "protocol/protocol.h"
30
31 void fill_ctdb_req_header(struct ctdb_req_header *h);
fill_ctdb_req_header(struct ctdb_req_header * h)32 void verify_ctdb_req_header(struct ctdb_req_header *h,
33 struct ctdb_req_header *h2);
34
35 void fill_ctdb_req_call(TALLOC_CTX *mem_ctx, struct ctdb_req_call *c);
36 void verify_ctdb_req_call(struct ctdb_req_call *c, struct ctdb_req_call *c2);
37
38 void fill_ctdb_reply_call(TALLOC_CTX *mem_ctx, struct ctdb_reply_call *c);
39 void verify_ctdb_reply_call(struct ctdb_reply_call *c,
40 struct ctdb_reply_call *c2);
41
42 void fill_ctdb_reply_error(TALLOC_CTX *mem_ctx, struct ctdb_reply_error *c);
43 void verify_ctdb_reply_error(struct ctdb_reply_error *c,
verify_ctdb_req_header(struct ctdb_req_header * h,struct ctdb_req_header * h2)44 struct ctdb_reply_error *c2);
45
46 void fill_ctdb_req_dmaster(TALLOC_CTX *mem_ctx, struct ctdb_req_dmaster *c);
47 void verify_ctdb_req_dmaster(struct ctdb_req_dmaster *c,
48 struct ctdb_req_dmaster *c2);
49
50 void fill_ctdb_reply_dmaster(TALLOC_CTX *mem_ctx,
51 struct ctdb_reply_dmaster *c);
52 void verify_ctdb_reply_dmaster(struct ctdb_reply_dmaster *c,
53 struct ctdb_reply_dmaster *c2);
54
55 void fill_ctdb_req_control_data(TALLOC_CTX *mem_ctx,
56 struct ctdb_req_control_data *cd,
fill_ctdb_req_call(TALLOC_CTX * mem_ctx,struct ctdb_req_call * c)57 uint32_t opcode);
58 void verify_ctdb_req_control_data(struct ctdb_req_control_data *cd,
59 struct ctdb_req_control_data *cd2);
60
61 void fill_ctdb_req_control(TALLOC_CTX *mem_ctx, struct ctdb_req_control *c,
62 uint32_t opcode);
63 void verify_ctdb_req_control(struct ctdb_req_control *c,
64 struct ctdb_req_control *c2);
65
66 void fill_ctdb_reply_control_data(TALLOC_CTX *mem_ctx,
verify_ctdb_req_call(struct ctdb_req_call * c,struct ctdb_req_call * c2)67 struct ctdb_reply_control_data *cd,
68 uint32_t opcode);
69 void verify_ctdb_reply_control_data(struct ctdb_reply_control_data *cd,
70 struct ctdb_reply_control_data *cd2);
71
72 void fill_ctdb_reply_control(TALLOC_CTX *mem_ctx,
73 struct ctdb_reply_control *c, uint32_t opcode);
74 void verify_ctdb_reply_control(struct ctdb_reply_control *c,
75 struct ctdb_reply_control *c2);
76
fill_ctdb_reply_call(TALLOC_CTX * mem_ctx,struct ctdb_reply_call * c)77 void fill_ctdb_message_data(TALLOC_CTX *mem_ctx, union ctdb_message_data *md,
78 uint64_t srvid);
79 void verify_ctdb_message_data(union ctdb_message_data *md,
80 union ctdb_message_data *md2, uint64_t srvid);
81
82 void fill_ctdb_req_message(TALLOC_CTX *mem_ctx, struct ctdb_req_message *c,
verify_ctdb_reply_call(struct ctdb_reply_call * c,struct ctdb_reply_call * c2)83 uint64_t srvid);
84 void verify_ctdb_req_message(struct ctdb_req_message *c,
85 struct ctdb_req_message *c2);
86
87 void fill_ctdb_req_message_data(TALLOC_CTX *mem_ctx,
88 struct ctdb_req_message_data *c);
89 void verify_ctdb_req_message_data(struct ctdb_req_message_data *c,
fill_ctdb_reply_error(TALLOC_CTX * mem_ctx,struct ctdb_reply_error * c)90 struct ctdb_req_message_data *c2);
91
92 void fill_ctdb_req_keepalive(TALLOC_CTX *mem_ctx,
93 struct ctdb_req_keepalive *c);
94 void verify_ctdb_req_keepalive(struct ctdb_req_keepalive *c,
95 struct ctdb_req_keepalive *c2);
verify_ctdb_reply_error(struct ctdb_reply_error * c,struct ctdb_reply_error * c2)96
97 void fill_ctdb_req_tunnel(TALLOC_CTX *mem_ctx, struct ctdb_req_tunnel *c);
98 void verify_ctdb_req_tunnel(struct ctdb_req_tunnel *c,
99 struct ctdb_req_tunnel *c2);
100
101 #endif /* __CTDB_PROTOCOL_COMMON_CTDB_H__ */
102