- add fde::read_impl, fde::write_impl.
(defaults to read(2) and write(2) with raw FDs at the moment;
this will be revised to act on the fde later.)
- F = calloc(sizeof(fde_t), 1);
+ F = MyMalloc(sizeof(fde_t));
+
+ F->read_impl = read;
+ F->write_impl = write;
+
list = &fd_table[fd % FD_HASH_SIZE];
dlinkAdd(F, &F->node, list);
list = &fd_table[fd % FD_HASH_SIZE];
dlinkAdd(F, &F->node, list);
/* Callback for completed IO events */
typedef void PF(int fd, void *);
/* Callback for completed IO events */
typedef void PF(int fd, void *);
+/* virtual function types for I/O --nenolod */
+typedef void IOFuncRead(int fd, void *buf, size_t count);
+typedef void IOFuncWrite(int fd, const void *buf, size_t count);
+
/* Callback for completed connections */
/* int fd, int status, void * */
typedef void CNCB(int fd, int, void *);
/* Callback for completed connections */
/* int fd, int status, void * */
typedef void CNCB(int fd, int, void *);
fdlist_t list; /* Which list this FD should sit on */
int comm_index; /* where in the poll list we live */
char desc[FD_DESC_SZ];
fdlist_t list; /* Which list this FD should sit on */
int comm_index; /* where in the poll list we live */
char desc[FD_DESC_SZ];
PF *read_handler;
void *read_data;
PF *read_handler;
void *read_data;
PF *write_handler;
void *write_data;
PF *write_handler;
void *write_data;
PF *timeout_handler;
void *timeout_data;
time_t timeout;
PF *timeout_handler;
void *timeout_data;
time_t timeout;
PF *flush_handler;
void *flush_data;
time_t flush_timeout;
PF *flush_handler;
void *flush_data;
time_t flush_timeout;
+
+ IOReadFunc *read_impl;
+ IOWriteFunc *write_impl;
+
struct DNSQuery *dns_query;
struct
{
struct DNSQuery *dns_query;
struct
{