--- a/src/server/daemon/func.c Thu Feb 16 15:08:38 2012 +0100 +++ b/src/server/daemon/func.c Wed Feb 22 23:20:39 2012 +0100 @@ -30,7 +30,7 @@ #include <stdlib.h> #include "../public/nsapi.h" - +#include "../util/pblock.h" #include "../ucx/map.h" #include "func.h" @@ -59,3 +59,26 @@ FuncStruct* get_function(char *name) { return ucx_map_cstr_get(function_map, name); } + +FuncStruct* func_resolve(pblock *pb, Session *sn, Request *rq) { + char *name = pblock_findkeyval(pb_key_fn, pb); + if(name == NULL) { + // TODO: error + return NULL; + } + + FuncStruct *func = get_function(name); + if(func == NULL) { + // TODO: error + } + return func; +} + +int func_exec (pblock *pb, Session *sn, Request *rq) { + FuncStruct *func = func_resolve(pb, sn, rq); + if(func == NULL) { + return REQ_ABORTED; + } + return func->func(pb, sn, rq); +} +