Code Review
/
src
/
app-framework-binder.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
websocket: cleanup
[src/app-framework-binder.git]
/
src
/
afb-api-dyn.c
diff --git
a/src/afb-api-dyn.c
b/src/afb-api-dyn.c
index
8802210
..
0667f51
100644
(file)
--- a/
src/afb-api-dyn.c
+++ b/
src/afb-api-dyn.c
@@
-58,11
+58,14
@@
int afb_api_dyn_add_verb(
const char *verb,
const char *info,
void (*callback)(struct afb_request *request),
const char *verb,
const char *info,
void (*callback)(struct afb_request *request),
+ void *vcbdata,
const struct afb_auth *auth,
uint32_t session)
{
struct afb_api_dyn_verb *v, **vv;
const struct afb_auth *auth,
uint32_t session)
{
struct afb_api_dyn_verb *v, **vv;
+ afb_api_dyn_sub_verb(dynapi, verb);
+
vv = realloc(dynapi->verbs, (1 + dynapi->count) * sizeof *vv);
if (!vv)
goto oom;
vv = realloc(dynapi->verbs, (1 + dynapi->count) * sizeof *vv);
if (!vv)
goto oom;
@@
-73,6
+76,7
@@
int afb_api_dyn_add_verb(
goto oom;
v->callback = callback;
goto oom;
v->callback = callback;
+ v->vcbdata = vcbdata;
v->auth = auth;
v->session = session;
v->auth = auth;
v->session = session;
@@
-114,19
+118,21
@@
int afb_api_dyn_sub_verb(
static void call_cb(void *closure, struct afb_xreq *xreq)
{
struct afb_api_dyn *dynapi = closure;
static void call_cb(void *closure, struct afb_xreq *xreq)
{
struct afb_api_dyn *dynapi = closure;
- struct afb_api_dyn_verb **verbs;
+ struct afb_api_dyn_verb **verbs
, *v
;
const struct afb_verb_v2 *verbsv2;
int i;
const char *name;
const struct afb_verb_v2 *verbsv2;
int i;
const char *name;
- name = xreq->verb;
+ name = xreq->
request.
verb;
xreq->request.dynapi = (void*)dynapi->export; /* hack: this avoids to export afb_export structure */
/* look first in dyna mic verbs */
verbs = dynapi->verbs;
i = dynapi->count;
while (i) {
xreq->request.dynapi = (void*)dynapi->export; /* hack: this avoids to export afb_export structure */
/* look first in dyna mic verbs */
verbs = dynapi->verbs;
i = dynapi->count;
while (i) {
- if (!strcasecmp(verbs[--i]->verb, name)) {
+ v = verbs[--i];
+ if (!strcasecmp(v->verb, name)) {
+ xreq->request.vcbdata = v->vcbdata;
afb_xreq_call_verb_vdyn(xreq, verbs[i]);
return;
}
afb_xreq_call_verb_vdyn(xreq, verbs[i]);
return;
}
@@
-268,7
+274,7
@@
int afb_api_dyn_add(struct afb_apiset *apiset, const char *name, const char *inf
goto error;
}
INFO("binding %s added to set %s", afb_export_apiname(dynapi->export), afb_apiset_name(apiset));
goto error;
}
INFO("binding %s added to set %s", afb_export_apiname(dynapi->export), afb_apiset_name(apiset));
- return
1
;
+ return
0
;
error:
afb_export_destroy(export);
error:
afb_export_destroy(export);