Improve names
authorJosé Bollo <jose.bollo@iot.bzh>
Thu, 6 Apr 2017 12:51:08 +0000 (14:51 +0200)
committerJosé Bollo <jose.bollo@iot.bzh>
Thu, 6 Apr 2017 14:26:13 +0000 (16:26 +0200)
Change-Id: Ib7e31b50a725c73e6eaba414c6628524fbcd84f9
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
src/afb-xreq.c

index b64cefb..87e0155 100644 (file)
@@ -292,9 +292,9 @@ void afb_xreq_fail_f(struct afb_xreq *xreq, const char *status, const char *info
        free(message);
 }
 
-static int xcheck(struct afb_xreq *xreq, int stag)
+static int xcheck(struct afb_xreq *xreq, int sessionflags)
 {
-       if ((stag & (AFB_SESSION_CREATE|AFB_SESSION_CLOSE|AFB_SESSION_RENEW|AFB_SESSION_CHECK|AFB_SESSION_LOA_EQ)) != 0) {
+       if ((sessionflags & (AFB_SESSION_CREATE|AFB_SESSION_CLOSE|AFB_SESSION_RENEW|AFB_SESSION_CHECK|AFB_SESSION_LOA_EQ)) != 0) {
                if (!afb_context_check(&xreq->context)) {
                        afb_context_close(&xreq->context);
                        afb_xreq_fail_f(xreq, "failed", "invalid token's identity");
@@ -302,7 +302,7 @@ static int xcheck(struct afb_xreq *xreq, int stag)
                }
        }
 
-       if ((stag & AFB_SESSION_CREATE) != 0) {
+       if ((sessionflags & AFB_SESSION_CREATE) != 0) {
                if (afb_context_check_loa(&xreq->context, 1)) {
                        afb_xreq_fail_f(xreq, "failed", "invalid creation state");
                        return 0;
@@ -311,24 +311,24 @@ static int xcheck(struct afb_xreq *xreq, int stag)
                afb_context_refresh(&xreq->context);
        }
 
-       if ((stag & (AFB_SESSION_CREATE | AFB_SESSION_RENEW)) != 0)
+       if ((sessionflags & (AFB_SESSION_CREATE | AFB_SESSION_RENEW)) != 0)
                afb_context_refresh(&xreq->context);
 
-       if ((stag & AFB_SESSION_CLOSE) != 0) {
+       if ((sessionflags & AFB_SESSION_CLOSE) != 0) {
                afb_context_change_loa(&xreq->context, 0);
                afb_context_close(&xreq->context);
        }
 
-       if ((stag & AFB_SESSION_LOA_GE) != 0) {
-               int loa = (stag >> AFB_SESSION_LOA_SHIFT) & AFB_SESSION_LOA_MASK;
+       if ((sessionflags & AFB_SESSION_LOA_GE) != 0) {
+               int loa = (sessionflags >> AFB_SESSION_LOA_SHIFT) & AFB_SESSION_LOA_MASK;
                if (!afb_context_check_loa(&xreq->context, loa)) {
                        afb_xreq_fail_f(xreq, "failed", "invalid LOA");
                        return 0;
                }
        }
 
-       if ((stag & AFB_SESSION_LOA_LE) != 0) {
-               int loa = (stag >> AFB_SESSION_LOA_SHIFT) & AFB_SESSION_LOA_MASK;
+       if ((sessionflags & AFB_SESSION_LOA_LE) != 0) {
+               int loa = (sessionflags >> AFB_SESSION_LOA_SHIFT) & AFB_SESSION_LOA_MASK;
                if (afb_context_check_loa(&xreq->context, loa + 1)) {
                        afb_xreq_fail_f(xreq, "failed", "invalid LOA");
                        return 0;
@@ -337,9 +337,9 @@ static int xcheck(struct afb_xreq *xreq, int stag)
        return 1;
 }
 
-void afb_xreq_call(struct afb_xreq *xreq, int sessionflags, void (*callback)(struct afb_req req))
+void afb_xreq_call(struct afb_xreq *xreq, int sessionflags, void (*method)(struct afb_req req))
 {
        if (xcheck(xreq, sessionflags))
-               callback((struct afb_req){ .itf = &xreq_itf, .closure = xreq });
+               method((struct afb_req){ .itf = &xreq_itf, .closure = xreq });
 }