1 | /*
|
---|
2 | Unix SMB/CIFS implementation.
|
---|
3 | Samba3 ctdb connection handling
|
---|
4 | Copyright (C) Volker Lendecke 2007
|
---|
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 _CTDBD_CONN_H
|
---|
21 | #define _CTDBD_CONN_H
|
---|
22 |
|
---|
23 | #include <tdb.h>
|
---|
24 |
|
---|
25 | struct ctdbd_connection;
|
---|
26 | struct messaging_context;
|
---|
27 | struct messaging_rec;
|
---|
28 |
|
---|
29 | int ctdbd_messaging_connection(TALLOC_CTX *mem_ctx,
|
---|
30 | const char *sockname, int timeout,
|
---|
31 | struct ctdbd_connection **pconn);
|
---|
32 |
|
---|
33 | uint32_t ctdbd_vnn(const struct ctdbd_connection *conn);
|
---|
34 |
|
---|
35 | int ctdbd_register_msg_ctx(struct ctdbd_connection *conn,
|
---|
36 | struct messaging_context *msg_ctx,
|
---|
37 | struct tevent_context *ev);
|
---|
38 | struct messaging_context *ctdb_conn_msg_ctx(struct ctdbd_connection *conn);
|
---|
39 |
|
---|
40 | int ctdbd_conn_get_fd(struct ctdbd_connection *conn);
|
---|
41 |
|
---|
42 | int ctdbd_messaging_send_iov(struct ctdbd_connection *conn,
|
---|
43 | uint32_t dst_vnn, uint64_t dst_srvid,
|
---|
44 | const struct iovec *iov, int iovlen);
|
---|
45 |
|
---|
46 | bool ctdbd_process_exists(struct ctdbd_connection *conn, uint32_t vnn,
|
---|
47 | pid_t pid);
|
---|
48 | bool ctdb_processes_exist(struct ctdbd_connection *conn,
|
---|
49 | const struct server_id *pids, int num_pids,
|
---|
50 | bool *results);
|
---|
51 |
|
---|
52 | char *ctdbd_dbpath(struct ctdbd_connection *conn,
|
---|
53 | TALLOC_CTX *mem_ctx, uint32_t db_id);
|
---|
54 |
|
---|
55 | int ctdbd_db_attach(struct ctdbd_connection *conn, const char *name,
|
---|
56 | uint32_t *db_id, int tdb_flags);
|
---|
57 |
|
---|
58 | int ctdbd_migrate(struct ctdbd_connection *conn, uint32_t db_id, TDB_DATA key);
|
---|
59 |
|
---|
60 | int ctdbd_parse(struct ctdbd_connection *conn, uint32_t db_id,
|
---|
61 | TDB_DATA key, bool local_copy,
|
---|
62 | void (*parser)(TDB_DATA key, TDB_DATA data,
|
---|
63 | void *private_data),
|
---|
64 | void *private_data);
|
---|
65 |
|
---|
66 | int ctdbd_traverse(struct ctdbd_connection *master, uint32_t db_id,
|
---|
67 | void (*fn)(TDB_DATA key, TDB_DATA data,
|
---|
68 | void *private_data),
|
---|
69 | void *private_data);
|
---|
70 |
|
---|
71 | int ctdbd_register_ips(struct ctdbd_connection *conn,
|
---|
72 | const struct sockaddr_storage *server,
|
---|
73 | const struct sockaddr_storage *client,
|
---|
74 | int (*cb)(uint32_t src_vnn, uint32_t dst_vnn,
|
---|
75 | uint64_t dst_srvid,
|
---|
76 | const uint8_t *msg, size_t msglen,
|
---|
77 | void *private_data),
|
---|
78 | void *private_data);
|
---|
79 |
|
---|
80 | int ctdbd_control_local(struct ctdbd_connection *conn, uint32_t opcode,
|
---|
81 | uint64_t srvid, uint32_t flags, TDB_DATA data,
|
---|
82 | TALLOC_CTX *mem_ctx, TDB_DATA *outdata,
|
---|
83 | int *cstatus);
|
---|
84 | int ctdb_watch_us(struct ctdbd_connection *conn);
|
---|
85 | int ctdb_unwatch(struct ctdbd_connection *conn);
|
---|
86 |
|
---|
87 | struct ctdb_req_message_old;
|
---|
88 |
|
---|
89 | int register_with_ctdbd(struct ctdbd_connection *conn, uint64_t srvid,
|
---|
90 | int (*cb)(uint32_t src_vnn, uint32_t dst_vnn,
|
---|
91 | uint64_t dst_srvid,
|
---|
92 | const uint8_t *msg, size_t msglen,
|
---|
93 | void *private_data),
|
---|
94 | void *private_data);
|
---|
95 | int ctdbd_probe(const char *sockname, int timeout);
|
---|
96 |
|
---|
97 | #endif /* _CTDBD_CONN_H */
|
---|