4
mirror of git://git.acid.vegas/unrealircd.git synced 2024-11-23 16:36:40 +00:00
unrealircd/include/fdlist.h

43 lines
1.2 KiB
C
Raw Normal View History

2020-03-29 09:16:53 +00:00
#ifndef FDLIST_H
#define FDLIST_H
/* $Id$ */
#define FD_DESC_SZ (100)
typedef void (*IOCallbackFunc)(int fd, int revents, void *data);
2022-01-15 05:16:34 +00:00
typedef enum FDCloseMethod { FDCLOSE_SOCKET=0, FDCLOSE_FILE=1, FDCLOSE_NONE=3 } FDCloseMethod;
2020-03-29 09:16:53 +00:00
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;
2022-01-15 05:16:34 +00:00
FDCloseMethod close_method;
2020-03-29 09:16:53 +00:00
unsigned int backend_flags;
} FDEntry;
extern MODVAR FDEntry fd_table[MAXCONNECTIONS + 1];
2022-01-15 05:16:34 +00:00
extern int fd_open(int fd, const char *desc, FDCloseMethod close_method);
extern int fd_close(int fd);
2020-03-29 09:16:53 +00:00
extern void fd_unnotify(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);
extern int fd_fileopen(const char *path, unsigned int flags);
#define FD_SELECT_READ 0x1
#define FD_SELECT_WRITE 0x2
extern void fd_setselect(int fd, int flags, IOCallbackFunc iocb, void *data);
extern void fd_select(time_t delay); /* backend-specific */
extern void fd_refresh(int fd); /* backend-specific */
extern void fd_fork(); /* backend-specific */
#endif