From b4aebc9c6d92d63bf2788be53c94196e21590198 Mon Sep 17 00:00:00 2001 From: Suvendhu Hansa Date: Mon, 15 Apr 2024 04:33:49 +0000 Subject: [PATCH] Moved Device.Time. vendor extensions to timemngr --- libbbfdm/dmtree/vendor/iopsys/extension.c | 1 - libbbfdm/dmtree/vendor/iopsys/times.c | 58 ----------------------- libbbfdm/dmtree/vendor/iopsys/times.h | 19 -------- 3 files changed, 78 deletions(-) delete mode 100644 libbbfdm/dmtree/vendor/iopsys/times.c delete mode 100644 libbbfdm/dmtree/vendor/iopsys/times.h diff --git a/libbbfdm/dmtree/vendor/iopsys/extension.c b/libbbfdm/dmtree/vendor/iopsys/extension.c index af4091ca..e488eaec 100644 --- a/libbbfdm/dmtree/vendor/iopsys/extension.c +++ b/libbbfdm/dmtree/vendor/iopsys/extension.c @@ -20,7 +20,6 @@ DM_MAP_OBJ tDynamicObj[] = { /* parentobj, nextobject, parameter */ {"Device.DeviceInfo.", NULL, tIOPSYS_DeviceInfoParams}, -{"Device.Time.", NULL, tIOPSYS_TimeParams}, {"Device.Bridging.Bridge.{i}.Port.{i}.", NULL, tIOPSYS_BridgingBridgePortParams}, {"Device.WiFi.AccessPoint.{i}.", NULL, tIOPSYS_WiFiAccessPointParams}, {0} diff --git a/libbbfdm/dmtree/vendor/iopsys/times.c b/libbbfdm/dmtree/vendor/iopsys/times.c deleted file mode 100644 index 6583356b..00000000 --- a/libbbfdm/dmtree/vendor/iopsys/times.c +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (C) 2021 iopsys Software Solutions AB - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 2.1 - * as published by the Free Software Foundation - * - * Author Amin Ben Ramdhane - * - */ - -#include "times.h" - -static int get_local_time_zone_name(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - dmuci_get_option_value_string("system", "@system[0]", "zonename", value); - replace_char(*value, ' ', '_'); - - return 0; -} - -static int get_time_source_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - char *iface = NULL; - - dmuci_get_option_value_string("system", "ntp", "interface", &iface); - adm_entry_get_reference_param(ctx, "Device.IP.Interface.*.Name", iface, value); - return 0; -} - -static int set_time_source_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - char *allowed_objects[] = {"Device.IP.Interface.", NULL}; - struct dm_reference reference = {0}; - - bbf_get_reference_args(value, &reference); - - switch (action) { - case VALUECHECK: - if (dm_validate_allowed_objects(ctx, &reference, allowed_objects)) - return FAULT_9007; - break; - case VALUESET: - dmuci_set_value("system", "ntp", "interface", reference.value); - return 0; - } - return 0; -} - -/********************************************************************************************************************************** -* OBJ & PARAM DEFINITION -***********************************************************************************************************************************/ -DMLEAF tIOPSYS_TimeParams[] = { -/* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/ -{BBF_VENDOR_PREFIX"LocalTimeZoneName", &DMREAD, DMT_STRING, get_local_time_zone_name, NULL, BBFDM_BOTH}, -{BBF_VENDOR_PREFIX"SourceInterface", &DMWRITE, DMT_STRING, get_time_source_interface, set_time_source_interface, BBFDM_BOTH, DM_FLAG_REFERENCE}, -{0} -}; diff --git a/libbbfdm/dmtree/vendor/iopsys/times.h b/libbbfdm/dmtree/vendor/iopsys/times.h deleted file mode 100644 index 7558c1cf..00000000 --- a/libbbfdm/dmtree/vendor/iopsys/times.h +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (C) 2021 iopsys Software Solutions AB - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 2.1 - * as published by the Free Software Foundation - * - * Author Amin Ben Ramdhane - * - */ - -#ifndef __IOPSYS_TIMES_H -#define __IOPSYS_TIMES_H - -#include "libbbfdm-api/dmcommon.h" - -extern DMLEAF tIOPSYS_TimeParams[]; - -#endif //__IOPSYS_TIMES_H