lib: Added more indirection for child handling.
[ashd.git] / lib / cf.h
index a1eadb0..35529c2 100644 (file)
--- a/lib/cf.h
+++ b/lib/cf.h
@@ -15,9 +15,14 @@ struct cfstate {
 struct child {
     struct child *next;
     char *name;
-    int type;
-    char **argv;
-    int fd;
+    struct chandler *iface;
+    void *pdata;
+};
+
+struct chandler {
+    int (*handle)(struct child *ch, struct hthead *req, int fd, void (*chinit)(void *), void *idata);
+    void (*merge)(struct child *dst, struct child *src);
+    void (*destroy)(struct child *ch);
 };
 
 void skipcfblock(struct cfstate *s);
@@ -26,7 +31,9 @@ void freecfparser(struct cfstate *s);
 char **getcfline(struct cfstate *s);
 char *findstdconf(char *name);
 
+struct child *newchild(char *name, struct chandler *iface, void *pdata);
 void freechild(struct child *ch);
+void mergechildren(struct child *dst, struct child *src);
 struct child *parsechild(struct cfstate *s);
 int childhandle(struct child *ch, struct hthead *req, int fd, void (*chinit)(void *), void *idata);