1 |
/* |
2 |
* ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd). |
3 |
* s_bsd.h: A header for the network subsystem. |
4 |
* |
5 |
* Copyright (C) 2002 by the past and present ircd coders, and others. |
6 |
* |
7 |
* This program is free software; you can redistribute it and/or modify |
8 |
* it under the terms of the GNU General Public License as published by |
9 |
* the Free Software Foundation; either version 2 of the License, or |
10 |
* (at your option) any later version. |
11 |
* |
12 |
* This program is distributed in the hope that it will be useful, |
13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 |
* GNU General Public License for more details. |
16 |
* |
17 |
* You should have received a copy of the GNU General Public License |
18 |
* along with this program; if not, write to the Free Software |
19 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
20 |
* USA |
21 |
* |
22 |
* $Id$ |
23 |
*/ |
24 |
|
25 |
#ifndef INCLUDED_s_bsd_h |
26 |
#define INCLUDED_s_bsd_h |
27 |
|
28 |
#include "config.h" |
29 |
|
30 |
|
31 |
/* |
32 |
* TCP window sizes |
33 |
* Set server window to a large value for fat pipes, |
34 |
* set client to a smaller size to allow TCP flow control |
35 |
* to reduce flooding |
36 |
*/ |
37 |
/** Default TCP window size for server connections. */ |
38 |
#define SERVER_TCP_WINDOW 61440 |
39 |
/** Default TCP window size for client connections. */ |
40 |
#define CLIENT_TCP_WINDOW 2048 |
41 |
|
42 |
struct Client; |
43 |
struct MaskItem; |
44 |
struct Listener; |
45 |
struct MsgQ; |
46 |
|
47 |
/** Result of an input/output operation. */ |
48 |
typedef enum IOResult |
49 |
{ |
50 |
IO_FAILURE = -1, /**< Serious I/O error (not due to blocking). */ |
51 |
IO_BLOCKED = 0, /**< I/O could not start because it would block. */ |
52 |
IO_SUCCESS = 1 /**< I/O succeeded. */ |
53 |
} IOResult; |
54 |
|
55 |
/* |
56 |
* text for report_error |
57 |
*/ |
58 |
extern const char *const BIND_ERROR_MSG; |
59 |
extern const char *const LISTEN_ERROR_MSG; |
60 |
extern const char *const NONB_ERROR_MSG; |
61 |
extern const char *const REUSEADDR_ERROR_MSG; |
62 |
extern const char *const SOCKET_ERROR_MSG; |
63 |
extern const char *const CONNLIMIT_ERROR_MSG; |
64 |
extern const char *const ACCEPT_ERROR_MSG; |
65 |
extern const char *const PEERNAME_ERROR_MSG; |
66 |
extern const char *const POLL_ERROR_MSG; |
67 |
extern const char *const SELECT_ERROR_MSG; |
68 |
extern const char *const CONNECT_ERROR_MSG; |
69 |
extern const char *const SETBUFS_ERROR_MSG; |
70 |
extern const char *const TOS_ERROR_MSG; |
71 |
extern const char *const REGISTER_ERROR_MSG; |
72 |
|
73 |
|
74 |
extern dlink_list connection_list; |
75 |
|
76 |
extern void add_connection(struct Listener *, struct irc_ssaddr *, int); |
77 |
extern void close_connection(struct Client *); |
78 |
extern void report_error(int, const char *, const char *, int); |
79 |
extern void update_write(struct Client *); |
80 |
extern int connect_server(struct MaskItem *, struct Client *); |
81 |
extern unsigned int deliver_it(struct Client *, struct MsgQ *); |
82 |
extern int os_get_sockerr(int); |
83 |
extern int os_set_reuseaddr(int); |
84 |
extern int os_set_sockbufs(int, unsigned int, unsigned int); |
85 |
extern int os_set_tos(int, int); |
86 |
extern int os_disable_options(int); |
87 |
extern int os_set_listen(int, int); |
88 |
extern int os_accept(int, struct irc_ssaddr *); |
89 |
extern int os_socket(int, int); |
90 |
extern int os_bind(int, struct irc_ssaddr *, int); |
91 |
extern IOResult os_recv_nonb(int, char *, unsigned int, unsigned int *); |
92 |
extern IOResult os_recvfrom_nonb(int, char *, unsigned int, unsigned int *, |
93 |
struct irc_ssaddr *); |
94 |
extern IOResult os_send_nonb(int, const char *, unsigned int, unsigned int *); |
95 |
extern IOResult os_sendv_nonb(int, struct MsgQ *, unsigned int *, unsigned int *); |
96 |
extern IOResult os_sendto_nonb(int, const char *, unsigned int, unsigned int *, |
97 |
unsigned int, struct irc_ssaddr *); |
98 |
extern IOResult os_connect_nonb(int, const struct irc_ssaddr *); |
99 |
extern void close_connections(const int); |
100 |
extern void remove_ipv6_mapping(struct irc_ssaddr *); |
101 |
#endif /* INCLUDED_s_bsd_h */ |