wreq->xreq.context.flags = flags;
/* makes the call */
+ wreq->xreq.cred = afb_cred_addref(client->cred);
wreq->xreq.api = client->api;
wreq->xreq.verb = verb;
afb_apis_call(&wreq->xreq);
struct api_ws_server_req *wreq = CONTAINER_OF_XREQ(struct api_ws_server_req, xreq);
afb_context_disconnect(&wreq->xreq.context);
+ afb_cred_unref(wreq->xreq.cred);
json_object_put(wreq->xreq.json);
free(wreq->rcvdata);
api_ws_server_client_unref(wreq->client);
#include "afb-apis.h"
#include "afb-context.h"
#include "afb-xreq.h"
+#include "afb-cred.h"
#include "verbose.h"
#include "jobs.h"
struct subcall *subcall = CONTAINER_OF_XREQ(struct subcall, xreq);
json_object_put(subcall->xreq.json);
+ afb_cred_unref(subcall->xreq.cred);
afb_xreq_unref(subcall->caller);
free(subcall);
}
afb_xreq_init(&subcall->xreq, &afb_subcall_xreq_itf);
afb_context_subinit(&subcall->xreq.context, &caller->context);
+ subcall->xreq.cred = afb_cred_addref(caller->cred);
subcall->xreq.json = args;
subcall->xreq.api = api; /* TODO: alloc ? */
subcall->xreq.verb = verb; /* TODO: alloc ? */
#include "afb-msg-json.h"
#include "afb-svc.h"
#include "afb-xreq.h"
+#include "afb-cred.h"
#include "afb-apis.h"
#include "verbose.h"
afb_xreq_init(&svcreq->xreq, &afb_svc_xreq_itf);
afb_context_init(&svcreq->xreq.context, svc->session, NULL);
svcreq->xreq.context.validated = 1;
+ svcreq->xreq.cred = afb_cred_current();
svcreq->xreq.api = api;
svcreq->xreq.verb = verb;
svcreq->xreq.listener = svc->listener;
struct svc_req *svcreq = CONTAINER_OF_XREQ(struct svc_req, xreq);
afb_context_disconnect(&svcreq->xreq.context);
json_object_put(svcreq->xreq.json);
+ afb_cred_unref(svcreq->xreq.cred);
free(svcreq);
}
/* fill and record the request */
afb_wsj1_msg_addref(msg);
wsreq->msgj1 = msg;
+ wsreq->xreq.cred = afb_cred_addref(ws->cred);
wsreq->xreq.api = api;
wsreq->xreq.verb = verb;
wsreq->xreq.json = afb_wsj1_msg_object_j(wsreq->msgj1);
afb_context_disconnect(&wsreq->xreq.context);
afb_wsj1_msg_unref(wsreq->msgj1);
+ afb_cred_unref(wsreq->xreq.cred);
aws_unref(wsreq->aws);
free(wsreq);
}
struct json_object;
struct afb_evt_listener;
struct afb_xreq;
+struct afb_cred;
struct afb_xreq_query_itf {
struct json_object *(*json)(struct afb_xreq *xreq);
int hookflags; /**< flags for hooking */
int hookindex; /**< index for hooking */
struct afb_evt_listener *listener;
+ struct afb_cred *cred;
};
#define CONTAINER_OF_XREQ(type,x) ((type*)(((intptr_t)(x))-((intptr_t)&(((type*)NULL)->xreq))))
#include "afb-context.h"
#include "afb-hreq.h"
#include "afb-xreq.h"
+#include "afb-cred.h"
#include "jobs.h"
#include "afb-session.h"
#include "verbose.h"
free(sreq->api);
free(sreq->verb);
json_object_put(sreq->xreq.json);
+ afb_cred_unref(sreq->xreq.cred);
sreq->current = sreq->current->next;
if (sreq->current)
startup_call_current(sreq);
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;