Ticket refs #2845: bbf: add support the case uci config is updated manually

This commit is contained in:
Amin Ben Ramdhane 2020-08-21 09:29:30 +01:00
parent 83f69f9c53
commit bbecdd7444
51 changed files with 1077 additions and 658 deletions

View file

@ -282,7 +282,7 @@ int browse_obj(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *
//UCI: arg1=type :: arg2=uci_file :: arg3=uci_section_type :: arg4=uci_dmmap_file :: arg5="" :: arg6=""
char buf_instance[64] = "", buf_alias[64] = "", *prefix_obj = NULL, *object = NULL;
char *instance = NULL, *instnbr = NULL;
char *inst = NULL, *max_inst = NULL;
struct dmmap_dup *p;
LIST_HEAD(dup_list);
@ -298,8 +298,11 @@ int browse_obj(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *
if(arg2 && arg3 && arg4) {
synchronize_specific_config_sections_with_dmmap(arg2, arg3, arg4, &dup_list);
list_for_each_entry(p, &dup_list, list) {
instance = handle_update_instance(1, dmctx, &instnbr, update_instance_alias, 3, p->dmmap_section, buf_instance, buf_alias);
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, instance) == DM_STOP)
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
p->dmmap_section, buf_instance, buf_alias, arg4, arg3);
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, inst) == DM_STOP)
break;
}
}
@ -309,7 +312,7 @@ int browse_obj(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *
//UBUS: arg1=type :: arg2=ubus_object :: arg3=ubus_method :: arg4=ubus_args1 :: arg5=ubus_args2 :: arg6=ubus_key
json_object *res = NULL, *dyn_obj = NULL, *arrobj = NULL;
char *idx, *idx_last = NULL;
char *inst, *max_inst = NULL;
int id = 0, j = 0;
if (arg2 && arg3 && arg4 && arg5)
@ -318,8 +321,8 @@ int browse_obj(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *
dmubus_call(arg2, arg3, UBUS_ARGS{{}}, 0, &res);
if (res && arg6) {
dmjson_foreach_obj_in_array(res, arrobj, dyn_obj, j, 1, arg6) {
idx = handle_update_instance(1, dmctx, &idx_last, update_instance_without_section, 1, ++id);
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)dyn_obj, idx) == DM_STOP)
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_without_section, 1, ++id);
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)dyn_obj, inst) == DM_STOP)
break;
}
}
@ -363,7 +366,7 @@ static int add_obj(char *refparam, struct dmctx *ctx, void *data, char **instanc
dmuci_add_section_bbfdm(arg4, arg3, &dmmap, &v);
dmuci_set_value_by_section(dmmap, "section_name", sect_name);
*instance = update_instance_bbfdm(dmmap, inst, buf_instance);
*instance = update_instance(dmmap, inst, buf_instance);
}
}
return 0;

View file

@ -55,26 +55,26 @@
/*** UPNP ***/
#ifdef BBF_TR064
DMOBJ tEntry181ObjUPNP[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{(char *)&dmroot, &DMREAD, NULL, NULL, NULL, NULL, &DMFINFRM, &DMNONE, tRoot181ObjUPNP, NULL, NULL, BBFDM_BOTH},
{0}
};
DMOBJ tRoot181ObjUPNP[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"BBF", &DMREAD, NULL, NULL, NULL, NULL, &DMFINFRM, &DMNONE, tRoot181ObjUPNPBBF, NULL, NULL, BBFDM_BOTH},
{"UPnP", &DMREAD, NULL, NULL, NULL, NULL, &DMFINFRM, &DMNONE, tRoot181ObjUPNPDMROOT, NULL, NULL, BBFDM_BOTH},
{0}
};
DMOBJ tRoot181ObjUPNPDMROOT[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"DM", &DMREAD, NULL, NULL, NULL, NULL, &DMFINFRM, &DMNONE, tRoot181ObjUPNPDM, NULL, NULL, BBFDM_BOTH},
{0}
};
DMOBJ tRoot181ObjUPNPDM[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"DeviceInfo", &DMREAD, NULL, NULL, NULL, NULL, &DMFINFRM, &DMNONE,upnpDeviceInfoObj, upnpDeviceInfoParams, NULL, BBFDM_BOTH},
{"Configuration", &DMREAD, NULL, NULL, NULL, NULL, &DMFINFRM, &DMNONE,upnpConfigurationObj, NULL, NULL, BBFDM_BOTH},
{"Monitoring", &DMREAD, NULL, NULL, NULL, NULL, &DMFINFRM, &DMNONE,upnpMonitoringObj, upnpMonitoringParams, NULL, BBFDM_BOTH},
@ -82,7 +82,7 @@ DMOBJ tRoot181ObjUPNPDM[] = {
};
DMOBJ tRoot181ObjUPNPBBF[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"DeviceInfo", &DMREAD, NULL, NULL, NULL, NULL, &DMFINFRM, &DMNONE,tDeviceInfoObj, tDeviceInfoParams, NULL, BBFDM_BOTH},
{"ManagementServer", &DMREAD, NULL, NULL, NULL, NULL, &DMFINFRM, &DMNONE,NULL, tManagementServerParams, NULL, BBFDM_BOTH},
{"Time", &DMREAD, NULL, NULL, NULL, NULL, NULL, &DMNONE,NULL, tTimeParams, NULL, BBFDM_BOTH},

View file

@ -312,7 +312,7 @@ static int add_profile_object(char *refparam, struct dmctx *ctx, void *data, cha
dmuci_add_section_bbfdm("dmmap_asterisk", "sip_service_provider", &dmmap_voice_section, &v);
dmuci_set_value_by_section(dmmap_voice_section, "section_name", sname);
*instancepara = update_instance_bbfdm(dmmap_voice_section, instance, "profileinstance");
*instancepara = update_instance(dmmap_voice_section, instance, "profileinstance");
return 0;
}
@ -2139,12 +2139,15 @@ static void set_voice_profile_key_of_line(struct uci_section *dmmap_line_section
static int browseVoiceServiceInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
struct uci_section *s = NULL;
char *vs = NULL, *vs_last = NULL;
char *inst = NULL, *max_inst = NULL;
update_section_list(DMMAP,"voice_service", NULL, 1, NULL, NULL, NULL, NULL, NULL);
uci_path_foreach_sections(bbfdm, "dmmap", "voice_service", s) {
vs = handle_update_instance(1, dmctx, &vs_last, update_instance_alias_bbfdm, 3, s, "vsinstance", "vsalias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)s, vs) == DM_STOP)
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
s, "vsinstance", "vsalias", "dmmap", "voice_service");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)s, inst) == DM_STOP)
break;
}
return 0;
@ -2153,7 +2156,7 @@ static int browseVoiceServiceInst(struct dmctx *dmctx, DMNODE *parent_node, void
static int browseCodecsInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
int i = 0;
char *id, *id_last = NULL;
char *inst, *max_inst = NULL;
struct uci_section *code_sec;
struct codec_args curr_codec_args = {0};
@ -2161,11 +2164,15 @@ static int browseCodecsInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev
codec_update_id();
uci_path_foreach_sections(bbfdm, "dmmap", "codec_id", code_sec) {
init_codec_args(&curr_codec_args, allowed_sip_codecs[i].allowed_cdc, allowed_sip_codecs[i].id, allowed_sip_codecs[i].enumid, code_sec);
id = handle_update_instance(2, dmctx, &id_last, update_instance_alias_bbfdm, 3, code_sec, "codecinstance", "codecalias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_codec_args, id) == DM_STOP) {
inst = handle_update_instance(2, dmctx, &max_inst, update_instance_alias, 5,
code_sec, "codecinstance", "codecalias", "dmmap", "codec_id");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_codec_args, inst) == DM_STOP) {
fini_codec_args(&curr_codec_args);
break;
}
fini_codec_args(&curr_codec_args);
i++;
}
@ -2175,7 +2182,7 @@ static int browseCodecsInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev
/*#Device.Services.VoiceService.{i}.VoiceProfile.{i}.!UCI:asterisk/sip_service_provider/dmmap_asterisk*/
static int browseProfileInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
char *profile_num = NULL, *profile_num_last = NULL;
char *inst = NULL, *max_inst = NULL;
struct sip_args curr_sip_args = {0};
struct dmmap_dup *p;
LIST_HEAD(dup_list);
@ -2183,9 +2190,13 @@ static int browseProfileInst(struct dmctx *dmctx, DMNODE *parent_node, void *pre
wait_voice_service_up();
synchronize_specific_config_sections_with_dmmap("asterisk", "sip_service_provider", "dmmap_asterisk", &dup_list);
list_for_each_entry(p, &dup_list, list) {
profile_num = handle_update_instance(2, dmctx, &profile_num_last, update_instance_alias_bbfdm, 3, p->dmmap_section, "profileinstance", "profilealias");
init_sip_args(&curr_sip_args, p->config_section, profile_num_last);
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_sip_args, profile_num) == DM_STOP)
inst = handle_update_instance(2, dmctx, &max_inst, update_instance_alias, 5,
p->dmmap_section, "profileinstance", "profilealias", "dmmap_asterisk", "sip_service_provider");
init_sip_args(&curr_sip_args, p->config_section, inst);
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_sip_args, inst) == DM_STOP)
break;
}
free_dmmap_config_dup_list(&dup_list);
@ -2196,9 +2207,10 @@ static int browseProfileInst(struct dmctx *dmctx, DMNODE *parent_node, void *pre
static int browseLineInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
int maxLine, line_id = 0;
char *line_num = NULL, *last_inst = NULL;
char *inst = NULL, *max_inst = NULL;
struct sip_args *sipargs = (struct sip_args *)prev_data;
struct tel_args curr_tel_args = {0};
struct browse_args browse_args = {0};
struct dmmap_dup *p;
LIST_HEAD(dup_list);
@ -2210,9 +2222,17 @@ static int browseLineInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_d
if ( line_id >= maxLine )
continue;
set_voice_profile_key_of_line(p->dmmap_section, prev_instance);
line_num = handle_update_instance(3, dmctx, &last_inst, update_instance_alias_bbfdm, 3, p->dmmap_section, "lineinstance", "linealias");
browse_args.option = "voice_profile_key";
browse_args.value = sipargs->profile_num;
inst = handle_update_instance(3, dmctx, &max_inst, update_instance_alias, 7,
p->dmmap_section, "lineinstance", "linealias", "dmmap_asterisk", "tel_line",
check_browse_section, (void *)&browse_args);
init_tel_args(&curr_tel_args, p->config_section, sipargs->sip_section, sipargs->profile_num); //check difference between sipargs->profile_num and profile_num
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_tel_args, line_num) == DM_STOP)
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_tel_args, inst) == DM_STOP)
break;
}
free_dmmap_config_dup_list(&dup_list);
@ -2222,7 +2242,7 @@ static int browseLineInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_d
static int browseLineCodecListInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
int i = 0;
char *id = NULL , *id_last = NULL;
char *inst = NULL , *max_inst = NULL;
struct tel_args *telargs = (struct tel_args *)prev_data;
struct uci_section *code_sec = NULL;
struct line_codec_args curr_line_codec_args = {0};
@ -2232,8 +2252,11 @@ static int browseLineCodecListInst(struct dmctx *dmctx, DMNODE *parent_node, voi
codec_priority_update(telargs->sip_section);
uci_path_foreach_sections(bbfdm, "dmmap", "codec_id", code_sec) {
init_line_code_args(&curr_line_codec_args, i, telargs->sip_section, code_sec);
id = handle_update_instance(4, dmctx, &id_last, update_instance_alias_bbfdm, 3, code_sec, "codecinstance", "codecalias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_line_codec_args, id) == DM_STOP)
inst = handle_update_instance(4, dmctx, &max_inst, update_instance_alias, 5,
code_sec, "codecinstance", "codecalias", "dmmap", "codec_id");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_line_codec_args, inst) == DM_STOP)
break;
i++;
}
@ -2242,14 +2265,14 @@ static int browseLineCodecListInst(struct dmctx *dmctx, DMNODE *parent_node, voi
/* *** Device.Services. *** */
DMOBJ tServicesObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"VoiceService", &DMREAD, NULL, NULL, NULL, browseVoiceServiceInst, NULL, NULL, NULL, tServicesVoiceServiceObj, tServicesVoiceServiceParams, NULL, BBFDM_BOTH},
{0}
};
/* *** Device.Services.VoiceService.{i}. *** */
DMOBJ tServicesVoiceServiceObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"Capabilities", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tServicesVoiceServiceCapabilitiesObj, tServicesVoiceServiceCapabilitiesParams, NULL, BBFDM_BOTH},
{"VoiceProfile", &DMWRITE, add_profile_object, delete_profile_object, NULL, browseProfileInst, NULL, NULL, NULL, tServicesVoiceServiceVoiceProfileObj, tServicesVoiceServiceVoiceProfileParams, NULL, BBFDM_BOTH},
{0}
@ -2263,7 +2286,7 @@ DMLEAF tServicesVoiceServiceParams[] = {
/* *** Device.Services.VoiceService.{i}.Capabilities. *** */
DMOBJ tServicesVoiceServiceCapabilitiesObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"SIP", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tServicesVoiceServiceCapabilitiesSIPParams, NULL, BBFDM_BOTH},
{"Codecs", &DMREAD, NULL, NULL, NULL, browseCodecsInst, NULL, NULL, NULL, NULL, tServicesVoiceServiceCapabilitiesCodecsParams, NULL, BBFDM_BOTH},
{0}
@ -2331,7 +2354,7 @@ DMLEAF tServicesVoiceServiceCapabilitiesCodecsParams[] = {
/* *** Device.Services.VoiceService.{i}.VoiceProfile.{i}. *** */
DMOBJ tServicesVoiceServiceVoiceProfileObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"SIP", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tServicesVoiceServiceVoiceProfileSIPParams, NULL, BBFDM_BOTH},
{"ServiceProviderInfo", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tServicesVoiceServiceVoiceProfileServiceProviderInfoParams, NULL, BBFDM_BOTH},
{"FaxT38", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tServicesVoiceServiceVoiceProfileFaxT38Params, NULL, BBFDM_BOTH},
@ -2392,7 +2415,7 @@ DMLEAF tServicesVoiceServiceVoiceProfileFaxT38Params[] = {
/* *** Device.Services.VoiceService.{i}.VoiceProfile.{i}.RTP. *** */
DMOBJ tServicesVoiceServiceVoiceProfileRTPObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"RTCP", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tServicesVoiceServiceVoiceProfileRTPRTCPParams, NULL, BBFDM_BOTH},
{"SRTP", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tServicesVoiceServiceVoiceProfileRTPSRTPParams, NULL, BBFDM_BOTH},
{0}
@ -2423,7 +2446,7 @@ DMLEAF tServicesVoiceServiceVoiceProfileRTPSRTPParams[] = {
/* *** Device.Services.VoiceService.{i}.VoiceProfile.{i}.Line.{i}. *** */
DMOBJ tServicesVoiceServiceVoiceProfileLineObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"VoiceProcessing", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tServicesVoiceServiceVoiceProfileLineVoiceProcessingParams, NULL, BBFDM_BOTH},
{"CallingFeatures", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tServicesVoiceServiceVoiceProfileLineCallingFeaturesParams, NULL, BBFDM_BOTH},
{"SIP", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tServicesVoiceServiceVoiceProfileLineSIPParams, NULL, BBFDM_BOTH},
@ -2470,7 +2493,7 @@ DMLEAF tServicesVoiceServiceVoiceProfileLineSIPParams[] = {
/* *** Device.Services.VoiceService.{i}.VoiceProfile.{i}.Line.{i}.Codec. *** */
DMOBJ tServicesVoiceServiceVoiceProfileLineCodecObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"List", &DMREAD, NULL, NULL, NULL, browseLineCodecListInst, NULL, NULL, NULL, NULL, tServicesVoiceServiceVoiceProfileLineCodecListParams, NULL, BBFDM_BOTH},
{0}
};

View file

@ -2140,11 +2140,14 @@ static int get_IPDiagnosticsServerSelectionDiagnostics_MaximumResponseTime(char
static int browseIPDiagnosticsTraceRouteRouteHopsInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
struct uci_section *s = NULL;
char *instance, *idx_last = NULL;
char *inst, *max_inst = NULL;
uci_foreach_sections_state("cwmp", "RouteHops", s) {
instance = handle_update_instance(2, dmctx, &idx_last, update_instance_alias, 3, (void *)s, "routehop_instance", "routehop_alias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)s, instance) == DM_STOP)
inst = handle_update_instance(2, dmctx, &max_inst, update_instance_alias, 5,
(void *)s, "routehop_instance", "routehop_alias", "cwmp", "RouteHops");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)s, inst) == DM_STOP)
break;
}
return 0;
@ -2153,11 +2156,14 @@ static int browseIPDiagnosticsTraceRouteRouteHopsInst(struct dmctx *dmctx, DMNOD
static int browseIPDiagnosticsDownloadDiagnosticsPerConnectionResultInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
struct uci_section *s = NULL;
char *instance, *idx_last = NULL;
char *inst, *max_inst = NULL;
uci_foreach_sections_state("cwmp", "DownloadPerConnection", s) {
instance = handle_update_instance(2, dmctx, &idx_last, update_instance_alias, 3, (void *)s, "perconnection_instance", "perconnection_alias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)s, instance) == DM_STOP)
inst = handle_update_instance(2, dmctx, &max_inst, update_instance_alias, 5,
(void *)s, "perconnection_instance", "perconnection_alias", "cwmp", "DownloadPerConnection");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)s, inst) == DM_STOP)
break;
}
return 0;
@ -2166,11 +2172,14 @@ static int browseIPDiagnosticsDownloadDiagnosticsPerConnectionResultInst(struct
static int browseIPDiagnosticsUploadDiagnosticsPerConnectionResultInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
struct uci_section *s = NULL;
char *instance, *idx_last = NULL;
char *inst, *max_inst = NULL;
uci_foreach_sections_state("cwmp", "UploadPerConnection", s) {
instance = handle_update_instance(2, dmctx, &idx_last, update_instance_alias, 3, (void *)s, "perconnection_instance", "perconnection_alias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)s, instance) == DM_STOP)
inst = handle_update_instance(2, dmctx, &max_inst, update_instance_alias, 5,
(void *)s, "perconnection_instance", "perconnection_alias", "cwmp", "UploadPerConnection");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)s, inst) == DM_STOP)
break;
}
return 0;
@ -2178,7 +2187,7 @@ static int browseIPDiagnosticsUploadDiagnosticsPerConnectionResultInst(struct dm
/* *** Device.IP.Diagnostics. *** */
DMOBJ tIPDiagnosticsObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"IPPing", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tIPDiagnosticsIPPingParams, NULL, BBFDM_CWMP},
{"TraceRoute", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tIPDiagnosticsTraceRouteObj, tIPDiagnosticsTraceRouteParams, NULL, BBFDM_CWMP},
{"DownloadDiagnostics", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tIPDiagnosticsDownloadDiagnosticsObj, tIPDiagnosticsDownloadDiagnosticsParams, NULL, BBFDM_CWMP},
@ -2230,7 +2239,7 @@ DMLEAF tIPDiagnosticsIPPingParams[] = {
/* *** Device.IP.Diagnostics.TraceRoute. *** */
DMOBJ tIPDiagnosticsTraceRouteObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"RouteHops", &DMREAD, NULL, NULL, NULL, browseIPDiagnosticsTraceRouteRouteHopsInst, NULL, NULL, NULL, NULL, tIPDiagnosticsTraceRouteRouteHopsParams, NULL, BBFDM_CWMP},
{0}
};
@ -2263,7 +2272,7 @@ DMLEAF tIPDiagnosticsTraceRouteRouteHopsParams[] = {
/* *** Device.IP.Diagnostics.DownloadDiagnostics. *** */
DMOBJ tIPDiagnosticsDownloadDiagnosticsObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"PerConnectionResult", &DMREAD, NULL, NULL, NULL, browseIPDiagnosticsDownloadDiagnosticsPerConnectionResultInst, NULL, NULL, NULL, NULL, tIPDiagnosticsDownloadDiagnosticsPerConnectionResultParams, NULL, BBFDM_CWMP},
{0}
};
@ -2312,7 +2321,7 @@ DMLEAF tIPDiagnosticsDownloadDiagnosticsPerConnectionResultParams[] = {
/* *** Device.IP.Diagnostics.UploadDiagnostics. *** */
DMOBJ tIPDiagnosticsUploadDiagnosticsObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"PerConnectionResult", &DMREAD, NULL, NULL, NULL, browseIPDiagnosticsUploadDiagnosticsPerConnectionResultInst, NULL, NULL, NULL, NULL, tIPDiagnosticsUploadDiagnosticsPerConnectionResultParams, NULL, BBFDM_CWMP},
{0}
};

View file

@ -16,12 +16,15 @@
/*#Device.BulkData.Profile.{i}.!UCI:cwmp_bulkdata/profile/dmmap_cwmp_profile*/
static int browseBulkDataProfileInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
char *profile = NULL, *profile_last = NULL;
char *inst = NULL, *max_inst = NULL;
struct uci_section *s = NULL;
uci_foreach_sections("cwmp_bulkdata", "profile", s) {
profile = handle_update_instance(1, dmctx, &profile_last, update_instance_alias, 3, s, "profile_instance", "profile_alias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)s, profile) == DM_STOP)
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
s, "profile_instance", "profile_alias", "cwmp_bulkdata", "profile");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)s, inst) == DM_STOP)
break;
}
return 0;
@ -30,16 +33,21 @@ static int browseBulkDataProfileInst(struct dmctx *dmctx, DMNODE *parent_node, v
/*#Device.BulkData.Profile.{i}.Parameter.{i}.!UCI:cwmp_bulkdata/profile_parameter/dmmap_cwmp_profile_parameter*/
static int browseBulkDataProfileParameterInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
char *profile_parameter = NULL, *profile_parameter_last = NULL, *profile_id, *prev_profile_id;
char *inst = NULL, *max_inst = NULL, *prev_profile_id;
struct uci_section *s = NULL, *prev_section = (struct uci_section *)prev_data;
struct browse_args browse_args = {0};
dmuci_get_value_by_section_string(prev_section, "profile_id", &prev_profile_id);
uci_foreach_sections("cwmp_bulkdata", "profile_parameter", s) {
dmuci_get_value_by_section_string(s, "profile_id", &profile_id);
if(strcmp(profile_id, prev_profile_id) != 0)
continue;
profile_parameter = handle_update_instance(1, dmctx, &profile_parameter_last, update_instance_alias, 3, s, "parameter_instance", "parameter_alias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)s, profile_parameter) == DM_STOP)
uci_foreach_option_eq("cwmp_bulkdata", "profile_parameter", "profile_id", prev_profile_id, s) {
browse_args.option = "profile_id";
browse_args.value = prev_profile_id;
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 7,
s, "parameter_instance", "parameter_alias", "cwmp_bulkdata", "profile_parameter",
check_browse_section, (void *)&browse_args);
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)s, inst) == DM_STOP)
break;
}
return 0;
@ -48,16 +56,21 @@ static int browseBulkDataProfileParameterInst(struct dmctx *dmctx, DMNODE *paren
/*#Device.BulkData.Profile.{i}.HTTP.RequestURIParameter.{i}.!UCI:cwmp_bulkdata/profile_http_request_uri_parameter/dmmap_cwmp_profile_http_request_uri_parameter*/
static int browseBulkDataProfileHTTPRequestURIParameterInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
char *profile_http_request_uri_parameter = NULL, *profile_http_request_uri_parameter_last = NULL, *profile_id, *prev_profile_id;
char *inst = NULL, *max_inst = NULL, *prev_profile_id;
struct uci_section *s = NULL, *prev_section = (struct uci_section *)prev_data;
struct browse_args browse_args = {0};
dmuci_get_value_by_section_string(prev_section, "profile_id", &prev_profile_id);
uci_foreach_sections("cwmp_bulkdata", "profile_http_request_uri_parameter", s) {
dmuci_get_value_by_section_string(s, "profile_id", &profile_id);
if(strcmp(profile_id, prev_profile_id) != 0)
continue;
profile_http_request_uri_parameter = handle_update_instance(1, dmctx, &profile_http_request_uri_parameter_last, update_instance_alias, 3, s, "requesturiparameter_instance", "requesturiparameter_alias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)s, profile_http_request_uri_parameter) == DM_STOP)
uci_foreach_option_eq("cwmp_bulkdata", "profile_http_request_uri_parameter", "profile_id", prev_profile_id, s) {
browse_args.option = "profile_id";
browse_args.value = prev_profile_id;
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 7,
s, "requesturiparameter_instance", "requesturiparameter_alias", "cwmp_bulkdata", "profile_http_request_uri_parameter",
check_browse_section, (void *)&browse_args);
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)s, inst) == DM_STOP)
break;
}
return 0;
@ -1071,7 +1084,7 @@ static int set_BulkDataProfileHTTPRequestURIParameter_Reference(char *refparam,
/* *** Device.BulkData. *** */
DMOBJ tBulkDataObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"Profile", &DMWRITE, addObjBulkDataProfile, delObjBulkDataProfile, NULL, browseBulkDataProfileInst, NULL, NULL, NULL, tBulkDataProfileObj, tBulkDataProfileParams, NULL, BBFDM_BOTH},
{0}
};
@ -1092,7 +1105,7 @@ DMLEAF tBulkDataParams[] = {
/* *** Device.BulkData.Profile.{i}. *** */
DMOBJ tBulkDataProfileObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"Parameter", &DMWRITE, addObjBulkDataProfileParameter, delObjBulkDataProfileParameter, NULL, browseBulkDataProfileParameterInst, NULL, NULL, NULL, NULL, tBulkDataProfileParameterParams, NULL, BBFDM_BOTH},
{"CSVEncoding", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tBulkDataProfileCSVEncodingParams, NULL, BBFDM_BOTH},
{"JSONEncoding", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tBulkDataProfileJSONEncodingParams, NULL, BBFDM_BOTH},
@ -1151,7 +1164,7 @@ DMLEAF tBulkDataProfileJSONEncodingParams[] = {
/* *** Device.BulkData.Profile.{i}.HTTP. *** */
DMOBJ tBulkDataProfileHTTPObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"RequestURIParameter", &DMWRITE, addObjBulkDataProfileHTTPRequestURIParameter, delObjBulkDataProfileHTTPRequestURIParameter, NULL, browseBulkDataProfileHTTPRequestURIParameterInst, NULL, NULL, NULL, NULL, tBulkDataProfileHTTPRequestURIParameterParams, NULL, BBFDM_BOTH},
{0}
};

View file

@ -43,14 +43,14 @@ static int get_du_linker(char *refparam, struct dmctx *dmctx, void *data, char *
static int browseSoftwareModulesExecEnvInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
json_object *res = NULL, *du_obj = NULL, *arrobj = NULL;
char *idx, *idx_last = NULL;
char *inst, *max_inst = NULL;
int id = 0, j = 0;
dmubus_call("swmodules", "environment", UBUS_ARGS{}, 0, &res);
if (res) {
dmjson_foreach_obj_in_array(res, arrobj, du_obj, j, 1, "environment") {
idx = handle_update_instance(1, dmctx, &idx_last, update_instance_without_section, 1, ++id);
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)du_obj, idx) == DM_STOP)
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_without_section, 1, ++id);
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)du_obj, inst) == DM_STOP)
break;
}
}
@ -60,14 +60,14 @@ static int browseSoftwareModulesExecEnvInst(struct dmctx *dmctx, DMNODE *parent_
static int browseSoftwareModulesDeploymentUnitInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
json_object *res = NULL, *du_obj = NULL, *arrobj = NULL;
char *idx, *idx_last = NULL;
char *inst, *max_inst = NULL;
int id = 0, j = 0;
dmubus_call("swmodules", "du_list", UBUS_ARGS{}, 0, &res);
if (res) {
dmjson_foreach_obj_in_array(res, arrobj, du_obj, j, 1, "deployment_unit") {
idx = handle_update_instance(2, dmctx, &idx_last, update_instance_without_section, 1, ++id);
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)du_obj, idx) == DM_STOP)
inst = handle_update_instance(2, dmctx, &max_inst, update_instance_without_section, 1, ++id);
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)du_obj, inst) == DM_STOP)
break;
}
}
@ -77,14 +77,14 @@ static int browseSoftwareModulesDeploymentUnitInst(struct dmctx *dmctx, DMNODE *
static int browseSoftwareModulesExecutionUnitInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
json_object *res = NULL, *du_obj = NULL, *arrobj = NULL;
char *idx, *idx_last = NULL;
char *inst, *max_inst = NULL;
int id = 0, j = 0;
dmubus_call("swmodules", "eu_list", UBUS_ARGS{}, 0, &res);
if (res) {
dmjson_foreach_obj_in_array(res, arrobj, du_obj, j, 1, "execution_unit") {
idx = handle_update_instance(2, dmctx, &idx_last, update_instance_without_section, 1, ++id);
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)du_obj, idx) == DM_STOP)
inst = handle_update_instance(2, dmctx, &max_inst, update_instance_without_section, 1, ++id);
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)du_obj, inst) == DM_STOP)
break;
}
}
@ -793,7 +793,7 @@ char *get_softwaremodules_url(char *uuid)
/* *** Device.SoftwareModules. *** */
DMOBJ tSoftwareModulesObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"ExecEnv", &DMREAD, NULL, NULL, NULL, browseSoftwareModulesExecEnvInst, NULL, NULL, NULL, NULL, tSoftwareModulesExecEnvParams, get_exe_cenv_linker, BBFDM_BOTH},
{"DeploymentUnit", &DMREAD, NULL, NULL, NULL, browseSoftwareModulesDeploymentUnitInst, NULL, NULL, NULL, NULL, tSoftwareModulesDeploymentUnitParams, get_du_linker, BBFDM_BOTH},
{"ExecutionUnit", &DMREAD, NULL, NULL, NULL, browseSoftwareModulesExecutionUnitInst, NULL, NULL, NULL, tSoftwareModulesExecutionUnitObj, tSoftwareModulesExecutionUnitParams, NULL, BBFDM_BOTH},
@ -855,7 +855,7 @@ DMLEAF tSoftwareModulesDeploymentUnitParams[] = {
/* *** Device.SoftwareModules.ExecutionUnit.{i}. *** */
DMOBJ tSoftwareModulesExecutionUnitObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
//{"Extensions", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, BBFDM_BOTH},
{0}
};

View file

