79d8abe59d150061c30c5e2c2decc1bf78cfaddd
[kai/samba.git] / source3 / include / ctdbd_conn.h
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 2 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, write to the Free Software
18    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 */
20
21 struct ctdbd_connection;
22
23 NTSTATUS ctdbd_init_connection(TALLOC_CTX *mem_ctx,
24                                struct ctdbd_connection **pconn);
25 NTSTATUS ctdbd_messaging_connection(TALLOC_CTX *mem_ctx,
26                                     struct ctdbd_connection **pconn);
27
28 uint32 ctdbd_vnn(const struct ctdbd_connection *conn);
29
30 NTSTATUS ctdbd_register_msg_ctx(struct ctdbd_connection *conn,
31                                 struct messaging_context *msg_ctx);
32
33 NTSTATUS ctdbd_messaging_send(struct ctdbd_connection *conn,
34                               uint32 dst_vnn, uint64 dst_srvid,
35                               struct messaging_rec *msg);
36
37 BOOL ctdbd_process_exists(struct ctdbd_connection *conn, uint32 vnn,
38                           pid_t pid);
39
40 char *ctdbd_dbpath(struct ctdbd_connection *conn,
41                    TALLOC_CTX *mem_ctx, uint32_t db_id);
42
43 NTSTATUS ctdbd_db_attach(struct ctdbd_connection *conn, const char *name,
44                          uint32_t *db_id, int tdb_flags);
45
46 NTSTATUS ctdbd_migrate(struct ctdbd_connection *conn, uint32 db_id,
47                        TDB_DATA key);
48
49 NTSTATUS ctdbd_fetch(struct ctdbd_connection *conn, uint32 db_id,
50                      TDB_DATA key, TALLOC_CTX *mem_ctx, TDB_DATA *data);
51
52 NTSTATUS ctdbd_traverse(uint32 db_id,
53                         void (*fn)(TDB_DATA key, TDB_DATA data,
54                                    void *private_data),
55                         void *private_data);
56
57 NTSTATUS ctdbd_register_ips(struct ctdbd_connection *conn,
58                             const struct sockaddr_in *server,
59                             const struct sockaddr_in *client,
60                             void (*release_ip_handler)(const char *ip_addr,
61                                                        void *private_data),
62                             void *private_data);
63
64 NTSTATUS ctdbd_register_reconfigure(struct ctdbd_connection *conn);
65