diff --git a/backupSession.c b/backupSession.c index 92cea2e..0b8f062 100644 --- a/backupSession.c +++ b/backupSession.c @@ -3,10 +3,10 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 2 of the License, or * (at your option) any later version. - * Powered by Inteno Broadband Technology AB * - * Copyright (C) 2013 Mohamed Kallel - * Copyright (C) 2013 Ahmed Zribi + * Copyright (C) 2013 Inteno Broadband Technology AB + * Author Mohamed Kallel + * Author Ahmed Zribi * */ diff --git a/config.c b/config.c index 7b64ded..138c557 100644 --- a/config.c +++ b/config.c @@ -3,10 +3,10 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 2 of the License, or * (at your option) any later version. - * Powered by Inteno Broadband Technology AB * - * Copyright (C) 2013 Mohamed Kallel - * Copyright (C) 2013 Ahmed Zribi + * Copyright (C) 2013 Inteno Broadband Technology AB + * Author Mohamed Kallel + * Author Ahmed Zribi * */ diff --git a/config/cwmp b/config/cwmp index ce6e954..4761f0c 100644 --- a/config/cwmp +++ b/config/cwmp @@ -58,3 +58,18 @@ config notifications config cwmp option parameter 'InternetGatewayDevice.DeviceInfo.SpecVersion' option value '1.0' + +config DeviceInfo + list function 'device_info' + +config Services + list function 'voice_service' + +config LANDevice + list function 'lan_device' + +config ManagementServer + list function 'management_server' + +config WANDevice + list function 'wan_device' diff --git a/cwmp.c b/cwmp.c index 1a39c01..9cc02ba 100644 --- a/cwmp.c +++ b/cwmp.c @@ -3,10 +3,10 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 2 of the License, or * (at your option) any later version. - * Powered by Inteno Broadband Technology AB * - * Copyright (C) 2013 Mohamed Kallel - * Copyright (C) 2013 Ahmed Zribi + * Copyright (C) 2013 Inteno Broadband Technology AB + * Author Mohamed Kallel + * Author Ahmed Zribi * */ @@ -136,10 +136,12 @@ void cwmp_schedule_session (struct cwmp *cwmp) CWMP_LOG(EMERG,"FATAL error in the mutex process in the session scheduler!"); exit(EXIT_FAILURE); } + external_init(); CWMP_LOG (INFO,"Start session"); error = cwmp_schedule_rpc (cwmp,session); CWMP_LOG (INFO,"End session"); run_session_end_func(session); + external_exit(); if (session->error == CWMP_RETRY_SESSION) { error = cwmp_move_session_to_session_queue (cwmp, session); @@ -440,20 +442,20 @@ int run_session_end_func (struct session *session) if (session->end_session & END_SESSION_EXTERNAL_ACTION) { CWMP_LOG (INFO,"Executing external commands: end session request"); - external_simple("end_session", NULL); + external_simple("end_session"); } if (session->end_session & END_SESSION_FACTORY_RESET) { CWMP_LOG (INFO,"Executing factory reset: end session request"); - external_simple("factory_reset", NULL); + external_simple("factory_reset"); exit(EXIT_SUCCESS); } if (session->end_session & END_SESSION_REBOOT) { CWMP_LOG (INFO,"Executing Reboot: end session request"); - external_simple("reboot", NULL); + external_simple("reboot"); exit(EXIT_SUCCESS); } diff --git a/event.c b/event.c index a5751be..83550b8 100644 --- a/event.c +++ b/event.c @@ -3,10 +3,10 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 2 of the License, or * (at your option) any later version. - * Powered by Inteno Broadband Technology AB * - * Copyright (C) 2013 Mohamed Kallel - * Copyright (C) 2013 Ahmed Zribi + * Copyright (C) 2013 Inteno Broadband Technology AB + * Author Mohamed Kallel + * Author Ahmed Zribi * */ diff --git a/external.c b/external.c index f7fdc66..b3115bc 100644 --- a/external.c +++ b/external.c @@ -3,31 +3,38 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 2 of the License, or * (at your option) any later version. - * Contributed by Inteno Broadband Technology AB * - * Copyright (C) 2013 Mohamed Kallel - * Copyright (C) 2013 Ahmed Zribi + * Copyright (C) 2013 Inteno Broadband Technology AB + * Author Mohamed Kallel + * Author Ahmed Zribi * Copyright (C) 2011 Luka Perkov */ #include #include +#include #include #include #include #include #include +#include #include +#include #include #include +#include + #include "external.h" #include "cwmp.h" #include "log.h" -static struct uloop_process uproc; -static pthread_mutex_t external_mutex_exec = PTHREAD_MUTEX_INITIALIZER; +static int pid; +static json_object *json_obj_in; +static int pfds_in[2], pfds_out[2]; +static FILE *fpipe; LIST_HEAD(external_list_parameter); LIST_HEAD(external_list_value_change); @@ -134,523 +141,259 @@ void external_fetch_delObjectResp (char **status, char **fault) external_MethodFault = NULL; } -static void external_action_jshn_parse(int fp, int external_handler(char *msg)) +static void external_read_pipe_input(int (*external_handler)(char *msg)) { char buf[1], *value = NULL, *c = NULL; int i=0, len; - - while(read(fp, buf, sizeof(buf))>0) { + struct pollfd fd = { + .fd = pfds_in[0], + .events = POLLIN + }; + while(1) { + poll(&fd, 1, 500000); + if (!(fd.revents & POLLIN)) break; + if (read(pfds_in[0], buf, sizeof(buf))<=0) break; if (buf[0]!='\n') { if (value) asprintf(&c,"%s%c",value,buf[0]); else asprintf(&c,"%c",buf[0]); - free(value); + FREE(value); value = c; } else { if (!value) continue; - external_handler(value); + if (strcmp(value, "EOF")==0) break; + if(external_handler) external_handler(value); FREE(value); } } } -int external_get_action(char *action, char *name, char *arg, int external_handler(char *msg)) +static void external_write_pipe_output(const char *msg) +{ + char *value = NULL; + int i=0, len; + + asprintf(&value, "%s\n", msg); + if (write(pfds_out[1], value, strlen(value)) == -1) { + CWMP_LOG(ERROR,"Error occured when trying to write to the pipe"); + } + free(value); +} + +static void json_obj_out_add(json_object *json_obj_out, char *name, char *val) +{ + json_object *json_obj_tmp; + + json_obj_tmp = json_object_new_string(val); + json_object_object_add(json_obj_out, name, json_obj_tmp); + } + +void external_init() +{ + if (pipe(pfds_in) < 0) + return; + + if (pipe(pfds_out) < 0) + return; + + if ((pid = fork()) == -1) + goto error; + + if (pid == 0) { + /* child */ + + close(pfds_out[1]); + close(pfds_in[0]); + + dup2(pfds_out[0], STDIN_FILENO); + dup2(pfds_in[1], STDOUT_FILENO); + + const char *argv[5]; + int i = 0; + argv[i++] = "/bin/sh"; + argv[i++] = fc_script; + argv[i++] = "--json"; + argv[i++] = "json_continuous_input"; + argv[i++] = NULL; + execvp(argv[0], (char **) argv); + + close(pfds_out[0]); + close(pfds_in[1]); + + exit(ESRCH); + } + + close(pfds_in[1]); + close(pfds_out[0]); + + external_read_pipe_input(NULL); + + DD(INFO, "freecwmp script is listening"); + return; + +error: + CWMP_LOG(ERROR,"freecwmp script intialization failed"); + exit(EXIT_FAILURE); +} + +void external_exit() +{ + int status; + + json_object *json_obj_out; + + json_obj_out = json_object_new_object(); + + json_obj_out_add(json_obj_out, "command", "exit"); + + external_write_pipe_output(json_object_to_json_string(json_obj_out)); + + json_object_put(json_obj_out); + + while (wait(&status) != pid) { + DD(DEBUG, "waiting for child to exit"); + } + + close(pfds_in[0]); + close(pfds_out[1]); + } + +int external_handle_action(int (*external_handler)(char *msg)) +{ + json_object *json_obj_out; + + json_obj_out = json_object_new_object(); + json_obj_out_add(json_obj_out, "command", "end"); + external_write_pipe_output(json_object_to_json_string(json_obj_out)); + json_object_put(json_obj_out); + external_read_pipe_input(external_handler); + return 0; +} + + +int external_get_action(char *action, char *name, char *next_level) { - int pfds[2]; - if (pipe(pfds) < 0) - return -1; - pthread_mutex_lock(&external_mutex_exec); DD(INFO,"executing get %s '%s'", action, name); - if ((uproc.pid = fork()) == -1) - goto error; + json_object *json_obj_out; - if (uproc.pid == 0) { - /* child */ + /* send data to the script */ + json_obj_out = json_object_new_object(); - const char *argv[8]; - int i = 0; - argv[i++] = "/bin/sh"; - argv[i++] = fc_script; - argv[i++] = "--json"; - argv[i++] = "get"; - argv[i++] = action; - argv[i++] = name; - if(arg) argv[i++] = arg; - argv[i++] = NULL; + json_obj_out_add(json_obj_out, "command", "get"); + json_obj_out_add(json_obj_out, "action", action); + json_obj_out_add(json_obj_out, "parameter", name); + if (next_level) json_obj_out_add(json_obj_out, "next_level", next_level); - close(pfds[0]); - dup2(pfds[1], 1); - close(pfds[1]); + external_write_pipe_output(json_object_to_json_string(json_obj_out)); - execvp(argv[0], (char **) argv); - exit(ESRCH); + json_object_put(json_obj_out); - } else if (uproc.pid < 0) - goto error; - - /* parent */ - close(pfds[1]); - - int status; - while (wait(&status) != uproc.pid) { - DD(DEBUG,"waiting for child to exit"); + return 0; } - external_action_jshn_parse(pfds[0], external_handler); +int external_set_action(char *action, char *name, char *value, char *change) +{ + DD(INFO,"executing set %s '%s'", action, name); - close(pfds[0]); + json_object *json_obj_out; + + /* send data to the script */ + json_obj_out = json_object_new_object(); + + json_obj_out_add(json_obj_out, "command", "set"); + json_obj_out_add(json_obj_out, "action", action); + json_obj_out_add(json_obj_out, "parameter", name); + json_obj_out_add(json_obj_out, "value", value); + if (change) json_obj_out_add(json_obj_out, "change", change); + + external_write_pipe_output(json_object_to_json_string(json_obj_out)); + + json_object_put(json_obj_out); - pthread_mutex_unlock(&external_mutex_exec); return 0; - -error: - close(pfds[0]); - pthread_mutex_unlock(&external_mutex_exec); - return -1; } -int external_get_action_write(char *action, char *name, char *arg) +int external_object_action(char *command, char *name) { - pthread_mutex_lock(&external_mutex_exec); - DD(INFO,"adding to get %s script '%s'", action, name); + DD(INFO,"executing %s object '%s'", action, name); - FILE *fp; + json_object *json_obj_out; - if (access(fc_script_actions, R_OK | W_OK | X_OK) != -1) { - fp = fopen(fc_script_actions, "a"); - if (!fp) goto error; - } else { - fp = fopen(fc_script_actions, "w"); - if (!fp) goto error; + /* send data to the script */ + json_obj_out = json_object_new_object(); - fprintf(fp, "#!/bin/sh\n"); + json_obj_out_add(json_obj_out, "command", command); + json_obj_out_add(json_obj_out, "action", "object"); + json_obj_out_add(json_obj_out, "parameter", name); - if (chmod(fc_script_actions, - strtol("0700", 0, 8)) < 0) { - goto error; - } - } + external_write_pipe_output(json_object_to_json_string(json_obj_out)); -#ifdef DUMMY_MODE - fprintf(fp, "/bin/sh `pwd`/%s --json get %s %s %s\n", fc_script, action, name, arg?arg:""); -#else - fprintf(fp, "/bin/sh %s --json get %s %s %s\n", fc_script, action, name, arg?arg:""); -#endif + json_object_put(json_obj_out); - fclose(fp); - - pthread_mutex_unlock(&external_mutex_exec); return 0; - -error: - pthread_mutex_unlock(&external_mutex_exec); - return -1; } -int external_get_action_execute(int external_handler(char *msg)) +int external_simple(char *command) { - int pfds[2]; - if (pipe(pfds) < 0) - return -1; + DD(INFO,"executing %s request", command); - pthread_mutex_lock(&external_mutex_exec); + json_object *json_obj_out; - if (access(fc_script_actions, F_OK) == -1) - goto success; + /* send data to the script */ + json_obj_out = json_object_new_object(); - DD(INFO,"executing get script"); + json_obj_out_add(json_obj_out, "command", command); - if ((uproc.pid = fork()) == -1) { - goto error; - } + external_write_pipe_output(json_object_to_json_string(json_obj_out)); - if (uproc.pid == 0) { - /* child */ + json_object_put(json_obj_out); - const char *argv[3]; - int i = 0; - argv[i++] = "/bin/sh"; - argv[i++] = fc_script_actions; - argv[i++] = NULL; - - close(pfds[0]); - dup2(pfds[1], 1); - close(pfds[1]); - - execvp(argv[0], (char **) argv); - exit(ESRCH); - - } else if (uproc.pid < 0) - goto error; - - /* parent */ - close(pfds[1]); - - int status; - while (wait(&status) != uproc.pid) { - DD(DEBUG,"waiting for child to exit"); - } - - external_action_jshn_parse(pfds[0], external_handler); - remove(fc_script_actions); - -success: - close(pfds[0]); - pthread_mutex_unlock(&external_mutex_exec); return 0; - -error: - close(pfds[0]); - pthread_mutex_unlock(&external_mutex_exec); - return -1; } - -int external_set_action_write(char *action, char *name, char *value, char *change) +int external_download(char *url, char *size, char *type, char *user, char *pass) { - pthread_mutex_lock(&external_mutex_exec); - DD(INFO,"adding to set %s script '%s'", action, name); - - FILE *fp; - - if (access(fc_script_actions, R_OK | W_OK | X_OK) != -1) { - fp = fopen(fc_script_actions, "a"); - if (!fp) goto error; - } else { - fp = fopen(fc_script_actions, "w"); - if (!fp) goto error; - - fprintf(fp, "#!/bin/sh\n"); - - if (chmod(fc_script_actions, - strtol("0700", 0, 8)) < 0) { - goto error; - } - } -#ifdef DUMMY_MODE - fprintf(fp, "/bin/sh `pwd`/%s --json set %s %s %s %s\n", fc_script, action, name, value, change ? change : ""); -#else - fprintf(fp, "/bin/sh %s --json set %s %s %s %s\n", fc_script, action, name, value, change ? change : ""); -#endif - - - fclose(fp); - - pthread_mutex_unlock(&external_mutex_exec); - return 0; - -error: - pthread_mutex_unlock(&external_mutex_exec); - return -1; -} - -int external_set_action_execute(char *action, int external_handler(char *msg)) -{ - int pfds[2]; - if (pipe(pfds) < 0) - return -1; - - pthread_mutex_lock(&external_mutex_exec); - DD(INFO,"executing set script"); - - FILE *fp; - - if (access(fc_script_actions, R_OK | W_OK | F_OK) == -1) - goto error; - - fp = fopen(fc_script_actions, "a"); - if (!fp) goto error; - -#ifdef DUMMY_MODE - fprintf(fp, "/bin/sh `pwd`/%s --json apply %s\n", fc_script, action); -#else - fprintf(fp, "/bin/sh %s --json apply %s\n", fc_script, action); -#endif - - fclose(fp); - - if ((uproc.pid = fork()) == -1) { - goto error; - } - - if (uproc.pid == 0) { - /* child */ - - const char *argv[3]; - int i = 0; - argv[i++] = "/bin/sh"; - argv[i++] = fc_script_actions; - argv[i++] = NULL; - - close(pfds[0]); - dup2(pfds[1], 1); - close(pfds[1]); - - execvp(argv[0], (char **) argv); - exit(ESRCH); - - } else if (uproc.pid < 0) - goto error; - - /* parent */ - close(pfds[1]); - - int status; - while (wait(&status) != uproc.pid) { - DD(DEBUG,"waiting for child to exit"); - } - - external_action_jshn_parse(pfds[0], external_handler); - - if (remove(fc_script_actions) != 0) - goto error; - - close(pfds[0]); - - pthread_mutex_unlock(&external_mutex_exec); - return 0; - -error: - close(pfds[0]); - pthread_mutex_unlock(&external_mutex_exec); - return -1; -} - -int external_object_action(char *action, char *name, int external_handler(char *msg)) -{ - int pfds[2]; - if (pipe(pfds) < 0) - return -1; - - pthread_mutex_lock(&external_mutex_exec); - DD(INFO,"executing object %s '%s'", action, name); - - if ((uproc.pid = fork()) == -1) - goto error; - - if (uproc.pid == 0) { - /* child */ - - const char *argv[8]; - int i = 0; - argv[i++] = "/bin/sh"; - argv[i++] = fc_script; - argv[i++] = "--json"; - argv[i++] = action; - argv[i++] = "object"; - argv[i++] = name; - argv[i++] = NULL; - - close(pfds[0]); - dup2(pfds[1], 1); - close(pfds[1]); - - execvp(argv[0], (char **) argv); - exit(ESRCH); - - } else if (uproc.pid < 0) - goto error; - - close(pfds[1]); - - int status; - while (wait(&status) != uproc.pid) { - DD(DEBUG, "waiting for child to exit"); - } - - external_action_jshn_parse(pfds[0], external_handler); - - close(pfds[0]); - - pthread_mutex_unlock(&external_mutex_exec); - return 0; - -error: - close(pfds[0]); - pthread_mutex_unlock(&external_mutex_exec); - return -1; -} - -int external_simple(char *arg, int external_handler(char *msg)) -{ - - int pfds[2]; - if (pipe(pfds) < 0) - return -1; - - pthread_mutex_lock(&external_mutex_exec); - DD(INFO,"executing %s request", arg); - - if ((uproc.pid = fork()) == -1) - goto error; - - if (uproc.pid == 0) { - /* child */ - - const char *argv[6]; - int i = 0; - argv[i++] = "/bin/sh"; - argv[i++] = fc_script; - argv[i++] = "--json"; - argv[i++] = arg; - argv[i++] = NULL; - - close(pfds[0]); - dup2(pfds[1], 1); - close(pfds[1]); - - execvp(argv[0], (char **) argv); - exit(ESRCH); - - } else if (uproc.pid < 0) - goto error; - - /* parent */ - close(pfds[1]); - - int status; - while (wait(&status) != uproc.pid) { - DD(DEBUG,"waiting for child to exit"); - } - - if (external_handler) - external_action_jshn_parse(pfds[0], external_handler); - close(pfds[0]); - - pthread_mutex_unlock(&external_mutex_exec); - return 0; - -error: - close(pfds[0]); - pthread_mutex_unlock(&external_mutex_exec); - return -1; -} - -int external_download(char *url, char *size, char *type, char *user, char *pass, int external_handler(char *msg)) -{ - int pfds[2]; - if (pipe(pfds) < 0) - return -1; - - pthread_mutex_lock(&external_mutex_exec); DD(INFO,"executing download url '%s'", url); - if ((uproc.pid = fork()) == -1) - goto error; + json_object *json_obj_out; - if (uproc.pid == 0) { - /* child */ + /* send data to the script */ + json_obj_out = json_object_new_object(); - const char *argv[20]; - int i = 0; - argv[i++] = "/bin/sh"; - argv[i++] = fc_script; - argv[i++] = "download"; - argv[i++] = "--json"; - argv[i++] = "--url"; - argv[i++] = url; - argv[i++] = "--size"; - argv[i++] = size; - argv[i++] = "--type"; - argv[i++] = type; - if(user) - { - argv[i++] = "--user"; - argv[i++] = user; - } - if(pass) - { - argv[i++] = "--pass"; - argv[i++] = pass; - } - argv[i++] = NULL; + json_obj_out_add(json_obj_out, "command", "download"); + json_obj_out_add(json_obj_out, "url", url); + json_obj_out_add(json_obj_out, "size", size); + json_obj_out_add(json_obj_out, "type", type); + if(user) json_obj_out_add(json_obj_out, "user", user); + if(pass) json_obj_out_add(json_obj_out, "pass", pass); - close(pfds[0]); - dup2(pfds[1], 1); - close(pfds[1]); + external_write_pipe_output(json_object_to_json_string(json_obj_out)); - execvp(argv[0], (char **) argv); - exit(ESRCH); + json_object_put(json_obj_out); - } else if (uproc.pid < 0) - goto error; - - /* parent */ - close(pfds[1]); - - int status; - while (wait(&status) != uproc.pid) { - DD(INFO,"waiting for child to exit"); - } - - external_action_jshn_parse(pfds[0], external_handler); - close(pfds[0]); - - pthread_mutex_unlock(&external_mutex_exec); return 0; - -error: - close(pfds[0]); - pthread_mutex_unlock(&external_mutex_exec); - return -1; } -int external_apply_download(char *type, int external_handler(char *msg)) +int external_apply(char *action, char *type) { - int pfds[2]; - if (pipe(pfds) < 0) - return -1; + DD(INFO,"executing apply %s", action); - pthread_mutex_lock(&external_mutex_exec); - DD(INFO,"applying downloaded file"); + json_object *json_obj_out; - if ((uproc.pid = fork()) == -1) - goto error; + /* send data to the script */ + json_obj_out = json_object_new_object(); - if (uproc.pid == 0) { - /* child */ + json_obj_out_add(json_obj_out, "command", "apply"); + json_obj_out_add(json_obj_out, "action", action); + if (type) json_obj_out_add(json_obj_out, "type", type); - const char *argv[8]; - int i = 0; - argv[i++] = "/bin/sh"; - argv[i++] = fc_script; - argv[i++] = "--json"; - argv[i++] = "apply"; - argv[i++] = "download"; - argv[i++] = "--type"; - argv[i++] = type; - argv[i++] = NULL; + external_write_pipe_output(json_object_to_json_string(json_obj_out)); - close(pfds[0]); - dup2(pfds[1], 1); - close(pfds[1]); + json_object_put(json_obj_out); - execvp(argv[0], (char **) argv); - exit(ESRCH); - - } else if (uproc.pid < 0) - goto error; - - /* parent */ - close(pfds[1]); - - int status; - while (wait(&status) != uproc.pid) { - DD(INFO,"waiting for child to exit"); - } - - external_action_jshn_parse(pfds[0], external_handler); - close(pfds[0]); - - pthread_mutex_unlock(&external_mutex_exec); return 0; - -error: - close(pfds[0]); - pthread_mutex_unlock(&external_mutex_exec); - return -1; } diff --git a/http.c b/http.c index c8b8761..b5052b7 100644 --- a/http.c +++ b/http.c @@ -3,10 +3,10 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 2 of the License, or * (at your option) any later version. - * Contributed by Inteno Broadband Technology AB * - * Copyright (C) 2013 Mohamed Kallel - * Copyright (C) 2013 Ahmed Zribi + * Copyright (C) 2013 Inteno Broadband Technology AB + * Author Mohamed Kallel + * Author Ahmed Zribi * Copyright (C) 2011-2012 Luka Perkov */ diff --git a/inc/backupSession.h b/inc/backupSession.h index 1f17bd2..135f424 100644 --- a/inc/backupSession.h +++ b/inc/backupSession.h @@ -3,10 +3,10 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 2 of the License, or * (at your option) any later version. - * Powered by Inteno Broadband Technology AB * - * Copyright (C) 2013 Mohamed Kallel - * Copyright (C) 2013 Ahmed Zribi + * Copyright (C) 2013 Inteno Broadband Technology AB + * Author Mohamed Kallel + * Author Ahmed Zribi * */ diff --git a/inc/cwmp.h b/inc/cwmp.h index 8a44863..5fb4514 100644 --- a/inc/cwmp.h +++ b/inc/cwmp.h @@ -3,10 +3,10 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 2 of the License, or * (at your option) any later version. - * Powered by Inteno Broadband Technology AB * - * Copyright (C) 2013 Mohamed Kallel - * Copyright (C) 2013 Ahmed Zribi + * Copyright (C) 2013 Inteno Broadband Technology AB + * Author Mohamed Kallel + * Author Ahmed Zribi * */ diff --git a/inc/external.h b/inc/external.h index 1ff3ee7..6952fea 100644 --- a/inc/external.h +++ b/inc/external.h @@ -3,10 +3,10 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 2 of the License, or * (at your option) any later version. - * Contributed by Inteno Broadband Technology AB * - * Copyright (C) 2013 Mohamed Kallel - * Copyright (C) 2013 Ahmed Zribi + * Copyright (C) 2013 Inteno Broadband Technology AB + * Author Mohamed Kallel + * Author Ahmed Zribi * Copyright (C) 2011 Luka Perkov * */ @@ -20,7 +20,6 @@ static char *fc_script = "./ext/openwrt/scripts/freecwmp.sh"; #else static char *fc_script = "/usr/sbin/freecwmp"; #endif -static char *fc_script_actions = "/tmp/freecwmp_action.sh"; extern pthread_mutex_t external_mutex_value_change; extern struct list_head external_list_value_change; @@ -36,17 +35,17 @@ void external_addObjectResp (char *instance, char *status, char *fault); void external_fetch_addObjectResp (char **instance, char **status, char **fault); void external_delObjectResp (char *status, char *fault); void external_fetch_delObjectResp (char **status, char **fault); -int external_get_action(char *action, char *name, char *arg, int external_handler(char *msg)); -int external_get_action_write(char *action, char *name, char *arg); -int external_get_action_execute(int external_handler(char *msg)); -int external_set_action_write(char *action, char *name, char *value, char *change); -int external_set_action_execute(char *action, int external_handler(char *msg)); -int external_object_action(char *action, char *name, int external_handler(char *msg)); -int external_simple(char *arg, int external_handler(char *msg)); -int external_download(char *url, char *size, char *type, char *user, char *pass, int external_handler(char *msg)); -int external_apply_download(char *type, int external_handler(char *msg)); +int external_get_action(char *action, char *name, char *next_level); +int external_set_action(char *action, char *name, char *value, char *change); +int external_object_action(char *command, char *name); +int external_simple(char *command); +int external_download(char *url, char *size, char *type, char *user, char *pass); +int external_apply(char *action, char *type); +int external_handle_action(int (*external_handler)(char *msg)); void external_add_list_paramameter(char *param_name, char *param_data, char *param_type, char *fault_code); void external_free_list_parameter(); +void external_init(); +void external_exit(); #endif diff --git a/inc/jshn.h b/inc/jshn.h index a226017..47afdec 100644 --- a/inc/jshn.h +++ b/inc/jshn.h @@ -3,10 +3,10 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 2 of the License, or * (at your option) any later version. - * Powered by Inteno Broadband Technology AB * - * Copyright (C) 2013 Mohamed Kallel - * Copyright (C) 2013 Ahmed Zribi + * Copyright (C) 2013 Inteno Broadband Technology AB + * Author Mohamed Kallel + * Author Ahmed Zribi * */ diff --git a/inc/log.h b/inc/log.h index fe8486e..ad43a26 100644 --- a/inc/log.h +++ b/inc/log.h @@ -3,10 +3,10 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 2 of the License, or * (at your option) any later version. - * Powered by Inteno Broadband Technology AB * - * Copyright (C) 2013 Mohamed Kallel - * Copyright (C) 2013 Ahmed Zribi + * Copyright (C) 2013 Inteno Broadband Technology AB + * Author Mohamed Kallel + * Author Ahmed Zribi * */ diff --git a/inc/xml.h b/inc/xml.h index 3e21ece..f314d9e 100644 --- a/inc/xml.h +++ b/inc/xml.h @@ -3,10 +3,10 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 2 of the License, or * (at your option) any later version. - * Contributed by Inteno Broadband Technology AB * - * Copyright (C) 2013 Mohamed Kallel - * Copyright (C) 2013 Ahmed Zribi + * Copyright (C) 2013 Inteno Broadband Technology AB + * Author Mohamed Kallel + * Author Ahmed Zribi * Copyright (C) 2011 Luka Perkov * */ diff --git a/init/cwmpd.init b/init/cwmpd.init index 1bc9aad..4e38048 100644 --- a/init/cwmpd.init +++ b/init/cwmpd.init @@ -66,17 +66,17 @@ check_dhcp() { done fi } -set_wan_interface() -{ - - local device="" - local default_wan_interface="" - config_load cwmp - config_get default_wan_interface cpe default_wan_interface - json_load "$(ifstatus $default_wan_interface)" - json_get_var device device - uci_set cwmp cpe interface "$device" - uci_commit +set_wan_interface() { + local l3_device="" + local default_wan_interface="" + config_load cwmp + config_get default_wan_interface cpe default_wan_interface + json_load "$(ifstatus $default_wan_interface)" + json_get_var l3_device l3_device + if [ "$l3_device" != "" ];then + uci_set cwmp cpe interface "$l3_device" + uci_commit + fi } start_msg="Start cwmpd ..." @@ -104,15 +104,6 @@ boot() { } start() { - local default_wan_interface - config_load cwmp - config_get default_wan_interface cpe default_wan_interface - json_load "$(ifstatus $default_wan_interface)" - json_get_var device device - if [ "$device" != "" ];then - uci -q set cwmp.cpe.interface="$device" - uci commit -q - fi run=$(ps aux|grep /usr/sbin/cwmpd|grep -v grep|grep -v rc.common) if [ "$run" = "" ] then @@ -141,19 +132,11 @@ stop() { pids="`ps aux|grep /usr/sbin/cwmpd|sed 's/^ \+//g'|sed 's/ \+/:/g'|grep -v \" Z \"|grep -v grep|cut -f1 -d:|tr '\n' ' '`" done - pids="`ps aux|grep /tmp/freecwmp_action.sh|sed 's/^ \+//g'|sed 's/ \+/:/g'|grep -v grep|cut -f1 -d:|tr '\n' ' '`" - while [ "_$pids" != "_" ];do - kill -9 $pids 2> /dev/null - pids="`ps aux|grep /tmp/freecwmp_action.sh|sed 's/^ \+//g'|sed 's/ \+/:/g'|grep -v grep|cut -f1 -d:|tr '\n' ' '`" - done - pids="`ps aux|grep /usr/sbin/freecwmp|sed 's/^ \+//g'|sed 's/ \+/:/g'|grep -v grep|cut -f1 -d:|tr '\n' ' '`" while [ "_$pids" != "_" ];do kill -9 $pids 2> /dev/null pids="`ps aux|grep /usr/sbin/freecwmp|sed 's/^ \+//g'|sed 's/ \+/:/g'|grep -v grep|cut -f1 -d:|tr '\n' ' '`" done - - rm -f /tmp/freecwmp_action.sh } restart() { diff --git a/jshn.c b/jshn.c index 57b4f08..825cbb6 100644 --- a/jshn.c +++ b/jshn.c @@ -3,10 +3,10 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 2 of the License, or * (at your option) any later version. - * Contributed by Inteno Broadband Technology AB * - * Copyright (C) 2013 Mohamed Kallel - * Copyright (C) 2013 Ahmed Zribi + * Copyright (C) 2013 Inteno Broadband Technology AB + * Author Mohamed Kallel + * Author Ahmed Zribi * Copyright (C) 2012 Luka Perkov */ diff --git a/log.c b/log.c index 14c6953..a063028 100644 --- a/log.c +++ b/log.c @@ -3,10 +3,10 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 2 of the License, or * (at your option) any later version. - * Powered by Inteno Broadband Technology AB * - * Copyright (C) 2013 Mohamed Kallel - * Copyright (C) 2013 Ahmed Zribi + * Copyright (C) 2013 Inteno Broadband Technology AB + * Author Mohamed Kallel + * Author Ahmed Zribi * */ @@ -108,14 +108,13 @@ void puts_log(int severity, const char *fmt, ...) gettimeofday(&tv, 0); t = time((time_t*)NULL); Tm= localtime(&tv.tv_sec); - i = sprintf(buf,"%02d-%02d-%4d, %02d:%02d:%02d.%03d %s ", + i = sprintf(buf,"%02d-%02d-%4d, %02d:%02d:%02d %s ", Tm->tm_mday, Tm->tm_mon+1, Tm->tm_year+1900, Tm->tm_hour, Tm->tm_min, Tm->tm_sec, - (int)tv.tv_usec%1000, SEVERITY_NAMES[severity]); if(strlen(log_file_name) == 0) diff --git a/netlink.c b/netlink.c index b9c2cf6..c4488d1 100644 --- a/netlink.c +++ b/netlink.c @@ -3,10 +3,10 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 2 of the License, or * (at your option) any later version. - * Contributed by Inteno Broadband Technology AB * - * Copyright (C) 2013 Mohamed Kallel - * Copyright (C) 2013 Ahmed Zribi + * Copyright (C) 2013 Inteno Broadband Technology AB + * Author Mohamed Kallel + * Author Ahmed Zribi * Copyright (C) 2011-2012 Luka Perkov * */ diff --git a/scripts/freecwmp.sh b/scripts/freecwmp.sh index b4bb29c..a307a64 100644 --- a/scripts/freecwmp.sh +++ b/scripts/freecwmp.sh @@ -1,6 +1,8 @@ #!/bin/sh # Copyright (C) 2011-2012 Luka Perkov -# Copyright (C) 2012 Ahmed Zribi +# Copyright (C) 2013 Inteno Broadband Technology AB +# Author Mohamed Kallel +# Author Ahmed Zribi . /lib/functions.sh . /usr/share/libubox/jshn.sh @@ -10,17 +12,12 @@ # define a 'name' command-line string flag DEFINE_boolean 'newline' false 'do not output the trailing newline' 'n' DEFINE_boolean 'value' false 'output values only' 'v' -DEFINE_boolean 'json' false 'send values using ubus' 'j' +DEFINE_boolean 'json' false 'send values using json' 'j' DEFINE_boolean 'empty' false 'output empty parameters' 'e' DEFINE_boolean 'last' false 'output only last line ; for parameters that tend to have huge output' 'l' DEFINE_boolean 'debug' false 'give debug output' 'd' DEFINE_boolean 'dummy' false 'echo system commands' 'D' DEFINE_boolean 'force' false 'force getting values for certain parameters' 'f' -DEFINE_string 'url' '' 'file to download [download only]' 'u' -DEFINE_string 'size' '' 'size of file to download [download only]' 's' -DEFINE_string 'type' '' 'type of file to download [download only]' 't' -DEFINE_string 'user' '' 'username for downloading file [download only]' 'U' -DEFINE_string 'pass' '' 'password for downloading file [download only]' 'P' FLAGS_HELP=`cat << EOF USAGE: $0 [flags] command [parameter] [values] @@ -28,11 +25,15 @@ command: get [value|notification|tags|name|all] set [value|notification|tag] apply [value|notification|download] + add [object] + delete [object] download factory_reset reboot notify end_session + inform + json_continuous_input EOF` FLAGS "$@" || exit 1 @@ -90,6 +91,11 @@ case "$1" in fi ;; download) + __arg1="$2" + __arg2="$3" + __arg3="$4" + __arg4="$5" + __arg5="$6" action="download" ;; factory_reset) @@ -104,28 +110,19 @@ case "$1" in elif [ "$2" = "value" ]; then action="apply_value" elif [ "$2" = "download" ]; then + __arg1="$3" action="apply_download" else action="apply_value" fi ;; add) - if [ "$2" = "object" ]; then - action="add_object" __arg1="$3" - else action="add_object" - __arg1="$3" - fi ;; delete) - if [ "$2" = "object" ]; then - action="delete_object" __arg1="$3" - else action="delete_object" - __arg1="$3" - fi ;; inform) action="inform" @@ -139,6 +136,15 @@ case "$1" in end_session) action="end_session" ;; + json_continuous_input) + action="json_continuous_input" + ;; + end) + echo "EOF" + ;; + exit) + exit 0 + ;; esac if [ -z "$action" ]; then @@ -181,6 +187,8 @@ handle_scripts() { config_load cwmp config_foreach handle_scripts "scripts" +# load instance number for TR104 +load_voice # Fault code @@ -205,6 +213,7 @@ FAULT_CPE_DOWNLOAD_FAIL_COMPLETE_DOWNLOAD="17" FAULT_CPE_DOWNLOAD_FAIL_FILE_CORRUPTED="18" FAULT_CPE_DOWNLOAD_FAIL_FILE_AUTHENTICATION="19" +handle_action() { if [ "$action" = "get_value" -o "$action" = "get_all" ]; then if [ ${FLAGS_force} -eq ${FLAGS_FALSE} ]; then __tmp_arg="Device." @@ -436,15 +445,15 @@ fi if [ "$action" = "download" ]; then local fault_code="9000" - if [ "${FLAGS_user}" = "" -o "${FLAGS_pass}" = "" ];then - wget -O /tmp/freecwmp_download "${FLAGS_url}" > /dev/null + if [ "$__arg4" = "" -o "$__arg5" = "" ];then + wget -O /tmp/freecwmp_download "$__arg1" > /dev/null if [ "$?" != "0" ];then let fault_code=$fault_code+$FAULT_CPE_DOWNLOAD_FAILURE freecwmp_fault_output "" "$fault_code" exit 1 fi else - local url="http://${FLAGS_user}:${FLAGS_pass}@`echo ${FLAGS_url}|sed 's/http:\/\///g'`" + local url="http://$__arg4:$__arg5@`echo $__arg1|sed 's/http:\/\///g'`" wget -O /tmp/freecwmp_download "$url" > /dev/null if [ "$?" != "0" ];then let fault_code=$fault_code+$FAULT_CPE_DOWNLOAD_FAILURE @@ -455,12 +464,12 @@ if [ "$action" = "download" ]; then local flashsize="`freecwmp_check_flash_size`" local filesize=`ls -l /tmp/freecwmp_download | awk '{ print $5 }'` - if [ $flashsize -gt 0 -a $flashsize -lt ${FLAGS_size} ]; then + if [ $flashsize -gt 0 -a $flashsize -lt $__arg2 ]; then let fault_code=$fault_code+$FAULT_CPE_DOWNLOAD_FAILURE rm /tmp/freecwmp_download 2> /dev/null freecwmp_fault_output "" "$fault_code" else - if [ "${FLAGS_type}" = "1" ];then + if [ "$__arg3" = "1" ];then mv /tmp/freecwmp_download /tmp/firmware_upgrade_image 2> /dev/null freecwmp_check_image if [ "$?" = "0" ];then @@ -478,10 +487,10 @@ if [ "$action" = "download" ]; then rm /tmp/firmware_upgrade_image 2> /dev/null freecwmp_fault_output "" "$fault_code" fi - elif [ "${FLAGS_type}" = "2" ];then + elif [ "$__arg3" = "2" ];then mv /tmp/freecwmp_download /tmp/web_content.ipk 2> /dev/null freecwmp_fault_output "" "$FAULT_CPE_NO_FAULT" - elif [ "${FLAGS_type}" = "3" ];then + elif [ "$__arg3" = "3" ];then mv /tmp/freecwmp_download /tmp/vendor_configuration_file.cfg 2> /dev/null freecwmp_fault_output "" "$FAULT_CPE_NO_FAULT" else @@ -493,7 +502,7 @@ if [ "$action" = "download" ]; then fi if [ "$action" = "apply_download" ]; then - case "${FLAGS_type}" in + case "$__arg1" in 1) freecwmp_apply_firmware ;; 2) freecwmp_apply_web_content ;; 3) freecwmp_apply_vendor_configuration ;; @@ -580,6 +589,106 @@ if [ "$action" = "end_session" ]; then echo 'rm -f /tmp/end_session.sh' >> /tmp/end_session.sh /bin/sh /tmp/end_session.sh fi + if [ "$action" = "json_continuous_input" ]; then + echo "EOF" + while read CMD; do + [ -z "$CMD" ] && continue + result="" + json_init + json_load "$CMD" + json_get_var command command + json_get_var action action + case "$command" in + set) + if [ "$action" = "notification" ]; then + json_get_var __arg1 parameter + json_get_var __arg2 value + json_get_var __arg3 change + action="set_notification" + elif [ "$action" = "value" ]; then + json_get_var __arg1 parameter + json_get_var __arg2 value + action="set_value" + else + json_get_var __arg1 parameter + json_get_var __arg2 value + action="set_value" + fi + ;; + get) + if [ "$action" = "notification" ]; then + json_get_var __arg1 parameter + action="get_notification" + elif [ "$action" = "value" ]; then + json_get_var __arg1 parameter + action="get_value" + elif [ "$action" = "name" ]; then + json_get_var __arg1 parameter + json_get_var __arg2 next_level + action="get_name" + else + json_get_var __arg1 parameter + action="get_value" + fi + ;; + download) + json_get_var __arg1 url + json_get_var __arg2 size + json_get_var __arg3 type + json_get_var __arg4 user + json_get_var __arg5 pass + action="download" + ;; + factory_reset) + action="factory_reset" + ;; + reboot) + action="reboot" + ;; + apply) + if [ "$action" = "notification" ]; then + action="apply_notification" + elif [ "$action" = "value" ]; then + action="apply_value" + elif [ "$action" = "download" ]; then + json_get_var __arg1 type + action="apply_download" + else + action="apply_value" + fi + ;; + add) + json_get_var __arg1 parameter + action="add_object" + ;; + delete) + json_get_var __arg1 parameter + action="delete_object" + ;; + inform) + action="inform" + ;; + end_session) + action="end_session" + ;; + end) + echo "EOF" + ;; + exit) + exit 0 + ;; + *) + continue + ;; + esac + handle_action + done + + exit 0; + fi +} + +handle_action if [ ${FLAGS_debug} -eq ${FLAGS_TRUE} ]; then echo "[debug] exited at \"`date`\"" diff --git a/scripts/functions/common b/scripts/functions/common index 634f69d..60208e5 100644 --- a/scripts/functions/common +++ b/scripts/functions/common @@ -1,6 +1,7 @@ #!/bin/sh # Copyright (C) 2011-2012 Luka Perkov -# Copyright (C) 2012 Ahmed Zribi +# Copyright (C) 2013 Inteno Broadband Technology AB +# Author Ahmed Zribi # TODO: merge this one somewhere in OpenWrt uci_remove_list_element() { @@ -293,7 +294,7 @@ freecwmp_config_notifications() { if [ "$item" = "$3" ]; then eval "export -- \"$4=0\"" return 0 - elif [ "`echo $3|grep $item`" = "$3" ]; then + elif [ "`echo $3|grep $item`" = "$3" -a "`echo $item|grep '\.$'`" != "" ]; then if [ $length -lt ${#item} ]; then eval "export -- \"$4=0\"" length="${#item}" @@ -305,7 +306,7 @@ freecwmp_config_notifications() { if [ "$item" = "$3" ]; then eval "export -- \"$4=2\"" return 0 - elif [ "`echo $3|grep $item`" = "$3" ]; then + elif [ "`echo $3|grep $item`" = "$3" -a "`echo $item|grep '\.$'`" != "" ]; then if [ $length -lt ${#item} ]; then eval "export -- \"$4=2\"" length="${#item}" @@ -317,7 +318,7 @@ freecwmp_config_notifications() { if [ "$item" = "$3" ]; then eval "export -- \"$4=1\"" return 0 - elif [ "`echo $3|grep $item`" = "$3" ]; then + elif [ "`echo $3|grep $item`" = "$3" -a "`echo $item|grep '\.$'`" != "" ]; then if [ $length -lt ${#item} ]; then eval "export -- \"$4=1\"" length="${#item}" @@ -385,6 +386,16 @@ freecwmp_notify() { fi } +freecwmp_update_notification() { +local list="$1" +local __parm="$2" +for i in $(/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get cwmp.@notifications[0].$list);do + if [ "`echo $i|grep $__parm`" != "" ];then + uci_remove_list_element "cwmp.@notifications[0].$list" "$i" 2>/dev/null + fi +done +} + freecwmp_set_parameter_notification() { local _parm="$1" local _val="$2" @@ -395,13 +406,24 @@ freecwmp_set_parameter_notification() { uci_remove_list_element "cwmp.@notifications[0].passive" "$_parm" 2>/dev/null uci_remove_list_element "cwmp.@notifications[0].active" "$_parm" 2>/dev/null uci_remove_list_element "cwmp.@notifications[0].disabled" "$_parm" 2>/dev/null + + freecwmp_update_notification "passive" "$_parm" 2>/dev/null + freecwmp_update_notification "active" "$_parm" 2>/dev/null + freecwmp_update_notification "disabled" "$_parm" 2>/dev/null + fi + if [ "`echo $_parm|grep '\.$'`" = "" ]; then + _parent="${_parm%.*}." + config_foreach freecwmp_config_notifications "notifications" "get" "$_parent" "_val_p" + else + _parent="${_parm%.*.}." + config_foreach freecwmp_config_notifications "notifications" "get" "$_parent" "_val_p" fi if [ "$_val" -eq "1" ]; then /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q add_list cwmp.@notifications[0].passive="$_parm" 2>&1 >/dev/null elif [ "$_val" -eq "2" ]; then /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q add_list cwmp.@notifications[0].active="$_parm" 2>&1 >/dev/null - #elif [ "$_val" -eq "0" ]; then - #/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q add_list cwmp.@notifications[0].disabled="$_parm" 2>&1 >/dev/null + elif [ "$_val" -eq "0" -a "$_val_p" != "" -a "$_val_p" != "0" ]; then + /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q add_list cwmp.@notifications[0].disabled="$_parm" 2>&1 >/dev/null fi } @@ -521,6 +543,9 @@ freecwmp_execute_functions() for function_name in $function_list do + func=$(echo "$arg1" | cut -d "." -f 2) + func_config=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} get -q cwmp.@$func[0].function` + if [ "`echo $function_name|grep \"$func_config\"`" != "" -o "$func" = "" ];then $function_name "$arg1" "$arg2" "$arg3" fault_code="$?" if [ "$fault_code" = "0" ]; then @@ -528,6 +553,7 @@ freecwmp_execute_functions() fi if [ "$fault_code" != "0" -a "$fault_code" != "$FAULT_CPE_INVALID_PARAMETER_NAME" ]; then return $fault_code + fi fi done if [ "$no_fault" = "1" ]; then fault_code="0"; fi diff --git a/scripts/functions/device_hosts b/scripts/functions/device_hosts index 05646bc..dd9098b 100644 --- a/scripts/functions/device_hosts +++ b/scripts/functions/device_hosts @@ -1,6 +1,7 @@ #!/bin/sh # Copyright (C) 2012 Luka Perkov -# Copyright (C) 2012 Ahmed Zribi +# Copyright (C) 2013 Inteno Broadband Technology AB +# Author Ahmed Zribi get_device_hosts_number_of_leases() { local _static=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} show dhcp 2> /dev/null | fgrep 'dhcp.' | fgrep '.mac=' | wc -l` diff --git a/scripts/functions/device_info b/scripts/functions/device_info index 132efea..d7dd0bd 100644 --- a/scripts/functions/device_info +++ b/scripts/functions/device_info @@ -1,6 +1,7 @@ #!/bin/sh # Copyright (C) 2011-2012 Luka Perkov -# Copyright (C) 2012 Ahmed Zribi +# Copyright (C) 2013 Inteno Broadband Technology AB +# Author Ahmed Zribi get_device_info_manufacturer() { local val="" @@ -76,7 +77,7 @@ local dslAnnex="" case "$action" in get_value) dslAnnex=`cat /proc/nvram/dslAnnex 2> /dev/null` - val=`cat /etc/iop_version | cut -d'-' -f1 | sed s/$/"$dslAnnex"/ 2> /dev/null` + val=`cat /etc/iop_version | cut -d'-' -f1 | sed s/$/"$dslAnnex"/ 2> /dev/null` ;; get_name) permissions="0" @@ -108,6 +109,7 @@ freecwmp_output "InternetGatewayDevice.DeviceInfo.SoftwareVersion" "$val" "$perm get_device_info_uptime() { local val="" local permissions="" +local type="xsd:unsignedInt" case "$action" in get_value) val=`cat /proc/uptime | awk -F "." '{ print $1 }'` @@ -119,7 +121,7 @@ case "$action" in freecwmp_get_parameter_notification "val" "InternetGatewayDevice.DeviceInfo.UpTime" ;; esac -freecwmp_output "InternetGatewayDevice.DeviceInfo.UpTime" "$val" "$permissions" +freecwmp_output "InternetGatewayDevice.DeviceInfo.UpTime" "$val" "$permissions" "$type" } get_device_info_device_log() { diff --git a/scripts/functions/device_routing b/scripts/functions/device_routing index 186e97f..88d0999 100644 --- a/scripts/functions/device_routing +++ b/scripts/functions/device_routing @@ -1,6 +1,7 @@ #!/bin/sh # Copyright (C) 2012 Luka Perkov -# Copyright (C) 2012 Ahmed Zribi +# Copyright (C) 2013 Inteno Broadband Technology AB +# Author Ahmed Zribi # TODO: LIMITATIONS: we only handle one device router at the moment diff --git a/scripts/functions/device_users b/scripts/functions/device_users index 2412b99..f9545c0 100644 --- a/scripts/functions/device_users +++ b/scripts/functions/device_users @@ -1,6 +1,7 @@ #!/bin/sh # Copyright (C) 2012 Luka Perkov -# Copyright (C) 2012 Ahmed Zribi +# Copyright (C) 2013 Inteno Broadband Technology AB +# Author Ahmed Zribi get_device_users() { local parameter="$1" diff --git a/scripts/functions/lan_device b/scripts/functions/lan_device index d70344d..f27076c 100644 --- a/scripts/functions/lan_device +++ b/scripts/functions/lan_device @@ -1,6 +1,7 @@ #!/bin/sh # Copyright (C) 2012 Luka Perkov -# Copyright (C) 2012 Ahmed Zribi +# Copyright (C) 2013 Inteno Broadband Technology AB +# Author Ahmed Zribi get_wlan_number_of_entries() { local val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless | fgrep '.network' | fgrep "$2" | wc -l` @@ -22,6 +23,85 @@ for lan in `ubus list|sed -n 's/network\.interface\.//p'|grep -v loopback`;do done } +get_set_lan_device_parameter() { +local parameter="$1" +local function="$2" +local partial_parameter_name="$3" +local args="$4" + +freecwmp_parse_formated_parameter "$parameter" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.$partial_parameter_name" "rc" "num" +local num1=`echo $num | awk '{ print $1 }'` +local num2=`echo $num | awk '{ print $2 }'` +for lan in `get_lan_device_interface`;do + lan_num=`echo $lan|cut -f2 -d:` + lan_dev=`echo $lan|cut -f1 -d:` + if [ $num1 -ne $lan_num ]; then + continue + fi + get_wlan_number_of_entries "max_num" $lan_dev + i=0 + for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do + let "i++" + if [ $num2 -ne $i ]; then + continue + fi + if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then + let uci_num=$num2-1 + $function $uci_num $num1 $i $args + else + return $FAULT_CPE_INVALID_PARAMETER_NAME + fi + if [ $num2 -eq $i ]; then + break + fi + done + if [ $num1 -eq $lan_num ]; then + continue + fi +done +return $FAULT_CPE_NO_FAULT +} + +get_associated_device_parameter() { +local parameter="$1" +local partial_parameter_name="$2" +freecwmp_parse_formated_parameter "$parameter" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.AssociatedDevice.{i}.$partial_parameter_name" "rc" "num" +local num1=`echo $num | awk '{ print $1 }'` +local num2=`echo $num | awk '{ print $2 }'` +local num3=`echo $num | awk '{ print $3 }'` +for lan in `get_lan_device_interface`;do + lan_num=`echo $lan|cut -f2 -d:` + lan_dev=`echo $lan|cut -f1 -d:` + if [ $num1 -ne $lan_num ]; then + continue + fi + get_wlan_number_of_entries "max_num" $lan_dev + i=0 + for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do + let "i++" + if [ $num2 -ne $i ]; then + continue + fi + if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then + let uci_num=$num2-1 + get_wlan_associated_device $uci_num $num1 $i $num3 "$partial_parameter_name" + if [ "$?" != "0" ];then + return $FAULT_CPE_INVALID_PARAMETER_NAME + fi + else + return $FAULT_CPE_INVALID_PARAMETER_NAME + fi + if [ $num2 -eq $i ]; then + break + fi + done + if [ $num1 -eq $lan_num ]; then + continue + fi +done +return $FAULT_CPE_NO_FAULT +} + get_wlan_enable() { local num="$1" local lan_num="$2" @@ -32,22 +112,15 @@ local permissions="" case "$action" in get_value) val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get wireless.@wifi-device[$num].disabled 2> /dev/null` - let num=$num+1 - if [ "$val" = "1" ]; then - val="0" - else - val="1" - fi + let val^=1 freecwmp_output "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.Enable" "$val" "$permissions" "$type" ;; get_name) permissions="1" - let num=$num+1 freecwmp_output "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.Enable" "$val" "$permissions" ;; get_notification) - let num=$num+1 - freecwmp_get_parameter_notification "val" "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$num.Enable" + freecwmp_get_parameter_notification "val" "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.Enable" freecwmp_output "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.Enable" "$val" ;; esac @@ -60,16 +133,11 @@ local wlan_num="$3" local val="$4" case $action in set_value) - if [ "$val" = "1" ]; then - val="0" - else - val="1" - fi + let val^=1 delay_command "wifi" "5" /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q set wireless.@wifi-device[$num].disabled="$val" ;; set_notification) - let num=$num+1 local parm="InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.Enable" freecwmp_set_parameter_notification "$parm" "$val" ;; @@ -86,7 +154,6 @@ local permissions="" case "$action" in get_value) val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get wireless.@wifi-device[$num].disabled 2> /dev/null` - let num=$num+1 if [ "$val" = "1" ]; then val="Disabled" else @@ -96,11 +163,9 @@ case "$action" in ;; get_name) permissions="0" - let num=$num+1 freecwmp_output "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.Status" "$val" "$permissions" ;; get_notification) - let num=$num+1 freecwmp_get_parameter_notification "val" "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.Status" freecwmp_output "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.Status" "$val" ;; @@ -121,16 +186,13 @@ case "$action" in else val=`/usr/sbin/wlctl -i wl0.$num bssid` fi - let num=$num+1 freecwmp_output "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.BSSID" "$val" "$permissions" "$type" ;; get_name) permissions="0" - let num=$num+1 freecwmp_output "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.BSSID" "$val" "$permissions" ;; get_notification) - let num=$num+1 freecwmp_get_parameter_notification "val" "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.BSSID" freecwmp_output "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.BSSID" "$val" ;; @@ -147,16 +209,13 @@ local permissions="" case "$action" in get_value) val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get wireless.wl0.hwmode` - let num=$num+1 freecwmp_output "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.MaxBitRate" "$val" "$permissions" "$type" ;; get_name) permissions="1" - let num=$num+1 freecwmp_output "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.MaxBitRate" "$val" "$permissions" ;; get_notification) - let num=$num+1 freecwmp_get_parameter_notification "val" "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.MaxBitRate" freecwmp_output "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.MaxBitRate" "$val" ;; @@ -174,7 +233,6 @@ case $action in /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q set wireless.wl0.hwmode="auto" ;; set_notification) - let num=$num+1 local parm="InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.MaxBitRate" freecwmp_set_parameter_notification "$parm" "$val" ;; @@ -195,16 +253,13 @@ case "$action" in else val=`/usr/sbin/wlctl -i wl0.$num channel|grep "target channel"|awk -F ' ' '{print$3}'` fi - let num=$num+1 freecwmp_output "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.Channel" "$val" "$permissions" "$type" ;; get_name) permissions="1" - let num=$num+1 freecwmp_output "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.Channel" "$val" "$permissions" ;; get_notification) - let num=$num+1 freecwmp_get_parameter_notification "val" "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.Channel" freecwmp_output "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.Channel" "$val" ;; @@ -222,7 +277,6 @@ case $action in /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q set wireless.@wifi-iface[$num].channel="$val" ;; set_notification) - let num=$num+1 local parm="InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.Channel" freecwmp_set_parameter_notification "$parm" "$val" ;; @@ -238,16 +292,13 @@ local permissions="" case "$action" in get_value) val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get wireless.@wifi-iface[$num].ssid` - let num=$num+1 freecwmp_output "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.SSID" "$val" ;; get_name) permissions="1" - let num=$num+1 freecwmp_output "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.SSID" "$val" "$permissions" ;; get_notification) - let num=$num+1 freecwmp_get_parameter_notification "val" "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.SSID" freecwmp_output "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.SSID" "$val" ;; @@ -266,7 +317,6 @@ case $action in /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q set wireless.@wifi-iface[$num].ssid="$val" ;; set_notification) - let num=$num+1 local parm="InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.SSID" freecwmp_set_parameter_notification "$parm" "$val" ;; @@ -293,16 +343,13 @@ case "$action" in elif [ "$encryption" = "pskmixedpsk2" -o "$encryption" = "wpamixedwpa2" ]; then val="WPAand11i" fi - let num=$num+1 freecwmp_output "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.BeaconType" "$val" ;; get_name) permissions="1" - let num=$num+1 freecwmp_output "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.BeaconType" "$val" "$permissions" ;; get_notification) - let num=$num+1 freecwmp_get_parameter_notification "val" "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.BeaconType" freecwmp_output "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.BeaconType" "$val" ;; @@ -353,7 +400,6 @@ case $action in delay_command "wifi" "5" ;; set_notification) - let num=$num+1 local parm="InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.BeaconType" freecwmp_set_parameter_notification "$parm" "$val" ;; @@ -370,7 +416,6 @@ local permissions="" case "$action" in get_value) val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get wireless.@wifi-device[$num].macfilter 2> /dev/null` - let num=$num+1 if [ "$val" = "2" ]; then val="1" else @@ -380,11 +425,9 @@ case "$action" in ;; get_name) permissions="1" - let num=$num+1 freecwmp_output "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.MACAddressControlEnabled" "$val" "$permissions" ;; get_notification) - let num=$num+1 freecwmp_get_parameter_notification "val" "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.MACAddressControlEnabled" freecwmp_output "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.MACAddressControlEnabled" "$val" ;; @@ -405,12 +448,10 @@ case $action in fi delay_command "wifi" "5" /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q set wireless.@wifi-device[$num].macfilter="$val" - let num=$num+1 local parm="InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.MACAddressControlEnabled" freecwmp_notify "$parm" "$2" "xsd:boolean" ;; set_notification) - let num=$num+1 local parm="InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.MACAddressControlEnabled" freecwmp_set_parameter_notification "$parm" "$val" ;; @@ -426,7 +467,6 @@ local permissions="" case "$action" in get_value) val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get wireless.wl0.hwmode` - let num=$num+1 if [ "$val" = "11b" ]; then val="b" elif [ "$val" = "11bg" ]; then @@ -440,11 +480,9 @@ case "$action" in ;; get_name) permissions="1" - let num=$num+1 freecwmp_output "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.Standard" "$val" "$permissions" ;; get_notification) - let num=$num+1 freecwmp_get_parameter_notification "val" "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.Standard" freecwmp_output "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.Standard" "$val" ;; @@ -469,12 +507,10 @@ case $action in fi delay_command "wifi" "5" /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q set wireless.wl0.hwmode="$val" - let num=$num+1 local parm="InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.Standard" freecwmp_notify "$parm" "$2" "xsd:boolean" ;; set_notification) - let num=$num+1 local parm="InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.Standard" freecwmp_set_parameter_notification "$parm" "$val" ;; @@ -497,16 +533,13 @@ case "$action" in else val="" fi - let num=$num+1 freecwmp_output "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.WEPKeyIndex" "$val" "$permissions" "$type" ;; get_name) permissions="1" - let num=$num+1 freecwmp_output "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.WEPKeyIndex" "$val" "$permissions" ;; get_notification) - let num=$num+1 freecwmp_get_parameter_notification "val" "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.WEPKeyIndex" freecwmp_output "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.WEPKeyIndex" "$val" ;; @@ -529,12 +562,10 @@ case $action in delay_command "wifi" "5" /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q set wireless.@wifi-iface[$num].key="$val" /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q set wireless.@wifi-iface[$num].encryption="wep-shared" - let num=$num+1 local parm="InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.WEPKeyIndex" freecwmp_notify "$parm" "$2" "xsd:unsignedInt" ;; set_notification) - let num=$num+1 local parm="InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.WEPKeyIndex" freecwmp_set_parameter_notification "$parm" "$val" ;; @@ -550,16 +581,13 @@ local type="xsd:string" local permissions="" case "$action" in get_value) - let num=$num+1 freecwmp_output "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.KeyPassphrase" "$val" "$permissions" "$type" ;; get_name) permissions="1" - let num=$num+1 freecwmp_output "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.KeyPassphrase" "$val" "$permissions" ;; get_notification) - let num=$num+1 freecwmp_get_parameter_notification "val" "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.KeyPassphrase" freecwmp_output "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.KeyPassphrase" "$val" ;; @@ -581,12 +609,10 @@ case $action in /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q set wireless.@wifi-iface[$num].key$i="$key" let i++ done - let num=$num+1 local parm="InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.KeyPassphrase" freecwmp_notify "$parm" "$2" "xsd:string" ;; set_notification) - let num=$num+1 local parm="InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.KeyPassphrase" freecwmp_set_parameter_notification "$parm" "$val" ;; @@ -602,16 +628,13 @@ local permissions="" case "$action" in get_value) val="40-bit, 104-bit" - let num=$num+1 freecwmp_output "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.WEPEncryptionLevel" "$val" "$permissions" ;; get_name) permissions="0" - let num=$num+1 freecwmp_output "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.WEPEncryptionLevel" "$val" "$permissions" ;; get_notification) - let num=$num+1 freecwmp_get_parameter_notification "val" "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.WEPEncryptionLevel" freecwmp_output "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.WEPEncryptionLevel" "$val" ;; @@ -631,7 +654,6 @@ case "$action" in else wep=`/usr/sbin/wlctl -i wl0.$num wepstatus` fi - let num=$num+1 if [ "$wep" = "1" ]; then val="WEPEncryption" else @@ -641,11 +663,9 @@ case "$action" in ;; get_name) permissions="1" - let num=$num+1 freecwmp_output "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.BasicEncryptionModes" "$val" "$permissions" ;; get_notification) - let num=$num+1 freecwmp_get_parameter_notification "val" "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.BasicEncryptionModes" freecwmp_output "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.BasicEncryptionModes" "$val" ;; @@ -677,12 +697,10 @@ case $action in /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q set wireless.@wifi-iface[$num].encryption="$val" fi delay_command "wifi" "5" - let num=$num+1 local parm="InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.BasicEncryptionModes" freecwmp_notify "$parm" "$2" "xsd:string" ;; set_notification) - let num=$num+1 local parm="InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.BasicEncryptionModes" freecwmp_set_parameter_notification "$parm" "$val" ;; @@ -704,7 +722,6 @@ case "$action" in wep=`/usr/sbin/wlctl -i wl0.$num wepstatus` auth=`/usr/sbin/wlctl -i wl0.$num auth` fi - let num=$num+1 if [ "$wep" = "1" -a "$auth" = "1" ]; then val="SharedAuthentication" else @@ -714,11 +731,9 @@ case "$action" in ;; get_name) permissions="1" - let num=$num+1 freecwmp_output "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.BasicAuthenticationMode" "$val" "$permissions" ;; get_notification) - let num=$num+1 freecwmp_get_parameter_notification "val" "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.BasicAuthenticationMode" freecwmp_output "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.BasicAuthenticationMode" "$val" ;; @@ -756,12 +771,10 @@ case $action in /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q set wireless.@wifi-iface[$num].encryption="$val" fi delay_command "wifi" "5" - let num=$num+1 local parm="InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.BasicAuthenticationMode" freecwmp_notify "$parm" "$2" "xsd:string" ;; set_notification) - let num=$num+1 local parm="InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.BasicAuthenticationMode" freecwmp_set_parameter_notification "$parm" "$val" ;; @@ -784,7 +797,6 @@ case "$action" in fi wpa=`echo $(($value))` encryption=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get wireless.@wifi-iface[$num].encryption` - let num=$num+1 if [ "$wpa" = "4" -o "$wpa" = "132" ]; then if [ "$encryption" = "psk+tkip" -o "$encryption" = "pskmixedpsk2+tkip" ];then val="TKIPEncryption" @@ -800,11 +812,9 @@ case "$action" in ;; get_name) permissions="1" - let num=$num+1 freecwmp_output "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.WPAEncryptionModes" "$val" "$permissions" ;; get_notification) - let num=$num+1 freecwmp_get_parameter_notification "val" "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.WPAEncryptionModes" freecwmp_output "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.WPAEncryptionModes" "$val" ;; @@ -845,12 +855,10 @@ case $action in /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q set wireless.@wifi-iface[$num].encryption="$val" fi delay_command "wifi" "5" - let num=$num+1 local parm="InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.WPAEncryptionModes" freecwmp_notify "$parm" "$2" "xsd:string" ;; set_notification) - let num=$num+1 local parm="InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.WPAEncryptionModes" freecwmp_set_parameter_notification "$parm" "$val" ;; @@ -871,7 +879,6 @@ case "$action" in value=`/usr/sbin/wlctl -i wl0.$num wpa_auth | awk -F' ' '{print$1}'` fi wpa=`echo $(($value))` - let num=$num+1 if [ "$wpa" = "4" -o "$wpa" = "132" ]; then val="PSKAuthentication" elif [ "$wpa" = "2" -o "$wpa" = "66" ];then @@ -883,11 +890,9 @@ case "$action" in ;; get_name) permissions="1" - let num=$num+1 freecwmp_output "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.WPAAuthenticationMode" "$val" "$permissions" ;; get_notification) - let num=$num+1 freecwmp_get_parameter_notification "val" "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.WPAAuthenticationMode" freecwmp_output "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.WPAAuthenticationMode" "$val" ;; @@ -923,12 +928,10 @@ case $action in /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q set wireless.@wifi-iface[$num].encryption="$val" fi delay_command "wifi" "5" - let num=$num+1 local parm="InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.WPAAuthenticationMode" freecwmp_notify "$parm" "$2" "xsd:string" ;; set_notification) - let num=$num+1 local parm="InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.WPAAuthenticationMode" freecwmp_set_parameter_notification "$parm" "$val" ;; @@ -951,7 +954,6 @@ case "$action" in fi wpa=`echo $(($value))` encryption=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get wireless.@wifi-iface[$num].encryption` - let num=$num+1 if [ "$wpa" = "128" -o "$wpa" = "132" ]; then if [ "$encryption" = "psk2+tkip" -o "$encryption" = "pskmixedpsk2+tkip" ];then val="TKIPEncryption" @@ -967,11 +969,9 @@ case "$action" in ;; get_name) permissions="1" - let num=$num+1 freecwmp_output "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.IEEE11iEncryptionModes" "$val" "$permissions" ;; get_notification) - let num=$num+1 freecwmp_get_parameter_notification "val" "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.IEEE11iEncryptionModes" freecwmp_output "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.IEEE11iEncryptionModes" "$val" ;; @@ -1015,12 +1015,10 @@ case $action in /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q set wireless.@wifi-iface[$num].encryption="$val" fi delay_command "wifi" "5" - let num=$num+1 local parm="InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.IEEE11iEncryptionModes" freecwmp_notify "$parm" "$2" "xsd:string" ;; set_notification) - let num=$num+1 local parm="InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.IEEE11iEncryptionModes" freecwmp_set_parameter_notification "$parm" "$val" ;; @@ -1041,7 +1039,6 @@ case "$action" in value=`/usr/sbin/wlctl -i wl0.$num wpa_auth | awk -F' ' '{print$1}'` fi wpa=`echo $(($value))` - let num=$num+1 if [ "$wpa" = "128" -o "$wpa" = "132" ]; then val="PSKAuthentication" elif [ "$wpa" = "64" -o "$wpa" = "66" ];then @@ -1053,11 +1050,9 @@ case "$action" in ;; get_name) permissions="1" - let num=$num+1 freecwmp_output "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.IEEE11iAuthenticationMode" "$val" "$permissions" ;; get_notification) - let num=$num+1 freecwmp_get_parameter_notification "val" "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.IEEE11iAuthenticationMode" freecwmp_output "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.IEEE11iAuthenticationMode" "$val" ;; @@ -1094,12 +1089,10 @@ case $action in /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q set wireless.@wifi-iface[$num].encryption="$val" fi delay_command "wifi" "5" - let num=$num+1 local parm="InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.IEEE11iAuthenticationMode" freecwmp_notify "$parm" "$2" "xsd:string" ;; set_notification) - let num=$num+1 local parm="InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.IEEE11iAuthenticationMode" freecwmp_set_parameter_notification "$parm" "$val" ;; @@ -1126,16 +1119,13 @@ case "$action" in elif [ "$val" = "1" ];then val=0 fi - let num=$num+1 freecwmp_output "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.RadioEnabled" "$val" "$permissions" "$type" ;; get_name) permissions="1" - let num=$num+1 freecwmp_output "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.RadioEnabled" "$val" "$permissions" ;; get_notification) - let num=$num+1 freecwmp_get_parameter_notification "val" "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.RadioEnabled" freecwmp_output "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.RadioEnabled" "$val" ;; @@ -1160,12 +1150,10 @@ case $action in else /usr/sbin/wlctl -i wl0.$num radio $val fi - let num=$num+1 local parm="InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.RadioEnabled" freecwmp_notify "$parm" "$2" "xsd:boolean" ;; set_notification) - let num=$num+1 local parm="InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.RadioEnabled" freecwmp_set_parameter_notification "$parm" "$val" ;; @@ -1185,16 +1173,13 @@ case "$action" in if [ "$val" = "ap" ];then val="InfrastructureAccessPoint" fi - let num=$num+1 freecwmp_output "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.DeviceOperationMode" "$val" "$permissions" "$type" ;; get_name) permissions="1" - let num=$num+1 freecwmp_output "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.DeviceOperationMode" "$val" "$permissions" ;; get_notification) - let num=$num+1 freecwmp_get_parameter_notification "val" "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.DeviceOperationMode" freecwmp_output "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.DeviceOperationMode" "$val" ;; @@ -1212,12 +1197,10 @@ case $action in if [ "$val" = "InfrastructureAccessPoint" ];then /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q set wireless.@wifi-iface[$num].mode="ap" fi - let num=$num+1 local parm="InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.DeviceOperationMode" freecwmp_notify "$parm" "$2" "xsd:string" ;; set_notification) - let num=$num+1 local parm="InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.DeviceOperationMode" freecwmp_set_parameter_notification "$parm" "$val" ;; @@ -1244,16 +1227,13 @@ case "$action" in else val="None" fi - let num=$num+1 freecwmp_output "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.AuthenticationServiceMode" "$val" "$permissions" "$type" ;; get_name) permissions="1" - let num=$num+1 freecwmp_output "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.AuthenticationServiceMode" "$val" "$permissions" ;; get_notification) - let num=$num+1 freecwmp_get_parameter_notification "val" "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.AuthenticationServiceMode" freecwmp_output "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.AuthenticationServiceMode" "$val" ;; @@ -1273,12 +1253,10 @@ case $action in elif [ "$val" = "RadiusClient" ];then /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q set wireless.@wifi-iface[$num].encryption="wpa" fi - let num=$num+1 local parm="InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.AuthenticationServiceMode" freecwmp_notify "$parm" "$2" "xsd:string" ;; set_notification) - let num=$num+1 local parm="InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.AuthenticationServiceMode" freecwmp_set_parameter_notification "$parm" "$val" ;; @@ -1299,16 +1277,13 @@ case "$action" in else val=`/usr/sbin/wlctl -i wl0.$num assoclist | grep -c 'assoclist'` fi - let num=$num+1 freecwmp_output "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.TotalAssociations" "$val" "$permissions" "$type" ;; get_name) permissions="0" - let num=$num+1 freecwmp_output "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.TotalAssociations" "$val" "$permissions" ;; get_notification) - let num=$num+1 freecwmp_get_parameter_notification "val" "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.TotalAssociations" freecwmp_output "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.TotalAssociations" "$val" ;; @@ -1319,10 +1294,13 @@ get_wlan_associated_device() { local num="$1" local lan_num="$2" local wlan_num="$3" +local id_tab="$4" +local param_name="$5" local val="" local permissions="" local i=0 local assoclist +local found=0 if [ "$num" = "0" ];then assoclist=`/usr/sbin/wlctl -i wl$num assoclist|awk -F' ' '{print $2}'` else @@ -1332,10 +1310,18 @@ case "$action" in get_value) for mac in $assoclist;do let i=$i+1 + if [ "$i" = "$id_tab" -o "$id_tab" = "" ]; then mac_lower=`echo $mac|tr '[A-F]' '[a-f]'` ip=`cat /proc/net/arp|grep $mac_lower|awk -F' ' '{print $1}'` + if [ "$param_name" = "AssociatedDeviceMACAddress" -o "$param_name" = "" ]; then freecwmp_output "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.AssociatedDevice.$i.AssociatedDeviceMACAddress" "$mac" "$permissions" + found=1 + fi + if [ "$param_name" = "AssociatedDeviceIPAddress" -o "$param_name" = "" ]; then freecwmp_output "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.AssociatedDevice.$i.AssociatedDeviceIPAddress" "$ip" "$permissions" + found=1 + fi + if [ "$param_name" = "AssociatedDeviceAuthenticationState" -o "$param_name" = "" ]; then if [ "$num" = "0" ];then is_authenticated=`/usr/sbin/wlctl -i wl$num authe_sta_list|grep $mac` else @@ -1345,6 +1331,12 @@ case "$action" in freecwmp_output "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.AssociatedDevice.$i.AssociatedDeviceAuthenticationState" "0" "$permissions" "xsd:boolean" else freecwmp_output "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.AssociatedDevice.$i.AssociatedDeviceAuthenticationState" "1" "$permissions" "xsd:boolean" + fi + found=1 + fi + if [ "$i" = "$id_tab" ];then + break + fi fi done ;; @@ -1352,23 +1344,59 @@ case "$action" in permissions="0" for mac in $assoclist;do let i=$i+1 + if [ "$id_tab" = "" ]; then + freecwmp_output "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.AssociatedDevice.$i." "" "$permissions" + fi + if [ "$i" = "$id_tab" -o "$id_tab" = "" ]; then + if [ "$param_name" = "AssociatedDeviceMACAddress" -o "$param_name" = "" ]; then freecwmp_output "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.AssociatedDevice.$i.AssociatedDeviceMACAddress" "" "$permissions" + found=1 + fi + if [ "$param_name" = "AssociatedDeviceIPAddress" -o "$param_name" = "" ]; then freecwmp_output "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.AssociatedDevice.$i.AssociatedDeviceIPAddress" "" "$permissions" + found=1 + fi + if [ "$param_name" = "AssociatedDeviceAuthenticationState" -o "$param_name" = "" ]; then freecwmp_output "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.AssociatedDevice.$i.AssociatedDeviceAuthenticationState" "" "$permissions" + found=1 + fi + if [ "$i" = "$id_tab" ];then + break + fi + fi done ;; get_notification) for mac in $assoclist;do let i=$i+1 + if [ "$i" = "$id_tab" -o "$id_tab" = "" ]; then + if [ "$param_name" = "AssociatedDeviceMACAddress" -o "$param_name" = "" ]; then freecwmp_get_parameter_notification "val" "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.AssociatedDevice.$i.AssociatedDeviceMACAddress" freecwmp_output "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.AssociatedDevice.$i.AssociatedDeviceMACAddress" "$val" + found=1 + fi + if [ "$param_name" = "AssociatedDeviceIPAddress" -o "$param_name" = "" ]; then freecwmp_get_parameter_notification "val" "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.AssociatedDevice.$i.AssociatedDeviceIPAddress" freecwmp_output "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.AssociatedDevice.$i.AssociatedDeviceIPAddress" "$val" + found=1 + fi + if [ "$param_name" = "AssociatedDeviceMACAddress" -o "$param_name" = "" ]; then freecwmp_get_parameter_notification "val" "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.AssociatedDevice.$i.AssociatedDeviceAuthenticationState" freecwmp_output "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.AssociatedDevice.$i.AssociatedDeviceAuthenticationState" "$val" + found=1 + fi + if [ "$i" = "$id_tab" ];then + break + fi + fi done ;; esac +if [ "$found" = "1" ];then + return 0 +else + return 1 +fi } get_wlan_wep_key() { @@ -1413,12 +1441,10 @@ case $action in /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q set wireless.@wifi-iface[$num].key$key_index=$val /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q set wireless.@wifi-iface[$num].key="$key_index" /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q set wireless.@wifi-iface[$num].encryption="wep-shared" - let num=$num+1 local parm="InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.WEPKey.$key_index.WEPKey" freecwmp_notify "$parm" "$2" "xsd:string" ;; set_notification) - let num=$num+1 local parm="InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.WEPKey.$key_index.WEPKey" freecwmp_set_parameter_notification "$parm" "$val" ;; @@ -1471,12 +1497,10 @@ case $action in /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q set wireless.@wifi-iface[$num].key=$val /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q set wireless.@wifi-iface[$num].gtk_rekey="3600" /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q set wireless.@wifi-iface[$num].encryption="$val" - let num=$num+1 local parm="InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.PreSharedKey.$key_index.PreSharedKey" freecwmp_notify "$parm" "$2" "xsd:string" ;; set_notification) - let num=$num+1 local parm="InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.PreSharedKey.$key_index.PreSharedKey" freecwmp_set_parameter_notification "$parm" "$val" ;; @@ -1516,12 +1540,10 @@ local val="$5" case $action in set_value) delay_command "wifi" "5" - let num=$num+1 local parm="InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.PreSharedKey.$key_index.KeyPassphrase" freecwmp_notify "$parm" "$2" "xsd:string" ;; set_notification) - let num=$num+1 local parm="InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.PreSharedKey.$key_index.KeyPassphrase" freecwmp_set_parameter_notification "$parm" "$val" ;; @@ -1561,12 +1583,10 @@ local val="$5" case $action in set_value) delay_command "wifi" "5" - let num=$num+1 local parm="InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.PreSharedKey.$key_index.AssociatedDeviceMACAddress" freecwmp_notify "$parm" "$2" "xsd:string" ;; set_notification) - let num=$num+1 local parm="InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$wlan_num.PreSharedKey.$key_index.AssociatedDeviceMACAddress" freecwmp_set_parameter_notification "$parm" "$val" ;; @@ -1718,7 +1738,7 @@ case "${_parm%.*.}." in esac } -get_lan_device() { +get_lan_device_function() { local max_num local max_lan_num @@ -2011,730 +2031,92 @@ case "$1" in return $FAULT_CPE_NO_FAULT ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].Enable) - freecwmp_parse_formated_parameter "$1.$i." "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.Enable" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_enable $uci_num $num1 $i - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "get_wlan_enable" "Enable" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].Status) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.Status" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_status $uci_num $num1 $i - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "get_wlan_status" "Status" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].BSSID) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.BSSID" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_bssid $uci_num $num1 $i - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "get_wlan_bssid" "BSSID" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].MaxBitRate) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.MaxBitRate" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_max_bit_rate $uci_num $num1 $i - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "get_wlan_max_bit_rate" "MaxBitRate" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].Channel) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.Channel" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_channel $uci_num $num1 $i - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "get_wlan_channel" "Channel" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].SSID) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.SSID" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_ssid $uci_num $num1 $i - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "get_wlan_ssid" "SSID" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].BeaconType) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.BeaconType" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_beacon_type $uci_num $num1 $i - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "get_wlan_beacon_type" "BeaconType" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].MACAddressControlEnabled) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.MACAddressControlEnabled" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_mac_control_enable $uci_num $num1 $i - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "get_wlan_mac_control_enable" "MACAddressControlEnabled" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].Standard) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.Standard" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_standard $uci_num $num1 $i - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "get_wlan_standard" "Standard" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].WEPKeyIndex) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.WEPKeyIndex" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_wep_key_index $uci_num $num1 $i - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "get_wlan_wep_key_index" "WEPKeyIndex" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].KeyPassphrase) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.KeyPassphrase" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_key_passphrase $uci_num $num1 $i - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "get_wlan_key_passphrase" "KeyPassphrase" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].WEPEncryptionLevel) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.WEPEncryptionLevel" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_wep_encryption_level $uci_num $num1 $i - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "get_wlan_wep_encryption_level" "WEPEncryptionLevel" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].BasicEncryptionModes) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.BasicEncryptionModes" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_basic_encryption_modes $uci_num $num1 $i - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "get_wlan_basic_encryption_modes" "BasicEncryptionModes" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].BasicAuthenticationMode) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.BasicAuthenticationMode" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_basic_authentication_mode $uci_num $num1 $i - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "get_wlan_basic_authentication_mode" "BasicAuthenticationMode" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].WPAEncryptionModes) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.WPAEncryptionModes" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_wpa_encryption_modes $uci_num $num1 $i - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "get_wlan_wpa_encryption_modes" "WPAEncryptionModes" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].WPAAuthenticationMode) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.WPAAuthenticationMode" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_wpa_authentication_mode $uci_num $num1 $i - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "get_wlan_wpa_authentication_mode" "WPAAuthenticationMode" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].IEEE11iEncryptionModes) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.IEEE11iEncryptionModes" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_ieee_11i_encryption_modes $uci_num $num1 $i - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "get_wlan_ieee_11i_encryption_modes" "IEEE11iEncryptionModes" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].IEEE11iAuthenticationMode) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.IEEE11iAuthenticationMode" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_ieee_11i_authentication_mode $uci_num $num1 $i - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "get_wlan_ieee_11i_authentication_mode" "IEEE11iAuthenticationMode" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].DeviceOperationMode) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.DeviceOperationMode" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_device_operation_mode $uci_num $num1 $i - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "get_wlan_device_operation_mode" "DeviceOperationMode" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].AuthenticationServiceMode) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.AuthenticationServiceMode" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_authentication_service_mode $uci_num $num1 $i - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "get_wlan_authentication_service_mode" "AuthenticationServiceMode" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].RadioEnabled) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.RadioEnabled" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_radio_enabled $uci_num $num1 $i - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "get_wlan_radio_enabled" "RadioEnabled" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].TotalAssociations) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.TotalAssociations" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_total_associations $uci_num $num1 $i - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "get_wlan_total_associations" "TotalAssociations" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].WEPKey.) freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.WEPKey." "rc" "num" @@ -2807,136 +2189,20 @@ case "$1" in return $FAULT_CPE_NO_FAULT ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].WEPKey.1.WEPKey) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.WEPKey.1.WEPKey" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_wep_key $uci_num $num1 $i "1" - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "get_wlan_wep_key" "WEPKey.1.WEPKey" "1" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].WEPKey.2.WEPKey) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.WEPKey.2.WEPKey" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_wep_key $uci_num $num1 $i "2" - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "get_wlan_wep_key" "WEPKey.2.WEPKey" "2" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].WEPKey.3.WEPKey) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.WEPKey.3.WEPKey" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_wep_key $uci_num $num1 $i "3" - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "get_wlan_wep_key" "WEPKey.3.WEPKey" "3" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].WEPKey.4.WEPKey) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.WEPKey.4.WEPKey" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_wep_key $uci_num $num1 $i "4" - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "get_wlan_wep_key" "WEPKey.4.WEPKey" "4" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].PreSharedKey.|\ InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].PreSharedKey.1.) @@ -2973,110 +2239,51 @@ case "$1" in fi done return $FAULT_CPE_NO_FAULT - ;; + ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].PreSharedKey.1.PreSharedKey) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.PreSharedKey.1.PreSharedKey" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_pre_shared_key $uci_num $num1 $i "1" - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "get_wlan_pre_shared_key" "PreSharedKey.1.PreSharedKey" "1" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].PreSharedKey.1.KeyPassphrase) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.PreSharedKey.1.KeyPassphrase" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_pre_shared_key_key_passphrase $uci_num $num1 $i "1" - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "get_wlan_pre_shared_key_key_passphrase" "PreSharedKey.1.KeyPassphrase" "1" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].PreSharedKey.1.AssociatedDeviceMACAddress) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.PreSharedKey.1.AssociatedDeviceMACAddress" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_pre_shared_key_associated_device_MACAddress $uci_num $num1 $i "1" - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "get_wlan_pre_shared_key_associated_device_MACAddress" "PreSharedKey.1.AssociatedDeviceMACAddress" "1" + return $? + ;; + InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].AssociatedDevice.*.AssociatedDeviceMACAddress) + get_associated_device_parameter "$1" "AssociatedDeviceMACAddress" + echo $fault_error + return $? + ;; + InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].AssociatedDevice.*.AssociatedDeviceIPAddress) + get_associated_device_parameter "$1" "AssociatedDeviceIPAddress" + return $? + ;; + InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].AssociatedDevice.*.AssociatedDeviceAuthenticationState) + get_associated_device_parameter "$1" "AssociatedDeviceAuthenticationState" + return $? + ;; + InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].AssociatedDevice.*.) + get_associated_device_parameter "$1" + return $? + ;; + InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].AssociatedDevice.) + get_associated_device_parameter "$1" + return $? ;; esac return $FAULT_CPE_INVALID_PARAMETER_NAME } +get_lan_device() { +local fault_code="" +get_lan_device_function "$1" "$2" +fault_code="$?" +return $fault_code +} + get_lan_device_name() { local max_num local max_lan_num @@ -3094,18 +2301,18 @@ case "$1" in if [ "$2" = "0" ]; then freecwmp_output "InternetGatewayDevice.LANDevice.$lan_num." "" "1" freecwmp_output "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration." "" "1" - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" + i=0 + for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do + let "i++" freecwmp_parse_formated_parameter $1"LANDevice.$lan_num.WLANConfiguration.$i." "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}." "rc" "num" local num1=`echo $num | awk '{ print $1 }'` local num2=`echo $num | awk '{ print $2 }'` - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then + if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then freecwmp_output "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$i." "" "1" get_wlan_enable $uci_num $num1 $i get_wlan_status $uci_num $num1 $i get_wlan_bssid $uci_num $num1 $i - get_wlan_max_bit_rate $uci_num $num1 $i + get_wlan_max_bit_rate $uci_num $num1 $i get_wlan_channel $uci_num $num1 $i get_wlan_ssid $uci_num $num1 $i get_wlan_beacon_type $uci_num $num1 $i @@ -3139,8 +2346,8 @@ case "$1" in get_wlan_pre_shared_key $uci_num $num1 $i "1" get_wlan_pre_shared_key_key_passphrase $uci_num $num1 $i "1" get_wlan_pre_shared_key_associated_device_MACAddress $uci_num $num1 $i "1" - fi - done + fi + done fi done return $FAULT_CPE_NO_FAULT @@ -3154,19 +2361,19 @@ case "$1" in freecwmp_output "InternetGatewayDevice.LANDevice.$lan_num." "" "1" if [ "$2" = "0" ]; then freecwmp_output "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration." "" "1" - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" + i=0 + for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do + let "i++" freecwmp_parse_formated_parameter $1"$lan_num.WLANConfiguration.$i." "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}." "rc" "num" local num1=`echo $num | awk '{ print $1 }'` local num2=`echo $num | awk '{ print $2 }'` - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then + if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then freecwmp_output "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$i." "" "1" get_wlan_enable $uci_num $num1 $i get_wlan_status $uci_num $num1 $i get_wlan_bssid $uci_num $num1 $i get_wlan_max_bit_rate $uci_num $num1 $i - get_wlan_channel $uci_num $num1 $i + get_wlan_channel $uci_num $num1 $i get_wlan_ssid $uci_num $num1 $i get_wlan_beacon_type $uci_num $num1 $i get_wlan_mac_control_enable $uci_num $num1 $i @@ -3199,8 +2406,8 @@ case "$1" in get_wlan_pre_shared_key $uci_num $num1 $i "1" get_wlan_pre_shared_key_key_passphrase $uci_num $num1 $i "1" get_wlan_pre_shared_key_associated_device_MACAddress $uci_num $num1 $i "1" - fi - done + fi + done fi done return $FAULT_CPE_NO_FAULT @@ -3217,20 +2424,20 @@ case "$1" in freecwmp_output "InternetGatewayDevice.LANDevice.$lan_num." "" "1" freecwmp_output "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration." "" "1" if [ "$2" = "0" ]; then - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" + i=0 + for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do + let "i++" freecwmp_parse_formated_parameter $1"WLANConfiguration.$i." "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}." "rc" "num" local num1=`echo $num | awk '{ print $1 }'` local num2=`echo $num | awk '{ print $2 }'` - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then + if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then freecwmp_output "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$i." "" "1" get_wlan_enable $uci_num $num1 $i get_wlan_status $uci_num $num1 $i get_wlan_bssid $uci_num $num1 $i get_wlan_max_bit_rate $uci_num $num1 $i get_wlan_channel $uci_num $num1 $i - get_wlan_ssid $uci_num $num1 $i + get_wlan_ssid $uci_num $num1 $i get_wlan_beacon_type $uci_num $num1 $i get_wlan_mac_control_enable $uci_num $num1 $i get_wlan_standard $uci_num $num1 $i @@ -3264,11 +2471,11 @@ case "$1" in get_wlan_pre_shared_key_associated_device_MACAddress $uci_num $num1 $i "1" fi done - fi + fi if [ $x -eq $lan_num ]; then - break - fi - done + break + fi + done return $FAULT_CPE_NO_FAULT ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.) @@ -3296,7 +2503,7 @@ case "$1" in get_wlan_max_bit_rate $uci_num $num1 $i get_wlan_channel $uci_num $num1 $i get_wlan_ssid $uci_num $num1 $i - get_wlan_beacon_type $uci_num $num1 $i + get_wlan_beacon_type $uci_num $num1 $i get_wlan_mac_control_enable $uci_num $num1 $i get_wlan_standard $uci_num $num1 $i get_wlan_wep_key_index $uci_num $num1 $i @@ -3327,7 +2534,7 @@ case "$1" in get_wlan_pre_shared_key $uci_num $num1 $i "1" get_wlan_pre_shared_key_key_passphrase $uci_num $num1 $i "1" get_wlan_pre_shared_key_associated_device_MACAddress $uci_num $num1 $i "1" - fi + fi fi done if [ $x -eq $lan_num ]; then @@ -3396,7 +2603,7 @@ case "$1" in get_wlan_pre_shared_key $uci_num $num1 $i "1" get_wlan_pre_shared_key_key_passphrase $uci_num $num1 $i "1" get_wlan_pre_shared_key_associated_device_MACAddress $uci_num $num1 $i "1" - fi + fi fi done done @@ -3405,795 +2612,157 @@ case "$1" in InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].Enable) if [ "$2" = "1" ]; then return $FAULT_CPE_INVALID_ARGUMENTS - fi - freecwmp_parse_formated_parameter "$1.$i." "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.Enable" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_enable $uci_num $num1 $i - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "get_wlan_enable" "Enable" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].Status) if [ "$2" = "1" ]; then return $FAULT_CPE_INVALID_ARGUMENTS - fi - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.Status" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_status $uci_num $num1 $i - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "get_wlan_status" "Status" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].BSSID) if [ "$2" = "1" ]; then return $FAULT_CPE_INVALID_ARGUMENTS - fi - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.BSSID" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_bssid $uci_num $num1 $i - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT - ;; + get_set_lan_device_parameter "$1" "get_wlan_bssid" "BSSID" + return $? + ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].MaxBitRate) if [ "$2" = "1" ]; then return $FAULT_CPE_INVALID_ARGUMENTS - fi - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.MaxBitRate" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_max_bit_rate $uci_num $num1 $i - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "get_wlan_max_bit_rate" "MaxBitRate" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].Channel) if [ "$2" = "1" ]; then return $FAULT_CPE_INVALID_ARGUMENTS - fi - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.Channel" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_channel $uci_num $num1 $i - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "get_wlan_channel" "Channel" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].SSID) if [ "$2" = "1" ]; then return $FAULT_CPE_INVALID_ARGUMENTS - fi - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.SSID" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_ssid $uci_num $num1 $i - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "get_wlan_ssid" "SSID" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].BeaconType) if [ "$2" = "1" ]; then return $FAULT_CPE_INVALID_ARGUMENTS - fi - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.BeaconType" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_beacon_type $uci_num $num1 $i - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "get_wlan_beacon_type" "BeaconType" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].MACAddressControlEnabled) if [ "$2" = "1" ]; then return $FAULT_CPE_INVALID_ARGUMENTS - fi - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.MACAddressControlEnabled" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_mac_control_enable $uci_num $num1 $i - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "get_wlan_mac_control_enable" "MACAddressControlEnabled" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].Standard) if [ "$2" = "1" ]; then return $FAULT_CPE_INVALID_ARGUMENTS - fi - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.Standard" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_standard $uci_num $num1 $i - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "get_wlan_standard" "Standard" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].WEPKeyIndex) if [ "$2" = "1" ]; then return $FAULT_CPE_INVALID_ARGUMENTS - fi - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.WEPKeyIndex" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_wep_key_index $uci_num $num1 $i - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "get_wlan_wep_key_index" "WEPKeyIndex" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].KeyPassphrase) if [ "$2" = "1" ]; then return $FAULT_CPE_INVALID_ARGUMENTS - fi - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.KeyPassphrase" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_key_passphrase $uci_num $num1 $i - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "get_wlan_key_passphrase" "KeyPassphrase" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].WEPEncryptionLevel) if [ "$2" = "1" ]; then return $FAULT_CPE_INVALID_ARGUMENTS - fi - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.WEPEncryptionLevel" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_wep_encryption_level $uci_num $num1 $i - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "get_wlan_wep_encryption_level" "WEPEncryptionLevel" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].BasicEncryptionModes) if [ "$2" = "1" ]; then return $FAULT_CPE_INVALID_ARGUMENTS - fi - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.BasicEncryptionModes" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_basic_encryption_modes $uci_num $num1 $i - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "get_wlan_basic_encryption_modes" "BasicEncryptionModes" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].BasicAuthenticationMode) if [ "$2" = "1" ]; then return $FAULT_CPE_INVALID_ARGUMENTS fi - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.BasicAuthenticationMode" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_basic_authentication_mode $uci_num $num1 $i - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "get_wlan_basic_authentication_mode" "BasicAuthenticationMode" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].WPAEncryptionModes) if [ "$2" = "1" ]; then return $FAULT_CPE_INVALID_ARGUMENTS - fi - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.WPAEncryptionModes" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_wpa_encryption_modes $uci_num $num1 $i - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "get_wlan_wpa_encryption_modes" "WPAEncryptionModes" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].WPAAuthenticationMode) if [ "$2" = "1" ]; then return $FAULT_CPE_INVALID_ARGUMENTS - fi - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.WPAAuthenticationMode" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_wpa_authentication_mode $uci_num $num1 $i - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "get_wlan_wpa_authentication_mode" "WPAAuthenticationMode" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].IEEE11iEncryptionModes) if [ "$2" = "1" ]; then return $FAULT_CPE_INVALID_ARGUMENTS - fi - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.IEEE11iEncryptionModes" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_ieee_11i_encryption_modes $uci_num $num1 $i - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "get_wlan_ieee_11i_encryption_modes" "IEEE11iEncryptionModes" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].IEEE11iAuthenticationMode) if [ "$2" = "1" ]; then return $FAULT_CPE_INVALID_ARGUMENTS - fi - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.IEEE11iAuthenticationMode" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_ieee_11i_authentication_mode $uci_num $num1 $i - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT - ;; + get_set_lan_device_parameter "$1" "get_wlan_ieee_11i_authentication_mode" "IEEE11iAuthenticationMode" + return $? + ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].DeviceOperationMode) if [ "$2" = "1" ]; then return $FAULT_CPE_INVALID_ARGUMENTS - fi - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.DeviceOperationMode" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_device_operation_mode $uci_num $num1 $i - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "get_wlan_device_operation_mode" "DeviceOperationMode" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].AuthenticationServiceMode) if [ "$2" = "1" ]; then return $FAULT_CPE_INVALID_ARGUMENTS - fi - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.AuthenticationServiceMode" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_authentication_service_mode $uci_num $num1 $i - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "get_wlan_authentication_service_mode" "AuthenticationServiceMode" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].RadioEnabled) if [ "$2" = "1" ]; then return $FAULT_CPE_INVALID_ARGUMENTS - fi - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.RadioEnabled" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_radio_enabled $uci_num $num1 $i - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "get_wlan_radio_enabled" "RadioEnabled" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].TotalAssociations) if [ "$2" = "1" ]; then return $FAULT_CPE_INVALID_ARGUMENTS - fi - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.TotalAssociations" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_total_associations $uci_num $num1 $i - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT - ;; + get_set_lan_device_parameter "$1" "get_wlan_total_associations" "TotalAssociations" + return $? + ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].WEPKey.) freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.WEPKey." "rc" "num" local num1=`echo $num | awk '{ print $1 }'` @@ -4217,15 +2786,15 @@ case "$1" in freecwmp_output "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$i.WEPKey.3." "" "0" freecwmp_output "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$i.WEPKey.4." "" "0" if [ "$2" = "0" ];then - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 + if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then + let uci_num=$num2-1 get_wlan_wep_key $uci_num $num1 $i "1" get_wlan_wep_key $uci_num $num1 $i "2" get_wlan_wep_key $uci_num $num1 $i "3" get_wlan_wep_key $uci_num $num1 $i "4" - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi + else + return $FAULT_CPE_INVALID_PARAMETER_NAME + fi fi if [ $num2 -eq $i ]; then break @@ -4276,145 +2845,29 @@ case "$1" in if [ "$2" = "1" ]; then return $FAULT_CPE_INVALID_ARGUMENTS fi - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.WEPKey.1.WEPKey" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_wep_key $uci_num $num1 $i "1" - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "get_wlan_wep_key" "WEPKey.1.WEPKey" "1" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].WEPKey.2.WEPKey) if [ "$2" = "1" ]; then return $FAULT_CPE_INVALID_ARGUMENTS fi - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.WEPKey.2.WEPKey" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_wep_key $uci_num $num1 $i "2" - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "get_wlan_wep_key" "WEPKey.2.WEPKey" "2" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].WEPKey.3.WEPKey) if [ "$2" = "1" ]; then return $FAULT_CPE_INVALID_ARGUMENTS fi - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.WEPKey.3.WEPKey" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_wep_key $uci_num $num1 $i "3" - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "get_wlan_wep_key" "WEPKey.3.WEPKey" "3" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].WEPKey.4.WEPKey) if [ "$2" = "1" ]; then return $FAULT_CPE_INVALID_ARGUMENTS fi - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.WEPKey.4.WEPKey" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_wep_key $uci_num $num1 $i "4" - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "get_wlan_wep_key" "WEPKey.4.WEPKey" "4" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].PreSharedKey.) freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.PreSharedKey.1." "rc" "num" @@ -4436,14 +2889,14 @@ case "$1" in freecwmp_output "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$i.PreSharedKey." "" "0" freecwmp_output "InternetGatewayDevice.LANDevice.$lan_num.WLANConfiguration.$i.PreSharedKey.1." "" "0" if [ "$2" = "0" ];then - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 + if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then + let uci_num=$num2-1 get_wlan_pre_shared_key $uci_num $num1 $i "1" get_wlan_pre_shared_key_key_passphrase $uci_num $num1 $i "1" get_wlan_pre_shared_key_associated_device_MACAddress $uci_num $num1 $i "1" - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi + else + return $FAULT_CPE_INVALID_PARAMETER_NAME + fi fi if [ $num2 -eq $i ]; then break @@ -4495,108 +2948,58 @@ case "$1" in if [ "$2" = "1" ]; then return $FAULT_CPE_INVALID_ARGUMENTS fi - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.PreSharedKey.1.PreSharedKey" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_pre_shared_key $uci_num $num1 $i "1" - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "get_wlan_pre_shared_key" "PreSharedKey.1.PreSharedKey" "1" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].PreSharedKey.1.KeyPassphrase) if [ "$2" = "1" ]; then return $FAULT_CPE_INVALID_ARGUMENTS fi - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.PreSharedKey.1.KeyPassphrase" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_pre_shared_key_key_passphrase $uci_num $num1 $i "1" - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "get_wlan_pre_shared_key_key_passphrase" "PreSharedKey.1.KeyPassphrase" "1" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].PreSharedKey.1.AssociatedDeviceMACAddress) if [ "$2" = "1" ]; then return $FAULT_CPE_INVALID_ARGUMENTS fi - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.PreSharedKey.1.AssociatedDeviceMACAddress" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_pre_shared_key_associated_device_MACAddress $uci_num $num1 $i "1" - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done + get_set_lan_device_parameter "$1" "get_wlan_pre_shared_key_associated_device_MACAddress" "PreSharedKey.1.AssociatedDeviceMACAddress" "1" + return $? + ;; + InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].AssociatedDevice.*.AssociatedDeviceMACAddress) + if [ "$2" = "1" ]; then + return $FAULT_CPE_INVALID_ARGUMENTS + fi + get_associated_device_parameter "$1" "AssociatedDeviceMACAddress" + return $? + ;; + InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].AssociatedDevice.*.AssociatedDeviceIPAddress) + if [ "$2" = "1" ]; then + return $FAULT_CPE_INVALID_ARGUMENTS + fi + get_associated_device_parameter "$1" "AssociatedDeviceIPAddress" + return $? + ;; + InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].AssociatedDevice.*.AssociatedDeviceAuthenticationState) + if [ "$2" = "1" ]; then + return $FAULT_CPE_INVALID_ARGUMENTS + fi + get_associated_device_parameter "$1" "AssociatedDeviceAuthenticationState" + return $? + ;; + InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].AssociatedDevice.*.) + freecwmp_output "$1" "" "0" + if [ "$2" = "0" ]; then + get_associated_device_parameter "$1" + return $? + fi + return $FAULT_CPE_NO_FAULT + ;; + InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].AssociatedDevice.) + freecwmp_output "$1" "" "0" + if [ "$2" = "0" ]; then + get_associated_device_parameter "$1" + return $? + fi return $FAULT_CPE_NO_FAULT ;; esac @@ -4604,1362 +3007,10 @@ return $FAULT_CPE_INVALID_PARAMETER_NAME } get_lan_device_notification() { -local max_num -local max_lan_num - -get_wlan_number_of_entries "max_num" -get_lan_number_of_entries "max_lan_num" - -case "$1" in - InternetGatewayDevice.) - get_ip_interface_ip_address - get_ip_interface_netmask - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - freecwmp_parse_formated_parameter $1"LANDevice.$lan_num.WLANConfiguration.$i." "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}." "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - get_wlan_enable $uci_num $num1 $i - get_wlan_status $uci_num $num1 $i - get_wlan_bssid $uci_num $num1 $i - get_wlan_max_bit_rate $uci_num $num1 $i - get_wlan_channel $uci_num $num1 $i - get_wlan_ssid $uci_num $num1 $i - get_wlan_beacon_type $uci_num $num1 $i - get_wlan_mac_control_enable $uci_num $num1 $i - get_wlan_standard $uci_num $num1 $i - get_wlan_wep_key_index $uci_num $num1 $i - get_wlan_key_passphrase $uci_num $num1 $i - get_wlan_wep_encryption_level $uci_num $num1 $i - get_wlan_basic_encryption_modes $uci_num $num1 $i - get_wlan_basic_authentication_mode $uci_num $num1 $i - get_wlan_wpa_encryption_modes $uci_num $num1 $i - get_wlan_wpa_authentication_mode $uci_num $num1 $i - get_wlan_ieee_11i_encryption_modes $uci_num $num1 $i - get_wlan_ieee_11i_authentication_mode $uci_num $num1 $i - get_wlan_radio_enabled $uci_num $num1 $i - get_wlan_device_operation_mode $uci_num $num1 $i - get_wlan_authentication_service_mode $uci_num $num1 $i - get_wlan_total_associations $uci_num $num1 $i - get_wlan_associated_device $uci_num $num1 $i - get_wlan_wep_key $uci_num $num1 $i "1" - get_wlan_wep_key $uci_num $num1 $i "2" - get_wlan_wep_key $uci_num $num1 $i "3" - get_wlan_wep_key $uci_num $num1 $i "4" - get_wlan_pre_shared_key $uci_num $num1 $i "1" - get_wlan_pre_shared_key_key_passphrase $uci_num $num1 $i "1" - get_wlan_pre_shared_key_associated_device_MACAddress $uci_num $num1 $i "1" - fi - done - done - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.LANDevice.) - get_ip_interface_ip_address - get_ip_interface_netmask - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - freecwmp_parse_formated_parameter $1"$lan_num.WLANConfiguration.$i." "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}." "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - get_wlan_enable $uci_num $num1 $i - get_wlan_status $uci_num $num1 $i - get_wlan_bssid $uci_num $num1 $i - get_wlan_max_bit_rate $uci_num $num1 $i - get_wlan_channel $uci_num $num1 $i - get_wlan_ssid $uci_num $num1 $i - get_wlan_beacon_type $uci_num $num1 $i - get_wlan_mac_control_enable $uci_num $num1 $i - get_wlan_standard $uci_num $num1 $i - get_wlan_wep_key_index $uci_num $num1 $i - get_wlan_key_passphrase $uci_num $num1 $i - get_wlan_wep_encryption_level $uci_num $num1 $i - get_wlan_basic_encryption_modes $uci_num $num1 $i - get_wlan_basic_authentication_mode $uci_num $num1 $i - get_wlan_wpa_encryption_modes $uci_num $num1 $i - get_wlan_wpa_authentication_mode $uci_num $num1 $i - get_wlan_ieee_11i_encryption_modes $uci_num $num1 $i - get_wlan_ieee_11i_authentication_mode $uci_num $num1 $i - get_wlan_radio_enabled $uci_num $num1 $i - get_wlan_device_operation_mode $uci_num $num1 $i - get_wlan_authentication_service_mode $uci_num $num1 $i - get_wlan_total_associations $uci_num $num1 $i - get_wlan_associated_device $uci_num $num1 $i - get_wlan_wep_key $uci_num $num1 $i "1" - get_wlan_wep_key $uci_num $num1 $i "2" - get_wlan_wep_key $uci_num $num1 $i "3" - get_wlan_wep_key $uci_num $num1 $i "4" - get_wlan_pre_shared_key $uci_num $num1 $i "1" - get_wlan_pre_shared_key_key_passphrase $uci_num $num1 $i "1" - get_wlan_pre_shared_key_associated_device_MACAddress $uci_num $num1 $i "1" - fi - done - done - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.LANDevice.[1-$max_lan_num].) - get_ip_interface_ip_address - get_ip_interface_netmask - freecwmp_parse_formated_parameter $1 "InternetGatewayDevice.LANDevice.{i}." "rc" "x" - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $x -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - freecwmp_parse_formated_parameter $1"WLANConfiguration.$i." "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}." "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - get_wlan_enable $uci_num $num1 $i - get_wlan_status $uci_num $num1 $i - get_wlan_bssid $uci_num $num1 $i - get_wlan_max_bit_rate $uci_num $num1 $i - get_wlan_channel $uci_num $num1 $i - get_wlan_ssid $uci_num $num1 $i - get_wlan_beacon_type $uci_num $num1 $i - get_wlan_mac_control_enable $uci_num $num1 $i - get_wlan_standard $uci_num $num1 $i - get_wlan_wep_key_index $uci_num $num1 $i - get_wlan_key_passphrase $uci_num $num1 $i - get_wlan_wep_encryption_level $uci_num $num1 $i - get_wlan_basic_encryption_modes $uci_num $num1 $i - get_wlan_basic_authentication_mode $uci_num $num1 $i - get_wlan_wpa_encryption_modes $uci_num $num1 $i - get_wlan_wpa_authentication_mode $uci_num $num1 $i - get_wlan_ieee_11i_encryption_modes $uci_num $num1 $i - get_wlan_ieee_11i_authentication_mode $uci_num $num1 $i - get_wlan_radio_enabled $uci_num $num1 $i - get_wlan_device_operation_mode $uci_num $num1 $i - get_wlan_authentication_service_mode $uci_num $num1 $i - get_wlan_total_associations $uci_num $num1 $i - get_wlan_associated_device $uci_num $num1 $i - get_wlan_wep_key $uci_num $num1 $i "1" - get_wlan_wep_key $uci_num $num1 $i "2" - get_wlan_wep_key $uci_num $num1 $i "3" - get_wlan_wep_key $uci_num $num1 $i "4" - get_wlan_pre_shared_key $uci_num $num1 $i "1" - get_wlan_pre_shared_key_key_passphrase $uci_num $num1 $i "1" - get_wlan_pre_shared_key_associated_device_MACAddress $uci_num $num1 $i "1" - fi - done - if [ $x -eq $lan_num ]; then - break - fi - done - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.LANDevice.[1-$max_lan_num].LANHostConfigManagement.) - get_ip_interface_ip_address - get_ip_interface_netmask - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.LANDevice.[1-$max_lan_num].LANHostConfigManagement.IPInterface.) - get_ip_interface_ip_address - get_ip_interface_netmask - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.LANDevice.[1-$max_lan_num].LANHostConfigManagement.IPInterface.[1-9]+.) - get_ip_interface_ip_address - get_ip_interface_netmask - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.) - freecwmp_parse_formated_parameter $1 "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration." "rc" "x" - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $x -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - freecwmp_parse_formated_parameter "$1$i." "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}." "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - get_wlan_enable $uci_num $num1 $i - get_wlan_status $uci_num $num1 $i - get_wlan_bssid $uci_num $num1 $i - get_wlan_max_bit_rate $uci_num $num1 $i - get_wlan_channel $uci_num $num1 $i - get_wlan_ssid $uci_num $num1 $i - get_wlan_beacon_type $uci_num $num1 $i - get_wlan_mac_control_enable $uci_num $num1 $i - get_wlan_standard $uci_num $num1 $i - get_wlan_wep_key_index $uci_num $num1 $i - get_wlan_key_passphrase $uci_num $num1 $i - get_wlan_wep_encryption_level $uci_num $num1 $i - get_wlan_basic_encryption_modes $uci_num $num1 $i - get_wlan_basic_authentication_mode $uci_num $num1 $i - get_wlan_wpa_encryption_modes $uci_num $num1 $i - get_wlan_wpa_authentication_mode $uci_num $num1 $i - get_wlan_ieee_11i_encryption_modes $uci_num $num1 $i - get_wlan_ieee_11i_authentication_mode $uci_num $num1 $i - get_wlan_radio_enabled $uci_num $num1 $i - get_wlan_device_operation_mode $uci_num $num1 $i - get_wlan_authentication_service_mode $uci_num $num1 $i - get_wlan_total_associations $uci_num $num1 $i - get_wlan_associated_device $uci_num $num1 $i - get_wlan_wep_key $uci_num $num1 $i "1" - get_wlan_wep_key $uci_num $num1 $i "2" - get_wlan_wep_key $uci_num $num1 $i "3" - get_wlan_wep_key $uci_num $num1 $i "4" - get_wlan_pre_shared_key $uci_num $num1 $i "1" - get_wlan_pre_shared_key_key_passphrase $uci_num $num1 $i "1" - get_wlan_pre_shared_key_associated_device_MACAddress $uci_num $num1 $i "1" - fi - done - if [ $x -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}." "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - get_wlan_enable $uci_num $num1 $i - get_wlan_status $uci_num $num1 $i - get_wlan_bssid $uci_num $num1 $i - get_wlan_max_bit_rate $uci_num $num1 $i - get_wlan_channel $uci_num $num1 $i - get_wlan_ssid $uci_num $num1 $i - get_wlan_beacon_type $uci_num $num1 $i - get_wlan_mac_control_enable $uci_num $num1 $i - get_wlan_standard $uci_num $num1 $i - get_wlan_wep_key_index $uci_num $num1 $i - get_wlan_key_passphrase $uci_num $num1 $i - get_wlan_wep_encryption_level $uci_num $num1 $i - get_wlan_basic_encryption_modes $uci_num $num1 $i - get_wlan_basic_authentication_mode $uci_num $num1 $i - get_wlan_wpa_encryption_modes $uci_num $num1 $i - get_wlan_wpa_authentication_mode $uci_num $num1 $i - get_wlan_ieee_11i_encryption_modes $uci_num $num1 $i - get_wlan_ieee_11i_authentication_mode $uci_num $num1 $i - get_wlan_radio_enabled $uci_num $num1 $i - get_wlan_device_operation_mode $uci_num $num1 $i - get_wlan_authentication_service_mode $uci_num $num1 $i - get_wlan_total_associations $uci_num $num1 $i - get_wlan_associated_device $uci_num $num1 $i - get_wlan_wep_key $uci_num $num1 $i "1" - get_wlan_wep_key $uci_num $num1 $i "2" - get_wlan_wep_key $uci_num $num1 $i "3" - get_wlan_wep_key $uci_num $num1 $i "4" - get_wlan_pre_shared_key $uci_num $num1 $i "1" - get_wlan_pre_shared_key_key_passphrase $uci_num $num1 $i "1" - get_wlan_pre_shared_key_associated_device_MACAddress $uci_num $num1 $i "1" - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].Enable) - freecwmp_parse_formated_parameter "$1.$i." "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.Enable" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_enable $uci_num $num1 $i - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].Status) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.Status" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_status $uci_num $num1 $i - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].BSSID) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.BSSID" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_bssid $uci_num $num1 $i - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].MaxBitRate) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.MaxBitRate" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_max_bit_rate $uci_num $num1 $i - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].Channel) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.Channel" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_channel $uci_num $num1 $i - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].SSID) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.SSID" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_ssid $uci_num $num1 $i - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].BeaconType) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.BeaconType" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_beacon_type $uci_num $num1 $i - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].MACAddressControlEnabled) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.MACAddressControlEnabled" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_mac_control_enable $uci_num $num1 $i - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].Standard) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.Standard" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_standard $uci_num $num1 $i - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].WEPKeyIndex) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.WEPKeyIndex" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_wep_key_index $uci_num $num1 $i - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].KeyPassphrase) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.KeyPassphrase" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_key_passphrase $uci_num $num1 $i - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].WEPEncryptionLevel) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.WEPEncryptionLevel" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_wep_encryption_level $uci_num $num1 $i - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].BasicEncryptionModes) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.BasicEncryptionModes" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_basic_encryption_modes $uci_num $num1 $i - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].BasicAuthenticationMode) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.BasicAuthenticationMode" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_basic_authentication_mode $uci_num $num1 $i - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].WPAEncryptionModes) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.WPAEncryptionModes" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_wpa_encryption_modes $uci_num $num1 $i - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].WPAAuthenticationMode) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.WPAAuthenticationMode" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_wpa_authentication_mode $uci_num $num1 $i - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].IEEE11iEncryptionModes) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.IEEE11iEncryptionModes" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_ieee_11i_encryption_modes $uci_num $num1 $i - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].IEEE11iAuthenticationMode) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.IEEE11iAuthenticationMode" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_ieee_11i_authentication_mode $uci_num $num1 $i - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].DeviceOperationMode) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.DeviceOperationMode" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_device_operation_mode $uci_num $num1 $i - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].AuthenticationServiceMode) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.AuthenticationServiceMode" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_authentication_service_mode $uci_num $num1 $i - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].RadioEnabled) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.RadioEnabled" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_radio_enabled $uci_num $num1 $i - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].TotalAssociations) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.TotalAssociations" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_total_associations $uci_num $num1 $i - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].WEPKey.) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.WEPKey." "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_wep_key $uci_num $num1 $i "1" - get_wlan_wep_key $uci_num $num1 $i "2" - get_wlan_wep_key $uci_num $num1 $i "3" - get_wlan_wep_key $uci_num $num1 $i "4" - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].WEPKey.[1-4].) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.WEPKey.{i}." "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - local num3=`echo $num | awk '{ print $3 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_wep_key $uci_num $num1 $i $num3 - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].WEPKey.1.WEPKey) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.WEPKey.1.WEPKey" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_wep_key $uci_num $num1 $i "1" - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].WEPKey.2.WEPKey) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.WEPKey.2.WEPKey" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_wep_key $uci_num $num1 $i "2" - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].WEPKey.3.WEPKey) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.WEPKey.3.WEPKey" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_wep_key $uci_num $num1 $i "3" - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].WEPKey.4.WEPKey) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.WEPKey.4.WEPKey" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_wep_key $uci_num $num1 $i "4" - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].PreSharedKey.|\ - InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].PreSharedKey.1.) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.PreSharedKey.1." "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_pre_shared_key $uci_num $num1 $i "1" - get_wlan_pre_shared_key_key_passphrase $uci_num $num1 $i "1" - get_wlan_pre_shared_key_associated_device_MACAddress $uci_num $num1 $i "1" - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].PreSharedKey.1.PreSharedKey) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.PreSharedKey.1.PreSharedKey" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_pre_shared_key $uci_num $num1 $i "1" - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].PreSharedKey.1.KeyPassphrase) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.PreSharedKey.1.KeyPassphrase" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_pre_shared_key_key_passphrase $uci_num $num1 $i "1" - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].PreSharedKey.1.AssociatedDeviceMACAddress) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.PreSharedKey.1.AssociatedDeviceMACAddress" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - get_wlan_pre_shared_key_associated_device_MACAddress $uci_num $num1 $i "1" - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT - ;; -esac -return $FAULT_CPE_INVALID_PARAMETER_NAME +local fault_code="" +get_lan_device_function "$1" "$2" +fault_code="$?" +return $fault_code } set_lan_device() { @@ -5971,37 +3022,8 @@ get_lan_number_of_entries "max_lan_num" case "$1" in InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].Enable) - freecwmp_parse_formated_parameter "$1.$i." "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.Enable" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - set_wlan_enable $uci_num $num1 $i "$2" - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "set_wlan_enable" "Enable" "$2" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].Status) return $FAULT_CPE_NON_WRITABLE_PARAMETER @@ -6010,802 +3032,106 @@ case "$1" in return $FAULT_CPE_NON_WRITABLE_PARAMETER ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].MaxBitRate) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.MaxBitRate" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - set_wlan_max_bit_rate $uci_num $num1 $i "$2" - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "set_wlan_max_bit_rate" "MaxBitRate" "$2" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].Channel) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.Channel" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - set_wlan_channel $uci_num $num1 $i "$2" - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "set_wlan_channel" "Channel" "$2" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].SSID) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.SSID" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - set_wlan_ssid $uci_num $num1 $i "$2" - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "set_wlan_ssid" "SSID" "$2" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].BeaconType) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.BeaconType" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - set_wlan_beacon_type $uci_num $num1 $i "$2" - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "set_wlan_beacon_type" "BeaconType" "$2" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].MACAddressControlEnabled) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.MACAddressControlEnabled" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - set_wlan_mac_control_enable $uci_num $num1 $i "$2" - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "set_wlan_mac_control_enable" "MACAddressControlEnabled" "$2" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].Standard) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.Standard" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - set_wlan_standard $uci_num $num1 $i "$2" - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "set_wlan_standard" "Standard" "$2" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].WEPKeyIndex) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.WEPKeyIndex" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - set_wlan_wep_key_index $uci_num $num1 $i "$2" - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "set_wlan_wep_key_index" "WEPKeyIndex" "$2" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].KeyPassphrase) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.KeyPassphrase" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - set_wlan_key_passphrase $uci_num $num1 $i "$2" - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "set_wlan_key_passphrase" "KeyPassphrase" "$2" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].WEPEncryptionLevel) return $FAULT_CPE_NON_WRITABLE_PARAMETER ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].BasicEncryptionModes) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.BasicEncryptionModes" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - set_wlan_basic_encryption_modes $uci_num $num1 $i "$2" - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "set_wlan_basic_encryption_modes" "BasicEncryptionModes" "$2" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].BasicAuthenticationMode) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.BasicAuthenticationMode" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - set_wlan_basic_authentication_mode $uci_num $num1 $i "$2" - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "set_wlan_basic_authentication_mode" "BasicAuthenticationMode" "$2" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].WPAEncryptionModes) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.WPAEncryptionModes" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - set_wlan_wpa_encryption_modes $uci_num $num1 $i "$2" - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "set_wlan_wpa_encryption_modes" "WPAEncryptionModes" "$2" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].WPAAuthenticationMode) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.WPAAuthenticationMode" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - set_wlan_wpa_authentication_mode $uci_num $num1 $i "$2" - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "set_wlan_wpa_authentication_mode" "WPAAuthenticationMode" "$2" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].IEEE11iEncryptionModes) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.IEEE11iEncryptionModes" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - set_wlan_ieee_11i_encryption_modes $uci_num $num1 $i "$2" - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "set_wlan_ieee_11i_encryption_modes" "IEEE11iEncryptionModes" "$2" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].IEEE11iAuthenticationMode) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.IEEE11iAuthenticationMode" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - set_wlan_ieee_11i_authentication_mode $uci_num $num1 $i "$2" - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "set_wlan_ieee_11i_authentication_mode" "IEEE11iAuthenticationMode" "$2" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].DeviceOperationMode) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.DeviceOperationMode" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - set_wlan_device_operation_mode $uci_num $num1 $i "$2" - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "set_wlan_device_operation_mode" "DeviceOperationMode" "$2" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].AuthenticationServiceMode) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.AuthenticationServiceMode" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - set_wlan_authentication_service_mode $uci_num $num1 $i "$2" - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "set_wlan_authentication_service_mode" "AuthenticationServiceMode" "$2" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].RadioEnabled) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.RadioEnabled" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - set_wlan_radio_enabled $uci_num $num1 $i "$2" - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "set_wlan_radio_enabled" "RadioEnabled" "$2" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].TotalAssociations) return $FAULT_CPE_NON_WRITABLE_PARAMETER ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].WEPKey.1.WEPKey) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.WEPKey.1.WEPKey" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - set_wlan_wep_key $uci_num $num1 $i "1" "$2" - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "set_wlan_wep_key" "WEPKey.1.WEPKey" "1" "$2" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].WEPKey.2.WEPKey) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.WEPKey.2.WEPKey" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - set_wlan_wep_key $uci_num $num1 $i "2" "$2" - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "set_wlan_wep_key" "WEPKey.2.WEPKey" "2" "$2" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].WEPKey.3.WEPKey) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.WEPKey.3.WEPKey" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - set_wlan_wep_key $uci_num $num1 $i "3" "$2" - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "set_wlan_wep_key" "WEPKey.3.WEPKey" "3" "$2" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].WEPKey.4.WEPKey) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.WEPKey.4.WEPKey" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - set_wlan_wep_key $uci_num $num1 $i "4" "$2" - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "set_wlan_wep_key" "WEPKey.4.WEPKey" "4" "$2" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].PreSharedKey.1.PreSharedKey) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.PreSharedKey.1.PreSharedKey" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - set_wlan_pre_shared_key $uci_num $num1 $i "1" "$2" - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "set_wlan_pre_shared_key" "PreSharedKey.1.PreSharedKey" "1" "$2" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].PreSharedKey.1.KeyPassphrase) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.PreSharedKey.1.KeyPassphrase" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - set_wlan_pre_shared_key_key_passphrase $uci_num $num1 $i "1" "$2" - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "set_wlan_pre_shared_key_key_passphrase" "PreSharedKey.1.KeyPassphrase" "1" "$2" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].PreSharedKey.1.AssociatedDeviceMACAddress) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.PreSharedKey.1.AssociatedDeviceMACAddress" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - set_wlan_pre_shared_key_associated_device_MACAddress $uci_num $num1 $i "1" "$2" - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "set_wlan_pre_shared_key_associated_device_MACAddress" "PreSharedKey.1.AssociatedDeviceMACAddress" "1" "$2" + return $? ;; *) set_ip_interface_ip_address $1 $2 @@ -6969,9 +3295,9 @@ case "$1" in fi done if [ $x -eq $lan_num ]; then - break - fi - done + break + fi + done freecwmp_set_parameter_notification "$1" "$2" return $FAULT_CPE_NO_FAULT ;; @@ -7089,37 +3415,8 @@ case "$1" in return $FAULT_CPE_NO_FAULT ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].Enable) - freecwmp_parse_formated_parameter "$1.$i." "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.Enable" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - set_wlan_enable $uci_num $num1 $i "$2" - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "set_wlan_enable" "Enable" "$2" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].Status) return $FAULT_CPE_NOTIFICATION_REJECTED @@ -7128,837 +3425,106 @@ case "$1" in return $FAULT_CPE_NOTIFICATION_REJECTED ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].MaxBitRate) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.MaxBitRate" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - set_wlan_max_bit_rate $uci_num $num1 $i "$2" - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "set_wlan_max_bit_rate" "MaxBitRate" "$2" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].Channel) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.Channel" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - set_wlan_channel $uci_num $num1 $i "$2" - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "set_wlan_channel" "Channel" "$2" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].SSID) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.SSID" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - set_wlan_ssid $uci_num $num1 $i "$2" - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "set_wlan_ssid" "SSID" "$2" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].BeaconType) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.BeaconType" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - set_wlan_beacon_type $uci_num $num1 $i "$2" - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "set_wlan_beacon_type" "BeaconType" "$2" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].MACAddressControlEnabled) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.MACAddressControlEnabled" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - set_wlan_mac_control_enable $uci_num $num1 $i "$2" - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "set_wlan_mac_control_enable" "MACAddressControlEnabled" "$2" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].Standard) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.Standard" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - set_wlan_standard $uci_num $num1 $i "$2" - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "set_wlan_standard" "Standard" "$2" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].WEPKeyIndex) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.WEPKeyIndex" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - set_wlan_wep_key_index $uci_num $num1 $i "$2" - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "set_wlan_wep_key_index" "WEPKeyIndex" "$2" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].KeyPassphrase) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.KeyPassphrase" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - set_wlan_key_passphrase $uci_num $num1 $i "$2" - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "set_wlan_key_passphrase" "KeyPassphrase" "$2" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].WEPEncryptionLevel) - return $FAULT_CPE_NOTIFICATION_REJECTED + return $FAULT_CPE_NON_WRITABLE_PARAMETER ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].BasicEncryptionModes) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.BasicEncryptionModes" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - set_wlan_basic_encryption_modes $uci_num $num1 $i "$2" - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "set_wlan_basic_encryption_modes" "BasicEncryptionModes" "$2" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].BasicAuthenticationMode) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.BasicAuthenticationMode" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - set_wlan_basic_authentication_mode $uci_num $num1 $i "$2" - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "set_wlan_basic_authentication_mode" "BasicAuthenticationMode" "$2" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].WPAEncryptionModes) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.WPAEncryptionModes" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - set_wlan_wpa_encryption_modes $uci_num $num1 $i "$2" - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "set_wlan_wpa_encryption_modes" "WPAEncryptionModes" "$2" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].WPAAuthenticationMode) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.WPAAuthenticationMode" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - set_wlan_wpa_authentication_mode $uci_num $num1 $i "$2" - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "set_wlan_wpa_authentication_mode" "WPAAuthenticationMode" "$2" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].IEEE11iEncryptionModes) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.IEEE11iEncryptionModes" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - set_wlan_ieee_11i_encryption_modes $uci_num $num1 $i "$2" - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "set_wlan_ieee_11i_encryption_modes" "IEEE11iEncryptionModes" "$2" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].IEEE11iAuthenticationMode) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.IEEE11iAuthenticationMode" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - set_wlan_ieee_11i_authentication_mode $uci_num $num1 $i "$2" - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "set_wlan_ieee_11i_authentication_mode" "IEEE11iAuthenticationMode" "$2" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].DeviceOperationMode) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.DeviceOperationMode" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - set_wlan_device_operation_mode $uci_num $num1 $i "$2" - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "set_wlan_device_operation_mode" "DeviceOperationMode" "$2" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].AuthenticationServiceMode) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.AuthenticationServiceMode" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - set_wlan_authentication_service_mode $uci_num $num1 $i "$2" - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "set_wlan_authentication_service_mode" "AuthenticationServiceMode" "$2" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].RadioEnabled) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.RadioEnabled" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - set_wlan_radio_enabled $uci_num $num1 $i "$2" - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "set_wlan_radio_enabled" "RadioEnabled" "$2" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].TotalAssociations) - return $FAULT_CPE_NOTIFICATION_REJECTED - ;; - InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].WEPKey.) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.WEPKey." "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - freecwmp_set_parameter_notification "InternetGatewayDevice.LANDevice.$num1.WLANConfiguration.$num2.WEPKey.1.WEPKey" "0" - freecwmp_set_parameter_notification "InternetGatewayDevice.LANDevice.$num1.WLANConfiguration.$num2.WEPKey.2.WEPKey" "0" - freecwmp_set_parameter_notification "InternetGatewayDevice.LANDevice.$num1.WLANConfiguration.$num2.WEPKey.3.WEPKey" "0" - freecwmp_set_parameter_notification "InternetGatewayDevice.LANDevice.$num1.WLANConfiguration.$num2.WEPKey.4.WEPKey" "0" - freecwmp_set_parameter_notification "$1" "$2" - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].WEPKey.[1-4].) - freecwmp_set_parameter_notification "$1" "$2" - return $FAULT_CPE_NO_FAULT - ;; + return $FAULT_CPE_NON_WRITABLE_PARAMETER + ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].WEPKey.1.WEPKey) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.WEPKey.1.WEPKey" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - set_wlan_wep_key $uci_num $num1 $i "1" "$2" - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "set_wlan_wep_key" "WEPKey.1.WEPKey" "1" "$2" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].WEPKey.2.WEPKey) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.WEPKey.2.WEPKey" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - set_wlan_wep_key $uci_num $num1 $i "2" "$2" - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "set_wlan_wep_key" "WEPKey.2.WEPKey" "2" "$2" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].WEPKey.3.WEPKey) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.WEPKey.3.WEPKey" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - set_wlan_wep_key $uci_num $num1 $i "3" "$2" - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "set_wlan_wep_key" "WEPKey.3.WEPKey" "3" "$2" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].WEPKey.4.WEPKey) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.WEPKey.4.WEPKey" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - set_wlan_wep_key $uci_num $num1 $i "4" "$2" - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].PreSharedKey.) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.PreSharedKey." "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - freecwmp_set_parameter_notification "InternetGatewayDevice.LANDevice.$num1.WLANConfiguration.$num2.PreSharedKey.1.PreSharedKey" "0" - freecwmp_set_parameter_notification "InternetGatewayDevice.LANDevice.$num1.WLANConfiguration.$num2.PreSharedKey.1.KeyPassphrase" "0" - freecwmp_set_parameter_notification "InternetGatewayDevice.LANDevice.$num1.WLANConfiguration.$num2.PreSharedKey.1.AssociatedDeviceMACAddress" "0" - freecwmp_set_parameter_notification "$1" "$2" - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].PreSharedKey.1.) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.PreSharedKey.1." "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - freecwmp_set_parameter_notification "InternetGatewayDevice.LANDevice.$num1.WLANConfiguration.$num2.PreSharedKey.1.PreSharedKey" "0" - freecwmp_set_parameter_notification "InternetGatewayDevice.LANDevice.$num1.WLANConfiguration.$num2.PreSharedKey.1.KeyPassphrase" "0" - freecwmp_set_parameter_notification "InternetGatewayDevice.LANDevice.$num1.WLANConfiguration.$num2.PreSharedKey.1.AssociatedDeviceMACAddress" "0" - freecwmp_set_parameter_notification "$1" "$2" - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "set_wlan_wep_key" "WEPKey.4.WEPKey" "4" "$2" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].PreSharedKey.1.PreSharedKey) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.PreSharedKey.1.PreSharedKey" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - set_wlan_pre_shared_key $uci_num $num1 $i "1" "$2" - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "set_wlan_pre_shared_key" "PreSharedKey.1.PreSharedKey" "1" "$2" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].PreSharedKey.1.KeyPassphrase) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.PreSharedKey.1.KeyPassphrase" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - set_wlan_pre_shared_key_key_passphrase $uci_num $num1 $i "1" "$2" - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "set_wlan_pre_shared_key_key_passphrase" "PreSharedKey.1.KeyPassphrase" "1" "$2" + return $? ;; InternetGatewayDevice.LANDevice.[1-$max_lan_num].WLANConfiguration.[1-$max_num].PreSharedKey.1.AssociatedDeviceMACAddress) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.LANDevice.{i}.WLANConfiguration.{i}.PreSharedKey.1.AssociatedDeviceMACAddress" "rc" "num" - local num1=`echo $num | awk '{ print $1 }'` - local num2=`echo $num | awk '{ print $2 }'` - for lan in `get_lan_device_interface`;do - lan_num=`echo $lan|cut -f2 -d:` - lan_dev=`echo $lan|cut -f1 -d:` - if [ $num1 -ne $lan_num ]; then - continue - fi - get_wlan_number_of_entries "max_num" $lan_dev - i=0 - for uci_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show wireless|grep $lan_dev|sed -n 's/wireless\.@wifi-iface//p'|sed -n 's/\.network=\w\+ *\w*//p'|sed -n 's/\]//p'|sed -n 's/\[//p'`;do - let "i++" - if [ $num2 -ne $i ]; then - continue - fi - if [ $rc -eq 0 ] && [ $num2 -gt 0 ] && [ $num2 -le $max_num ]; then - let uci_num=$num2-1 - set_wlan_pre_shared_key_associated_device_MACAddress $uci_num $num1 $i "1" "$2" - else - return $FAULT_CPE_INVALID_PARAMETER_NAME - fi - if [ $num2 -eq $i ]; then - break - fi - done - if [ $num1 -eq $lan_num ]; then - continue - fi - done - return $FAULT_CPE_NO_FAULT + get_set_lan_device_parameter "$1" "set_wlan_pre_shared_key_associated_device_MACAddress" "PreSharedKey.1.AssociatedDeviceMACAddress" "1" "$2" + return $? ;; esac return $FAULT_CPE_INVALID_PARAMETER_NAME diff --git a/scripts/functions/management_server b/scripts/functions/management_server index 3a1b569..fe83c44 100644 --- a/scripts/functions/management_server +++ b/scripts/functions/management_server @@ -1,6 +1,7 @@ #!/bin/sh # Copyright (C) 2011-2012 Luka Perkov -# Copyright (C) 2012 Ahmed Zribi +# Copyright (C) 2013 Inteno Broadband Technology AB +# Author Ahmed Zribi get_management_server_url() { local tmp=${FLAGS_value} @@ -78,7 +79,8 @@ local permissions="" local parm="InternetGatewayDevice.ManagementServer.Password" case "$action" in get_value) - val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get cwmp.acs.passwd 2> /dev/null` + # returned value must be empty + val="" ;; get_name) permissions="1" @@ -275,7 +277,8 @@ local parm="InternetGatewayDevice.ManagementServer.ConnectionRequestPassword" local permissions="" case "$action" in get_value) - val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get cwmp.cpe.passwd 2> /dev/null` + # returned value must be empty + val="" ;; get_name) permissions="1" diff --git a/scripts/functions/misc b/scripts/functions/misc index acb711b..2719b54 100644 --- a/scripts/functions/misc +++ b/scripts/functions/misc @@ -1,6 +1,7 @@ #!/bin/sh # Copyright (C) 2012 Luka Perkov -# Copyright (C) 2012 Ahmed Zribi +# Copyright (C) 2013 Inteno Broadband Technology AB +# Author Ahmed Zribi get_misc_cpu_usage() { local val=`uptime | awk -F'average: ' '{ print $2 }' | awk -F',' '{ print $1 }' | awk -F'.' '{ print $2 }'` diff --git a/scripts/functions/voice_service b/scripts/functions/voice_service index 78e672c..13bdea0 100644 --- a/scripts/functions/voice_service +++ b/scripts/functions/voice_service @@ -1,6 +1,139 @@ #!/bin/sh # Copyright (C) 2012 Luka Perkov -# Copyright (C) 2012 Ahmed Zribi +# Copyright (C) 2013 Inteno Broadband Technology AB +# Author Ahmed Zribi + +get_set_voice_service_parameter() { +local parameter="$1" +local function="$2" +local partial_parameter_name="$3" +local args="$4" +local value="$5" + +freecwmp_parse_formated_parameter "$parameter" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.$partial_parameter_name" "rc" "num" +if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $args ]; then + let sip_id=$num-1 + exist=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.sip$sip_id` + if [ "$exist" = "" ];then + return $FAULT_CPE_INVALID_PARAMETER_NAME + fi + $function $sip_id $value +fi +return $FAULT_CPE_NO_FAULT +} + +get_set_line_parameter() { +local parameter="$1" +local function="$2" +local partial_parameter_name="$3" +local args="$4" +local value="$5" + +freecwmp_parse_formated_parameter "$parameter" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.Line.{i}.$partial_parameter_name" "rc" "num" +if [ $rc -eq 0 ]; then + local profile_num=`echo $num | awk '{ print $1 }'` + local line_number=`echo $num | awk '{ print $2 }'` + let sip_id=$profile_num-1 + exist=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.sip$sip_id` + if [ "$exist" = "" ];then + return $FAULT_CPE_INVALID_PARAMETER_NAME + fi + line_instances_list=`get_line_instances_list $profile_num` + local l_inst_found=0 + for line_instance in $line_instances_list;do + if [ "$line_instance" = "$line_number" ];then + l_inst_found=1 + break + fi + done + if [ "$l_inst_found" = "0" ];then + return $FAULT_CPE_INVALID_PARAMETER_NAME + fi + + if [ $profile_num -gt 0 ] && [ $profile_num -le $args ]; then + # Line + local max_line_number=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep brcm|grep instances|awk -F '=' '{print $2'}|cut -f$profile_num -d:|sort -u|tail -1` + let profile_num=$profile_num-1 + if [ $line_number -gt 0 ] && [ $line_number -le $max_line_number ]; then + local count=0 + local found=0 + for line_name in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|grep sip$profile_num$|awk -F'.' '{print$2}'`;do + let p_instance=$profile_num+1 + count=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.instances|cut -f$p_instance -d:` + if [ "$count" = "$line_number" ];then + found=1 + break + fi + done + if [ "$found" = "1" ];then + $function $profile_num $line_name $value + else + return $FAULT_CPE_INVALID_PARAMETER_NAME + fi + else + return $FAULT_CPE_INVALID_PARAMETER_NAME; + fi + else + return $FAULT_CPE_INVALID_PARAMETER_NAME; + fi +fi +return $FAULT_CPE_NO_FAULT +} + +voice_service_save_instance_config() { + local i="$1" #line number + local j="$2" #line profile + local k="$3" #profile number + local line_name="$4" + local instances="" + t=1 + while [ $t -lt $j ];do + if [ "$instances" != "" ];then + instances=$instances:"0" + else + instances="0" + fi + let t++ + done + if [ "$instances" != "" ];then + instances=$instances:"$i" + else + instances="$i" + fi + while [ $t -lt $k ];do + instances=$instances:"0" + let t++ + done + /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q set voice_client.$line_name.instances="$instances" + /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q commit +} + +load_voice() { + local max_profile_number=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep "voice_client.sip"|grep -v sip_service_provider|awk -F '.' '{print $2}'|sort -u|sed 's/sip//g'|tail -1` + let max_profile_number++ + for sip in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep "voice_client.sip"|grep -v sip_service_provider|awk -F '.' '{print $2}'|sort -u`;do + sip_number=`echo $sip|sed 's/sip//g'` + let profile_number=$sip_number+1 + # Line + local line_number="0" + for line_name in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|grep sip$sip_number|awk -F '.' '{print$2}'`;do + let line_number++ + if [ "`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.instances`" = "" ];then + voice_service_save_instance_config "$line_number" "$profile_number" "$max_profile_number" "$line_name" + else + local instances=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.instances` + length=`echo $instances|tr -d -c [0-9] |wc -c` + new_length=`get_voice_profile_max_instance` + for r in `seq $length $new_length`;do + instances=$instances:0 + done + /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q set voice_client.$line_name.instances="$instances" + /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q commit + instances="" + fi + done + done +} # under InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}. @@ -109,7 +242,7 @@ case "$action" in ;; get_name) let num=$num+1 - permissions="1" + permissions="0" freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Name" "$val" "$permissions" "$type" ;; get_notification) @@ -190,7 +323,7 @@ case "$action" in ;; get_name) let num=$num+1 - permissions="1" + permissions="0" freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.MaxSessions" "$val" "$permissions" "$type" ;; get_notification) @@ -214,7 +347,7 @@ case "$action" in ;; get_name) let num=$num+1 - permissions="1" + permissions="0" freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.NumberOfLines" "$val" "$permissions" "$type" ;; get_notification) @@ -275,7 +408,7 @@ local type="xsd:unsignedInt" local permissions="" case "$action" in get_value) - val=`/usr/sbin/asterisk -rx "brcm show status"|grep -c "Default context : sip$num"` + val="" let num=$num+1 freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.ProxyServerPort" "$val" "$permissions" "$type" ;; @@ -752,7 +885,7 @@ local type="xsd:unsignedInt" local permissions="" case "$action" in get_value) - val=`/usr/sbin/asterisk -rx "brcm show status"|grep -c "Default context : sip$num"` + val="" let num=$num+1 freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.InviteExpires" "$val" "$permissions" "$type" ;; @@ -870,7 +1003,7 @@ local type="xsd:unsignedInt" local permissions="" case "$action" in get_value) - val=`/usr/sbin/asterisk -rx "brcm show status"|grep -c "Default context : sip$num"` + val="" let num=$num+1 freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.RegistersMinExpires" "$val" "$permissions" "$type" ;; @@ -1061,7 +1194,7 @@ esac get_line_enable() { local num="$1" local line_name="$2" -local line_num="$3" +local line_num="" local val="" local type="xsd:string" local permissions="" @@ -1069,6 +1202,7 @@ case "$action" in get_value) val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.sip$num.enabled 2> /dev/null` let num=$num+1 + line_num=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.instances|cut -d : -f$num` if [ "$val" = "0" ]; then val="Disabled" else @@ -1078,11 +1212,13 @@ case "$action" in ;; get_name) let num=$num+1 + line_num=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.instances|cut -d : -f$num` permissions="1" freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Line.$line_num.Enable" "$val" "$permissions" "$type" ;; get_notification) let num=$num+1 + line_num=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.instances|cut -d : -f$num` freecwmp_get_parameter_notification "val" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Line.$line_num.Enable" freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Line.$line_num.Enable" "$val" ;; @@ -1092,8 +1228,8 @@ esac set_line_enable() { local num="$1" local line_name="$2" -local line_num="$3" -local val="$4" +local val="$3" +local line_num="" case $action in set_value) if [ "$val" = "Enabled" ]; then @@ -1107,6 +1243,7 @@ case $action in ;; set_notification) let num=$num+1 + line_num=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.instances|cut -d : -f$num` local parm="InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Line.$line_num.Enable" freecwmp_set_parameter_notification "$parm" "$val" ;; @@ -1116,7 +1253,7 @@ esac get_line_directory_number() { local num="$1" local line_name="$2" -local line_num="$3" +local line_num="" local val="" local type="xsd:string" local permissions="" @@ -1124,15 +1261,18 @@ case "$action" in get_value) val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.extension` let num=$num+1 + line_num=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.instances|cut -d : -f$num` freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Line.$line_num.DirectoryNumber" "$val" "$permissions" "$type" ;; get_name) let num=$num+1 + line_num=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.instances|cut -d : -f$num` permissions="1" freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Line.$line_num.DirectoryNumber" "$val" "$permissions" "$type" ;; get_notification) let num=$num+1 + line_num=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.instances|cut -d : -f$num` freecwmp_get_parameter_notification "val" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Line.$line_num.DirectoryNumber" freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Line.$line_num.DirectoryNumber" "$val" ;; @@ -1142,8 +1282,8 @@ esac set_line_directory_number() { local num="$1" local line_name="$2" -local line_num="$3" -local val="$4" +local val="$3" +local line_num="" case $action in set_value) delay_service_restart "voice_client" "5" @@ -1152,6 +1292,7 @@ case $action in ;; set_notification) let num=$num+1 + line_num=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.instances|cut -d : -f$num` local parm="InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Line.$line_num.DirectoryNumber" freecwmp_set_parameter_notification "$parm" "$val" ;; @@ -1161,7 +1302,7 @@ esac get_line_status() { local num="$1" local line_name="$2" -local line_num="$3" +local line_num="" local val="" local type="xsd:string" local permissions="" @@ -1179,15 +1320,18 @@ case "$action" in fi fi let num=$num+1 + line_num=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.instances|cut -d : -f$num` freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Line.$line_num.Status" "$val" "$permissions" "$type" ;; get_name) let num=$num+1 - permissions="1" + line_num=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.instances|cut -d : -f$num` + permissions="0" freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Line.$line_num.Status" "$val" "$permissions" "$type" ;; get_notification) let num=$num+1 + line_num=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.instances|cut -d : -f$num` freecwmp_get_parameter_notification "val" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Line.$line_num.Status" freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Line.$line_num.Status" "$val" ;; @@ -1197,7 +1341,7 @@ esac get_line_call_state() { local num="$1" local line_name="$2" -local line_num="$3" +local line_num="" local val="" local type="xsd:string" local permissions="" @@ -1216,15 +1360,18 @@ case "$action" in val="Ringing" fi let num=$num+1 + line_num=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.instances|cut -d : -f$num` freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Line.$line_num.CallState" "$val" "$permissions" "$type" ;; get_name) let num=$num+1 - permissions="1" + line_num=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.instances|cut -d : -f$num` + permissions="0" freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Line.$line_num.CallState" "$val" "$permissions" "$type" ;; get_notification) let num=$num+1 + line_num=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.instances|cut -d : -f$num` freecwmp_get_parameter_notification "val" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Line.$line_num.CallState" freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Line.$line_num.CallState" "$val" ;; @@ -1234,7 +1381,7 @@ esac get_line_calling_features_caller_id_name() { local num="$1" local line_name="$2" -local line_num="$3" +local line_num="" local val="" local type="xsd:string" local permissions="" @@ -1242,15 +1389,18 @@ case "$action" in get_value) val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.sip$num.displayname` let num=$num+1 + line_num=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.instances|cut -d : -f$num` freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Line.$line_num.CallingFeatures.CallerIDName" "$val" "$permissions" "$type" ;; get_name) let num=$num+1 + line_num=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.instances|cut -d : -f$num` permissions="1" freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Line.$line_num.CallingFeatures.CallerIDName" "$val" "$permissions" "$type" ;; get_notification) let num=$num+1 + line_num=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.instances|cut -d : -f$num` freecwmp_get_parameter_notification "val" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Line.$line_num.CallingFeatures.CallerIDName" freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Line.$line_num.CallingFeatures.CallerIDName" "$val" ;; @@ -1260,8 +1410,8 @@ esac set_line_calling_features_caller_id_name() { local num="$1" local line_name="$2" -local line_num="$3" -local val="$4" +local val="$3" +local line_num="" case $action in set_value) delay_service_restart "voice_client" "5" @@ -1270,18 +1420,100 @@ case $action in ;; set_notification) let num=$num+1 + line_num=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.instances|cut -d : -f$num` local parm="InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Line.$line_num.CallingFeatures.CallerIDName" freecwmp_set_parameter_notification "$parm" "$val" ;; esac } +get_line_x_002207_line_profile() { +local num="$1" +local line_name="$2" +local line_num="" +local val="" +local type="xsd:unsignedInt" +local permissions="" +case "$action" in + get_value) + let num=$num+1 + line_num=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.instances|cut -d : -f$num` + val=$num + freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Line.$line_num.X_002207_LineProfile" "$val" "$permissions" + ;; + get_name) + let num=$num+1 + line_num=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.instances|cut -d : -f$num` + permissions="1" + freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Line.$line_num.X_002207_LineProfile" "$val" "$permissions" "$type" + ;; + get_notification) + let num=$num+1 + line_num=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.instances|cut -d : -f$num` + freecwmp_get_parameter_notification "val" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Line.$line_num.X_002207_LineProfile" + freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Line.$line_num.X_002207_LineProfile" "$val" + ;; +esac +} + +set_line_x_002207_line_profile() { +local num="$1" +local line_name="$2" +local val="$3" +local line_num="" +case $action in + set_value) + delay_service_restart "voice_client" "5" + delay_service_restart "asterisk" "6" + delete_line $line_name + i=`echo $line_name|sed 's/brcm//g'` + let sip_id=$val-1 + add_line "$i" "$sip_id" + instance=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.instances|cut -f $val -d :` + if [ "$instance" = "0" ];then + max_line_instance=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep instances|sort -u|cut -f $val -d :|grep -v 0|tail -1` + let instance=$max_line_instance+1 + local j=0 + for k in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.instances|sed 's/:/ /g'`;do + let j++ + if [ "$j" != "$val" ];then + if [ "$instances" = "" ];then + instances=$k + else + instances=$instances:$k + fi + else + if [ "$instances" = "" ];then + instances=$instance + else + instances=$instances:$instance + fi + fi + done + /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q set voice_client.$line_name.instances="$instances" + fi + call_lines=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.sip$sip_id.call_lines` + if [ "$call_lines" != "" ];then + /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q set voice_client.sip$sip_id.call_lines="$call_lines $i" + else + /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q set voice_client.sip$sip_id.call_lines="$i" + fi + ;; + set_notification) + let num=$num+1 + line_num=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.instances|cut -d : -f$num` + local parm="InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Line.$line_num.X_002207_LineProfile" + freecwmp_set_parameter_notification "$parm" "$val" + ;; +esac +} + #under InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.Line.{i}.SIP. get_line_sip_username() { local num="$1" local line_name="$2" -local line_num="$3" +local line_num="" local val="" local type="xsd:string" local permissions="" @@ -1289,15 +1521,18 @@ case "$action" in get_value) val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.sip$num.authuser 2> /dev/null` let num=$num+1 + line_num=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.instances|cut -d : -f$num` freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Line.$line_num.SIP.AuthUserName" "$val" "$permissions" "$type" ;; get_name) let num=$num+1 + line_num=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.instances|cut -d : -f$num` permissions="1" freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Line.$line_num.SIP.AuthUserName" "$val" "$permissions" "$type" ;; get_notification) let num=$num+1 + line_num=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.instances|cut -d : -f$num` freecwmp_get_parameter_notification "val" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Line.$line_num.SIP.AuthUserName" freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Line.$line_num.SIP.AuthUserName" "$val" ;; @@ -1307,8 +1542,8 @@ esac set_line_sip_username() { local num="$1" local line_name="$2" -local line_num="$3" -local val="$4" +local val="$3" +local line_num="" case $action in set_value) delay_service_restart "voice_client" "5" @@ -1317,7 +1552,8 @@ case $action in ;; set_notification) let num=$num+1 - local parm="InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.1.Line.$num.SIP.AuthUserName" + line_num=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.instances|cut -d : -f$num` + local parm="InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Line.$line_num.SIP.AuthUserName" freecwmp_set_parameter_notification "$parm" "$val" ;; esac @@ -1326,7 +1562,7 @@ esac get_line_sip_password() { local num="$1" local line_name="$2" -local line_num="$3" +local line_num="" local val="" local type="xsd:string" local permissions="" @@ -1334,15 +1570,18 @@ case "$action" in get_value) val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.sip$num.secret 2> /dev/null` let num=$num+1 + line_num=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.instances|cut -d : -f$num` freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Line.$line_num.SIP.AuthPassword" "$val" "$permissions" "$type" ;; get_name) let num=$num+1 + line_num=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.instances|cut -d : -f$num` permissions="1" freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Line.$line_num.SIP.AuthPassword" "$val" "$permissions" "$type" ;; get_notification) let num=$num+1 + line_num=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.instances|cut -d : -f$num` freecwmp_get_parameter_notification "val" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Line.$line_num.SIP.AuthPassword" freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Line.$line_num.SIP.AuthPassword" "$val" ;; @@ -1352,8 +1591,8 @@ esac set_line_sip_password() { local num="$1" local line_name="$2" -local line_num="$3" -local val="$4" +local val="$3" +local line_num="" case $action in set_value) delay_service_restart "voice_client" "5" @@ -1362,7 +1601,8 @@ case $action in ;; set_notification) let num=$num+1 - local parm="InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.1.Line.$num.SIP.AuthPassword" + line_num=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.instances|cut -d : -f$num` + local parm="InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Line.$line_num.SIP.AuthPassword" freecwmp_set_parameter_notification "$parm" "$val" ;; esac @@ -1371,7 +1611,7 @@ esac get_line_sip_uri() { local num="$1" local line_name="$2" -local line_num="$3" +local line_num="" local val="" local domain="" local username="" @@ -1382,6 +1622,7 @@ case "$action" in domain=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.sip$num.domain 2> /dev/null` username=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.sip$num.user 2> /dev/null` let num=$num+1 + line_num=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.instances|cut -d : -f$num` if [ "$domain" != "" -a "$username" != "" ];then freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Line.$line_num.SIP.URI" "$username@$domain" "$permissions" "$type" else @@ -1390,11 +1631,13 @@ case "$action" in ;; get_name) let num=$num+1 + line_num=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.instances|cut -d : -f$num` permissions="1" freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Line.$line_num.SIP.URI" "$val" "$permissions" "$type" ;; get_notification) let num=$num+1 + line_num=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.instances|cut -d : -f$num` freecwmp_get_parameter_notification "val" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Line.$line_num.SIP.URI" freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Line.$line_num.SIP.URI" "$val" ;; @@ -1404,8 +1647,8 @@ esac set_line_sip_uri() { local num="$1" local line_name="$2" -local line_num="$3" -local val="$4" +local val="$3" +local line_num="" case $action in set_value) delay_service_restart "voice_client" "5" @@ -1419,7 +1662,8 @@ case $action in ;; set_notification) let num=$num+1 - local parm="InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Line.$num.SIP.URI" + line_num=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.instances|cut -d : -f$num` + local parm="InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Line.$line_num.SIP.URI" freecwmp_set_parameter_notification "$parm" "$val" ;; esac @@ -1434,12 +1678,12 @@ get_voice_service_max_profile() { } get_voice_service_max_line() { - local val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep -c brcm_line` + local val=`/usr/sbin/asterisk -rx "brcm show status"|grep -c "Line id"` let val=$val-1 eval "export -- \"$1=$val\"" } -get_voice_service() { +get_voice_service_function() { local max_profile local max_line local max_num @@ -1455,7 +1699,7 @@ case "$1" in InternetGatewayDevice.Services.VoiceService.|\ InternetGatewayDevice.Services.VoiceService.1.|\ InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.) - for profile_num in `seq 0 $max_profile`;do + for profile_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep "voice_client.sip"|grep -v sip_service_provider|awk -F '.' '{print $2}'|sed 's/sip//g'|sort -un`;do get_voice_profile_enable $profile_num get_voice_profile_reset $profile_num get_voice_profile_name $profile_num @@ -1484,24 +1728,32 @@ case "$1" in # get_sip_inbound_auth_username $profile_num # get_sip_inbound_auth_password $profile_num # Line - local line_number="0" - for line_name in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|grep sip$profile_num|awk -F'.' '{print$2}'`;do - let line_number=$line_number+1 - get_line_enable $profile_num $line_name $line_number - get_line_directory_number $profile_num $line_name $line_number - get_line_status $profile_num $line_name $line_number - get_line_call_state $profile_num $line_name $line_number - get_line_calling_features_caller_id_name $profile_num $line_name $line_number - get_line_sip_username $profile_num $line_name $line_number - get_line_sip_password $profile_num $line_name $line_number - get_line_sip_uri $profile_num $line_name $line_number + for line_name in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|grep sip$profile_num$|awk -F'.' '{print$2}'`;do + line_id=`echo $line_name|sed 's/brcm//g'` + if [ $line_id -gt $max_line ];then + continue + fi + get_line_enable $profile_num $line_name + get_line_directory_number $profile_num $line_name + get_line_status $profile_num $line_name + get_line_call_state $profile_num $line_name + get_line_calling_features_caller_id_name $profile_num $line_name + get_line_x_002207_line_profile $profile_num $line_name + get_line_sip_username $profile_num $line_name + get_line_sip_password $profile_num $line_name + get_line_sip_uri $profile_num $line_name done done return $FAULT_CPE_NO_FAULT ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].) + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.) freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}." "rc" "num" if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then + let sip_id=$num-1 + exist=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.sip$sip_id` + if [ "$exist" = "" ];then + return $FAULT_CPE_INVALID_PARAMETER_NAME + fi let profile_num=$num-1 get_voice_profile_enable $profile_num get_voice_profile_reset $profile_num @@ -1531,24 +1783,32 @@ case "$1" in # get_sip_inbound_auth_username $profile_num # get_sip_inbound_auth_password $profile_num # Line - local line_number="0" - for line_name in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|grep sip$profile_num|awk -F'.' '{print$2}'`;do - let line_number=$line_number+1 - get_line_enable $profile_num $line_name $line_number - get_line_directory_number $profile_num $line_name $line_number - get_line_status $profile_num $line_name $line_number - get_line_call_state $profile_num $line_name $line_number - get_line_calling_features_caller_id_name $profile_num $line_name $line_number - get_line_sip_username $profile_num $line_name $line_number - get_line_sip_password $profile_num $line_name $line_number - get_line_sip_uri $profile_num $line_name $line_number + for line_name in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|grep sip$profile_num$|awk -F'.' '{print$2}'`;do + line_id=`echo $line_name|sed 's/brcm//g'` + if [ $line_id -gt $max_line ];then + continue + fi + get_line_enable $profile_num $line_name + get_line_directory_number $profile_num $line_name + get_line_status $profile_num $line_name + get_line_call_state $profile_num $line_name + get_line_calling_features_caller_id_name $profile_num $line_name + get_line_x_002207_line_profile $profile_num $line_name + get_line_sip_username $profile_num $line_name + get_line_sip_password $profile_num $line_name + get_line_sip_uri $profile_num $line_name done fi return $FAULT_CPE_NO_FAULT ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.) + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.) freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP." "rc" "num" if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then + let sip_id=$num-1 + exist=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.sip$sip_id` + if [ "$exist" = "" ];then + return $FAULT_CPE_INVALID_PARAMETER_NAME + fi let profile_num=$num-1 get_sip_proxy_server $profile_num get_sip_proxy_server_port $profile_num @@ -1574,271 +1834,201 @@ case "$1" in fi return $FAULT_CPE_NO_FAULT ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].Enable) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.Enable" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - get_voice_profile_enable $profile_num - fi - return $FAULT_CPE_NO_FAULT + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Enable) + get_set_voice_service_parameter "$1" "get_voice_profile_enable" "Enable" "$max_num" + return $? ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].Reset) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.Reset" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - get_voice_profile_reset $profile_num - fi - return $FAULT_CPE_NO_FAULT + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Reset) + get_set_voice_service_parameter "$1" "get_voice_profile_reset" "Reset" "$max_num" + return $? ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].Name) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.Name" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - get_voice_profile_name $profile_num - fi - return $FAULT_CPE_NO_FAULT + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Name) + get_set_voice_service_parameter "$1" "get_voice_profile_name" "Name" "$max_num" + return $? ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SignalingProtocol) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SignalingProtocol" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - get_voice_profile_signaling_protocol $profile_num - fi - return $FAULT_CPE_NO_FAULT + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SignalingProtocol) + get_set_voice_service_parameter "$1" "get_voice_profile_signaling_protocol" "SignalingProtocol" "$max_num" + return $? ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].MaxSessions) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.MaxSessions" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - get_voice_profile_max_sessions $profile_num - fi - return $FAULT_CPE_NO_FAULT + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.MaxSessions) + get_set_voice_service_parameter "$1" "get_voice_profile_max_sessions" "MaxSessions" "$max_num" + return $? ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].NumberOfLines) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.NumberOfLines" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - get_voice_profile_number_of_lines $profile_num - fi - return $FAULT_CPE_NO_FAULT + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.NumberOfLines) + get_set_voice_service_parameter "$1" "get_voice_profile_number_of_lines" "NumberOfLines" "$max_num" + return $? ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.ProxyServer) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.ProxyServer" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - get_sip_proxy_server $profile_num - fi - return $FAULT_CPE_NO_FAULT + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.ProxyServer) + get_set_voice_service_parameter "$1" "get_sip_proxy_server" "SIP.ProxyServer" "$max_num" + return $? ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.ProxyServerPort) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.ProxyServerPort" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - get_sip_proxy_server_port $profile_num - fi - return $FAULT_CPE_NO_FAULT + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.ProxyServerPort) + get_set_voice_service_parameter "$1" "get_sip_proxy_server_port" "SIP.ProxyServerPort" "$max_num" + return $? ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.ProxyServerTransport) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.ProxyServerTransport" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - get_sip_proxy_server_transport $profile_num - fi - return $FAULT_CPE_NO_FAULT + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.ProxyServerTransport) + get_set_voice_service_parameter "$1" "get_sip_proxy_server_transport" "SIP.ProxyServerTransport" "$max_num" + return $? ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.RegistrarServer) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.RegistrarServer" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - get_sip_registrar_server $profile_num - fi - return $FAULT_CPE_NO_FAULT + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.RegistrarServer) + get_set_voice_service_parameter "$1" "get_sip_registrar_server" "SIP.RegistrarServer" "$max_num" + return $? ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.RegistrarServerPort) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.RegistrarServerPort" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - get_sip_registrar_server_port $profile_num - fi - return $FAULT_CPE_NO_FAULT + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.RegistrarServerPort) + get_set_voice_service_parameter "$1" "get_sip_registrar_server_port" "SIP.RegistrarServerPort" "$max_num" + return $? ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.RegistrarServerTransport) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.RegistrarServerTransport" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - get_sip_registrar_server_transport $profile_num - fi - return $FAULT_CPE_NO_FAULT + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.RegistrarServerTransport) + get_set_voice_service_parameter "$1" "get_sip_registrar_server_transport" "SIP.RegistrarServerTransport" "$max_num" + return $? ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.UserAgentDomain) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.UserAgentDomain" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - get_sip_user_agent_domain $profile_num - fi - return $FAULT_CPE_NO_FAULT + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.UserAgentDomain) + get_set_voice_service_parameter "$1" "get_sip_user_agent_domain" "SIP.UserAgentDomain" "$max_num" + return $? ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.UserAgentPort) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.UserAgentPort" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - get_sip_user_agent_port $profile_num - fi - return $FAULT_CPE_NO_FAULT + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.UserAgentPort) + get_set_voice_service_parameter "$1" "get_sip_user_agent_port" "SIP.UserAgentPort" "$max_num" + return $? ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.UserAgentTransport) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.UserAgentTransport" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - get_sip_user_agent_transport $profile_num - fi - return $FAULT_CPE_NO_FAULT + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.UserAgentTransport) + get_set_voice_service_parameter "$1" "get_sip_user_agent_transport" "SIP.UserAgentTransport" "$max_num" + return $? ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.OutboundProxy) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.OutboundProxy" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - get_sip_outbound_proxy $profile_num - fi - return $FAULT_CPE_NO_FAULT + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.OutboundProxy) + get_set_voice_service_parameter "$1" "get_sip_outbound_proxy" "SIP.OutboundProxy" "$max_num" + return $? ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.OutboundProxyPort) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.OutboundProxyPort" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - get_sip_outbound_proxy_port $profile_num - fi - return $FAULT_CPE_NO_FAULT + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.OutboundProxyPort) + get_set_voice_service_parameter "$1" "get_sip_outbound_proxy_port" "SIP.OutboundProxyPort" "$max_num" + return $? ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.Organization) + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.Organization) return $FAULT_CPE_INVALID_PARAMETER_NAME - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.Organization" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - get_sip_organization $profile_num - fi - return $FAULT_CPE_NO_FAULT + get_set_voice_service_parameter "$1" "get_sip_organization" "SIP.Organization" "$max_num" + return $? ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.RegistrationPeriod) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.RegistrationPeriod" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - get_sip_registration_period $profile_num - fi - return $FAULT_CPE_NO_FAULT + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.RegistrationPeriod) + get_set_voice_service_parameter "$1" "get_sip_registration_period" "SIP.RegistrationPeriod" "$max_num" + return $? ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.InviteExpires) + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.InviteExpires) return $FAULT_CPE_INVALID_PARAMETER_NAME - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.InviteExpires" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - get_sip_invite_expires $profile_num - fi - return $FAULT_CPE_NO_FAULT + get_set_voice_service_parameter "$1" "get_sip_invite_expires" "SIP.InviteExpires" "$max_num" + return $? ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.ReInviteExpires) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.ReInviteExpires" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - get_sip_re_invite_expires $profile_num - fi - return $FAULT_CPE_NO_FAULT + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.ReInviteExpires) + get_set_voice_service_parameter "$1" "get_sip_re_invite_expires" "SIP.ReInviteExpires" "$max_num" + return $? ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.RegisterExpires) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.RegisterExpires" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - get_sip_register_expires $profile_num - fi - return $FAULT_CPE_NO_FAULT + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.RegisterExpires) + get_set_voice_service_parameter "$1" "get_sip_register_expires" "SIP.RegisterExpires" "$max_num" + return $? ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.RegistersMinExpires) + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.RegistersMinExpires) return $FAULT_CPE_INVALID_PARAMETER_NAME - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.RegistersMinExpires" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - get_sip_registers_min_expires $profile_num - fi - return $FAULT_CPE_NO_FAULT + get_set_voice_service_parameter "$1" "get_sip_registers_min_expires" "SIP.RegistersMinExpires" "$max_num" + return $? ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.RegisterRetryInterval) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.RegisterRetryInterval" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - get_sip_register_retry_interval $profile_num - fi - return $FAULT_CPE_NO_FAULT + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.RegisterRetryInterval) + get_set_voice_service_parameter "$1" "get_sip_register_retry_interval" "SIP.RegisterRetryInterval" "$max_num" + return $? ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.InboundAuth) + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.InboundAuth) return $FAULT_CPE_INVALID_PARAMETER_NAME - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.InboundAuth" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - get_sip_inbound_auth $profile_num - fi - return $FAULT_CPE_NO_FAULT + get_set_voice_service_parameter "$1" "get_sip_inbound_auth" "SIP.InboundAuth" "$max_num" + return $? ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.InboundAuthUsername) + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.InboundAuthUsername) return $FAULT_CPE_INVALID_PARAMETER_NAME - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.InboundAuthUsername" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - get_sip_inbound_auth_username $profile_num - fi - return $FAULT_CPE_NO_FAULT + get_set_voice_service_parameter "$1" "get_sip_inbound_auth_username" "SIP.InboundAuthUsername" "$max_num" + return $? ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.InboundAuthPassword) + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.InboundAuthPassword) return $FAULT_CPE_INVALID_PARAMETER_NAME - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.InboundAuthPassword" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - get_sip_inbound_auth_password $profile_num - fi - return $FAULT_CPE_NO_FAULT + get_set_voice_service_parameter "$1" "get_sip_inbound_auth_password" "SIP.InboundAuthPassword" "$max_num" + return $? ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].Line.) + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.) freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.Line." "rc" "num" if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then + let sip_id=$num-1 + exist=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.sip$sip_id` + if [ "$exist" = "" ];then + return $FAULT_CPE_INVALID_PARAMETER_NAME + fi let profile_num=$num-1 # Line - local line_number="0" - for line_name in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|grep sip$profile_num|awk -F'.' '{print$2}'`;do - let line_number=$line_number+1 - get_line_enable $profile_num $line_name $line_number - get_line_directory_number $profile_num $line_name $line_number - get_line_status $profile_num $line_name $line_number - get_line_call_state $profile_num $line_name $line_number - get_line_calling_features_caller_id_name $profile_num $line_name $line_number - get_line_sip_username $profile_num $line_name $line_number - get_line_sip_password $profile_num $line_name $line_number - get_line_sip_uri $profile_num $line_name $line_number + for line_name in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|grep sip$profile_num$|awk -F'.' '{print$2}'`;do + line_id=`echo $line_name|sed 's/brcm//g'` + if [ $line_id -gt $max_line ];then + continue + fi + get_line_enable $profile_num $line_name + get_line_directory_number $profile_num $line_name + get_line_status $profile_num $line_name + get_line_call_state $profile_num $line_name + get_line_calling_features_caller_id_name $profile_num $line_name + get_line_x_002207_line_profile $profile_num $line_name + get_line_sip_username $profile_num $line_name + get_line_sip_password $profile_num $line_name + get_line_sip_uri $profile_num $line_name done fi return $FAULT_CPE_NO_FAULT ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].Line.[1-$max_line].) + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.) freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.Line.{i}." "rc" "num" if [ $rc -eq 0 ]; then local profile_num=`echo $num | awk '{ print $1 }'` local line_number=`echo $num | awk '{ print $2 }'` + let sip_id=$profile_num-1 + exist=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.sip$sip_id` + if [ "$exist" = "" ];then + return $FAULT_CPE_INVALID_PARAMETER_NAME + fi + line_instances_list=`get_line_instances_list $profile_num` + local l_inst_found=0 + for line_instance in $line_instances_list;do + if [ "$line_instance" = "$line_number" ];then + l_inst_found=1 + break + fi + done + if [ "$l_inst_found" = "0" ];then + return $FAULT_CPE_INVALID_PARAMETER_NAME + fi if [ $profile_num -gt 0 ] && [ $profile_num -le $max_num ]; then - let profile_num=$profile_num-1 # Line - local max_line_number=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep brcm|grep -c sip$profile_num` + local max_line_number=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep brcm|grep instances|awk -F '=' '{print $2'}|cut -f$profile_num -d:|sort -u|tail -1` + let profile_num=$profile_num-1 if [ $line_number -gt 0 ] && [ $line_number -le $max_line_number ]; then local count=0 - for line_name in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|grep sip$profile_num|awk -F'.' '{print$2}'`;do - let count=$count+1 - if [ "$count" = "$line_number" ];then break;fi + local found=0 + for line_name in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|grep sip$profile_num$|awk -F'.' '{print$2}'`;do + line_id=`echo $line_name|sed 's/brcm//g'` + if [ $line_id -gt $max_line ];then + continue + fi + let p_instance=$profile_num+1 + count=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client.$line_name.instances|cut -f$p_instance -d:` + if [ "$count" = "$line_number" ];then + found=1 + break + fi done - get_line_enable $profile_num $line_name $line_number - get_line_directory_number $profile_num $line_name $line_number - get_line_status $profile_num $line_name $line_number - get_line_call_state $profile_num $line_name $line_number - get_line_calling_features_caller_id_name $profile_num $line_name $line_number - get_line_sip_username $profile_num $line_name $line_number - get_line_sip_password $profile_num $line_name $line_number - get_line_sip_uri $profile_num $line_name $line_number + if [ "$found" = "1" ];then + get_line_enable $profile_num $line_name + get_line_directory_number $profile_num $line_name + get_line_status $profile_num $line_name + get_line_call_state $profile_num $line_name + get_line_calling_features_caller_id_name $profile_num $line_name + get_line_x_002207_line_profile $profile_num $line_name + get_line_sip_username $profile_num $line_name + get_line_sip_password $profile_num $line_name + get_line_sip_uri $profile_num $line_name + else + return $FAULT_CPE_INVALID_PARAMETER_NAME + fi else return $FAULT_CPE_INVALID_PARAMETER_NAME; fi @@ -1848,122 +2038,67 @@ case "$1" in fi return $FAULT_CPE_NO_FAULT ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].Line.[1-$max_line].Enable) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.Line.{i}.Enable" "rc" "num" - if [ $rc -eq 0 ]; then - local profile_num=`echo $num | awk '{ print $1 }'` - local line_number=`echo $num | awk '{ print $2 }'` - if [ $profile_num -gt 0 ] && [ $profile_num -le $max_num ]; then - let profile_num=$profile_num-1 - # Line - local max_line_number=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep brcm|grep -c sip$profile_num` - if [ $line_number -gt 0 ] && [ $line_number -le $max_line_number ]; then - local count=0 - for line_name in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|grep sip$profile_num|awk -F'.' '{print$2}'`;do - let count=$count+1 - if [ "$count" = "$line_number" ];then break;fi - done - get_line_enable $profile_num $line_name $line_number - else - return $FAULT_CPE_INVALID_PARAMETER_NAME; - fi - else - return $FAULT_CPE_INVALID_PARAMETER_NAME; - fi - fi - return $FAULT_CPE_NO_FAULT + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.Enable) + get_set_line_parameter "$1" "get_line_enable" "Enable" "$max_num" + return $? ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].Line.[1-$max_line].DirectoryNumber) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.Line.{i}.DirectoryNumber" "rc" "num" - if [ $rc -eq 0 ]; then - local profile_num=`echo $num | awk '{ print $1 }'` - local line_number=`echo $num | awk '{ print $2 }'` - if [ $profile_num -gt 0 ] && [ $profile_num -le $max_num ]; then - let profile_num=$profile_num-1 - # Line - local max_line_number=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep brcm|grep -c sip$profile_num` - if [ $line_number -gt 0 ] && [ $line_number -le $max_line_number ]; then - local count=0 - for line_name in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|grep sip$profile_num|awk -F'.' '{print$2}'`;do - let count=$count+1 - if [ "$count" = "$line_number" ];then break;fi - done - get_line_directory_number $profile_num $line_name $line_number - else - return $FAULT_CPE_INVALID_PARAMETER_NAME; - fi - else - return $FAULT_CPE_INVALID_PARAMETER_NAME; - fi - fi - return $FAULT_CPE_NO_FAULT + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.DirectoryNumber) + get_set_line_parameter "$1" "get_line_directory_number" "DirectoryNumber" "$max_num" + return $? ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].Line.[1-$max_line].Status) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.Line.{i}.Status" "rc" "num" - if [ $rc -eq 0 ]; then - local profile_num=`echo $num | awk '{ print $1 }'` - local line_number=`echo $num | awk '{ print $2 }'` - if [ $profile_num -gt 0 ] && [ $profile_num -le $max_num ]; then - let profile_num=$profile_num-1 - # Line - local max_line_number=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep brcm|grep -c sip$profile_num` - if [ $line_number -gt 0 ] && [ $line_number -le $max_line_number ]; then - local count=0 - for line_name in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|grep sip$profile_num|awk -F'.' '{print$2}'`;do - let count=$count+1 - if [ "$count" = "$line_number" ];then break;fi - done - get_line_status $profile_num $line_name $line_number - else - return $FAULT_CPE_INVALID_PARAMETER_NAME; - fi - else - return $FAULT_CPE_INVALID_PARAMETER_NAME; - fi - fi - return $FAULT_CPE_NO_FAULT + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.Status) + get_set_line_parameter "$1" "get_line_status" "Status" "$max_num" + return $? ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].Line.[1-$max_line].CallState) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.Line.{i}.CallState" "rc" "num" - if [ $rc -eq 0 ]; then - local profile_num=`echo $num | awk '{ print $1 }'` - local line_number=`echo $num | awk '{ print $2 }'` - if [ $profile_num -gt 0 ] && [ $profile_num -le $max_num ]; then - let profile_num=$profile_num-1 - # Line - local max_line_number=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep brcm|grep -c sip$profile_num` - if [ $line_number -gt 0 ] && [ $line_number -le $max_line_number ]; then - local count=0 - for line_name in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|grep sip$profile_num|awk -F'.' '{print$2}'`;do - let count=$count+1 - if [ "$count" = "$line_number" ];then break;fi - done - get_line_call_state $profile_num $line_name $line_number - else - return $FAULT_CPE_INVALID_PARAMETER_NAME; - fi - else - return $FAULT_CPE_INVALID_PARAMETER_NAME; - fi - fi - return $FAULT_CPE_NO_FAULT + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.CallState) + get_set_line_parameter "$1" "get_line_call_state" "CallState" "$max_num" + return $? ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].Line.[1-$max_line].CallingFeatures.) + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.CallingFeatures.) freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.Line.{i}.CallingFeatures." "rc" "num" if [ $rc -eq 0 ]; then local profile_num=`echo $num | awk '{ print $1 }'` local line_number=`echo $num | awk '{ print $2 }'` + let sip_id=$profile_num-1 + exist=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.sip$sip_id` + if [ "$exist" = "" ];then + return $FAULT_CPE_INVALID_PARAMETER_NAME + fi + line_instances_list=`get_line_instances_list $profile_num` + local l_inst_found=0 + for line_instance in $line_instances_list;do + if [ "$line_instance" = "$line_number" ];then + l_inst_found=1 + break + fi + done + if [ "$l_inst_found" = "0" ];then + return $FAULT_CPE_INVALID_PARAMETER_NAME + fi if [ $profile_num -gt 0 ] && [ $profile_num -le $max_num ]; then - let profile_num=$profile_num-1 # Line - local max_line_number=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep brcm|grep -c sip$profile_num` + local max_line_number=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep brcm|grep instances|awk -F '=' '{print $2'}|cut -f$profile_num -d:|sort -u|tail -1` + let profile_num=$profile_num-1 if [ $line_number -gt 0 ] && [ $line_number -le $max_line_number ]; then local count=0 - for line_name in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|grep sip$profile_num|awk -F'.' '{print$2}'`;do - let count=$count+1 - if [ "$count" = "$line_number" ];then break;fi + local found=0 + for line_name in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|grep sip$profile_num$|awk -F'.' '{print$2}'`;do + line_id=`echo $line_name|sed 's/brcm//g'` + if [ $line_id -gt $max_line ];then + continue + fi + let p_instance=$profile_num+1 + count=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client.$line_name.instances|cut -f$p_instance -d:` + if [ "$count" = "$line_number" ];then + found=1 + break + fi done - get_line_calling_features_caller_id_name $profile_num $line_name $line_number + if [ "$found" = "1" ];then + get_line_calling_features_caller_id_name $profile_num $line_name + else + return $FAULT_CPE_INVALID_PARAMETER_NAME + fi else return $FAULT_CPE_INVALID_PARAMETER_NAME; fi @@ -1973,49 +2108,61 @@ case "$1" in fi return $FAULT_CPE_NO_FAULT ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].Line.[1-$max_line].CallingFeatures.CallerIDName) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.Line.{i}.CallingFeatures.CallerIDName" "rc" "num" - if [ $rc -eq 0 ]; then - local profile_num=`echo $num | awk '{ print $1 }'` - local line_number=`echo $num | awk '{ print $2 }'` - if [ $profile_num -gt 0 ] && [ $profile_num -le $max_num ]; then - let profile_num=$profile_num-1 - # Line - local max_line_number=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep brcm|grep -c sip$profile_num` - if [ $line_number -gt 0 ] && [ $line_number -le $max_line_number ]; then - local count=0 - for line_name in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|grep sip$profile_num|awk -F'.' '{print$2}'`;do - let count=$count+1 - if [ "$count" = "$line_number" ];then break;fi - done - get_line_calling_features_caller_id_name $profile_num $line_name $line_number - else - return $FAULT_CPE_INVALID_PARAMETER_NAME; - fi - else - return $FAULT_CPE_INVALID_PARAMETER_NAME; - fi - fi - return $FAULT_CPE_NO_FAULT + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.CallingFeatures.CallerIDName) + get_set_line_parameter "$1" "get_line_calling_features_caller_id_name" "CallingFeatures.CallerIDName" "$max_num" + return $? ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].Line.[1-$max_line].SIP.) + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.X_002207_LineProfile) + get_set_line_parameter "$1" "get_line_x_002207_line_profile" "X_002207_LineProfile" "$max_num" + return $? + ;; + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.SIP.) freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.Line.{i}.SIP." "rc" "num" if [ $rc -eq 0 ]; then + let sip_id=$profile_num-1 + exist=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.sip$sip_id` + if [ "$exist" = "" ];then + return $FAULT_CPE_INVALID_PARAMETER_NAME + fi + line_instances_list=`get_line_instances_list $profile_num` + local l_inst_found=0 + for line_instance in $line_instances_list;do + if [ "$line_instance" = "$line_number" ];then + l_inst_found=1 + break + fi + done + if [ "$l_inst_found" = "0" ];then + return $FAULT_CPE_INVALID_PARAMETER_NAME + fi local profile_num=`echo $num | awk '{ print $1 }'` local line_number=`echo $num | awk '{ print $2 }'` if [ $profile_num -gt 0 ] && [ $profile_num -le $max_num ]; then - let profile_num=$profile_num-1 # Line - local max_line_number=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep brcm|grep -c sip$profile_num` + local max_line_number=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep brcm|grep instances|awk -F '=' '{print $2'}|cut -f$profile_num -d:|sort -u|tail -1` + let profile_num=$profile_num-1 if [ $line_number -gt 0 ] && [ $line_number -le $max_line_number ]; then local count=0 - for line_name in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|grep sip$profile_num|awk -F'.' '{print$2}'`;do - let count=$count+1 - if [ "$count" = "$line_number" ];then break;fi + local found=0 + for line_name in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|grep sip$profile_num$|awk -F'.' '{print$2}'`;do + line_id=`echo $line_name|sed 's/brcm//g'` + if [ $line_id -gt $max_line ];then + continue + fi + let p_instance=$profile_num+1 + count=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client.$line_name.instances|cut -f$p_instance -d:` + if [ "$count" = "$line_number" ];then + found=1 + break + fi done - get_line_sip_username $profile_num $line_name $line_number - get_line_sip_password $profile_num $line_name $line_number - get_line_sip_uri $profile_num $line_name $line_number + if [ "$found" = "1" ];then + get_line_sip_username $profile_num $line_name + get_line_sip_password $profile_num $line_name + get_line_sip_uri $profile_num $line_name + else + return $FAULT_CPE_INVALID_PARAMETER_NAME + fi else return $FAULT_CPE_INVALID_PARAMETER_NAME; fi @@ -2025,748 +2172,34 @@ case "$1" in fi return $FAULT_CPE_NO_FAULT ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].Line.[1-$max_line].SIP.AuthUserName) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.Line.{i}.SIP.AuthUserName" "rc" "num" - if [ $rc -eq 0 ]; then - local profile_num=`echo $num | awk '{ print $1 }'` - local line_number=`echo $num | awk '{ print $2 }'` - if [ $profile_num -gt 0 ] && [ $profile_num -le $max_num ]; then - let profile_num=$profile_num-1 - # Line - local max_line_number=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep brcm|grep -c sip$profile_num` - if [ $line_number -gt 0 ] && [ $line_number -le $max_line_number ]; then - local count=0 - for line_name in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|grep sip$profile_num|awk -F'.' '{print$2}'`;do - let count=$count+1 - if [ "$count" = "$line_number" ];then break;fi - done - get_line_sip_username $profile_num $line_name $line_number - else - return $FAULT_CPE_INVALID_PARAMETER_NAME; - fi - else - return $FAULT_CPE_INVALID_PARAMETER_NAME; - fi - fi - return $FAULT_CPE_NO_FAULT + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.SIP.AuthUserName) + get_set_line_parameter "$1" "get_line_sip_username" "SIP.AuthUserName" "$max_num" + return $? ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].Line.[1-$max_line].SIP.AuthPassword) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.Line.{i}.SIP.AuthPassword" "rc" "num" - if [ $rc -eq 0 ]; then - local profile_num=`echo $num | awk '{ print $1 }'` - local line_number=`echo $num | awk '{ print $2 }'` - if [ $profile_num -gt 0 ] && [ $profile_num -le $max_num ]; then - let profile_num=$profile_num-1 - # Line - local max_line_number=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep brcm|grep -c sip$profile_num` - if [ $line_number -gt 0 ] && [ $line_number -le $max_line_number ]; then - local count=0 - for line_name in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|grep sip$profile_num|awk -F'.' '{print$2}'`;do - let count=$count+1 - if [ "$count" = "$line_number" ];then break;fi - done - get_line_sip_password $profile_num $line_name $line_number - else - return $FAULT_CPE_INVALID_PARAMETER_NAME; - fi - else - return $FAULT_CPE_INVALID_PARAMETER_NAME; - fi - fi - return $FAULT_CPE_NO_FAULT + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.SIP.AuthPassword) + get_set_line_parameter "$1" "get_line_sip_password" "SIP.AuthPassword" "$max_num" + return $? ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].Line.[1-$max_line].SIP.URI) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.Line.{i}.SIP.URI" "rc" "num" - if [ $rc -eq 0 ]; then - local profile_num=`echo $num | awk '{ print $1 }'` - local line_number=`echo $num | awk '{ print $2 }'` - if [ $profile_num -gt 0 ] && [ $profile_num -le $max_num ]; then - let profile_num=$profile_num-1 - # Line - local max_line_number=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep brcm|grep -c sip$profile_num` - if [ $line_number -gt 0 ] && [ $line_number -le $max_line_number ]; then - local count=0 - for line_name in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|grep sip$profile_num|awk -F'.' '{print$2}'`;do - let count=$count+1 - if [ "$count" = "$line_number" ];then break;fi - done - get_line_sip_uri $profile_num $line_name $line_number - else - return $FAULT_CPE_INVALID_PARAMETER_NAME; - fi - else - return $FAULT_CPE_INVALID_PARAMETER_NAME; - fi - fi - return $FAULT_CPE_NO_FAULT + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.SIP.URI) + get_set_line_parameter "$1" "get_line_sip_uri" "SIP.URI" "$max_num" + return $? ;; esac return $FAULT_CPE_INVALID_PARAMETER_NAME; } +get_voice_service() { +local fault_code="" +get_voice_service_function "$1" +fault_code="$?" +return $fault_code +} + get_voice_service_notification() { -local max_profile -local max_line -local max_num - -get_voice_service_max_profile max_profile -let max_num=$max_profile+1 - -get_voice_service_max_line max_line - -case "$1" in - InternetGatewayDevice.|\ - InternetGatewayDevice.Services.|\ - InternetGatewayDevice.Services.VoiceService.|\ - InternetGatewayDevice.Services.VoiceService.1.|\ - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.) - for profile_num in `seq 0 $max_profile`;do - get_voice_profile_enable $profile_num - get_voice_profile_reset $profile_num - get_voice_profile_name $profile_num - get_voice_profile_signaling_protocol $profile_num - get_voice_profile_max_sessions $profile_num - get_voice_profile_number_of_lines $profile_num - get_sip_proxy_server $profile_num - get_sip_proxy_server_port $profile_num - get_sip_proxy_server_transport $profile_num - get_sip_registrar_server $profile_num - get_sip_registrar_server_port $profile_num - get_sip_registrar_server_transport $profile_num - get_sip_user_agent_domain $profile_num - get_sip_user_agent_port $profile_num - get_sip_user_agent_transport $profile_num - get_sip_outbound_proxy $profile_num - get_sip_outbound_proxy_port $profile_num - # get_sip_organization $profile_num - get_sip_registration_period $profile_num - # get_sip_invite_expires $profile_num - get_sip_re_invite_expires $profile_num - get_sip_register_expires $profile_num - # get_sip_registers_min_expires $profile_num - get_sip_register_retry_interval $profile_num - # get_sip_inbound_auth $profile_num - # get_sip_inbound_auth_username $profile_num - # get_sip_inbound_auth_password $profile_num - # Line - local line_number="0" - for line_name in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|grep sip$profile_num|awk -F'.' '{print$2}'`;do - let line_number=$line_number+1 - get_line_enable $profile_num $line_name $line_number - get_line_directory_number $profile_num $line_name $line_number - get_line_status $profile_num $line_name $line_number - get_line_call_state $profile_num $line_name $line_number - get_line_calling_features_caller_id_name $profile_num $line_name $line_number - get_line_sip_username $profile_num $line_name $line_number - get_line_sip_password $profile_num $line_name $line_number - get_line_sip_uri $profile_num $line_name $line_number - done - done - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}." "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - get_voice_profile_enable $profile_num - get_voice_profile_reset $profile_num - get_voice_profile_name $profile_num - get_voice_profile_signaling_protocol $profile_num - get_voice_profile_max_sessions $profile_num - get_voice_profile_number_of_lines $profile_num - get_sip_proxy_server $profile_num - get_sip_proxy_server_port $profile_num - get_sip_proxy_server_transport $profile_num - get_sip_registrar_server $profile_num - get_sip_registrar_server_port $profile_num - get_sip_registrar_server_transport $profile_num - get_sip_user_agent_domain $profile_num - get_sip_user_agent_port $profile_num - get_sip_user_agent_transport $profile_num - get_sip_outbound_proxy $profile_num - get_sip_outbound_proxy_port $profile_num - # get_sip_organization $profile_num - get_sip_registration_period $profile_num - # get_sip_invite_expires $profile_num - get_sip_re_invite_expires $profile_num - get_sip_register_expires $profile_num - # get_sip_registers_min_expires $profile_num - get_sip_register_retry_interval $profile_num - # get_sip_inbound_auth $profile_num - # get_sip_inbound_auth_username $profile_num - # get_sip_inbound_auth_password $profile_num - # Line - local line_number="0" - for line_name in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|grep sip$profile_num|awk -F'.' '{print$2}'`;do - let line_number=$line_number+1 - get_line_enable $profile_num $line_name $line_number - get_line_directory_number $profile_num $line_name $line_number - get_line_status $profile_num $line_name $line_number - get_line_call_state $profile_num $line_name $line_number - get_line_calling_features_caller_id_name $profile_num $line_name $line_number - get_line_sip_username $profile_num $line_name $line_number - get_line_sip_password $profile_num $line_name $line_number - get_line_sip_uri $profile_num $line_name $line_number - done - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP." "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - get_sip_proxy_server $profile_num - get_sip_proxy_server_port $profile_num - get_sip_proxy_server_transport $profile_num - get_sip_registrar_server $profile_num - get_sip_registrar_server_port $profile_num - get_sip_registrar_server_transport $profile_num - get_sip_user_agent_domain $profile_num - get_sip_user_agent_port $profile_num - get_sip_user_agent_transport $profile_num - get_sip_outbound_proxy $profile_num - get_sip_outbound_proxy_port $profile_num - # get_sip_organization $profile_num - get_sip_registration_period $profile_num - # get_sip_invite_expires $profile_num - get_sip_re_invite_expires $profile_num - get_sip_register_expires $profile_num - # get_sip_registers_min_expires $profile_num - get_sip_register_retry_interval $profile_num - # get_sip_inbound_auth $profile_num - # get_sip_inbound_auth_username $profile_num - # get_sip_inbound_auth_password $profile_num - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].Enable) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.Enable" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - get_voice_profile_enable $profile_num - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].Reset) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.Reset" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - get_voice_profile_reset $profile_num - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].Name) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.Name" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - get_voice_profile_name $profile_num - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SignalingProtocol) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SignalingProtocol" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - get_voice_profile_signaling_protocol $profile_num - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].MaxSessions) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.MaxSessions" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - get_voice_profile_max_sessions $profile_num - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].NumberOfLines) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.NumberOfLines" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - get_voice_profile_number_of_lines $profile_num - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.ProxyServer) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.ProxyServer" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - get_sip_proxy_server $profile_num - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.ProxyServerPort) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.ProxyServerPort" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - get_sip_proxy_server_port $profile_num - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.ProxyServerTransport) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.ProxyServerTransport" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - get_sip_proxy_server_transport $profile_num - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.RegistrarServer) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.RegistrarServer" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - get_sip_registrar_server $profile_num - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.RegistrarServerPort) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.RegistrarServerPort" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - get_sip_registrar_server_port $profile_num - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.RegistrarServerTransport) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.RegistrarServerTransport" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - get_sip_registrar_server_transport $profile_num - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.UserAgentDomain) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.UserAgentDomain" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - get_sip_user_agent_domain $profile_num - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.UserAgentPort) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.UserAgentPort" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - get_sip_user_agent_port $profile_num - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.UserAgentTransport) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.UserAgentTransport" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - get_sip_user_agent_transport $profile_num - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.OutboundProxy) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.OutboundProxy" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - get_sip_outbound_proxy $profile_num - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.OutboundProxyPort) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.OutboundProxyPort" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - get_sip_outbound_proxy_port $profile_num - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.Organization) - return $FAULT_CPE_INVALID_PARAMETER_NAME - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.Organization" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - get_sip_organization $profile_num - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.RegistrationPeriod) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.RegistrationPeriod" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - get_sip_registration_period $profile_num - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.InviteExpires) - return $FAULT_CPE_INVALID_PARAMETER_NAME - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.InviteExpires" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - get_sip_invite_expires $profile_num - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.ReInviteExpires) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.ReInviteExpires" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - get_sip_re_invite_expires $profile_num - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.RegisterExpires) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.RegisterExpires" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - get_sip_register_expires $profile_num - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.RegistersMinExpires) - return $FAULT_CPE_INVALID_PARAMETER_NAME - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.RegistersMinExpires" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - get_sip_registers_min_expires $profile_num - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.RegisterRetryInterval) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.RegisterRetryInterval" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - get_sip_register_retry_interval $profile_num - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.InboundAuth) - return $FAULT_CPE_INVALID_PARAMETER_NAME - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.InboundAuth" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - get_sip_inbound_auth $profile_num - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.InboundAuthUsername) - return $FAULT_CPE_INVALID_PARAMETER_NAME - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.InboundAuthUsername" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - get_sip_inbound_auth_username $profile_num - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.InboundAuthPassword) - return $FAULT_CPE_INVALID_PARAMETER_NAME - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.InboundAuthPassword" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - get_sip_inbound_auth_password $profile_num - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].Line.) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.Line." "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - # Line - local line_number="0" - for line_name in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|grep sip$profile_num|awk -F'.' '{print$2}'`;do - let line_number=$line_number+1 - get_line_enable $profile_num $line_name $line_number - get_line_directory_number $profile_num $line_name $line_number - get_line_status $profile_num $line_name $line_number - get_line_call_state $profile_num $line_name $line_number - get_line_calling_features_caller_id_name $profile_num $line_name $line_number - get_line_sip_username $profile_num $line_name $line_number - get_line_sip_password $profile_num $line_name $line_number - get_line_sip_uri $profile_num $line_name $line_number - done - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].Line.[1-$max_line].) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.Line.{i}." "rc" "num" - if [ $rc -eq 0 ]; then - local profile_num=`echo $num | awk '{ print $1 }'` - local line_number=`echo $num | awk '{ print $2 }'` - if [ $profile_num -gt 0 ] && [ $profile_num -le $max_num ]; then - let profile_num=$profile_num-1 - # Line - local max_line_number=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep brcm|grep -c sip$profile_num` - if [ $line_number -gt 0 ] && [ $line_number -le $max_line_number ]; then - local count=0 - for line_name in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|grep sip$profile_num|awk -F'.' '{print$2}'`;do - let count=$count+1 - if [ "$count" = "$line_number" ];then break;fi - done - get_line_enable $profile_num $line_name $line_number - get_line_directory_number $profile_num $line_name $line_number - get_line_status $profile_num $line_name $line_number - get_line_call_state $profile_num $line_name $line_number - get_line_calling_features_caller_id_name $profile_num $line_name $line_number - get_line_sip_username $profile_num $line_name $line_number - get_line_sip_password $profile_num $line_name $line_number - get_line_sip_uri $profile_num $line_name $line_number - else - return $FAULT_CPE_INVALID_PARAMETER_NAME; - fi - else - return $FAULT_CPE_INVALID_PARAMETER_NAME; - fi - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].Line.[1-$max_line].Enable) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.Line.{i}.Enable" "rc" "num" - if [ $rc -eq 0 ]; then - local profile_num=`echo $num | awk '{ print $1 }'` - local line_number=`echo $num | awk '{ print $2 }'` - if [ $profile_num -gt 0 ] && [ $profile_num -le $max_num ]; then - let profile_num=$profile_num-1 - # Line - local max_line_number=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep brcm|grep -c sip$profile_num` - if [ $line_number -gt 0 ] && [ $line_number -le $max_line_number ]; then - local count=0 - for line_name in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|grep sip$profile_num|awk -F'.' '{print$2}'`;do - let count=$count+1 - if [ "$count" = "$line_number" ];then break;fi - done - get_line_enable $profile_num $line_name $line_number - else - return $FAULT_CPE_INVALID_PARAMETER_NAME; - fi - else - return $FAULT_CPE_INVALID_PARAMETER_NAME; - fi - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].Line.[1-$max_line].DirectoryNumber) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.Line.{i}.DirectoryNumber" "rc" "num" - if [ $rc -eq 0 ]; then - local profile_num=`echo $num | awk '{ print $1 }'` - local line_number=`echo $num | awk '{ print $2 }'` - if [ $profile_num -gt 0 ] && [ $profile_num -le $max_num ]; then - let profile_num=$profile_num-1 - # Line - local max_line_number=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep brcm|grep -c sip$profile_num` - if [ $line_number -gt 0 ] && [ $line_number -le $max_line_number ]; then - local count=0 - for line_name in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|grep sip$profile_num|awk -F'.' '{print$2}'`;do - let count=$count+1 - if [ "$count" = "$line_number" ];then break;fi - done - get_line_directory_number $profile_num $line_name $line_number - else - return $FAULT_CPE_INVALID_PARAMETER_NAME; - fi - else - return $FAULT_CPE_INVALID_PARAMETER_NAME; - fi - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].Line.[1-$max_line].Status) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.Line.{i}.Status" "rc" "num" - if [ $rc -eq 0 ]; then - local profile_num=`echo $num | awk '{ print $1 }'` - local line_number=`echo $num | awk '{ print $2 }'` - if [ $profile_num -gt 0 ] && [ $profile_num -le $max_num ]; then - let profile_num=$profile_num-1 - # Line - local max_line_number=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep brcm|grep -c sip$profile_num` - if [ $line_number -gt 0 ] && [ $line_number -le $max_line_number ]; then - local count=0 - for line_name in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|grep sip$profile_num|awk -F'.' '{print$2}'`;do - let count=$count+1 - if [ "$count" = "$line_number" ];then break;fi - done - get_line_status $profile_num $line_name $line_number - else - return $FAULT_CPE_INVALID_PARAMETER_NAME; - fi - else - return $FAULT_CPE_INVALID_PARAMETER_NAME; - fi - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].Line.[1-$max_line].CallState) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.Line.{i}.CallState" "rc" "num" - if [ $rc -eq 0 ]; then - local profile_num=`echo $num | awk '{ print $1 }'` - local line_number=`echo $num | awk '{ print $2 }'` - if [ $profile_num -gt 0 ] && [ $profile_num -le $max_num ]; then - let profile_num=$profile_num-1 - # Line - local max_line_number=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep brcm|grep -c sip$profile_num` - if [ $line_number -gt 0 ] && [ $line_number -le $max_line_number ]; then - local count=0 - for line_name in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|grep sip$profile_num|awk -F'.' '{print$2}'`;do - let count=$count+1 - if [ "$count" = "$line_number" ];then break;fi - done - get_line_call_state $profile_num $line_name $line_number - else - return $FAULT_CPE_INVALID_PARAMETER_NAME; - fi - else - return $FAULT_CPE_INVALID_PARAMETER_NAME; - fi - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].Line.[1-$max_line].CallingFeatures.) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.Line.{i}.CallingFeatures." "rc" "num" - if [ $rc -eq 0 ]; then - local profile_num=`echo $num | awk '{ print $1 }'` - local line_number=`echo $num | awk '{ print $2 }'` - if [ $profile_num -gt 0 ] && [ $profile_num -le $max_num ]; then - let profile_num=$profile_num-1 - # Line - local max_line_number=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep brcm|grep -c sip$profile_num` - if [ $line_number -gt 0 ] && [ $line_number -le $max_line_number ]; then - local count=0 - for line_name in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|grep sip$profile_num|awk -F'.' '{print$2}'`;do - let count=$count+1 - if [ "$count" = "$line_number" ];then break;fi - done - get_line_calling_features_caller_id_name $profile_num $line_name $line_number - else - return $FAULT_CPE_INVALID_PARAMETER_NAME; - fi - else - return $FAULT_CPE_INVALID_PARAMETER_NAME; - fi - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].Line.[1-$max_line].CallingFeatures.CallerIDName) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.Line.{i}.CallingFeatures.CallerIDName" "rc" "num" - if [ $rc -eq 0 ]; then - local profile_num=`echo $num | awk '{ print $1 }'` - local line_number=`echo $num | awk '{ print $2 }'` - if [ $profile_num -gt 0 ] && [ $profile_num -le $max_num ]; then - let profile_num=$profile_num-1 - # Line - local max_line_number=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep brcm|grep -c sip$profile_num` - if [ $line_number -gt 0 ] && [ $line_number -le $max_line_number ]; then - local count=0 - for line_name in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|grep sip$profile_num|awk -F'.' '{print$2}'`;do - let count=$count+1 - if [ "$count" = "$line_number" ];then break;fi - done - get_line_calling_features_caller_id_name $profile_num $line_name $line_number - else - return $FAULT_CPE_INVALID_PARAMETER_NAME; - fi - else - return $FAULT_CPE_INVALID_PARAMETER_NAME; - fi - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].Line.[1-$max_line].SIP.) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.Line.{i}.SIP." "rc" "num" - if [ $rc -eq 0 ]; then - local profile_num=`echo $num | awk '{ print $1 }'` - local line_number=`echo $num | awk '{ print $2 }'` - if [ $profile_num -gt 0 ] && [ $profile_num -le $max_num ]; then - let profile_num=$profile_num-1 - # Line - local max_line_number=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep brcm|grep -c sip$profile_num` - if [ $line_number -gt 0 ] && [ $line_number -le $max_line_number ]; then - local count=0 - for line_name in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|grep sip$profile_num|awk -F'.' '{print$2}'`;do - let count=$count+1 - if [ "$count" = "$line_number" ];then break;fi - done - get_line_sip_username $profile_num $line_name $line_number - get_line_sip_password $profile_num $line_name $line_number - get_line_sip_uri $profile_num $line_name $line_number - else - return $FAULT_CPE_INVALID_PARAMETER_NAME; - fi - else - return $FAULT_CPE_INVALID_PARAMETER_NAME; - fi - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].Line.[1-$max_line].SIP.AuthUserName) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.Line.{i}.SIP.AuthUserName" "rc" "num" - if [ $rc -eq 0 ]; then - local profile_num=`echo $num | awk '{ print $1 }'` - local line_number=`echo $num | awk '{ print $2 }'` - if [ $profile_num -gt 0 ] && [ $profile_num -le $max_num ]; then - let profile_num=$profile_num-1 - # Line - local max_line_number=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep brcm|grep -c sip$profile_num` - if [ $line_number -gt 0 ] && [ $line_number -le $max_line_number ]; then - local count=0 - for line_name in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|grep sip$profile_num|awk -F'.' '{print$2}'`;do - let count=$count+1 - if [ "$count" = "$line_number" ];then break;fi - done - get_line_sip_username $profile_num $line_name $line_number - else - return $FAULT_CPE_INVALID_PARAMETER_NAME; - fi - else - return $FAULT_CPE_INVALID_PARAMETER_NAME; - fi - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].Line.[1-$max_line].SIP.AuthPassword) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.Line.{i}.SIP.AuthPassword" "rc" "num" - if [ $rc -eq 0 ]; then - local profile_num=`echo $num | awk '{ print $1 }'` - local line_number=`echo $num | awk '{ print $2 }'` - if [ $profile_num -gt 0 ] && [ $profile_num -le $max_num ]; then - let profile_num=$profile_num-1 - # Line - local max_line_number=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep brcm|grep -c sip$profile_num` - if [ $line_number -gt 0 ] && [ $line_number -le $max_line_number ]; then - local count=0 - for line_name in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|grep sip$profile_num|awk -F'.' '{print$2}'`;do - let count=$count+1 - if [ "$count" = "$line_number" ];then break;fi - done - get_line_sip_password $profile_num $line_name $line_number - else - return $FAULT_CPE_INVALID_PARAMETER_NAME; - fi - else - return $FAULT_CPE_INVALID_PARAMETER_NAME; - fi - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].Line.[1-$max_line].SIP.URI) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.Line.{i}.SIP.URI" "rc" "num" - if [ $rc -eq 0 ]; then - local profile_num=`echo $num | awk '{ print $1 }'` - local line_number=`echo $num | awk '{ print $2 }'` - if [ $profile_num -gt 0 ] && [ $profile_num -le $max_num ]; then - let profile_num=$profile_num-1 - # Line - local max_line_number=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep brcm|grep -c sip$profile_num` - if [ $line_number -gt 0 ] && [ $line_number -le $max_line_number ]; then - local count=0 - for line_name in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|grep sip$profile_num|awk -F'.' '{print$2}'`;do - let count=$count+1 - if [ "$count" = "$line_number" ];then break;fi - done - get_line_sip_uri $profile_num $line_name $line_number - else - return $FAULT_CPE_INVALID_PARAMETER_NAME; - fi - else - return $FAULT_CPE_INVALID_PARAMETER_NAME; - fi - fi - return $FAULT_CPE_NO_FAULT - ;; -esac -return $FAULT_CPE_INVALID_PARAMETER_NAME; +local fault_code="" +get_voice_service_function "$1" +fault_code="$?" +return $fault_code } get_voice_service_name() { @@ -2783,120 +2216,133 @@ case "$1" in InternetGatewayDevice.|\ InternetGatewayDevice.Services.) freecwmp_output "InternetGatewayDevice.Services." "" "1" + if [ "$1" = "InternetGatewayDevice.Services." -a "$2" = "1" ];then + freecwmp_output "InternetGatewayDevice.Services.VoiceService.1." "" "1" + fi if [ "$2" = "0" ]; then freecwmp_output "InternetGatewayDevice.Services.VoiceService." "" "1" freecwmp_output "InternetGatewayDevice.Services.VoiceService.1." "" "1" freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile." "" "1" - for profile_num in `seq 0 $max_profile`;do - get_voice_profile_enable $profile_num - get_voice_profile_reset $profile_num - get_voice_profile_name $profile_num - get_voice_profile_signaling_protocol $profile_num - get_voice_profile_max_sessions $profile_num - get_voice_profile_number_of_lines $profile_num + for profile_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep "voice_client.sip"|grep -v sip_service_provider|awk -F '.' '{print $2}'|sed 's/sip//g'|sort -un`;do + get_voice_profile_enable $profile_num + get_voice_profile_reset $profile_num + get_voice_profile_name $profile_num + get_voice_profile_signaling_protocol $profile_num + get_voice_profile_max_sessions $profile_num + get_voice_profile_number_of_lines $profile_num let i=$profile_num+1 freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$i.SIP." "" "0" - get_sip_proxy_server $profile_num - get_sip_proxy_server_port $profile_num - get_sip_proxy_server_transport $profile_num - get_sip_registrar_server $profile_num - get_sip_registrar_server_port $profile_num - get_sip_registrar_server_transport $profile_num - get_sip_user_agent_domain $profile_num - get_sip_user_agent_port $profile_num - get_sip_user_agent_transport $profile_num - get_sip_outbound_proxy $profile_num - get_sip_outbound_proxy_port $profile_num - # get_sip_organization $profile_num - get_sip_registration_period $profile_num - # get_sip_invite_expires $profile_num - get_sip_re_invite_expires $profile_num - get_sip_register_expires $profile_num - # get_sip_registers_min_expires $profile_num - get_sip_register_retry_interval $profile_num - # get_sip_inbound_auth $profile_num - # get_sip_inbound_auth_username $profile_num - # get_sip_inbound_auth_password $profile_num - # Line - local line_number="0" - for line_name in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|grep sip$profile_num|awk -F'.' '{print$2}'`;do - let line_number=$line_number+1 + get_sip_proxy_server $profile_num + get_sip_proxy_server_port $profile_num + get_sip_proxy_server_transport $profile_num + get_sip_registrar_server $profile_num + get_sip_registrar_server_port $profile_num + get_sip_registrar_server_transport $profile_num + get_sip_user_agent_domain $profile_num + get_sip_user_agent_port $profile_num + get_sip_user_agent_transport $profile_num + get_sip_outbound_proxy $profile_num + get_sip_outbound_proxy_port $profile_num + # get_sip_organization $profile_num + get_sip_registration_period $profile_num + # get_sip_invite_expires $profile_num + get_sip_re_invite_expires $profile_num + get_sip_register_expires $profile_num + # get_sip_registers_min_expires $profile_num + get_sip_register_retry_interval $profile_num + # get_sip_inbound_auth $profile_num + # get_sip_inbound_auth_username $profile_num + # get_sip_inbound_auth_password $profile_num + # Line + for line_name in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|grep sip$profile_num$|awk -F'.' '{print$2}'`;do + line_id=`echo $line_name|sed 's/brcm//g'` + if [ $line_id -gt $max_line ];then + continue + fi + line_number=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.instances|cut -d : -f$num` freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$i.Line.$line_number." "" "1" - get_line_enable $profile_num $line_name $line_number - get_line_directory_number $profile_num $line_name $line_number - get_line_status $profile_num $line_name $line_number - get_line_call_state $profile_num $line_name $line_number + get_line_enable $profile_num $line_name + get_line_directory_number $profile_num $line_name + get_line_status $profile_num $line_name + get_line_call_state $profile_num $line_name freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$i.Line.$line_number.CallingFeatures." "" "0" - get_line_calling_features_caller_id_name $profile_num $line_name $line_number + get_line_calling_features_caller_id_name $profile_num $line_name + get_line_x_002207_line_profile $profile_num $line_name freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$i.Line.$line_number.SIP." "" "0" - get_line_sip_username $profile_num $line_name $line_number - get_line_sip_password $profile_num $line_name $line_number - get_line_sip_uri $profile_num $line_name $line_number - done + get_line_sip_username $profile_num $line_name + get_line_sip_password $profile_num $line_name + get_line_sip_uri $profile_num $line_name done + done fi return $FAULT_CPE_NO_FAULT ;; InternetGatewayDevice.Services.VoiceService.) - freecwmp_output "InternetGatewayDevice.Services.VoiceService." "" "1" + freecwmp_output "$1" "" "1" + freecwmp_output "$1\1." "" "1" if [ "$2" = "0" ]; then - freecwmp_output "InternetGatewayDevice.Services.VoiceService.1." "" "1" - freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile." "" "1" - for profile_num in `seq 0 $max_profile`;do - get_voice_profile_enable $profile_num - get_voice_profile_reset $profile_num - get_voice_profile_name $profile_num - get_voice_profile_signaling_protocol $profile_num - get_voice_profile_max_sessions $profile_num - get_voice_profile_number_of_lines $profile_num + freecwmp_output "$1\1.VoiceProfile." "" "1" + for profile_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep "voice_client.sip"|grep -v sip_service_provider|awk -F '.' '{print $2}'|sed 's/sip//g'|sort -un`;do + get_voice_profile_enable $profile_num + get_voice_profile_reset $profile_num + get_voice_profile_name $profile_num + get_voice_profile_signaling_protocol $profile_num + get_voice_profile_max_sessions $profile_num + get_voice_profile_number_of_lines $profile_num let i=$profile_num+1 freecwmp_output "$1\1.VoiceProfile.$i.SIP." "" "0" - get_sip_proxy_server $profile_num - get_sip_proxy_server_port $profile_num - get_sip_proxy_server_transport $profile_num - get_sip_registrar_server $profile_num - get_sip_registrar_server_port $profile_num - get_sip_registrar_server_transport $profile_num - get_sip_user_agent_domain $profile_num - get_sip_user_agent_port $profile_num - get_sip_user_agent_transport $profile_num - get_sip_outbound_proxy $profile_num - get_sip_outbound_proxy_port $profile_num - # get_sip_organization $profile_num - get_sip_registration_period $profile_num - # get_sip_invite_expires $profile_num - get_sip_re_invite_expires $profile_num - get_sip_register_expires $profile_num - # get_sip_registers_min_expires $profile_num - get_sip_register_retry_interval $profile_num - # get_sip_inbound_auth $profile_num - # get_sip_inbound_auth_username $profile_num - # get_sip_inbound_auth_password $profile_num - # Line - local line_number="0" - for line_name in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|grep sip$profile_num|awk -F'.' '{print$2}'`;do - let line_number=$line_number+1 + get_sip_proxy_server $profile_num + get_sip_proxy_server_port $profile_num + get_sip_proxy_server_transport $profile_num + get_sip_registrar_server $profile_num + get_sip_registrar_server_port $profile_num + get_sip_registrar_server_transport $profile_num + get_sip_user_agent_domain $profile_num + get_sip_user_agent_port $profile_num + get_sip_user_agent_transport $profile_num + get_sip_outbound_proxy $profile_num + get_sip_outbound_proxy_port $profile_num + # get_sip_organization $profile_num + get_sip_registration_period $profile_num + # get_sip_invite_expires $profile_num + get_sip_re_invite_expires $profile_num + get_sip_register_expires $profile_num + # get_sip_registers_min_expires $profile_num + get_sip_register_retry_interval $profile_num + # get_sip_inbound_auth $profile_num + # get_sip_inbound_auth_username $profile_num + # get_sip_inbound_auth_password $profile_num + # Line + for line_name in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|grep sip$profile_num$|awk -F'.' '{print$2}'`;do + line_id=`echo $line_name|sed 's/brcm//g'` + if [ $line_id -gt $max_line ];then + continue + fi + line_number=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.instances|cut -d : -f$num` freecwmp_output "$1\1.VoiceProfile.$i.Line.$line_number." "" "1" - get_line_enable $profile_num $line_name $line_number - get_line_directory_number $profile_num $line_name $line_number - get_line_status $profile_num $line_name $line_number - get_line_call_state $profile_num $line_name $line_number + get_line_enable $profile_num $line_name + get_line_directory_number $profile_num $line_name + get_line_status $profile_num $line_name + get_line_call_state $profile_num $line_name freecwmp_output "$1\1.VoiceProfile.$i.Line.$line_number.CallingFeatures." "" "0" - get_line_calling_features_caller_id_name $profile_num $line_name $line_number + get_line_calling_features_caller_id_name $profile_num $line_name + get_line_x_002207_line_profile $profile_num $line_name freecwmp_output "$1\1.VoiceProfile.$i.Line.$line_number.SIP." "" "0" - get_line_sip_username $profile_num $line_name $line_number - get_line_sip_password $profile_num $line_name $line_number - get_line_sip_uri $profile_num $line_name $line_number + get_line_sip_username $profile_num $line_name + get_line_sip_password $profile_num $line_name + get_line_sip_uri $profile_num $line_name done done fi return $FAULT_CPE_NO_FAULT ;; InternetGatewayDevice.Services.VoiceService.1.) - freecwmp_output "InternetGatewayDevice.Services.VoiceService.1." "" "1" + freecwmp_output "$1" "" "1" if [ "$2" = "0" ]; then - freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile." "" "1" - for profile_num in `seq 0 $max_profile`;do + freecwmp_output "$1VoiceProfile." "" "1" + for profile_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep "voice_client.sip"|grep -v sip_service_provider|awk -F '.' '{print $2}'|sed 's/sip//g'|sort -un`;do + let i=$profile_num+1 + freecwmp_output "$1VoiceProfile.$i." "" "1" get_voice_profile_enable $profile_num get_voice_profile_reset $profile_num get_voice_profile_name $profile_num @@ -2905,60 +2351,66 @@ case "$1" in get_voice_profile_number_of_lines $profile_num let i=$profile_num+1 freecwmp_output "$1VoiceProfile.$i.SIP." "" "0" - get_sip_proxy_server $profile_num - get_sip_proxy_server_port $profile_num - get_sip_proxy_server_transport $profile_num - get_sip_registrar_server $profile_num - get_sip_registrar_server_port $profile_num - get_sip_registrar_server_transport $profile_num - get_sip_user_agent_domain $profile_num - get_sip_user_agent_port $profile_num - get_sip_user_agent_transport $profile_num - get_sip_outbound_proxy $profile_num - get_sip_outbound_proxy_port $profile_num - # get_sip_organization $profile_num - get_sip_registration_period $profile_num - # get_sip_invite_expires $profile_num - get_sip_re_invite_expires $profile_num - get_sip_register_expires $profile_num - # get_sip_registers_min_expires $profile_num - get_sip_register_retry_interval $profile_num - # get_sip_inbound_auth $profile_num - # get_sip_inbound_auth_username $profile_num - # get_sip_inbound_auth_password $profile_num + get_sip_proxy_server $profile_num + get_sip_proxy_server_port $profile_num + get_sip_proxy_server_transport $profile_num + get_sip_registrar_server $profile_num + get_sip_registrar_server_port $profile_num + get_sip_registrar_server_transport $profile_num + get_sip_user_agent_domain $profile_num + get_sip_user_agent_port $profile_num + get_sip_user_agent_transport $profile_num + get_sip_outbound_proxy $profile_num + get_sip_outbound_proxy_port $profile_num + # get_sip_organization $profile_num + get_sip_registration_period $profile_num + # get_sip_invite_expires $profile_num + get_sip_re_invite_expires $profile_num + get_sip_register_expires $profile_num + # get_sip_registers_min_expires $profile_num + get_sip_register_retry_interval $profile_num + # get_sip_inbound_auth $profile_num + # get_sip_inbound_auth_username $profile_num + # get_sip_inbound_auth_password $profile_num # Line local line_number="0" - for line_name in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|grep sip$profile_num|awk -F'.' '{print$2}'`;do + for line_name in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|grep sip$profile_num$|awk -F'.' '{print$2}'`;do + line_id=`echo $line_name|sed 's/brcm//g'` + if [ $line_id -gt $max_line ];then + continue + fi freecwmp_output "$1.VoiceProfile.$i.Line.$line_number." "" "1" - get_line_enable $profile_num $line_name $line_number - get_line_directory_number $profile_num $line_name $line_number - get_line_status $profile_num $line_name $line_number - get_line_call_state $profile_num $line_name $line_number + get_line_enable $profile_num $line_name + get_line_directory_number $profile_num $line_name + get_line_status $profile_num $line_name + get_line_call_state $profile_num $line_name freecwmp_output "$1VoiceProfile.$i.Line.$line_number.CallingFeatures." "" "0" - get_line_calling_features_caller_id_name $profile_num $line_name $line_number + get_line_calling_features_caller_id_name $profile_num $line_name + get_line_x_002207_line_profile $profile_num $line_name freecwmp_output "$1VoiceProfile.$i.Line.$line_number.SIP." "" "0" - get_line_sip_username $profile_num $line_name $line_number - get_line_sip_password $profile_num $line_name $line_number - get_line_sip_uri $profile_num $line_name $line_number + get_line_sip_username $profile_num $line_name + get_line_sip_password $profile_num $line_name + get_line_sip_uri $profile_num $line_name done done fi return $FAULT_CPE_NO_FAULT ;; InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.) - freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile." "" "1" - if [ "$2" = "0" ]; then - for profile_num in `seq 0 $max_profile`;do - get_voice_profile_enable $profile_num - get_voice_profile_reset $profile_num - get_voice_profile_name $profile_num - get_voice_profile_signaling_protocol $profile_num - get_voice_profile_max_sessions $profile_num - get_voice_profile_number_of_lines $profile_num - let i=$profile_num+1 + freecwmp_output "$1" "" "1" + for profile_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep "voice_client.sip"|grep -v sip_service_provider|awk -F '.' '{print $2}'|sed 's/sip//g'|sort -un`;do + let i=$profile_num+1 + freecwmp_output "$1$i" "" "1" + if [ "$2" = "0" ]; then + get_voice_profile_enable $profile_num + get_voice_profile_reset $profile_num + get_voice_profile_name $profile_num + get_voice_profile_signaling_protocol $profile_num + get_voice_profile_max_sessions $profile_num + get_voice_profile_number_of_lines $profile_num freecwmp_output "$1$i.SIP." "" "0" - get_sip_proxy_server $profile_num - get_sip_proxy_server_port $profile_num + get_sip_proxy_server $profile_num + get_sip_proxy_server_port $profile_num get_sip_proxy_server_transport $profile_num get_sip_registrar_server $profile_num get_sip_registrar_server_port $profile_num @@ -2979,28 +2431,37 @@ case "$1" in # get_sip_inbound_auth_username $profile_num # get_sip_inbound_auth_password $profile_num # Line - local line_number="0" - for line_name in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|grep sip$profile_num|awk -F'.' '{print$2}'`;do - let line_number=$line_number+1 + for line_name in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|grep sip$profile_num$|awk -F'.' '{print$2}'`;do + line_id=`echo $line_name|sed 's/brcm//g'` + if [ $line_id -gt $max_line ];then + continue + fi + line_number=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.instances|cut -d : -f$num` freecwmp_output "$1$i.Line.$line_number." "" "1" - get_line_enable $profile_num $line_name $line_number - get_line_directory_number $profile_num $line_name $line_number - get_line_status $profile_num $line_name $line_number - get_line_call_state $profile_num $line_name $line_number + get_line_enable $profile_num $line_name + get_line_directory_number $profile_num $line_name + get_line_status $profile_num $line_name + get_line_call_state $profile_num $line_name freecwmp_output "$1$i.Line.$line_number.CallingFeatures." "" "0" - get_line_calling_features_caller_id_name $profile_num $line_name $line_number + get_line_calling_features_caller_id_name $profile_num $line_name + get_line_x_002207_line_profile $profile_num $line_name freecwmp_output "$1$i.Line.$line_number.SIP." "" "0" - get_line_sip_username $profile_num $line_name $line_number - get_line_sip_password $profile_num $line_name $line_number - get_line_sip_uri $profile_num $line_name $line_number + get_line_sip_username $profile_num $line_name + get_line_sip_password $profile_num $line_name + get_line_sip_uri $profile_num $line_name done - done fi + done return $FAULT_CPE_NO_FAULT ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].) + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.) freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}." "rc" "num" if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then + let sip_id=$num-1 + exist=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.sip$sip_id` + if [ "$exist" = "" ];then + return $FAULT_CPE_INVALID_PARAMETER_NAME + fi let profile_num=$num-1 get_voice_profile_enable $profile_num get_voice_profile_reset $profile_num @@ -3012,7 +2473,7 @@ case "$1" in freecwmp_output "$1SIP." "" "0" get_sip_proxy_server $profile_num get_sip_proxy_server_port $profile_num - get_sip_proxy_server_transport $profile_num + get_sip_proxy_server_transport $profile_num get_sip_registrar_server $profile_num get_sip_registrar_server_port $profile_num get_sip_registrar_server_transport $profile_num @@ -3032,412 +2493,351 @@ case "$1" in # get_sip_inbound_auth_username $profile_num # get_sip_inbound_auth_password $profile_num # Line - local line_number="0" - for line_name in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|grep sip$profile_num|awk -F'.' '{print$2}'`;do - let line_number=$line_number+1 + for line_name in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|grep sip$profile_num$|awk -F'.' '{print$2}'`;do + line_id=`echo $line_name|sed 's/brcm//g'` + if [ $line_id -gt $max_line ];then + continue + fi + line_number=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.instances|cut -d : -f$num` freecwmp_output "$1Line.$line_number." "" "1" - get_line_enable $profile_num $line_name $line_number - get_line_directory_number $profile_num $line_name $line_number - get_line_status $profile_num $line_name $line_number - get_line_call_state $profile_num $line_name $line_number + get_line_enable $profile_num $line_name + get_line_directory_number $profile_num $line_name + get_line_status $profile_num $line_name + get_line_call_state $profile_num $line_name freecwmp_output "$1Line.$line_number.CallingFeatures." "" "0" - get_line_calling_features_caller_id_name $profile_num $line_name $line_number + get_line_calling_features_caller_id_name $profile_num $line_name + get_line_x_002207_line_profile $profile_num $line_name freecwmp_output "$1Line.$line_number.SIP." "" "0" - get_line_sip_username $profile_num $line_name $line_number - get_line_sip_password $profile_num $line_name $line_number - get_line_sip_uri $profile_num $line_name $line_number + get_line_sip_username $profile_num $line_name + get_line_sip_password $profile_num $line_name + get_line_sip_uri $profile_num $line_name done fi fi return $FAULT_CPE_NO_FAULT ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.) + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.) freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP." "rc" "num" if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then + let sip_id=$num-1 + exist=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.sip$sip_id` + if [ "$exist" = "" ];then + return $FAULT_CPE_INVALID_PARAMETER_NAME + fi let profile_num=$num-1 freecwmp_output "$1" "" "0" - if [ "$2" = "0" ];then - get_sip_proxy_server $profile_num - get_sip_proxy_server_port $profile_num - get_sip_proxy_server_transport $profile_num - get_sip_registrar_server $profile_num - get_sip_registrar_server_port $profile_num - get_sip_registrar_server_transport $profile_num - get_sip_user_agent_domain $profile_num - get_sip_user_agent_port $profile_num - get_sip_user_agent_transport $profile_num - get_sip_outbound_proxy $profile_num - get_sip_outbound_proxy_port $profile_num - # get_sip_organization $profile_num - get_sip_registration_period $profile_num - # get_sip_invite_expires $profile_num - get_sip_re_invite_expires $profile_num - get_sip_register_expires $profile_num - # get_sip_registers_min_expires $profile_num - get_sip_register_retry_interval $profile_num - # get_sip_inbound_auth $profile_num - # get_sip_inbound_auth_username $profile_num - # get_sip_inbound_auth_password $profile_num - fi - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].Enable) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.Enable" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - if [ "$2" = "1" ]; then - return $FAULT_CPE_INVALID_ARGUMENTS - fi - get_voice_profile_enable $profile_num - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].Reset) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.Reset" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - if [ "$2" = "1" ]; then - return $FAULT_CPE_INVALID_ARGUMENTS - fi - get_voice_profile_reset $profile_num - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].Name) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.Name" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - if [ "$2" = "1" ]; then - return $FAULT_CPE_INVALID_ARGUMENTS - fi - get_voice_profile_name $profile_num - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SignalingProtocol) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SignalingProtocol" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - if [ "$2" = "1" ]; then - return $FAULT_CPE_INVALID_ARGUMENTS - fi - get_voice_profile_signaling_protocol $profile_num - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].MaxSessions) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.MaxSessions" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - if [ "$2" = "1" ]; then - return $FAULT_CPE_INVALID_ARGUMENTS - fi - get_voice_profile_max_sessions $profile_num - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].NumberOfLines) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.NumberOfLines" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - if [ "$2" = "1" ]; then - return $FAULT_CPE_INVALID_ARGUMENTS - fi - get_voice_profile_number_of_lines $profile_num - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.ProxyServer) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.ProxyServer" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - if [ "$2" = "1" ]; then - return $FAULT_CPE_INVALID_ARGUMENTS - fi get_sip_proxy_server $profile_num - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.ProxyServerPort) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.ProxyServerPort" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - if [ "$2" = "1" ]; then - return $FAULT_CPE_INVALID_ARGUMENTS - fi get_sip_proxy_server_port $profile_num - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.ProxyServerTransport) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.ProxyServerTransport" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - if [ "$2" = "1" ]; then - return $FAULT_CPE_INVALID_ARGUMENTS - fi get_sip_proxy_server_transport $profile_num - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.RegistrarServer) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.RegistrarServer" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - if [ "$2" = "1" ]; then - return $FAULT_CPE_INVALID_ARGUMENTS - fi get_sip_registrar_server $profile_num - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.RegistrarServerPort) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.RegistrarServerPort" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - if [ "$2" = "1" ]; then - return $FAULT_CPE_INVALID_ARGUMENTS - fi get_sip_registrar_server_port $profile_num - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.RegistrarServerTransport) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.RegistrarServerTransport" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - if [ "$2" = "1" ]; then - return $FAULT_CPE_INVALID_ARGUMENTS - fi get_sip_registrar_server_transport $profile_num - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.UserAgentDomain) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.UserAgentDomain" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - if [ "$2" = "1" ]; then - return $FAULT_CPE_INVALID_ARGUMENTS - fi get_sip_user_agent_domain $profile_num - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.UserAgentPort) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.UserAgentPort" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - if [ "$2" = "1" ]; then - return $FAULT_CPE_INVALID_ARGUMENTS - fi get_sip_user_agent_port $profile_num - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.UserAgentTransport) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.UserAgentTransport" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - if [ "$2" = "1" ]; then - return $FAULT_CPE_INVALID_ARGUMENTS - fi get_sip_user_agent_transport $profile_num - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.OutboundProxy) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.OutboundProxy" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - if [ "$2" = "1" ]; then - return $FAULT_CPE_INVALID_ARGUMENTS - fi get_sip_outbound_proxy $profile_num - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.OutboundProxyPort) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.OutboundProxyPort" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - if [ "$2" = "1" ]; then - return $FAULT_CPE_INVALID_ARGUMENTS - fi get_sip_outbound_proxy_port $profile_num - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.Organization) - return $FAULT_CPE_INVALID_PARAMETER_NAME - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.Organization" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - if [ "$2" = "1" ]; then - return $FAULT_CPE_INVALID_ARGUMENTS - fi - get_sip_organization $profile_num - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.RegistrationPeriod) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.RegistrationPeriod" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - if [ "$2" = "1" ]; then - return $FAULT_CPE_INVALID_ARGUMENTS - fi + # get_sip_organization $profile_num get_sip_registration_period $profile_num - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.InviteExpires) - return $FAULT_CPE_INVALID_PARAMETER_NAME - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.InviteExpires" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - if [ "$2" = "1" ]; then - return $FAULT_CPE_INVALID_ARGUMENTS - fi - get_sip_invite_expires $profile_num - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.ReInviteExpires) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.ReInviteExpires" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - if [ "$2" = "1" ]; then - return $FAULT_CPE_INVALID_ARGUMENTS - fi + # get_sip_invite_expires $profile_num get_sip_re_invite_expires $profile_num - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.RegisterExpires) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.RegisterExpires" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - if [ "$2" = "1" ]; then - return $FAULT_CPE_INVALID_ARGUMENTS - fi get_sip_register_expires $profile_num - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.RegistersMinExpires) - return $FAULT_CPE_INVALID_PARAMETER_NAME - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.RegistersMinExpires" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - if [ "$2" = "1" ]; then - return $FAULT_CPE_INVALID_ARGUMENTS - fi - get_sip_registers_min_expires $profile_num - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.RegisterRetryInterval) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.RegisterRetryInterval" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - if [ "$2" = "1" ]; then - return $FAULT_CPE_INVALID_ARGUMENTS - fi + # get_sip_registers_min_expires $profile_num get_sip_register_retry_interval $profile_num + # get_sip_inbound_auth $profile_num + # get_sip_inbound_auth_username $profile_num + # get_sip_inbound_auth_password $profile_num fi return $FAULT_CPE_NO_FAULT ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.InboundAuth) + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Enable) + if [ "$2" = "1" ]; then + return $FAULT_CPE_INVALID_ARGUMENTS + fi + get_set_voice_service_parameter "$1" "get_voice_profile_enable" "Enable" "$max_num" + return $? + ;; + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Reset) + if [ "$2" = "1" ]; then + return $FAULT_CPE_INVALID_ARGUMENTS + fi + get_set_voice_service_parameter "$1" "get_voice_profile_reset" "Reset" "$max_num" + return $? + ;; + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Name) + if [ "$2" = "1" ]; then + return $FAULT_CPE_INVALID_ARGUMENTS + fi + get_set_voice_service_parameter "$1" "get_voice_profile_name" "Name" "$max_num" + return $? + ;; + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SignalingProtocol) + if [ "$2" = "1" ]; then + return $FAULT_CPE_INVALID_ARGUMENTS + fi + get_set_voice_service_parameter "$1" "get_voice_profile_signaling_protocol" "SignalingProtocol" "$max_num" + return $? + ;; + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.MaxSessions) + if [ "$2" = "1" ]; then + return $FAULT_CPE_INVALID_ARGUMENTS + fi + get_set_voice_service_parameter "$1" "get_voice_profile_max_sessions" "MaxSessions" "$max_num" + return $? + ;; + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.NumberOfLines) + if [ "$2" = "1" ]; then + return $FAULT_CPE_INVALID_ARGUMENTS + fi + get_set_voice_service_parameter "$1" "get_voice_profile_number_of_lines" "NumberOfLines" "$max_num" + return $? + ;; + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.ProxyServer) + if [ "$2" = "1" ]; then + return $FAULT_CPE_INVALID_ARGUMENTS + fi + get_set_voice_service_parameter "$1" "get_sip_proxy_server" "SIP.ProxyServer" "$max_num" + return $? + ;; + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.ProxyServerPort) + if [ "$2" = "1" ]; then + return $FAULT_CPE_INVALID_ARGUMENTS + fi + get_set_voice_service_parameter "$1" "get_sip_proxy_server_port" "SIP.ProxyServerPort" "$max_num" + return $? + ;; + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.ProxyServerTransport) + if [ "$2" = "1" ]; then + return $FAULT_CPE_INVALID_ARGUMENTS + fi + get_set_voice_service_parameter "$1" "get_sip_proxy_server_transport" "SIP.ProxyServerTransport" "$max_num" + return $? + ;; + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.RegistrarServer) + if [ "$2" = "1" ]; then + return $FAULT_CPE_INVALID_ARGUMENTS + fi + get_set_voice_service_parameter "$1" "get_sip_registrar_server" "SIP.RegistrarServer" "$max_num" + return $? + ;; + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.RegistrarServerPort) + if [ "$2" = "1" ]; then + return $FAULT_CPE_INVALID_ARGUMENTS + fi + get_set_voice_service_parameter "$1" "get_sip_registrar_server_port" "SIP.RegistrarServerPort" "$max_num" + return $? + ;; + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.RegistrarServerTransport) + if [ "$2" = "1" ]; then + return $FAULT_CPE_INVALID_ARGUMENTS + fi + get_set_voice_service_parameter "$1" "get_sip_registrar_server_transport" "SIP.RegistrarServerTransport" "$max_num" + return $? + ;; + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.UserAgentDomain) + if [ "$2" = "1" ]; then + return $FAULT_CPE_INVALID_ARGUMENTS + fi + get_set_voice_service_parameter "$1" "get_sip_user_agent_domain" "SIP.UserAgentDomain" "$max_num" + return $? + ;; + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.UserAgentPort) + if [ "$2" = "1" ]; then + return $FAULT_CPE_INVALID_ARGUMENTS + fi + get_set_voice_service_parameter "$1" "get_sip_user_agent_port" "SIP.UserAgentPort" "$max_num" + return $? + ;; + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.UserAgentTransport) + if [ "$2" = "1" ]; then + return $FAULT_CPE_INVALID_ARGUMENTS + fi + get_set_voice_service_parameter "$1" "get_sip_user_agent_transport" "SIP.UserAgentTransport" "$max_num" + return $? + ;; + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.OutboundProxy) + if [ "$2" = "1" ]; then + return $FAULT_CPE_INVALID_ARGUMENTS + fi + get_set_voice_service_parameter "$1" "get_sip_outbound_proxy" "SIP.OutboundProxy" "$max_num" + return $? + ;; + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.OutboundProxyPort) + if [ "$2" = "1" ]; then + return $FAULT_CPE_INVALID_ARGUMENTS + fi + get_set_voice_service_parameter "$1" "get_sip_outbound_proxy_port" "SIP.OutboundProxyPort" "$max_num" + return $? + ;; + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.Organization) return $FAULT_CPE_INVALID_PARAMETER_NAME - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.InboundAuth" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - if [ "$2" = "1" ]; then - return $FAULT_CPE_INVALID_ARGUMENTS - fi - get_sip_inbound_auth $profile_num + if [ "$2" = "1" ]; then + return $FAULT_CPE_INVALID_ARGUMENTS fi - return $FAULT_CPE_NO_FAULT + get_set_voice_service_parameter "$1" "get_sip_organization" "SIP.Organization" "$max_num" + return $? ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.InboundAuthUsername) + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.RegistrationPeriod) + if [ "$2" = "1" ]; then + return $FAULT_CPE_INVALID_ARGUMENTS + fi + get_set_voice_service_parameter "$1" "get_sip_registration_period" "SIP.RegistrationPeriod" "$max_num" + return $? + ;; + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.InviteExpires) return $FAULT_CPE_INVALID_PARAMETER_NAME - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.InboundAuthUsername" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - if [ "$2" = "1" ]; then - return $FAULT_CPE_INVALID_ARGUMENTS - fi - get_sip_inbound_auth_username $profile_num + if [ "$2" = "1" ]; then + return $FAULT_CPE_INVALID_ARGUMENTS fi - return $FAULT_CPE_NO_FAULT + get_set_voice_service_parameter "$1" "get_sip_invite_expires" "SIP.InviteExpires" "$max_num" + return $? ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.InboundAuthPassword) + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.ReInviteExpires) + if [ "$2" = "1" ]; then + return $FAULT_CPE_INVALID_ARGUMENTS + fi + get_set_voice_service_parameter "$1" "get_sip_re_invite_expires" "SIP.ReInviteExpires" "$max_num" + return $? + ;; + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.RegisterExpires) + if [ "$2" = "1" ]; then + return $FAULT_CPE_INVALID_ARGUMENTS + fi + get_set_voice_service_parameter "$1" "get_sip_register_expires" "SIP.RegisterExpires" "$max_num" + return $? + ;; + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.RegistersMinExpires) return $FAULT_CPE_INVALID_PARAMETER_NAME - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.InboundAuthPassword" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - if [ "$2" = "1" ]; then - return $FAULT_CPE_INVALID_ARGUMENTS - fi - get_sip_inbound_auth_password $profile_num + if [ "$2" = "1" ]; then + return $FAULT_CPE_INVALID_ARGUMENTS fi - return $FAULT_CPE_NO_FAULT + get_set_voice_service_parameter "$1" "get_sip_registers_min_expires" "SIP.RegistersMinExpires" "$max_num" + return $? ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].Line.) + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.RegisterRetryInterval) + if [ "$2" = "1" ]; then + return $FAULT_CPE_INVALID_ARGUMENTS + fi + get_set_voice_service_parameter "$1" "get_sip_register_retry_interval" "SIP.RegisterRetryInterval" "$max_num" + return $? + ;; + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.InboundAuth) + return $FAULT_CPE_INVALID_PARAMETER_NAME + if [ "$2" = "1" ]; then + return $FAULT_CPE_INVALID_ARGUMENTS + fi + get_set_voice_service_parameter "$1" "get_sip_inbound_auth" "SIP.InboundAuth" "$max_num" + return $? + ;; + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.InboundAuthUsername) + return $FAULT_CPE_INVALID_PARAMETER_NAME + if [ "$2" = "1" ]; then + return $FAULT_CPE_INVALID_ARGUMENTS + fi + get_set_voice_service_parameter "$1" "get_sip_inbound_auth_username" "SIP.InboundAuthUsername" "$max_num" + return $? + ;; + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.InboundAuthPassword) + return $FAULT_CPE_INVALID_PARAMETER_NAME + if [ "$2" = "1" ]; then + return $FAULT_CPE_INVALID_ARGUMENTS + fi + get_set_voice_service_parameter "$1" "get_sip_inbound_auth_password" "SIP.InboundAuthPassword" "$max_num" + return $? + ;; + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.) freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.Line." "rc" "num" if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then + let sip_id=$num-1 + exist=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.sip$sip_id` + if [ "$exist" = "" ];then + return $FAULT_CPE_INVALID_PARAMETER_NAME + fi let profile_num=$num-1 freecwmp_output "$1" "" "1" # Line - if [ "$2" = "0" ];then - local line_number="0" - for line_name in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|grep sip$profile_num|awk -F'.' '{print$2}'`;do - let line_number=$line_number+1 - freecwmp_output "$1$line_number." "" "1" - get_line_enable $profile_num $line_name $line_number - get_line_directory_number $profile_num $line_name $line_number - get_line_status $profile_num $line_name $line_number - get_line_call_state $profile_num $line_name $line_number - freecwmp_output "$1$line_number.CallingFeatures." "" "0" - get_line_calling_features_caller_id_name $profile_num $line_name $line_number - freecwmp_output "$1$line_number.SIP." "" "0" - get_line_sip_username $profile_num $line_name $line_number - get_line_sip_password $profile_num $line_name $line_number - get_line_sip_uri $profile_num $line_name $line_number - done - fi + for line_name in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|grep sip$profile_num$|awk -F'.' '{print$2}'`;do + line_id=`echo $line_name|sed 's/brcm//g'` + if [ $line_id -gt $max_line ];then + continue + fi + line_number=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.instances|cut -d : -f$num` + freecwmp_output "$1$line_number." "" "1" + get_line_enable $profile_num $line_name + get_line_directory_number $profile_num $line_name + get_line_status $profile_num $line_name + get_line_call_state $profile_num $line_name + freecwmp_output "$1$line_number.CallingFeatures." "" "0" + get_line_calling_features_caller_id_name $profile_num $line_name + get_line_x_002207_line_profile $profile_num $line_name + freecwmp_output "$1$line_number.SIP." "" "0" + if [ "$2" = "0" ];then + get_line_sip_username $profile_num $line_name + get_line_sip_password $profile_num $line_name + get_line_sip_uri $profile_num $line_name + fi + done fi return $FAULT_CPE_NO_FAULT ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].Line.[1-$max_line].) + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.) freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.Line.{i}." "rc" "num" if [ $rc -eq 0 ]; then local profile_num=`echo $num | awk '{ print $1 }'` local line_number=`echo $num | awk '{ print $2 }'` + let sip_id=$profile_num-1 + exist=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.sip$sip_id` + if [ "$exist" = "" ];then + return $FAULT_CPE_INVALID_PARAMETER_NAME + fi + line_instances_list=`get_line_instances_list $profile_num` + local l_inst_found=0 + for line_instance in $line_instances_list;do + if [ "$line_instance" = "$line_number" ];then + l_inst_found=1 + break + fi + done + if [ "$l_inst_found" = "0" ];then + return $FAULT_CPE_INVALID_PARAMETER_NAME + fi + if [ $profile_num -gt 0 ] && [ $profile_num -le $max_num ]; then - let profile_num=$profile_num-1 # Line - local max_line_number=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep brcm|grep -c sip$profile_num` + local max_line_number=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep brcm|grep instances|awk -F '=' '{print $2'}|cut -f$profile_num -d:|sort -u|tail -1` + let profile_num=$profile_num-1 if [ $line_number -gt 0 ] && [ $line_number -le $max_line_number ]; then local count=0 - for line_name in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|grep sip$profile_num|awk -F'.' '{print$2}'`;do - let count=$count+1 - if [ "$count" = "$line_number" ];then break;fi + local found=0 + for line_name in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|grep sip$profile_num$|awk -F'.' '{print$2}'`;do + line_id=`echo $line_name|sed 's/brcm//g'` + if [ $line_id -gt $max_line ];then + continue + fi + let p_instance=$profile_num+1 + count=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client.$line_name.instances|cut -f$p_instance -d:` + if [ "$count" = "$line_number" ];then + found=1 + break + fi done - freecwmp_output "$1" "" "1" - get_line_enable $profile_num $line_name $line_number - get_line_directory_number $profile_num $line_name $line_number - get_line_status $profile_num $line_name $line_number - get_line_call_state $profile_num $line_name $line_number - if [ "$2" = "0" ];then - freecwmp_output "$1CallingFeatures." "" "0" - get_line_calling_features_caller_id_name $profile_num $line_name $line_number - freecwmp_output "$1SIP." "" "0" - get_line_sip_username $profile_num $line_name $line_number - get_line_sip_password $profile_num $line_name $line_number - get_line_sip_uri $profile_num $line_name $line_number + if [ "$found" = "1" ];then + freecwmp_output "$1" "" "1" + get_line_enable $profile_num $line_name + get_line_directory_number $profile_num $line_name + get_line_status $profile_num $line_name + get_line_call_state $profile_num $line_name + get_line_x_002207_line_profile $profile_num $line_name + if [ "$2" = "0" ];then + freecwmp_output "$1CallingFeatures." "" "0" + get_line_calling_features_caller_id_name $profile_num $line_name + freecwmp_output "$1SIP." "" "0" + get_line_sip_username $profile_num $line_name + get_line_sip_password $profile_num $line_name + get_line_sip_uri $profile_num $line_name + fi + else + return $FAULT_CPE_INVALID_PARAMETER_NAME fi else return $FAULT_CPE_INVALID_PARAMETER_NAME; @@ -3448,23 +2848,82 @@ case "$1" in fi return $FAULT_CPE_NO_FAULT ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].Line.[1-$max_line].CallingFeatures.) + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.Enable) + if [ "$2" = "1" ]; then + return $FAULT_CPE_INVALID_ARGUMENTS + fi + get_set_line_parameter "$1" "get_line_enable" "Enable" "$max_num" + return $? + ;; + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.DirectoryNumber) + if [ "$2" = "1" ]; then + return $FAULT_CPE_INVALID_ARGUMENTS + fi + get_set_line_parameter "$1" "get_line_directory_number" "DirectoryNumber" "$max_num" + return $? + ;; + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.Status) + if [ "$2" = "1" ]; then + return $FAULT_CPE_INVALID_ARGUMENTS + fi + get_set_line_parameter "$1" "get_line_status" "Status" "$max_num" + return $? + ;; + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.CallState) + if [ "$2" = "1" ]; then + return $FAULT_CPE_INVALID_ARGUMENTS + fi + get_set_line_parameter "$1" "get_line_call_state" "CallState" "$max_num" + return $? + ;; + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.CallingFeatures.) freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.Line.{i}.CallingFeatures." "rc" "num" if [ $rc -eq 0 ]; then local profile_num=`echo $num | awk '{ print $1 }'` local line_number=`echo $num | awk '{ print $2 }'` + let sip_id=$profile_num-1 + exist=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.sip$sip_id` + if [ "$exist" = "" ];then + return $FAULT_CPE_INVALID_PARAMETER_NAME + fi + line_instances_list=`get_line_instances_list $profile_num` + local l_inst_found=0 + for line_instance in $line_instances_list;do + if [ "$line_instance" = "$line_number" ];then + l_inst_found=1 + break + fi + done + if [ "$l_inst_found" = "0" ];then + return $FAULT_CPE_INVALID_PARAMETER_NAME + fi if [ $profile_num -gt 0 ] && [ $profile_num -le $max_num ]; then - let profile_num=$profile_num-1 # Line - local max_line_number=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep brcm|grep -c sip$profile_num` + local max_line_number=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep brcm|grep instances|awk -F '=' '{print $2'}|cut -f$profile_num -d:|sort -u|tail -1` + let profile_num=$profile_num-1 if [ $line_number -gt 0 ] && [ $line_number -le $max_line_number ]; then local count=0 - for line_name in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|grep sip$profile_num|awk -F'.' '{print$2}'`;do - let count=$count+1 - if [ "$count" = "$line_number" ];then break;fi + local found=0 + for line_name in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|grep sip$profile_num$|awk -F'.' '{print$2}'`;do + line_id=`echo $line_name|sed 's/brcm//g'` + if [ $line_id -gt $max_line ];then + continue + fi + let p_instance=$profile_num+1 + count=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client.$line_name.instances|cut -f$p_instance -d:` + if [ "$count" = "$line_number" ];then + found=1 + break + fi done - freecwmp_output "$1" "" "0" - get_line_calling_features_caller_id_name $profile_num $line_name $line_number + if [ "$found" = "1" ];then + freecwmp_output "$1" "" "0" + if [ "$2" = "0" ];then + get_line_calling_features_caller_id_name $profile_num $line_name + fi + else + return $FAULT_CPE_INVALID_PARAMETER_NAME + fi else return $FAULT_CPE_INVALID_PARAMETER_NAME; fi @@ -3474,53 +2933,71 @@ case "$1" in fi return $FAULT_CPE_NO_FAULT ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].Line.[1-$max_line].CallingFeatures.CallerIDName) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.Line.{i}.CallingFeatures.CallerIDName" "rc" "num" - if [ $rc -eq 0 ]; then - local profile_num=`echo $num | awk '{ print $1 }'` - local line_number=`echo $num | awk '{ print $2 }'` - if [ $profile_num -gt 0 ] && [ $profile_num -le $max_num ]; then - let profile_num=$profile_num-1 - # Line - local max_line_number=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep brcm|grep -c sip$profile_num` - if [ $line_number -gt 0 ] && [ $line_number -le $max_line_number ]; then - if [ "$2" = "1" ]; then - return $FAULT_CPE_INVALID_ARGUMENTS - fi - local count=0 - for line_name in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|grep sip$profile_num|awk -F'.' '{print$2}'`;do - let count=$count+1 - if [ "$count" = "$line_number" ];then break;fi - done - get_line_calling_features_caller_id_name $profile_num $line_name $line_number - else - return $FAULT_CPE_INVALID_PARAMETER_NAME; - fi - else - return $FAULT_CPE_INVALID_PARAMETER_NAME; - fi + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.CallingFeatures.CallerIDName) + if [ "$2" = "1" ]; then + return $FAULT_CPE_INVALID_ARGUMENTS fi - return $FAULT_CPE_NO_FAULT + get_set_line_parameter "$1" "get_line_calling_features_caller_id_name" "CallingFeatures.CallerIDName" "$max_num" + return $? ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].Line.[1-$max_line].SIP.) + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.X_002207_LineProfile) + if [ "$2" = "1" ]; then + return $FAULT_CPE_INVALID_ARGUMENTS + fi + get_set_line_parameter "$1" "get_line_x_002207_line_profile" "X_002207_LineProfile" "$max_num" + return $? + ;; + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.SIP.) freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.Line.{i}.SIP." "rc" "num" if [ $rc -eq 0 ]; then local profile_num=`echo $num | awk '{ print $1 }'` local line_number=`echo $num | awk '{ print $2 }'` + let sip_id=$profile_num-1 + exist=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.sip$sip_id` + if [ "$exist" = "" ];then + return $FAULT_CPE_INVALID_PARAMETER_NAME + fi + line_instances_list=`get_line_instances_list $profile_num` + local l_inst_found=0 + for line_instance in $line_instances_list;do + if [ "$line_instance" = "$line_number" ];then + l_inst_found=1 + break + fi + done + if [ "$l_inst_found" = "0" ];then + return $FAULT_CPE_INVALID_PARAMETER_NAME + fi + if [ $profile_num -gt 0 ] && [ $profile_num -le $max_num ]; then - let profile_num=$profile_num-1 # Line - local max_line_number=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep brcm|grep -c sip$profile_num` + local max_line_number=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep brcm|grep instances|awk -F '=' '{print $2'}|cut -f$profile_num -d:|sort -u|tail -1` + let profile_num=$profile_num-1 if [ $line_number -gt 0 ] && [ $line_number -le $max_line_number ]; then local count=0 - for line_name in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|grep sip$profile_num|awk -F'.' '{print$2}'`;do - let count=$count+1 - if [ "$count" = "$line_number" ];then break;fi + local found=0 + for line_name in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|grep sip$profile_num$|awk -F'.' '{print$2}'`;do + line_id=`echo $line_name|sed 's/brcm//g'` + if [ $line_id -gt $max_line ];then + continue + fi + let p_instance=$profile_num+1 + count=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client.$line_name.instances|cut -f$p_instance -d:` + if [ "$count" = "$line_number" ];then + found=1 + break + fi done - freecwmp_output "$1" "" "0" - get_line_sip_username $profile_num $line_name $line_number - get_line_sip_password $profile_num $line_name $line_number - get_line_sip_uri $profile_num $line_name $line_number + if [ "$found" = "1" ];then + freecwmp_output "$1" "" "0" + if [ "$2" = "0" ];then + get_line_sip_username $profile_num $line_name + get_line_sip_password $profile_num $line_name + get_line_sip_uri $profile_num $line_name + fi + else + return $FAULT_CPE_INVALID_PARAMETER_NAME + fi else return $FAULT_CPE_INVALID_PARAMETER_NAME; fi @@ -3530,94 +3007,32 @@ case "$1" in fi return $FAULT_CPE_NO_FAULT ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].Line.[1-$max_line].SIP.AuthUserName) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.Line.{i}.SIP.AuthUserName" "rc" "num" - if [ $rc -eq 0 ]; then - local profile_num=`echo $num | awk '{ print $1 }'` - local line_number=`echo $num | awk '{ print $2 }'` - if [ $profile_num -gt 0 ] && [ $profile_num -le $max_num ]; then - let profile_num=$profile_num-1 - # Line - local max_line_number=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep brcm|grep -c sip$profile_num` - if [ $line_number -gt 0 ] && [ $line_number -le $max_line_number ]; then - if [ "$2" = "1" ]; then - return $FAULT_CPE_INVALID_ARGUMENTS - fi - local count=0 - for line_name in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|grep sip$profile_num|awk -F'.' '{print$2}'`;do - let count=$count+1 - if [ "$count" = "$line_number" ];then break;fi - done - get_line_sip_username $profile_num $line_name $line_number - else - return $FAULT_CPE_INVALID_PARAMETER_NAME; + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.SIP.AuthUserName) + if [ "$2" = "1" ]; then + return $FAULT_CPE_INVALID_ARGUMENTS fi - else - return $FAULT_CPE_INVALID_PARAMETER_NAME; - fi - fi - return $FAULT_CPE_NO_FAULT + get_set_line_parameter "$1" "get_line_sip_username" "SIP.AuthUserName" "$max_num" + return $? ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].Line.[1-$max_line].SIP.AuthPassword) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.Line.{i}.SIP.AuthPassword" "rc" "num" - if [ $rc -eq 0 ]; then - local profile_num=`echo $num | awk '{ print $1 }'` - local line_number=`echo $num | awk '{ print $2 }'` - if [ $profile_num -gt 0 ] && [ $profile_num -le $max_num ]; then - let profile_num=$profile_num-1 - # Line - local max_line_number=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep brcm|grep -c sip$profile_num` - if [ $line_number -gt 0 ] && [ $line_number -le $max_line_number ]; then - if [ "$2" = "1" ]; then - return $FAULT_CPE_INVALID_ARGUMENTS - fi - local count=0 - for line_name in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|grep sip$profile_num|awk -F'.' '{print$2}'`;do - let count=$count+1 - if [ "$count" = "$line_number" ];then break;fi - done - get_line_sip_password $profile_num $line_name $line_number - else - return $FAULT_CPE_INVALID_PARAMETER_NAME; - fi - else - return $FAULT_CPE_INVALID_PARAMETER_NAME; + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.SIP.AuthPassword) + if [ "$2" = "1" ]; then + return $FAULT_CPE_INVALID_ARGUMENTS fi - fi - return $FAULT_CPE_NO_FAULT + get_set_line_parameter "$1" "get_line_sip_password" "SIP.AuthPassword" "$max_num" + return $? ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].Line.[1-$max_line].SIP.URI) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.Line.{i}.SIP.URI" "rc" "num" - if [ $rc -eq 0 ]; then - local profile_num=`echo $num | awk '{ print $1 }'` - local line_number=`echo $num | awk '{ print $2 }'` - if [ $profile_num -gt 0 ] && [ $profile_num -le $max_num ]; then - let profile_num=$profile_num-1 - # Line - local max_line_number=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep brcm|grep -c sip$profile_num` - if [ $line_number -gt 0 ] && [ $line_number -le $max_line_number ]; then - if [ "$2" = "1" ]; then - return $FAULT_CPE_INVALID_ARGUMENTS - fi - local count=0 - for line_name in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|grep sip$profile_num|awk -F'.' '{print$2}'`;do - let count=$count+1 - if [ "$count" = "$line_number" ];then break;fi - done - get_line_sip_uri $profile_num $line_name $line_number - else - return $FAULT_CPE_INVALID_PARAMETER_NAME; - fi - else - return $FAULT_CPE_INVALID_PARAMETER_NAME; - fi + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.SIP.URI) + if [ "$2" = "1" ]; then + return $FAULT_CPE_INVALID_ARGUMENTS fi - return $FAULT_CPE_NO_FAULT + get_set_line_parameter "$1" "get_line_sip_uri" "SIP.URI" "$max_num" + return $? ;; esac -return $FAULT_CPE_INVALID_PARAMETER_NAME; + return $FAULT_CPE_INVALID_PARAMETER_NAME; } + set_voice_service() { local max_profile local max_line @@ -3629,403 +3044,150 @@ let max_num=$max_profile+1 get_voice_service_max_line max_line case "$1" in - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].Enable) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.Enable" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - set_voice_profile_enable $profile_num $2 - fi - return $FAULT_CPE_NO_FAULT + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Enable) + get_set_voice_service_parameter "$1" "set_voice_profile_enable" "Enable" "$max_num" "$2" + return $? ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].Reset) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.Reset" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - set_voice_profile_reset $profile_num $2 - fi - return $FAULT_CPE_NO_FAULT + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Reset) + get_set_voice_service_parameter "$1" "set_voice_profile_reset" "Reset" "$max_num" "$2" + return $? ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].Name) + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Name) return $FAULT_CPE_NON_WRITABLE_PARAMETER ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SignalingProtocol) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SignalingProtocol" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - set_voice_profile_signaling_protocol $profile_num $2 - fi - return $FAULT_CPE_NO_FAULT + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SignalingProtocol) + get_set_voice_service_parameter "$1" "set_voice_profile_signaling_protocol" "SignalingProtocol" "$max_num" "$2" + return $? ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].MaxSessions) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.MaxSessions" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - set_voice_profile_max_sessions $profile_num $2 - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].NumberOfLines) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.NumberOfLines" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - set_voice_profile_number_of_lines $profile_num $2 - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.ProxyServer) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.ProxyServer" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - set_sip_proxy_server $profile_num $2 - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.ProxyServerPort) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.ProxyServerPort" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - set_sip_proxy_server_port $profile_num $2 - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.ProxyServerTransport) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.ProxyServerTransport" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - set_sip_proxy_server_transport $profile_num $2 - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.RegistrarServer) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.RegistrarServer" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - set_sip_registrar_server $profile_num $2 - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.RegistrarServerPort) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.RegistrarServerPort" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - set_sip_registrar_server_port $profile_num $2 - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.RegistrarServerTransport) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.RegistrarServerTransport" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - set_sip_registrar_server_transport $profile_num $2 - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.UserAgentDomain) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.UserAgentDomain" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - set_sip_user_agent_domain $profile_num $2 - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.UserAgentPort) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.UserAgentPort" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - set_sip_user_agent_port $profile_num $2 - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.UserAgentTransport) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.UserAgentTransport" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - set_sip_user_agent_transport $profile_num $2 - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.OutboundProxy) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.OutboundProxy" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - set_sip_outbound_proxy $profile_num $2 - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.OutboundProxyPort) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.OutboundProxyPort" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - set_sip_outbound_proxy_port $profile_num $2 - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.Organization) - return $FAULT_CPE_INVALID_PARAMETER_NAME - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.Organization" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - set_sip_organization $profile_num $2 - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.RegistrationPeriod) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.RegistrationPeriod" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - set_sip_registration_period $profile_num $2 - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.InviteExpires) - return $FAULT_CPE_INVALID_PARAMETER_NAME - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.InviteExpires" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - set_sip_invite_expires $profile_num $2 - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.ReInviteExpires) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.ReInviteExpires" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - set_sip_re_invite_expires $profile_num $2 - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.RegisterExpires) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.RegisterExpires" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - set_sip_register_expires $profile_num $2 - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.RegistersMinExpires) - return $FAULT_CPE_INVALID_PARAMETER_NAME - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.RegistersMinExpires" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - set_sip_registers_min_expires $profile_num $2 - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.RegisterRetryInterval) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.RegisterRetryInterval" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - set_sip_register_retry_interval $profile_num $2 - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.InboundAuth) - return $FAULT_CPE_INVALID_PARAMETER_NAME - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.InboundAuth" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - set_sip_inbound_auth $profile_num $2 - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.InboundAuthUsername) - return $FAULT_CPE_INVALID_PARAMETER_NAME - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.InboundAuthUsername" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - set_sip_inbound_auth_username $profile_num $2 - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.InboundAuthPassword) - return $FAULT_CPE_INVALID_PARAMETER_NAME - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.InboundAuthPassword" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - set_sip_inbound_auth_password $profile_num $2 - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].Line.[1-$max_line].Enable) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.Line.{i}.Enable" "rc" "num" - if [ $rc -eq 0 ]; then - local profile_num=`echo $num | awk '{ print $1 }'` - local line_number=`echo $num | awk '{ print $2 }'` - if [ $profile_num -gt 0 ] && [ $profile_num -le $max_num ]; then - let profile_num=$profile_num-1 - # Line - local max_line_number=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep brcm|grep -c sip$profile_num` - if [ $line_number -gt 0 ] && [ $line_number -le $max_line_number ]; then - local count=0 - for line_name in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|grep sip$profile_num|awk -F'.' '{print$2}'`;do - let count=$count+1 - if [ "$count" = "$line_number" ];then break;fi - done - set_line_enable $profile_num $line_name $line_number $2 - else - return $FAULT_CPE_INVALID_PARAMETER_NAME; - fi - else - return $FAULT_CPE_INVALID_PARAMETER_NAME; - fi - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].Line.[1-$max_line].DirectoryNumber) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.Line.{i}.DirectoryNumber" "rc" "num" - if [ $rc -eq 0 ]; then - local profile_num=`echo $num | awk '{ print $1 }'` - local line_number=`echo $num | awk '{ print $2 }'` - if [ $profile_num -gt 0 ] && [ $profile_num -le $max_num ]; then - let profile_num=$profile_num-1 - # Line - local max_line_number=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep brcm|grep -c sip$profile_num` - if [ $line_number -gt 0 ] && [ $line_number -le $max_line_number ]; then - local count=0 - for line_name in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|grep sip$profile_num|awk -F'.' '{print$2}'`;do - let count=$count+1 - if [ "$count" = "$line_number" ];then break;fi - done - set_line_directory_number $profile_num $line_name $line_number $2 - else - return $FAULT_CPE_INVALID_PARAMETER_NAME; - fi - else - return $FAULT_CPE_INVALID_PARAMETER_NAME; - fi - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].Line.[1-$max_line].Status) + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.MaxSessions) return $FAULT_CPE_NON_WRITABLE_PARAMETER ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].Line.[1-$max_line].CallState) + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.NumberOfLines) return $FAULT_CPE_NON_WRITABLE_PARAMETER ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].Line.[1-$max_line].CallingFeatures.CallerIDName) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.Line.{i}.CallingFeatures.CallerIDName" "rc" "num" - if [ $rc -eq 0 ]; then - local profile_num=`echo $num | awk '{ print $1 }'` - local line_number=`echo $num | awk '{ print $2 }'` - if [ $profile_num -gt 0 ] && [ $profile_num -le $max_num ]; then - let profile_num=$profile_num-1 - # Line - local max_line_number=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep brcm|grep -c sip$profile_num` - if [ $line_number -gt 0 ] && [ $line_number -le $max_line_number ]; then - local count=0 - for line_name in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|grep sip$profile_num|awk -F'.' '{print$2}'`;do - let count=$count+1 - if [ "$count" = "$line_number" ];then break;fi - done - set_line_calling_features_caller_id_name $profile_num $line_name $line_number $2 - else - return $FAULT_CPE_INVALID_PARAMETER_NAME; - fi - else - return $FAULT_CPE_INVALID_PARAMETER_NAME; - fi - fi - return $FAULT_CPE_NO_FAULT + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.ProxyServer) + get_set_voice_service_parameter "$1" "set_sip_proxy_server" "SIP.ProxyServer" "$max_num" "$2" + return $? ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].Line.[1-$max_line].SIP.AuthUserName) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.Line.{i}.SIP.AuthUserName" "rc" "num" - if [ $rc -eq 0 ]; then - local profile_num=`echo $num | awk '{ print $1 }'` - local line_number=`echo $num | awk '{ print $2 }'` - if [ $profile_num -gt 0 ] && [ $profile_num -le $max_num ]; then - let profile_num=$profile_num-1 - # Line - local max_line_number=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep brcm|grep -c sip$profile_num` - if [ $line_number -gt 0 ] && [ $line_number -le $max_line_number ]; then - local count=0 - for line_name in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|grep sip$profile_num|awk -F'.' '{print$2}'`;do - let count=$count+1 - if [ "$count" = "$line_number" ];then break;fi - done - set_line_sip_username $profile_num $line_name $line_number $2 - else - return $FAULT_CPE_INVALID_PARAMETER_NAME; - fi - else - return $FAULT_CPE_INVALID_PARAMETER_NAME; - fi - fi - return $FAULT_CPE_NO_FAULT + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.ProxyServerPort) + get_set_voice_service_parameter "$1" "set_sip_proxy_server_port" "SIP.ProxyServerPort" "$max_num" "$2" + return $? ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].Line.[1-$max_line].SIP.AuthPassword) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.Line.{i}.SIP.AuthPassword" "rc" "num" - if [ $rc -eq 0 ]; then - local profile_num=`echo $num | awk '{ print $1 }'` - local line_number=`echo $num | awk '{ print $2 }'` - if [ $profile_num -gt 0 ] && [ $profile_num -le $max_num ]; then - let profile_num=$profile_num-1 - # Line - local max_line_number=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep brcm|grep -c sip$profile_num` - if [ $line_number -gt 0 ] && [ $line_number -le $max_line_number ]; then - local count=0 - for line_name in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|grep sip$profile_num|awk -F'.' '{print$2}'`;do - let count=$count+1 - if [ "$count" = "$line_number" ];then break;fi - done - set_line_sip_password $profile_num $line_name $line_number $2 - else - return $FAULT_CPE_INVALID_PARAMETER_NAME; - fi - else - return $FAULT_CPE_INVALID_PARAMETER_NAME; - fi - fi - return $FAULT_CPE_NO_FAULT + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.ProxyServerTransport) + get_set_voice_service_parameter "$1" "set_sip_proxy_server_transport" "SIP.ProxyServerTransport" "$max_num" "$2" + return $? ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].Line.[1-$max_line].SIP.URI) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.Line.{i}.SIP.URI" "rc" "num" - if [ $rc -eq 0 ]; then - local profile_num=`echo $num | awk '{ print $1 }'` - local line_number=`echo $num | awk '{ print $2 }'` - if [ $profile_num -gt 0 ] && [ $profile_num -le $max_num ]; then - let profile_num=$profile_num-1 - # Line - local max_line_number=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep brcm|grep -c sip$profile_num` - if [ $line_number -gt 0 ] && [ $line_number -le $max_line_number ]; then - local count=0 - for line_name in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|grep sip$profile_num|awk -F'.' '{print$2}'`;do - let count=$count+1 - if [ "$count" = "$line_number" ];then break;fi - done - set_line_sip_uri $profile_num $line_name $line_number $2 - else - return $FAULT_CPE_INVALID_PARAMETER_NAME; - fi - else - return $FAULT_CPE_INVALID_PARAMETER_NAME; - fi - fi - return $FAULT_CPE_NO_FAULT + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.RegistrarServer) + get_set_voice_service_parameter "$1" "set_sip_registrar_server" "SIP.RegistrarServer" "$max_num" "$2" + return $? ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].Line.[1-$max_line].CallingFeatures.CallerIDName) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.Line.{i}.CallingFeatures.CallerIDName" "rc" "num" - if [ $rc -eq 0 ]; then - local profile_num=`echo $num | awk '{ print $1 }'` - local line_number=`echo $num | awk '{ print $2 }'` - if [ $profile_num -gt 0 ] && [ $profile_num -le $max_num ]; then - let profile_num=$profile_num-1 - # Line - local max_line_number=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep brcm|grep -c sip$profile_num` - if [ $line_number -gt 0 ] && [ $line_number -le $max_line_number ]; then - local count=0 - for line_name in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|grep sip$profile_num|awk -F'.' '{print$2}'`;do - let count=$count+1 - if [ "$count" = "$line_number" ];then break;fi - done - set_line_calling_features_caller_id_name $profile_num $line_name $line_number $2 - else - return $FAULT_CPE_INVALID_PARAMETER_NAME; - fi - else - return $FAULT_CPE_INVALID_PARAMETER_NAME; - fi - fi - return $FAULT_CPE_NO_FAULT + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.RegistrarServerPort) + get_set_voice_service_parameter "$1" "set_sip_registrar_server_port" "SIP.RegistrarServerPort" "$max_num" "$2" + return $? + ;; + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.RegistrarServerTransport) + get_set_voice_service_parameter "$1" "set_sip_registrar_server_transport" "SIP.RegistrarServerTransport" "$max_num" "$2" + return $? + ;; + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.UserAgentDomain) + get_set_voice_service_parameter "$1" "set_sip_user_agent_domain" "SIP.UserAgentDomain" "$max_num" "$2" + return $? + ;; + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.UserAgentPort) + get_set_voice_service_parameter "$1" "set_sip_user_agent_port" "SIP.UserAgentPort" "$max_num" "$2" + return $? + ;; + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.UserAgentTransport) + get_set_voice_service_parameter "$1" "set_sip_user_agent_transport" "SIP.UserAgentTransport" "$max_num" "$2" + return $? + ;; + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.OutboundProxy) + get_set_voice_service_parameter "$1" "set_sip_outbound_proxy" "SIP.OutboundProxy" "$max_num" "$2" + return $? + ;; + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.OutboundProxyPort) + get_set_voice_service_parameter "$1" "set_sip_outbound_proxy_port" "SIP.OutboundProxyPort" "$max_num" "$2" + return $? + ;; + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.Organization) + return $FAULT_CPE_INVALID_PARAMETER_NAME + get_set_voice_service_parameter "$1" "set_sip_organization" "SIP.Organization" "$max_num" "$2" + return $? + ;; + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.RegistrationPeriod) + get_set_voice_service_parameter "$1" "set_sip_registration_period" "SIP.RegistrationPeriod" "$max_num" "$2" + return $? + ;; + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.InviteExpires) + return $FAULT_CPE_INVALID_PARAMETER_NAME + get_set_voice_service_parameter "$1" "set_sip_invite_expires" "SIP.InviteExpires" "$max_num" "$2" + return $? + ;; + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.ReInviteExpires) + get_set_voice_service_parameter "$1" "set_sip_re_invite_expires" "SIP.ReInviteExpires" "$max_num" "$2" + return $? + ;; + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.RegisterExpires) + get_set_voice_service_parameter "$1" "set_sip_register_expires" "SIP.RegisterExpires" "$max_num" "$2" + return $? + ;; + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.RegistersMinExpires) + return $FAULT_CPE_INVALID_PARAMETER_NAME + get_set_voice_service_parameter "$1" "set_sip_registers_min_expires" "SIP.RegistersMinExpires" "$max_num" "$2" + return $? + ;; + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.RegisterRetryInterval) + get_set_voice_service_parameter "$1" "set_sip_register_retry_interval" "SIP.RegisterRetryInterval" "$max_num" "$2" + return $? + ;; + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.InboundAuth) + return $FAULT_CPE_INVALID_PARAMETER_NAME + get_set_voice_service_parameter "$1" "set_sip_inbound_auth" "SIP.InboundAuth" "$max_num" "$2" + return $? + ;; + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.InboundAuthUsername) + return $FAULT_CPE_INVALID_PARAMETER_NAME + get_set_voice_service_parameter "$1" "set_sip_inbound_auth_username" "SIP.InboundAuthUsername" "$max_num" "$2" + return $? + ;; + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.InboundAuthPassword) + return $FAULT_CPE_INVALID_PARAMETER_NAME + get_set_voice_service_parameter "$1" "set_sip_inbound_auth_password" "SIP.InboundAuthPassword" "$max_num" "$2" + return $? + ;; + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.Enable) + get_set_line_parameter "$1" "set_line_enable" "Enable" "$max_num" "$2" + return $? + ;; + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.DirectoryNumber) + get_set_line_parameter "$1" "set_line_directory_number" "DirectoryNumber" "$max_num" "$2" + return $? + ;; + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.Status) + return $FAULT_CPE_NON_WRITABLE_PARAMETER + ;; + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.CallState) + return $FAULT_CPE_NON_WRITABLE_PARAMETER + ;; + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.CallingFeatures.CallerIDName) + get_set_line_parameter "$1" "set_line_calling_features_caller_id_name" "CallingFeatures.CallerIDName" "$max_num" "$2" + return $? + ;; + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.X_002207_LineProfile) + get_set_line_parameter "$1" "set_line_x_002207_line_profile" "X_002207_LineProfile" "$max_num" "$2" + return $? + ;; + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.SIP.AuthUserName) + get_set_line_parameter "$1" "set_line_sip_username" "SIP.AuthUserName" "$max_num" "$2" + return $? + ;; + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.SIP.AuthPassword) + get_set_line_parameter "$1" "set_line_sip_password" "SIP.AuthPassword" "$max_num" "$2" + return $? + ;; + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.SIP.URI) + get_set_line_parameter "$1" "set_line_sip_uri" "SIP.URI" "$max_num" "$2" + return $? ;; esac return $FAULT_CPE_INVALID_PARAMETER_NAME; @@ -4045,452 +3207,469 @@ case "$1" in InternetGatewayDevice.) return $FAULT_CPE_NO_FAULT ;; - InternetGatewayDevice.Services.) - freecwmp_set_parameter_notification "$1" "$2" - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.) - freecwmp_set_parameter_notification "$1" "$2" - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.) - freecwmp_set_parameter_notification "$1" "$2" - return $FAULT_CPE_NO_FAULT - ;; + InternetGatewayDevice.Services.|\ + InternetGatewayDevice.Services.VoiceService.|\ + InternetGatewayDevice.Services.VoiceService.1.|\ InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.) freecwmp_set_parameter_notification "$1" "$2" return $FAULT_CPE_NO_FAULT ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].) - freecwmp_output "$1Enable" "0" - freecwmp_output "$1Reset" "0" - freecwmp_output "$1Name" "0" - freecwmp_output "$1Signaling" "0" - freecwmp_output "$1MaxSessions" "0" - freecwmp_output "$1NumberOfLines" "0" - freecwmp_output "$1SIP.ProxyServer" "0" - freecwmp_output "$1SIP.ProxyServerPort" "0" - freecwmp_output "$1SIP.ProxyServerTransport" "0" - freecwmp_output "$1SIP.RegistrarServer" "0" - freecwmp_output "$1SIP.RegistrarServerPort" "0" - freecwmp_output "$1SIP.RegistrarServerTransport" "0" - freecwmp_output "$1SIP.UserAgentDomain" "0" - freecwmp_output "$1SIP.UserAgentPort" "0" - freecwmp_output "$1SIP.UserAgentTransport" "0" - freecwmp_output "$1SIP.OutboundProxy" "0" - freecwmp_output "$1SIP.OutboundProxyPort" "0" - freecwmp_output "$1SIP.Organization" "0" - freecwmp_output "$1SIP.RegistrationPeriod" "0" - freecwmp_output "$1SIP.InviteExpires" "0" - freecwmp_output "$1SIP.ReInviteExpires" "0" - freecwmp_output "$1SIP.RegisterExpires" "0" - freecwmp_output "$1SIP.RegistersMinExpires" "0" - freecwmp_output "$1SIP.RegisterRetryInterval" "0" - freecwmp_output "$1SIP.InboundAuth" "0" - freecwmp_output "$1SIP.InboundAuthUsername" "0" - freecwmp_output "$1SIP.InboundAuthPassword" "0" - freecwmp_set_parameter_notification "$1" "$2" + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.) + freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}." "rc" "num" + let sip_id=$num-1 + exist=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.sip$sip_id` + if [ "$exist" = "" ];then + return $FAULT_CPE_INVALID_PARAMETER_NAME + fi freecwmp_set_parameter_notification "$1" "$2" return $FAULT_CPE_NO_FAULT ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.) - freecwmp_output "$1ProxyServer" "0" - freecwmp_output "$1ProxyServerPort" "0" - freecwmp_output "$1ProxyServerTransport" "0" - freecwmp_output "$1RegistrarServer" "0" - freecwmp_output "$1RegistrarServerPort" "0" - freecwmp_output "$1RegistrarServerTransport" "0" - freecwmp_output "$1UserAgentDomain" "0" - freecwmp_output "$1UserAgentPort" "0" - freecwmp_output "$1UserAgentTransport" "0" - freecwmp_output "$1OutboundProxy" "0" - freecwmp_output "$1OutboundProxyPort" "0" - freecwmp_output "$1Organization" "0" - freecwmp_output "$1RegistrationPeriod" "0" - freecwmp_output "$1InviteExpires" "0" - freecwmp_output "$1ReInviteExpires" "0" - freecwmp_output "$1RegisterExpires" "0" - freecwmp_output "$1RegistersMinExpires" "0" - freecwmp_output "$1RegisterRetryInterval" "0" - freecwmp_output "$1InboundAuth" "0" - freecwmp_output "$1InboundAuthUsername" "0" - freecwmp_output "$1InboundAuthPassword" "0" + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.) + local profile_object=`echo $1|sed 's/SIP*.*//g'` + freecwmp_parse_formated_parameter "$profile_object" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP." "rc" "num" + let sip_id=$num-1 + exist=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.sip$sip_id` + if [ "$exist" = "" ];then + return $FAULT_CPE_INVALID_PARAMETER_NAME + fi freecwmp_set_parameter_notification "$1" "$2" return $FAULT_CPE_NO_FAULT ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].Enable) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.Enable" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - set_voice_profile_enable $profile_num $2 + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.) + local profile_object=`echo $1|sed 's/Line*.*//g'` + freecwmp_parse_formated_parameter "$profile_object" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.Line." "rc" "num" + let sip_id=$num-1 + exist=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.sip$sip_id` + if [ "$exist" = "" ];then + return $FAULT_CPE_INVALID_PARAMETER_NAME fi + freecwmp_set_parameter_notification "$1" "$2" return $FAULT_CPE_NO_FAULT ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].Reset) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.Reset" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - set_voice_profile_reset $profile_num $2 + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.SIP.|\ + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.CallingFeatures.) + local profile_object=`echo $1|sed 's/Line*.*//g'` + freecwmp_parse_formated_parameter "$profile_object" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.Line." "rc" "num" + let sip_id=$num-1 + exist=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.sip$sip_id` + if [ "$exist" = "" ];then + return $FAULT_CPE_INVALID_PARAMETER_NAME fi + line_instances_list=`get_line_instances_list $num` + object="$1" + local line_object=${object%\.[A-Z]*\.}. + freecwmp_parse_formated_parameter "$line_object" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.Line.{i}." "rc" "num" + local num1=`echo $num | awk '{ print $1 }'` + local num2=`echo $num | awk '{ print $2 }'` + if [ $rc -eq 0 ];then + local l_inst_found=0 + for line_instance in $line_instances_list;do + if [ "$line_instance" = "$num2" ];then + l_inst_found=1 + break + fi + done + if [ "$l_inst_found" = "0" ];then + return $FAULT_CPE_INVALID_PARAMETER_NAME + fi + fi + freecwmp_set_parameter_notification "$1" "$2" return $FAULT_CPE_NO_FAULT ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].Name) + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Enable) + get_set_voice_service_parameter "$1" "set_voice_profile_enable" "Enable" "$max_num" "$2" + return $? + ;; + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Reset) + get_set_voice_service_parameter "$1" "set_voice_profile_reset" "Reset" "$max_num" "$2" + return $? + ;; + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Name) return $FAULT_CPE_NOTIFICATION_REJECTED ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SignalingProtocol) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SignalingProtocol" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - set_voice_profile_signaling_protocol $profile_num $2 - fi - return $FAULT_CPE_NO_FAULT + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SignalingProtocol) + get_set_voice_service_parameter "$1" "set_voice_profile_signaling_protocol" "SignalingProtocol" "$max_num" "$2" + return $? ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].MaxSessions) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.MaxSessions" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - set_voice_profile_max_sessions $profile_num $2 - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].NumberOfLines) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.NumberOfLines" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - set_voice_profile_number_of_lines $profile_num $2 - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.ProxyServer) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.ProxyServer" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - set_sip_proxy_server $profile_num $2 - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.ProxyServerPort) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.ProxyServerPort" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - set_sip_proxy_server_port $profile_num $2 - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.ProxyServerTransport) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.ProxyServerTransport" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - set_sip_proxy_server_transport $profile_num $2 - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.RegistrarServer) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.RegistrarServer" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - set_sip_registrar_server $profile_num $2 - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.RegistrarServerPort) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.RegistrarServerPort" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - set_sip_registrar_server_port $profile_num $2 - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.RegistrarServerTransport) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.RegistrarServerTransport" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - set_sip_registrar_server_transport $profile_num $2 - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.UserAgentDomain) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.UserAgentDomain" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - set_sip_user_agent_domain $profile_num $2 - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.UserAgentPort) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.UserAgentPort" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - set_sip_user_agent_port $profile_num $2 - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.UserAgentTransport) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.UserAgentTransport" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - set_sip_user_agent_transport $profile_num $2 - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.OutboundProxy) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.OutboundProxy" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - set_sip_outbound_proxy $profile_num $2 - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.OutboundProxyPort) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.OutboundProxyPort" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - set_sip_outbound_proxy_port $profile_num $2 - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.Organization) - return $FAULT_CPE_INVALID_PARAMETER_NAME - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.Organization" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - set_sip_organization $profile_num $2 - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.RegistrationPeriod) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.RegistrationPeriod" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - set_sip_registration_period $profile_num $2 - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.InviteExpires) - return $FAULT_CPE_INVALID_PARAMETER_NAME - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.InviteExpires" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - set_sip_invite_expires $profile_num $2 - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.ReInviteExpires) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.ReInviteExpires" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - set_sip_re_invite_expires $profile_num $2 - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.RegisterExpires) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.RegisterExpires" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - set_sip_register_expires $profile_num $2 - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.RegistersMinExpires) - return $FAULT_CPE_INVALID_PARAMETER_NAME - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.RegistersMinExpires" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - set_sip_registers_min_expires $profile_num $2 - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.RegisterRetryInterval) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.RegisterRetryInterval" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - set_sip_register_retry_interval $profile_num $2 - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.InboundAuth) - return $FAULT_CPE_INVALID_PARAMETER_NAME - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.InboundAuth" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - set_sip_inbound_auth $profile_num $2 - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.InboundAuthUsername) - return $FAULT_CPE_INVALID_PARAMETER_NAME - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.InboundAuthUsername" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - set_sip_inbound_auth_username $profile_num $2 - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].SIP.InboundAuthPassword) - return $FAULT_CPE_INVALID_PARAMETER_NAME - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.InboundAuthPassword" "rc" "num" - if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then - let profile_num=$num-1 - set_sip_inbound_auth_password $profile_num $2 - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].Line.[1-$max_line].Enable) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.Line.{i}.Enable" "rc" "num" - if [ $rc -eq 0 ]; then - local profile_num=`echo $num | awk '{ print $1 }'` - local line_number=`echo $num | awk '{ print $2 }'` - if [ $profile_num -gt 0 ] && [ $profile_num -le $max_num ]; then - let profile_num=$profile_num-1 - # Line - local max_line_number=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep brcm|grep -c sip$profile_num` - if [ $line_number -gt 0 ] && [ $line_number -le $max_line_number ]; then - local count=0 - for line_name in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|grep sip$profile_num|awk -F'.' '{print$2}'`;do - let count=$count+1 - if [ "$count" = "$line_number" ];then break;fi - done - set_line_enable $profile_num $line_name $line_number $2 - else - return $FAULT_CPE_INVALID_PARAMETER_NAME; - fi - else - return $FAULT_CPE_INVALID_PARAMETER_NAME; - fi - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].Line.[1-$max_line].DirectoryNumber) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.Line.{i}.DirectoryNumber" "rc" "num" - if [ $rc -eq 0 ]; then - local profile_num=`echo $num | awk '{ print $1 }'` - local line_number=`echo $num | awk '{ print $2 }'` - if [ $profile_num -gt 0 ] && [ $profile_num -le $max_num ]; then - let profile_num=$profile_num-1 - # Line - local max_line_number=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep brcm|grep -c sip$profile_num` - if [ $line_number -gt 0 ] && [ $line_number -le $max_line_number ]; then - local count=0 - for line_name in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|grep sip$profile_num|awk -F'.' '{print$2}'`;do - let count=$count+1 - if [ "$count" = "$line_number" ];then break;fi - done - set_line_directory_number $profile_num $line_name $line_number $2 - else - return $FAULT_CPE_INVALID_PARAMETER_NAME; - fi - else - return $FAULT_CPE_INVALID_PARAMETER_NAME; - fi - fi - return $FAULT_CPE_NO_FAULT - ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].Line.[1-$max_line].Status) + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.MaxSessions) return $FAULT_CPE_NOTIFICATION_REJECTED ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].Line.[1-$max_line].CallState) + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.NumberOfLines) return $FAULT_CPE_NOTIFICATION_REJECTED ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].Line.[1-$max_line].CallingFeatures.CallerIDName) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.Line.{i}.CallingFeatures.CallerIDName" "rc" "num" - if [ $rc -eq 0 ]; then - local profile_num=`echo $num | awk '{ print $1 }'` - local line_number=`echo $num | awk '{ print $2 }'` - if [ $profile_num -gt 0 ] && [ $profile_num -le $max_num ]; then - let profile_num=$profile_num-1 - # Line - local max_line_number=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep brcm|grep -c sip$profile_num` - if [ $line_number -gt 0 ] && [ $line_number -le $max_line_number ]; then - local count=0 - for line_name in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|grep sip$profile_num|awk -F'.' '{print$2}'`;do - let count=$count+1 - if [ "$count" = "$line_number" ];then break;fi - done - set_line_calling_features_caller_id_name $profile_num $line_name $line_number $2 - else - return $FAULT_CPE_INVALID_PARAMETER_NAME; - fi - else - return $FAULT_CPE_INVALID_PARAMETER_NAME; - fi - fi - return $FAULT_CPE_NO_FAULT + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.ProxyServer) + get_set_voice_service_parameter "$1" "set_sip_proxy_server" "SIP.ProxyServer" "$max_num" "$2" + return $? ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].Line.[1-$max_line].SIP.AuthUserName) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.Line.{i}.SIP.AuthUserName" "rc" "num" - if [ $rc -eq 0 ]; then - local profile_num=`echo $num | awk '{ print $1 }'` - local line_number=`echo $num | awk '{ print $2 }'` - if [ $profile_num -gt 0 ] && [ $profile_num -le $max_num ]; then - let profile_num=$profile_num-1 - # Line - local max_line_number=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep brcm|grep -c sip$profile_num` - if [ $line_number -gt 0 ] && [ $line_number -le $max_line_number ]; then - local count=0 - for line_name in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|grep sip$profile_num|awk -F'.' '{print$2}'`;do - let count=$count+1 - if [ "$count" = "$line_number" ];then break;fi - done - set_line_sip_username $profile_num $line_name $line_number $2 - else - return $FAULT_CPE_INVALID_PARAMETER_NAME; - fi - else - return $FAULT_CPE_INVALID_PARAMETER_NAME; - fi - fi - return $FAULT_CPE_NO_FAULT + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.ProxyServerPort) + get_set_voice_service_parameter "$1" "set_sip_proxy_server_port" "SIP.ProxyServerPort" "$max_num" "$2" + return $? ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].Line.[1-$max_line].SIP.AuthPassword) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.Line.{i}.SIP.AuthPassword" "rc" "num" - if [ $rc -eq 0 ]; then - local profile_num=`echo $num | awk '{ print $1 }'` - local line_number=`echo $num | awk '{ print $2 }'` - if [ $profile_num -gt 0 ] && [ $profile_num -le $max_num ]; then - let profile_num=$profile_num-1 - # Line - local max_line_number=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep brcm|grep -c sip$profile_num` - if [ $line_number -gt 0 ] && [ $line_number -le $max_line_number ]; then - local count=0 - for line_name in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|grep sip$profile_num|awk -F'.' '{print$2}'`;do - let count=$count+1 - if [ "$count" = "$line_number" ];then break;fi - done - set_line_sip_password $profile_num $line_name $line_number $2 - else - return $FAULT_CPE_INVALID_PARAMETER_NAME; - fi - else - return $FAULT_CPE_INVALID_PARAMETER_NAME; - fi - fi - return $FAULT_CPE_NO_FAULT + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.ProxyServerTransport) + get_set_voice_service_parameter "$1" "set_sip_proxy_server_transport" "SIP.ProxyServerTransport" "$max_num" "$2" + return $? ;; - InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.[1-$max_num].Line.[1-$max_line].SIP.URI) - freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.Line.{i}.SIP.URI" "rc" "num" - if [ $rc -eq 0 ]; then + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.RegistrarServer) + get_set_voice_service_parameter "$1" "set_sip_registrar_server" "SIP.RegistrarServer" "$max_num" "$2" + return $? + ;; + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.RegistrarServerPort) + get_set_voice_service_parameter "$1" "set_sip_registrar_server_port" "SIP.RegistrarServerPort" "$max_num" "$2" + return $? + ;; + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.RegistrarServerTransport) + get_set_voice_service_parameter "$1" "set_sip_registrar_server_transport" "SIP.RegistrarServerTransport" "$max_num" "$2" + return $? + ;; + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.UserAgentDomain) + get_set_voice_service_parameter "$1" "set_sip_user_agent_domain" "SIP.UserAgentDomain" "$max_num" "$2" + return $? + ;; + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.UserAgentPort) + get_set_voice_service_parameter "$1" "set_sip_user_agent_port" "SIP.UserAgentPort" "$max_num" "$2" + return $? + ;; + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.UserAgentTransport) + get_set_voice_service_parameter "$1" "set_sip_user_agent_transport" "SIP.UserAgentTransport" "$max_num" "$2" + return $? + ;; + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.OutboundProxy) + get_set_voice_service_parameter "$1" "set_sip_outbound_proxy" "SIP.OutboundProxy" "$max_num" "$2" + return $? + ;; + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.OutboundProxyPort) + get_set_voice_service_parameter "$1" "set_sip_outbound_proxy_port" "SIP.OutboundProxyPort" "$max_num" "$2" + return $? + ;; + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.Organization) + return $FAULT_CPE_INVALID_PARAMETER_NAME + get_set_voice_service_parameter "$1" "set_sip_organization" "SIP.Organization" "$max_num" "$2" + return $? + ;; + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.RegistrationPeriod) + get_set_voice_service_parameter "$1" "set_sip_registration_period" "SIP.RegistrationPeriod" "$max_num" "$2" + return $? + ;; + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.InviteExpires) + return $FAULT_CPE_INVALID_PARAMETER_NAME + get_set_voice_service_parameter "$1" "set_sip_invite_expires" "SIP.InviteExpires" "$max_num" "$2" + return $? + ;; + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.ReInviteExpires) + get_set_voice_service_parameter "$1" "set_sip_re_invite_expires" "SIP.ReInviteExpires" "$max_num" "$2" + return $? + ;; + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.RegisterExpires) + get_set_voice_service_parameter "$1" "set_sip_register_expires" "SIP.RegisterExpires" "$max_num" "$2" + return $? + ;; + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.RegistersMinExpires) + return $FAULT_CPE_INVALID_PARAMETER_NAME + get_set_voice_service_parameter "$1" "set_sip_registers_min_expires" "SIP.RegistersMinExpires" "$max_num" "$2" + return $? + ;; + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.RegisterRetryInterval) + get_set_voice_service_parameter "$1" "set_sip_register_retry_interval" "SIP.RegisterRetryInterval" "$max_num" "$2" + return $? + ;; + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.InboundAuth) + return $FAULT_CPE_INVALID_PARAMETER_NAME + get_set_voice_service_parameter "$1" "set_sip_inbound_auth" "SIP.InboundAuth" "$max_num" "$2" + return $? + ;; + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.InboundAuthUsername) + return $FAULT_CPE_INVALID_PARAMETER_NAME + get_set_voice_service_parameter "$1" "set_sip_inbound_auth_username" "SIP.InboundAuthUsername" "$max_num" "$2" + return $? + ;; + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.InboundAuthPassword) + return $FAULT_CPE_INVALID_PARAMETER_NAME + get_set_voice_service_parameter "$1" "set_sip_inbound_auth_password" "SIP.InboundAuthPassword" "$max_num" "$2" + return $? + ;; + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.) + freecwmp_parse_formated_parameter "$line_object" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.Line.{i}." "rc" "num" local profile_num=`echo $num | awk '{ print $1 }'` local line_number=`echo $num | awk '{ print $2 }'` - if [ $profile_num -gt 0 ] && [ $profile_num -le $max_num ]; then - let profile_num=$profile_num-1 - # Line - local max_line_number=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep brcm|grep -c sip$profile_num` - if [ $line_number -gt 0 ] && [ $line_number -le $max_line_number ]; then - local count=0 - for line_name in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|grep sip$profile_num|awk -F'.' '{print$2}'`;do - let count=$count+1 - if [ "$count" = "$line_number" ];then break;fi + if [ $rc -eq 0 ];then + let sip_id=$profile_num-1 + exist=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.sip$sip_id` + if [ "$exist" = "" ];then + return $FAULT_CPE_INVALID_PARAMETER_NAME + fi + line_instances_list=`get_line_instances_list $profile_num` + local l_inst_found=0 + for line_instance in $line_instances_list;do + if [ "$line_instance" = "$line_number" ];then + l_inst_found=1 + break + fi done - set_line_sip_uri $profile_num $line_name $line_number $2 - else - return $FAULT_CPE_INVALID_PARAMETER_NAME; - fi - else - return $FAULT_CPE_INVALID_PARAMETER_NAME; + if [ "$l_inst_found" = "0" ];then + return $FAULT_CPE_INVALID_PARAMETER_NAME fi fi - return $FAULT_CPE_NO_FAULT + freecwmp_set_parameter_notification "$1" "$2" + ;; + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.Enable) + get_set_line_parameter "$1" "set_line_enable" "Enable" "$max_num" "$2" + return $? + ;; + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.DirectoryNumber) + get_set_line_parameter "$1" "set_line_directory_number" "DirectoryNumber" "$max_num" "$2" + return $? + ;; + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.Status) + return $FAULT_CPE_NOTIFICATION_REJECTED + ;; + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.CallState) + return $FAULT_CPE_NOTIFICATION_REJECTED + ;; + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.CallingFeatures.CallerIDName) + get_set_line_parameter "$1" "set_line_calling_features_caller_id_name" "CallingFeatures.CallerIDName" "$max_num" "$2" + return $? + ;; + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.X_002207_LineProfile) + get_set_line_parameter "$1" "set_line_x_002207_line_profile" "X_002207_LineProfile" "$max_num" "$2" + return $? + ;; + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.SIP.AuthUserName) + get_set_line_parameter "$1" "set_line_sip_username" "SIP.AuthUserName" "$max_num" "$2" + return $? + ;; + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.SIP.AuthPassword) + get_set_line_parameter "$1" "set_line_sip_password" "SIP.AuthPassword" "$max_num" "$2" + return $? + ;; + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.SIP.URI) + get_set_line_parameter "$1" "set_line_sip_uri" "SIP.URI" "$max_num" "$2" + return $? ;; esac return $FAULT_CPE_INVALID_PARAMETER_NAME; } + +get_voice_profile_max_instance() { + local max=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_service_provider|awk -F '.' '{print $2}'|awk -F '=' '{print $1}'|sed 's/sip//g'|sort -n|tail -1` + for i in `seq 0 $max`;do + if [ "`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.sip$i`" = "" ];then + let j=$i-1 + echo $j + return 0 + fi + done + if [ "$max" = "" ];then + echo -1 + else + echo $max + fi +} + +get_line_max_instance() { +local line_number=`/usr/sbin/asterisk -rx "brcm show status"|grep -c "Line id"` +for i in `seq 0 $line_number`;do + if [ "`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.brcm$i.sip_account`" = "-" ];then + echo $i + break + fi +done +} + +add_voice_profile() { +local i="$1" +let j=$i+1 +/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q batch << EOF 2>&1 >/dev/null + set voice_client.sip$i=sip_service_provider + set voice_client.sip$i._title='Account $j' + set voice_client.sip$i.enabled='0' + set voice_client.sip$i.codec0='ulaw' + set voice_client.sip$i.codec1='alaw' + set voice_client.sip$i.codec2='g729' + set voice_client.sip$i.codec3='g726' + set voice_client.sip$i.cfim_on='*21*' + set voice_client.sip$i.cfim_off='#21#' + set voice_client.sip$i.cfbs_on='*61*' + set voice_client.sip$i.cfbs_off='#61#' + set voice_client.sip$i.call_return='*69' + set voice_client.sip$i.redial='*66' + set voice_client.sip$i.cbbs_key='5' + set voice_client.sip$i.cbbs_maxretry='5' + set voice_client.sip$i.cbbs_retrytime='300' + set voice_client.sip$i.cbbs_waittime='30' +EOF +} + +delete_voice_profile() { +local i="$1" +/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q delete voice_client.sip$i +} + +add_line() { +local i="$1" +local j="$2" +/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q batch << EOF 2>&1 >/dev/null + set voice_client.brcm$i.sip_account="sip$j" +EOF +} + +delete_line() { +local line_name="$1" +sip_id=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.sip_account|sed 's/sip//g''` +line_id=`echo $line_name|sed 's/brcm//g'` +/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q set voice_client.$line_name.sip_account='-' +call_lines=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.sip$sip_id.call_lines|sed "s/ *$line_id *//g"` +/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q set voice_client.sip$sip_id.call_lines="$call_lines" +} + +get_line_instances_list() { +local i=$1 +local j=$1 +local instances +let j-- +for line in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|awk -F '.' '{print $2}'`;do + if [ "`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line.sip_account`" = "sip$j" ];then + local instance=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line.instances|cut -f $i -d:` + if [ "$instance" != "0" ];then + instances="$instances $instance" + fi + fi +done +echo $instances +} + +delete_associated_line_instances() { +local i=$1 +for line in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|awk -F '.' '{print $2}'`;do + if [ "`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line.sip_account`" = "sip$i" ];then + /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q set voice_client.$line.sip_account="-" + fi + done +} + +add_voice_service() { + local profile_object=`echo $1|sed 's/Line*.*//g'` + freecwmp_parse_formated_parameter "$profile_object" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}." "rc" "num" + if [ "$num" != "" ] && [ $rc -eq 0 ];then + let sip_id=$num-1 + exist=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.sip$sip_id` + if [ "$exist" = "" ];then + return $FAULT_CPE_INVALID_PARAMETER_NAME + fi + fi + + case $1 in + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.) + freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.Line." "rc" "num" + i=`get_line_max_instance` + if [ "$i" = "" ];then + return $FAULT_CPE_RESOURCES_EXCEEDED + fi + let sip_id=$num-1 + add_line "$i" "$sip_id" + instance=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.brcm$i.instances|cut -f $num -d :` + if [ "$instance" = "0" ];then + max_line_instance=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep instances|sort -u|cut -f $num -d :|grep -v 0|tail -1` + let instance=$max_line_instance+1 + local j=0 + for k in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.brcm$i.instances|sed 's/:/ /g'`;do + let j++ + if [ "$j" != "$num" ];then + if [ "$instances" = "" ];then + instances=$k + else + instances=$instances:$k + fi + else + if [ "$instances" = "" ];then + instances=$instance + else + instances=$instances:$instance + fi + fi + done + /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q set voice_client.brcm$i.instances="$instances" + fi + call_lines=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.sip$sip_id.call_lines` + if [ "$call_lines" != "" ];then + /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q set voice_client.sip$sip_id.call_lines="$call_lines $i" + else + /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q set voice_client.sip$sip_id.call_lines="$i" + fi + let i++ + freecwmp_set_parameter_notification "$1$instance." "0" + /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q commit + freecwmp_output "" "" "" "" "" "1" "$instance" + delay_service_restart "voice_client" "5" + delay_service_restart "asterisk" "6" + return $FAULT_CPE_NO_FAULT + ;; + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.) + i=`get_voice_profile_max_instance` + let i++ + add_voice_profile "$i" + /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q commit + let i++ + freecwmp_output "" "" "" "" "" "1" "$i" + freecwmp_set_parameter_notification "$1$i." "0" + delay_service_restart "voice_client" "5" + delay_service_restart "asterisk" "6" + return $FAULT_CPE_NO_FAULT + ;; + InternetGatewayDevice.Services.VoiceService.) + return $FAULT_CPE_RESOURCES_EXCEEDED + ;; + esac + return $FAULT_CPE_INVALID_PARAMETER_NAME +} + +delete_voice_service() { + local profile_object=`echo $1|sed 's/Line*.*//g'` + freecwmp_parse_formated_parameter "$profile_object" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.Line." "rc" "num" + let sip_id=$num-1 + exist=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.sip$sip_id` + if [ "$exist" = "" ];then + return $FAULT_CPE_INVALID_PARAMETER_NAME + fi + line_instances_list=`get_line_instances_list $num` + case $1 in + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.) + freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.Line.{i}." "rc" "num" + local num1=`echo $num | awk '{ print $1 }'` + local num2=`echo $num | awk '{ print $2 }'` + if [ $rc -eq 0 ]; then + local l_inst_found=0 + for line_instance in $line_instances_list;do + if [ "$line_instance" = "$num2" ];then + l_inst_found=1 + break + fi + done + if [ "$l_inst_found" = "0" ];then + return $FAULT_CPE_INVALID_PARAMETER_NAME + fi + for line in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep brcm|grep instances`;do + if [ "`echo $line|awk -F '=' '{print $2}'|cut -d: -f $num1`" = "$num2" ];then + line_name=`echo $line|awk -F '.' '{print $2}'` + break + fi + done + delete_line $line_name + /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q commit + freecwmp_output "" "" "" "" "" "1" + delay_service_restart "voice_client" "5" + delay_service_restart "asterisk" "6" + fi + return $FAULT_CPE_NO_FAULT + ;; + InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.) + delete_voice_profile $sip_id + delete_associated_line_instances $sip_id + /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q commit + freecwmp_output "" "" "" "" "" "1" + delay_service_restart "voice_client" "5" + delay_service_restart "asterisk" "6" + return $FAULT_CPE_NO_FAULT + ;; +esac + return $FAULT_CPE_INVALID_PARAMETER_NAME +} diff --git a/scripts/functions/wan_device b/scripts/functions/wan_device index 83a6aff..9875af5 100644 --- a/scripts/functions/wan_device +++ b/scripts/functions/wan_device @@ -1,6 +1,7 @@ #!/bin/sh # Copyright (C) 2011-2012 Luka Perkov -# Copyright (C) 2012 Ahmed Zribi +# Copyright (C) 2013 Inteno Broadband Technology AB +# Author Ahmed Zribi get_wan_logical_intf() { local intf="$1" @@ -86,6 +87,41 @@ for intf in $list_interface;do $populate "$parameter" "InternetGatewayDevice.WANDevice.$dev." "get_wan_device_object_name" "" "$value" "$notification" "$next_level" "$iface" $populate "$parameter" "InternetGatewayDevice.WANDevice.$dev.WANConnectionDevice." "get_wan_device_object_name" "" "$value" "$notification" "$next_level" "$iface" $populate "$parameter" "InternetGatewayDevice.WANDevice.$dev.WANConnectionDevice.$wan." "get_wan_device_object_name" "" "$value" "$notification" "$next_level" "$iface" + + + $populate "$parameter" "InternetGatewayDevice.WANDevice.$dev.WANCommonInterfaceConfig." "get_wan_device_object_ro_name" "" "$value" "$notification" "$next_level" "$iface" + $populate "$parameter" "InternetGatewayDevice.WANDevice.$dev.WANCommonInterfaceConfig.WANAccessType" "get_wan_device_wan_access_type" "" "$value" "$notification" "$next_level" "$iface" + fault_code="$?" + if [ "$fault_code" = "$FAULT_CPE_NO_FAULT" ];then + fault_err=$FAULT_CPE_NO_FAULT + fi + if [ \( "`echo $parameter|grep '\.$'`" = "" -o "$populate" = "get_pop_inform" \) -a "$fault_code" = "$FAULT_CPE_NO_FAULT" ];then + return $fault_code + elif [ "$fault_code" != "$FAULT_CPE_INVALID_PARAMETER_NAME" -a "$fault_code" != "$FAULT_CPE_NO_FAULT" ];then + return $fault_code + fi + $populate "$parameter" "InternetGatewayDevice.WANDevice.$dev.WANDSLInterfaceConfig." "get_wan_device_object_ro_name" "" "$value" "$notification" "$next_level" "$iface" + $populate "$parameter" "InternetGatewayDevice.WANDevice.$dev.WANDSLInterfaceConfig.Status" "get_wan_device_wan_dsl_interface_config_status" "" "$value" "$notification" "$next_level" "$iface" + fault_code="$?" + if [ "$fault_code" = "$FAULT_CPE_NO_FAULT" ];then + fault_err=$FAULT_CPE_NO_FAULT + fi + if [ \( "`echo $parameter|grep '\.$'`" = "" -o "$populate" = "get_pop_inform" \) -a "$fault_code" = "$FAULT_CPE_NO_FAULT" ];then + return $fault_code + elif [ "$fault_code" != "$FAULT_CPE_INVALID_PARAMETER_NAME" -a "$fault_code" != "$FAULT_CPE_NO_FAULT" ];then + return $fault_code + fi + $populate "$parameter" "InternetGatewayDevice.WANDevice.$dev.WANDSLInterfaceConfig.ModulationType" "get_wan_device_wan_dsl_interface_config_modulation_type" "" "$value" "$notification" "$next_level" "$iface" + fault_code="$?" + if [ "$fault_code" = "$FAULT_CPE_NO_FAULT" ];then + fault_err=$FAULT_CPE_NO_FAULT + fi + if [ \( "`echo $parameter|grep '\.$'`" = "" -o "$populate" = "get_pop_inform" \) -a "$fault_code" = "$FAULT_CPE_NO_FAULT" ];then + return $fault_code + elif [ "$fault_code" != "$FAULT_CPE_INVALID_PARAMETER_NAME" -a "$fault_code" != "$FAULT_CPE_NO_FAULT" ];then + return $fault_code + fi + if [ "$proto" = "dhcp" -o "$proto" = "static" ];then $populate "$parameter" "InternetGatewayDevice.WANDevice.$dev.WANConnectionDevice.$wan.WANIPConnection." "get_wan_device_object_name" "" "$value" "$notification" "$next_level" "$iface" fault_code="$?" @@ -228,6 +264,109 @@ done return $fault_err } +get_wan_device_wan_access_type() { +local val="" +local type="xsd:string" +local parm="$1" +local permissions="" +local intf="$2" +case "$action" in + get_value) + json_load "$(ifstatus $intf)" + json_get_var device device + if [ "${device:0:3}" = "eth" ];then + val="Ethernet" + elif [ "${device:0:3}" = "atm" -o "${device:3:3}" = "ptm" ];then + val="DSL" + fi + ;; + get_name) + permissions="0" + ;; + get_notification) + freecwmp_get_parameter_notification "val" "$parm" + ;; +esac +freecwmp_output "$parm" "$val" "$permissions" "$type" +} + +get_wan_device_wan_dsl_interface_config_status() { +local val="" +local type="xsd:string" +local parm="$1" +local permissions="" +local intf="$2" +case "$action" in + get_value) + adsl_shown=`adsl info --stats|grep "^Status:"|cut -f2 -d:|sed 's/\t*//g'|sed 's/^ *//g'|sed 's/ *$//g'` + case "$adsl_shown" in + "Showtime") + val="Up" + ;; + "Training") + val="Initializing" + ;; + "Channel Analysis") + val="EstablishingLink" + ;; + "Disabled") + val="Disabled" + ;; + esac + ;; + get_name) + permissions="0" + ;; + get_notification) + freecwmp_get_parameter_notification "val" "$parm" + ;; +esac +freecwmp_output "$parm" "$val" "$permissions" "$type" +} + +get_wan_device_wan_dsl_interface_config_modulation_type() { +local val="" +local type="xsd:string" +local parm="$1" +local permissions="" +local intf="$2" +case "$action" in + get_value) + adsl_shown=`adsl info --stats|grep "Mode:"|cut -f2 -d:|sed 's/\t*//g'|sed 's/^ *//g'|cut -f1 -d ' '` + case "$adsl_shown" in + G.Dmt) + val="ADSL_G.dmt" + ;; + G.lite) + val="ADSL_G.lite" + ;; + T1.413) + val="ADSL_ANSI_T1 .413" + ;; + ADSL2) + val="ADSL_G.dmt.bis" + ;; + AnnexL) + val="ADSL_re-adsl" + ;; + ADSL2+) + val="ADSL_2plus" + ;; + *) + val="$adsl_shown" + ;; + esac + ;; + get_name) + permissions="0" + ;; + get_notification) + freecwmp_get_parameter_notification "val" "$parm" + ;; +esac +freecwmp_output "$parm" "$val" "$permissions" "$type" +} + get_wan_device_wan_mng_enable() { local val="" local type="xsd:boolean" @@ -286,7 +425,7 @@ case "$action" in fi if [ $uptime -gt 0 ];then val="Connected" - elif [ $pending = 1 ];then + elif [ "$pending" = "1" ];then val="Pending Disconnect" else val="Disconnected" @@ -486,7 +625,8 @@ local permissions="" local intf="$2" case "$action" in get_value) - val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get network.$intf.password 2> /dev/null` + # returned value must be empty + val="" ;; get_name) permissions="1" @@ -534,6 +674,11 @@ freecwmp_output "$parm" "" "1" return $FAULT_CPE_NO_FAULT } +get_wan_device_object_ro_name() { +local parm="$1" +freecwmp_output "$parm" "" "0" +return $FAULT_CPE_NO_FAULT +} get_pop_inform() { local parameter="$1" local parm="$2" diff --git a/scripts/wepkeygen b/scripts/wepkeygen index f78ffc4..3b4c8b6 100644 --- a/scripts/wepkeygen +++ b/scripts/wepkeygen @@ -1,4 +1,6 @@ #!/usr/sbin/bash +# Copyright (C) 2013 Inteno Broadband Technology AB +# Author Mohamed Kallel usage() { echo "Usage: $0 " diff --git a/ubus.c b/ubus.c index c2bdb1d..a52b91b 100644 --- a/ubus.c +++ b/ubus.c @@ -3,10 +3,10 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 2 of the License, or * (at your option) any later version. - * Contributed by Inteno Broadband Technology AB * - * Copyright (C) 2013 Mohamed Kallel - * Copyright (C) 2013 Ahmed Zribi + * Copyright (C) 2013 Inteno Broadband Technology AB + * Author Mohamed Kallel + * Author Ahmed Zribi * Copyright (C) 2012 Luka Perkov */ diff --git a/xml.c b/xml.c index 4f410d1..2c77c20 100644 --- a/xml.c +++ b/xml.c @@ -3,10 +3,10 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 2 of the License, or * (at your option) any later version. - * Contributed by Inteno Broadband Technology AB * - * Copyright (C) 2013 Mohamed Kallel - * Copyright (C) 2013 Ahmed Zribi + * Copyright (C) 2013 Inteno Broadband Technology AB + * Author Mohamed Kallel + * Author Ahmed Zribi * Copyright (C) 2011-2012 Luka Perkov * Copyright (C) 2012 Jonas Gorski */ @@ -450,7 +450,7 @@ static int xml_prepare_parameters_inform(struct parameter_container *parameter_c } else if (!b && parameter_container->data == NULL) { - external_get_action_write("value", parameter_container->name, NULL); + external_get_action("value", parameter_container->name, NULL); return 0; } node = mxmlNewElement (parameter_list, "ParameterValueStruct"); @@ -506,28 +506,6 @@ int cwmp_rpc_acs_prepare_message_inform (struct cwmp *cwmp, struct session *sess b = mxmlNewInteger(b, cwmp->retry_count_session); if (!b) goto error; - remove(fc_script_actions); - - for (i=0; iname)==0) { - if (parameter_container->fault_code && parameter_container->fault_code[0]=='9') - goto error; - b = mxmlFindElement(tree, tree, DEVICE_ID_CONST[i].device_id_name, NULL, NULL, MXML_DESCEND); - if (!b) goto error; - - b = mxmlNewText(b, 0, parameter_container->data? parameter_container->data : ""); - if (!b) goto error; - } - } - parameter_container_delete(parameter_container); - } - if (xml_prepare_events_inform(session, tree)) goto error; @@ -551,8 +529,25 @@ int cwmp_rpc_acs_prepare_message_inform (struct cwmp *cwmp, struct session *sess } } - external_get_action_execute(cwmp_handle_getParamValues); - external_simple("inform", cwmp_handle_getParamValues); + external_simple("inform"); + + external_handle_action(cwmp_handle_getParamValues); + + list_for_each(ilist, &(external_list_parameter)) { + parameter_container = list_entry(ilist, struct parameter_container, list); + for (i=0; iname)==0) { + if (parameter_container->fault_code && parameter_container->fault_code[0]=='9') + goto error; + b = mxmlFindElement(tree, tree, DEVICE_ID_CONST[i].device_id_name, NULL, NULL, MXML_DESCEND); + if (!b) goto error; + + b = mxmlNewText(b, 0, parameter_container->data? parameter_container->data : ""); + if (!b) goto error; + } + } + } while (external_list_parameter.next!=&external_list_parameter) { @@ -760,14 +755,14 @@ int cwmp_handle_rpc_cpe_get_parameter_values(struct session *session, struct rpc parameter_name = ""; } if (parameter_name) { - if (external_get_action_write("value",parameter_name, NULL)) + if (external_get_action("value", parameter_name, NULL)) goto fault; } b = mxmlWalkNext(b, session->body_in, MXML_DESCEND); parameter_name = NULL; } - if (external_get_action_execute(cwmp_handle_getParamValues)) - goto fault; + + external_handle_action(cwmp_handle_getParamValues); while (external_list_parameter.next!=&external_list_parameter) { parameter_container = list_entry(external_list_parameter.next, struct parameter_container, list); @@ -874,10 +869,12 @@ int cwmp_handle_rpc_cpe_get_parameter_names(struct session *session, struct rpc b = mxmlWalkNext(b, session->body_in, MXML_DESCEND); } if (parameter_name && NextLevel) { - if (external_get_action("name", parameter_name, NextLevel, cwmp_handle_getParamNames)) + if (external_get_action("name", parameter_name, NextLevel)) goto fault; } + external_handle_action(cwmp_handle_getParamNames); + while (external_list_parameter.next!=&external_list_parameter) { parameter_container = list_entry(external_list_parameter.next, struct parameter_container, list); @@ -974,14 +971,14 @@ int cwmp_handle_rpc_cpe_get_parameter_attributes(struct session *session, struct parameter_name = ""; } if (parameter_name) { - if (external_get_action_write("notification",parameter_name, NULL)) + if (external_get_action("notification",parameter_name, NULL)) goto fault; } b = mxmlWalkNext(b, session->body_in, MXML_DESCEND); parameter_name = NULL; } - if (external_get_action_execute(cwmp_handle_getParamAttributes)) - goto fault; + + external_handle_action(cwmp_handle_getParamAttributes); while (external_list_parameter.next!=&external_list_parameter) { parameter_container = list_entry(external_list_parameter.next, struct parameter_container, list); @@ -1102,8 +1099,7 @@ int cwmp_handle_rpc_cpe_set_parameter_values(struct session *session, struct rpc } if (parameter_name && parameter_value) { - if (external_set_action_write("value", - parameter_name, parameter_value,NULL)) + if (external_set_action("value", parameter_name, parameter_value, NULL)) goto fault; parameter_name = NULL; parameter_value = NULL; @@ -1121,9 +1117,11 @@ int cwmp_handle_rpc_cpe_set_parameter_values(struct session *session, struct rpc if (b && b->value.text.string) parameter_key = b->value.text.string; - if (external_set_action_execute("value",cwmp_handle_setParamValues)) + if (external_apply("value", NULL)) goto fault; + external_handle_action(cwmp_handle_setParamValues); + while (external_list_parameter.next != &external_list_parameter) { parameter_container = list_entry(external_list_parameter.next, struct parameter_container, list); @@ -1220,8 +1218,8 @@ int cwmp_handle_rpc_cpe_set_parameter_attributes(struct session *session, struct parameter_notification = b->value.text.string; } if (attr_notification_update && parameter_name && parameter_notification) { - if (external_set_action_write("notification", - parameter_name, parameter_notification, attr_notification_update)) + if (external_set_action("notification", parameter_name, + parameter_notification, attr_notification_update)) goto fault; attr_notification_update = NULL; parameter_name = NULL; @@ -1230,9 +1228,11 @@ int cwmp_handle_rpc_cpe_set_parameter_attributes(struct session *session, struct b = mxmlWalkNext(b, n, MXML_DESCEND); } - if (external_set_action_execute("notification", cwmp_handle_setParamAttributes)) + if (external_apply("notification", NULL)) goto fault; + external_handle_action(cwmp_handle_setParamAttributes); + external_fetch_setParamAttrResp(&success, &fault); if (fault && fault[0]=='9') @@ -1298,13 +1298,15 @@ int cwmp_handle_rpc_cpe_add_object(struct session *session, struct rpc *rpc) } if (object_name) { - if (external_object_action("add", object_name, cwmp_handle_addObject)) + if (external_object_action("add", object_name)) goto fault; } else { fault_code = FAULT_CPE_INVALID_PARAMETER_NAME; goto fault; } + external_handle_action(cwmp_handle_addObject); + external_fetch_addObjectResp(&instance, &status, &fault); if (fault && fault[0]=='9') @@ -1391,13 +1393,15 @@ int cwmp_handle_rpc_cpe_delete_object(struct session *session, struct rpc *rpc) } if (object_name) { - if (external_object_action("delete", object_name, cwmp_handle_delObject)) + if (external_object_action("delete", object_name)) goto fault; } else { fault_code = FAULT_CPE_INVALID_PARAMETER_NAME; goto fault; } + external_handle_action(cwmp_handle_delObject); + external_fetch_delObjectResp(&status, &fault); if (fault && fault[0]=='9') @@ -1798,8 +1802,8 @@ int cwmp_launch_download(struct download *pdownload, struct transfer_complete ** sprintf(file_size,"%d",pdownload->file_size); external_download(pdownload->url, file_size, pdownload->file_type, - pdownload->username, pdownload->password, - cwmp_handle_downloadFault); + pdownload->username, pdownload->password); + external_handle_action(cwmp_handle_downloadFault); external_fetch_downloadFaultResp(&fault_code); if(fault_code != NULL) @@ -1895,7 +1899,8 @@ void *thread_cwmp_rpc_cpe_download (void *v) else { bkp_session_save(); - external_apply_download(pdownload->file_type, cwmp_handle_downloadFault); + external_apply("download", pdownload->file_type); + external_handle_action(cwmp_handle_downloadFault); external_fetch_downloadFaultResp(&fault_code); if(fault_code != NULL) {