@ -255,7 +255,7 @@ static int add_atm_link(char *refparam, struct dmctx *ctx, void *data, char **in
dmuci_set_value("dsl", atm_device, "qos_class", "ubr");
dmuci_add_section_bbfdm("dmmap_dsl", "atm-device", &dmmap_atm, &v);
dmuci_set_value_by_section(dmmap_atm, "section_name", atm_device);
*instancepara = update_instance_bbfdm(dmmap_atm, instance, "atmlinkinstance");
*instancepara = update_instance(dmmap_atm, instance, "atmlinkinstance");
return 0;
}
@ -353,7 +353,7 @@ static int set_atm_alias(char *refparam, struct dmctx *ctx, void *data, char *in
/*#Device.ATM.Link.{i}.!UCI:dsl/atm-device/dmmap_dsl*/
static int browseAtmLinkInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
char *wnum = NULL, *channel_last = NULL, *ifname;
char *inst = NULL, *max_inst = NULL, *ifname;
struct atm_args curr_atm_args = {0};
struct dmmap_dup *p;
LIST_HEAD(dup_list);
@ -362,8 +362,11 @@ static int browseAtmLinkInst(struct dmctx *dmctx, DMNODE *parent_node, void *pre
list_for_each_entry(p, &dup_list, list) {
dmuci_get_value_by_section_string(p->config_section, "device", &ifname);
init_atm_link(&curr_atm_args, p->config_section, ifname);
wnum = handle_update_instance(1, dmctx, &channel_last, update_instance_alias, 3, p->dmmap_section, "atmlinkinstance", "atmlinkalias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_atm_args, wnum) == DM_STOP)
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
p->dmmap_section, "atmlinkinstance", "atmlinkalias", "dmmap_dsl", "atm-device");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_atm_args, inst) == DM_STOP)
break;
}
free_dmmap_config_dup_list(&dup_list);
@ -372,14 +375,14 @@ static int browseAtmLinkInst(struct dmctx *dmctx, DMNODE *parent_node, void *pre
/*** ATM. ***/
DMOBJ tATMObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"Link", &DMWRITE, add_atm_link, delete_atm_link, NULL, browseAtmLinkInst, NULL, NULL, NULL, tATMLinkObj, tATMLinkParams, get_atm_linker, BBFDM_BOTH},
{0}
};
/*** ATM.Link. ***/
DMOBJ tATMLinkObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"Stats", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tATMLinkStatsParams, NULL, BBFDM_BOTH},
{0}
};

View file

@ -13,10 +13,6 @@
#include "dmentry.h"
#include "bridging.h"
#define MAX_QOS_MAP_ELEMENTS 8
#define MIN_QOS_MAP_ELEMENTS 8
#define MAX_STRING_LEN 15
struct bridge_args
{
struct uci_section *bridge_sec;
@ -836,7 +832,7 @@ static int addObjBridgingBridge(char *refparam, struct dmctx *ctx, void *data, c
dmuci_add_section_bbfdm("dmmap_network", "interface", &dmmap_bridge, &v);
dmuci_set_value_by_section(dmmap_bridge, "section_name", bridge_name);
dmuci_set_value_by_section(dmmap_bridge, "added_by_user", "1");
*instance = update_instance_bbfdm(dmmap_bridge, last_inst, "bridge_instance");
*instance = update_instance(dmmap_bridge, last_inst, "bridge_instance");
return 0;
}
@ -1652,7 +1648,7 @@ static int set_BridgingBridgePort_PriorityRegeneration(char *refparam, struct dm
{
switch (action) {
case VALUECHECK:
if (dm_validate_unsignedInt_list(value, MIN_QOS_MAP_ELEMENTS, MAX_QOS_MAP_ELEMENTS, MAX_STRING_LEN, RANGE_ARGS{{"0","7"}}, 1))
if (dm_validate_unsignedInt_list(value, 8, 8, -1, RANGE_ARGS{{"0","7"}}, 1))
return FAULT_9007;
break;
@ -1673,7 +1669,7 @@ static int set_BridgingBridgePort_Egress_PriorityRegeneration(char *refparam, st
{
switch (action) {
case VALUECHECK:
if (dm_validate_unsignedInt_list(value, MIN_QOS_MAP_ELEMENTS, MAX_QOS_MAP_ELEMENTS, MAX_STRING_LEN, RANGE_ARGS{{"0","7"}}, 1))
if (dm_validate_unsignedInt_list(value, 8, 8, -1, RANGE_ARGS{{"0","7"}}, 1))
return FAULT_9007;
return 0;
@ -2227,17 +2223,20 @@ static int set_BridgingBridgeVLANPort_Untagged(char *refparam, struct dmctx *ctx
/*#Device.Bridging.Bridge.{i}.!UCI:network/interface/dmmap_network*/
static int browseBridgingBridgeInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
char *br_inst = NULL, *br_inst_last = NULL, *ifname;
char *inst = NULL, *max_inst = NULL, *ifname;
struct bridge_args curr_bridging_args = {0};
struct dmmap_dup *p = NULL;
LIST_HEAD(dup_list);
synchronize_specific_config_sections_with_dmmap_eq("network", "interface", "dmmap_network", "type", "bridge", &dup_list);
list_for_each_entry(p, &dup_list, list) {
br_inst = handle_update_instance(1, dmctx, &br_inst_last, update_instance_alias, 3, p->dmmap_section, "bridge_instance", "bridge_alias");
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
p->dmmap_section, "bridge_instance", "bridge_alias", "dmmap_network", "interface");
dmuci_get_value_by_section_string(p->config_section, "ifname", &ifname);
init_bridging_args(&curr_bridging_args, p->config_section, ifname, br_inst);
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_bridging_args, br_inst) == DM_STOP)
init_bridging_args(&curr_bridging_args, p->config_section, ifname, inst);
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_bridging_args, inst) == DM_STOP)
break;
}
free_dmmap_config_dup_list(&dup_list);
@ -2246,11 +2245,11 @@ static int browseBridgingBridgeInst(struct dmctx *dmctx, DMNODE *parent_node, vo
static int browseBridgingBridgePortInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
struct bridge_port_args curr_bridge_port_args = {0};
struct bridge_args *br_args = (struct bridge_args *)prev_data;
struct browse_args browse_args = {0};
struct uci_section *s = NULL, *deviceport_s = NULL;
char *port_inst = NULL, *port_last = NULL, *device;
char *inst = NULL, *max_inst = NULL, *device;
check_create_dmmap_package("dmmap_bridge_port");
dmmap_synchronizeBridgingBridgePort(dmctx, parent_node, prev_data, prev_instance);
@ -2258,8 +2257,15 @@ static int browseBridgingBridgePortInst(struct dmctx *dmctx, DMNODE *parent_node
get_bridge_port_device_section(s, &deviceport_s);
dmuci_get_value_by_section_string(s, "device", &device);
init_bridge_port_args(&curr_bridge_port_args, deviceport_s, s, br_args->bridge_sec, device, br_args->br_inst);
port_inst = handle_update_instance(1, dmctx, &port_last, update_instance_alias_bbfdm, 3, s, "bridge_port_instance", "bridge_port_alias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_bridge_port_args, port_inst) == DM_STOP)
browse_args.option = "br_inst";
browse_args.value = br_args->br_inst;
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 7,
s, "bridge_port_instance", "bridge_port_alias", "dmmap_bridge_port", "bridge_port",
check_browse_section, (void *)&browse_args);
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_bridge_port_args, inst) == DM_STOP)
break;
}
return 0;
@ -2269,15 +2275,23 @@ static int browseBridgingBridgeVLANInst(struct dmctx *dmctx, DMNODE *parent_node
{
struct bridge_vlan_args curr_bridge_vlan_args = {0};
struct bridge_args *br_args = (struct bridge_args *)prev_data;
struct browse_args browse_args = {0};
struct uci_section *s = NULL;
char *vlan_inst = NULL, *vlan_last = NULL;
char *inst = NULL, *max_inst = NULL;
check_create_dmmap_package("dmmap_bridge_vlan");
dmmap_synchronizeBridgingBridgeVLAN(dmctx, parent_node, prev_data, prev_instance);
uci_path_foreach_option_eq(bbfdm, "dmmap_bridge_vlan", "bridge_vlan", "br_inst", br_args->br_inst, s) {
init_bridge_vlan_args(&curr_bridge_vlan_args, s, br_args->bridge_sec, br_args->br_inst);
vlan_inst = handle_update_instance(1, dmctx, &vlan_last, update_instance_alias_bbfdm, 3, s, "bridge_vlan_instance", "bridge_vlan_alias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_bridge_vlan_args, vlan_inst) == DM_STOP)
browse_args.option = "br_inst";
browse_args.value = br_args->br_inst;
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 7,
s, "bridge_vlan_instance", "bridge_vlan_alias", "dmmap_bridge_vlanport", "bridge_vlan",
check_browse_section, (void *)&browse_args);
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_bridge_vlan_args, inst) == DM_STOP)
break;
}
return 0;
@ -2287,16 +2301,24 @@ static int browseBridgingBridgeVLANPortInst(struct dmctx *dmctx, DMNODE *parent_
{
struct bridge_vlanport_args curr_bridge_vlanport_args = {0};
struct bridge_args *br_args = (struct bridge_args *)prev_data;
struct browse_args browse_args = {0};
struct uci_section *s = NULL, *device_s = NULL;
char *vlanport_inst = NULL, *vlanport_last = NULL;
char *inst = NULL, *max_inst = NULL;
check_create_dmmap_package("dmmap_bridge_vlanport");
dmmap_synchronizeBridgingBridgeVLANPort(dmctx, parent_node, prev_data, prev_instance);
uci_path_foreach_option_eq(bbfdm, "dmmap_bridge_vlanport", "bridge_vlanport", "br_inst", br_args->br_inst, s) {
get_bridge_vlanport_device_section(s, &device_s);
init_bridge_vlanport_args(&curr_bridge_vlanport_args, device_s, s, br_args->bridge_sec, br_args->br_inst);
vlanport_inst = handle_update_instance(1, dmctx, &vlanport_last, update_instance_alias_bbfdm, 3, s, "bridge_vlanport_instance", "bridge_vlanport_alias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_bridge_vlanport_args, vlanport_inst) == DM_STOP)
browse_args.option = "br_inst";
browse_args.value = br_args->br_inst;
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 7,
s, "bridge_vlanport_instance", "bridge_vlanport_alias", "dmmap_bridge_vlanport", "bridge_vlanport",
check_browse_section, (void *)&browse_args);
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_bridge_vlanport_args, inst) == DM_STOP)
break;
}
return 0;
@ -2307,7 +2329,7 @@ static int browseBridgingBridgeVLANPortInst(struct dmctx *dmctx, DMNODE *parent_
***********************************************************************************************************************************/
/* *** Device.Bridging. *** */
DMOBJ tBridgingObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"Bridge", &DMWRITE, addObjBridgingBridge, delObjBridgingBridge, NULL, browseBridgingBridgeInst, NULL, NULL, NULL, tBridgingBridgeObj, tBridgingBridgeParams, NULL, BBFDM_BOTH},
{0}
};
@ -2326,7 +2348,7 @@ DMLEAF tBridgingParams[] = {
/*** Bridging.Bridge.{i}. ***/
DMOBJ tBridgingBridgeObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"Port", &DMWRITE, addObjBridgingBridgePort, delObjBridgingBridgePort, NULL, browseBridgingBridgePortInst, NULL, NULL, NULL, tBridgingBridgePortObj, tBridgingBridgePortParams, get_linker_br_port, BBFDM_BOTH},
{"VLAN", &DMWRITE, addObjBridgingBridgeVLAN, delObjBridgingBridgeVLAN, NULL, browseBridgingBridgeVLANInst, NULL, NULL, NULL, NULL, tBridgingBridgeVLANParams, get_linker_br_vlan, BBFDM_BOTH},
{"VLANPort", &DMWRITE, addObjBridgingBridgeVLANPort, delObjBridgingBridgeVLANPort, NULL, browseBridgingBridgeVLANPortInst, NULL, NULL, NULL, NULL, tBridgingBridgeVLANPortParams, NULL, BBFDM_BOTH},
@ -2347,7 +2369,7 @@ DMLEAF tBridgingBridgeParams[] = {
/*** Bridging.Bridge.{i}.Port.{i}. ***/
DMOBJ tBridgingBridgePortObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"Stats", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tBridgingBridgePortStatsParams, NULL, BBFDM_BOTH},
{0}
};

View file

@ -192,14 +192,14 @@ int os__get_process_state(char* refparam, struct dmctx *ctx, void *data, char *i
int os__browseProcessEntriesInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
json_object *res = NULL, *processes = NULL, *arrobj = NULL;
char *idx, *idx_last = NULL;
char *inst, *max_inst = NULL;
int id = 0, i = 0;
dmubus_call("router.system", "processes", UBUS_ARGS{}, 0, &res);
if (res) {
dmjson_foreach_obj_in_array(res, arrobj, processes, i, 1, "processes") {
idx = handle_update_instance(2, dmctx, &idx_last, update_instance_without_section, 1, ++id);
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)processes, idx) == DM_STOP)
inst = handle_update_instance(2, dmctx, &max_inst, update_instance_without_section, 1, ++id);
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)processes, inst) == DM_STOP)
break;
}
}

View file

@ -282,7 +282,7 @@ static int get_vlf_persistent(char *refparam, struct dmctx *ctx, void *data, cha
static int browseVcfInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
char *vcf = NULL, *vcf_last = NULL, *name;
char *inst = NULL, *max_inst = NULL, *name;
struct uci_section *s = NULL, *del_sec = NULL;
DIR *dir;
struct dirent *d_file;
@ -305,8 +305,11 @@ static int browseVcfInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_da
del_sec = s;
continue;
}
vcf = handle_update_instance(1, dmctx, &vcf_last, update_instance_alias_bbfdm, 3, s, "vcf_instance", "vcf_alias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)s, vcf) == DM_STOP)
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
s, "vcf_instance", "vcf_alias", "dmmap", "vcf");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)s, inst) == DM_STOP)
break;
}
if(del_sec)
@ -337,10 +340,12 @@ static int browseVlfInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_da
}
}
uci_path_foreach_sections(bbfdm, "dmmap", "vlf", dm_sec) {
char *instance, *last_instance = NULL;
char *inst, *max_inst = NULL;
instance = handle_update_instance(1, dmctx, &last_instance, update_instance_alias_bbfdm, 3, dm_sec, "vlf_instance", "vlf_alias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)dm_sec, instance) == DM_STOP){
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
dm_sec, "vlf_instance", "vlf_alias", "dmmap", "vlf");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)dm_sec, inst) == DM_STOP){
break;
}
}
@ -349,12 +354,12 @@ static int browseVlfInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_da
static int browseDeviceInfoProcessorInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
char *idx = NULL, *idx_last = NULL;
char *inst = NULL, *max_inst = NULL;
int i;
for (i = 0; i < get_number_of_cpus(); i++) {
idx = handle_update_instance(1, dmctx, &idx_last, update_instance_without_section, 1, i+1);
if (DM_LINK_INST_OBJ(dmctx, parent_node, NULL, idx) == DM_STOP)
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_without_section, 1, i+1);
if (DM_LINK_INST_OBJ(dmctx, parent_node, NULL, inst) == DM_STOP)
break;
}
return 0;
@ -415,12 +420,12 @@ static int get_DeviceInfoProcessor_Architecture(char *refparam, struct dmctx *ct
static int browseDeviceInfoSupportedDataModelInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
char *idx = NULL, *idx_last = NULL;
char *inst = NULL, *max_inst = NULL;
int i;
for (i = 0; i < sizeof(Data_Models)/sizeof(struct Supported_Data_Models); i++) {
idx = handle_update_instance(1, dmctx, &idx_last, update_instance_without_section, 1, i+1);
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&Data_Models[i], idx) == DM_STOP)
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_without_section, 1, i+1);
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&Data_Models[i], inst) == DM_STOP)
break;
}
return 0;
@ -482,7 +487,7 @@ static int get_DeviceInfoSupportedDataModel_Features(char *refparam, struct dmct
/* *** Device.DeviceInfo. *** */
DMOBJ tDeviceInfoObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"VendorConfigFile", &DMREAD, NULL, NULL, NULL, browseVcfInst, NULL, NULL, NULL, NULL, tDeviceInfoVendorConfigFileParams, NULL, BBFDM_BOTH},
{"MemoryStatus", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tDeviceInfoMemoryStatusParams, NULL, BBFDM_BOTH},
{"ProcessStatus", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tDeviceInfoProcessStatusObj, tDeviceInfoProcessStatusParams, NULL, BBFDM_BOTH},
@ -535,7 +540,7 @@ DMLEAF tDeviceInfoMemoryStatusParams[] = {
/* *** Device.DeviceInfo.ProcessStatus. *** */
DMOBJ tDeviceInfoProcessStatusObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"Process", &DMREAD, NULL, NULL, NULL, os__browseProcessEntriesInst, NULL, NULL, NULL, NULL, tDeviceInfoProcessStatusProcessParams, NULL, BBFDM_BOTH},
{0}
};

View file

@ -151,7 +151,7 @@ static int add_dhcp_server(char *refparam, struct dmctx *ctx, void *data, char *
dmuci_add_section_bbfdm("dmmap_dhcp", "dhcp", &dmmap_dhcp, &v);
dmuci_set_value_by_section(dmmap_dhcp, "section_name", section_name(s));
*instancepara = update_instance_bbfdm(dmmap_dhcp, instance, "dhcp_instance");
*instancepara = update_instance(dmmap_dhcp, instance, "dhcp_instance");
return 0;
}
@ -210,7 +210,8 @@ static int add_dhcp_staticaddress(char *refparam, struct dmctx *ctx, void *data,
dmuci_add_section_bbfdm("dmmap_dhcp", "host", &dmmap_dhcp_host, &v);
dmuci_set_value_by_section(dmmap_dhcp_host, "section_name", section_name(s));
*instancepara = update_instance_bbfdm(dmmap_dhcp_host, instance, "ldhcpinstance");
dmuci_set_value_by_section(dmmap_dhcp_host, "dhcp", ((struct dhcp_args *)data)->interface);
*instancepara = update_instance(dmmap_dhcp_host, instance, "ldhcpinstance");
return 0;
}
@ -271,7 +272,7 @@ static int addObjDHCPv4Client(char *refparam, struct dmctx *ctx, void *data, cha
dmuci_set_value_by_section(s, "type", "anywan");
dmuci_add_section_bbfdm("dmmap_dhcp_client", "interface", &dmmap_sect, &v);
dmuci_set_value_by_section(dmmap_sect, "section_name", section_name(s));
*instance = update_instance_bbfdm(dmmap_sect, instancepara, "bbf_dhcpv4client_instance");
*instance = update_instance(dmmap_sect, instancepara, "bbf_dhcpv4client_instance");
return 0;
}
@ -364,7 +365,7 @@ static int addObjDHCPv4ClientSentOption(char *refparam, struct dmctx *ctx, void
if(dhcp_client_args->dhcp_client_conf != NULL)
DMUCI_SET_VALUE_BY_SECTION(bbfdm, dmmap_sect, "section_name", section_name(dhcp_client_args->dhcp_client_conf));
DMUCI_SET_VALUE_BY_SECTION(bbfdm, dmmap_sect, "option_tag", "0");
*instance = update_instance_bbfdm(dmmap_sect, instancepara, "bbf_dhcpv4_sentopt_instance");
*instance = update_instance(dmmap_sect, instancepara, "bbf_dhcpv4_sentopt_instance");
return 0;
}
@ -408,7 +409,7 @@ static int addObjDHCPv4ClientReqOption(char *refparam, struct dmctx *ctx, void *
if(dhcp_client_args->dhcp_client_conf != NULL)
DMUCI_SET_VALUE_BY_SECTION(bbfdm, dmmap_sect, "section_name", section_name(dhcp_client_args->dhcp_client_conf));
DMUCI_SET_VALUE_BY_SECTION(bbfdm, dmmap_sect, "option_tag", "0");
*instance = update_instance_bbfdm(dmmap_sect, instancepara, "bbf_dhcpv4_sentopt_instance");
*instance = update_instance(dmmap_sect, instancepara, "bbf_dhcpv4_sentopt_instance");
return 0;
}
@ -450,7 +451,7 @@ static int addObjDHCPv4ServerPoolOption(char *refparam, struct dmctx *ctx, void
if(dhcp_arg->dhcp_sec != NULL)
DMUCI_SET_VALUE_BY_SECTION(bbfdm, dmmap_sect, "section_name", section_name(dhcp_arg->dhcp_sec));
DMUCI_SET_VALUE_BY_SECTION(bbfdm, dmmap_sect, "option_tag", "0");
*instance = update_instance_bbfdm(dmmap_sect, instancepara, "bbf_dhcpv4_servpool_option_instance");
*instance = update_instance(dmmap_sect, instancepara, "bbf_dhcpv4_servpool_option_instance");
return 0;
}
@ -492,7 +493,7 @@ static int addObjDHCPv4RelayForwarding(char *refparam, struct dmctx *ctx, void *
dmuci_set_value_by_section(s, "proto", "relay");
dmuci_add_section_bbfdm("dmmap_dhcp_relay", "interface", &dmmap_sect, &v);
dmuci_set_value_by_section(dmmap_sect, "section_name", section_name(s));
*instance = update_instance_bbfdm(dmmap_sect, instancepara, "bbf_dhcpv4relay_instance");
*instance = update_instance(dmmap_sect, instancepara, "bbf_dhcpv4relay_instance");
return 0;
}
@ -2542,7 +2543,7 @@ static void dhcp_leases_assign_to_interface(struct dhcp_args *dhcp,
/*#Device.DHCPv4.Server.Pool.{i}.!UCI:dhcp/dhcp/dmmap_dhcp*/
static int browseDhcpInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
char *interface, *idhcp = NULL, *idhcp_last = NULL, *v;
char *interface, *inst = NULL, *max_inst = NULL, *v;
struct dhcp_args curr_dhcp_args = {0};
struct dmmap_dup *p;
LIST_HEAD(leases);
@ -2559,11 +2560,14 @@ static int browseDhcpInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_d
dhcp_leases_assign_to_interface(&curr_dhcp_args, &leases, interface);
idhcp = handle_update_instance(1, dmctx, &idhcp_last, update_instance_alias_bbfdm, 3, p->dmmap_section, "dhcp_instance", "dhcp_alias");
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
p->dmmap_section, "dhcp_instance", "dhcp_alias", "dmmap_dhcp", "dhcp");
dmuci_get_value_by_section_string(p->dmmap_section, "order", &v);
if (v == NULL || strlen(v) == 0)
set_section_order("dhcp", "dmmap_dhcp", "dhcp", p->dmmap_section, p->config_section, 0, idhcp);
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_dhcp_args, idhcp) == DM_STOP)
set_section_order("dhcp", "dmmap_dhcp", "dhcp", p->dmmap_section, p->config_section, 0, inst);
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_dhcp_args, inst) == DM_STOP)
break;
}
free_dmmap_config_dup_list(&dup_list);
@ -2573,16 +2577,26 @@ static int browseDhcpInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_d
/*#Device.DHCPv4.Server.Pool.{i}.StaticAddress.{i}.!UCI:dhcp/host/dmmap_dhcp*/
static int browseDhcpStaticInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
char *idhcp = NULL, *idhcp_last = NULL;
char *inst = NULL, *max_inst = NULL;
struct dhcp_static_args curr_dhcp_staticargs = {0};
struct browse_args browse_args = {0};
struct dmmap_dup *p;
LIST_HEAD(dup_list);
synchronize_specific_config_sections_with_dmmap_cont("dhcp", "host", "dmmap_dhcp", "dhcp", ((struct dhcp_args *)prev_data)->interface, &dup_list);
list_for_each_entry(p, &dup_list, list) {
idhcp = handle_update_instance(2, dmctx, &idhcp_last, update_instance_alias_bbfdm, 3, p->dmmap_section, "ldhcpinstance", "ldhcpalias");
dmuci_set_value_by_section(p->dmmap_section, "dhcp", ((struct dhcp_args *)prev_data)->interface);
init_args_dhcp_host(&curr_dhcp_staticargs, p->config_section);
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_dhcp_staticargs, idhcp) == DM_STOP)
browse_args.option = "dhcp";
browse_args.value = ((struct dhcp_args *)prev_data)->interface;
inst = handle_update_instance(2, dmctx, &max_inst, update_instance_alias, 7,
p->dmmap_section, "ldhcpinstance", "ldhcpalias", "dmmap_dhcp", "host",
check_browse_section, (void *)&browse_args);
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_dhcp_staticargs, inst) == DM_STOP)
break;
}
free_dmmap_config_dup_list(&dup_list);
@ -2597,12 +2611,13 @@ static int browseDhcpClientInst(struct dmctx *dmctx, DMNODE *parent_node, void *
list_for_each_entry(lease, &dhcp->leases, list) {
struct client_args client_args;
char *idx, *idx_last = NULL;
char *inst, *max_inst = NULL;
init_dhcp_client_args(&client_args, lease);
idx = handle_update_instance(2, dmctx, &idx_last, update_instance_without_section, 1, ++id);
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&client_args, idx) == DM_STOP)
inst = handle_update_instance(2, dmctx, &max_inst, update_instance_without_section, 1, ++id);
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&client_args, inst) == DM_STOP)
break;
}
return 0;
@ -2610,19 +2625,19 @@ static int browseDhcpClientInst(struct dmctx *dmctx, DMNODE *parent_node, void *
static int browseDhcpClientIPv4Inst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
char *idx, *idx_last = NULL;
char *inst, *max_inst = NULL;
idx = handle_update_instance(2, dmctx, &idx_last, update_instance_without_section, 1, 1);
DM_LINK_INST_OBJ(dmctx, parent_node, prev_data, idx);
inst = handle_update_instance(2, dmctx, &max_inst, update_instance_without_section, 1, 1);
DM_LINK_INST_OBJ(dmctx, parent_node, prev_data, inst);
return 0;
}
/*#Device.DHCPv4.Client.{i}.!UCI:network/interface/dmmap_dhcp_client*/
static int browseDHCPv4ClientInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
char *instance, *instnbr = NULL;
char *inst, *max_inst = NULL;
struct dmmap_dup *p;
char *type, *ipv4addr = "", *ipv6addr = "", *proto, *inst, *mask4 = NULL;
char *type, *ipv4addr = "", *ipv6addr = "", *proto, *ip_inst, *mask4 = NULL;
json_object *res, *jobj;
struct dhcp_client_args dhcp_client_arg = {0};
LIST_HEAD(dup_list);
@ -2655,9 +2670,9 @@ static int browseDHCPv4ClientInst(struct dmctx *dmctx, DMNODE *parent_node, void
}
dmuci_get_value_by_section_string(p->config_section, "proto", &proto);
dmuci_get_value_by_section_string(p->config_section, "ip_int_instance", &inst);
dmuci_get_value_by_section_string(p->config_section, "ip_int_instance", &ip_inst);
if (ipv4addr[0] == '\0' && ipv6addr[0] == '\0' && strcmp(proto, "dhcp") != 0 && strcmp(proto, "dhcpv6") != 0 && strcmp(inst, "") == 0 && strcmp(type, "bridge") != 0) {
if (ipv4addr[0] == '\0' && ipv6addr[0] == '\0' && strcmp(proto, "dhcp") != 0 && strcmp(proto, "dhcpv6") != 0 && strcmp(ip_inst, "") == 0 && strcmp(type, "bridge") != 0) {
p->config_section=NULL;
DMUCI_SET_VALUE_BY_SECTION(bbfdm, p->dmmap_section, "section_name", "");
}
@ -2675,8 +2690,10 @@ static int browseDHCPv4ClientInst(struct dmctx *dmctx, DMNODE *parent_node, void
dhcp_client_arg.dhcp_client_conf = p->config_section;
dhcp_client_arg.dhcp_client_dm= p->dmmap_section;
instance = handle_update_instance(1, dmctx, &instnbr, update_instance_alias_bbfdm, 3, (void *)p->dmmap_section, "bbf_dhcpv4client_instance", "bbf_dhcpv4client_alias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, &dhcp_client_arg, instance) == DM_STOP)
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
p->dmmap_section, "bbf_dhcpv4client_instance", "bbf_dhcpv4client_alias", "dmmap_dhcp_client", "interface");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&dhcp_client_arg, inst) == DM_STOP)
break;
}
return 0;
@ -2687,7 +2704,8 @@ static int browseDHCPv4ClientSentOptionInst(struct dmctx *dmctx, DMNODE *parent_
struct dhcp_client_args *dhcp_client_args = (struct dhcp_client_args*)prev_data;
struct uci_section *dmmap_sect;
struct dhcp_client_option_args dhcp_client_opt_args = {0};
char *instance, *instnbr = NULL, *v1, *v2, **sentopts = NULL, **buf = NULL, *tmp, *optionvalue, *v = NULL;
struct browse_args browse_args = {0};
char *inst, *max_inst = NULL, *v1, *v2, **sentopts = NULL, **buf = NULL, *tmp, *optionvalue, *v = NULL;
size_t length = 0, lgh2;
int i, j;
@ -2725,8 +2743,14 @@ static int browseDHCPv4ClientSentOptionInst(struct dmctx *dmctx, DMNODE *parent_
dhcp_client_opt_args.value= dmstrdup(v2);
dhcp_client_opt_args.opt_sect= dmmap_sect;
instance = handle_update_instance(1, dmctx, &instnbr, update_instance_alias_bbfdm, 3, dmmap_sect, "bbf_dhcpv4_sentopt_instance", "bbf_dhcpv4_sentopt_alias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, &dhcp_client_opt_args, instance) == DM_STOP)
browse_args.option = "section_name";
browse_args.value = section_name(dhcp_client_args->dhcp_client_conf);
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 7,
dmmap_sect, "bbf_dhcpv4_sentopt_instance", "bbf_dhcpv4_sentopt_alias", "dmmap_dhcp_client", "send_option",
check_browse_section, (void *)&browse_args);
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&dhcp_client_opt_args, inst) == DM_STOP)
break;
}
return 0;
@ -2737,7 +2761,8 @@ static int browseDHCPv4ClientReqOptionInst(struct dmctx *dmctx, DMNODE *parent_n
struct dhcp_client_args *dhcp_client_args = (struct dhcp_client_args*)prev_data;
struct uci_section *dmmap_sect;
struct dhcp_client_option_args dhcp_client_opt_args = {0};
char *instance, *instnbr = NULL, *v1, **reqtopts = NULL, *v = NULL;
struct browse_args browse_args = {0};
char *inst, *max_inst = NULL, *v1, **reqtopts = NULL, *v = NULL;
size_t length = 0;
int i;
@ -2760,8 +2785,14 @@ static int browseDHCPv4ClientReqOptionInst(struct dmctx *dmctx, DMNODE *parent_n
dhcp_client_opt_args.value = dmstrdup("");
dhcp_client_opt_args.opt_sect = dmmap_sect;
instance = handle_update_instance(1, dmctx, &instnbr, update_instance_alias_bbfdm, 3, dmmap_sect, "bbf_dhcpv4_reqtopt_instance", "bbf_dhcpv4_reqtopt_alias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, &dhcp_client_opt_args, instance) == DM_STOP)
browse_args.option = "section_name";
browse_args.value = section_name(dhcp_client_args->dhcp_client_conf);
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 7,
dmmap_sect, "bbf_dhcpv4_reqtopt_instance", "bbf_dhcpv4_reqtopt_alias", "dmmap_dhcp_client", "req_option",
check_browse_section, (void *)&browse_args);
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&dhcp_client_opt_args, inst) == DM_STOP)
break;
}
return 0;
@ -2773,7 +2804,8 @@ static int browseDHCPv4ServerPoolOptionInst(struct dmctx *dmctx, DMNODE *parent_
struct uci_element *e;
struct dhcp_args *curr_dhcp_args = (struct dhcp_args*)prev_data;
struct uci_section *dmmap_sect;
char **tagvalue = NULL, *instance, *instnbr = NULL, *optionvalue = NULL, *tmp, *v1, *v2, *v;
struct browse_args browse_args = {0};
char **tagvalue = NULL, *inst, *max_inst = NULL, *optionvalue = NULL, *tmp, *v1, *v2, *v;
size_t length;
int j;
struct dhcp_client_option_args dhcp_client_opt_args = {0};
@ -2808,8 +2840,15 @@ static int browseDHCPv4ServerPoolOptionInst(struct dmctx *dmctx, DMNODE *parent_
dhcp_client_opt_args.option_tag = dmstrdup(v1);
dhcp_client_opt_args.value = dmstrdup(v2);
dhcp_client_opt_args.opt_sect = dmmap_sect;
instance = handle_update_instance(1, dmctx, &instnbr, update_instance_alias_bbfdm, 3, dmmap_sect, "bbf_dhcpv4_servpool_option_instance", "bbf_dhcpv4_servpool_option_alias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, &dhcp_client_opt_args, instance) == DM_STOP)
browse_args.option = "section_name";
browse_args.value = section_name(curr_dhcp_args->dhcp_sec);
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 7,
dmmap_sect, "bbf_dhcpv4_servpool_option_instance", "bbf_dhcpv4_servpool_option_alias", "dmmap_dhcp", "servpool_option",
check_browse_section, (void *)&browse_args);
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&dhcp_client_opt_args, inst) == DM_STOP)
break;
}
return 0;
@ -2849,9 +2888,9 @@ struct uci_section* get_dhcp_classifier(char *classifier_name, char *network)
/*#Device.DHCPv4.Relay.Forwarding.{i}.!UCI:network/interface/dmmap_dhcp_relay*/
static int browseDHCPv4RelayForwardingInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
char *instance, *instnbr = NULL, *v, *dhcp_network = NULL;
char *inst, *max_inst = NULL, *v, *dhcp_network = NULL;
struct dmmap_dup *p;
char *type, *ipv4addr = "", *ipv6addr = "", *proto, *inst, *mask4 = NULL;
char *type, *ipv4addr = "", *ipv6addr = "", *proto, *ip_inst, *mask4 = NULL;
json_object *res, *jobj;
struct dhcp_client_args dhcp_relay_arg = {0};
LIST_HEAD(dup_list);
@ -2884,8 +2923,8 @@ static int browseDHCPv4RelayForwardingInst(struct dmctx *dmctx, DMNODE *parent_n
}
dmuci_get_value_by_section_string(p->config_section, "proto", &proto);
dmuci_get_value_by_section_string(p->config_section, "ip_int_instance", &inst);
if (ipv4addr[0] == '\0' && ipv6addr[0] == '\0' && strcmp(inst, "") == 0 && strcmp(type, "bridge") != 0 && strcmp(proto, "relay") != 0) {
dmuci_get_value_by_section_string(p->config_section, "ip_int_instance", &ip_inst);
if (ipv4addr[0] == '\0' && ipv6addr[0] == '\0' && strcmp(ip_inst, "") == 0 && strcmp(type, "bridge") != 0 && strcmp(proto, "relay") != 0) {
p->config_section = NULL;
DMUCI_SET_VALUE_BY_SECTION(bbfdm, p->dmmap_section, "section_name", "");
}
@ -2917,8 +2956,12 @@ static int browseDHCPv4RelayForwardingInst(struct dmctx *dmctx, DMNODE *parent_n
dhcp_relay_arg.dhcp_client_conf = p->config_section;
dhcp_relay_arg.dhcp_client_dm= p->dmmap_section;
instance = handle_update_instance(1, dmctx, &instnbr, update_instance_alias_bbfdm, 3, (void *)p->dmmap_section, "bbf_dhcpv4relay_instance", "bbf_dhcpv4relay_alias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, &dhcp_relay_arg, instance) == DM_STOP)
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
p->dmmap_section, "bbf_dhcpv4relay_instance", "bbf_dhcpv4relay_alias", "dmmap_dhcp_relay", "interface");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&dhcp_relay_arg, inst) == DM_STOP)
break;
}
return 0;
@ -2926,7 +2969,7 @@ static int browseDHCPv4RelayForwardingInst(struct dmctx *dmctx, DMNODE *parent_n
/*** DHCPv4. ***/
DMOBJ tDHCPv4Obj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"Client", &DMWRITE, addObjDHCPv4Client, delObjDHCPv4Client, NULL, browseDHCPv4ClientInst, NULL, NULL, NULL, tDHCPv4ClientObj, tDHCPv4ClientParams, NULL, BBFDM_BOTH},
{"Server", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tDHCPv4ServerObj, tDHCPv4ServerParams, NULL, BBFDM_BOTH},
{"Relay", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tDHCPv4RelayObj, tDHCPv4RelayParams, NULL, BBFDM_BOTH},
@ -2941,7 +2984,7 @@ DMLEAF tDHCPv4Params[] = {
/* *** Device.DHCPv4.Client.{i}. *** */
DMOBJ tDHCPv4ClientObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"SentOption", &DMWRITE, addObjDHCPv4ClientSentOption, delObjDHCPv4ClientSentOption, NULL, browseDHCPv4ClientSentOptionInst, NULL, NULL, NULL, NULL, tDHCPv4ClientSentOptionParams, NULL, BBFDM_BOTH},
{"ReqOption", &DMWRITE, addObjDHCPv4ClientReqOption, delObjDHCPv4ClientReqOption, NULL, browseDHCPv4ClientReqOptionInst, NULL, NULL, NULL, NULL, tDHCPv4ClientReqOptionParams, NULL, BBFDM_BOTH},
{0}
@ -2998,14 +3041,14 @@ DMLEAF tDHCPv4ServerParams[] = {
/*** DHCPv4.Server. ***/
DMOBJ tDHCPv4ServerObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"Pool", &DMWRITE, add_dhcp_server, delete_dhcp_server, NULL, browseDhcpInst, NULL, NULL, NULL, tDHCPv4ServerPoolObj, tDHCPv4ServerPoolParams, NULL, BBFDM_BOTH},
{0}
};
/*** DHCPv4.Server.Pool.{i}. ***/
DMOBJ tDHCPv4ServerPoolObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"StaticAddress", &DMWRITE, add_dhcp_staticaddress, delete_dhcp_staticaddress, NULL, browseDhcpStaticInst, NULL, NULL, NULL, NULL, tDHCPv4ServerPoolStaticAddressParams, NULL, BBFDM_BOTH},
{"Option", &DMWRITE, addObjDHCPv4ServerPoolOption, delObjDHCPv4ServerPoolOption, NULL, browseDHCPv4ServerPoolOptionInst, NULL, NULL, NULL, NULL, tDHCPv4ServerPoolOptionParams, NULL, BBFDM_BOTH},
{"Client", &DMREAD, NULL, NULL, NULL, browseDhcpClientInst, NULL, NULL, NULL, tDHCPv4ServerPoolClientObj, tDHCPv4ServerPoolClientParams, get_dhcp_client_linker},
@ -3014,7 +3057,7 @@ DMOBJ tDHCPv4ServerPoolObj[] = {
/*** DHCPv4.Server.Pool.{i}.Client.{i}. ***/
DMOBJ tDHCPv4ServerPoolClientObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"IPv4Address", &DMREAD, NULL, NULL, NULL, browseDhcpClientIPv4Inst, NULL, NULL, NULL, NULL, tDHCPv4ServerPoolClientIPv4AddressParams, NULL, BBFDM_BOTH},
//{"Option", &DMREAD, NULL, NULL, NULL, browseDHCPv4ServerPoolClientOptionInst, NULL, NULL, NULL, NULL, tDHCPv4ServerPoolClientOptionParams, NULL, BBFDM_BOTH},
{0}
@ -3087,7 +3130,7 @@ DMLEAF tDHCPv4ServerPoolClientOptionParams[] = {
/* *** Device.DHCPv4.Relay. *** */
DMOBJ tDHCPv4RelayObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"Forwarding", &DMWRITE, addObjDHCPv4RelayForwarding, delObjDHCPv4RelayForwarding, NULL, browseDHCPv4RelayForwardingInst, NULL, NULL, NULL, NULL, tDHCPv4RelayForwardingParams, NULL, BBFDM_BOTH},
{0}
};

