1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-07-04 11:33:13 +02:00
Files
unrealircd/include/fdlist.h
T
William Pitcock b26207df50 - Add support for proper FD accounting (rewrite of the fdlist code).
This is the first step to adding evented I/O.  Infact, writing the evented I/O code
  should now be quite easy.
2012-10-05 03:42:44 +00:00

53 lines
1.0 KiB
C

#ifndef _IRCD_DOG3_FDLIST
#define _IRCD_DOG3_FDLIST
/* $Id$ */
#define FD_DESC_SZ (100)
typedef void (*IOCallbackFunc)(int fd, void *data);
typedef struct fd_entry {
int fd;
char desc[FD_DESC_SZ];
IOCallbackFunc read_callback;
IOCallbackFunc write_callback;
void *data;
time_t deadline;
unsigned char is_open;
} FDEntry;
extern MODVAR FDEntry fd_table[MAXCONNECTIONS + 1];
extern int fd_open(int fd, const char *desc);
extern void fd_close(int fd);
extern int fd_socket(int family, int type, int protocol, const char *desc);
extern int fd_accept(int sockfd);
extern void fd_desc(int fd, const char *desc);
typedef struct fdstruct {
int entry[MAXCONNECTIONS + 2];
int last_entry;
} fdlist;
void addto_fdlist(int a, fdlist * b);
void delfrom_fdlist(int a, fdlist * b);
void init_fdlist(fdlist * b);
#ifndef NO_FDLIST
extern MODVAR fdlist oper_fdlist;
#endif
#ifndef TRUE
#define TRUE 1
#endif
#define LOADCFREQ 5
#define LOADRECV 35
#define FDLISTCHKFREQ 2
#endif /*
* _IRCD_DOG3_FDLIST
*/