1 | /*
|
---|
2 | ctdb database library
|
---|
3 |
|
---|
4 | Copyright (C) Andrew Tridgell 2006
|
---|
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_TCP_H
|
---|
21 | #define _CTDB_TCP_H
|
---|
22 |
|
---|
23 | /* ctdb_tcp main state */
|
---|
24 | struct ctdb_tcp {
|
---|
25 | struct ctdb_context *ctdb;
|
---|
26 | int listen_fd;
|
---|
27 | };
|
---|
28 |
|
---|
29 | /*
|
---|
30 | state associated with an incoming connection
|
---|
31 | */
|
---|
32 | struct ctdb_incoming {
|
---|
33 | struct ctdb_context *ctdb;
|
---|
34 | int fd;
|
---|
35 | struct ctdb_queue *queue;
|
---|
36 | };
|
---|
37 |
|
---|
38 | /*
|
---|
39 | state associated with one tcp node
|
---|
40 | */
|
---|
41 | struct ctdb_tcp_node {
|
---|
42 | int fd;
|
---|
43 | struct ctdb_queue *out_queue;
|
---|
44 | struct tevent_fd *connect_fde;
|
---|
45 | struct tevent_timer *connect_te;
|
---|
46 | };
|
---|
47 |
|
---|
48 |
|
---|
49 | /* prototypes internal to tcp transport */
|
---|
50 | int ctdb_tcp_queue_pkt(struct ctdb_node *node, uint8_t *data, uint32_t length);
|
---|
51 | int ctdb_tcp_listen(struct ctdb_context *ctdb);
|
---|
52 | void ctdb_tcp_node_connect(struct tevent_context *ev, struct tevent_timer *te,
|
---|
53 | struct timeval t, void *private_data);
|
---|
54 | void ctdb_tcp_read_cb(uint8_t *data, size_t cnt, void *args);
|
---|
55 | void ctdb_tcp_tnode_cb(uint8_t *data, size_t cnt, void *private_data);
|
---|
56 | void ctdb_tcp_stop_connection(struct ctdb_node *node);
|
---|
57 |
|
---|
58 | #define CTDB_TCP_ALIGNMENT 8
|
---|
59 |
|
---|
60 | #endif /* _CTDB_TCP_H */
|
---|