2006-11-18 02:41:20 +03:00
/*
ctdb database library
Copyright ( C ) Andrew Tridgell 2006
2007-05-31 07:50:53 +04:00
This program is free software ; you can redistribute it and / or modify
it under the terms of the GNU General Public License as published by
2007-07-10 09:29:31 +04:00
the Free Software Foundation ; either version 3 of the License , or
2007-05-31 07:50:53 +04:00
( at your option ) any later version .
This program is distributed in the hope that it will be useful ,
2006-11-18 02:41:20 +03:00
but WITHOUT ANY WARRANTY ; without even the implied warranty of
2007-05-31 07:50:53 +04:00
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
GNU General Public License for more details .
You should have received a copy of the GNU General Public License
2007-07-10 09:29:31 +04:00
along with this program ; if not , see < http : //www.gnu.org/licenses/>.
2006-11-18 02:41:20 +03:00
*/
2011-11-11 05:41:24 +04:00
# ifndef _CTDB_TCP_H
# define _CTDB_TCP_H
2006-11-27 13:38:13 +03:00
/* ctdb_tcp main state */
struct ctdb_tcp {
2008-02-19 06:44:48 +03:00
struct ctdb_context * ctdb ;
2006-11-27 13:38:13 +03:00
int listen_fd ;
2006-11-18 03:21:40 +03:00
} ;
2006-11-18 02:41:20 +03:00
/*
2006-11-27 13:38:13 +03:00
state associated with an incoming connection
2006-11-18 02:41:20 +03:00
*/
2006-11-27 13:38:13 +03:00
struct ctdb_incoming {
2006-11-18 02:41:20 +03:00
struct ctdb_context * ctdb ;
int fd ;
2007-04-10 13:33:21 +04:00
struct ctdb_queue * queue ;
2006-11-28 06:15:46 +03:00
} ;
2006-11-18 05:45:04 +03:00
/*
2006-11-27 13:38:13 +03:00
state associated with one tcp node
2006-11-18 05:45:04 +03:00
*/
2006-11-27 13:38:13 +03:00
struct ctdb_tcp_node {
2006-11-18 05:45:04 +03:00
int fd ;
2007-07-02 08:26:50 +04:00
struct ctdb_queue * out_queue ;
2015-10-26 08:50:09 +03:00
struct tevent_fd * connect_fde ;
struct tevent_timer * connect_te ;
2006-11-18 05:45:04 +03:00
} ;
2006-11-28 03:51:33 +03:00
/* prototypes internal to tcp transport */
2006-11-28 06:15:46 +03:00
int ctdb_tcp_queue_pkt ( struct ctdb_node * node , uint8_t * data , uint32_t length ) ;
2006-11-28 03:51:33 +03:00
int ctdb_tcp_listen ( struct ctdb_context * ctdb ) ;
2015-10-26 08:50:09 +03:00
void ctdb_tcp_node_connect ( struct tevent_context * ev , struct tevent_timer * te ,
2007-04-13 14:38:24 +04:00
struct timeval t , void * private_data ) ;
2007-04-10 13:33:21 +04:00
void ctdb_tcp_read_cb ( uint8_t * data , size_t cnt , void * args ) ;
2007-04-13 14:38:24 +04:00
void ctdb_tcp_tnode_cb ( uint8_t * data , size_t cnt , void * private_data ) ;
2007-10-22 10:41:11 +04:00
void ctdb_tcp_stop_connection ( struct ctdb_node * node ) ;
2006-12-19 04:07:07 +03:00
# define CTDB_TCP_ALIGNMENT 8
2011-11-11 05:41:24 +04:00
# endif /* _CTDB_TCP_H */