+ if ((stag & AFB_SESSION_LOA_GE) != 0) {
+ int loa = (stag >> AFB_SESSION_LOA_SHIFT) & AFB_SESSION_LOA_MASK;
+ if (!afb_context_check_loa(context, loa)) {
+ afb_req_fail(req, "failed", "invalid LOA");
+ return 0;
+ }
+ }
+
+ if ((stag & AFB_SESSION_LOA_LE) != 0) {
+ int loa = (stag >> AFB_SESSION_LOA_SHIFT) & AFB_SESSION_LOA_MASK;
+ if (afb_context_check_loa(context, loa + 1)) {
+ afb_req_fail(req, "failed", "invalid LOA");
+ return 0;
+ }
+ }
+ return 1;
+}
+
+static void call_cb(void *closure, struct afb_req req, struct afb_context *context, const char *strverb, size_t lenverb)
+{
+ const struct afb_verb_desc_v1 *verb;
+ struct api_so_desc *desc = closure;
+
+ verb = desc->binding->v1.verbs;
+ while (verb->name && (strncasecmp(verb->name, strverb, lenverb) || verb->name[lenverb]))
+ verb++;
+ if (!verb->name)
+ afb_req_fail_f(req, "unknown-verb", "verb %.*s unknown within api %s", (int)lenverb, strverb, desc->binding->v1.prefix);
+ else if (call_check(req, context, verb)) {
+ afb_thread_req_call(req, verb->callback, api_timeout, desc);
+ }