/*
- * Copyright (C) 2015 "IoT.bzh"
+ * Copyright (C) 2015, 2016 "IoT.bzh"
* Author "Fulup Ar Foll"
*
* Licensed under the Apache License, Version 2.0 (the "License");
struct AFB_clientCtx
{
unsigned refcount;
+ unsigned loa;
time_t expiration; // expiration time of the token
time_t access;
char uuid[37]; // long term authentication of remote client
return clientCtx->token;
}
+unsigned ctxClientGetLOA (struct AFB_clientCtx *clientCtx)
+{
+ assert(clientCtx != NULL);
+ return clientCtx->loa;
+}
+
+void ctxClientSetLOA (struct AFB_clientCtx *clientCtx, unsigned loa)
+{
+ assert(clientCtx != NULL);
+ clientCtx->loa = loa;
+}
+
void *ctxClientValueGet(struct AFB_clientCtx *clientCtx, int index)
{
assert(clientCtx != NULL);
assert(index < sessions.apicount);
prev = clientCtx->values[index];
clientCtx->values[index] = (struct client_value){.value = value, .free_value = free_value};
- if (prev.value != NULL && prev.free_value != NULL)
+ if (prev.value != NULL && prev.value != value && prev.free_value != NULL)
prev.free_value(prev.value);
}