aboutsummaryrefslogtreecommitdiffstats
path: root/src/afb-api-v3.c
diff options
context:
space:
mode:
authorJose Bollo <jose.bollo@iot.bzh>2019-02-18 14:31:25 +0100
committerJosé Bollo <jose.bollo@iot.bzh>2019-04-02 09:58:49 +0200
commitec0564bc90b3c63f7e82f09e81db8bd2cfac89a2 (patch)
treeb61f04cc61fb45af20dd594c4eab2f0ae623fc01 /src/afb-api-v3.c
parent2ba7c200c6c4844b63f8f707a6f04017661f16ca (diff)
Add conditionnal support of bindings version 2
Bindings version 2 will become legacy soon. This patch allows their removal Change-Id: Iecad3abd0ddd714e5d55c0b935be756a29d1ca37 Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'src/afb-api-v3.c')
-rw-r--r--src/afb-api-v3.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/afb-api-v3.c b/src/afb-api-v3.c
index 95727065..7b889ee8 100644
--- a/src/afb-api-v3.c
+++ b/src/afb-api-v3.c
@@ -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,