IPv6 support (hopefully with fewer future transition pains)
[ircu2.10.12-pk.git] / include / ircd_osdep.h
1 /*
2  * ircd_osdep.h
3  *
4  * $Id$
5  */
6 #ifndef INCLUDED_ircd_osdep_h
7 #define INCLUDED_ircd_osdep_h
8
9 struct Client;
10 struct irc_sockaddr;
11 struct MsgQ;
12
13 typedef enum IOResult {
14   IO_FAILURE = -1,
15   IO_BLOCKED = 0,
16   IO_SUCCESS = 1
17 } IOResult;
18
19 /*
20  * NOTE: osdep.c files should never need to know the actual size of a
21  * Client struct. When passed as a parameter, the pointer just needs
22  * to be forwarded to the enumeration function.
23  */
24 typedef void (*EnumFn)(struct Client*, const char* msg);
25
26 extern int os_disable_options(int fd);
27 extern int os_get_rusage(struct Client* cptr, int uptime, EnumFn enumerator);
28 extern int os_get_sockerr(int fd);
29 extern int os_get_sockname(int fd, struct irc_sockaddr* sin_out);
30 extern int os_get_peername(int fd, struct irc_sockaddr* sin_out);
31 extern int os_socket(const struct irc_sockaddr* local, int type, const char* port_name);
32 extern int os_accept(int fd, struct irc_sockaddr* peer);
33 extern IOResult os_sendto_nonb(int fd, const char* buf, unsigned int length,
34                                unsigned int* length_out, unsigned int flags,
35                                const struct irc_sockaddr* peer);
36 extern IOResult os_recv_nonb(int fd, char* buf, unsigned int length,
37                         unsigned int* length_out);
38 extern IOResult os_send_nonb(int fd, const char* buf, unsigned int length,
39                         unsigned int* length_out);
40 extern IOResult os_sendv_nonb(int fd, struct MsgQ* buf,
41                               unsigned int* len_in, unsigned int* len_out);
42 extern IOResult os_recvfrom_nonb(int fd, char* buf, unsigned int len,
43                                  unsigned int* length_out,
44                                  struct irc_sockaddr* from_out);
45 extern IOResult os_connect_nonb(int fd, const struct irc_sockaddr* sin);
46 extern int os_set_fdlimit(unsigned int max_descriptors);
47 extern int os_set_listen(int fd, int backlog);
48 extern int os_set_nonblocking(int fd);
49 extern int os_set_reuseaddr(int fd);
50 extern int os_set_sockbufs(int fd, unsigned int ssize, unsigned int rsize);
51 extern int os_set_tos(int fd,int tos);
52
53 #endif /* INCLUDED_ircd_osdep_h */
54