From 6caade489f8bd15dccdde6c69452d920ead2201e Mon Sep 17 00:00:00 2001 From: José Bollo Date: Thu, 2 Aug 2018 18:48:57 +0200 Subject: Add the external binding feature MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit introduce two new features: TODO: manage security by setting correct Smack label to the exported files Bugs-AGL: SPEC-1439 Bugs-AGL: SPEC-1663 Change-Id: I70aad7d523ece7a2ae0058b79708a02ef81144e2 Signed-off-by: José Bollo --- src/wgt-json.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'src/wgt-json.c') diff --git a/src/wgt-json.c b/src/wgt-json.c index bb1ba55..f4212d0 100644 --- a/src/wgt-json.c +++ b/src/wgt-json.c @@ -387,6 +387,26 @@ static int add_required_api(struct json_object *targets, const struct wgt_desc_f return add_targeted_params(targets, feat, actions); } +/* Treats the feature "provided_binding" */ +static int add_provided_binding(struct json_object *targets, const struct wgt_desc_feature *feat) +{ + static struct paramaction actions[] = { + { .name = string_sharp_target, .action = NULL, .closure = NULL }, /* TODO: should be an error! */ + { .name = NULL, .action = add_param_array, .closure = (void*)string_provided_binding } + }; + return add_targeted_params(targets, feat, actions); +} + +/* Treats the feature "required_binding" */ +static int add_required_binding(struct json_object *targets, const struct wgt_desc_feature *feat) +{ + static struct paramaction actions[] = { + { .name = string_sharp_target, .action = NULL, .closure = NULL }, /* skip #target */ + { .name = NULL, .action = add_param_array, .closure = (void*)string_required_binding } + }; + return add_targeted_params(targets, feat, actions); +} + /* Treats the feature "required_permission" */ static int add_required_permission(struct json_object *targets, const struct wgt_desc_feature *feat) { @@ -460,9 +480,15 @@ static struct json_object *to_json(const struct wgt_desc *desc) else if (!strcmp(featname, string_provided_api)) { rc2 = add_provided_api(targets, feat); } + else if (!strcmp(featname, string_provided_binding)) { + rc2 = add_provided_binding(targets, feat); + } else if (!strcmp(featname, string_required_api)) { rc2 = add_required_api(targets, feat); } + else if (!strcmp(featname, string_required_binding)) { + rc2 = add_required_binding(targets, feat); + } else if (!strcmp(featname, string_required_permission)) { rc2 = add_required_permission(targets, feat); } else { -- cgit 1.2.3-korg