Add support for L4Re Virtio Sockets
[src/app-framework-binder.git] / src / afb-api-v3.c
index 1fc6ebe..caaaff4 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016, 2017, 2018 "IoT.bzh"
+ * Copyright (C) 2016-2019 "IoT.bzh"
  * Author José Bollo <jose.bollo@iot.bzh>
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -21,7 +21,6 @@
 #include <string.h>
 #include <assert.h>
 #include <errno.h>
-#include <fnmatch.h>
 
 #include <json-c/json.h>
 
@@ -34,8 +33,9 @@
 #include "afb-auth.h"
 #include "afb-export.h"
 #include "afb-xreq.h"
-#include "verbose.h"
+#include "globmatch.h"
 #include "sig-monitor.h"
+#include "verbose.h"
 
 /*
  * Description of a binding
@@ -44,7 +44,9 @@ struct afb_api_v3 {
        int refcount;
        int count;
        struct afb_verb_v3 **verbs;
+#if WITH_LEGACY_BINDING_V2
        const struct afb_verb_v2 *verbsv2;
+#endif
        const struct afb_verb_v3 *verbsv3;
        struct afb_export *export;
        const char *info;
@@ -77,7 +79,9 @@ static struct afb_verb_v3 *search_dynamic_verb(struct afb_api_v3 *api, const cha
 void afb_api_v3_process_call(struct afb_api_v3 *api, struct afb_xreq *xreq)
 {
        const struct afb_verb_v3 *verbsv3;
+#if WITH_LEGACY_BINDING_V2
        const struct afb_verb_v2 *verbsv2;
+#endif
        const char *name;
 
        name = xreq->request.called_verb;
@@ -104,6 +108,7 @@ void afb_api_v3_process_call(struct afb_api_v3 *api, struct afb_xreq *xreq)
                return;
        }
 
+#if WITH_LEGACY_BINDING_V2
        /* look in legacy set */
        verbsv2 = api->verbsv2;
        if (verbsv2) {
@@ -116,7 +121,7 @@ void afb_api_v3_process_call(struct afb_api_v3 *api, struct afb_xreq *xreq)
                        }
                }
        }
-
+#endif
        afb_xreq_reply_unknown_verb(xreq);
 }
 
@@ -252,12 +257,14 @@ struct afb_export *afb_api_v3_export(struct afb_api_v3 *api)
        return api->export;
 }
 
+#if WITH_LEGACY_BINDING_V2
 void afb_api_v3_set_verbs_v2(
                struct afb_api_v3 *api,
                const struct afb_verb_v2 *verbs)
 {
        api->verbsv2 = verbs;
 }
+#endif
 
 void afb_api_v3_set_verbs_v3(
                struct afb_api_v3 *api,