92295365e349c5f2f44503f808a4efd0a2d92d81
[samba.git] / source3 / lib / ctdb_conn.h
1 /*
2    Unix SMB/CIFS implementation.
3    Samba3 ctdb connection handling
4    Copyright (C) Volker Lendecke 2012
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_CONN_H
21 #define _CTDB_CONN_H
22
23 #ifdef CLUSTER_SUPPORT
24
25 #include <tdb.h>
26 #include <ctdb_protocol.h>
27
28 #else /* CLUSTER_SUPPORT */
29
30 struct ctdb_reply_control;
31
32 #endif /* CLUSTER_SUPPORT */
33
34 #include "tevent.h"
35 #include "librpc/gen_ndr/messaging.h"
36
37 struct ctdb_conn;
38
39 struct tevent_req *ctdb_conn_control_send(TALLOC_CTX *mem_ctx,
40                                           struct tevent_context *ev,
41                                           struct ctdb_conn *conn,
42                                           uint32_t vnn, uint32_t opcode,
43                                           uint64_t srvid, uint32_t flags,
44                                           uint8_t *data, size_t datalen);
45 int ctdb_conn_control_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
46                            struct ctdb_reply_control **preply);
47
48 struct tevent_req *ctdb_conn_init_send(TALLOC_CTX *mem_ctx,
49                                        struct tevent_context *ev,
50                                        const char *sock);
51 int ctdb_conn_init_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
52                         struct ctdb_conn **pconn);
53
54 struct tevent_req *ctdb_conn_msg_write_send(TALLOC_CTX *mem_ctx,
55                                             struct tevent_context *ev,
56                                             struct ctdb_conn *conn,
57                                             uint32_t vnn, uint64_t srvid,
58                                             uint8_t *msg, size_t msg_len);
59 int ctdb_conn_msg_write_recv(struct tevent_req *req);
60
61 struct ctdb_msg_channel;
62
63 struct tevent_req *ctdb_msg_channel_init_send(
64         TALLOC_CTX *mem_ctx, struct tevent_context *ev,
65         const char *sock, uint64_t srvid);
66 int ctdb_msg_channel_init_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
67                                struct ctdb_msg_channel **pchannel);
68
69 struct tevent_req *ctdb_msg_read_send(TALLOC_CTX *mem_ctx,
70                                       struct tevent_context *ev,
71                                       struct ctdb_msg_channel *channel);
72 int ctdb_msg_read_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
73                        uint8_t **pmsg, size_t *pmsg_len);
74
75 #endif /* _CTDB_CONN_H */