57 } |
57 } |
58 |
58 |
59 FuncStruct* get_function(char *name) { |
59 FuncStruct* get_function(char *name) { |
60 return ucx_map_cstr_get(function_map, name); |
60 return ucx_map_cstr_get(function_map, name); |
61 } |
61 } |
|
62 |
|
63 FuncStruct* func_resolve(pblock *pb, Session *sn, Request *rq) { |
|
64 char *name = pblock_findkeyval(pb_key_fn, pb); |
|
65 if(name == NULL) { |
|
66 // TODO: error |
|
67 return NULL; |
|
68 } |
|
69 |
|
70 FuncStruct *func = get_function(name); |
|
71 if(func == NULL) { |
|
72 // TODO: error |
|
73 } |
|
74 return func; |
|
75 } |
|
76 |
|
77 int func_exec (pblock *pb, Session *sn, Request *rq) { |
|
78 FuncStruct *func = func_resolve(pb, sn, rq); |
|
79 if(func == NULL) { |
|
80 return REQ_ABORTED; |
|
81 } |
|
82 return func->func(pb, sn, rq); |
|
83 } |
|
84 |