]> jfr.im git - irc/DALnet/libd.git/commitdiff
Update structures:
authorepiphani <redacted>
Tue, 13 Jan 2009 01:29:05 +0000 (20:29 -0500)
committerepiphani <redacted>
Tue, 13 Jan 2009 01:29:05 +0000 (20:29 -0500)
- add per-client parser/packeter pointers
- add ownership tree pointers
- add an error handler function pointer

include/sockeng.h

index d66d416642bb5b8900684fe4606e69921964c609..c0043e188d8ae3f14db5f009c99d6bca043364de 100644 (file)
@@ -6,6 +6,7 @@
 #define SOCKENG_H
 
 #include <stdio.h>
+#include <stdarg.h>
 #include <stdlib.h>
 #include <string.h>
 #include <sys/types.h>
@@ -69,10 +70,18 @@ struct _client {
        unsigned short  port;                   /* the remote port */
        int             type;                   /* the type of this connection (tcp/udp/raw) */
 
+       Listener        *listener;              /* listener this client came in on (optional) */
+
        /* functions */
        int             (*send)();
        int             (*close)();
        int             (*qopts)();
+
+       int             (*set_packeter)();
+       int             (*set_parser)();
+
+       char            *(*packeter)();
+       int             (*parser)();
 };
 
 /*
@@ -80,11 +89,13 @@ struct _client {
  */
 struct _listener {
        int             fd;             /* file descriptor of the listener */
-       u_short         port;           /* port of the descriptor */
+       unsigned short  port;           /* port of the descriptor */
        unsigned int    count;          /* count of the clients connected */
        ipvx            addr;           /* address of the listener to bind to */
        time_t          last;           /* TS of last connect */
 
+       SockEng         *sockeng;       /* socket engine this is running on */
+
        int             flags;          /* flags? */
 
        int             (*qopts)();             /* function to set options */
@@ -105,6 +116,8 @@ struct _group {
        cLink           *clients;               /* clients in this group */
        gLink           *groups;                /* subgroups to this group */
 
+       Group           *parent;                /* parent group (if applicable) */
+
        int             (*add)(Group *gr, Client *cl);          /* function for adding clients to this group */
        int             (*remove)(Group *gr, Client *cl);       /* function for removing clients from this group */
        Group           *(*create_subgroup)(Group *gr);         /* function to create a subgroup */
@@ -126,6 +139,8 @@ struct _sockeng {
        Listener        *(*create_listener)();
        Group           *(*create_group)();
        int             (*poll)();
+       int             (*set_errorhandler)();
+       void            (*error)();
 };
 
 #endif