diff --git a/dmtree/tr181/hosts-iopsyswrt.c b/dmtree/tr181/hosts-iopsyswrt.c index 63d15c0c..c3f6ce60 100644 --- a/dmtree/tr181/hosts-iopsyswrt.c +++ b/dmtree/tr181/hosts-iopsyswrt.c @@ -88,48 +88,6 @@ int os__get_Hosts_HostNumberOfEntries(char *refparam, struct dmctx *ctx, void *d return 0; } -int os__get_HostsHost_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - struct uci_section *s = NULL; - - char *macaddr = dmjson_get_value((json_object *)data, 1, "macaddr"); - uci_path_foreach_sections(bbfdm, "dmmap", "hosts", s) { - char *mac; - dmuci_get_value_by_section_string(s, "mac", &mac); - if (strcmp(mac, macaddr) == 0) { - dmuci_get_value_by_section_string(s, "alias", value); - break; - } - } - if ((*value)[0] == '\0') - dmasprintf(value, "cpe-%s", instance); - return 0; -} - -int os__set_HostsHost_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - struct uci_section *s = NULL, *dmmap = NULL; - char *macaddr, *v; - - switch (action) { - case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) - return FAULT_9007; - break; - case VALUESET: - macaddr = dmjson_get_value((json_object *)data, 1, "macaddr"); - uci_path_foreach_option_eq(bbfdm, "dmmap", "hosts", "mac", macaddr, s) { - dmuci_set_value_by_section_bbfdm(s, "alias", value); - return 0; - } - dmuci_add_section_bbfdm("dmmap", "hosts", &dmmap, &v); - dmuci_set_value_by_section(dmmap, "mac", macaddr); - dmuci_set_value_by_section(dmmap, "alias", value); - break; - } - return 0; -} - /*#Device.Hosts.Host.{i}.PhysAddress!UBUS:router.network/hosts//hosts[@i-1].macaddr*/ int os__get_HostsHost_PhysAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { diff --git a/dmtree/tr181/hosts-openwrt.c b/dmtree/tr181/hosts-openwrt.c index a0e3e007..0420e859 100644 --- a/dmtree/tr181/hosts-openwrt.c +++ b/dmtree/tr181/hosts-openwrt.c @@ -40,24 +40,6 @@ int os__get_Hosts_HostNumberOfEntries(char *refparam, struct dmctx *ctx, void *d return not_implemented(value); } -int os__get_HostsHost_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__set_HostsHost_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) - return FAULT_9007; - break; - case VALUESET: - break; - } - return 0; -} - int os__get_HostsHost_PhysAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { return not_implemented(value); diff --git a/dmtree/tr181/hosts.c b/dmtree/tr181/hosts.c index 58cafd3a..45e7a8ec 100644 --- a/dmtree/tr181/hosts.c +++ b/dmtree/tr181/hosts.c @@ -14,7 +14,7 @@ /* *** Device.Hosts. *** */ DMOBJ tHostsObj[] = { /* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"Host", &DMREAD, NULL, NULL, NULL, os__browseHostsHostInst, NULL, NULL, NULL, tHostsHostObj, tHostsHostParams, get_linker_host, BBFDM_BOTH, LIST_KEY{"PhysAddress", "Alias", NULL}}, +{"Host", &DMREAD, NULL, NULL, NULL, os__browseHostsHostInst, NULL, NULL, NULL, tHostsHostObj, tHostsHostParams, get_linker_host, BBFDM_BOTH, LIST_KEY{"PhysAddress", NULL}}, {0} }; @@ -35,7 +35,6 @@ DMOBJ tHostsHostObj[] = { DMLEAF tHostsHostParams[] = { /* PARAM, permission, type, getvalue, setvalue, forced_inform, notification, bbfdm_type*/ -{"Alias", &DMWRITE, DMT_STRING, os__get_HostsHost_Alias, os__set_HostsHost_Alias, NULL, NULL, BBFDM_BOTH}, {"PhysAddress", &DMREAD, DMT_STRING, os__get_HostsHost_PhysAddress, NULL, NULL, NULL, BBFDM_BOTH}, {"IPAddress", &DMREAD, DMT_STRING, os__get_HostsHost_IPAddress, NULL, NULL, NULL, BBFDM_BOTH}, {"AddressSource", &DMREAD, DMT_STRING, os__get_HostsHost_AddressSource, NULL, NULL, NULL, BBFDM_BOTH}, diff --git a/dmtree/tr181/os.h b/dmtree/tr181/os.h index cc007847..2d3b7684 100644 --- a/dmtree/tr181/os.h +++ b/dmtree/tr181/os.h @@ -37,8 +37,6 @@ int os__browseHostsHostIPv4AddressInst(struct dmctx *dmctx, DMNODE *parent_node, int os__browseHostsHostIPv6AddressInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance); int get_linker_host(char *refparam, struct dmctx *dmctx, void *data, char *instance, char **linker); int os__get_Hosts_HostNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_HostsHost_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__set_HostsHost_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); int os__get_HostsHost_PhysAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); int os__get_HostsHost_IPAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); int os__get_HostsHost_AddressSource(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);