View file

@ -120,7 +120,7 @@ static int browseDHCPv6ClientInst(struct dmctx *dmctx, DMNODE *parent_node, void
struct dmmap_dup *p;
struct dhcpv6_client_args dhcpv6_client_arg = {0};
json_object *res, *jobj;
char *instance, *instnbr = NULL, *ipv6addr = NULL;
char *inst, *max_inst = NULL, *ipv6addr = NULL;
LIST_HEAD(dup_list);
synchronize_specific_config_sections_with_dmmap_eq_no_delete("network", "interface", "dmmap_dhcpv6", "proto", "dhcpv6", &dup_list);
@ -133,8 +133,11 @@ static int browseDHCPv6ClientInst(struct dmctx *dmctx, DMNODE *parent_node, void
dhcpv6_client_arg.dhcp_client_conf = p->config_section;
dhcpv6_client_arg.dhcp_client_dm = p->dmmap_section;
dhcpv6_client_arg.ip = dmstrdup(ipv6addr?ipv6addr:"");
instance = handle_update_instance(1, dmctx, &instnbr, update_instance_alias, 3, p->dmmap_section, "bbf_dhcpv6client_instance", "bbf_dhcpv6client_alias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, &dhcpv6_client_arg, instance) == DM_STOP)
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
p->dmmap_section, "bbf_dhcpv6client_instance", "bbf_dhcpv6client_alias", "dmmap_dhcpv6", "interface");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&dhcpv6_client_arg, inst) == DM_STOP)
break;
}
free_dmmap_config_dup_list(&dup_list);
@ -144,7 +147,7 @@ static int browseDHCPv6ClientInst(struct dmctx *dmctx, DMNODE *parent_node, void
/*#Device.DHCPv6.Server.Pool.{i}.!UCI:dhcp/dhcp/dmmap_dhcpv6*/
static int browseDHCPv6ServerPoolInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
char *interface, *idhcp = NULL, *idhcp_last = NULL, *v;
char *interface, *inst = NULL, *max_inst = NULL, *v;
struct dhcpv6_args curr_dhcp6_args = {0};
struct dmmap_dup *p;
LIST_HEAD(dup_list);
@ -153,14 +156,17 @@ static int browseDHCPv6ServerPoolInst(struct dmctx *dmctx, DMNODE *parent_node,
list_for_each_entry(p, &dup_list, list) {
dmuci_get_value_by_section_string(p->config_section, "interface", &interface);
init_dhcpv6_args(&curr_dhcp6_args, p->config_section, interface);
idhcp = handle_update_instance(1, dmctx, &idhcp_last, update_instance_alias_bbfdm, 3, p->dmmap_section, "dhcpv6_serv_pool_instance", "dhcpv6_serv_pool_alias");
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
p->dmmap_section, "dhcpv6_serv_pool_instance", "dhcpv6_serv_pool_alias", "dmmap_dhcpv6", "dhcp");
dmuci_get_value_by_section_string(p->dmmap_section, "order", &v);
if (v == NULL || strlen(v) == 0)
set_section_dhcp6_order("dhcp", "dmmap_dhcpv6", "dhcp", p->dmmap_section, p->config_section, 0, idhcp);
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_dhcp6_args, idhcp) == DM_STOP)
set_section_dhcp6_order("dhcp", "dmmap_dhcpv6", "dhcp", p->dmmap_section, p->config_section, 0, inst);
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_dhcp6_args, inst) == DM_STOP)
break;
}
free_dmmap_config_dup_list(&dup_list);
return 0;
@ -172,7 +178,7 @@ static int browseDHCPv6ServerPoolClientInst(struct dmctx *dmctx, DMNODE *parent_
json_object *res, *res1, *jobj, *dev_obj= NULL, *net_obj= NULL;
struct clientv6_args curr_dhcp_client_args = {0};
int i = 0;
char *idx = NULL, *idx_last = NULL, *device;
char *inst = NULL, *max_inst = NULL, *device;
dmubus_call("network.interface", "status", UBUS_ARGS{{"interface", section_name(dhcp_arg->dhcp_sec), String}}, 1, &res1);
if (!res1) return 0;
@ -189,8 +195,8 @@ static int browseDHCPv6ServerPoolClientInst(struct dmctx *dmctx, DMNODE *parent_
if (!jobj) break;
init_dhcpv6_client_args(&curr_dhcp_client_args, jobj, NULL, i);
i++;
idx = handle_update_instance(2, dmctx, &idx_last, update_instance_without_section, 1, i);
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_dhcp_client_args, idx) == DM_STOP)
inst = handle_update_instance(2, dmctx, &max_inst, update_instance_without_section, 1, i);
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_dhcp_client_args, inst) == DM_STOP)
break;
}
return 0;
@ -202,7 +208,8 @@ static int browseDHCPv6ServerPoolOptionInst(struct dmctx *dmctx, DMNODE *parent_
struct uci_element *e;
struct dhcpv6_args *curr_dhcp_args = (struct dhcpv6_args*)prev_data;
struct uci_section *dmmap_sect;
char **tagvalue = NULL, *instance, *instnbr = NULL, *optionvalue= NULL, *tmp, *v1, *v2, *v;
struct browse_args browse_args = {0};
char **tagvalue = NULL, *inst, *max_inst = NULL, *optionvalue= NULL, *tmp, *v1, *v2, *v;
size_t length;
int j;
struct dhcpv6_client_option_args dhcp_client_opt_args = {0};
@ -238,8 +245,15 @@ static int browseDHCPv6ServerPoolOptionInst(struct dmctx *dmctx, DMNODE *parent_
dhcp_client_opt_args.option_tag = dmstrdup(v1);
dhcp_client_opt_args.value = dmstrdup(v2);
dhcp_client_opt_args.opt_sect = dmmap_sect;
instance= handle_update_instance(1, dmctx, &instnbr, update_instance_alias_bbfdm, 3, dmmap_sect, "bbf_dhcpv6_servpool_option_instance", "bbf_dhcpv6_servpool_option_alias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, &dhcp_client_opt_args, instance) == DM_STOP)
browse_args.option = "section_name";
browse_args.value = section_name(curr_dhcp_args->dhcp_sec);
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 7,
dmmap_sect, "bbf_dhcpv6_servpool_option_instance", "bbf_dhcpv6_servpool_option_alias", "dmmap_dhcpv6", "servpool_option",
check_browse_section, (void *)&browse_args);
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&dhcp_client_opt_args, inst) == DM_STOP)
break;
}
return 0;
@ -250,7 +264,7 @@ static int browseDHCPv6ServerPoolClientIPv6AddressInst(struct dmctx *dmctx, DMNO
struct clientv6_args *dhcpv6_serv_pool_client = (struct clientv6_args *)prev_data;
json_object *address_obj= NULL;
struct clientv6_args curr_dhcv6_address_args = {0};
char *idx = NULL, *idx_last = NULL;
char *inst = NULL, *max_inst = NULL;
int i = 0;
while (1) {
@ -259,8 +273,8 @@ static int browseDHCPv6ServerPoolClientIPv6AddressInst(struct dmctx *dmctx, DMNO
break;
init_dhcpv6_client_args(&curr_dhcv6_address_args, dhcpv6_serv_pool_client->client, address_obj, i);
i++;
idx = handle_update_instance(2, dmctx, &idx_last, update_instance_without_section, 1, i);
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_dhcv6_address_args, idx) == DM_STOP)
inst = handle_update_instance(2, dmctx, &max_inst, update_instance_without_section, 1, i);
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_dhcv6_address_args, inst) == DM_STOP)
break;
}
@ -272,7 +286,7 @@ static int browseDHCPv6ServerPoolClientIPv6PrefixInst(struct dmctx *dmctx, DMNOD
struct clientv6_args *dhcpv6_serv_pool_client = (struct clientv6_args *)prev_data;
json_object *address_obj = NULL;
struct clientv6_args curr_dhcv6_address_args = {0};
char *idx = NULL, *idx_last = NULL;
char *inst = NULL, *max_inst = NULL;
int i = 0;
while (1) {
@ -281,8 +295,8 @@ static int browseDHCPv6ServerPoolClientIPv6PrefixInst(struct dmctx *dmctx, DMNOD
break;
init_dhcpv6_client_args(&curr_dhcv6_address_args, dhcpv6_serv_pool_client->client, address_obj, i);
i++;
idx = handle_update_instance(2, dmctx, &idx_last, update_instance_without_section, 1, i);
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_dhcv6_address_args, idx) == DM_STOP)
inst = handle_update_instance(2, dmctx, &max_inst, update_instance_without_section, 1, i);
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_dhcv6_address_args, inst) == DM_STOP)
break;
}
@ -302,7 +316,7 @@ static int addObjDHCPv6Client(char *refparam, struct dmctx *ctx, void *data, cha
dmuci_set_value_by_section(s, "type", "anywan");
dmuci_add_section_bbfdm("dmmap_dhcpv6", "interface", &dmmap_sect, &v);
dmuci_set_value_by_section(dmmap_sect, "section_name", section_name(s));
*instance = update_instance_bbfdm(dmmap_sect, instancepara, "bbf_dhcpv6client_instance");
*instance = update_instance(dmmap_sect, instancepara, "bbf_dhcpv6client_instance");
return 0;
}
@ -367,7 +381,7 @@ static int addObjDHCPv6ServerPool(char *refparam, struct dmctx *ctx, void *data,
dmuci_add_section_bbfdm("dmmap_dhcpv6", "dhcp", &dmmap_dhcp, &v);
dmuci_set_value_by_section(dmmap_dhcp, "section_name", section_name(s));
*instance = update_instance_bbfdm(dmmap_dhcp, instancepara, "dhcpv6_serv_pool_instance");
*instance = update_instance(dmmap_dhcp, instancepara, "dhcpv6_serv_pool_instance");
return 0;
}
@ -428,7 +442,7 @@ static int addObjDHCPv6ServerPoolOption(char *refparam, struct dmctx *ctx, void
if (dhcp_arg->dhcp_sec != NULL)
DMUCI_SET_VALUE_BY_SECTION(bbfdm, dmmap_sect, "section_name", section_name(dhcp_arg->dhcp_sec));
DMUCI_SET_VALUE_BY_SECTION(bbfdm, dmmap_sect, "option_tag", "0");
*instance = update_instance_bbfdm(dmmap_sect, instancepara, "bbf_dhcpv6_servpool_option_instance");
*instance = update_instance(dmmap_sect, instancepara, "bbf_dhcpv6_servpool_option_instance");
return 0;
}
@ -1383,7 +1397,7 @@ static int set_DHCPv6ServerPoolOption_Value(char *refparam, struct dmctx *ctx, v
/* *** Device.DHCPv6. *** */
DMOBJ tDHCPv6Obj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"Client", &DMWRITE, addObjDHCPv6Client, delObjDHCPv6Client, NULL, browseDHCPv6ClientInst, NULL, NULL, NULL, tDHCPv6ClientObj, tDHCPv6ClientParams, NULL, BBFDM_BOTH},
{"Server", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tDHCPv6ServerObj, tDHCPv6ServerParams, NULL, BBFDM_BOTH},
{0}
@ -1397,7 +1411,7 @@ DMLEAF tDHCPv6Params[] = {
/* *** Device.DHCPv6.Client.{i}. *** */
DMOBJ tDHCPv6ClientObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
//{"Server", &DMREAD, NULL, NULL, NULL, browseDHCPv6ClientServerInst, NULL, NULL, NULL, NULL, tDHCPv6ClientServerParams, NULL, BBFDM_BOTH},
//{"SentOption", &DMWRITE, addObjDHCPv6ClientSentOption, delObjDHCPv6ClientSentOption, NULL, browseDHCPv6ClientSentOptionInst, NULL, NULL, NULL, NULL, tDHCPv6ClientSentOptionParams, NULL, BBFDM_BOTH},
//{"ReceivedOption", &DMREAD, NULL, NULL, NULL, browseDHCPv6ClientReceivedOptionInst, NULL, NULL, NULL, NULL, tDHCPv6ClientReceivedOptionParams, NULL, BBFDM_BOTH},
@ -1455,7 +1469,7 @@ DMLEAF tDHCPv6ClientReceivedOptionParams[] = {
/* *** Device.DHCPv6.Server. *** */
DMOBJ tDHCPv6ServerObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"Pool", &DMWRITE, addObjDHCPv6ServerPool, delObjDHCPv6ServerPool, NULL, browseDHCPv6ServerPoolInst, NULL, NULL, NULL, tDHCPv6ServerPoolObj, tDHCPv6ServerPoolParams, NULL, BBFDM_BOTH},
{0}
};
@ -1469,7 +1483,7 @@ DMLEAF tDHCPv6ServerParams[] = {
/* *** Device.DHCPv6.Server.Pool.{i}. *** */
DMOBJ tDHCPv6ServerPoolObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"Client", &DMREAD, NULL, NULL, NULL, browseDHCPv6ServerPoolClientInst, NULL, NULL, NULL, tDHCPv6ServerPoolClientObj, tDHCPv6ServerPoolClientParams, NULL, BBFDM_BOTH},
{"Option", &DMWRITE, addObjDHCPv6ServerPoolOption, delObjDHCPv6ServerPoolOption, NULL, browseDHCPv6ServerPoolOptionInst, NULL, NULL, NULL, NULL, tDHCPv6ServerPoolOptionParams, NULL, BBFDM_BOTH},
{0}
@ -1505,7 +1519,7 @@ DMLEAF tDHCPv6ServerPoolParams[] = {
/* *** Device.DHCPv6.Server.Pool.{i}.Client.{i}. *** */
DMOBJ tDHCPv6ServerPoolClientObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"IPv6Address", &DMREAD, NULL, NULL, NULL, browseDHCPv6ServerPoolClientIPv6AddressInst, NULL, NULL, NULL, NULL, tDHCPv6ServerPoolClientIPv6AddressParams, NULL, BBFDM_BOTH},
{"IPv6Prefix", &DMREAD, NULL, NULL, NULL, browseDHCPv6ServerPoolClientIPv6PrefixInst, NULL, NULL, NULL, NULL, tDHCPv6ServerPoolClientIPv6PrefixParams, NULL, BBFDM_BOTH},
//{"Option", &DMREAD, NULL, NULL, NULL, browseDHCPv6ServerPoolClientOptionInst, NULL, NULL, NULL, NULL, tDHCPv6ServerPoolClientOptionParams, NULL, BBFDM_BOTH},

View file

@ -114,12 +114,15 @@ static int dmmap_synchronizeDNSClientRelayServer(struct dmctx *dmctx, DMNODE *pa
static int browseServerInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
struct uci_section *s = NULL;
char *instance, *instnbr = NULL;
char *inst, *max_inst = NULL;
dmmap_synchronizeDNSClientRelayServer(dmctx, NULL, NULL, NULL);
uci_path_foreach_sections(bbfdm, "dmmap_dns", "dns_server", s) {
instance = handle_update_instance(1, dmctx, &instnbr, update_instance_alias_bbfdm, 3, s, "dns_server_instance", "dns_server_alias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)s, instance) == DM_STOP)
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
s, "dns_server_instance", "dns_server_alias", "dmmap_dns", "dns_server");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)s, inst) == DM_STOP)
break;
}
return 0;
@ -128,14 +131,16 @@ static int browseServerInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev
static int browseRelayForwardingInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
struct uci_section *s = NULL;
char *instance, *instnbr = NULL;
char *inst, *max_inst = NULL;
dmmap_synchronizeDNSClientRelayServer(dmctx, NULL, NULL, NULL);
uci_path_foreach_sections(bbfdm, "dmmap_dns", "dns_server", s) {
instance = handle_update_instance(1, dmctx, &instnbr, update_instance_alias_bbfdm, 3, s, "dns_server_instance", "dns_server_alias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)s, instance) == DM_STOP)
break;
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
s, "dns_server_instance", "dns_server_alias", "dmmap_dns", "dns_server");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)s, inst) == DM_STOP)
break;
}
return 0;
}
@ -143,11 +148,14 @@ static int browseRelayForwardingInst(struct dmctx *dmctx, DMNODE *parent_node, v
static int browseResultInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
struct uci_section *s = NULL;
char *instance, *idx_last = NULL;
char *inst, *max_inst = NULL;
uci_foreach_sections_state("cwmp", "NSLookupResult", s) {
instance = handle_update_instance(2, dmctx, &idx_last, update_instance_alias, 3, (void *)s, "nslookup_res_instance", "nslookup_res_alias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)s, instance) == DM_STOP)
inst = handle_update_instance(2, dmctx, &max_inst, update_instance_alias, 5,
s, "nslookup_res_instance", "nslookup_res_alias", "cwmp", "NSLookupResult");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)s, inst) == DM_STOP)
break;
}
return 0;
@ -166,7 +174,7 @@ static int add_client_server(char *refparam, struct dmctx *ctx, void *data, char
dmuci_set_value_by_section(s, "ip", "0.0.0.0");
dmuci_set_value_by_section(s, "interface", "lan");
dmuci_set_value_by_section(s, "enable", "1");
*instance = update_instance_bbfdm(s, inst, "dns_server_instance");
*instance = update_instance(s, inst, "dns_server_instance");
return 0;
}
@ -182,7 +190,7 @@ static int add_relay_forwarding(char *refparam, struct dmctx *ctx, void *data, c
dmuci_set_value_by_section(s, "ip", "0.0.0.0");
dmuci_set_value_by_section(s, "interface", "lan");
dmuci_set_value_by_section(s, "enable", "1");
*instance = update_instance_bbfdm(s, inst, "dns_server_instance");
*instance = update_instance(s, inst, "dns_server_instance");
return 0;
}
@ -922,7 +930,7 @@ static int set_nslookupdiagnostics_number_of_repetitions(char *refparam, struct
/* *** Device.DNS. *** */
DMOBJ tDNSObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"Client", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tDNSClientObj, tDNSClientParams, NULL, BBFDM_BOTH},
{"Relay", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tDNSRelayObj, tDNSRelayParams, NULL, BBFDM_BOTH},
{"Diagnostics", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tDNSDiagnosticsObj, NULL, NULL, BBFDM_BOTH},
@ -937,7 +945,7 @@ DMLEAF tDNSParams[] = {
/* *** Device.DNS.Client. *** */
DMOBJ tDNSClientObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"Server", &DMWRITE, add_client_server, delete_client_server, NULL, browseServerInst, NULL, NULL, NULL, NULL, tDNSClientServerParams, NULL, BBFDM_BOTH},
{0}
};
@ -964,7 +972,7 @@ DMLEAF tDNSClientServerParams[] = {
/* *** Device.DNS.Relay. *** */
DMOBJ tDNSRelayObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"Forwarding", &DMWRITE, add_relay_forwarding, delete_relay_forwarding, NULL, browseRelayForwardingInst, NULL, NULL, NULL, NULL, tDNSRelayForwardingParams, NULL, BBFDM_BOTH},
{0}
};
@ -991,14 +999,14 @@ DMLEAF tDNSRelayForwardingParams[] = {
/* *** Device.DNS.Diagnostics. *** */
DMOBJ tDNSDiagnosticsObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"NSLookupDiagnostics", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tDNSDiagnosticsNSLookupDiagnosticsObj, tDNSDiagnosticsNSLookupDiagnosticsParams, NULL, BBFDM_BOTH},
{0}
};
/* *** Device.DNS.Diagnostics.NSLookupDiagnostics. *** */
DMOBJ tDNSDiagnosticsNSLookupDiagnosticsObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"Result", &DMREAD, NULL, NULL, NULL, browseResultInst, NULL, NULL, NULL, NULL, tDNSDiagnosticsNSLookupDiagnosticsResultParams, NULL, BBFDM_BOTH},
{0}
};

View file

@ -106,7 +106,7 @@ static int browseDSLLineInst(struct dmctx *dmctx, DMNODE *parent_node, void *pre
json_object *res = NULL, *line_obj = NULL;
struct dsl_line_args cur_dsl_line_args = {0};
struct uci_section *s = NULL;
char *dsl_int = NULL, *dsl_int_last = NULL;
char *inst = NULL, *max_inst = NULL;
int entries = 0;
dmubus_call("dsl", "status", UBUS_ARGS{}, 0, &res);
@ -117,8 +117,11 @@ static int browseDSLLineInst(struct dmctx *dmctx, DMNODE *parent_node, void *pre
entries++;
s = update_create_dmmap_dsl_line(cur_dsl_line_args.id);
init_dsl_line(&cur_dsl_line_args, s);
dsl_int = handle_update_instance(1, dmctx, &dsl_int_last, update_instance_alias, 3, s, "dsl_line_instance", "dsl_line_alias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&cur_dsl_line_args, dsl_int) == DM_STOP)
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
s, "dsl_line_instance", "dsl_line_alias", "dmmap", "dsl_line");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&cur_dsl_line_args, inst) == DM_STOP)
break;
}
else
@ -132,7 +135,7 @@ static int browseDSLChannelInst(struct dmctx *dmctx, DMNODE *parent_node, void *
json_object *res = NULL, *line_obj = NULL, *channel_obj = NULL;
struct dsl_channel_args cur_dsl_channel_args = {0};
struct uci_section *s = NULL;
char *dsl_int = NULL, *dsl_int_last = NULL;
char *inst = NULL, *max_inst = NULL;
int entries_line = 0, entries_channel = 0;
dmubus_call("dsl", "status", UBUS_ARGS{}, 0, &res);
@ -145,8 +148,11 @@ static int browseDSLChannelInst(struct dmctx *dmctx, DMNODE *parent_node, void *
entries_channel++;
s = update_create_dmmap_dsl_channel(cur_dsl_channel_args.id);
init_dsl_channel(&cur_dsl_channel_args, s);
dsl_int = handle_update_instance(1, dmctx, &dsl_int_last, update_instance_alias, 3, s, "dsl_channel_instance", "dsl_channel_alias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&cur_dsl_channel_args, dsl_int) == DM_STOP)
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
s, "dsl_channel_instance", "dsl_channel_alias", "dmmap", "dsl_line");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&cur_dsl_channel_args, inst) == DM_STOP)
break;
}
else
@ -1321,7 +1327,7 @@ static int get_DSLChannelStatsQuarterHour_XTUCCRCErrors(char *refparam, struct d
/* *** Device.DSL. *** */
DMOBJ tDSLObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"Line", &DMREAD, NULL, NULL, NULL, browseDSLLineInst, NULL, NULL, NULL, tDSLLineObj, tDSLLineParams, get_dsl_line_linker, BBFDM_BOTH},
{"Channel", &DMREAD, NULL, NULL, NULL, browseDSLChannelInst, NULL, NULL, NULL, tDSLChannelObj, tDSLChannelParams, get_dsl_channel_linker, BBFDM_BOTH},
{0}
@ -1336,7 +1342,7 @@ DMLEAF tDSLParams[] = {
/* *** Device.DSL.Line.{i}. *** */
DMOBJ tDSLLineObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"Stats", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tDSLLineStatsObj, tDSLLineStatsParams, NULL, BBFDM_BOTH},
{0}
};
@ -1396,7 +1402,7 @@ DMLEAF tDSLLineParams[] = {
/* *** Device.DSL.Line.{i}.Stats. *** */
DMOBJ tDSLLineStatsObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"Total", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tDSLLineStatsTotalParams, NULL, BBFDM_BOTH},
{"Showtime", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tDSLLineStatsShowtimeParams, NULL, BBFDM_BOTH},
{"LastShowtime", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tDSLLineStatsLastShowtimeParams, NULL, BBFDM_BOTH},
@ -1457,7 +1463,7 @@ DMLEAF tDSLLineStatsQuarterHourParams[] = {
/* *** Device.DSL.Channel.{i}. *** */
DMOBJ tDSLChannelObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"Stats", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tDSLChannelStatsObj, tDSLChannelStatsParams, NULL, BBFDM_BOTH},
{0}
};
@ -1489,7 +1495,7 @@ DMLEAF tDSLChannelParams[] = {
/* *** Device.DSL.Channel.{i}.Stats. *** */
DMOBJ tDSLChannelStatsObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"Total", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tDSLChannelStatsTotalParams, NULL, BBFDM_BOTH},
{"Showtime", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tDSLChannelStatsShowtimeParams, NULL, BBFDM_BOTH},
{"LastShowtime", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tDSLChannelStatsLastShowtimeParams, NULL, BBFDM_BOTH},

