From 04241c8168fe8826b4fc7a80500577b50936b57a Mon Sep 17 00:00:00 2001 From: José Bollo Date: Tue, 10 Oct 2017 18:21:54 +0200 Subject: Add the function afb_req_get_uid MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I9caf38ee3811cf10b546489094f0bb5b3d844c40 Signed-off-by: José Bollo --- include/afb/afb-req.h | 11 +++++++++++ include/afb/afb-request-itf.h | 3 +++ include/afb/afb-request.h | 11 +++++++++++ 3 files changed, 25 insertions(+) (limited to 'include/afb') diff --git a/include/afb/afb-req.h b/include/afb/afb-req.h index 6f98e900..af33108c 100644 --- a/include/afb/afb-req.h +++ b/include/afb/afb-req.h @@ -420,3 +420,14 @@ static inline char *afb_req_get_application_id(struct afb_req req) return req.itf->get_application_id(req.closure); } +/* + * Get the user identifier (UID) of the client application for the + * request 'req'. + * + * Returns -1 when the application can not be identified. + */ +static inline int afb_req_get_uid(struct afb_req req) +{ + return req.itf->get_uid(req.closure); +} + diff --git a/include/afb/afb-request-itf.h b/include/afb/afb-request-itf.h index e542442c..d9d9c835 100644 --- a/include/afb/afb-request-itf.h +++ b/include/afb/afb-request-itf.h @@ -198,5 +198,8 @@ struct afb_request_itf void (*callback)(void*, int, struct json_object*, struct afb_request *request), void *cb_closure); + int (*get_uid)( + struct afb_request *request); + }; diff --git a/include/afb/afb-request.h b/include/afb/afb-request.h index fcab03c3..f9a1bbbb 100644 --- a/include/afb/afb-request.h +++ b/include/afb/afb-request.h @@ -376,3 +376,14 @@ static inline char *afb_request_get_application_id(struct afb_request *request) return request->itf->get_application_id(request); } +/* + * Get the user identifier (UID) of the client for the + * request 'request'. + * + * Returns -1 when the application can not be identified. + */ +static inline int afb_request_get_uid(struct afb_request *request) +{ + return request->itf->get_uid(request); +} + -- cgit 1.2.3-korg