]> jfr.im git - solanum.git/commitdiff
- add IOReadFunc and IOWriteFunc types.
authorWilliam Pitcock <redacted>
Sat, 22 Dec 2007 22:05:51 +0000 (16:05 -0600)
committerWilliam Pitcock <redacted>
Sat, 22 Dec 2007 22:05:51 +0000 (16:05 -0600)
- 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.)

libcharybdis/commio.c
libcharybdis/commio.h

index 14c9efaf1ef689eef705a3cf114c36741923efcb..ac09126ceea0d8b7c2901b5a58672bfa6980f0f5 100644 (file)
@@ -85,8 +85,12 @@ comm_add_fd(int fd)
        if (F != NULL)
                return F;
 
-       F = calloc(sizeof(fde_t), 1);
+       F = MyMalloc(sizeof(fde_t));
        F->fd = fd;
+
+       F->read_impl = read;
+       F->write_impl = write;
+
        list = &fd_table[fd % FD_HASH_SIZE];
        dlinkAdd(F, &F->node, list);
 
index f7240609dfcc59a35f70d03f93d28cc837d8584d..3100e6f8093f61eb6dbc4c4ee9e88eee447f9ab7 100644 (file)
 /* 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 *);
@@ -96,16 +100,24 @@ struct _fde
        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 *write_handler;
        void *write_data;
+
        PF *timeout_handler;
        void *timeout_data;
        time_t timeout;
+
        PF *flush_handler;
        void *flush_data;
        time_t flush_timeout;
+
+       IOReadFunc *read_impl;
+       IOWriteFunc *write_impl;
+
        struct DNSQuery *dns_query;
        struct
        {