View file

@ -35,13 +35,16 @@ static int get_linker_dynamicdns_server(char *refparam, struct dmctx *dmctx, voi
/*#Device.DynamicDNS.Client.{i}.!UCI:ddns/service/dmmap_ddns*/
static int browseDynamicDNSClientInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
char *inst = NULL, *inst_last = NULL;
char *inst = NULL, *max_inst = NULL;
struct dmmap_dup *p;
LIST_HEAD(dup_list);
synchronize_specific_config_sections_with_dmmap("ddns", "service", "dmmap_ddns", &dup_list);
list_for_each_entry(p, &dup_list, list) {
inst = handle_update_instance(1, dmctx, &inst_last, update_instance_alias, 3, p->dmmap_section, "clientinstance", "clientalias");
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
p->dmmap_section, "clientinstance", "clientalias", "dmmap_ddns", "service");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, inst) == DM_STOP)
break;
}
@ -125,13 +128,15 @@ static int dmmap_synchronizeDynamicDNSServer(struct dmctx *dmctx, DMNODE *parent
/*#Device.DynamicDNS.Server.{i}.!UCI:ddns/service/dmmap_ddns*/
static int browseDynamicDNSServerInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
char *inst = NULL, *inst_last = NULL;
char *inst = NULL, *max_inst = NULL;
struct uci_section *s = NULL;
dmmap_synchronizeDynamicDNSServer(dmctx, NULL, NULL, NULL);
uci_path_foreach_sections(bbfdm, "dmmap_ddns", "ddns_server", s)
{
inst = handle_update_instance(1, dmctx, &inst_last, update_instance_alias, 3, s, "serverinstance", "serveralias");
uci_path_foreach_sections(bbfdm, "dmmap_ddns", "ddns_server", s) {
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
s, "serverinstance", "serveralias", "dmmap_ddns", "ddns_server");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)s, inst) == DM_STOP)
break;
}
@ -172,7 +177,7 @@ static int addObjDynamicDNSClient(char *refparam, struct dmctx *ctx, void *data,
dmuci_add_section_bbfdm("dmmap_ddns", "service", &dmmap, &v);
dmuci_set_value_by_section(dmmap, "section_name", section_name(s));
*instance = update_instance_bbfdm(dmmap, last_inst, "clientinstance");
*instance = update_instance(dmmap, last_inst, "clientinstance");
return 0;
}
@ -235,7 +240,7 @@ static int addObjDynamicDNSServer(char *refparam, struct dmctx *ctx, void *data,
dmuci_add_section_bbfdm("dmmap_ddns", "ddns_server", &dmmap, &v);
dmuci_set_value_by_section(dmmap, "section_name", section_name(s));
*instance = update_instance_bbfdm(dmmap, last_inst, "serverinstance");
*instance = update_instance(dmmap, last_inst, "serverinstance");
return 0;
}
@ -1059,7 +1064,7 @@ static int set_DynamicDNSServer_MaxRetries(char *refparam, struct dmctx *ctx, vo
/* *** Device.DynamicDNS. *** */
DMOBJ tDynamicDNSObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"Client", &DMWRITE, addObjDynamicDNSClient, delObjDynamicDNSClient, NULL, browseDynamicDNSClientInst, NULL, NULL, NULL, tDynamicDNSClientObj, tDynamicDNSClientParams, NULL, BBFDM_BOTH},
{"Server", &DMWRITE, addObjDynamicDNSServer, delObjDynamicDNSServer, NULL, browseDynamicDNSServerInst, NULL, NULL, NULL, NULL, tDynamicDNSServerParams, get_linker_dynamicdns_server, BBFDM_BOTH},
{0}
@ -1075,7 +1080,7 @@ DMLEAF tDynamicDNSParams[] = {
/* *** Device.DynamicDNS.Client.{i}. *** */
DMOBJ tDynamicDNSClientObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"Hostname", &DMWRITE, NULL, NULL, NULL, browseDynamicDNSClientHostnameInst, NULL, NULL, NULL, NULL, tDynamicDNSClientHostnameParams, NULL, BBFDM_BOTH},
{0}
};

View file

@ -205,7 +205,7 @@ static char *get_vlan_last_instance_bbfdm(char *package, char *section, char *op
dmuci_set_value_by_section(s, "vlan_term_instance", "");
continue;
}
inst = update_instance_bbfdm(s, last_inst, opt_inst);
inst = update_instance(s, last_inst, opt_inst);
if(last_inst)
dmfree(last_inst);
last_inst = dmstrdup(inst);
@ -219,7 +219,7 @@ static char *get_vlan_last_instance_bbfdm(char *package, char *section, char *op
/*#Device.Ethernet.Interface.{i}.!UCI:ports/ethport/dmmap_ports*/
static int browseEthernetInterfaceInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
char *int_num = NULL, *int_num_last = NULL, *ifname;
char *inst = NULL, *max_inst = NULL, *ifname;
struct eth_port_args curr_eth_port_args = {0};
struct dmmap_dup *p = NULL;
LIST_HEAD(dup_list);
@ -228,8 +228,11 @@ static int browseEthernetInterfaceInst(struct dmctx *dmctx, DMNODE *parent_node,
list_for_each_entry(p, &dup_list, list) {
dmuci_get_value_by_section_string(p->config_section, "ifname", &ifname);
init_eth_port(&curr_eth_port_args, p->config_section, ifname);
int_num = handle_update_instance(1, dmctx, &int_num_last, update_instance_alias, 3, p->dmmap_section, "eth_port_instance", "eth_port_alias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_eth_port_args, int_num) == DM_STOP)
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
p->dmmap_section, "eth_port_instance", "eth_port_alias", "dmmap_ports", "ethport");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_eth_port_args, inst) == DM_STOP)
break;
}
free_dmmap_config_dup_list(&dup_list);
@ -240,13 +243,16 @@ static int browseEthernetLinkInst(struct dmctx *dmctx, DMNODE *parent_node, void
{
struct dm_args args = {0};
struct uci_section *s = NULL;
char *id_last = NULL, *id = NULL;
char *inst = NULL, *max_inst = NULL;
dmmap_synchronizeEthernetLink(dmctx, NULL, NULL, NULL);
uci_path_foreach_sections(bbfdm, DMMAP, "link", s) {
args.section = s;
id = handle_update_instance(1, dmctx, &id_last, update_instance_alias_bbfdm, 3, s, "link_instance", "link_alias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&args, id) == DM_STOP)
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
s, "link_instance", "link_alias", "dmmap", "link");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&args, inst) == DM_STOP)
break;
}
return 0;
@ -255,7 +261,7 @@ static int browseEthernetLinkInst(struct dmctx *dmctx, DMNODE *parent_node, void
/*#Device.Ethernet.VLANTermination.{i}.!UCI:network/device/dmmap_network*/
static int browseEthernetVLANTerminationInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
char *type, *name, *vlan_term = NULL, *vlan_term_last = NULL;
char *type, *name, *inst = NULL, *max_inst = NULL;
struct dm_args curr_vlan_term_args = {0};
struct dmmap_dup *p = NULL;
LIST_HEAD(dup_list);
@ -267,8 +273,11 @@ static int browseEthernetVLANTerminationInst(struct dmctx *dmctx, DMNODE *parent
if (strcmp(type, "untagged") == 0 || (*name != '\0' && !is_vlan_termination_section(name)))
continue;
curr_vlan_term_args.section = p->config_section;
vlan_term = handle_update_instance(1, dmctx, &vlan_term_last, update_instance_alias, 3, p->dmmap_section, "vlan_term_instance", "vlan_term_alias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_vlan_term_args, vlan_term) == DM_STOP)
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
p->dmmap_section, "vlan_term_instance", "vlan_term_alias", "dmmap_network", "device");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_vlan_term_args, inst) == DM_STOP)
break;
}
free_dmmap_config_dup_list(&dup_list);
@ -277,7 +286,7 @@ static int browseEthernetVLANTerminationInst(struct dmctx *dmctx, DMNODE *parent
static int browseEthernetRMONStatsInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
char *idx = NULL, *idx_last = NULL, *ifname;
char *inst = NULL, *max_inst = NULL, *ifname;
struct eth_rmon_args curr_eth_rmon_args = {0};
struct dmmap_dup *p = NULL;
json_object *res = NULL;
@ -289,8 +298,11 @@ static int browseEthernetRMONStatsInst(struct dmctx *dmctx, DMNODE *parent_node,
dmubus_call("ethernet", "rmonstats", UBUS_ARGS{{"ifname", ifname, String}}, 1, &res);
if (!res) continue;
init_eth_rmon(&curr_eth_rmon_args, p->config_section, res);
idx = handle_update_instance(1, dmctx, &idx_last, update_instance_alias, 3, p->dmmap_section, "eth_rmon_instance", "eth_rmon_alias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_eth_rmon_args, idx) == DM_STOP)
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
p->dmmap_section, "eth_rmon_instance", "eth_rmon_alias", "dmmap_eth_rmon", "ethport");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_eth_rmon_args, inst) == DM_STOP)
break;
}
free_dmmap_config_dup_list(&dup_list);
@ -342,7 +354,7 @@ static int addObjEthernetLink(char *refparam, struct dmctx *ctx, void *data, cha
/* Add link section in dmmap file */
dmuci_add_section_bbfdm(DMMAP, "link", &dmmap_link, &v);
dmuci_set_value_by_section(dmmap_link, "section_name", interface_name);
*instance = update_instance_bbfdm(dmmap_link, inst, "link_instance");
*instance = update_instance(dmmap_link, inst, "link_instance");
return 0;
}
@ -406,7 +418,7 @@ static int addObjEthernetVLANTermination(char *refparam, struct dmctx *ctx, void
// Add device section in dmmap_network file
dmuci_add_section_bbfdm("dmmap_network", "device", &dmmap_network, &v);
dmuci_set_value_by_section(dmmap_network, "section_name", device_name);
*instance = update_instance_bbfdm(dmmap_network, inst, "vlan_term_instance");
*instance = update_instance(dmmap_network, inst, "vlan_term_instance");
return 0;
}

View file

@ -16,12 +16,13 @@
static int browseLevelInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
struct uci_section *s;
char *v, *instnbr = NULL;
char *v, *max_inst = NULL;
check_create_dmmap_package("dmmap_firewall");
s = is_dmmap_section_exist("dmmap_firewall", "level");
if (!s) dmuci_add_section_bbfdm("dmmap_firewall", "level", &s, &v);
handle_update_instance(1, dmctx, &instnbr, update_instance_alias, 3, s, "firewall_level_instance", "firewall_level_alias");
handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
s, "firewall_level_instance", "firewall_level_alias", "dmmap_firewall", "level");
DM_LINK_INST_OBJ(dmctx, parent_node, s, "1");
return 0;
}
@ -29,12 +30,13 @@ static int browseLevelInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_
static int browseChainInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
struct uci_section *s;
char *v, *instnbr = NULL;
char *v, *max_inst = NULL;
check_create_dmmap_package("dmmap_firewall");
s = is_dmmap_section_exist("dmmap_firewall", "chain");
if (!s) dmuci_add_section_bbfdm("dmmap_firewall", "chain", &s, &v);
handle_update_instance(1, dmctx, &instnbr, update_instance_alias, 3, s, "firewall_chain_instance", "firewall_chain_alias");
handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
s, "firewall_chain_instance", "firewall_chain_alias", "dmmap_firewall", "chain");
DM_LINK_INST_OBJ(dmctx, parent_node, s, "1");
return 0;
}
@ -42,14 +44,17 @@ static int browseChainInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_
/*#Device.Firewall.Chain.{i}.Rule.{i}.!UCI:firewall/rule/dmmap_firewall*/
static int browseRuleInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
char *instance, *instnbr = NULL;
char *inst, *max_inst = NULL;
struct dmmap_dup *p;
LIST_HEAD(dup_list);
synchronize_specific_config_sections_with_dmmap("firewall", "rule", "dmmap_firewall", &dup_list);
list_for_each_entry(p, &dup_list, list) {
instance = handle_update_instance(1, dmctx, &instnbr, update_instance_alias, 3, p->dmmap_section, "firewall_chain_rule_instance", "firewall_chain_rule_alias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, instance) == DM_STOP)
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
p->dmmap_section, "firewall_chain_rule_instance", "firewall_chain_rule_alias", "dmmap_firewall", "rule");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, inst) == DM_STOP)
break;
}
free_dmmap_config_dup_list(&dup_list);
@ -72,7 +77,7 @@ static int add_firewall_rule(char *refparam, struct dmctx *ctx, void *data, char
dmuci_add_section_bbfdm("dmmap_firewall", "rule", &dmmap_firewall_rule, &v);
dmuci_set_value_by_section(dmmap_firewall_rule, "section_name", sect_name);
*instance = update_instance_bbfdm(dmmap_firewall_rule, last_inst, "firewall_chain_rule_instance");
*instance = update_instance(dmmap_firewall_rule, last_inst, "firewall_chain_rule_instance");
return 0;
}
@ -1278,7 +1283,7 @@ static int set_time_span_stop_time(char *refparam, struct dmctx *ctx, void *data
/* *** Device.Firewall. *** */
DMOBJ tFirewallObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"Level", &DMREAD, NULL, NULL, NULL, browseLevelInst, NULL, NULL, NULL, NULL, tFirewallLevelParams, NULL, BBFDM_BOTH},
{"Chain", &DMREAD, NULL, NULL, NULL, browseChainInst, NULL, NULL, NULL, tFirewallChainObj, tFirewallChainParams, NULL, BBFDM_BOTH},
{0}
@ -1308,7 +1313,7 @@ DMLEAF tFirewallLevelParams[] = {
/* *** Device.Firewall.Chain.{i}. *** */
DMOBJ tFirewallChainObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"Rule", &DMWRITE, add_firewall_rule, delete_firewall_rule, NULL, browseRuleInst, NULL, NULL, NULL, tFirewallChainRuleObj, tFirewallChainRuleParams, NULL, BBFDM_BOTH},
{0}
};
@ -1325,7 +1330,7 @@ DMLEAF tFirewallChainParams[] = {
/* *** Device.Firewall.Chain.{i}.Rule.{i}. *** */
DMOBJ tFirewallChainRuleObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{CUSTOM_PREFIX"TimeSpan", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tTimeSpanParams, NULL, BBFDM_BOTH},
{0}
};

View file

@ -16,14 +16,17 @@
*************************************************************/
static int browseGRETunnelInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
char *gretun_inst= NULL, *gretun_inst_last= NULL;
char *inst = NULL, *max_inst = NULL;
struct dmmap_dup *p= NULL;
LIST_HEAD(dup_list);
synchronize_specific_config_sections_with_dmmap_eq("network", "interface", "dmmap_network", "proto", "gre", &dup_list);
list_for_each_entry(p, &dup_list, list) {
gretun_inst = handle_update_instance(1, dmctx, &gretun_inst_last, update_instance_alias, 3, p->dmmap_section, "gretunnel_instance", "gretunnel_alias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p, gretun_inst) == DM_STOP)
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
p->dmmap_section, "gretunnel_instance", "gretunnel_alias", "dmmap_network", "interface");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p, inst) == DM_STOP)
break;
}
free_dmmap_config_dup_list(&dup_list);
@ -42,9 +45,10 @@ struct uci_section *has_tunnel_interface_route(char *interface)
static int browseGRETunnelInterfaceInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
char *greiface_inst= NULL, *greiface_inst_last= NULL, *ifname= NULL;
struct dmmap_dup *p, *dm= (struct dmmap_dup *)prev_data;
char *inst = NULL, *max_inst = NULL, *ifname= NULL;
struct dmmap_dup *p, *dm = (struct dmmap_dup *)prev_data;
struct uci_section *s;
struct browse_args browse_args = {0};
LIST_HEAD(dup_list);
dmasprintf(&ifname, "@%s", section_name(dm->config_section));
@ -52,9 +56,17 @@ static int browseGRETunnelInterfaceInst(struct dmctx *dmctx, DMNODE *parent_node
list_for_each_entry(p, &dup_list, list) {
if ((s = has_tunnel_interface_route(section_name(p->config_section))) == NULL)
continue;
greiface_inst = handle_update_instance(1, dmctx, &greiface_inst_last, update_instance_alias, 3, p->dmmap_section, "greiface_instance", "greiface_alias");
p->additional_attribute= dm->config_section;
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p, greiface_inst) == DM_STOP)
p->additional_attribute = dm->config_section;
browse_args.option = "section_name";
browse_args.value = section_name(dm->config_section);
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 7,
p->dmmap_section, "greiface_instance", "greiface_alias", "dmmap_network", "interface",
check_browse_section, (void *)&browse_args);
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p, inst) == DM_STOP)
break;
}
free_dmmap_config_dup_list(&dup_list);
@ -77,7 +89,7 @@ static int addObjGRETunnel(char *refparam, struct dmctx *ctx, void *data, char *
dmuci_add_section_bbfdm("dmmap_network", "interface", &dmmap_sec, &v);
dmuci_set_value_by_section(dmmap_sec, "section_name", section_name(gre_sec));
*instancepara = update_instance_bbfdm(dmmap_sec, instance, "gretunnel_instance");
*instancepara = update_instance(dmmap_sec, instance, "gretunnel_instance");
return 0;
}
@ -139,7 +151,7 @@ static int addObjGRETunnelInterface(char *refparam, struct dmctx *ctx, void *dat
dmuci_add_section_bbfdm("dmmap_network", "interface", &dmmap_sec, &v);
dmuci_set_value_by_section(dmmap_sec, "section_name", section_name(greiface_sec));
dmuci_set_value_by_section(dmmap_sec, "gre_tunnel_sect", section_name(((struct dmmap_dup *)data)->config_section));
*instancepara = update_instance_bbfdm(dmmap_sec, instance, "greiface_instance");
*instancepara = update_instance(dmmap_sec, instance, "greiface_instance");
return 0;
}
@ -403,7 +415,7 @@ static int get_GRETunnelInterfaceStats_ErrorsReceived(char *refparam, struct dmc
/* *** Device.GRE. *** */
DMOBJ tGREObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nexjsontobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"Tunnel", &DMWRITE, addObjGRETunnel, delObjGRETunnel, NULL, browseGRETunnelInst, NULL, NULL, NULL, tGRETunnelObj, tGRETunnelParams, NULL, BBFDM_BOTH},
//{"Filter", &DMWRITE, addObjGREFilter, delObjGREFilter, NULL, browseGREFilterInst, NULL, NULL, NULL, NULL, tGREFilterParams, NULL, BBFDM_BOTH},
{0}
@ -418,7 +430,7 @@ DMLEAF tGREParams[] = {
/* *** Device.GRE.Tunnel.{i}. *** */
DMOBJ tGRETunnelObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nexjsontobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"Stats", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tGRETunnelStatsParams, NULL, BBFDM_BOTH},
{"Interface", &DMWRITE, addObjGRETunnelInterface, delObjGRETunnelInterface, NULL, browseGRETunnelInterfaceInst, NULL, NULL, NULL, tGRETunnelInterfaceObj, tGRETunnelInterfaceParams, NULL, BBFDM_BOTH},
{0}
@ -456,7 +468,7 @@ DMLEAF tGRETunnelStatsParams[] = {
/* *** Device.GRE.Tunnel.{i}.Interface.{i}. *** */
DMOBJ tGRETunnelInterfaceObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nexjsontobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"Stats", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tGRETunnelInterfaceStatsParams, NULL, BBFDM_BOTH},
{0}
};

View file

@ -18,14 +18,14 @@
int os__browseHostsHostInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
json_object *res = NULL, *host_obj = NULL, *arrobj = NULL;
char *idx = NULL, *idx_last = NULL;
char *inst = NULL, *max_inst = NULL;
int id = 0, i = 0;
dmubus_call("router.network", "hosts", UBUS_ARGS{}, 0, &res);
if (res) {
dmjson_foreach_obj_in_array(res, arrobj, host_obj, i, 1, "hosts") {
idx = handle_update_instance(1, dmctx, &idx_last, update_instance_without_section, 1, ++id);
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)host_obj, idx) == DM_STOP)
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_without_section, 1, ++id);
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)host_obj, inst) == DM_STOP)
break;
}
}
@ -36,12 +36,12 @@ int os__browseHostsHostInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev
int os__browseHostsHostIPv4AddressInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
json_object *ip_arr, *host_obj = (json_object *)prev_data;
char *idx = NULL, *idx_last = NULL, *ipv4addr = NULL;
char *inst = NULL, *max_inst = NULL, *ipv4addr = NULL;
int id = 0, i = 0;
dmjson_foreach_value_in_array(host_obj, ip_arr, ipv4addr, i, 1, "ipv4addr") {
idx = handle_update_instance(1, dmctx, &idx_last, update_instance_without_section, 1, ++id);
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)ipv4addr, idx) == DM_STOP)
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_without_section, 1, ++id);
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)ipv4addr, inst) == DM_STOP)
break;
}
return 0;
@ -51,12 +51,12 @@ int os__browseHostsHostIPv4AddressInst(struct dmctx *dmctx, DMNODE *parent_node,
int os__browseHostsHostIPv6AddressInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
json_object *ip_arr, *host_obj = (json_object *)prev_data;
char *idx = NULL, *idx_last = NULL, *ipv6addr = NULL;
char *inst = NULL, *max_inst = NULL, *ipv6addr = NULL;
int id = 0, i = 0;
dmjson_foreach_value_in_array(host_obj, ip_arr, ipv6addr, i, 1, "ipv6addr") {
idx = handle_update_instance(1, dmctx, &idx_last, update_instance_without_section, 1, ++id);
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)ipv6addr, idx) == DM_STOP)
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_without_section, 1, ++id);
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)ipv6addr, inst) == DM_STOP)
break;
}
return 0;
@ -68,7 +68,7 @@ int os__browseHostsHostIPv6AddressInst(struct dmctx *dmctx, DMNODE *parent_node,
int get_linker_host(char *refparam, struct dmctx *dmctx, void *data, char *instance, char **linker)
{
*linker = dmjson_get_value((json_object *)data, 1, "ipaddr");
return 0;
return 0;
}
/*************************************************************

View file

@ -29,7 +29,7 @@ int os__browseHostsHostIPv6AddressInst(struct dmctx *dmctx, DMNODE *parent_node,
**************************************************************/
int get_linker_host(char *refparam, struct dmctx *dmctx, void *data, char *instance, char **linker)
{
return 0;
return 0;
}
/*************************************************************

View file

@ -13,7 +13,7 @@
/* *** Device.Hosts. *** */
DMOBJ tHostsObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"Host", &DMREAD, NULL, NULL, NULL, os__browseHostsHostInst, NULL, NULL, NULL, tHostsHostObj, tHostsHostParams, get_linker_host, BBFDM_BOTH},
{0}
};
@ -26,7 +26,7 @@ DMLEAF tHostsParams[] = {
/* *** Device.Hosts.Host.{i}. *** */
DMOBJ tHostsHostObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"IPv4Address", &DMREAD, NULL, NULL, NULL, os__browseHostsHostIPv4AddressInst, NULL, NULL, NULL, NULL, tHostsHostIPv4AddressParams, NULL, BBFDM_BOTH},
{"IPv6Address", &DMREAD, NULL, NULL, NULL, os__browseHostsHostIPv6AddressInst, NULL, NULL, NULL, NULL, tHostsHostIPv6AddressParams, NULL, BBFDM_BOTH},
{"WANStats", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tHostsHostWANStatsParams, NULL, BBFDM_BOTH},

View file

@ -67,7 +67,7 @@ int browseInterfaceStackInst(struct dmctx *dmctx, DMNODE *parent_node, void *pre
struct interfacestack_data intf_stack_data = {0};
struct uci_section *s = NULL, *dmmap_s = NULL;
char *layer_inst = "", *loweralias = "", *higheralias = "";
char *intf_stack_inst = NULL, *intf_stack_last = NULL;
char *inst = NULL, *max_inst = NULL;
char buf_lowerlayer[128] = {0};
char buf_higherlayer[128] = {0};
char buf_higheralias[64] = {0};
@ -152,8 +152,10 @@ int browseInterfaceStackInst(struct dmctx *dmctx, DMNODE *parent_node, void *pre
dmmap_s = create_dmmap_interface_stack_section(buf_instance);
// link instance to interface stack data
intf_stack_inst = handle_update_instance(1, dmctx, &intf_stack_last, update_instance_alias, 3, dmmap_s, "interface_stack_instance", "interface_stack_alias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&intf_stack_data, intf_stack_inst) == DM_STOP)
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
dmmap_s, "interface_stack_instance", "interface_stack_alias", "dmmap_interface_stack", "interface_stack");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&intf_stack_data, inst) == DM_STOP)
goto end;
}
@ -224,8 +226,10 @@ int browseInterfaceStackInst(struct dmctx *dmctx, DMNODE *parent_node, void *pre
dmmap_s = create_dmmap_interface_stack_section(buf_instance);
// link instance to interface stack data
intf_stack_inst = handle_update_instance(1, dmctx, &intf_stack_last, update_instance_alias, 3, dmmap_s, "interface_stack_instance", "interface_stack_alias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&intf_stack_data, intf_stack_inst) == DM_STOP)
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
dmmap_s, "interface_stack_instance", "interface_stack_alias", "dmmap_interface_stack", "interface_stack");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&intf_stack_data, inst) == DM_STOP)
goto end;
}
@ -285,8 +289,10 @@ int browseInterfaceStackInst(struct dmctx *dmctx, DMNODE *parent_node, void *pre
dmmap_s = create_dmmap_interface_stack_section(buf_instance);
// link instance to interface stack data
intf_stack_inst = handle_update_instance(1, dmctx, &intf_stack_last, update_instance_alias, 3, dmmap_s, "interface_stack_instance", "interface_stack_alias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&intf_stack_data, intf_stack_inst) == DM_STOP)
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
dmmap_s, "interface_stack_instance", "interface_stack_alias", "dmmap_interface_stack", "interface_stack");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&intf_stack_data, inst) == DM_STOP)
goto end;
}
@ -365,8 +371,10 @@ int browseInterfaceStackInst(struct dmctx *dmctx, DMNODE *parent_node, void *pre
dmmap_s = create_dmmap_interface_stack_section(buf_instance);
// link instance to interface stack data
intf_stack_inst = handle_update_instance(1, dmctx, &intf_stack_last, update_instance_alias, 3, dmmap_s, "interface_stack_instance", "interface_stack_alias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&intf_stack_data, intf_stack_inst) == DM_STOP)
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
dmmap_s, "interface_stack_instance", "interface_stack_alias", "dmmap_interface_stack", "interface_stack");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&intf_stack_data, inst) == DM_STOP)
goto end;
}
@ -447,8 +455,10 @@ int browseInterfaceStackInst(struct dmctx *dmctx, DMNODE *parent_node, void *pre
dmmap_s = create_dmmap_interface_stack_section(buf_instance);
// link instance to interface stack data
intf_stack_inst = handle_update_instance(1, dmctx, &intf_stack_last, update_instance_alias, 3, dmmap_s, "interface_stack_instance", "interface_stack_alias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&intf_stack_data, intf_stack_inst) == DM_STOP)
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
dmmap_s, "interface_stack_instance", "interface_stack_alias", "dmmap_interface_stack", "interface_stack");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&intf_stack_data, inst) == DM_STOP)
goto end;
if (*loweralias == '\0')
@ -565,8 +575,10 @@ int browseInterfaceStackInst(struct dmctx *dmctx, DMNODE *parent_node, void *pre
dmmap_s = create_dmmap_interface_stack_section(buf_instance);
// link instance to interface stack data
intf_stack_inst = handle_update_instance(1, dmctx, &intf_stack_last, update_instance_alias, 3, dmmap_s, "interface_stack_instance", "interface_stack_alias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&intf_stack_data, intf_stack_inst) == DM_STOP)
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
dmmap_s, "interface_stack_instance", "interface_stack_alias", "dmmap_interface_stack", "interface_stack");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&intf_stack_data, inst) == DM_STOP)
goto end;
// The lower layer is Device.WiFi.Radio.{i}.
@ -620,8 +632,10 @@ int browseInterfaceStackInst(struct dmctx *dmctx, DMNODE *parent_node, void *pre
dmmap_s = create_dmmap_interface_stack_section(buf_instance);
// link instance to interface stack data
intf_stack_inst = handle_update_instance(1, dmctx, &intf_stack_last, update_instance_alias, 3, dmmap_s, "interface_stack_instance", "interface_stack_alias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&intf_stack_data, intf_stack_inst) == DM_STOP)
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
dmmap_s, "interface_stack_instance", "interface_stack_alias", "dmmap_interface_stack", "interface_stack");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&intf_stack_data, inst) == DM_STOP)
goto end;
}
@ -665,10 +679,11 @@ int browseInterfaceStackInst(struct dmctx *dmctx, DMNODE *parent_node, void *pre
dmmap_s = create_dmmap_interface_stack_section(buf_instance);
// link instance to interface stack data
intf_stack_inst = handle_update_instance(1, dmctx, &intf_stack_last, update_instance_alias, 3, dmmap_s, "interface_stack_instance", "interface_stack_alias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&intf_stack_data, intf_stack_inst) == DM_STOP)
goto end;
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
dmmap_s, "interface_stack_instance", "interface_stack_alias", "dmmap_interface_stack", "interface_stack");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&intf_stack_data, inst) == DM_STOP)
goto end;
}
// The lower layer is Device.DSL.Line.{i}.
@ -711,8 +726,10 @@ int browseInterfaceStackInst(struct dmctx *dmctx, DMNODE *parent_node, void *pre
dmmap_s = create_dmmap_interface_stack_section(buf_instance);
// link instance to interface stack data
intf_stack_inst = handle_update_instance(1, dmctx, &intf_stack_last, update_instance_alias, 3, dmmap_s, "interface_stack_instance", "interface_stack_alias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&intf_stack_data, intf_stack_inst) == DM_STOP)
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
dmmap_s, "interface_stack_instance", "interface_stack_alias", "dmmap_interface_stack", "interface_stack");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&intf_stack_data, inst) == DM_STOP)
goto end;
}
}

