+static void startup_call_current(struct startup_req *sreq)
+{
+ char *api, *verb, *json;
+
+ api = sreq->current->value;
+ verb = strchr(api, '/');
+ if (verb) {
+ json = strchr(verb, ':');
+ if (json) {
+ memset(&sreq->xreq, 0, sizeof sreq->xreq);
+ afb_xreq_init(&sreq->xreq, &startup_xreq_itf);
+ afb_context_init(&sreq->xreq.context, sreq->session, NULL);
+ sreq->xreq.context.validated = 1;
+ sreq->xreq.cred = afb_cred_current();
+ sreq->api = strndup(api, verb - api);
+ sreq->verb = strndup(verb + 1, json - verb - 1);
+ sreq->xreq.api = sreq->api;
+ sreq->xreq.verb = sreq->verb;
+ sreq->xreq.json = json_tokener_parse(json + 1);
+ if (sreq->api && sreq->verb && sreq->xreq.json) {
+ afb_xreq_process(&sreq->xreq, main_apiset);
+ return;
+ }
+ }
+ }
+ ERROR("Bad call specification %s", sreq->current->value);
+ exit(1);
+}