ircu2.10.12 pk910 fork
[ircu2.10.12-pk.git] / include / s_bsd.h
1 /** @file s_bsd.h
2  * @brief Wrapper functions to avoid direct use of BSD APIs.
3  * @version $Id: s_bsd.h 1764 2007-02-25 15:41:49Z entrope $
4  */
5 #ifndef INCLUDED_s_bsd_h
6 #define INCLUDED_s_bsd_h
7 #ifndef INCLUDED_sys_types_h
8 #include <sys/types.h>         /* size_t, time_t */
9 #define INCLUDED_sys_types_h
10 #endif
11 #ifndef INCLUDED_netinet_in_h
12 #include <netinet/in.h>
13 #define INCLUDED_netinet_in_h
14 #endif
15
16 #include "ssl.h"
17
18 struct Client;
19 struct ConfItem;
20 struct Listener;
21 struct MsgQ;
22 struct irc_in_addr;
23 struct Event;
24
25 /*
26  * TCP window sizes
27  * Set server window to a large value for fat pipes,
28  * set client to a smaller size to allow TCP flow control
29  * to reduce flooding
30  */
31 /** Default TCP window size for server connections. */
32 #define SERVER_TCP_WINDOW 61440
33 /** Default TCP window size for client connections. */
34 #define CLIENT_TCP_WINDOW 2048
35
36 extern void report_error(const char* text, const char* who, int err);
37 /*
38  * text for report_error
39  */
40 extern const char* const BIND_ERROR_MSG;
41 extern const char* const LISTEN_ERROR_MSG;
42 extern const char* const NONB_ERROR_MSG;
43 extern const char* const REUSEADDR_ERROR_MSG;
44 extern const char* const SOCKET_ERROR_MSG;
45 extern const char* const CONNLIMIT_ERROR_MSG;
46 extern const char* const ACCEPT_ERROR_MSG;
47 extern const char* const PEERNAME_ERROR_MSG;
48 extern const char* const POLL_ERROR_MSG;
49 extern const char* const SELECT_ERROR_MSG;
50 extern const char* const CONNECT_ERROR_MSG;
51 extern const char* const SETBUFS_ERROR_MSG;
52 extern const char* const TOS_ERROR_MSG;
53 extern const char* const REGISTER_ERROR_MSG;
54
55 extern int            HighestFd;
56 extern struct Client* LocalClientArray[MAXCONNECTIONS];
57 extern struct irc_sockaddr VirtualHost_v4;
58 extern struct irc_sockaddr VirtualHost_v6;
59 extern struct irc_sockaddr VirtualHost_dns_v4;
60 extern struct irc_sockaddr VirtualHost_dns_v6;
61
62 /*
63  * Proto types
64  */
65 extern unsigned int deliver_it(struct Client *cptr, struct MsgQ *buf);
66 extern int connect_server(struct ConfItem* aconf, struct Client* by);
67 extern int  net_close_unregistered_connections(struct Client* source);
68 extern void close_connection(struct Client *cptr);
69 extern void add_connection(struct Listener* listener, int fd, ssl_session_t *ssl);
70 extern int  read_message(time_t delay);
71 extern void init_server_identity(void);
72 extern void close_connections(int close_stderr);
73 extern int  init_connection_limits(void);
74 extern void update_write(struct Client* cptr);
75 extern int completed_connection(struct Client* cptr);
76 extern void client_sock_callback(struct Event* ev);
77
78 #endif /* INCLUDED_s_bsd_h */