blob: 7027a038e24aafaee83d0ed0cf584cd81a05820b [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001/**
2 * @file zte_web_interface.h
3 * @brief Public APIs of Sanechips
4 *
5 * Copyright (C) 2017 Sanechips Technology Co., Ltd.
6 * @author Hong Wu <wu.hong@sanechips.com.cn>
7 * @defgroup si_ap_app_webserver_id si_ap_app_webserver
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 *
13 */
14
15
16#ifndef ZTE_WEB_INTERFACE_H
17#define ZTE_WEB_INTERFACE_H
18
19/*******************************************************************************
20 * Include header files *
21 ******************************************************************************/
22#include <time.h>
23#include "../server/webs.h"
24#include "message.h"
25//#include "errorcode.h"
26#include "cfg_nv_def.h"
27#include "cfg_api.h"
28#include "zte_web_mgmt.h"
29#include <sys/ipc.h>
30#include <sys/msg.h>
31#include "softap_api.h"
32#include "netotherapi.h"
33#include "net/zte_web_net_lan.h"
34#include "net/zte_web_net_wan.h"
35#include "net/zte_web_net_other.h"
36
37/*******************************************************************************
38 * Macro definitions *
39 ******************************************************************************/
40#define cprintf(fmt, args...) do { \
41 FILE *fp = fopen("/dev/console", "w"); \
42 if (fp) { \
43 fprintf(fp, fmt, ## args); \
44 fclose(fp); \
45 } \
46} while (0)
47
48#define WEBLOG cprintf
49#define IFSTREQUAL(str1, str2) (strcmp((str1), (str2))?0:1)
50#define STR_EQUAL(a,b) ( strcmp((char*)a, (char*)b)==0 )
51#ifndef uint8
52#define uint8 unsigned char
53#endif
54
55#define ID "id"
56#define NAME "name"
57#define SITE "site"
58#define SUCCESS "success"
59#define FAILURE "failure"
60#define EXIST "exist"
61#define NOEXIST "noexist"
62#define PROCESSING "processing"
63#define MSG_INVALID_WEB_PARAM "MSG_INVALID_WEB_PARAM"
64#define ZTE_MC_OK_S (0)
65
66#define CFG_BUF_LENGTH 512
67#define CONFIG_DEFAULT_LENGTH 64
68
69#define DIAGLOG_DATA_PATH "/etc_ro/web/diaglog"
70
71/*** define about NV ***/
72#define NV_ITEM_VALUE_DEFAULT_STRING_LEN 128
73#define NV_ITEM_VALUE_BOOLEAN_LEN 1
74#define NV_ITEM_VALUE_YES_NO_LEN 5
75#define NV_ITEM_VALUE_IP_LEN 20
76#define NV_ITEM_MODE_STRING_LEN 25
77#define NV_ITEM_ADMIN_STRING_LEN 25
78#define NV_ITEM_VALUE_APN_STRING_LEN 400
79#define NV_ITEM_VALUE_NW_LIST_STRING_LEN 700
80#define NV_ITEM_STRING_LEN_5 5
81#define NV_ITEM_STRING_LEN_10 10
82#define NV_ITEM_STRING_LEN_20 20
83#define NV_ITEM_STRING_LEN_50 50
84#define NV_ITEM_STRING_LEN_64 64
85#define NV_ITEM_STRING_LEN_150 150
86#define NV_ITEM_STRING_LEN_200 200
87#define NV_FW_RULE_MAX_LEN_V6 400
88#define NV_ITEM_VALUE_STRING_LEN 50
89#define NVIO_MAX_LEN 1500
90#define NVIO_TMP_LEN 512
91#define NVIO_DEFAULT_LEN 50
92#define NV_ITEM_VALUE_STRING_LEN 50
93#define NV_ITEM_VALUE_MAX_LEN 1024
94#define zte_web_write(xx_item, xx_value) zte_nvconfig_write(xx_item, xx_value,(int)strlen(xx_value))
95#define zte_web_read(xx_item, xx_value) zte_nvconfig_read(xx_item, xx_value,sizeof(xx_value)) //modified,-1 deleted
96
97/*webuiÕʺÅ*/
98#define LOGIN_SUCCESS "0"
99#define LOGIN_FAIL "1"
100#define LOGIN_DUPLICATE_USER "2"
101#define LOGIN_BAD_PASSWORD "3"
102#define LOGIN_ALREADY_LOGGED "4"
103#define LOGIN_USER_NAME_NOT_EXSIT "5"
104#define LOGIN_TIMEOUT 600 //timeout after webui login
105#define LOGIN_PSW_MIN_LEN 1
106#define LOGIN_PSW_MAX_LEN 32
107#define LOGIN_FAIL_LOCK_TIME 300//the lock time after login failed
108#define LOGIN_FAIL_TIMES "5"
109#define LOGIN_RECORD_TIME 32
110
111#define COOKIE_SESSION_SIZE 32
112#define COOKIE_TOKEN_TIMEOUT 30
113
114#define NV_LANGUAGE "Language"
115#define NV_LOGINFO "loginfo"
116#define NV_USER_IP_ADDR "user_ip_addr"
117#define NV_LOGIN_LOCK_TIME "login_lock_time"
118#define NV_LAST_LOGIN_TIME "last_login_time"
119#define NV_USER_LOGIN_TIMEMARK "user_login_timemark"
120#define NV_COOKIE_ID "cookie_id"
121#define NV_WEB_TOKEN "web_token"
122
123/* ¿ìËÙÉèÖà */
124#define MAX_QUICK_SET_NUM 10
125
126/*Á÷Á¿Í³¼Æ*/
127#define ZTE_WEB_DATA_STATISTICS_CLEAR_ALL "ALL"
128#define ZTE_WEB_DATA_STATISTICS_CLEAR_TOTAL "TOTAL"
129#define ZTE_WEB_DATA_STATISTICS_CLEAR_CURRENT "CURRENT"
130
131
132
133//wan module
134#define ZTE_DAILNUM_LEN 8
135#define ZTE_ADDR_LEN 16
136#define ZTE_SEL_TYPE 8
137#define ZTE_PDP_TYPE_LEN 12
138#define ZTE_AUTH_TYPE_LEN 8
139#define ZTE_WAN_UMTS_MAX_PROFILE_NAME_LEN 32
140#define ZTE_WAN_UMTS_MAX_APN_STRING_LEN 104
141#define ZTE_WAN_UMTS_MAX_USERNAME_STRING_LEN 65
142#define ZTE_WAN_UMTS_MAX_PASSWD_STRING_LEN 65
143#define ZTE_USSD_DATA_TO_WEB_LEN 900
144#define CMD_CONNECTION_MODE "ConnectionMode"
145
146//pbm module
147#define CMD_PBM_DATA_INFO "pbm_data_info"
148#define CMD_PBM_DATA_TOTAL "pbm_data_total"
149#define CMD_PBM_CAPACITY_INFO "pbm_capacity_info"
150
151//sms module
152#define CMD_SMS_PAGE_DATA "sms_page_data"
153#define CMD_SMS_PARAMETER_INFO "sms_parameter_info"
154#define CMD_SMS_STATUS_INFO "sms_cmd_status_info"
155#define CMD_SMS_CAPACITY_INFO "sms_capacity_info"
156#define CMD_SMS_STATUS_RPT_DATA "sms_status_rpt_data"
157#define CMD_SMS_DATA_TOTAL "sms_data_total"
158#define CMD_SMS_UNREAD_COUNT "sms_unread_count"
159#define CMD_BROADCAST_DATA "broadcast_data"
160#define NV_SMS_UNREAD_NUM "sms_unread_num"
161
162//APN
163#define APN_SAVE_AND_SET_DEFAULT "0"
164#define APN_ONLY_SET_DEFAULT "1"
165#define ZTE_WEB_ACT_AUTO "auto"
166#define ZTE_WEB_ACT_MANUAL "manual"
167#define ZTE_WEB_ACT_SAVE "save"
168#define ZTE_WEB_ACT_SETDEFAULT "set_default"
169#define ZTE_WEB_ACT_SAVE_AND_SETDEFAULT "set_save_and_default"
170#define ZTE_WEB_ACT_DELETE "delete"
171#define ZTE_WEB_DIAL_MODE_AUTO "auto_dial"
172#define ZTE_WEB_DIAL_MODE_MANUAL "manual_dial"
173#define ZTE_WEB_DIAL_MODE_DEMAND "demand_dial"
174#define ZTE_WEB_MANUAL_DIAL_ACTION_CONN "connect"
175#define ZTE_WEB_MANUAL_DIAL_ACTION_DISCONN "disconnect"
176
177//nv for data limit settings
178#define NV_DATA_VOLUME_LIMIT_SWITCH "data_volume_limit_switch" /*0:disable;1:enable*/
179#define NV_DATA_VOLUME_LIMIT_UNIT "data_volume_limit_unit" /*time/data*/
180#define NV_DATA_VOLUME_LIMIT_SIZE "data_volume_limit_size"
181#define NV_DATA_VOLUME_ALERT_PERCENT "data_volume_alert_percent"
182#define DATA_VOLUME_LIMIT_UNIT_TIME "time"
183#define DATA_VOLUME_LIMIT_UNIT_DATA "data"
184#define NV_HTTPSHARE_STATUS "HTTP_SHARE_STATUS"
185#define NV_HTTPSHARE_WR_AUTH "HTTP_SHARE_WR_AUTH"
186#define NV_HTTPSHARE_FILE "HTTP_SHARE_FILE"
187
188//other fluxstat
189#define NV_DATA_TRAFFIC_SIM_PROVINCE "sim_home_location"
190#define NV_DATA_TRAFFIC_SWITCH "is_traffic_aline_on"
191#define NV_DATA_TRAFFIC_MONTH_TOTAL "traffic_month_total"
192#define NV_DATA_TRAFFIC_MONTH_USED "traffic_month_used"
193
194//fota module
195#define FOTA_ACTION_CANCEL_DOWNLOAD "0"
196#define FOTA_ACTION_CONFIRM_DOWNLOAD "1"
197#define FOTA_ACTION_DOWNLOADING_USER_CLICK_CANCEL "2"
198//#define FOTA_UPDATE_VERSION "version"
199#define FOTA_UPGRADE_RESULT "upgrade_result"
200//#define FOTA_PACK_SIZE_INFO "pack_size_info"
201//#define FOTA_UPDATE_INFO "update_info"
202//#define FOTA_SETTINGS_INFO "GetUpgAutoSetting"
203//#define FOTA_NEW_VERSION_STATE "new_version_state"
204
205//NET
206#define HOSTANME "hostname"
207#define MAC "mac"
208#define ADDR "ip"
209#define DOMAIN "domain"
210#define MAC_ADDR "mac_addr"
211#define DEVICES "devices"
212#define SITELIST "siteList"
213#define CMD_LAN_STATION_LIST "lan_station_list"
214#define CMD_CHILDREN_DEVICE_LIST "childGroupList"
215#define CMD_WHITE_SITE_LIST "site_white_list"
216#define CMD_GET_USER_MAC_ADDR "get_user_mac_addr"
217#define CMD_CURRENT_STATICADDR_LIST "current_static_addr_list"
218#define CMD_GET_POWERON_TIME "get_poweron_time"
219#define CMD_GET_LAN_DEV_INFO "get_lan_dev_info" //you wen ti
220#define CMD_GETDDNS_STATUS "getddns_status"
221#define CMD_USSD_DATA_INFO "ussd_data_info"
222#define CMD_GET_DEVICE_MODE "get_device_mode"
223
224//SD
225#define STR_SDCARD_MODE_OPT "sdcard_mode_option"
226
227
228/*useradded module start*/
229#define CMD_GET_SAMPLE "station_list"
230/*useradded module end*/
231
232/****************************All the Goform ID************************************/
233
234//#define GOFORM_MGMT_SET_WEB_DATA "SET_WEB_DATA"
235//#define GOFORM_MGMT_GUEST_USER_CONTROL "GUEST_USER_CONTROL"
236#define GOFORM_MGMT_SET_EXTERNAL_NV "SET_EXTERNAL_NV"
237/*management start*/
238#define GOFORM_MGMT_SET_WEB_LANGUAGE "SET_WEB_LANGUAGE"
239#define GOFORM_MGMT_SET_DEVICEMODE "SET_DEVICE_MODE"
240#define GOFORM_MGMT_LOGIN_IP "LOGIN"
241#define GOFORM_MGMT_LOGOUT_IP "LOGOUT"
242#define GOFORM_MGMT_CHANGE_PASSWORD "CHANGE_PASSWORD"
243#define GOFORM_MGMT_CHANGE_ACCOUNT "CHANGE_ACCOUNT"
244#define GOFORM_MGMT_RESTORE_FACTORY_SETTINGS "RESTORE_FACTORY_SETTINGS"
245#define GOFORM_MGMT_REBOOT "REBOOT_DEVICE"
246#define GOFORM_MGMT_POWEROFF "TURN_OFF_DEVICE"
247#define GOFORM_MGMT_POWER_ON_SPEED "MGMT_CONTROL_POWER_ON_SPEED"
248#define GOFORM_MGMT_QUICK_SETUP "QUICK_SETUP_EX"
249//#define GOFORM_SET_WORK_TYPE "SET_WORK_TYPE"
250#define GOFORM_MGMT_SNTP "SNTP"
251#define GOFORM_MGMT_SYSLOG "SYSLOG"
252//#define GOFORM_HTTP_REDIRECT "HTTP_REDIRECT"
253/*management end*/
254
255/*wan module start*/
256#define GOFORM_WAN_LOCK_FREQUENCY "LOCK_FREQUENCY"
257#define GOFORM_WAN_SET_NETWORK "SET_NETWORK"
258#define GOFORM_WAN_SET_CONNECTION_MODE "SET_CONNECTION_MODE"
259#define GOFORM_WAN_CONNECT_NETWORK "CONNECT_NETWORK"
260#define GOFORM_WAN_DISCONNECT_NETWORK "DISCONNECT_NETWORK"
261#define GOFORM_WAN_SCAN_NETWORK "SCAN_NETWORK"
262#define GOFORM_WAN_SET_BEARER_PREFERENCE "SET_BEARER_PREFERENCE"
263//#define GOFORM_WAN_SET_CONN_SETTING "SET_CONN_SETTING"
264//#define GOFORM_WAN_CANCEL_AUTO_RECONNECT "CANCEL_AUTO_RECONNECT"
265#define GOFORM_WAN_UNLOCK_NETWORK "UNLOCK_NETWORK"
266//statistics module
267#define GOFORM_WAN_RESET_DATA_COUNTER "RESET_DATA_COUNTER"
268#define GOFORM_WAN_DATA_LIMIT_SETTING "DATA_LIMIT_SETTING"
269#define GOFORM_WAN_DATA_FLOW_CALIBRATION_MANUAL "FLOW_CALIBRATION_MANUAL"
270#define GOFORM_SNTP_GETDATASTATIC "SNTP_Getdatastatic"
271//pin,puk module
272#define GOFORM_MGMT_ENTER_PIN "ENTER_PIN"
273#define GOFORM_MGMT_DISABLE_PIN "DISABLE_PIN"
274#define GOFORM_MGMT_ENABLE_PIN "ENABLE_PIN"
275//#define GOFORM_MGMT_MODIFY_PIN "MODIFY_PIN"
276#define GOFORM_MGMT_ENTER_PUK "ENTER_PUK"
277#define GOFORM_MGMT_AUTO_PIN "AUTO_PIN"
278//pbm
279#define GOFORM_PBM_CONTACT_ADD "PBM_CONTACT_ADD"
280#define GOFORM_PBM_CONTACT_DEL "PBM_CONTACT_DEL"
281//sms module
282#define GOFORM_SMS_SET_MSG_CENTER "SET_MESSAGE_CENTER"
283#define GOFORM_SMS_DELETE_SMS "DELETE_SMS"
284#define GOFORM_SMS_DELETE_SMS_ALL "ALL_DELETE_SMS"
285#define GOFORM_SMS_MOVE_TO_SIM "MOVE_TO_SIM"
286#define GOFORM_SMS_SAVE_SMS "SAVE_SMS"
287#define GOFORM_SMS_SEND_SMS "SEND_SMS"
288#define GOFORM_SMS_SET_MSG_READ "SET_MSG_READ"
289//ussd module
290//#define GOFORM_USSD_SEND_CMD "SEND_USSD_CMD"
291#define GOFORM_USSD_PROCESS "USSD_PROCESS"
292//apn module
293#define GOFORM_WAN_APN_PROC_EX "APN_PROC_EX"
294/*wan module end*/
295
296/*wifi module start*/
297#define GOFORM_WLAN_SET "SET_WIFI_INFO"
298//#define GOFORM_WIFI_SET_FOR_SLEEP "SET_WIFI_INFO_FOR_SLEEP"
299//#define GOFORM_SET_SHOW_SSID_KEY_OLED "SET_SHOW_SSID_KEY_OLED"
300#define GOFORM_WLAN_MAC_FILTER "WIFI_MAC_FILTER"
301#define GOFORM_WLAN_WPS_SET "WIFI_WPS_SET"
302#define GOFORM_WLAN_SSID1_SET "SET_WIFI_SSID1_SETTINGS"
303#define GOFORM_WLAN_SSID2_SET "SET_WIFI_SSID2_SETTINGS"
304#define GOFORM_WLAN_WIFI_SLEEP_SET "SET_WIFI_SLEEP_INFO"
305#define GOFORM_WLAN_WIFI_COVERAGE_SET "SET_WIFI_COVERAGE"
306#define GOFORM_WLAN_SET_TSW "SAVE_TSW"
307#define GOFORM_PARENT_CONTROL_SET "SAVE_TIME_LIMITED"
308//wifi station start
309#define GOFORM_WLAN_WIFI_STA_CONTROL "WIFI_STA_CONTROL"
310#define GOFORM_WLAN_WIFI_SPOT_PROFILE_UPDATE "WIFI_SPOT_PROFILE_UPDATE"
311#define GOFORM_WLAN_SET_STA_CON "WLAN_SET_STA_CON"
312#define GOFORM_WLAN_SET_STA_DISCON "WLAN_SET_STA_DISCON"
313#define GOFORM_WLAN_SET_STA_REFRESH "WLAN_SET_STA_REFRESH"
314/*wifi module end*/
315
316/*router module start*/
317#define GOFORM_ROUTER_DEL_IP_PORT_FILETER "DEL_IP_PORT_FILETER"
318#define GOFORM_ROUTER_ADD_IP_PORT_FILETER_V4V6 "ADD_IP_PORT_FILETER_V4V6"//ÉèÖö˿ڹýÂËÐÅÏ¢
319#define GOFORM_ROUTER_DEL_IP_PORT_FILETER_V4V6 "DEL_IP_PORT_FILETER_V4V6"
320#define GOFORM_ROUTER_ADD_PORT_FORWARE "FW_FORWARD_ADD"
321#define GOFORM_ROUTER_DEL_PORT_FORWARE "FW_FORWARD_DEL"
322#define GOFORM_ROUTER_ADD_PORT_MAP "ADD_PORT_MAP"
323#define GOFORM_ROUTER_DEL_PORT_MAP "DEL_PORT_MAP"
324#define GOFORM_ROUTER_BASIC_SETTING "BASIC_SETTING"
325#define GOFORM_ROUTER_FORWARD_SETTING "VIRTUAL_SERVER"
326#define GOFORM_ROUTER_SYSTEM_SECURITY "FW_SYS"
327#define GOFORM_ROUTER_DHCP_SETTING "DHCP_SETTING"
328#define GOFORM_ROUTER_STATIC_DHCP_SETTING "STATIC_DHCP_SETTING"
329#define GOFORM_ROUTER_UPNP_SETTING "UPNP_SETTING"
330#define GOFORM_ROUTER_DMZ_SETTING "DMZ_SETTING"
331#define GOFORM_ROUTER_EDIT_HOSTNAME "EDIT_HOSTNAME"
332#define GOFORM_BIND_STATIC_ADDRESS_SET "SET_BIND_STATIC_ADDRESS"
333#define GOFORM_BIND_STATIC_ADDRESS_ADD "BIND_STATIC_ADDRESS_ADD"
334#define GOFORM_BIND_STATIC_ADDRESS_DEL "BIND_STATIC_ADDRESS_DEL"
335#define GOFORM_ADD_CHILDREN_DEVICE "ADD_DEVICE"
336#define GOFORM_DEL_CHILDREN_DEVICE "DEL_DEVICE"
337#define GOFORM_ADD_WHITE_SITE "ADD_WHITE_SITE"
338#define GOFORM_REMOVE_WHITE_SITE "REMOVE_WHITE_SITE"
339#define GOFORM_URL_FILTER_DELETE "URL_FILTER_DELETE"
340#define GOFORM_URL_FILTER_ADD "URL_FILTER_ADD"
341#define GOFORM_DDNS "DDNS"
342//#define GOFORM_DNS_MODE_SET "SET_DNS_MODE"
343//#define GOFORM_DNS_SERVER_SET "SET_DNS_SERVER"
344
345// wan pppoe *
346#define GOFORM_SET_OPERATION_MODE "OPERATION_MODE"
347//#define GOFORM_SET_WAN_GATEWAYMODE "WAN_GATEWAYMODE"
348#define GOFORM_SET_WAN_GATEWAYMODE_PPPOE "WAN_GATEWAYMODE_PPPOE"
349#define GOFORM_SET_WAN_GATEWAYMODE_DHCP "WAN_GATEWAYMODE_DHCP"
350#define GOFORM_SET_WAN_GATEWAYMODE_STATIC "WAN_GATEWAYMODE_STATIC"
351#define GOFORM_SET_WAN_GATEWAYMODE_AUTO "WAN_GATEWAYMODE_AUTO"
352/*router module end*/
353
354/*httpShare module start*/
355#define GOFORM_HTTPSHARE_GETCARD_VAULE "HTTPSHARE_GETCARD_VALUE"
356#define GOFORM_HTTPSHARE_ENTERFOLD "HTTPSHARE_ENTERFOLD"
357#define GOFORM_HTTPSHARE_NEW "HTTPSHARE_NEW"
358#define GOFORM_HTTPSHARE_DEL "HTTPSHARE_DEL"
359#define GOFORM_HTTPSHARE_FILE_RENAME "HTTPSHARE_FILE_RENAME"
360#define GOFORM_HTTPSHARE_AUTH_SET "HTTPSHARE_AUTH_SET"
361#define GOFORM_HTTPSHARE_MODE_SET "HTTPSHARE_MODE_SET"
362#define GOFORM_HTTPSHARE_CHECK_FILE "GOFORM_HTTPSHARE_CHECK_FILE"
363#define CMD_HTTPSHARE_GETCARD_VAULE "HTTPSHARE_GETCARD_VALUE"
364#define CMD_HTTPSHARE_GETCARD_NMEA "HTTPSHARE_GETCARD_NAME"
365#define CMD_HTTPSHARE_AUTH_GET "HTTPSHARE_AUTH_GET"
366/*httpShare module end*/
367
368/*FOTA module start*/
369#define GOFORM_SET_FOTAAUTOUPDATE "IF_UPGRADE"
370#define GOFORM_SET_FOTASETTINGS "SetUpgAutoSetting"
371/*FOTA module end*/
372
373/*ping test*/
374#define GOFORM_PING_DIAGNOSTICS_START "PINT_DIAGNOSTICS_START"
375#define GOFORM_PING_DIAGNOSTICS_STOP "PINT_DIAGNOSTICS_STOP"
376/*ping test*/
377
378/*useradded module start*/
379#define GOFORM_SET_SAMPLE "GOFORM_SET_SAMPLE"
380/*useradded module end*/
381
382
383/****************************All the web pages' URL************************************/
384#define ZTE_WEB_PAGE_LOGIN_NAME "index.html"
385#define ZTE_WEB_MOBILE_PAGE_LOGIN_NAME "mobile.html"
386
387#define ZTE_WEB_PAGE_MSG "/message.asp"
388#define ZTE_WEB_PAGE_NET_CONNECT "/air_network/net_connect.asp"
389#define ZTE_WEB_PAGE_PPP_CONNECTING "/air_network/pppconnect.asp"
390#define ZTE_WEB_PAGE_PPP_DISCONNECT "/air_network/pppdisconnect.asp"
391
392/*******************************************************************************
393 * Type definitions *
394 ******************************************************************************/
395/**
396 * @brief time
397 * @param sec second
398 * @param usec Microsecond
399 * @note
400 * @warning
401 */
402struct os_time {
403 long sec;
404 long usec;
405};
406
407
408/**
409 * @brief goform/cmd table's struct
410 * @param goform_id the message id extract from URL
411 * @param proc_func the handler of this goform_id
412 * @note
413 * @warning
414 */
415typedef struct web_goform_struct {
416 char goform_id[50];
417 void (*proc_func)(webs_t wp);
418} web_goform_type;
419
420/*******************************************************************************
421 * Global variable declarations *
422 ******************************************************************************/
423typedef enum _data_safe_result_type_t {
424 DATA_NO_SAFE = 0,
425 DATA_SAFE = 1
426} data_safe_result_type_t;
427
428typedef enum {
429 ZTE_NVIO_FAIL = 0,
430 ZTE_NVIO_DONE = 1,
431 ZTE_NVIO_BUSY = 2,
432 ZTE_NVIO_BADCMD = 3,
433 ZTE_NVIO_MAX
434} zte_topsw_state_e_type;
435
436
437
438/*******************************************************************************
439 * Global function declarations *
440 ******************************************************************************/
441/**
442* @brief Get current systime
443*
444* @param
445*
446* @return currentTime
447* @note
448* @warning
449*/
450int zte_web_getCurrentTime();
451
452/**
453* @brief the entry of zte code in goahead.
454*
455* @param
456*
457* @return currentTime
458* @note
459* @warning
460*/
461extern void zte_web_init();
462
463/**
464 * @brief Read the NV's value from the nv file.
465 *
466 * @param item Pointer to the NV's name.
467 * @param data Pointer to the NV's value.
468 * @param dataLen data's length.
469 *
470 * @return zte_topsw_state_e_type result number
471 * @note
472 * @warning
473 */
474zte_topsw_state_e_type zte_nvconfig_read(char *item, char *data, int dataLen);
475
476/**
477* @brief Write the NV's name and value into the nv file.
478*
479* @param item Pointer to the NV's name.
480* @param data Pointer to the NV's value.
481* @param dataLen data's length.
482*
483* @return zte_topsw_state_e_type result number
484* @note
485* @warning
486*/
487zte_topsw_state_e_type zte_nvconfig_write(char *item, char *data, int dataLen);
488
489/**
490* @brief goform entry from web pages to get fw para, call the related functions according to the cmd
491*
492* @param wp HTTP Request Info.
493*
494* @return
495* @note
496* @warning
497*/
498void zte_goform_get_cmd_process(webs_t wp, char *path, char *query);
499
500/**
501* @brief goform entry from web pages to set fw para, call the related functions according to the goformId
502*
503* @param wp HTTP Request Info.
504*
505* @return
506* @note
507* @warning
508*/
509void zte_goform_set_cmd_process(webs_t wp, char *path, char *query);
510
511/**
512* @brief Feed back web page at top location.
513*
514* @param i_wp HTTP Request Info.
515* @param i_pageName The page name.
516*
517* @return
518* @note
519* @warning
520*/
521extern void zte_webs_feedback_top(webs_t i_wp, char *i_pageName);
522
523/**
524* @brief Check whether the login timeout.
525*
526* @param i_wp HTTP Request Info.
527* @param i_pageName The page name.
528*
529* @return
530* @note
531* @warning
532*/
533extern void zte_mgmt_login_timeout_check();
534
535/**
536* @brief Send SMS.
537*
538* @param wp HTTP Request Info.
539*
540* @return
541* @note
542* @warning
543*/
544extern void zte_sms_send_msg_process(webs_t wp);
545
546/**
547* @brief Save SMS.
548*
549* @param wp HTTP Request Info.
550*
551* @return
552* @note
553* @warning
554*/
555extern void zte_sms_save_msg_process(webs_t wp);
556
557/**
558* @brief Delete message.
559*
560* @param wp HTTP Request Info.
561*
562* @return
563* @note
564* @warning
565*/
566extern void zte_sms_delete_msg_process(webs_t wp);
567
568/**
569* @brief Move message to SIM.
570*
571* @param wp HTTP Request Info.
572*
573* @return
574* @note
575* @warning
576*/
577extern void zte_sms_move_to_sim_msg_process(webs_t wp);
578
579/**
580* @brief Delete all messages.
581*
582* @param wp HTTP Request Info.
583*
584* @return
585* @note
586* @warning
587*/
588extern void zte_goform_sms_alldel_msg_process(webs_t wp);
589
590/**
591* @brief Set SMS related parameters.
592*
593* @param wp HTTP Request Info.
594*
595* @return
596* @note
597* @warning
598*/
599extern void zte_sms_set_message_center(webs_t wp);
600
601/**
602* @brief To set the viewed message as read.
603*
604* @param wp HTTP Request Info.
605*
606* @return
607* @note
608* @warning
609*/
610extern void zte_sms_view_msg_process(webs_t wp);
611
612/**
613* @brief Add new contact.
614*
615* @param wp HTTP Request Info.
616*
617* @return
618* @note
619* @warning
620*/
621extern void zte_goform_pbm_contact_add_process(webs_t wp);
622
623/**
624* @brief Delete contact.
625*
626* @param wp HTTP Request Info.
627*
628* @return
629* @note
630* @warning
631*/
632extern void zte_goform_pbm_contact_del_process(webs_t wp);
633
634/**
635* @brief Set WiFi basic parameter.
636*
637* @param wp HTTP Request Info.
638*
639* @return
640* @note
641* @warning
642*/
643extern void zte_wlan_basic_set(webs_t wp);
644
645/**
646* @brief Set WiFi MAC filter parameters.
647*
648* @param wp HTTP Request Info.
649*
650* @return
651* @note
652* @warning
653*/
654extern void zte_wlan_mac_filter_set(webs_t wp);
655
656/**
657* @brief Set WiFi WPS mode.
658*
659* @param wp HTTP Request Info.
660*
661* @return
662* @note
663* @warning
664*/
665extern void zte_wlan_wps_mode_set(webs_t wp);
666
667/**
668* @brief Set WiFi sleep and wake up at regular time.
669*
670* @param wp HTTP Request Info.
671*
672* @return
673* @note
674* @warning
675*/
676extern void zte_wlan_set_tsw(webs_t wp);
677
678/**
679* @brief Set WiFi SSID1 parameters.
680*
681* @param wp HTTP Request Info.
682*
683* @return
684* @note
685* @warning
686*/
687extern void zte_wlan_web_ssid1_set(webs_t wp);
688
689/**
690* @brief Set WiFi SSID2 parameters.
691*
692* @param wp HTTP Request Info.
693*
694* @return
695* @note
696* @warning
697*/
698extern void zte_wlan_ssid2_set(webs_t wp);
699
700/**
701* @brief To set the WiFi sleep mode.
702*
703* @param wp HTTP Request Info.
704*
705* @return
706* @note
707* @warning
708*/
709extern void zte_wlan_sleep_set(webs_t wp);
710
711/**
712* @brief Set WiFi coverage mode.
713*
714* @param wp HTTP Request Info.
715*
716* @return
717* @note
718* @warning
719*/
720extern void zte_wlan_coverage_set(webs_t wp);
721
722/**
723* @brief Set WiFi apstation parameters.
724*
725* @param wp HTTP Request Info.
726*
727* @return
728* @note
729* @warning
730*/
731extern void zte_wlan_station_set(webs_t wp);
732
733/**
734* @brief Update the wifi spot profile.
735*
736* @param wp HTTP Request Info.
737*
738* @return
739* @note
740* @warning
741*/
742extern void zte_wlan_station_spot_profile_update(webs_t wp);
743
744/**
745* @brief Connect to wifi spot.
746*
747* @param wp HTTP Request Info.
748*
749* @return
750* @note
751* @warning
752*/
753extern void zte_wlan_station_connect(webs_t wp);
754
755/**
756* @brief Disconnect wifi spot.
757*
758* @param wp HTTP Request Info.
759*
760* @return
761* @note
762* @warning
763*/
764extern void zte_wlan_station_disconnect(webs_t wp);
765
766/**
767* @brief Scan the wifi spot.
768*
769* @param wp HTTP Request Info.
770*
771* @return
772* @note
773* @warning
774*/
775extern void zte_wlan_station_refresh(webs_t wp);
776
777/**
778* @brief Get the wlan port's information.
779*
780* @param wp HTTP Request Info.
781*
782* @return
783* @note
784* @warning
785*/
786extern void zte_wlan_get_station_list(webs_t wp);
787extern void zte_wlan_get_wps_pin(webs_t wp);
788extern void zte_wlan_get_wps_defpin(webs_t wp);
789
790
791
792/**
793* @brief Register network after manual search.
794*
795* @param wp HTTP Request Info.
796*
797* @return
798* @note
799* @warning
800*/
801extern void zte_wan_set_network(webs_t wp);
802
803/**
804* @brief Set connect mode.
805*
806* @param wp HTTP Request Info.
807*
808* @return
809* @note
810* @warning
811*/
812extern void zte_wan_set_connection_mode(webs_t wp);
813
814/**
815* @brief Connect to the network.
816*
817* @param wp HTTP Request Info.
818*
819* @return
820* @note
821* @warning
822*/
823extern void zte_wan_connect_network(webs_t wp);
824
825/**
826* @brief Disonnect the network.
827*
828* @param wp HTTP Request Info.
829*
830* @return
831* @note
832* @warning
833*/
834extern void zte_wan_disconnect_network(webs_t wp);
835
836/**
837* @brief Scan the network.
838*
839* @param wp HTTP Request Info.
840*
841* @return
842* @note
843* @warning
844*/
845extern void zte_wan_scan_network(webs_t wp);
846
847/**
848* @brief Set the mode of searching network.
849*
850* @param wp HTTP Request Info.
851*
852* @return
853* @note
854* @warning
855*/
856extern void zte_wan_network_select(webs_t wp);
857
858/**
859* @brief Set the management of network flow.
860*
861* @param wp HTTP Request Info.
862*
863* @return
864* @note
865* @warning
866*/
867extern void zte_wan_data_limit_setting(webs_t wp);
868
869/**
870* @brief Calibrate the network flow by manual.
871*
872* @param wp HTTP Request Info.
873*
874* @return
875* @note
876* @warning
877*/
878extern void zte_wan_data_flow_calibration_manual(webs_t wp);
879
880
881/**
882* @brief Clear the network flow records.
883*
884* @param wp HTTP Request Info.
885*
886* @return
887* @note
888* @warning
889*/
890extern void zte_wan_data_statistics_clear_process(webs_t wp, char_t *path, char_t *query);//11
891
892/**
893* @brief Init the httpshare.
894*
895* @param
896*
897* @return
898* @note
899* @warning
900*/
901extern void zte_httpshare_init();
902
903/**
904* @brief Get file list from httpshare's database.
905*
906* @param wp HTTP Request Info.
907*
908* @return
909* @note
910* @warning
911*/
912extern void zte_httpShare_enterFold(webs_t wp);
913
914/**
915* @brief Creat a new folder.
916*
917* @param wp HTTP Request Info.
918*
919* @return
920* @note
921* @warning
922*/
923extern void zte_httpShare_new(webs_t wp);
924
925/**
926* @brief Delete file or folder from SD card.
927*
928* @param wp HTTP Request Info.
929*
930* @return
931* @note
932* @warning
933*/
934extern void zte_httpShare_del(webs_t wp);
935
936/**
937* @brief Set the httpshare's configs.
938*
939* @param wp HTTP Request Info.
940*
941* @return
942* @note
943* @warning
944*/
945extern void zte_httpShare_auth_set(webs_t wp);
946
947/**
948* @brief Set the SD card's mode:usb mode or httpshare mode.
949*
950* @param wp HTTP Request Info.
951*
952* @return
953* @note
954* @warning
955*/
956extern void zte_httpShare_modeset(webs_t wp);
957
958/**
959* @brief Creat a new folder.
960*
961* @param wp HTTP Request Info.
962*
963* @return
964* @note
965* @warning
966*/
967extern void zte_httpShare_rename(webs_t wp);
968
969/**
970* @brief Check file exists.
971*
972* @param wp HTTP Request Info.
973*
974* @return
975* @note
976* @warning
977*/
978extern void zte_httpShare_check_file(webs_t wp);
979
980/**
981* @brief Get the httpshare's configs.
982*
983* @param wp HTTP Request Info.
984*
985* @return
986* @note
987* @warning
988*/
989extern void zte_httpShare_auth_get(webs_t wp);
990
991/**
992* @brief Get the SD card's name:"MicroSD Card".
993*
994* @param wp HTTP Request Info.
995*
996* @return
997* @note
998* @warning
999*/
1000extern void zte_httpShare_getcard_name(webs_t wp);
1001
1002/**
1003* @brief Get the SD card's available capacity and total capacity.
1004*
1005* @param wp HTTP Request Info.
1006*
1007* @return
1008* @note
1009* @warning
1010*/
1011extern void zte_httpShare_getcard_value(webs_t wp);
1012
1013/**
1014* @brief Ussd's operator process.
1015*
1016* @param wp HTTP Request Info.
1017*
1018* @return
1019* @note
1020* @warning
1021*/
1022extern void zte_goform_ussd_process(webs_t wp);
1023
1024/**
1025* @brief Handle the auto or manual apn set for ipv4ipv6.
1026*
1027* @param wp HTTP Request Info.
1028*
1029* @return
1030* @note
1031* @warning
1032*/
1033extern void zte_form_multi_apn_proc_ex(webs_t wp);
1034
1035/**
1036* @brief Set the user's selection:update or cancel.
1037*
1038* @param wp HTTP Request Info.
1039*
1040* @return
1041* @note
1042* @warning
1043*/
1044extern void zte_fota_update(webs_t wp);
1045
1046/**
1047* @brief Set the fota's configs.
1048*
1049* @param wp HTTP Request Info.
1050*
1051* @return
1052* @note
1053* @warning
1054*/
1055extern void zte_fota_settings(webs_t wp);
1056
1057
1058extern void zte_init_login_psw_time(void);
1059extern int zte_apn_param_check(webs_t wp, char * type);
1060extern void zte_get_login_lock_time(webs_t wp);
1061extern void zte_get_login_status_value(webs_t wp, char *login_status);
1062extern void zte_get_ddns_status(webs_t wp);
1063extern void zte_dhcpv6_state_set(webs_t wp);
1064extern void zte_mtu_set(webs_t wp);
1065extern void zte_dns_mode_set(webs_t wp);
1066//extern void zte_dns_server_set(webs_t wp);
1067extern void zte_ping_diagnostics_start(webs_t wp);
1068extern void zte_ping_diagnostics_stop(webs_t wp);
1069extern void zte_get_poweron_time(webs_t wp);
1070extern void zte_get_lan_dev_info(webs_t wp);
1071extern void zte_goform_set_external_nv(webs_t wp);
1072extern void zte_goform_set_work_type(webs_t wp);
1073
1074//other sntp + fluxstat + parent_control_set
1075extern void zte_goform_sntp_getdatastatic_process(webs_t wp);
1076extern void zte_parent_control_set(webs_t wp);//parent mode time control
1077
1078/*useradded module start*/
1079extern void zte_goform_set_sample(webs_t wp);
1080/*useradded module end*/
1081
1082
1083/**
1084* @brief Data to be decoded.
1085*
1086* @param src Data to be decoded.
1087* @param len Length of the data to be decoded.
1088* @param out_len Pointer to output length variable.
1089*
1090* @return Allocated buffer of out_len bytes of decoded data,or NULL on failure
1091* @note Caller is responsible for freeing the returned buffer.
1092* @warning
1093*/
1094extern unsigned char * zte_base64_decode(const unsigned char *src, size_t len, size_t *out_len);
1095#ifdef WEBS_SECURITY
1096extern char *zte_base64_encode(const char *data, int data_len);
1097#endif
1098
1099extern int zte_Safe_valid_SpecialChar(char single_data);
1100extern int zte_Safe_valid_SpecialChar_other(char single_data);
1101extern int zte_valid_length_str(char *string_s, int min, int max);
1102
1103extern data_safe_result_type_t zte_Safe_isMacValid(char *str);
1104extern data_safe_result_type_t zte_Safe_isIpValid(char *str);
1105extern data_safe_result_type_t zte_Safe_isNumOnly(char *str);
1106extern data_safe_result_type_t zte_Safe_noSpecialChar(char *str);
1107extern data_safe_result_type_t zte_Safe_noSpecialChar_other(char *str);
1108extern data_safe_result_type_t zte_Safe_isStringOnly(char *str);
1109extern data_safe_result_type_t zte_Safe_isNumorStringOnly(char *str);
1110
1111extern int web_set_pwd(char *buf);
1112extern void web_init_pwd(void);
1113extern int web_check_pwd(char* buf);
1114
1115extern int web_aes_init(void);
1116
1117#endif
1118