mirror of
https://dev.iopsys.eu/bbf/icwmp.git
synced 2026-03-11 03:28:31 +01:00
Code review and optimisation
This commit is contained in:
parent
37122f5617
commit
231f0faae1
5 changed files with 56 additions and 32 deletions
|
|
@ -56,10 +56,10 @@ int entry_method_root_X_INTENO_SE_LOGIN_CFG(struct dmctx *ctx)
|
|||
{
|
||||
IF_MATCH(ctx, DMROOT"X_INTENO_SE_LoginCfg.") {
|
||||
DMOBJECT(DMROOT"X_INTENO_SE_LoginCfg.", ctx, "0", 1, NULL, NULL, NULL);
|
||||
DMPARAM("AdminPassword", ctx, "1", get_empty, set_x_bcm_admin_password, "", 0, 1, UNDEF, NULL);
|
||||
DMPARAM("SupportPassword", ctx, "1", get_empty, set_x_bcm_support_password, "", 0, 1, UNDEF, NULL);
|
||||
DMPARAM("UserPassword", ctx, "1", get_empty, set_x_bcm_user_password, "", 0, 1, UNDEF, NULL);
|
||||
DMPARAM("RootPassword", ctx, "1", get_empty, set_x_bcm_root_password, "", 0, 1, UNDEF, NULL);
|
||||
DMPARAM("AdminPassword", ctx, "1", get_empty, set_x_bcm_admin_password, NULL, 0, 1, UNDEF, NULL);
|
||||
DMPARAM("SupportPassword", ctx, "1", get_empty, set_x_bcm_support_password, NULL, 0, 1, UNDEF, NULL);
|
||||
DMPARAM("UserPassword", ctx, "1", get_empty, set_x_bcm_user_password, NULL, 0, 1, UNDEF, NULL);
|
||||
DMPARAM("RootPassword", ctx, "1", get_empty, set_x_bcm_root_password, NULL, 0, 1, UNDEF, NULL);
|
||||
return 0;
|
||||
}
|
||||
return FAULT_9005;
|
||||
|
|
|
|||
|
|
@ -1,11 +1,6 @@
|
|||
#ifndef __SE_LOGINCFG_H
|
||||
#define __SE_LOGINCFG_H
|
||||
|
||||
int set_x_bcm_password(char *refparam, struct dmctx *ctx, int action, char *value, char *user_type);
|
||||
int set_x_bcm_admin_password(char *refparam, struct dmctx *ctx, int action, char *value);
|
||||
int set_x_bcm_support_password(char *refparam, struct dmctx *ctx, int action, char *value);
|
||||
int set_x_bcm_user_password(char *refparam, struct dmctx *ctx, int action, char *value);
|
||||
int set_x_bcm_root_password(char *refparam, struct dmctx *ctx, int action, char *value);
|
||||
int entry_method_root_X_INTENO_SE_LOGIN_CFG(struct dmctx *ctx);
|
||||
|
||||
#endif
|
||||
|
|
@ -29,13 +29,33 @@ int get_pwr_mgmt_value_eee(char *refparam, struct dmctx *ctx, char **value)
|
|||
|
||||
int get_pwr_nbr_interfaces_up(char *refparam, struct dmctx *ctx, char **value)
|
||||
{
|
||||
*value = "";//TODO WHEN UBUS CMD IS PROVIDED
|
||||
char buf[256];
|
||||
int pp, r;
|
||||
|
||||
*value = "";
|
||||
pp = dmcmd("pwrctl", 1, "show"); //TODO wait ubus command
|
||||
if (pp) {
|
||||
r = dmcmd_read(pp, buf, 256);
|
||||
close(pp);
|
||||
//TODO output command is changed
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int get_pwr_nbr_interfaces_down(char *refparam, struct dmctx *ctx, char **value)
|
||||
{
|
||||
*value = "";//TODO WHEN UBUS CMD IS PROVIDED
|
||||
char buf[256];
|
||||
int pp, r;
|
||||
|
||||
*value = "";
|
||||
pp = dmcmd("pwrctl", 1, "show"); //TODO wait ubus command
|
||||
if (pp) {
|
||||
r = dmcmd_read(pp, buf, 256);
|
||||
close(pp);
|
||||
//TODO output command is changed
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -84,7 +104,7 @@ bool dm_powermgmt_enable_set(void)
|
|||
if( access("/etc/init.d/power_mgmt", F_OK ) != -1 ) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
struct sewifiargs cur_wifiargs = {0};
|
||||
|
||||
inline int entry_sewifi_radio(struct dmctx *ctx);
|
||||
inline int init_se_wifi(struct dmctx *ctx, struct uci_section *s)
|
||||
{
|
||||
struct sewifiargs *args = &cur_wifiargs;
|
||||
|
|
@ -64,28 +65,40 @@ int set_wifi_maxassoc(char *refparam, struct dmctx *ctx, int action, char *value
|
|||
return 0;
|
||||
}
|
||||
|
||||
int entry_method_root_SE_Wifi(struct dmctx *ctx)
|
||||
/////////////SUB ENTRIES///////////////
|
||||
inline int entry_sewifi_radio(struct dmctx *ctx)
|
||||
{
|
||||
char *wnum;
|
||||
struct uci_section *s = NULL;
|
||||
|
||||
uci_foreach_sections("wireless", "wifi-device", s) {
|
||||
init_se_wifi(ctx, s);
|
||||
wnum = section_name(s);
|
||||
wnum += 2;
|
||||
dmasprintf(&wnum, "%d", atoi(wnum) + 1);
|
||||
SUBENTRY(entry_sewifi_radio_instance, ctx, wnum);
|
||||
dmfree(wnum);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
//////////////////////////////////////
|
||||
|
||||
int entry_method_root_SE_Wifi(struct dmctx *ctx)
|
||||
{
|
||||
IF_MATCH(ctx, DMROOT"X_INTENO_SE_Wifi.") {
|
||||
DMOBJECT(DMROOT"X_INTENO_SE_Wifi.", ctx, "0", 1, NULL, NULL, NULL);
|
||||
DMOBJECT(DMROOT"X_INTENO_SE_Wifi.Radio.", ctx, "0", 1, NULL, NULL, NULL);
|
||||
uci_foreach_sections("wireless", "wifi-device", s) {
|
||||
if (s != NULL) {
|
||||
init_se_wifi(ctx, s);
|
||||
wnum = section_name(s);
|
||||
wnum += 2;
|
||||
dmasprintf(&wnum, "%d", atoi(wnum) + 1);
|
||||
DMOBJECT(DMROOT"X_INTENO_SE_Wifi.Radio.%s.", ctx, "0", 1, NULL, NULL, NULL, wnum);
|
||||
DMPARAM("Frequency", ctx, "0", get_wifi_frequency, NULL, NULL, 0, 1, UNDEF, NULL);
|
||||
DMPARAM("MaxAssociations", ctx, "1", get_wifi_maxassoc, set_wifi_maxassoc, NULL, 0, 1, UNDEF, NULL);
|
||||
dmfree(wnum);
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
SUBENTRY(entry_sewifi_radio, ctx);
|
||||
return 0;
|
||||
}
|
||||
return FAULT_9005;
|
||||
}
|
||||
|
||||
inline int entry_sewifi_radio_instance(struct dmctx *ctx, char *wnum)
|
||||
{
|
||||
IF_MATCH(ctx, DMROOT"X_INTENO_SE_Wifi.Radio.%s.", wnum) {
|
||||
DMOBJECT(DMROOT"X_INTENO_SE_Wifi.Radio.%s.", ctx, "0", 1, NULL, NULL, NULL, wnum);
|
||||
DMPARAM("Frequency", ctx, "0", get_wifi_frequency, NULL, NULL, 0, 1, UNDEF, NULL);
|
||||
DMPARAM("MaxAssociations", ctx, "1", get_wifi_maxassoc, set_wifi_maxassoc, NULL, 0, 1, UNDEF, NULL);
|
||||
return 0;
|
||||
}
|
||||
return FAULT_9005;
|
||||
|
|
|
|||
|
|
@ -6,10 +6,6 @@ struct sewifiargs
|
|||
struct uci_section *sewifisection;
|
||||
};
|
||||
|
||||
inline int init_se_wifi(struct dmctx *ctx, struct uci_section *s);
|
||||
int get_wifi_frequency(char *refparam, struct dmctx *ctx, char **value);
|
||||
int get_wifi_maxassoc(char *refparam, struct dmctx *ctx, char **value);
|
||||
int set_wifi_maxassoc(char *refparam, struct dmctx *ctx, int action, char *value);
|
||||
int entry_method_root_SE_Wifi(struct dmctx *ctx);
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Reference in a new issue