summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/afb/afb-plugin.h28
-rw-r--r--include/afb/afb-req-itf.h12
2 files changed, 33 insertions, 7 deletions
diff --git a/include/afb/afb-plugin.h b/include/afb/afb-plugin.h
index c457f853..41e53ce1 100644
--- a/include/afb/afb-plugin.h
+++ b/include/afb/afb-plugin.h
@@ -59,7 +59,33 @@ enum AFB_session_v1
AFB_SESSION_CLOSE = 2, /* closes the session after authentification */
AFB_SESSION_RENEW = 4, /* refreshes the token after authentification */
AFB_SESSION_CHECK = 8, /* enforce authentification */
- AFB_SESSION_MASK = 15 /* convenient mask used internally, bit-or of the previous masks */
+
+ AFB_SESSION_LOA_GE = 16, /* check that the LOA is greater or equal to the given value */
+ AFB_SESSION_LOA_LE = 32, /* check that the LOA is lesser or equal to the given value */
+ AFB_SESSION_LOA_EQ = 48, /* check that the LOA is equal to the given value */
+
+ AFB_SESSION_LOA_SHIFT = 6, /* shift for LOA */
+ AFB_SESSION_LOA_MASK = 3, /* mask for LOA */
+
+ AFB_SESSION_LOA_0 = 0, /* value for LOA of 0 */
+ AFB_SESSION_LOA_1 = 64, /* value for LOA of 1 */
+ AFB_SESSION_LOA_2 = 128, /* value for LOA of 2 */
+ AFB_SESSION_LOA_3 = 192, /* value for LOA of 3 */
+
+ AFB_SESSION_LOA_LE_0 = AFB_SESSION_LOA_LE | AFB_SESSION_LOA_0, /* check LOA <= 0 */
+ AFB_SESSION_LOA_LE_1 = AFB_SESSION_LOA_LE | AFB_SESSION_LOA_1, /* check LOA <= 1 */
+ AFB_SESSION_LOA_LE_2 = AFB_SESSION_LOA_LE | AFB_SESSION_LOA_2, /* check LOA <= 2 */
+ AFB_SESSION_LOA_LE_3 = AFB_SESSION_LOA_LE | AFB_SESSION_LOA_3, /* check LOA <= 3 */
+
+ AFB_SESSION_LOA_GE_0 = AFB_SESSION_LOA_GE | AFB_SESSION_LOA_0, /* check LOA >= 0 */
+ AFB_SESSION_LOA_GE_1 = AFB_SESSION_LOA_GE | AFB_SESSION_LOA_1, /* check LOA >= 1 */
+ AFB_SESSION_LOA_GE_2 = AFB_SESSION_LOA_GE | AFB_SESSION_LOA_2, /* check LOA >= 2 */
+ AFB_SESSION_LOA_GE_3 = AFB_SESSION_LOA_GE | AFB_SESSION_LOA_3, /* check LOA >= 3 */
+
+ AFB_SESSION_LOA_EQ_0 = AFB_SESSION_LOA_EQ | AFB_SESSION_LOA_0, /* check LOA == 0 */
+ AFB_SESSION_LOA_EQ_1 = AFB_SESSION_LOA_EQ | AFB_SESSION_LOA_1, /* check LOA == 1 */
+ AFB_SESSION_LOA_EQ_2 = AFB_SESSION_LOA_EQ | AFB_SESSION_LOA_2, /* check LOA == 2 */
+ AFB_SESSION_LOA_EQ_3 = AFB_SESSION_LOA_EQ | AFB_SESSION_LOA_3 /* check LOA == 3 */
};
/*
diff --git a/include/afb/afb-req-itf.h b/include/afb/afb-req-itf.h
index 6984d0fa..454c1817 100644
--- a/include/afb/afb-req-itf.h
+++ b/include/afb/afb-req-itf.h
@@ -42,7 +42,7 @@ struct afb_req_itf {
void (*unref)(void *closure);
void (*session_close)(void *closure);
- void (*session_set_LOA)(void *closure, unsigned level);
+ int (*session_set_LOA)(void *closure, unsigned level);
};
struct afb_req {
@@ -97,7 +97,7 @@ static inline void *afb_req_context_get(struct afb_req req)
static inline void afb_req_context_set(struct afb_req req, void *value, void (*free_value)(void*))
{
- return req.itf->context_set(req.closure, value, free_value);
+ req.itf->context_set(req.closure, value, free_value);
}
static inline void *afb_req_context(struct afb_req req, void *(*create_value)(), void (*free_value)(void*))
@@ -118,20 +118,20 @@ static inline void afb_req_context_clear(struct afb_req req)
static inline void afb_req_addref(struct afb_req req)
{
- return req.itf->addref(req.closure);
+ req.itf->addref(req.closure);
}
static inline void afb_req_unref(struct afb_req req)
{
- return req.itf->unref(req.closure);
+ req.itf->unref(req.closure);
}
static inline void afb_req_session_close(struct afb_req req)
{
- return req.itf->session_close(req.closure);
+ req.itf->session_close(req.closure);
}
-static inline void afb_req_session_set_LOA(struct afb_req req, unsigned level)
+static inline int afb_req_session_set_LOA(struct afb_req req, unsigned level)
{
return req.itf->session_set_LOA(req.closure, level);
}