View file

@ -1587,7 +1587,7 @@ static char *get_last_instance_cond(char* dmmap_package, char *package, char *se
continue;
}
get_dmmap_section_of_config_section(dmmap_package, section, section_name(s), &dmmap_section);
inst = update_instance_bbfdm(dmmap_section, inst, opt_inst);
inst = update_instance(dmmap_section, inst, opt_inst);
}
return inst;
}
@ -1609,7 +1609,7 @@ static int add_ip_interface(char *refparam, struct dmctx *ctx, void *data, char
dmuci_add_section_bbfdm("dmmap_network", "interface", &dmmap_ip_interface, &v);
dmuci_set_value_by_section(dmmap_ip_interface, "section_name", ip_name);
*instance = update_instance_bbfdm(dmmap_ip_interface, last_inst, "ip_int_instance");
*instance = update_instance(dmmap_ip_interface, last_inst, "ip_int_instance");
return 0;
}
@ -1663,7 +1663,7 @@ static int add_ipv4(char *refparam, struct dmctx *ctx, void *data, char **instan
get_dmmap_section_of_config_section("dmmap_network", "interface", section_name(((struct ip_args *)data)->ip_sec), &dmmap_section);
dmuci_get_value_by_section_string(dmmap_section, "ipv4_instance", &instance);
*instancepara = update_instance_bbfdm(dmmap_section, instance, "ipv4_instance");
*instancepara = update_instance(dmmap_section, instance, "ipv4_instance");
if(instance[0] == '\0') {
dmuci_set_value_by_section(dmmap_section, "ipv4_instance", *instancepara);
dmuci_set_value_by_section(((struct ip_args *)data)->ip_sec, "ipaddr", "0.0.0.0");
@ -1877,7 +1877,7 @@ static int get_linker_ipv6_prefix(char *refparam, struct dmctx *dmctx, void *dat
/*#Device.IP.Interface.{i}.!UCI:network/interface/dmmap_network*/
static int browseIPIfaceInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
char *ip_int = NULL, *ip_int_last = NULL;
char *inst = NULL, *max_inst = NULL;
char *proto, *ipv4addr = "";
struct ip_args curr_ip_args = {0};
struct dmmap_dup *p;
@ -1895,8 +1895,11 @@ static int browseIPIfaceInst(struct dmctx *dmctx, DMNODE *parent_node, void *pre
ipv4addr = ubus_call_get_value(section_name(p->config_section), "ipv4-address", "address");
init_ip_args(&curr_ip_args, p->config_section, ipv4addr);
ip_int = handle_update_instance(1, dmctx, &ip_int_last, update_instance_alias, 3, p->dmmap_section, "ip_int_instance", "ip_int_alias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_ip_args, ip_int) == DM_STOP)
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
p->dmmap_section, "ip_int_instance", "ip_int_alias", "dmmap_network", "interface");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_ip_args, inst) == DM_STOP)
break;
}
free_dmmap_config_dup_list(&dup_list);
@ -1905,13 +1908,21 @@ static int browseIPIfaceInst(struct dmctx *dmctx, DMNODE *parent_node, void *pre
static int browseIfaceIPv4Inst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
char *ipv4_inst = NULL, *ipv4_inst_last = NULL;
char *inst = NULL, *max_inst = NULL;
struct uci_section *dmmap_section;
struct browse_args browse_args = {0};
get_dmmap_section_of_config_section("dmmap_network", "interface", section_name(((struct ip_args *)prev_data)->ip_sec), &dmmap_section);
if(((struct ip_args *)prev_data)->ip_4address[0] != '\0') {
ipv4_inst = handle_update_instance(2, dmctx, &ipv4_inst_last, update_instance_alias, 3, dmmap_section, "ipv4_instance", "ipv4_alias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, prev_data, ipv4_inst) == DM_STOP)
browse_args.option = "section_name";
browse_args.value = section_name(((struct ip_args *)prev_data)->ip_sec);
inst = handle_update_instance(2, dmctx, &max_inst, update_instance_alias, 7,
dmmap_section, "ipv4_instance", "ipv4_alias", "dmmap_network", "interface",
check_browse_section, (void *)&browse_args);
if (DM_LINK_INST_OBJ(dmctx, parent_node, prev_data, inst) == DM_STOP)
goto end;
}
end:
@ -1939,12 +1950,17 @@ static struct uci_section *update_dmmap_network_ipv6(char *curr_inst, char *sect
static int browseIfaceIPv6Inst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
struct uci_section *s;
char *ipv6_int = NULL, *ipv6_int_last = NULL, *ipv6addr = "", *ipv6mask = "", *ipv6_preferred = "", *ipv6_valid = "", buf[16]="";
char *inst = NULL, *max_inst = NULL, *ipv6addr = "", *ipv6mask = "", *ipv6_preferred = "", *ipv6_valid = "", buf[16]="";
struct ipv6_args curr_ipv6_args = {0};
struct browse_args browse_args = {0};
json_object *res, *jobj, *jobj1;
int entries = 0;
if(prev_data && ((struct ip_args *)prev_data)->ip_sec) {
browse_args.option = "section_name";
browse_args.value = section_name(((struct ip_args *)prev_data)->ip_sec);
dmuci_get_value_by_section_string(((struct ip_args *)prev_data)->ip_sec, "ip6addr", &ipv6addr);
dmuci_get_value_by_section_string(((struct ip_args *)prev_data)->ip_sec, "adv_preferred_lifetime", &ipv6_preferred);
dmuci_get_value_by_section_string(((struct ip_args *)prev_data)->ip_sec, "adv_valid_lifetime", &ipv6_valid);
@ -1972,8 +1988,12 @@ static int browseIfaceIPv6Inst(struct dmctx *dmctx, DMNODE *parent_node, void *p
snprintf(buf, sizeof(buf), "%d", entries);
s = update_dmmap_network_ipv6(buf, section_name(((struct ip_args *)prev_data)->ip_sec));
init_ipv6_args(&curr_ipv6_args, ((struct ip_args *)prev_data)->ip_sec, ipv6addr, ipv6mask, ipv6_preferred, ipv6_valid);
ipv6_int = handle_update_instance(1, dmctx, &ipv6_int_last, update_instance_alias, 3, s, "ipv6_instance", "ipv6_alias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_ipv6_args, ipv6_int) == DM_STOP)
inst = handle_update_instance(2, dmctx, &max_inst, update_instance_alias, 7,
s, "ipv6_instance", "ipv6_alias", "dmmap_network", "ipv6",
check_browse_section, (void *)&browse_args);
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_ipv6_args, inst) == DM_STOP)
goto end;
} else
goto end;
@ -1982,8 +2002,12 @@ static int browseIfaceIPv6Inst(struct dmctx *dmctx, DMNODE *parent_node, void *p
browse:
s = update_dmmap_network_ipv6("1", section_name(((struct ip_args *)prev_data)->ip_sec));
init_ipv6_args(&curr_ipv6_args, ((struct ip_args *)prev_data)->ip_sec, ipv6addr, ipv6mask, ipv6_preferred, ipv6_valid);
ipv6_int = handle_update_instance(1, dmctx, &ipv6_int_last, update_instance_alias, 3, s, "ipv6_instance", "ipv6_alias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_ipv6_args, ipv6_int) == DM_STOP)
inst = handle_update_instance(2, dmctx, &max_inst, update_instance_alias, 7,
s, "ipv6_instance", "ipv6_alias", "dmmap_network", "ipv6",
check_browse_section, (void *)&browse_args);
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_ipv6_args, inst) == DM_STOP)
goto end;
}
end:
@ -2012,12 +2036,17 @@ static struct uci_section *update_dmmap_network_ipv6prefix(char *curr_inst, char
static int browseIfaceIPv6PrefixInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
struct uci_section *s;
char *ipv6prefix_int = NULL, *ipv6prefix_int_last = NULL, *ipv6prefixaddr = "", *ipv6prefixmask = "", *ipv6prefix_preferred = "", *ipv6prefix_valid = "", buf[16] = "";
char *inst = NULL, *max_inst = NULL, *ipv6prefixaddr = "", *ipv6prefixmask = "", *ipv6prefix_preferred = "", *ipv6prefix_valid = "", buf[16] = "";
struct ipv6prefix_args curr_ipv6prefix_args = {0};
struct browse_args browse_args = {0};
json_object *res, *jobj;
int entries = 0;
if(prev_data && ((struct ip_args *)prev_data)->ip_sec) {
browse_args.option = "section_name";
browse_args.value = section_name(((struct ip_args *)prev_data)->ip_sec);
dmuci_get_value_by_section_string(((struct ip_args *)prev_data)->ip_sec, "ip6prefix", &ipv6prefixaddr);
if (ipv6prefixaddr[0] == '\0') {
dmubus_call("network.interface", "status", UBUS_ARGS{{"interface", section_name(((struct ip_args *)prev_data)->ip_sec), String}}, 1, &res);
@ -2040,8 +2069,12 @@ static int browseIfaceIPv6PrefixInst(struct dmctx *dmctx, DMNODE *parent_node, v
snprintf(buf, sizeof(buf), "%d", entries);
s = update_dmmap_network_ipv6prefix(buf, section_name(((struct ip_args *)prev_data)->ip_sec));
init_ipv6prefix_args(&curr_ipv6prefix_args, ((struct ip_args *)prev_data)->ip_sec, ipv6prefixaddr, ipv6prefixmask, ipv6prefix_preferred, ipv6prefix_valid);
ipv6prefix_int = handle_update_instance(1, dmctx, &ipv6prefix_int_last, update_instance_alias, 3, s, "ipv6prefix_instance", "ipv6prefix_alias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_ipv6prefix_args, ipv6prefix_int) == DM_STOP)
inst = handle_update_instance(2, dmctx, &max_inst, update_instance_alias, 7,
s, "ipv6prefix_instance", "ipv6prefix_alias", "dmmap_network", "ipv6prefix",
check_browse_section, (void *)&browse_args);
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_ipv6prefix_args, inst) == DM_STOP)
goto end;
} else
goto end;
@ -2050,8 +2083,12 @@ static int browseIfaceIPv6PrefixInst(struct dmctx *dmctx, DMNODE *parent_node, v
browse:
s = update_dmmap_network_ipv6prefix("1", section_name(((struct ip_args *)prev_data)->ip_sec));
init_ipv6prefix_args(&curr_ipv6prefix_args, ((struct ip_args *)prev_data)->ip_sec, ipv6prefixaddr, ipv6prefixmask, ipv6prefix_preferred, ipv6prefix_valid);
ipv6prefix_int = handle_update_instance(1, dmctx, &ipv6prefix_int_last, update_instance_alias, 3, s, "ipv6prefix_instance", "ipv6prefix_alias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_ipv6prefix_args, ipv6prefix_int) == DM_STOP)
inst = handle_update_instance(2, dmctx, &max_inst, update_instance_alias, 7,
s, "ipv6prefix_instance", "ipv6prefix_alias", "dmmap_network", "ipv6prefix",
check_browse_section, (void *)&browse_args);
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_ipv6prefix_args, inst) == DM_STOP)
goto end;
}
end:
@ -2061,11 +2098,14 @@ end:
static int browseIPInterfaceTWAMPReflectorInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
struct uci_section *s = NULL;
char *twamp_inst = NULL, *twamp_inst_last = NULL;
char *inst = NULL, *max_inst = NULL;
uci_foreach_option_eq("cwmp_twamp", "twamp_reflector", "interface", section_name(((struct ip_args *)prev_data)->ip_sec), s) {
twamp_inst = handle_update_instance(2, dmctx, &twamp_inst_last, update_instance_alias, 3, (void *)s, "twamp_inst", "twamp_alias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)s, twamp_inst) == DM_STOP)
inst = handle_update_instance(2, dmctx, &max_inst, update_instance_alias, 5,
s, "twamp_inst", "twamp_alias", "cwmp_twamp", "twamp_reflector");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)s, inst) == DM_STOP)
break;
}
return 0;
@ -2076,7 +2116,7 @@ static struct dm_forced_inform_s IPv6INFRM = {0, get_ipv6_finform};
/* *** Device.IP. *** */
DMOBJ tIPObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"Interface", &DMWRITE, add_ip_interface, delete_ip_interface, NULL, browseIPIfaceInst, NULL, NULL, NULL, tIPInterfaceObj, tIPInterfaceParams, get_linker_ip_interface, BBFDM_BOTH},
#ifdef BBF_TR143
{"Diagnostics", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tIPDiagnosticsObj, tIPDiagnosticsParams, NULL, BBFDM_BOTH},
@ -2099,7 +2139,7 @@ DMLEAF tIPParams[] = {
/* *** Device.IP.Interface. *** */
DMOBJ tIPInterfaceObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"IPv4Address", &DMWRITE, add_ipv4, delete_ipv4, NULL, browseIfaceIPv4Inst, NULL, NULL, NULL, NULL, tIPInterfaceIPv4AddressParams, NULL, BBFDM_BOTH},
{"IPv6Address", &DMWRITE, add_ipv6, delete_ipv6, NULL, browseIfaceIPv6Inst, NULL, NULL, NULL, NULL, tIPInterfaceIPv6AddressParams, NULL, BBFDM_BOTH},
{"IPv6Prefix", &DMWRITE, add_ipv6_prefix, delete_ipv6_prefix, NULL, browseIfaceIPv6PrefixInst, NULL, NULL, NULL, NULL, tIPInterfaceIPv6PrefixParams, get_linker_ipv6_prefix, BBFDM_BOTH},

View file

@ -33,7 +33,7 @@ static int add_NAT_InterfaceSetting(char *refparam, struct dmctx *ctx, void *dat
dmuci_add_section_bbfdm("dmmap_firewall", "zone", &dmmap_firewall, &v);
dmuci_set_value_by_section(dmmap_firewall, "section_name", section_name(s));
*instance = update_instance_bbfdm(dmmap_firewall, inst, "interface_setting_instance");
*instance = update_instance(dmmap_firewall, inst, "interface_setting_instance");
return 0;
}
@ -89,7 +89,7 @@ static int add_NAT_PortMapping(char *refparam, struct dmctx *ctx, void *data, ch
dmuci_add_section_bbfdm("dmmap_firewall", "redirect", &dmmap_firewall, &v);
dmuci_set_value_by_section(dmmap_firewall, "section_name", section_name(s));
*instance = update_instance_bbfdm(dmmap_firewall, inst, "port_mapping_instance");
*instance = update_instance(dmmap_firewall, inst, "port_mapping_instance");
return 0;
}
@ -581,14 +581,17 @@ static int set_nat_port_mapping_description(char *refparam, struct dmctx *ctx, v
/*#Device.NAT.InterfaceSetting.{i}.!UCI:firewall/zone/dmmap_firewall*/
static int browseInterfaceSettingInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
char *nati, *nati_last = NULL;
char *inst, *max_inst = NULL;
struct dmmap_dup *p;
LIST_HEAD(dup_list);
synchronize_specific_config_sections_with_dmmap("firewall", "zone", "dmmap_firewall", &dup_list);
list_for_each_entry(p, &dup_list, list) {
nati = handle_update_instance(1, dmctx, &nati_last, update_instance_alias, 3, p->dmmap_section, "interface_setting_instance", "interface_setting_alias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, nati) == DM_STOP)
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
p->dmmap_section, "interface_setting_instance", "interface_setting_alias", "dmmap_firewall", "zone");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, inst) == DM_STOP)
break;
}
free_dmmap_config_dup_list(&dup_list);
@ -598,7 +601,7 @@ static int browseInterfaceSettingInst(struct dmctx *dmctx, DMNODE *parent_node,
/*#Device.NAT.PortMapping.{i}.!UCI:firewall/redirect/dmmap_firewall*/
static int browsePortMappingInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
char *natp, *natp_last = NULL, *target;
char *inst, *max_inst = NULL, *target;
struct dmmap_dup *p;
LIST_HEAD(dup_list);
@ -607,8 +610,11 @@ static int browsePortMappingInst(struct dmctx *dmctx, DMNODE *parent_node, void
dmuci_get_value_by_section_string(p->config_section, "target", &target);
if (*target != '\0' && strcmp(target, "DNAT") != 0)
continue;
natp = handle_update_instance(1, dmctx, &natp_last, update_instance_alias, 3, p->dmmap_section, "port_mapping_instance", "port_mapping_alias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, natp) == DM_STOP)
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
p->dmmap_section, "port_mapping_instance", "port_mapping_alias", "dmmap_firewall", "redirect");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, inst) == DM_STOP)
break;
}
free_dmmap_config_dup_list(&dup_list);
@ -617,7 +623,7 @@ static int browsePortMappingInst(struct dmctx *dmctx, DMNODE *parent_node, void
/* *** Device.NAT. *** */
DMOBJ tNATObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"InterfaceSetting", &DMWRITE, add_NAT_InterfaceSetting, delete_NAT_InterfaceSetting, NULL, browseInterfaceSettingInst, NULL, NULL, NULL, NULL, tNATInterfaceSettingParams, NULL, BBFDM_BOTH},
{"PortMapping", &DMWRITE, add_NAT_PortMapping, delete_NAT_PortMapping, NULL, browsePortMappingInst, NULL, NULL, NULL, NULL, tNATPortMappingParams, NULL, BBFDM_BOTH},
{0}

View file

@ -417,7 +417,7 @@ static int add_ppp_interface(char *refparam, struct dmctx *ctx, void *data, char
dmuci_set_value("network", name, "password", name);
dmuci_add_section_bbfdm("dmmap_network", "interface", &dmmap_ppp, &v);
dmuci_set_value_by_section(dmmap_ppp, "section_name", name);
*instance = update_instance_bbfdm(dmmap_ppp, inst, "ppp_int_instance");
*instance = update_instance(dmmap_ppp, inst, "ppp_int_instance");
return 0;
}
@ -458,7 +458,7 @@ static int delete_ppp_interface(char *refparam, struct dmctx *ctx, void *data, c
/*#Device.PPP.Interface.{i}.!UCI:network/interface/dmmap_network*/
static int browseInterfaceInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
char *ppp_int = NULL, *ppp_int_last = NULL, *proto;
char *inst = NULL, *max_inst = NULL, *proto;
struct dmmap_dup *p;
LIST_HEAD(dup_list);
@ -467,8 +467,11 @@ static int browseInterfaceInst(struct dmctx *dmctx, DMNODE *parent_node, void *p
dmuci_get_value_by_section_string(p->config_section, "proto", &proto);
if (!strstr(proto, "ppp"))
continue;
ppp_int = handle_update_instance(1, dmctx, &ppp_int_last, update_instance_alias, 3, p->dmmap_section, "ppp_int_instance", "ppp_int_alias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, ppp_int) == DM_STOP)
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
p->dmmap_section, "ppp_int_instance", "ppp_int_alias", "dmmap_network", "interface");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, inst) == DM_STOP)
break;
}
free_dmmap_config_dup_list(&dup_list);
@ -477,7 +480,7 @@ static int browseInterfaceInst(struct dmctx *dmctx, DMNODE *parent_node, void *p
/* *** Device.PPP. *** */
DMOBJ tPPPObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"Interface", &DMWRITE, add_ppp_interface, delete_ppp_interface, NULL, browseInterfaceInst, NULL, NULL, NULL, tPPPInterfaceObj, tPPPInterfaceParams, get_linker_ppp_interface, BBFDM_BOTH},
{0}
};
@ -490,7 +493,7 @@ DMLEAF tPPPParams[] = {
/* *** Device.PPP.Interface.{i}. *** */
DMOBJ tPPPInterfaceObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"PPPoE", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tPPPInterfacePPPoEParams, NULL, BBFDM_BOTH},
{"Stats", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tPPPInterfaceStatsParams, NULL, BBFDM_BOTH},
{0}

View file

@ -145,7 +145,7 @@ static int add_ptm_link(char *refparam, struct dmctx *ctx, void *data, char **in
dmuci_set_value("dsl", ptm_device, "portid", "1");
dmuci_add_section_bbfdm("dmmap_dsl", "ptm-device", &dmmap_ptm, &v);
dmuci_set_value_by_section(dmmap_ptm, "section_name", ptm_device);
*instancepara = update_instance_bbfdm(dmmap_ptm, instance, "ptmlinkinstance");
*instancepara = update_instance(dmmap_ptm, instance, "ptmlinkinstance");
return 0;
}
@ -243,7 +243,7 @@ static int set_ptm_alias(char *refparam, struct dmctx *ctx, void *data, char *in
/*#Device.PTM.Link.{i}.!UCI:dsl/ptm-device/dmmap_dsl*/
static int browsePtmLinkInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
char *wnum = NULL, *channel_last = NULL, *ifname;
char *inst = NULL, *max_inst = NULL, *ifname;
struct ptm_args curr_ptm_args = {0};
struct dmmap_dup *p;
LIST_HEAD(dup_list);
@ -252,8 +252,11 @@ static int browsePtmLinkInst(struct dmctx *dmctx, DMNODE *parent_node, void *pre
list_for_each_entry(p, &dup_list, list) {
dmuci_get_value_by_section_string(p->config_section, "device", &ifname);
init_ptm_link(&curr_ptm_args, p->config_section, ifname);
wnum = handle_update_instance(1, dmctx, &channel_last, update_instance_alias, 3, p->dmmap_section, "ptmlinkinstance", "ptmlinkalias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_ptm_args, wnum) == DM_STOP)
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
p->dmmap_section, "ptmlinkinstance", "ptmlinkalias", "dmmap_dsl", "ptm-device");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_ptm_args, inst) == DM_STOP)
break;
}
free_dmmap_config_dup_list(&dup_list);
@ -262,14 +265,14 @@ static int browsePtmLinkInst(struct dmctx *dmctx, DMNODE *parent_node, void *pre
/* *** Device.PTM. *** */
DMOBJ tPTMObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"Link", &DMWRITE, add_ptm_link, delete_ptm_link, NULL, browsePtmLinkInst, NULL, NULL, NULL, tPTMLinkObj, tPTMLinkParams, get_ptm_linker, BBFDM_BOTH},
{0}
};
/* *** Device.PTM.Link.{i}. *** */
DMOBJ tPTMLinkObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"Stats", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tPTMLinkStatsParams, NULL, BBFDM_BOTH},
{0}
};

View file

@ -22,14 +22,17 @@ int os_get_linker_qos_queue(char *refparam, struct dmctx *dmctx, void *data, cha
}
int os_browseQoSClassificationInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
char *inst = NULL, *inst_last = NULL, *value = NULL;
char *inst = NULL, *max_inst = NULL, *value = NULL;
char *ret = NULL;
struct dmmap_dup *p;
LIST_HEAD(dup_list);
synchronize_specific_config_sections_with_dmmap("qos", "classify", "dmmap_qos", &dup_list);
list_for_each_entry(p, &dup_list, list) {
inst = handle_update_instance(1, dmctx, &inst_last, update_instance_alias, 3, p->dmmap_section, "classify_instance", "classifyalias");
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
p->dmmap_section, "classify_instance", "classifyalias", "dmmap_qos", "classify");
//synchronizing option src_ip of uci classify section to src_mask/src_ip of dmmap's classify section
dmuci_get_value_by_section_string(p->config_section, "src_ip", &value);
//checking if src_ip is an ip-prefix or ip address and synchronizing accordingly
@ -59,13 +62,16 @@ int os_browseQoSClassificationInst(struct dmctx *dmctx, DMNODE *parent_node, voi
/*#Device.QoS.Classification.{i}.!UCI:qos/classify/dmmap_qos*/
int browseQoSClassificationInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
char *inst = NULL, *inst_last = NULL;
char *inst = NULL, *max_inst = NULL;
struct dmmap_dup *p;
LIST_HEAD(dup_list);
synchronize_specific_config_sections_with_dmmap("qos", "classify", "dmmap_qos", &dup_list);
list_for_each_entry(p, &dup_list, list) {
inst = handle_update_instance(1, dmctx, &inst_last, update_instance_alias, 3, p->dmmap_section, "classificationinstance", "classificationalias");
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
p->dmmap_section, "classificationinstance", "classificationalias", "dmmap_qos", "classify");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, inst) == DM_STOP)
break;
}
@ -94,13 +100,16 @@ int browseQoSPolicerInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_da
/*#Device.QoS.Queue.{i}.!UCI:qos/queue/dmmap_qos*/
int os_browseQoSQueueInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
char *inst = NULL, *inst_last = NULL;
char *inst = NULL, *max_inst = NULL;
struct dmmap_dup *p;
LIST_HEAD(dup_list);
synchronize_specific_config_sections_with_dmmap("qos", "queue", "dmmap_qos", &dup_list);
list_for_each_entry(p, &dup_list, list) {
inst = handle_update_instance(1, dmctx, &inst_last, update_instance_alias, 3, p->dmmap_section, "queueinstance", "queuealias");
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
p->dmmap_section, "queueinstance", "queuealias", "dmmap_qos", "queue");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, inst) == DM_STOP)
break;
}
@ -115,13 +124,16 @@ int os_browseQoSQueueStatsInst(struct dmctx *dmctx, DMNODE *parent_node, void *p
int os_browseQoSShaperInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
char *inst = NULL, *inst_last = NULL;
char *inst = NULL, *max_inst = NULL;
struct dmmap_dup *p;
LIST_HEAD(dup_list);
synchronize_specific_config_sections_with_dmmap("qos", "shaper", "dmmap_qos", &dup_list);
list_for_each_entry(p, &dup_list, list) {
inst = handle_update_instance(1, dmctx, &inst_last, update_instance_alias, 3, p->dmmap_section, "shaperinstance", "shaperalias");
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
p->dmmap_section, "shaperinstance", "shaperalias", "dmmap_qos", "shaper");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, inst) == DM_STOP)
break;
}
@ -145,7 +157,7 @@ int os_addObjQoSClassification(char *refparam, struct dmctx *ctx, void *data, ch
dmuci_add_section_bbfdm("dmmap_qos", "classify", &dmmap, &v);
dmuci_set_value_by_section(dmmap, "section_name", section_name(s));
*instance = update_instance_bbfdm(dmmap, inst, "classify_instance");
*instance = update_instance(dmmap, inst, "classify_instance");
return 0;
}
@ -265,7 +277,7 @@ int os_addObjQoSQueue(char *refparam, struct dmctx *ctx, void *data, char **inst
dmuci_add_section_bbfdm("dmmap_qos", "queue", &dmmap, &v);
dmuci_set_value_by_section(dmmap, "section_name", section_name(s));
*instance = update_instance_bbfdm(dmmap, inst, "queueinstance");
*instance = update_instance(dmmap, inst, "queueinstance");
return 0;
}
@ -344,7 +356,7 @@ int os_addObjQoSShaper(char *refparam, struct dmctx *ctx, void *data, char **ins
dmuci_add_section_bbfdm("dmmap_qos", "shaper", &dmmap, &v);
dmuci_set_value_by_section(dmmap, "section_name", section_name(s));
*instance = update_instance_bbfdm(dmmap, inst, "shaperinstance");
*instance = update_instance(dmmap, inst, "shaperinstance");
return 0;
}

View file

@ -62,14 +62,17 @@ int get_linker_qos_queue(char *refparam, struct dmctx *dmctx, void *data, char *
/*#Device.QoS.Classification.{i}.!UCI:qos/classify/dmmap_qos*/
int os_browseQoSClassificationInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
char *wnum = NULL, *wnum_last = NULL;
char *inst = NULL, *max_inst = NULL;
struct dmmap_dup *p;
LIST_HEAD(dup_list);
synchronize_specific_config_sections_with_dmmap("qos", "classify", "dmmap_qos", &dup_list);
list_for_each_entry(p, &dup_list, list) {
wnum = handle_update_instance(1, dmctx, &wnum_last, update_instance_alias, 3, p->dmmap_section, "classifinstance", "classifalias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p, wnum) == DM_STOP)
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
p->dmmap_section, "classifinstance", "classifalias", "dmmap_qos", "classify");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p, inst) == DM_STOP)
break;
}
free_dmmap_config_dup_list(&dup_list);
@ -98,7 +101,6 @@ int os_browseQoSQueueInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_d
return 0;
}
struct uci_section *get_dup_qos_stats_section_in_dmmap(char *dmmap_package, char *section_type, char *dev)
{
struct uci_section *s;
@ -113,7 +115,7 @@ struct uci_section *get_dup_qos_stats_section_in_dmmap(char *dmmap_package, char
int os_browseQoSQueueStatsInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
struct uci_section *dmmap_sect;
char *questatsout[256], *instance = NULL, *inst_last = NULL, *v, *lastinstancestore = NULL, dev[50] = "", user[50] = "";
char *questatsout[256], *inst = NULL, *max_inst = NULL, *v, *lastinstancestore = NULL, dev[50] = "", user[50] = "";
int length, i, ret;
struct queuestats queuests = {0}, emptyquestats = {0};
regex_t regex1 = {}, regex2 = {};
@ -143,11 +145,15 @@ int os_browseQoSQueueStatsInst(struct dmctx *dmctx, DMNODE *parent_node, void *p
}
queuests.dmsect= dmmap_sect;
if(lastinstancestore != NULL && inst_last !=NULL)
inst_last= dmstrdup(lastinstancestore);
instance = handle_update_instance(1, dmctx, &inst_last, update_instance_alias, 3, dmmap_sect, "queuestatsinstance", "queuestatsalias");
lastinstancestore= dmstrdup(inst_last);
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&queuests, instance) == DM_STOP)
if(lastinstancestore != NULL && max_inst != NULL)
max_inst = dmstrdup(lastinstancestore);
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
dmmap_sect, "queuestatsinstance", "queuestatsalias", "dmmap_qos", "qos_queue_stats");
lastinstancestore = dmstrdup(max_inst);
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&queuests, inst) == DM_STOP)
goto end;
queuests = emptyquestats;
break;
@ -183,7 +189,7 @@ int os_addObjQoSClassification(char *refparam, struct dmctx *ctx, void *data, ch
dmuci_add_section_bbfdm("dmmap_qos", "classify", &dmmap_qos_classify, &v);
dmuci_set_value_by_section(dmmap_qos_classify, "section_name", sect_name);
*instance = update_instance_bbfdm(dmmap_qos_classify, last_inst, "classifinstance");
*instance = update_instance(dmmap_qos_classify, last_inst, "classifinstance");
return 0;
}
@ -304,7 +310,7 @@ int os_addObjQoSQueue(char *refparam, struct dmctx *ctx, void *data, char **inst
dmuci_add_section_bbfdm("dmmap_qos", "class", &dmmap_qos_class, &v);
dmuci_set_value_by_section(dmmap_qos_class, "section_name", sect_name);
*instance = update_instance_bbfdm(dmmap_qos_class, last_inst, "queueinstance");
*instance = update_instance(dmmap_qos_class, last_inst, "queueinstance");
return 0;
}
@ -401,7 +407,7 @@ int addObjQoSShaper(char *refparam, struct dmctx *ctx, void *data, char **instan
dmuci_add_section_bbfdm("dmmap_qos", "class", &dmmap_qos_class, &v);
dmuci_set_value_by_section(dmmap_qos_class, "section_name", sect_name);
*instance = update_instance_bbfdm(dmmap_qos_class, last_inst, "shaperinstance");
*instance = update_instance(dmmap_qos_class, last_inst, "shaperinstance");
return 0;
}
@ -3396,14 +3402,17 @@ int os_set_QoSShaper_ShapingBurstSize(char *refparam, struct dmctx *ctx, void *d
/*#Device.QoS.Queue.{i}.!UCI:qos/class/dmmap_qos*/
int browseQoSQueueInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
char *wnum = NULL, *wnum_last = NULL;
char *inst = NULL, *max_inst = NULL;
struct dmmap_dup *p;
LIST_HEAD(dup_list);
synchronize_specific_config_sections_with_dmmap("qos", "class", "dmmap_qos", &dup_list);
list_for_each_entry(p, &dup_list, list) {
wnum = handle_update_instance(1, dmctx, &wnum_last, update_instance_alias, 3, p->dmmap_section, "queueinstance", "queuealias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p, wnum) == DM_STOP)
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
p->dmmap_section, "queueinstance", "queuealias", "dmmap_qos", "class");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p, inst) == DM_STOP)
break;
}
free_dmmap_config_dup_list(&dup_list);
@ -3702,7 +3711,7 @@ int get_QoSQueueStats_QueueOccupancyPercentage(char *refparam, struct dmctx *ctx
int browseQoSShaperInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
char *wnum = NULL, *wnum_last = NULL;
char *inst = NULL, *max_inst = NULL;
struct dmmap_dup *p;
char *limitrate = NULL;
LIST_HEAD(dup_list);
@ -3712,8 +3721,11 @@ int browseQoSShaperInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_dat
dmuci_get_value_by_section_string(p->config_section, "limitrate", &limitrate);
if (limitrate == NULL || strlen(limitrate) == 0)
continue;
wnum = handle_update_instance(1, dmctx, &wnum_last, update_instance_alias, 3, p->dmmap_section, "shaperinstance", "shaperalias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p, wnum) == DM_STOP)
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
p->dmmap_section, "shaperinstance", "shaperalias", "dmmap_qos", "class");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p, inst) == DM_STOP)
break;
}
free_dmmap_config_dup_list(&dup_list);

