diff -r 998844b5ed25 -r dbc01588686e src/server/object.h --- a/src/server/object.h Sun Nov 13 13:43:01 2011 +0100 +++ b/src/server/object.h Mon Dec 26 15:48:32 2011 +0100 @@ -30,6 +30,7 @@ #define OBJECT_H #include "nsapi.h" +#include "pool.h" #ifdef __cplusplus extern "C" { @@ -40,25 +41,33 @@ NSAPIAuthTrans = 0, NSAPINameTrans, NSAPIPathCheck, + NSAPIObjectType, NSAPIService, REQ_FINISH, NUM_NSAPI_TYPES }; typedef enum RequestPhase RequestPhase; +typedef struct Condition Condition; +typedef int8_t ConditionResult; + +typedef struct NSAPIContext NSAPIContext; +typedef struct HTTPObjectConfig HTTPObjectConfig; + struct directive { FuncStruct *func; pblock *param; + Condition *cond; }; struct dtable { - directive **directive; - int ndir; + directive **dirs; + int ndir; }; struct httpd_object { - char *name; - + char *name; + char *path; dtable *dt; int nd; }; @@ -68,9 +77,30 @@ int pos; }; +struct Condition { + Condition *parent; + int expression; + int index; /* used by NSAPIContext to link expression with result */ +}; + + +struct NSAPIContext{ + HTTPObjectConfig *conf; + + ConditionResult **results; + int nres; + + httpd_objset *objset; +}; + +struct HTTPObjectConfig { + httpd_object **objects; + int nobj; + pool_handle_t *pool; +}; /* - * create a new httpd_object + * creates a new httpd_object */ httpd_object* object_new(char *name); @@ -80,7 +110,7 @@ void object_free(httpd_object *obj); /* - * adds a directive to the object with the type dt (enum DirectiveType) + * adds a directive to the object with the type dt (enum RequestPhase) */ void object_add_directive(httpd_object *obj, directive *dir, int dt); @@ -90,6 +120,17 @@ #define object_get_dtable(obj,type) &obj->dt[type]; +/* + * creates a new HTTPObjectConfig + */ +// TODO + +/* + * adds an object to the object configuration + */ +void httpobjconf_add_object(HTTPObjectConfig *conf, httpd_object *obj); + + httpd_objset* create_test_objset();