blob: 914866157dc67a569406d73e167ba72f39124217 [file] [log] [blame]
/**
* @file plugins_exts.c
* @author Radek Krejci <rkrejci@cesnet.cz>
* @brief Internally implemented YANG extensions.
*
* Copyright (c) 2019 CESNET, z.s.p.o.
*
* This source code is licensed under BSD 3-Clause License (the "License").
* You may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://opensource.org/licenses/BSD-3-Clause
*/
#include "plugins_exts.h"
#include <stdint.h>
#include <string.h>
#include "common.h"
#include "plugins_exts_metadata.c"
#include "plugins_exts_nacm.c"
#include "plugins_exts_yangdata.c"
/**
* @brief list of all extension plugins implemented internally
*/
struct lyext_plugins_list lyext_plugins_internal[] = {
{"ietf-netconf-acm", "2012-02-22", "default-deny-write", &nacm_plugin},
{"ietf-netconf-acm", "2018-02-14", "default-deny-write", &nacm_plugin},
{"ietf-netconf-acm", "2012-02-22", "default-deny-all", &nacm_plugin},
{"ietf-netconf-acm", "2018-02-14", "default-deny-all", &nacm_plugin},
{"ietf-yang-metadata", "2016-08-05", "annotation", &metadata_plugin},
{"ietf-restconf", "2017-01-26", "yang-data", &yangdata_plugin},
{NULL, NULL, NULL, NULL} /* terminating item */
};
/* TODO support for external extension plugins */
struct lyext_plugin *
lyext_get_plugin(struct lysc_ext *ext)
{
for (uint8_t u = 0; lyext_plugins_internal[u].module; ++u) {
if (!strcmp(ext->name, lyext_plugins_internal[u].name) &&
!strcmp(ext->module->name, lyext_plugins_internal[u].module) &&
(!lyext_plugins_internal[u].revision || !strcmp(ext->module->revision, lyext_plugins_internal[u].revision))) {
/* we have the match */
return lyext_plugins_internal[u].plugin;
}
}
return NULL;
}