Author: Bleep <tomh@inxpress.net>
[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 sockaddr_in;
11
12 typedef enum IOResult {
13   IO_FAILURE = -1,
14   IO_BLOCKED = 0,
15   IO_SUCCESS = 1
16 } IOResult;
17
18 /*
19  * NOTE: osdep.c files should never need to know the actual size of a
20  * Client struct. When passed as a parameter, the pointer just needs
21  * to be forwarded to the enumeration function.
22  */
23 typedef void (*EnumFn)(struct Client*, const char* msg);
24
25 extern int os_disable_options(int fd);
26 extern int os_get_rusage(struct Client* cptr, int uptime, EnumFn enumerator);
27 extern int os_get_sockerr(int fd);
28 extern int os_get_sockname(int fd, struct sockaddr_in* sin_out);
29 extern int os_get_peername(int fd, struct sockaddr_in* sin_out);
30 extern IOResult os_recv_nonb(int fd, char* buf, unsigned int length,
31                         unsigned int* length_out);
32 extern IOResult os_send_nonb(int fd, const char* buf, unsigned int length,
33                         unsigned int* length_out);
34 extern IOResult os_recvfrom_nonb(int fd, char* buf, unsigned int len,
35                                  unsigned int* length_out,
36                                  struct sockaddr_in* from_out);
37 extern int os_connect_nonb(int fd, const struct sockaddr_in* sin);
38 extern int os_set_fdlimit(unsigned int max_descriptors);
39 extern int os_set_listen(int fd, int backlog);
40 extern int os_set_nonblocking(int fd);
41 extern int os_set_reuseaddr(int fd);
42 extern int os_set_sockbufs(int fd, unsigned int size);
43
44 #endif /* INCLUDED_ircd_osdep_h */
45