View file

@ -13,7 +13,7 @@
/* *** Device.QoS. *** */
DMOBJ tQoSObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"Classification", &DMWRITE, os_addObjQoSClassification, os_delObjQoSClassification, NULL, os_browseQoSClassificationInst, NULL, NULL, NULL, NULL, tQoSClassificationParams, NULL, BBFDM_BOTH},
{"QueueStats", &DMWRITE, os_addObjQoSQueueStats, os_delObjQoSQueueStats, NULL, os_browseQoSQueueStatsInst, NULL, NULL, NULL, NULL, tQoSQueueStatsParams, NULL, BBFDM_BOTH},
//{"App", &DMWRITE, addObjQoSApp, delObjQoSApp, NULL, browseQoSAppInst, NULL, NULL, NULL, NULL, tQoSAppParams, NULL, BBFDM_BOTH},

View file

@ -1106,7 +1106,7 @@ static int add_ipv4forwarding(char *refparam, struct dmctx *ctx, void *data, cha
dmuci_add_section_bbfdm("dmmap_route_forwarding", "route", &dmmap_route, &v);
dmuci_set_value_by_section(dmmap_route, "section_name", section_name(s));
*instancepara = update_instance_bbfdm(dmmap_route, instance, "routeinstance");
*instancepara = update_instance(dmmap_route, instance, "routeinstance");
return 0;
}
@ -1146,7 +1146,7 @@ static int add_ipv6Forwarding(char *refparam, struct dmctx *ctx, void *data, cha
dmuci_add_section_bbfdm("dmmap_route_forwarding", "route6", &dmmap_route, &v);
dmuci_set_value_by_section(dmmap_route, "section_name", section_name(s));
*instancepara = update_instance_bbfdm(dmmap_route, instance, "route6instance");
*instancepara = update_instance(dmmap_route, instance, "route6instance");
return 0;
}
@ -1173,12 +1173,15 @@ static int delete_ipv6Forwarding(char *refparam, struct dmctx *ctx, void *data,
static int browseRouterInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
struct uci_section *s = NULL;
char *r = NULL, *r_last = NULL;
char *inst = NULL, *max_inst = NULL;
update_section_list(DMMAP,"router", NULL, 1, NULL, NULL, NULL, NULL, NULL);
uci_path_foreach_sections(bbfdm, "dmmap", "router", s) {
r = handle_update_instance(1, dmctx, &r_last, update_instance_alias_bbfdm, 3, s, "router_instance", "router_alias");
DM_LINK_INST_OBJ(dmctx, parent_node, (void *)s, r);
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
s, "router_instance", "router_alias", "dmmap", "router");
DM_LINK_INST_OBJ(dmctx, parent_node, (void *)s, inst);
break;
}
return 0;
@ -1187,7 +1190,7 @@ static int browseRouterInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev
/*#Device.Routing.Router.{i}.IPv4Forwarding.{i}.!UCI:network/route/dmmap_route_forwarding*/
static int browseIPv4ForwardingInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
char *iroute = NULL, *iroute_last = NULL;
char *inst = NULL, *max_inst = NULL;
struct uci_section *ss = NULL;
bool find_max = true;
struct routingfwdargs curr_routefwdargs = {0};
@ -1197,24 +1200,34 @@ static int browseIPv4ForwardingInst(struct dmctx *dmctx, DMNODE *parent_node, vo
synchronize_specific_config_sections_with_dmmap("network", "route", "dmmap_route_forwarding", &dup_list);
list_for_each_entry(p, &dup_list, list) {
init_args_ipv4forward(&curr_routefwdargs, p->config_section, "1", ROUTE_STATIC);
iroute = handle_update_instance(1, dmctx, &iroute_last, forwarding_update_instance_alias_bbfdm, 4, p->dmmap_section, "routeinstance", "routealias", &find_max);
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_routefwdargs, iroute) == DM_STOP)
inst = handle_update_instance(1, dmctx, &max_inst, forwarding_update_instance_alias_bbfdm, 4,
p->dmmap_section, "routeinstance", "routealias", &find_max);
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_routefwdargs, inst) == DM_STOP)
goto end;
}
free_dmmap_config_dup_list(&dup_list);
synchronize_specific_config_sections_with_dmmap("network", "route_disabled", "dmmap_route_forwarding", &dup_list);
list_for_each_entry(p, &dup_list, list) {
init_args_ipv4forward(&curr_routefwdargs, p->config_section, "1", ROUTE_DISABLED);
iroute = handle_update_instance(1, dmctx, &iroute_last, forwarding_update_instance_alias_bbfdm, 4, p->dmmap_section, "routeinstance", "routealias", &find_max);
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_routefwdargs, iroute) == DM_STOP)
inst = handle_update_instance(1, dmctx, &max_inst, forwarding_update_instance_alias_bbfdm, 4,
p->dmmap_section, "routeinstance", "routealias", &find_max);
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_routefwdargs, inst) == DM_STOP)
goto end;
}
free_dmmap_config_dup_list(&dup_list);
dmmap_synchronizeRoutingRouterIPv4Forwarding(dmctx, NULL, NULL, NULL);
uci_path_foreach_sections(bbfdm, "dmmap_route_forwarding", "route_dynamic", ss) {
init_args_ipv4forward(&curr_routefwdargs, ss, "0", ROUTE_DYNAMIC);
iroute = handle_update_instance(1, dmctx, &iroute_last, forwarding_update_instance_alias_bbfdm, 4, ss, "routeinstance", "routealias", &find_max);
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_routefwdargs, iroute) == DM_STOP)
inst = handle_update_instance(1, dmctx, &max_inst, forwarding_update_instance_alias_bbfdm, 4,
ss, "routeinstance", "routealias", &find_max);
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_routefwdargs, inst) == DM_STOP)
goto end;
}
end:
@ -1224,7 +1237,7 @@ end:
/*#Device.Routing.Router.{i}.IPv6Forwarding.{i}.!UCI:network/route6/dmmap_route_forwarding*/
static int browseIPv6ForwardingInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
char *iroute = NULL, *iroute_last = NULL;
char *inst = NULL, *max_inst = NULL;
struct uci_section *ss = NULL;
bool find_max = true;
struct routingfwdargs curr_route6fwdargs = {0};
@ -1234,16 +1247,22 @@ static int browseIPv6ForwardingInst(struct dmctx *dmctx, DMNODE *parent_node, vo
synchronize_specific_config_sections_with_dmmap("network", "route6", "dmmap_route_forwarding", &dup_list);
list_for_each_entry(p, &dup_list, list) {
init_args_ipv6forward(&curr_route6fwdargs, p->config_section, "1", ROUTE_STATIC);
iroute = handle_update_instance(1, dmctx, &iroute_last, forwarding6_update_instance_alias_bbfdm, 4, p->dmmap_section, "route6instance", "route6alias", &find_max);
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_route6fwdargs, iroute) == DM_STOP)
inst = handle_update_instance(1, dmctx, &max_inst, forwarding6_update_instance_alias_bbfdm, 4,
p->dmmap_section, "route6instance", "route6alias", &find_max);
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_route6fwdargs, inst) == DM_STOP)
goto end;
}
free_dmmap_config_dup_list(&dup_list);
dmmap_synchronizeRoutingRouterIPv6Forwarding(dmctx, NULL, NULL, NULL);
uci_path_foreach_sections(bbfdm, "dmmap_route_forwarding", "route6_dynamic", ss) {
init_args_ipv6forward(&curr_route6fwdargs, ss, "0", ROUTE_DYNAMIC);
iroute = handle_update_instance(1, dmctx, &iroute_last, forwarding6_update_instance_alias_bbfdm, 4, ss, "route6instance", "route6alias", &find_max);
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_route6fwdargs, iroute) == DM_STOP)
inst = handle_update_instance(1, dmctx, &max_inst, forwarding6_update_instance_alias_bbfdm, 4,
ss, "route6instance", "route6alias", &find_max);
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_route6fwdargs, inst) == DM_STOP)
goto end;
}
end:
@ -1254,7 +1273,7 @@ static int browseRoutingRouteInformationInterfaceSettingInst(struct dmctx *dmctx
{
struct uci_section *s = NULL;
json_object *res, *route_obj;
char *proto, *ip6addr, *idx, *idx_last = NULL;
char *proto, *ip6addr, *inst, *max_inst = NULL;
int id = 0, entries = 0;
uci_foreach_sections("network", "interface", s) {
@ -1266,8 +1285,8 @@ static int browseRoutingRouteInformationInterfaceSettingInst(struct dmctx *dmctx
route_obj = dmjson_select_obj_in_array_idx(res, entries, 1, "route");
if(route_obj) {
entries++;
idx = handle_update_instance(3, dmctx, &idx_last, update_instance_without_section, 1, ++id);
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)route_obj, idx) == DM_STOP)
inst = handle_update_instance(3, dmctx, &max_inst, update_instance_without_section, 1, ++id);
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)route_obj, inst) == DM_STOP)
break;
}
else
@ -1280,7 +1299,7 @@ static int browseRoutingRouteInformationInterfaceSettingInst(struct dmctx *dmctx
/* *** Device.Routing. *** */
DMOBJ tRoutingObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"Router", &DMREAD, NULL, NULL, NULL, browseRouterInst, NULL, NULL, NULL, tRoutingRouterObj, tRoutingRouterParams, NULL, BBFDM_BOTH},
{"RouteInformation", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tRoutingRouteInformationObj, tRoutingRouteInformationParams, NULL, BBFDM_BOTH},
{0}
@ -1294,7 +1313,7 @@ DMLEAF tRoutingParams[] = {
/* *** Device.Routing.Router.{i}. *** */
DMOBJ tRoutingRouterObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"IPv4Forwarding", &DMWRITE, add_ipv4forwarding, delete_ipv4forwarding, NULL, browseIPv4ForwardingInst, NULL, NULL, NULL, NULL, tRoutingRouterIPv4ForwardingParams, NULL, BBFDM_BOTH},
{"IPv6Forwarding", &DMWRITE, add_ipv6Forwarding, delete_ipv6Forwarding, NULL, browseIPv6ForwardingInst, NULL, NULL, NULL, NULL, tRoutingRouterIPv6ForwardingParams, NULL, BBFDM_BOTH},
{0}
@ -1345,7 +1364,7 @@ DMLEAF tRoutingRouterIPv6ForwardingParams[] = {
/* *** Device.Routing.RouteInformation. *** */
DMOBJ tRoutingRouteInformationObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"InterfaceSetting", &DMREAD, NULL, NULL, NULL, browseRoutingRouteInformationInterfaceSettingInst, NULL, NULL, NULL, NULL, tRoutingRouteInformationInterfaceSettingParams, NULL, BBFDM_BOTH},
{0}
};

View file

@ -209,7 +209,7 @@ static void get_certificate_paths(void)
static int browseSecurityCertificateInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
#if defined(LOPENSSL) || defined(LMBEDTLS)
char *cert_inst= NULL, *cert_inst_last= NULL, *v = NULL;
char *inst = NULL, *max_inst = NULL, *v = NULL;
struct uci_section *dmmap_sect = NULL;
struct certificate_profile certificateprofile = {};
@ -234,8 +234,11 @@ static int browseSecurityCertificateInst(struct dmctx *dmctx, DMNODE *parent_nod
DMUCI_SET_VALUE_BY_SECTION(bbfdm, dmmap_sect, "path", certifcates_paths[i]);
}
init_certificate(certifcates_paths[i], cert, dmmap_sect, &certificateprofile);
cert_inst = handle_update_instance(1, dmctx, &cert_inst_last, update_instance_alias, 3, dmmap_sect, "security_certificate_instance", "security_certificate_alias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&certificateprofile, cert_inst) == DM_STOP)
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
dmmap_sect, "security_certificate_instance", "security_certificate_alias", "dmmap_security", "security_certificate");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&certificateprofile, inst) == DM_STOP)
break;
X509_free(cert);
@ -253,8 +256,11 @@ static int browseSecurityCertificateInst(struct dmctx *dmctx, DMNODE *parent_nod
DMUCI_SET_VALUE_BY_SECTION(bbfdm, dmmap_sect, "path", certifcates_paths[i]);
}
init_certificate(certifcates_paths[i], cacert, dmmap_sect, &certificateprofile);
cert_inst = handle_update_instance(1, dmctx, &cert_inst_last, update_instance_alias, 3, dmmap_sect, "security_certificate_instance", "security_certificate_alias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&certificateprofile, cert_inst) == DM_STOP)
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
dmmap_sect, "security_certificate_instance", "security_certificate_alias", "dmmap_security", "security_certificate");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&certificateprofile, inst) == DM_STOP)
break;
#endif
}
@ -424,7 +430,7 @@ static int get_SecurityCertificate_SignatureAlgorithm(char *refparam, struct dmc
/* *** Device.Security. *** */
DMOBJ tSecurityObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"Certificate", &DMREAD, NULL, NULL, NULL, browseSecurityCertificateInst, NULL, NULL, NULL, NULL, tSecurityCertificateParams, NULL, BBFDM_BOTH},
{0}
};

View file

@ -100,7 +100,7 @@ static int browseUPnPDiscoveryRootDeviceInst(struct dmctx *dmctx, DMNODE *parent
{
json_object *res = NULL, *devices = NULL, *device = NULL;
struct upnpdiscovery upnp_dev = {};
char *descurl = NULL, *st = NULL, *usn = NULL, *is_root_device = NULL, *instance = NULL, *instnbr = NULL, *v = NULL;
char *descurl = NULL, *st = NULL, *usn = NULL, *is_root_device = NULL, *inst = NULL, *max_inst = NULL, *v = NULL;
char **stparams = NULL, **uuid, **urn;
int i;
size_t length;
@ -138,8 +138,10 @@ static int browseUPnPDiscoveryRootDeviceInst(struct dmctx *dmctx, DMNODE *parent
}
upnp_dev.dmmap_sect = dmmap_sect;
instance = handle_update_instance(1, dmctx, &instnbr, update_instance_alias_bbfdm, 3, dmmap_sect, "upnp_root_device_instance", "upnp_root_device_alias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, &upnp_dev, instance) == DM_STOP)
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
dmmap_sect, "upnp_root_device_instance", "upnp_root_device_alias", "dmmap_upnp", "upnp_root_device");
if (DM_LINK_INST_OBJ(dmctx, parent_node, &upnp_dev, inst) == DM_STOP)
return 0;
}
}
@ -150,7 +152,7 @@ static int browseUPnPDiscoveryDeviceInst(struct dmctx *dmctx, DMNODE *parent_nod
{
json_object *res = NULL, *devices = NULL, *device = NULL;
struct upnpdiscovery upnp_dev = {};
char *descurl = NULL, *st = NULL, *usn = NULL, *instance = NULL, *instnbr = NULL, *v = NULL;
char *descurl = NULL, *st = NULL, *usn = NULL, *inst = NULL, *max_inst = NULL, *v = NULL;
char **stparams= NULL, **uuid, **urn;
int i;
size_t lengthuuid, lengthurn;
@ -185,8 +187,10 @@ static int browseUPnPDiscoveryDeviceInst(struct dmctx *dmctx, DMNODE *parent_nod
}
upnp_dev.dmmap_sect = dmmap_sect;
instance = handle_update_instance(1, dmctx, &instnbr, update_instance_alias_bbfdm, 3, dmmap_sect, "upnp_evice_instance", "upnp_device_alias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, &upnp_dev, instance) == DM_STOP)
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
dmmap_sect, "upnp_evice_instance", "upnp_device_alias", "dmmap_upnp", "upnp_device");
if (DM_LINK_INST_OBJ(dmctx, parent_node, &upnp_dev, inst) == DM_STOP)
return 0;
}
}
@ -197,7 +201,7 @@ static int browseUPnPDiscoveryServiceInst(struct dmctx *dmctx, DMNODE *parent_no
{
json_object *res = NULL, *services = NULL, *service = NULL;
struct upnpdiscovery upnp_dev = {};
char *descurl = NULL, *st = NULL, *usn = NULL, *instance = NULL, *instnbr = NULL, *v = NULL;
char *descurl = NULL, *st = NULL, *usn = NULL, *inst = NULL, *max_inst = NULL, *v = NULL;
char **stparams = NULL, **uuid, **urn;
int i;
size_t lengthuuid, lengthurn;
@ -232,8 +236,10 @@ static int browseUPnPDiscoveryServiceInst(struct dmctx *dmctx, DMNODE *parent_no
}
upnp_dev.dmmap_sect = dmmap_sect;
instance = handle_update_instance(1, dmctx, &instnbr, update_instance_alias_bbfdm, 3, dmmap_sect, "upnp_service_instance", "upnp_service_alias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, &upnp_dev, instance) == DM_STOP)
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
dmmap_sect, "upnp_service_instance", "upnp_service_alias", "dmmap_upnp", "upnp_service");
if (DM_LINK_INST_OBJ(dmctx, parent_node, &upnp_dev, inst) == DM_STOP)
return 0;
}
}
@ -244,7 +250,7 @@ static int browseUPnPDescriptionDeviceDescriptionInst(struct dmctx *dmctx, DMNOD
{
json_object *res = NULL, *descriptions = NULL, *description = NULL;
struct upnp_description_file_info upnp_desc= {};
char *descurl = NULL, *instance = NULL, *instnbr = NULL, *v = NULL;
char *descurl = NULL, *inst = NULL, *max_inst = NULL, *v = NULL;
int i;
struct uci_section* dmmap_sect = NULL;
@ -268,8 +274,10 @@ static int browseUPnPDescriptionDeviceDescriptionInst(struct dmctx *dmctx, DMNOD
}
upnp_desc.dmmap_sect = dmmap_sect;
instance = handle_update_instance(1, dmctx, &instnbr, update_instance_alias_bbfdm, 3, dmmap_sect, "upnp_service_instance", "upnp_service_alias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, &upnp_desc, instance) == DM_STOP)
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
dmmap_sect, "upnp_service_instance", "upnp_service_alias", "dmmap_upnp", "upnp_description");
if (DM_LINK_INST_OBJ(dmctx, parent_node, &upnp_desc, inst) == DM_STOP)
return 0;
}
}
@ -280,7 +288,7 @@ static int browseUPnPDescriptionDeviceInstanceInst(struct dmctx *dmctx, DMNODE *
{
json_object *res = NULL, *devices_instances = NULL, *device_inst = NULL;
struct upnp_device_inst upnp_dev_inst = {};
char *instance = NULL, *instnbr = NULL, *v;
char *inst = NULL, *max_inst = NULL, *v;
int i;
struct uci_section* dmmap_sect = NULL;
@ -314,8 +322,10 @@ static int browseUPnPDescriptionDeviceInstanceInst(struct dmctx *dmctx, DMNODE *
}
upnp_dev_inst.dmmap_sect = dmmap_sect;
instance = handle_update_instance(1, dmctx, &instnbr, update_instance_alias_bbfdm, 3, dmmap_sect, "upnp_device_inst_instance", "upnp_device_inst_alias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, &upnp_dev_inst, instance) == DM_STOP)
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
dmmap_sect, "upnp_device_inst_instance", "upnp_device_inst_alias", "dmmap_upnp", "upnp_device_inst");
if (DM_LINK_INST_OBJ(dmctx, parent_node, &upnp_dev_inst, inst) == DM_STOP)
return 0;
}
}
@ -326,7 +336,7 @@ static int browseUPnPDescriptionServiceInstanceInst(struct dmctx *dmctx, DMNODE
{
json_object *res = NULL, *services_instances = NULL, *service_inst = NULL;
struct upnp_service_inst upnp_services_inst = {};
char *instance = NULL, *instnbr = NULL, *v;
char *inst = NULL, *max_inst = NULL, *v;
int i;
struct uci_section* dmmap_sect = NULL;
@ -354,8 +364,10 @@ static int browseUPnPDescriptionServiceInstanceInst(struct dmctx *dmctx, DMNODE
}
upnp_services_inst.dmmap_sect = dmmap_sect;
instance = handle_update_instance(1, dmctx, &instnbr, update_instance_alias_bbfdm, 3, dmmap_sect, "upnp_service_inst_instance", "upnp_service_inst_alias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, &upnp_services_inst, instance) == DM_STOP)
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
dmmap_sect, "upnp_service_inst_instance", "upnp_service_inst_alias", "dmmap_upnp", "upnp_service_inst");
if (DM_LINK_INST_OBJ(dmctx, parent_node, &upnp_services_inst, inst) == DM_STOP)
return 0;
}
}
@ -819,7 +831,7 @@ static int get_UPnPDescriptionServiceInstance_EventSubURL(char *refparam, struct
/* *** Device.UPnP. *** */
DMOBJ tUPnPObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"Device", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tUPnPDeviceObj, tUPnPDeviceParams, NULL, BBFDM_BOTH},
{"Discovery", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tUPnPDiscoveryObj, tUPnPDiscoveryParams, NULL, BBFDM_BOTH},
{"Description", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tUPnPDescriptionObj, tUPnPDescriptionParams, NULL, BBFDM_BOTH},
@ -828,7 +840,7 @@ DMOBJ tUPnPObj[] = {
/* *** Device.UPnP.Device. *** */
DMOBJ tUPnPDeviceObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"Capabilities", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tUPnPDeviceCapabilitiesParams, NULL, BBFDM_BOTH},
{0}
};
@ -869,7 +881,7 @@ DMLEAF tUPnPDeviceCapabilitiesParams[] = {
/* *** Device.UPnP.Discovery. *** */
DMOBJ tUPnPDiscoveryObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"RootDevice", &DMREAD, NULL, NULL, NULL, browseUPnPDiscoveryRootDeviceInst, NULL, NULL, NULL, NULL, tUPnPDiscoveryRootDeviceParams, get_root_device_linker, BBFDM_BOTH},
{"Device", &DMREAD, NULL, NULL, NULL, browseUPnPDiscoveryDeviceInst, NULL, NULL, NULL, NULL, tUPnPDiscoveryDeviceParams, get_device_linker, BBFDM_BOTH},
{"Service", &DMREAD, NULL, NULL, NULL, browseUPnPDiscoveryServiceInst, NULL, NULL, NULL, NULL, tUPnPDiscoveryServiceParams, get_service_linker, BBFDM_BOTH},
@ -928,7 +940,7 @@ DMLEAF tUPnPDiscoveryServiceParams[] = {
/* *** Device.UPnP.Description. *** */
DMOBJ tUPnPDescriptionObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"DeviceDescription", &DMREAD, NULL, NULL, NULL, browseUPnPDescriptionDeviceDescriptionInst, NULL, NULL, NULL, NULL, tUPnPDescriptionDeviceDescriptionParams, NULL, BBFDM_BOTH},
{"DeviceInstance", &DMREAD, NULL, NULL, NULL, browseUPnPDescriptionDeviceInstanceInst, NULL, NULL, NULL, NULL, tUPnPDescriptionDeviceInstanceParams, get_device_instance_linker, BBFDM_BOTH},
{"ServiceInstance", &DMREAD, NULL, NULL, NULL, browseUPnPDescriptionServiceInstanceInst, NULL, NULL, NULL, NULL, tUPnPDescriptionServiceInstanceParams, NULL, BBFDM_BOTH},

View file

@ -119,7 +119,7 @@ static int browseUSBInterfaceInst(struct dmctx *dmctx, DMNODE *parent_node, void
{
DIR *dir;
struct dirent *ent;
char *iface_path, *statistics_path, *instnbr = NULL, *instance = NULL;
char *iface_path, *statistics_path, *max_inst = NULL, *inst = NULL;
size_t length;
char **foldersplit;
struct usb_interface iface= {};
@ -160,8 +160,11 @@ static int browseUSBInterfaceInst(struct dmctx *dmctx, DMNODE *parent_node, void
dmasprintf(&statistics_path, "%s/statistics", iface_path);
init_usb_interface(p->dm, iface_name, iface_path, statistics_path, port_link, &iface);
instance = handle_update_instance(1, dmctx, &instnbr, update_instance_alias, 3, p->dm, "usb_iface_instance", "usb_iface_alias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, &iface, instance) == DM_STOP)
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
p->dm, "usb_iface_instance", "usb_iface_alias", "dmmap_usb", "dmmap_interface");
if (DM_LINK_INST_OBJ(dmctx, parent_node, &iface, inst) == DM_STOP)
break;
}
free_dmmap_config_dup_list(&dup_list);
@ -170,7 +173,7 @@ static int browseUSBInterfaceInst(struct dmctx *dmctx, DMNODE *parent_node, void
static int browseUSBPortInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
char *instnbr = NULL, *instance = NULL;
char *max_inst = NULL, *inst = NULL;
struct usb_port port = {0};
struct sysfs_dmsection *p;
LIST_HEAD(dup_list);
@ -191,10 +194,11 @@ static int browseUSBPortInst(struct dmctx *dmctx, DMNODE *parent_node, void *pre
continue;
}
init_usb_port(p->dm, p->sysfs_folder_name, p->sysfs_folder_path, &port);
instance = handle_update_instance(1, dmctx, &instnbr,
update_instance_alias_bbfdm, 3, p->dm,
"usb_port_instance", "usb_port_alias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, &port, instance) == DM_STOP)
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
p->dm, "usb_port_instance", "usb_port_alias", "dmmap_usb", "dmmap_port");
if (DM_LINK_INST_OBJ(dmctx, parent_node, &port, inst) == DM_STOP)
break;
}
free_dmmap_config_dup_list(&dup_list);
@ -206,7 +210,7 @@ static int browseUSBPortInst(struct dmctx *dmctx, DMNODE *parent_node, void *pre
static int browseUSBUSBHostsHostInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
struct sysfs_dmsection *p;
char *instance = NULL, *instnbr = NULL;
char *inst = NULL, *max_inst = NULL;
struct usb_port port= {};
LIST_HEAD(dup_list);
@ -218,9 +222,11 @@ static int browseUSBUSBHostsHostInst(struct dmctx *dmctx, DMNODE *parent_node, v
init_usb_port(p->dm, p->sysfs_folder_name, p->sysfs_folder_path, &port);
port.dmsect= p->dm;
instance = handle_update_instance(1, dmctx, &instnbr, update_instance_alias_bbfdm, 3, p->dm, "usb_host_instance", "usb_host_alias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, &port, instance) == DM_STOP)
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
p->dm, "usb_host_instance", "usb_host_alias", "dmmap_usb", "dmmap_host");
if (DM_LINK_INST_OBJ(dmctx, parent_node, &port, inst) == DM_STOP)
break;
}
free_dmmap_config_dup_list(&dup_list);
@ -318,7 +324,8 @@ static int browseUSBUSBHostsHostDeviceInst(struct dmctx *dmctx, DMNODE *parent_n
DMUCI_SET_VALUE_BY_SECTION(bbfdm, p->dm, "usb_host_device_parent_host_instance", parent_host_instance);
}
port.dmsect= prev_port->dmsect;
instance = handle_update_instance(1, dmctx, &instnbr, update_instance_alias_bbfdm, 3, p->dm, "usb_host_device_instance", "usb_host_device_alias");
instance = handle_update_instance(1, dmctx, &instnbr, update_instance_alias, 5,
p->dm, "usb_host_device_instance", "usb_host_device_alias", "dmmap_usb", "dmmap_host_device");
if (DM_LINK_INST_OBJ(dmctx, parent_node, &port, instance) == DM_STOP)
break;
}
@ -331,7 +338,7 @@ static int browseUSBUSBHostsHostDeviceConfigurationInst(struct dmctx *dmctx, DMN
const struct usb_port *usb_dev = prev_data;
struct usb_port port = {};
struct uci_section *s;
char nbre[16], *v, *instnbr = NULL;
char nbre[16], *v, *max_inst = NULL;
__read_sysfs_usb_port(usb_dev, "bNumConfigurations", nbre, sizeof(nbre));
if(nbre[0] == '0')
@ -344,7 +351,10 @@ static int browseUSBUSBHostsHostDeviceConfigurationInst(struct dmctx *dmctx, DMN
DMUCI_SET_VALUE_BY_SECTION(bbfdm, s, "usb_parent_device", usb_dev->folder_path);
init_usb_port(s, usb_dev->folder_name, usb_dev->folder_path, &port);
handle_update_instance(1, dmctx, &instnbr, update_instance_alias, 3, s, "usb_device_conf_instance", "usb_device_conf_alias");
handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
s, "usb_device_conf_instance", "usb_device_conf_alias", "dmmap_usb", "usb_device_conf");
DM_LINK_INST_OBJ(dmctx, parent_node, &port, "1");
return 0;
}
@ -355,7 +365,7 @@ static int browseUSBUSBHostsHostDeviceConfigurationInterfaceInst(struct dmctx *d
struct dirent *ent;
struct usb_port *usb_dev = (struct usb_port*)prev_data;
struct usb_port port = {0};
char *sysfs_rep_path, *v, *instance = NULL, *instnbr = NULL;
char *sysfs_rep_path, *v, *inst = NULL, *max_inst = NULL;
struct uci_section *dmmap_sect;
regex_t regex1 = {};
regex_t regex2 = {};
@ -374,8 +384,11 @@ static int browseUSBUSBHostsHostDeviceConfigurationInterfaceInst(struct dmctx *d
}
init_usb_port(dmmap_sect, ent->d_name, sysfs_rep_path, &port);
instance = handle_update_instance(1, dmctx, &instnbr, update_instance_alias_bbfdm, 3, dmmap_sect, "usb_device_conf_iface_instance", "usb_device_conf_iface_alias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, &port, instance) == DM_STOP)
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
dmmap_sect, "usb_device_conf_iface_instance", "usb_device_conf_iface_alias", "dmmap_usb", "usb_device_conf_interface");
if (DM_LINK_INST_OBJ(dmctx, parent_node, &port, inst) == DM_STOP)
break;
}
}
@ -1068,7 +1081,7 @@ static int get_linker_usb_host_device(char *refparam, struct dmctx *dmctx, void
/* *** Device.USB. *** */
DMOBJ tUSBObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"Interface", &DMREAD, NULL, NULL, NULL, browseUSBInterfaceInst, NULL, NULL, NULL, tUSBInterfaceObj, tUSBInterfaceParams, NULL, BBFDM_BOTH},
{"Port", &DMREAD, NULL, NULL, NULL, browseUSBPortInst, NULL, NULL, NULL, NULL, tUSBPortParams, get_linker_usb_port, BBFDM_BOTH},
{"USBHosts", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tUSBUSBHostsObj, tUSBUSBHostsParams, NULL, BBFDM_BOTH},
@ -1084,7 +1097,7 @@ DMLEAF tUSBParams[] = {
/* *** Device.USB.Interface.{i}. *** */
DMOBJ tUSBInterfaceObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"Stats", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tUSBInterfaceStatsParams, NULL, BBFDM_BOTH},
{0}
};
@ -1140,7 +1153,7 @@ DMLEAF tUSBPortParams[] = {
/* *** Device.USB.USBHosts. *** */
DMOBJ tUSBUSBHostsObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"Host", &DMREAD, NULL, NULL, NULL, browseUSBUSBHostsHostInst, NULL, NULL, NULL, tUSBUSBHostsHostObj, tUSBUSBHostsHostParams, NULL, BBFDM_BOTH},
{0}
};
@ -1153,7 +1166,7 @@ DMLEAF tUSBUSBHostsParams[] = {
/* *** Device.USB.USBHosts.Host.{i}. *** */
DMOBJ tUSBUSBHostsHostObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"Device", &DMREAD, NULL, NULL, NULL, browseUSBUSBHostsHostDeviceInst, NULL, NULL, NULL, tUSBUSBHostsHostDeviceObj, tUSBUSBHostsHostDeviceParams, get_linker_usb_host_device, BBFDM_BOTH},
{0}
};
@ -1173,7 +1186,7 @@ DMLEAF tUSBUSBHostsHostParams[] = {
/* *** Device.USB.USBHosts.Host.{i}.Device.{i}. *** */
DMOBJ tUSBUSBHostsHostDeviceObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"Configuration", &DMREAD, NULL, NULL, NULL, browseUSBUSBHostsHostDeviceConfigurationInst, NULL, NULL, NULL, tUSBUSBHostsHostDeviceConfigurationObj, tUSBUSBHostsHostDeviceConfigurationParams, NULL, BBFDM_BOTH},
{0}
};
@ -1204,7 +1217,7 @@ DMLEAF tUSBUSBHostsHostDeviceParams[] = {
/* *** Device.USB.USBHosts.Host.{i}.Device.{i}.Configuration.{i}. *** */
DMOBJ tUSBUSBHostsHostDeviceConfigurationObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"Interface", &DMREAD, NULL, NULL, NULL, browseUSBUSBHostsHostDeviceConfigurationInterfaceInst, NULL, NULL, NULL, NULL, tUSBUSBHostsHostDeviceConfigurationInterfaceParams, NULL, BBFDM_BOTH},
{0}
};

