messaging: Move parsing of ctdb_req_message to ctdbd_conn.c
[samba.git] / source3 / lib / ctdb_dummy.c
1 /*
2    Unix SMB/CIFS implementation.
3    Copyright (C) 2014 Björn Baumbach
4    Copyright (C) 2014 Stefan Metzmacher
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 #include "includes.h"
21 #include "messages.h"
22 #include "ctdb_conn.h"
23 #include "ctdbd_conn.h"
24 #include "lib/dbwrap/dbwrap.h"
25 #include "lib/dbwrap/dbwrap_ctdb.h"
26 #include "torture/proto.h"
27
28 NTSTATUS ctdbd_probe(void)
29 {
30         return NT_STATUS_NOT_IMPLEMENTED;
31 }
32
33 NTSTATUS ctdbd_messaging_send_iov(struct ctdbd_connection *conn,
34                                   uint32_t dst_vnn, uint64_t dst_srvid,
35                                   const struct iovec *iov, int iovlen)
36 {
37         return NT_STATUS_NOT_IMPLEMENTED;
38 }
39
40 NTSTATUS register_with_ctdbd(struct ctdbd_connection *conn, uint64_t srvid,
41                              void (*cb)(uint32_t src_vnn, uint32_t dst_vnn,
42                                         uint64_t dst_srvid,
43                                         const uint8_t *msg, size_t msglen,
44                                         void *private_data),
45                              void *private_data)
46 {
47         return NT_STATUS_NOT_IMPLEMENTED;
48 }
49
50 NTSTATUS ctdbd_register_ips(struct ctdbd_connection *conn,
51                             const struct sockaddr_storage *_server,
52                             const struct sockaddr_storage *_client,
53                             bool (*release_ip_handler)(const char *ip_addr,
54                                                        void *private_data),
55                             void *private_data)
56 {
57         return NT_STATUS_NOT_IMPLEMENTED;
58 }
59
60 const char *lp_ctdbd_socket(void)
61 {
62         return "";
63 }
64
65 bool ctdb_serverids_exist_supported(struct ctdbd_connection *conn)
66 {
67         return false;
68 }
69
70 bool ctdb_serverids_exist(struct ctdbd_connection *conn,
71                           const struct server_id *pids, unsigned num_pids,
72                           bool *results)
73 {
74         return false;
75 }
76
77 bool ctdb_processes_exist(struct ctdbd_connection *conn,
78                           const struct server_id *pids, int num_pids,
79                           bool *results)
80 {
81         return false;
82 }
83
84 struct dummy_state {
85         uint8_t dummy;
86 };
87
88 static struct tevent_req *dummy_send(TALLOC_CTX *mem_ctx,
89                                      struct tevent_context *ev)
90 {
91         struct tevent_req *req;
92         struct dummy_state *state;
93         req = tevent_req_create(mem_ctx, &state, struct dummy_state);
94         if (req == NULL) {
95                 return NULL;
96         }
97         tevent_req_done(req);
98         return tevent_req_post(req, ev);
99 }
100
101 struct tevent_req *ctdb_conn_init_send(TALLOC_CTX *mem_ctx,
102                                        struct tevent_context *ev,
103                                        const char *sock)
104 {
105         return dummy_send(mem_ctx, ev);
106 }
107
108 int ctdb_conn_init_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
109                         struct ctdb_conn **pconn)
110 {
111         return ENOSYS;
112 }
113
114 struct tevent_req *ctdb_conn_msg_write_send(TALLOC_CTX *mem_ctx,
115                                             struct tevent_context *ev,
116                                             struct ctdb_conn *conn,
117                                             uint32_t vnn, uint64_t srvid,
118                                             uint8_t *msg, size_t msg_len)
119 {
120         return dummy_send(mem_ctx, ev);
121 }
122
123 int ctdb_conn_msg_write_recv(struct tevent_req *req)
124 {
125         return ENOSYS;
126 }
127
128 struct tevent_req *ctdb_msg_channel_init_send(
129         TALLOC_CTX *mem_ctx, struct tevent_context *ev,
130         const char *sock, uint64_t srvid)
131 {
132         return dummy_send(mem_ctx, ev);
133 }
134
135 int ctdb_msg_channel_init_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
136                                struct ctdb_msg_channel **pchannel)
137 {
138         return ENOSYS;
139 }
140
141 struct tevent_req *ctdb_msg_read_send(TALLOC_CTX *mem_ctx,
142                                       struct tevent_context *ev,
143                                       struct ctdb_msg_channel *channel)
144 {
145         return dummy_send(mem_ctx, ev);
146 }
147
148 int ctdb_msg_read_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
149                        uint8_t **pmsg, size_t *pmsg_len)
150 {
151         return ENOSYS;
152 }
153
154 struct db_context *db_open_ctdb(TALLOC_CTX *mem_ctx,
155                                 const char *name,
156                                 int hash_size, int tdb_flags,
157                                 int open_flags, mode_t mode,
158                                 enum dbwrap_lock_order lock_order,
159                                 uint64_t dbwrap_flags)
160 {
161         errno = ENOSYS;
162         return NULL;
163 }
164
165 NTSTATUS messaging_ctdbd_init(struct messaging_context *msg_ctx,
166                               TALLOC_CTX *mem_ctx,
167                               struct messaging_backend **presult)
168 {
169         return NT_STATUS_NOT_IMPLEMENTED;
170 }
171
172 struct ctdbd_connection *messaging_ctdbd_connection(void)
173 {
174         return NULL;
175 }
176
177 bool run_ctdb_conn(int dummy)
178 {
179         return true;
180 }