summaryrefslogtreecommitdiffstats
path: root/src/afb-context.c
diff options
context:
space:
mode:
authorJose Bollo <jose.bollo@iot.bzh>2019-10-28 18:02:36 +0100
committerJose Bollo <jose.bollo@iot.bzh>2019-11-20 09:30:07 +0100
commit29ae81fa15c6080fd27929f4cc78e1289cb920e9 (patch)
treea6c93d41d8285652ba38ee121b1d2792e13fe244 /src/afb-context.c
parent1b240e6b92eb3762594312cc603180ae5ce77f72 (diff)
Introduce object for tokensicefish_8.99.1icefish/8.99.18.99.1
For further optimizations, the token is represented by a specific structure. Bug-AGL: SPEC-2968 Change-Id: I3d46a12c8c16809c6cc1d543fa2e6309927ed84d Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'src/afb-context.c')
-rw-r--r--src/afb-context.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/afb-context.c b/src/afb-context.c
index fd394939..6057e69d 100644
--- a/src/afb-context.c
+++ b/src/afb-context.c
@@ -50,12 +50,19 @@ void afb_context_init(struct afb_context *context, struct afb_session *session,
init_context(context, afb_session_addref(session), token);
}
+void afb_context_init_validated(struct afb_context *context, struct afb_session *session)
+{
+ afb_context_init(context, session, NULL);
+ context->validated = 1;
+}
+
void afb_context_subinit(struct afb_context *context, struct afb_context *super)
{
context->session = super->session;
context->flags = 0;
context->super = super;
context->api_key = NULL;
+ context->token = NULL;
context->validated = super->validated;
}
@@ -75,6 +82,14 @@ int afb_context_connect(struct afb_context *context, const char *uuid, const cha
return 0;
}
+int afb_context_connect_validated(struct afb_context *context, const char *uuid)
+{
+ int rc = afb_context_connect(context, uuid, NULL);
+ if (!rc)
+ context->validated = 1;
+ return rc;
+}
+
void afb_context_disconnect(struct afb_context *context)
{
if (context->session && !context->super) {