View file

@ -206,7 +206,7 @@ static int set_userint_remoteaccesss_protocol(char *refparam, struct dmctx *ctx,
/* *** Device.UserInterface. *** */
DMOBJ tUserInterfaceObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"RemoteAccess", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tUserInterfaceRemoteAccessParams, NULL, BBFDM_BOTH},
{0}
};

View file

@ -15,14 +15,17 @@
/*#Device.Users.User.{i}.!UCI:users/user/dmmap_users*/
static int browseUserInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
char *instance, *instnbr = NULL;
char *inst, *max_inst = NULL;
struct dmmap_dup *p;
LIST_HEAD(dup_list);
synchronize_specific_config_sections_with_dmmap("users", "user", "dmmap_users", &dup_list);
list_for_each_entry(p, &dup_list, list) {
instance = handle_update_instance(1, dmctx, &instnbr, update_instance_alias, 3, p->dmmap_section, "user_instance", "user_alias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, instance) == DM_STOP)
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
p->dmmap_section, "user_instance", "user_alias", "dmmap_users", "user");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, inst) == DM_STOP)
break;
}
free_dmmap_config_dup_list(&dup_list);
@ -45,7 +48,7 @@ static int add_users_user(char *refparam, struct dmctx *ctx, void *data, char **
dmuci_add_section_bbfdm("dmmap_users", "user", &dmmap_user, &v);
dmuci_set_value_by_section(dmmap_user, "section_name", sect_name);
*instance = update_instance_bbfdm(dmmap_user, last_inst, "user_instance");
*instance = update_instance(dmmap_user, last_inst, "user_instance");
return 0;
}
@ -239,7 +242,7 @@ static int set_user_language(char *refparam, struct dmctx *ctx, void *data, char
/* *** Device.Users. *** */
DMOBJ tUsersObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"User", &DMWRITE, add_users_user, delete_users_user, NULL, browseUserInst, NULL, NULL, NULL, NULL, tUsersUserParams, NULL, BBFDM_BOTH},
{0}
};

View file

@ -530,7 +530,7 @@ int os__browseWifiNeighboringWiFiDiagnosticResultInst(struct dmctx *dmctx, DMNOD
{
struct uci_section *ss;
json_object *res = NULL, *accesspoints = NULL, *arrobj = NULL;
char object[32], *idx, *idx_last = NULL;
char object[32], *inst, *max_inst = NULL;
int id = 0, i = 0;
uci_foreach_sections("wireless", "wifi-device", ss) {
@ -538,8 +538,8 @@ int os__browseWifiNeighboringWiFiDiagnosticResultInst(struct dmctx *dmctx, DMNOD
dmubus_call(object, "scanresults", UBUS_ARGS{}, 0, &res);
if (res) {
dmjson_foreach_obj_in_array(res, arrobj, accesspoints, i, 1, "accesspoints") {
idx = handle_update_instance(3, dmctx, &idx_last, update_instance_without_section, 1, ++id);
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)accesspoints, idx) == DM_STOP)
inst = handle_update_instance(3, dmctx, &max_inst, update_instance_without_section, 1, ++id);
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)accesspoints, inst) == DM_STOP)
return 0;
}
}
@ -619,15 +619,15 @@ int os__get_access_point_total_associations(char *refparam, struct dmctx *ctx, v
int os__browse_wifi_associated_device(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
json_object *res = NULL, *stations = NULL, *arrobj = NULL;
char object[32], *idx, *idx_last = NULL;
char object[32], *inst, *max_inst = NULL;
int id = 0, i = 0;
snprintf(object, sizeof(object), "wifi.ap.%s", ((struct wifi_acp_args *)prev_data)->ifname);
dmubus_call(object, "stations", UBUS_ARGS{}, 0, &res);
if (res) {
dmjson_foreach_obj_in_array(res, arrobj, stations, i, 1, "stations") {
idx = handle_update_instance(3, dmctx, &idx_last, update_instance_without_section, 1, ++id);
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)stations, idx) == DM_STOP)
inst = handle_update_instance(3, dmctx, &max_inst, update_instance_without_section, 1, ++id);
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)stations, inst) == DM_STOP)
return 0;
}
}

View file

@ -1998,7 +1998,7 @@ static int add_wifi_ssid(char *refparam, struct dmctx *ctx, void *data, char **i
dmuci_add_section_bbfdm("dmmap_wireless", "wifi-iface", &dmmap_wifi, &v);
dmuci_set_value_by_section(dmmap_wifi, "section_name", section_name(s));
*instance = update_instance_bbfdm(dmmap_wifi, inst, "ssidinstance");
*instance = update_instance(dmmap_wifi, inst, "ssidinstance");
return 0;
}
@ -2049,7 +2049,7 @@ static int add_wifi_accesspoint(char *refparam, struct dmctx *ctx, void *data, c
dmuci_add_section_bbfdm("dmmap_wireless", "wifi-iface", &dmmap_wifi, &v);
dmuci_set_value_by_section(dmmap_wifi, "section_name", section_name(s));
*instance = update_instance_bbfdm(dmmap_wifi, inst, "ap_instance");
*instance = update_instance(dmmap_wifi, inst, "ap_instance");
return 0;
}
@ -2100,7 +2100,7 @@ static int addObjWiFiEndPoint(char *refparam, struct dmctx *ctx, void *data, cha
dmuci_add_section_bbfdm("dmmap_wireless", "wifi-iface", &dmmap_sec, &v);
dmuci_set_value_by_section(dmmap_sec, "section_name", section_name(endpoint_sec));
*instance = update_instance_bbfdm(dmmap_sec, instancepara, "endpointinstance");
*instance = update_instance(dmmap_sec, instancepara, "endpointinstance");
return 0;
}
@ -2135,7 +2135,7 @@ static int delObjWiFiEndPoint(char *refparam, struct dmctx *ctx, void *data, cha
/*#Device.WiFi.Radio.{i}.!UCI:wireless/wifi-device/dmmap_wireless*/
static int browseWifiRadioInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
char *wnum = NULL, *wnum_last = NULL;
char *inst = NULL, *max_inst = NULL;
struct wifi_radio_args curr_wifi_radio_args = {0};
struct dmmap_dup *p;
LIST_HEAD(dup_list);
@ -2143,8 +2143,11 @@ static int browseWifiRadioInst(struct dmctx *dmctx, DMNODE *parent_node, void *p
synchronize_specific_config_sections_with_dmmap("wireless", "wifi-device", "dmmap_wireless", &dup_list);
list_for_each_entry(p, &dup_list, list) {
init_wifi_radio(&curr_wifi_radio_args, p->config_section);
wnum = handle_update_instance(1, dmctx, &wnum_last, update_instance_alias, 3, p->dmmap_section, "radioinstance", "radioalias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_wifi_radio_args, wnum) == DM_STOP)
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
p->dmmap_section, "radioinstance", "radioalias", "dmmap_wireless", "wifi-device");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_wifi_radio_args, inst) == DM_STOP)
break;
}
free_dmmap_config_dup_list(&dup_list);
@ -2154,7 +2157,7 @@ static int browseWifiRadioInst(struct dmctx *dmctx, DMNODE *parent_node, void *p
/*#Device.WiFi.SSID.{i}.!UCI:wireless/wifi-iface/dmmap_wireless*/
static int browseWifiSsidInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
char *wnum = NULL, *ssid_last = NULL, *ifname, *linker;
char *inst = NULL, *max_inst = NULL, *ifname, *linker;
struct wifi_ssid_args curr_wifi_ssid_args = {0};
struct dmmap_dup *p;
LIST_HEAD(dup_list);
@ -2168,8 +2171,11 @@ static int browseWifiSsidInst(struct dmctx *dmctx, DMNODE *parent_node, void *pr
dmuci_get_value_by_section_string(p->config_section, "ifname", &ifname);
#endif
init_wifi_ssid(&curr_wifi_ssid_args, p->config_section, ifname, linker);
wnum = handle_update_instance(1, dmctx, &ssid_last, update_instance_alias, 3, p->dmmap_section, "ssidinstance", "ssidalias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_wifi_ssid_args, wnum) == DM_STOP)
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
p->dmmap_section, "ssidinstance", "ssidalias", "dmmap_wireless", "wifi-iface");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_wifi_ssid_args, inst) == DM_STOP)
break;
}
free_dmmap_config_dup_list(&dup_list);
@ -2179,7 +2185,7 @@ static int browseWifiSsidInst(struct dmctx *dmctx, DMNODE *parent_node, void *pr
/*#Device.WiFi.AccessPoint.{i}.!UCI:wireless/wifi-iface/dmmap_wireless*/
static int browseWifiAccessPointInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
char *wnum = NULL, *ifname, *acpt_last = NULL, *mode = NULL;
char *inst = NULL, *ifname, *max_inst = NULL, *mode = NULL;
struct wifi_acp_args curr_wifi_acp_args = {0};
struct dmmap_dup *p;
LIST_HEAD(dup_list);
@ -2191,8 +2197,11 @@ static int browseWifiAccessPointInst(struct dmctx *dmctx, DMNODE *parent_node, v
continue;
dmuci_get_value_by_section_string(p->config_section, "ifname", &ifname);
init_wifi_acp(&curr_wifi_acp_args, p->config_section, ifname);
wnum = handle_update_instance(1, dmctx, &acpt_last, update_instance_alias, 3, p->dmmap_section, "ap_instance", "ap_alias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_wifi_acp_args, wnum) == DM_STOP)
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
p->dmmap_section, "ap_instance", "ap_alias", "dmmap_wireless", "wifi-iface");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_wifi_acp_args, inst) == DM_STOP)
break;
}
free_dmmap_config_dup_list(&dup_list);
@ -2202,7 +2211,7 @@ static int browseWifiAccessPointInst(struct dmctx *dmctx, DMNODE *parent_node, v
/*#Device.WiFi.EndPoint.{i}.!UCI:wireless/wifi-iface/dmmap_wireless*/
static int browseWiFiEndPointInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
char *wnum = NULL, *ifname, *acpt_last = NULL, *mode= NULL;
char *inst = NULL, *ifname, *max_inst = NULL, *mode= NULL;
struct wifi_enp_args curr_wifi_enp_args = {0};
struct dmmap_dup *p;
LIST_HEAD(dup_list);
@ -2214,8 +2223,11 @@ static int browseWiFiEndPointInst(struct dmctx *dmctx, DMNODE *parent_node, void
continue;
dmuci_get_value_by_section_string(p->config_section, "ifname", &ifname);
init_wifi_enp(&curr_wifi_enp_args, p->config_section, ifname);
wnum = handle_update_instance(1, dmctx, &acpt_last, update_instance_alias, 3, p->dmmap_section, "endpointinstance", "endpointalias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_wifi_enp_args, wnum) == DM_STOP)
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
p->dmmap_section, "endpointinstance", "endpointalias", "dmmap_wireless", "wifi-iface");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_wifi_enp_args, inst) == DM_STOP)
break;
}
free_dmmap_config_dup_list(&dup_list);
@ -2225,7 +2237,7 @@ static int browseWiFiEndPointInst(struct dmctx *dmctx, DMNODE *parent_node, void
static int browseWiFiEndPointProfileInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
struct uci_section *s= NULL;
char *v, *instnbr = NULL, *ep_instance;
char *v, *max_inst = NULL, *ep_instance;
struct wifi_enp_args *ep_args = (struct wifi_enp_args *)prev_data;
struct uci_section *dmmap_section = NULL;
@ -2237,7 +2249,9 @@ static int browseWiFiEndPointProfileInst(struct dmctx *dmctx, DMNODE *parent_nod
if(!s)
dmuci_add_section_bbfdm("dmmap_wireless", "ep_profile", &s, &v);
DMUCI_SET_VALUE_BY_SECTION(bbfdm, s, "ep_key", ep_instance);
handle_update_instance(1, dmctx, &instnbr, update_instance_alias, 3, s, "ep_profile_instance", "ep_profile_alias");
handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
s, "ep_profile_instance", "ep_profile_alias", "dmmap_wireless", "wifi-iface");
DM_LINK_INST_OBJ(dmctx, parent_node, ep_args->wifi_enp_sec, "1");
return 0;
@ -2266,7 +2280,7 @@ int set_neighboring_wifi_diagnostics_diagnostics_state(char *refparam, struct dm
/* *** Device.WiFi. *** */
DMOBJ tWiFiObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"Radio", &DMREAD, NULL, NULL, NULL, browseWifiRadioInst, NULL, NULL, NULL, tWiFiRadioObj, tWiFiRadioParams, get_linker_Wifi_Radio, BBFDM_BOTH},
{"SSID", &DMWRITE, add_wifi_ssid, delete_wifi_ssid, NULL, browseWifiSsidInst, NULL, NULL, NULL, tWiFiSSIDObj, tWiFiSSIDParams, get_linker_Wifi_Ssid, BBFDM_BOTH},
{"AccessPoint", &DMWRITE, add_wifi_accesspoint, delete_wifi_accesspoint, NULL, browseWifiAccessPointInst, NULL, NULL, NULL, tWiFiAccessPointObj, tWiFiAccessPointParams, NULL, BBFDM_BOTH},
@ -2286,7 +2300,7 @@ DMLEAF tWiFiParams[] = {
/* *** Device.WiFi.Radio.{i}. *** */
DMOBJ tWiFiRadioObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"Stats", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tWiFiRadioStatsParams, NULL, BBFDM_BOTH},
{0}
};
@ -2342,7 +2356,7 @@ DMLEAF tWiFiRadioStatsParams[] = {
/* *** Device.WiFi.NeighboringWiFiDiagnostic. *** */
DMOBJ tWiFiNeighboringWiFiDiagnosticObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"Result", &DMREAD, NULL, NULL, NULL, os__browseWifiNeighboringWiFiDiagnosticResultInst, NULL, NULL, NULL, NULL, tWiFiNeighboringWiFiDiagnosticResultParams, NULL, BBFDM_CWMP},
{0}
};
@ -2368,7 +2382,7 @@ DMLEAF tWiFiNeighboringWiFiDiagnosticResultParams[] = {
/* *** Device.WiFi.SSID.{i}. *** */
DMOBJ tWiFiSSIDObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"Stats", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tWiFiSSIDStatsParams, NULL, BBFDM_BOTH},
{0}
};
@ -2415,7 +2429,7 @@ DMLEAF tWiFiSSIDStatsParams[] = {
/* *** Device.WiFi.AccessPoint.{i}. *** */
DMOBJ tWiFiAccessPointObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"Security", &DMWRITE, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tWiFiAccessPointSecurityParams, NULL, BBFDM_BOTH},
{"AssociatedDevice", &DMREAD, NULL, NULL, NULL, os__browse_wifi_associated_device, NULL, NULL, NULL, tWiFiAccessPointAssociatedDeviceObj, tWiFiAccessPointAssociatedDeviceParams, get_linker_associated_device, BBFDM_BOTH},
{"WPS", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tWiFiAccessPointWPSParams, NULL, BBFDM_BOTH},
@ -2473,7 +2487,7 @@ DMLEAF tWiFiAccessPointWPSParams[] = {
/* *** Device.WiFi.AccessPoint.{i}.AssociatedDevice.{i}. *** */
DMOBJ tWiFiAccessPointAssociatedDeviceObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"Stats", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tWiFiAccessPointAssociatedDeviceStatsParams, NULL, BBFDM_BOTH},
{0}
};
@ -2522,7 +2536,7 @@ DMLEAF tWiFiAccessPointAccountingParams[] = {
/* *** Device.WiFi.EndPoint.{i}. *** */
DMOBJ tWiFiEndPointObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"Stats", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tWiFiEndPointStatsParams, NULL, BBFDM_BOTH},
{"Security", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tWiFiEndPointSecurityParams, NULL, BBFDM_BOTH},
{"Profile", &DMREAD, NULL, NULL, NULL, browseWiFiEndPointProfileInst, NULL, NULL, NULL, tWiFiEndPointProfileObj, tWiFiEndPointProfileParams, NULL, BBFDM_BOTH},
@ -2560,7 +2574,7 @@ DMLEAF tWiFiEndPointSecurityParams[] = {
/* *** Device.WiFi.EndPoint.{i}.Profile.{i}. *** */
DMOBJ tWiFiEndPointProfileObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"Security", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tWiFiEndPointProfileSecurityParams, NULL, BBFDM_BOTH},
{0}
};

View file

@ -14,14 +14,17 @@
int browseXIopsysEuButton(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
char *ibutton = NULL, *ibutton_last = NULL;
char *inst = NULL, *max_inst = NULL;
struct dmmap_dup *p;
LIST_HEAD(dup_list);
synchronize_specific_config_sections_with_dmmap("buttons", "button", "dmmap_buttons", &dup_list);
list_for_each_entry(p, &dup_list, list) {
ibutton = handle_update_instance(1, dmctx, &ibutton_last, update_instance_alias, 3, p->dmmap_section, "buttoninstance", "buttonalias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, ibutton) == DM_STOP)
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
p->dmmap_section, "buttoninstance", "buttonalias", "dmmap_buttons", "button");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, inst) == DM_STOP)
break;
}
free_dmmap_config_dup_list(&dup_list);

View file

@ -14,14 +14,17 @@
int browseXIopsysEuDropbear(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
char *idropbear = NULL, *idropbear_last = NULL;
char *inst = NULL, *max_inst = NULL;
struct dmmap_dup *p;
LIST_HEAD(dup_list);
synchronize_specific_config_sections_with_dmmap("dropbear", "dropbear", "dmmap_dropbear", &dup_list);
list_for_each_entry(p, &dup_list, list) {
idropbear = handle_update_instance(1, dmctx, &idropbear_last, update_instance_alias_bbfdm, 3, p->dmmap_section, "dropbearinstance", "dropbearalias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, idropbear) == DM_STOP)
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
p->dmmap_section, "dropbearinstance", "dropbearalias", "dmmap_dropbear", "dropbear");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, inst) == DM_STOP)
break;
}
return 0;
@ -339,7 +342,7 @@ int add_dropbear_instance(char *refparam, struct dmctx *ctx, void *data, char **
dmuci_add_section_bbfdm("dmmap_dropbear", "dropbear", &dmmap_sec, &v);
dmuci_set_value_by_section(dmmap_sec, "section_name", section_name(dropbear_sec));
*instancepara = update_instance_bbfdm(dmmap_sec, instance, "dropbearinstance");
*instancepara = update_instance(dmmap_sec, instance, "dropbearinstance");
return 0;
}

View file

@ -296,7 +296,7 @@ static int add_igmp_proxy_obj(char *refparam, struct dmctx *ctx, void *data, cha
dmuci_add_section_bbfdm("dmmap_mcast", "proxy", &dmmap, &v);
dmuci_set_value_by_section(dmmap, "section_name", section_name(s));
dmuci_set_value_by_section(dmmap, "proto", "igmp");
*instance = update_instance_bbfdm(dmmap, inst, "proxy_instance");
*instance = update_instance(dmmap, inst, "proxy_instance");
return 0;
}
@ -348,13 +348,16 @@ static int del_igmp_proxy_obj(char *refparam, struct dmctx *ctx, void *data, cha
static int browse_igmp_proxy_inst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
char *inst = NULL, *inst_last = NULL;
char *inst = NULL, *max_inst = NULL;
struct dmmap_dup *p;
LIST_HEAD(dup_list);
synchronize_specific_config_sections_with_dmmap_cont("mcast", "proxy", "dmmap_mcast", "proto", "igmp", &dup_list);
list_for_each_entry(p, &dup_list, list) {
inst = handle_update_instance(1, dmctx, &inst_last, update_instance_alias, 3, p->dmmap_section, "proxy_instance", "proxy_alias");
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
p->dmmap_section, "proxy_instance", "proxy_alias", "dmmap_mcast", "proxy");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, inst) == DM_STOP)
break;
}
@ -387,7 +390,7 @@ static int add_igmp_snooping_obj(char *refparam, struct dmctx *ctx, void *data,
dmuci_add_section_bbfdm("dmmap_mcast", "snooping", &dmmap, &v);
dmuci_set_value_by_section(dmmap, "section_name", section_name(s));
dmuci_set_value_by_section(dmmap, "proto", "igmp");
*instance = update_instance_bbfdm(dmmap, inst, "snooping_instance");
*instance = update_instance(dmmap, inst, "snooping_instance");
return 0;
}
@ -437,13 +440,16 @@ static int del_igmp_snooping_obj(char *refparam, struct dmctx *ctx, void *data,
static int browse_igmp_snooping_inst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
char *inst = NULL, *inst_last = NULL;
char *inst = NULL, *max_inst = NULL;
struct dmmap_dup *p;
LIST_HEAD(dup_list);
synchronize_specific_config_sections_with_dmmap_cont("mcast", "snooping", "dmmap_mcast", "proto", "igmp", &dup_list);
list_for_each_entry(p, &dup_list, list) {
inst = handle_update_instance(1, dmctx, &inst_last, update_instance_alias, 3, p->dmmap_section, "snooping_instance", "snooping_alias");
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
p->dmmap_section, "snooping_instance", "snooping_alias", "dmmap_mcast", "snooping");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, inst) == DM_STOP)
break;
}
@ -482,14 +488,14 @@ static int browse_igmp_cgrp_inst(struct dmctx *dmctx, DMNODE *parent_node, void
//perform ubus call to mcast stats and browse through each igmp group json object
int i = 0, id = 0;
json_object *res = NULL, *jobj = NULL, *arrobj = NULL, *group_obj = NULL;
char *idx, *idx_last = NULL;
char *inst, *max_inst = NULL;
dmubus_call("mcast", "stats", UBUS_ARGS{}, 0, &res);
if (res) {
jobj = dmjson_select_obj_in_array_idx(res, 0, 1, "snooping");
dmjson_foreach_obj_in_array(jobj, arrobj, group_obj, i, 1, "groups") {
idx = handle_update_instance(1, dmctx, &idx_last, update_instance_without_section, 1, ++id);
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)group_obj, idx) == DM_STOP)
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_without_section, 1, ++id);
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)group_obj, inst) == DM_STOP)
break;
}
}
@ -507,7 +513,7 @@ static int add_igmps_filter_obj(char *refparam, struct dmctx *ctx, void *data, c
dmuci_add_section_bbfdm("dmmap_mcast", "snooping_filter", &dmmap_igmps_filter, &v);
dmuci_set_value_by_section(dmmap_igmps_filter, "section_name", section_name((struct uci_section *)data));
dmuci_set_value_by_section(dmmap_igmps_filter, "enable", "0");
*instance = update_instance_bbfdm(dmmap_igmps_filter, last_inst, "filter_instance");
*instance = update_instance(dmmap_igmps_filter, last_inst, "filter_instance");
return 0;
}
@ -558,17 +564,23 @@ int del_mcasts_filter_obj(char *refparam, struct dmctx *ctx, void *data, char *i
static int browse_igmps_filter_inst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
struct dmmap_dup *p = NULL;
char *inst = NULL, *inst_last = NULL;
struct browse_args browse_args = {0};
char *inst = NULL, *max_inst = NULL;
LIST_HEAD(dup_list);
synchronize_specific_config_sections_with_dmmap_mcast_filter("mcast", "snooping", prev_data, "dmmap_mcast",
"snooping_filter", "igmp", &dup_list);
synchronize_specific_config_sections_with_dmmap_mcast_filter("mcast", "snooping", prev_data,
"dmmap_mcast", "snooping_filter", "igmp", &dup_list);
list_for_each_entry(p, &dup_list, list) {
if (!p->config_section)
break;
inst = handle_update_instance(1, dmctx, &inst_last, update_instance_alias, 3,
p->dmmap_section, "filter_instance", "filter_alias");
browse_args.option = "section_name";
browse_args.value = section_name((struct uci_section *)prev_data);
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 7,
p->dmmap_section, "filter_instance", "filter_alias", "dmmap_mcast", "snooping_filter",
check_browse_section, (void *)&browse_args);
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, inst) == DM_STOP)
break;
}
@ -943,7 +955,7 @@ static int add_igmpp_interface_obj(char *refparam, struct dmctx *ctx, void *data
dmuci_set_value_by_section(dmmap_igmpp_interface, "upstream", "0");
dmuci_set_value_by_section(dmmap_igmpp_interface, "snooping_mode", "0");
*instance = update_instance_bbfdm(dmmap_igmpp_interface, last_inst, "iface_instance");
*instance = update_instance(dmmap_igmpp_interface, last_inst, "iface_instance");
return 0;
}
@ -1040,7 +1052,8 @@ static int del_igmpp_interface_obj(char *refparam, struct dmctx *ctx, void *data
static int browse_igmpp_interface_inst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
struct dmmap_dup *p = NULL;
char *inst = NULL, *inst_last = NULL;
struct browse_args browse_args = {0};
char *inst = NULL, *max_inst = NULL;
LIST_HEAD(dup_list);
synchronize_specific_config_sections_with_dmmap_mcast_iface("mcast", "proxy", prev_data,
@ -1049,8 +1062,13 @@ static int browse_igmpp_interface_inst(struct dmctx *dmctx, DMNODE *parent_node,
if (!p->config_section)
break;
inst = handle_update_instance(1, dmctx, &inst_last, update_instance_alias, 3,
p->dmmap_section, "iface_instance", "iface_alias");
browse_args.option = "section_name";
browse_args.value = section_name((struct uci_section *)prev_data);
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 7,
p->dmmap_section, "iface_instance", "iface_alias", "dmmap_mcast", "proxy_interface",
check_browse_section, (void *)&browse_args);
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, inst) == DM_STOP)
break;
@ -1073,7 +1091,7 @@ static int add_igmpp_filter_obj(char *refparam, struct dmctx *ctx, void *data, c
section_name((struct uci_section *)data));
dmuci_set_value_by_section(dmmap_igmpp_filter, "enable", "0");
*instance = update_instance_bbfdm(dmmap_igmpp_filter, last_inst, "filter_instance");
*instance = update_instance(dmmap_igmpp_filter, last_inst, "filter_instance");
return 0;
}
@ -1125,20 +1143,25 @@ int del_mcastp_filter_obj(char *refparam, struct dmctx *ctx, void *data, char *i
static int browse_igmpp_filter_inst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
struct dmmap_dup *p = NULL;
char *inst = NULL, *inst_last = NULL;
struct browse_args browse_args = {0};
char *inst = NULL, *max_inst = NULL;
LIST_HEAD(dup_list);
synchronize_specific_config_sections_with_dmmap_mcast_filter("mcast", "proxy", prev_data, "dmmap_mcast",
"proxy_filter", "igmp", &dup_list);
synchronize_specific_config_sections_with_dmmap_mcast_filter("mcast", "proxy", prev_data,
"dmmap_mcast", "proxy_filter", "igmp", &dup_list);
list_for_each_entry(p, &dup_list, list) {
if (!p->config_section)
break;
inst = handle_update_instance(1, dmctx, &inst_last, update_instance_alias, 3,
p->dmmap_section, "filter_instance", "filter_alias");
browse_args.option = "section_name";
browse_args.value = section_name((struct uci_section *)prev_data);
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 7,
p->dmmap_section, "filter_instance", "filter_alias", "dmmap_mcast", "proxy_filter",
check_browse_section, (void *)&browse_args);
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, inst) == DM_STOP)
break;
}
free_dmmap_config_dup_list(&dup_list);
@ -1270,12 +1293,12 @@ static int browse_igmp_cgrp_assoc_dev_inst(struct dmctx *dmctx, DMNODE *parent_n
int i = 0, id = 0;
json_object *arrobj = NULL, *client_jobj = NULL;
char *idx, *idx_last = NULL;
char *inst, *max_inst = NULL;
dmjson_foreach_obj_in_array((struct json_object *)prev_data, arrobj, client_jobj, i, 1, "clients") {
idx = handle_update_instance(1, dmctx, &idx_last, update_instance_without_section, 1, ++id);
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)client_jobj, idx) == DM_STOP)
break;
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_without_section, 1, ++id);
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)client_jobj, inst) == DM_STOP)
break;
}
return 0;
}
@ -2008,7 +2031,7 @@ int set_mcastp_iface_snoop_mode(char *refparam, struct dmctx *ctx, void *data, c
/* ***Device.X_IOPSYS_EU_IGMP. *** */
DMOBJ X_IOPSYS_EU_IGMPObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"Snooping", &DMWRITE, add_igmp_snooping_obj, del_igmp_snooping_obj, NULL, browse_igmp_snooping_inst, NULL, NULL, NULL, X_IOPSYS_EU_IGMPSnoopingObj, X_IOPSYS_EU_IGMPSnoopingParams, NULL, BBFDM_BOTH},
{"Proxy", &DMWRITE, add_igmp_proxy_obj, del_igmp_proxy_obj, NULL, browse_igmp_proxy_inst, NULL, NULL, NULL, X_IOPSYS_EU_IGMPProxyObj, X_IOPSYS_EU_IGMPProxyParams, NULL, BBFDM_BOTH},
{0}

View file

@ -37,7 +37,7 @@ static int add_mld_proxy_obj(char *refparam, struct dmctx *ctx, void *data, char
dmuci_add_section_bbfdm("dmmap_mcast", "proxy", &dmmap, &v);
dmuci_set_value_by_section(dmmap, "section_name", section_name(s));
dmuci_set_value_by_section(dmmap, "proto", "mld");
*instance = update_instance_bbfdm(dmmap, inst, "proxy_instance");
*instance = update_instance(dmmap, inst, "proxy_instance");
return 0;
}
@ -89,13 +89,16 @@ static int del_mld_proxy_obj(char *refparam, struct dmctx *ctx, void *data, char
static int browse_mld_proxy_inst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
char *inst = NULL, *inst_last = NULL;
char *inst = NULL, *max_inst = NULL;
struct dmmap_dup *p;
LIST_HEAD(dup_list);
synchronize_specific_config_sections_with_dmmap_cont("mcast", "proxy", "dmmap_mcast", "proto", "mld", &dup_list);
list_for_each_entry(p, &dup_list, list) {
inst = handle_update_instance(1, dmctx, &inst_last, update_instance_alias, 3, p->dmmap_section, "proxy_instance", "proxy_alias");
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
p->dmmap_section, "proxy_instance", "proxy_alias", "dmmap_mcast", "proxy");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, inst) == DM_STOP)
break;
}
@ -128,7 +131,7 @@ static int add_mld_snooping_obj(char *refparam, struct dmctx *ctx, void *data, c
dmuci_add_section_bbfdm("dmmap_mcast", "snooping", &dmmap, &v);
dmuci_set_value_by_section(dmmap, "section_name", section_name(s));
dmuci_set_value_by_section(dmmap, "proto", "mld");
*instance = update_instance_bbfdm(dmmap, inst, "snooping_instance");
*instance = update_instance(dmmap, inst, "snooping_instance");
return 0;
}
@ -178,13 +181,16 @@ static int del_mld_snooping_obj(char *refparam, struct dmctx *ctx, void *data, c
static int browse_mld_snooping_inst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
char *inst = NULL, *inst_last = NULL;
char *inst = NULL, *max_inst = NULL;
struct dmmap_dup *p;
LIST_HEAD(dup_list);
synchronize_specific_config_sections_with_dmmap_cont("mcast", "snooping", "dmmap_mcast", "proto", "mld", &dup_list);
list_for_each_entry(p, &dup_list, list) {
inst = handle_update_instance(1, dmctx, &inst_last, update_instance_alias, 3, p->dmmap_section, "snooping_instance", "snooping_alias");
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
p->dmmap_section, "snooping_instance", "snooping_alias", "dmmap_mcast", "snooping");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, inst) == DM_STOP)
break;
}
@ -243,7 +249,7 @@ static int add_mlds_filter_obj(char *refparam, struct dmctx *ctx, void *data, ch
dmuci_add_section_bbfdm("dmmap_mcast", "snooping_filter", &dmmap_mlds_filter, &v);
dmuci_set_value_by_section(dmmap_mlds_filter, "section_name", section_name((struct uci_section *)data));
dmuci_set_value_by_section(dmmap_mlds_filter, "enable", "0");
*instance = update_instance_bbfdm(dmmap_mlds_filter, last_inst, "filter_instance");
*instance = update_instance(dmmap_mlds_filter, last_inst, "filter_instance");
return 0;
}
@ -251,17 +257,23 @@ static int add_mlds_filter_obj(char *refparam, struct dmctx *ctx, void *data, ch
static int browse_mlds_filter_inst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
struct dmmap_dup *p = NULL;
char *inst = NULL, *inst_last = NULL;
struct browse_args browse_args = {0};
char *inst = NULL, *max_inst = NULL;
LIST_HEAD(dup_list);
synchronize_specific_config_sections_with_dmmap_mcast_filter("mcast", "snooping", prev_data, "dmmap_mcast",
"snooping_filter", "mld", &dup_list);
synchronize_specific_config_sections_with_dmmap_mcast_filter("mcast", "snooping", prev_data,
"dmmap_mcast", "snooping_filter", "mld", &dup_list);
list_for_each_entry(p, &dup_list, list) {
if (!p->config_section)
break;
inst = handle_update_instance(1, dmctx, &inst_last, update_instance_alias, 3,
p->dmmap_section, "filter_instance", "filter_alias");
browse_args.option = "section_name";
browse_args.value = section_name((struct uci_section *)prev_data);
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 7,
p->dmmap_section, "filter_instance", "filter_alias", "dmmap_mcast", "snooping_filter",
check_browse_section, (void *)&browse_args);
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, inst) == DM_STOP)
break;
}
@ -307,7 +319,7 @@ static int add_mldp_interface_obj(char *refparam, struct dmctx *ctx, void *data,
dmuci_set_value_by_section(dmmap_mldp_interface, "upstream", "0");
dmuci_set_value_by_section(dmmap_mldp_interface, "snooping_mode", "0");
*instance = update_instance_bbfdm(dmmap_mldp_interface, last_inst, "iface_instance");
*instance = update_instance(dmmap_mldp_interface, last_inst, "iface_instance");
return 0;
}
@ -366,7 +378,8 @@ static int del_mldp_interface_obj(char *refparam, struct dmctx *ctx, void *data,
static int browse_mldp_interface_inst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
struct dmmap_dup *p = NULL;
char *inst = NULL, *inst_last = NULL;
struct browse_args browse_args = {0};
char *inst = NULL, *max_inst = NULL;
LIST_HEAD(dup_list);
synchronize_specific_config_sections_with_dmmap_mcast_iface("mcast", "proxy", prev_data,
@ -375,8 +388,13 @@ static int browse_mldp_interface_inst(struct dmctx *dmctx, DMNODE *parent_node,
if (!p->config_section)
break;
inst = handle_update_instance(1, dmctx, &inst_last, update_instance_alias, 3,
p->dmmap_section, "iface_instance", "iface_alias");
browse_args.option = "section_name";
browse_args.value = section_name((struct uci_section *)prev_data);
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 7,
p->dmmap_section, "iface_instance", "iface_alias", "dmmap_mcast", "proxy_interface",
check_browse_section, (void *)&browse_args);
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, inst) == DM_STOP)
break;
}
@ -397,7 +415,7 @@ static int add_mldp_filter_obj(char *refparam, struct dmctx *ctx, void *data, ch
dmuci_set_value_by_section(dmmap_mldp_filter, "section_name", section_name((struct uci_section *)data));
dmuci_set_value_by_section(dmmap_mldp_filter, "enable", "0");
*instance = update_instance_bbfdm(dmmap_mldp_filter, last_inst, "filter_instance");
*instance = update_instance(dmmap_mldp_filter, last_inst, "filter_instance");
return 0;
}
@ -405,17 +423,23 @@ static int add_mldp_filter_obj(char *refparam, struct dmctx *ctx, void *data, ch
static int browse_mldp_filter_inst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
struct dmmap_dup *p = NULL;
char *inst = NULL, *inst_last = NULL;
struct browse_args browse_args = {0};
char *inst = NULL, *max_inst = NULL;
LIST_HEAD(dup_list);
synchronize_specific_config_sections_with_dmmap_mcast_filter("mcast", "proxy", prev_data, "dmmap_mcast",
"proxy_filter", "mld", &dup_list);
synchronize_specific_config_sections_with_dmmap_mcast_filter("mcast", "proxy", prev_data,
"dmmap_mcast", "proxy_filter", "mld", &dup_list);
list_for_each_entry(p, &dup_list, list) {
if (!p->config_section)
break;
inst = handle_update_instance(1, dmctx, &inst_last, update_instance_alias, 3,
p->dmmap_section, "filter_instance", "filter_alias");
browse_args.option = "section_name";
browse_args.value = section_name((struct uci_section *)prev_data);
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 7,
p->dmmap_section, "filter_instance", "filter_alias", "dmmap_mcast", "proxy_filter",
check_browse_section, (void *)&browse_args);
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, inst) == DM_STOP)
break;
}
@ -792,7 +816,7 @@ static int set_mldp_interface_upstream(char *refparam, struct dmctx *ctx, void *
/* ***Device.X_IOPSYS_EU_MLD. *** */
DMOBJ X_IOPSYS_EU_MLDObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"Snooping", &DMWRITE, add_mld_snooping_obj, del_mld_snooping_obj, NULL, browse_mld_snooping_inst, NULL, NULL, NULL, X_IOPSYS_EU_MLDSnoopingObj, X_IOPSYS_EU_MLDSnoopingParams, NULL, BBFDM_BOTH},
{"Proxy", &DMWRITE, add_mld_proxy_obj, del_mld_proxy_obj, NULL, browse_mld_proxy_inst, NULL, NULL, NULL, X_IOPSYS_EU_MLDProxyObj, X_IOPSYS_EU_MLDProxyParams, NULL, BBFDM_BOTH},
{0}

View file

@ -15,14 +15,17 @@
static int browseXIopsysEuOWSDVirtualHost(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
char *iowsd_listen = NULL, *iowsd_listen_last = NULL;
char *inst = NULL, *max_inst = NULL;
struct dmmap_dup *p;
LIST_HEAD(dup_list);
synchronize_specific_config_sections_with_dmmap("owsd", "owsd-listen", "dmmap_owsd", &dup_list);
list_for_each_entry(p, &dup_list, list) {
iowsd_listen = handle_update_instance(1, dmctx, &iowsd_listen_last, update_instance_alias_bbfdm, 3, p->dmmap_section, "olisteninstance", "olistenalias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, iowsd_listen) == DM_STOP)
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
p->dmmap_section, "olisteninstance", "olistenalias", "dmmap_owsd", "owsd-listen");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, inst) == DM_STOP)
break;
}
free_dmmap_config_dup_list(&dup_list);
@ -397,7 +400,7 @@ static int add_owsd_listen(char *refparam, struct dmctx *ctx, void *data, char *
dmuci_add_section_bbfdm("dmmap_owsd", "owsd-listen", &dmmap_sec, &v);
dmuci_set_value_by_section(dmmap_sec, "section_name", section_name(listen_sec));
*instancepara = update_instance_bbfdm(dmmap_sec, instance, "olisteninstance");
*instancepara = update_instance(dmmap_sec, instance, "olisteninstance");
return 0;
}
@ -452,7 +455,7 @@ DMLEAF X_IOPSYS_EU_OWSDParams[] = {
};
DMOBJ X_IOPSYS_EU_OWSDObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"UbusProxy", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, UbusProxyParams, NULL, BBFDM_BOTH},
{"VirtualHost", &DMWRITE, add_owsd_listen, delete_owsd_listen_instance, NULL, browseXIopsysEuOWSDVirtualHost, NULL, NULL, NULL, NULL, VirtualHostParams, NULL, BBFDM_BOTH},
{0}

View file

@ -517,12 +517,15 @@ static int get_xmpp_connection_linker(char *refparam, struct dmctx *dmctx, void
/*#Device.XMPP.Connection.{i}.!UCI:cwmp_xmpp/xmpp_connection/dmmap_cwmp_xmpp*/
static int browsexmpp_connectionInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
char *iconnection = NULL, *iconnection_last = NULL;
char *inst = NULL, *max_inst = NULL;
struct uci_section *s = NULL;
uci_foreach_sections("cwmp_xmpp", "xmpp_connection", s) {
iconnection = handle_update_instance(1, dmctx, &iconnection_last, update_instance_alias, 3, s, "connection_instance", "connection_instance_alias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)s, iconnection) == DM_STOP)
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
s, "connection_instance", "connection_instance_alias""cwmp_xmpp", "xmpp_connection");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)s, inst) == DM_STOP)
break;
}
return 0;
@ -531,13 +534,21 @@ static int browsexmpp_connectionInst(struct dmctx *dmctx, DMNODE *parent_node, v
/*#Device.XMPP.Connection.{i}.!UCI:cwmp_xmpp/xmpp_connection_server/dmmap_cwmp_xmpp*/
static int browsexmpp_connection_serverInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
char *iconnectionserver = NULL, *iconnectionserver_last = NULL, *prev_connection_instance;
char *inst = NULL, *max_inst = NULL, *prev_connection_instance;
struct uci_section *s = NULL, *connsection = (struct uci_section *)prev_data;
struct browse_args browse_args = {0};
dmuci_get_value_by_section_string(connsection, "connection_instance", &prev_connection_instance);
uci_foreach_option_eq("cwmp_xmpp", "xmpp_connection_server", "id_connection", prev_connection_instance, s) {
iconnectionserver = handle_update_instance(1, dmctx, &iconnectionserver_last, update_instance_alias, 3, s, "connection_server_instance", "connection_server_instance_alias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)s, iconnectionserver) == DM_STOP)
browse_args.option = "id_connection";
browse_args.value = prev_connection_instance;
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
s, "connection_server_instance", "connection_server_instance_alias", "cwmp_xmpp", "xmpp_connection_server",
check_browse_section, (void *)&browse_args);
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)s, inst) == DM_STOP)
break;
}
return 0;
@ -545,7 +556,7 @@ static int browsexmpp_connection_serverInst(struct dmctx *dmctx, DMNODE *parent_
/* *** Device.XMPP. *** */
DMOBJ tXMPPObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"Connection", &DMWRITE, add_xmpp_connection, delete_xmpp_connection, NULL, browsexmpp_connectionInst, NULL, NULL, NULL, tXMPPConnectionObj, tXMPPConnectionParams, get_xmpp_connection_linker, BBFDM_BOTH},
{0}
};
@ -559,7 +570,7 @@ DMLEAF tXMPPParams[] = {
/* *** Device.XMPP.Connection.{i}. *** */
DMOBJ tXMPPConnectionObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"Server", &DMREAD, NULL, NULL, NULL, browsexmpp_connection_serverInst, NULL, NULL, NULL, NULL, tXMPPConnectionServerParams, NULL, BBFDM_BOTH},
{0}
};

View file

@ -33,7 +33,7 @@ LIB_MAP_OPERATE tRootDynamicOperate[] = {
/* *** Device.IP.Diagnostics. *** */
DMOBJ tdynamicIPDiagnosticsObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
{"X_IOPSYS_EU_BBKSpeedTest", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tdynamicIPDiagnosticsX_IOPSYS_EU_BBKSpeedTestParams, NULL, BBFDM_BOTH},
{0}
};

View file

@ -107,7 +107,7 @@ def printheaderObjCommon( objname ):
def cprintheaderOBJS( objname ):
fp = open('./.objparamarray.c', 'a')
print >> fp, "DMOBJ %s[] = {" % ("tdynamic" + getname(objname) + "Obj")
print >> fp, "/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/"
print >> fp, "/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/"
fp.close()
def cprintheaderRootDynamicObj( ):

View file

@ -349,7 +349,7 @@ def printheaderObjCommon( objname ):
def cprintheaderOBJS( objname ):
fp = open('./.objparamarray.c', 'a')
print >> fp, "DMOBJ %s[] = {" % ("t" + getname(objname) + "Obj")
print >> fp, "/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/"
print >> fp, "/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/"
fp.close()
def hprintheaderOBJS( objname ):
@ -410,7 +410,7 @@ def cprintAddDelObj( faddobj, fdelobj, name, mappingobj, dmobject ):
print >> fp, ""
print >> fp, " dmuci_add_section_bbfdm(\"%s\", \"%s\", &dmmap, &v);" % (dmmapfile, sectiontype)
print >> fp, " dmuci_set_value_by_section(dmmap, \"section_name\", section_name(s));"
print >> fp, " *instance = update_instance_bbfdm(dmmap, inst, \"%s\");" % (name+"instance")
print >> fp, " *instance = update_instance(dmmap, inst, \"%s\");" % (name+"instance")
else:
print >> fp, " //TODO"
print >> fp, " return 0;"
@ -483,13 +483,16 @@ def cprintBrowseObj( fbrowse, name, mappingobj, dmobject ):
############################## UCI ########################################
if type == "uci" :
print >> fp, " char *inst = NULL, *inst_last = NULL;"
print >> fp, " char *inst = NULL, *max_inst = NULL;"
print >> fp, " struct dmmap_dup *p;"
print >> fp, " LIST_HEAD(dup_list);"
print >> fp, ""
print >> fp, " synchronize_specific_config_sections_with_dmmap(\"%s\", \"%s\", \"%s\", &dup_list);" % (res1, res2, res3)
print >> fp, " list_for_each_entry(p, &dup_list, list) {"
print >> fp, " inst = handle_update_instance(1, dmctx, &inst_last, update_instance_alias, 3, p->dmmap_section, \"%s\", \"%s\");" % (name+"instance", name+"alias")
print >> fp, ""
print >> fp, " inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,"
print >> fp, " p->dmmap_section, \"%s\", \"%s\", \"%s\", \"%s\");" % (name+"instance", name+"alias", res3, res2)
print >> fp, ""
print >> fp, " if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, inst) == DM_STOP)"
print >> fp, " break;"
print >> fp, " }"
@ -499,7 +502,7 @@ def cprintBrowseObj( fbrowse, name, mappingobj, dmobject ):
############################## UBUS ########################################
elif type == "ubus" :
print >> fp, " json_object *res = NULL, *obj = NULL, *arrobj = NULL;"
print >> fp, " char *idx = NULL, *idx_last = NULL;"
print >> fp, " char *inst = NULL, *max_inst = NULL;"
print >> fp, " int id = 0, i = 0;"
print >> fp, ""
if res3 == None and res4 == None:
@ -508,8 +511,10 @@ def cprintBrowseObj( fbrowse, name, mappingobj, dmobject ):
print >> fp, " dmubus_call(\"%s\", \"%s\", UBUS_ARGS{{\"%s\", \"%s\", String}}, 1, &res);" % (res1, res2, res3, res4)
print >> fp, " if (res) {"
print >> fp, " dmjson_foreach_obj_in_array(res, arrobj, obj, i, 1, \"%s\") {" % res5
print >> fp, " idx = handle_update_instance(1, dmctx, &idx_last, update_instance_without_section, 1, ++id);"
print >> fp, " if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)obj, idx) == DM_STOP)"
print >> fp, ""
print >> fp, " inst = handle_update_instance(1, dmctx, &max_inst, update_instance_without_section, 1, ++id);"
print >> fp, ""
print >> fp, " if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)obj, inst) == DM_STOP)"
print >> fp, " break;"
print >> fp, " }"
print >> fp, " }"

View file

@ -33,6 +33,8 @@ static int mparam_get_name_in_obj(DMPARAM_ARGS);
static int mobj_get_name_in_obj(DMOBJECT_ARGS);
static int mobj_get_schema_name(DMOBJECT_ARGS);
static int mparam_get_schema_name(DMPARAM_ARGS);
static int mobj_get_instances_in_obj(DMOBJECT_ARGS);
static int mparam_get_instances_in_obj(DMPARAM_ARGS);
static int inform_check_obj(DMOBJECT_ARGS);
static int inform_check_param(DMPARAM_ARGS);
static int mparam_add_object(DMPARAM_ARGS);
@ -593,12 +595,13 @@ char *handle_update_instance(int instance_ranck, struct dmctx *ctx, char **last_
char *instance;
int i = 0;
unsigned int action, pos = instance_ranck - 1;
void *argv[argc];
void *argv[argc+1];
va_start(arg, argc);
for (i = 0; i < argc; i++) {
argv[i] = va_arg(arg, void*);
}
argv[argc] = NULL;
va_end(arg);
if (ctx->amd_version >= AMD_4) {
if(pos < ctx->nbrof_instance) {
@ -611,11 +614,12 @@ char *handle_update_instance(int instance_ranck, struct dmctx *ctx, char **last_
}
instance = up_instance(action, last_inst, argv);
if(*last_inst)
if (*last_inst)
ctx->inst_buf[pos] = dmstrdup(*last_inst);
return instance;
}
char *update_instance(struct uci_section *s, char *last_inst, char *inst_opt)
{
char *instance;
@ -625,69 +629,58 @@ char *update_instance(struct uci_section *s, char *last_inst, char *inst_opt)
argv[1] = inst_opt;
argv[2] = "";
instance = update_instance_alias_bbfdm(0, &last_inst, argv);
instance = update_instance_alias(0, &last_inst, argv);
return instance;
}
char *update_instance_bbfdm(struct uci_section *s, char *last_inst, char *inst_opt)
static int get_max_instance(char *dmmap_package, char *section_type, char *inst_opt, int (*check_browse)(struct uci_section *section, void *data), void *data)
{
char *instance;
void *argv[3];
struct uci_section *s;
char *inst;
int max = 0;
argv[0]= s;
argv[1]= inst_opt;
argv[2]= "";
instance = update_instance_alias_bbfdm(0, &last_inst, argv);
return instance;
uci_path_foreach_sections(bbfdm, dmmap_package, section_type, s) {
if (check_browse && check_browse(s, data) != 0)
continue;
dmuci_get_value_by_section_string(s, inst_opt, &inst);
if (inst[0] == '\0')
continue;
max = max > atoi(inst) ? max : atoi(inst);
}
return max;
}
char *update_instance_alias_bbfdm(int action, char **last_inst , void *argv[])
{
char *instance, *alias;
char buf[64] = {0};
struct uci_section *s = (struct uci_section *) argv[0];
char *inst_opt = (char *) argv[1];
char *alias_opt = (char *) argv[2];
dmuci_get_value_by_section_string(s, inst_opt, &instance);
if (instance[0] == '\0') {
if (*last_inst == NULL)
snprintf(buf, sizeof(buf), "%d", 1);
else
snprintf(buf, sizeof(buf), "%d", atoi(*last_inst)+1);
instance = dmuci_set_value_by_section_bbfdm(s, inst_opt, buf);
}
*last_inst = instance;
if (action == INSTANCE_MODE_ALIAS) {
dmuci_get_value_by_section_string(s, alias_opt, &alias);
if (alias[0] == '\0') {
snprintf(buf, sizeof(buf), "cpe-%s", instance);
alias = dmuci_set_value_by_section_bbfdm(s, alias_opt, buf);
}
snprintf(buf, sizeof(buf), "[%s]", alias);
instance = dmstrdup(buf);
}
return instance;
}
char *update_instance_alias(int action, char **last_inst, void *argv[])
char *update_instance_alias(int action, char **max_inst, void *argv[])
{
char *instance, *alias;
char buf[64] = {0};
int max_instance = 0;
struct uci_section *s = (struct uci_section *) argv[0];
char *inst_opt = (char *) argv[1];
char *alias_opt = (char *) argv[2];
char *dmmap_package = (char *) argv[3];
char *section_type = (char *) argv[4];
int (*check_browse)(struct uci_section *section, void *data) = argv[5];
void *data = (void *) argv[6];
if (*max_inst == NULL)
max_instance = get_max_instance(dmmap_package, section_type, inst_opt, check_browse, data);
else
max_instance = atoi(*max_inst);
dmuci_get_value_by_section_string(s, inst_opt, &instance);
if (instance[0] == '\0') {
if (*last_inst == NULL)
snprintf(buf, sizeof(buf), "%d", 1);
else
snprintf(buf, sizeof(buf), "%d", atoi(*last_inst) + 1);
snprintf(buf, sizeof(buf), "%d", max_instance + 1);
instance = dmuci_set_value_by_section(s, inst_opt, buf);
*max_inst = instance;
} else {
dmasprintf(max_inst, "%d", max_instance);
}
*last_inst = instance;
if (action == INSTANCE_MODE_ALIAS) {
dmuci_get_value_by_section_string(s, alias_opt, &alias);
if (alias[0] == '\0') {
@ -721,7 +714,7 @@ char *get_last_instance_bbfdm(char *package, char *section, char *opt_inst)
char *inst = NULL, *last_inst = NULL;
uci_path_foreach_sections(bbfdm, package, section, s) {
inst = update_instance_bbfdm(s, last_inst, opt_inst);
inst = update_instance(s, last_inst, opt_inst);
if(last_inst)
dmfree(last_inst);
last_inst = dmstrdup(inst);
@ -750,7 +743,7 @@ char *get_last_instance(char *package, char *section, char *opt_inst)
if (strcmp(package, DMMAP) == 0) {
uci_path_foreach_sections(bbfdm, "dmmap", section, s) {
inst = update_instance_bbfdm(s, last_inst, opt_inst);
inst = update_instance(s, last_inst, opt_inst);
if(last_inst)
dmfree(last_inst);
last_inst = dmstrdup(inst);
@ -770,7 +763,7 @@ char *get_last_instance_lev2_bbfdm_dmmap_opt(char* dmmap_package, char *section,
uci_path_foreach_option_eq(bbfdm, dmmap_package, section, opt_check, value_check, s) {
dmuci_get_value_by_section_string(s, "section_name", &section_name);
instance = update_instance_bbfdm(s, last_inst, opt_inst);
instance = update_instance(s, last_inst, opt_inst);
if(last_inst)
dmfree(last_inst);
last_inst = dmstrdup(instance);
@ -789,7 +782,7 @@ char *get_last_instance_lev2_bbfdm(char *package, char *section, char* dmmap_pac
dmuci_add_section_bbfdm(dmmap_package, section, &dmmap_section, &v);
dmuci_set_value_by_section(dmmap_section, "section_name", section_name(s));
}
instance = update_instance_bbfdm(dmmap_section, last_inst, opt_inst);
instance = update_instance(dmmap_section, last_inst, opt_inst);
if(last_inst)
dmfree(last_inst);
last_inst = dmstrdup(instance);
@ -804,7 +797,7 @@ char *get_last_instance_lev2(char *package, char *section, char *opt_inst, char
if (strcmp(package, DMMAP) == 0) {
uci_path_foreach_option_cont(bbfdm, package, section, opt_check, value_check, s) {
instance = update_instance_bbfdm(s, last_inst, opt_inst);
instance = update_instance(s, last_inst, opt_inst);
if(last_inst)
dmfree(last_inst);
last_inst = dmstrdup(instance);
@ -1426,25 +1419,6 @@ static int mparam_get_schema_name(DMPARAM_ARGS)
/* **************
* get_instances
* **************/
static int mobj_get_instances_in_obj(DMOBJECT_ARGS)
{
if (node->matched && node->is_instanceobj) {
char *name = dmstrdup(node->current_object);
if (name) {
name[strlen(name) - 1] = 0;
add_list_paramameter(dmctx, name, NULL, "xsd:object", NULL, 0);
}
}
return 0;
}
static int mparam_get_instances_in_obj(DMPARAM_ARGS)
{
return 0;
}
int dm_entry_get_instances(struct dmctx *dmctx)
{
DMOBJ *root = dmctx->dm_entryobj;
@ -1469,12 +1443,27 @@ int dm_entry_get_instances(struct dmctx *dmctx)
dmctx->method_param = mparam_get_instances_in_obj;
err = dm_browse(dmctx, &node, root, NULL, NULL);
if (dmctx->findparam == 0)
return err;
return err;
}
static int mobj_get_instances_in_obj(DMOBJECT_ARGS)
{
if (node->matched && node->is_instanceobj) {
char *name = dmstrdup(node->current_object);
if (name) {
name[strlen(name) - 1] = 0;
add_list_paramameter(dmctx, name, NULL, "xsd:object", NULL, 0);
}
}
return 0;
}
static int mparam_get_instances_in_obj(DMPARAM_ARGS)
{
return 0;
}
/* ********************
* get notification

View file

@ -539,8 +539,6 @@ extern int bbfdatamodel_type;
char *update_instance(struct uci_section *s, char *last_inst, char *inst_opt);
char *update_instance_bbfdm(struct uci_section *s, char *last_inst, char *inst_opt);
char *update_instance_alias_bbfdm(int action, char **last_inst , void *argv[]);
char *update_instance_alias(int action, char **last_inst , void *argv[]);
char *update_instance_without_section(int action, char **last_inst, void *argv[]);
int get_empty(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);

View file

@ -1757,3 +1757,14 @@ void sync_dmmap_bool_to_uci_list(struct uci_section *s, char *section, char *val
dmuci_add_list_value_by_section(s, section, value);
}
}
int check_browse_section(struct uci_section *s, void *data)
{
struct browse_args *browse_args = (struct browse_args *)data;
char *opt_val;
dmuci_get_value_by_section_string(s, browse_args->option, &opt_val);
if (strcmp(opt_val, browse_args->value) == 0)
return 0;
return -1;
}

View file

@ -243,6 +243,11 @@ struct sysfs_dmsection {
struct uci_section *dm;
};
struct browse_args {
char *option;
char *value;
};
char *cut_fx(char *str, char *delimiter, int occurence);
pid_t get_pid(char *pname);
int check_file(char *path);
@ -326,5 +331,5 @@ char *replace_char(char *str, char find, char replace);
int is_vlan_termination_section(char *name);
void sync_dmmap_bool_to_uci_list(struct uci_section *s, char *section, char *value, bool b);
void del_dmmap_sec_with_opt_eq(char *dmmap_file, char *section, char *option, char *value);
int check_browse_section(struct uci_section *s, void *data);
#endif

View file

@ -626,10 +626,11 @@ int dmuci_get_value_by_section_list(struct uci_section *s, char *option, struct
struct uci_list *list;
char *pch = NULL, *spch = NULL, *dup;
*value = NULL;
if (s == NULL || option == NULL)
return -1;
*value = NULL;
uci_foreach_element(&s->options, e) {
o = (uci_to_option(e));
if (strcmp(o->e.name, option) == 0) {