1/*************************************************************************** 2#*** 3#*** Copyright 2005 Hon Hai Precision Ind. Co. Ltd. 4#*** All Rights Reserved. 5#*** No portions of this material shall be reproduced in any form without the 6#*** written permission of Hon Hai Precision Ind. Co. Ltd. 7#*** 8#*** All information contained in this document is Hon Hai Precision Ind. 9#*** Co. Ltd. company private, proprietary, and trade secret property and 10#*** are protected by international intellectual property laws and treaties. 11#*** 12#****************************************************************************/ 13#ifndef _ACOSNVRAMCONFIG_H 14#define _ACOSNVRAMCONFIG_H 15 16#ifdef __cplusplus 17extern "C" 18{ /* Assume C declarations for C++ */ 19#endif /* __cplusplus */ 20 21#include "acosTypes.h" 22 23/* definitions */ 24#define ACOSNVRAM_MAX_TAG_LEN 32 25#define ACOSNVRAM_MAX_VAL_LEN 512 26#define ACOSNVRAM_MAX_FVAL_LEN 500 /* maximum length formatted string */ 27/* acos configuration error number */ 28#define ACOSNVRAM_SUCCESS 0 29#define ACOSNVRAM_FAIL 1 30#define ACOSNVRAM_TAGNOTFOUND 2 31#define ACOSNVRAM_RESOURCE 3 32#define ACOSNVRAM_TAGTOOLONG 4 33#define ACOSNVRAM_VALTOOLONG 5 34 35#define ENCRYPT_START_TAG "<en>" 36#define ENCRYPT_END_TAG "</en>" 37#define DECRYPT_START_TAG "<de>" 38#define DECRYPT_END_TAG "</de>" 39 40#define ACOSNVRAM_TAG_TM_WOL "TM_WOL_ENABLE" 41/* NVRAM Parameters */ 42#define ACOSNVRAM_TAG_VERSION "system_nvram_version" 43#define ACOSNVRAM_TAG_WAN_IFS "system_wan_ifs" 44#define ACOSNVRAM_TAG_LAN_IFS "system_lan_ifs" 45#define ACOSNVRAM_TAG_BRIDGE_IFS "system_bridge_ifs" 46#define ACOSNVRAM_TAG_NAT_IFS "system_nat_ifs" 47#define ACOSNVRAM_TAG_NAT_INBOUNDNUM "system_nat_inboundnum" 48#define ACOSNVRAM_TAG_RTSPALG_TIMEOUT "system_rtspalg_timeout" 49#define ACOSNVRAM_TAG_RTSPALG_SERVERPORT "system_rtspalg_serverport" 50#define ACOSNVRAM_TAG_DHCPC_IFS "system_dhcpc_ifs" 51#define ACOSNVRAM_TAG_DHCPS_IFS "system_dhcps_ifs" 52#define ACOSNVRAM_TAG_PPPOE_IFS "system_pppoe_ifs" 53 54#define ACOSNVRAM_TAG_LAN_IP_ADDR "system_lan_ipaddr" /* LAN IP address */ 55#define ACOSNVRAM_TAG_LAN_NET_MASK "system_lan_netmask" /* LAN subnet mask */ 56 /*#define ACOSNVRAM_TAG_LAN_MAC_ADDR "system_lan_hwaddr" *//* LAN MAC address */ 57 58#define ACOSNVRAM_TAG_WAN_PROTO "system_wan_ipconfig" /* WAN protocol, "dhcp", "static" or "pppoe" */ 59#define ACOSNVRAM_TAG_WAN_IP_ADDR "system_wan_ipaddr" /* WAN IP address */ 60#define ACOSNVRAM_TAG_WAN_NET_MASK "system_wan_netmask" /* WAN subnet mask */ 61 /*#define ACOSNVRAM_TAG_WAN_MAC_ADDR "system_wan_hwaddr" *//* WAN MAC address */ 62#define ACOSNVRAM_TAG_WAN_GATEWAY "system_wan_gateway" /* WAN default gateway */ 63#define ACOSNVRAM_TAG_WAN_DNS "system_wan_dns" /* WAN DNS */ 64#define ACOSNVRAM_TAG_WAN_WINS "system_wan_wins" /* WAN WINS */ 65#define ACOSNVRAM_TAG_WAN_HOSTNAME "system_hostname" /* WAN hostname */ 66#define ACOSNVRAM_TAG_WAN_DOMAIN "system_wan_domain" /* WAN Domain name */ 67#define ACOSNVRAM_TAG_FIREWALL "system_firewall" /* Firewall enable or disable */ 68#define ACOSNVRAM_TAG_CA_NAME "system_ca_name" /* Call agent name */ 69#define ACOSNVRAM_TAG_CA_IP_ADDR "system_ca_ipaddr" /* Call agent IP address */ 70#define ACOSNVRAM_TAG_TFTP_SERVER "system_tftp_server" /* tftp server ip address */ 71 72#define ACOSNVRAM_TAG_COUNTRYCODE "system_countrycode" /* country code for wireless device */ 73 74#define ACOSNVRAM_TAG_NAPT_MODE "system_napt_mode" /* NAPT modes */ 75#define ACOSNVRAM_TAG_SRV_MODE "system_srv_mode" /* Service modes */ 76 77#define ACOSNVRAM_TAG_DHCPS_STATUS "dhcps_status" /* Enable / Disable DHPCS, "dhcp" or "static" */ 78#define ACOSNVRAM_TAG_DHCPS_STARTIP "dhcps_startip" /* First IP Address in pool */ 79#define ACOSNVRAM_TAG_DHCPS_ENDIP "dhcps_endip" /* Last IP Address in pool */ 80#define ACOSNVRAM_TAG_DHCPS_MODE "dhcps_mode" /* "auto" or "manual" */ 81#define ACOSNVRAM_TAG_DHCPS_DF_GW "dhcps_df_gw" /* Default gateway */ 82#define ACOSNVRAM_TAG_DHCPS_DNS "dhcps_dns" /* DNS */ 83#define ACOSNVRAM_TAG_DHCPS_WINS "dhcps_wins" /* WINS server */ 84#define ACOSNVRAM_TAG_DHCPS_DOMAIN "dhcps_domain" /* Domain name */ 85#define ACOSNVRAM_TAG_DHCPS_LEASE_TIME "dhcps_lease_time" /* Lease time */ 86#define ACOSNVRAM_TAG_DHCPS_RESERVED_IP "dhcps_reserved_ip" /* Reserved IP address */ 87#define ACOSNVRAM_TAG_DHCPS_RESERVED_MAC "dhcps_reserved_mac" /* MAC address to get the reserved IP */ 88 89#define ACOSNVRAM_TAG_DHCPC_CLID "dhcpc_clid" /* DHCP client ID */ 90#define ACOSNVRAM_TAG_DHCPC_OPT "dhcpc_opts" /* DHCP Options */ 91 92#define ACOSNVRAM_TAG_PPPOE_VIRTUAL_IFS "pppoe_virtual_ifs" /* PPPOE virtual interface name */ 93#define ACOSNVRAM_TAG_PPPOE_USERNAME "pppoe_username" /* PPPOE username */ 94#define ACOSNVRAM_TAG_PPPOE_PASSWD "pppoe_passwd" /* PPPOE password */ 95#define ACOSNVRAM_TAG_PPPOE_MTU "pppoe_mtu" /* PPPOE MTU size */ 96#define ACOSNVRAM_TAG_PPPOE_MRU "pppoe_mru" /* PPPOE MRU size */ 97#define ACOSNVRAM_TAG_PPPOE_IDLETIME "pppoe_idletime" /* PPPOE idle time */ 98#define ACOSNVRAM_TAG_PPPOE_KEEPALIVE "pppoe_keepalive" /* PPPOE keep alive function, "0" or "1" */ 99#define ACOSNVRAM_TAG_PPPOE_AUTHTYPE "pppoe_authtype" /* PPP authentication type */ 100#define ACOSNVRAM_TAG_PPPOE_SERVICENAME "pppoe_servicename" /* PPPOE service name */ 101#define ACOSNVRAM_TAG_PPPOE_ACNAME "pppoe_acname" /* PPPOE AC name */ 102#define ACOSNVRAM_TAG_PPPOE_DOD "pppoe_dod" /* PPPOE dial on demand */ 103#define ACOSNVRAM_TAG_PPPOE_SESSIONID "pppoe_session_id" /* PPPoE previous session ID */ 104#define ACOSNVRAM_TAG_PPPOE_SERVER_MAC "pppoe_server_mac" /* PPPoE previous server Mac */ 105 106#define ACOSNVRAM_TAG_NAT_ENABLE "nat_enable" /* Enable/disable NAT, 0=disable,1=enable */ 107#define ACOSNVRAM_TAG_TCP_FORWARD "nat_forward_tcp" /* TCP port forwarding rules */ 108#define ACOSNVRAM_TAG_UDP_FORWARD "nat_forward_udp" /* UDP port forwarding rules */ 109#define ACOSNVRAM_TAG_DMZ_ADDR "nat_dmz_ipaddr" /* DMZ address */ 110#define ACOSNVRAM_TAG_STATIC_ROUTE "nat_static_route" /* Static routing table */ 111 112#define ACOSNVRAM_TAG_RIP_ENABLE "rip_enable" /* Enable / disable RIP */ 113#define ACOSNVRAM_TAG_RIP_FILTER_ENABLE "rip_filter_enable" /* Enable / disable RIP filter */ 114#define ACOSNVRAM_TAG_RIP_MULTICAST "rip_multicast" /* RIP multicast */ 115#define ACOSNVRAM_TAG_RIP_VERSION "rip_version" /* RIP version */ 116 117#define ACOSNVRAM_TAG_LAN_IP_FILTER "filter_ip" /* LAN IP filters */ 118#define ACOSNVRAM_TAG_LAN_TCP_FILTER "filter_tcp" /* LAN TCP filters */ 119#define ACOSNVRAM_TAG_LAN_UDP_FILTER "filter_udp" /* LAN UDP filters */ 120#define ACOSNVRAM_TAG_LAN_MAC_FILTER "filter_mac" /* LAN MAC filters */ 121 122 /*#define ACOSNVRAM_TAG_RESTORE_DEFAULT "restore_defaults" *//* Set to "1" to restore factory defaults */ 123 124#define ACOSNVRAM_TAG_SYSLOG_SERVER "system_syslog_server" /* Syslog server */ 125#define ACOSNVRAM_TAG_NTP_SERVER "system_ntp_server" /* SNTP server */ 126#define ACOSNVRAM_TAG_TIMEZONE "system_time_zone" /* Timezone */ 127#define ACOSNVRAM_TAG_PERIOD "sntp_period" /* sntp get NTP server time period */ 128#define ACOSNVRAM_TAG_FASTUDP_FLAG "fastudp_flag" /* fastudp flag */ 129 130#define ACOSNVRAM_TAG_HTTP_NAME1 "httpd_username1" /* WEB UI login name */ 131#define ACOSNVRAM_TAG_HTTP_PASSWD1 "httpd_password1" /* WEB UI password */ 132#define ACOSNVRAM_TAG_HTTP_NAME2 "httpd_username2" /* WEB UI login name */ 133#define ACOSNVRAM_TAG_HTTP_PASSWD2 "httpd_password2" /* WEB UI password */ 134#define ACOSNVRAM_TAG_HTTP_NAME3 "httpd_username3" /* WEB UI login name */ 135#define ACOSNVRAM_TAG_HTTP_PASSWD3 "httpd_password3" /* WEB UI password */ 136#define ACOSNVRAM_TAG_HTTP_NAME4 "httpd_username4" /* WEB UI login name */ 137#define ACOSNVRAM_TAG_HTTP_PASSWD4 "httpd_password4" /* WEB UI password */ 138 139#define ACOSNVRAM_TAG_CLI_SUPER "cli_super_username" 140#define ACOSNVRAM_TAG_CLI_SUPER_PWD "cli_super_passwd" 141#define ACOSNVRAM_TAG_CLI_SUPER_RMTPWD "cli_super_rmtpwd" 142#define ACOSNVRAM_TAG_CLI_USR1 "cli_user_01" 143#define ACOSNVRAM_TAG_CLI_USR1_PWD "cli_user_01_passwd" 144#define ACOSNVRAM_TAG_CLI_USR1_RMTPWD "cli_user_01_rmtpwd" 145#define ACOSNVRAM_TAG_CLI_USR2 "cli_user_02" 146#define ACOSNVRAM_TAG_CLI_USR2_PWD "cli_user_02_passwd" 147#define ACOSNVRAM_TAG_CLI_USR2_RMTPWD "cli_user_02_rmtpwd" 148#define ACOSNVRAM_TAG_CLI_USR3 "cli_user_03" 149#define ACOSNVRAM_TAG_CLI_USR3_PWD "cli_user_03_passwd" 150#define ACOSNVRAM_TAG_CLI_USR3_RMTPWD "cli_user_03_rmtpwd" 151 152#define ACOSNVRAM_TAG_CLI_SESS_TIMEOUT "cli_sess_timeout" 153#define ACOSNVRAM_TAG_CLI_RMT_TIMEOUT "cli_rmt_timeout" 154#define ACOSNVRAM_TAG_CLI_CONSOLE_LOCK "cli_console_lock" 155 156 /* #define ACOSNVRAM_TAG_USER_NAME "cli_user_username" *//* CLI user-level username */ 157 /* #define ACOSNVRAM_TAG_USER_PASSWD "cli_user_passwd" *//* CLI user-level password */ 158 /* #define ACOSNVRAM_TAG_SUPER_NAME "cli_super_username" *//* CLI supervisor-level username */ 159 /* #define ACOSNVRAM_TAG_SUPER_PASSWD "cli_super_passwd" *//* CLI supervisor-level password */ 160 161#define ACOSNVRAM_TAG_SSH_TYPE "SSH_TYPE" /* SSH_THROUGH_TELNET */ 162#define ACOSNVRAM_TAG_SSH_LISTEN_PORT "SSH_LISTEN_PORT" 163#define ACOSNVRAM_TAG_SSH_HOST_KEY "SSH_HOST_KEY" 164 165 166/* Reason: Save static routes to nvram */ 167#define ACOSNVRAM_TAG_ROUTE_NUM "route_num" /* total static route number */ 168#define ACOSNVRAM_TAG_ROUTE_TAG_NUM "route_tag_num" /* total tag number in use */ 169#define ACOSNVRAM_TAG_ROUTE_ENTRY0 "route_entry0" /* static route index 0 */ 170#define ACOSNVRAM_TAG_ROUTE_ENTRY1 "route_entry1" /* static route index 1 */ 171#define ACOSNVRAM_TAG_ROUTE_ENTRY2 "route_entry2" /* static route index 2 */ 172#define ACOSNVRAM_TAG_ROUTE_ENTRY3 "route_entry3" /* static route index 3 */ 173#define ACOSNVRAM_TAG_ROUTE_ENTRY4 "route_entry4" /* static route index 4 */ 174#define ACOSNVRAM_TAG_ROUTE_ENTRY5 "route_entry5" /* static route index 5 */ 175#define ACOSNVRAM_TAG_ROUTE_ENTRY6 "route_entry6" /* static route index 6 */ 176#define ACOSNVRAM_TAG_ROUTE_ENTRY7 "route_entry7" /* static route index 7 */ 177#define ACOSNVRAM_TAG_ROUTE_ENTRY8 "route_entry8" /* static route index 8 */ 178#define ACOSNVRAM_TAG_ROUTE_ENTRY9 "route_entry9" /* static route index 9 */ 179 180/* 802.11b parameters */ 181#define ACOSNVRAM_TAG_WLB_NAME "wlb_name" 182#define ACOSNVRAM_TAG_WLB_SSID "wlb_ssid" 183#define ACOSNVRAM_TAG_WLB_AUTH_ALG "wlb_auth" 184#define ACOSNVRAM_TAG_WLB_CHANNEL "wlb_channel" 185#define ACOSNVRAM_TAG_WLB_PREAMBLE "wlb_preamble" 186#define ACOSNVRAM_TAG_WLB_BASIC_RATE "wlb_basic_rate" 187#define ACOSNVRAM_TAG_WLB_SUPPORT_RATE "wlb_sup_rate" 188#define ACOSNVRAM_TAG_WLB_TX_RATE "wlb_tx_rate" 189#define ACOSNVRAM_TAG_WLB_FRAG "wlb_frag" 190#define ACOSNVRAM_TAG_WLB_RTS "wlb_rts" 191#define ACOSNVRAM_TAG_WLB_DTIM "wlb_dtim" 192#define ACOSNVRAM_TAG_WLB_BEACON "wlb_bcn" 193#define ACOSNVRAM_TAG_WLB_PRIVACY "wlb_wep" 194#define ACOSNVRAM_TAG_WLB_EXCL_NOWEP "wlb_excl_nowep" 195#define ACOSNVRAM_TAG_WLB_KEYID "wlb_key" 196#define ACOSNVRAM_TAG_WLB_KEYID_64 "wlb_key_64" 197#define ACOSNVRAM_TAG_WLB_KEYID_128 "wlb_key_128" 198#define ACOSNVRAM_TAG_WLB_KEY64_1 "wlb_key64_1" 199#define ACOSNVRAM_TAG_WLB_KEY64_2 "wlb_key64_2" 200#define ACOSNVRAM_TAG_WLB_KEY64_3 "wlb_key64_3" 201#define ACOSNVRAM_TAG_WLB_KEY64_4 "wlb_key64_4" 202#define ACOSNVRAM_TAG_WLB_KEY128_1 "wlb_key128_1" 203#define ACOSNVRAM_TAG_WLB_KEY128_2 "wlb_key128_2" 204#define ACOSNVRAM_TAG_WLB_KEY128_3 "wlb_key128_3" 205#define ACOSNVRAM_TAG_WLB_KEY128_4 "wlb_key128_4" 206#define ACOSNVRAM_TAG_WLB_ACL_ENABLE "wlb_acl_enable" 207#define ACOSNVRAM_TAG_WLB_MAC "wlb_mac" 208#define ACOSNVRAM_TAG_WLB_ICC "wlb_icc" 209#define ACOSNVRAM_TAG_WLB_COUNTRY "wlb_country" 210#define ACOSNVRAM_TAG_WLB_AP_DENSITY "wlb_ap_density" 211#define ACOSNVRAM_TAG_WLB_AUTO_CHANNEL "wlb_auto_channel" 212#define ACOSNVRAM_TAG_WLB_ENH_SECURITY "wlb_enh_security" 213#define ACOSNVRAM_TAG_WLB_ENABLE_BRIDGE "wlb_enable_bridge" 214#define ACOSNVRAM_TAG_WLB_WANLINK "wlb_wanlink" 215#define ACOSNVRAM_TAG_WLB_TXPOWER "wlb_txpower" 216#define ACOSNVRAM_TAG_WLB_TXPOWER_OFFSET "wlb_txpower_offset" 217#define ACOSNVRAM_TAG_WLB_CLIENTTHRES "wlb_clientthres" 218#define ACOSNVRAM_TAG_WLB_TRAFFICTHRES "wlb_trafficthres" 219 220#define ACOSNVRAM_TAG_WLB_MODE "wlb_mode" 221#define ACOSNVRAM_TAG_WLB_WDS_MAC "wlb_wds_mac" 222 223#define ACOSNVRAM_TAG_WDS_PORT_ENABLE_1 "wlb_wds_port_enable_1" 224#define ACOSNVRAM_TAG_WDS_PORT_ENABLE_2 "wlb_wds_port_enable_2" 225#define ACOSNVRAM_TAG_WDS_PORT_ENABLE_3 "wlb_wds_port_enable_3" 226#define ACOSNVRAM_TAG_WDS_PORT_ENABLE_4 "wlb_wds_port_enable_4" 227#define ACOSNVRAM_TAG_WDS_PORT_ENABLE_5 "wlb_wds_port_enable_5" 228#define ACOSNVRAM_TAG_WDS_PORT_ENABLE_6 "wlb_wds_port_enable_6" 229#define ACOSNVRAM_TAG_WDS_AP_MAC_1 "wlb_wds_ap_mac_1" 230#define ACOSNVRAM_TAG_WDS_AP_MAC_2 "wlb_wds_ap_mac_2" 231#define ACOSNVRAM_TAG_WDS_AP_MAC_3 "wlb_wds_ap_mac_3" 232#define ACOSNVRAM_TAG_WDS_AP_MAC_4 "wlb_wds_ap_mac_4" 233#define ACOSNVRAM_TAG_WDS_AP_MAC_5 "wlb_wds_ap_mac_5" 234#define ACOSNVRAM_TAG_WDS_AP_MAC_6 "wlb_wds_ap_mac_6" 235 236#define ACOSNVRAM_TAG_SNMP_GET_COMM_NAME "snmp_get_comm_name" 237#define ACOSNVRAM_TAG_SNMP_SET_COMM_NAME "snmp_set_comm_name" 238 239#define ACOSNVRAM_TAG_RADIUS_AUTH_MODE "radius_auth_mode" 240#define ACOSNVRAM_TAG_RADIUS_AUTH_IP "radius_auth_ip" 241#define ACOSNVRAM_TAG_RADIUS_AUTH_PORT "radius_auth_port" 242#define ACOSNVRAM_TAG_RADIUS_AUTH_SECRET "radius_auth_secret" 243#define ACOSNVRAM_TAG_RADIUS_ACCT_IP "radius_acct_ip" 244#define ACOSNVRAM_TAG_RADIUS_ACCT_PORT "radius_acct_port" 245#define ACOSNVRAM_TAG_RADIUS_ACCT_SECRET "radius_acct_secret" 246#define ACOSNVRAM_TAG_RADIUS_DWEP "radius_dwep" 247 248#define ACOSNVRAM_TAG_HTTP_RMEANBlE "httpd_rmenable" /* Enable/ Disable remote management */ 249#define ACOSNVRAM_TAG_HTTP_RMPORT "httpd_rmport" /* Remote management port number */ 250#define ACOSNVRAM_TAG_HTTP_RMSTARTIP "httpd_rmstartip" /* Remote management allowed ip range start */ 251#define ACOSNVRAM_TAG_HTTP_RMENDIP "httpd_rmendip" /* Remote management allowed ip range end */ 252 253#define ACOSNVRAM_TAG_UPNP_EANBlE "upnp_enable" /* UPnP enable/disable */ 254#define ACOSNVRAM_TAG_UPNP_PERIOD "upnp_period" /* UPnP advertisement period */ 255#define ACOSNVRAM_TAG_UPNP_TTL "upnp_ttl" /* UPnP advertisement TTL */ 256#define ACOSNVRAM_TAG_UPNP_PORT "upnp_port" /* UPnP TCP port for HTTP GET, GENA, and SOAP */ 257#define ACOSNVRAM_TAG_UPNP_IFENABLE "upnp_ifenable" /* Enable/Disable UPnP support for the specified interface */ 258#define ACOSNVRAM_TAG_UPNP_ALGPORTNUM "upnp_algport_num" /* Number of ALG port related to UPnP */ 259#define ACOSNVRAM_TAG_UPNP_ALGPORT_PREFIX "upnp_algport" /* ALG port related to UPnP */ 260#define ACOSNVRAM_TAG_UPNP_ALGPROT_PREFIX "upnp_algport_pro" /* ALG port protocol related to UPnP */ 261 262 extern int acosNvramConfig_init (IN char *pcFsMount); 263 extern char *acosNvramConfig_get(const char *name); 264 /* wklin added start */ 265 extern char *acosNvramConfig_bget(const char *name, char *buf, int buf_len); 266 extern char *acosNvramConfig_get_decode(const char *name); 267 extern int acosNvramConfig_set_encode(const char *name, const char *value); 268 extern int acosNvramConfig_read_decode(IN char *pcTagName, OUT char *pcValue, 269 IN int iMaxBufSize); 270 /* wklin added end */ 271 extern int acosNvramConfig_set (const char *name, const char *value); 272 extern int acosNvramConfig_unset (const char *name); 273 extern int acosNvramConfig_match (char *name, char *match); 274 extern int acosNvramConfig_invmatch (char *name, char *invmatch); 275 276 extern int acosNvramConfig_read (IN char *pcTagName, OUT char *pcValue, 277 IN int iMaxBufSize); 278 extern int acosNvramConfig_readAsInt (IN char *pcTagName, 279 OUT int *pcValue, 280 IN int iMaxBufSize); 281 extern int acosNvramConfig_readFile (IN char *pcTagName, 282 OUT char *pcValue, 283 IN int iMaxBufSize); 284 extern int acosNvramConfig_readDefault (IN char *pcTagName, 285 OUT char *pcValue, 286 IN int iMaxBufSize); 287 extern int acosNvramConfig_write (IN char *pcTagName, IN char *pcValue, 288 IN BOOL blSaveImmediately); 289 extern int acosNvramConfig_writeAsInt (IN char *pcTagName, IN int iValue, 290 IN BOOL blSaveImmediately); 291 extern int acosNvramConfig_save (void); 292 293 /* used for config backup and restore */ 294 extern int acosNvramConfig_readflash (char *buf); 295 extern int acosNvramConfig_writeflash (char *buf, int size); 296 297/******************The naming rule of config tag name ************************* 298*** 1. <module name or grpou name>_<config name> 299*** e.g. "system_lan_ipaddr" 300*** e.g. "system_wan_ipaddr" 301*** e.g. "dhcpserver_lease_time" 302*** e.g. "dhcpserver_reservedip" 303*** The config items those are not belong to any module please classify them to "system". 304*** 2. The length of TAG name and VALUE name can not exceed 32 and 512 characters 305*** 3. The written config data are saved to separated config files 306*** e.g. % system.cfg 307*** system_lan_ipaddr=192.168.1.1 255.255.255.0 308*** system_web_loginname=admin 309*** system_web_password=password 310*** ... 311*** e.g. % dhcpserver.cfg 312*** dhcpserver_leasetime=86400 313*** dhcpserver_reservedip_1=00:11:22:33:44:55 192.168.1.10 314*** dhcpserver_reservedip_2=00:11:22:33:44:66 192.168.1.11 315*******************************************************************************/ 316 extern int acosNvramConfig_readHuge (char *pTagName, char *pBuf, 317 int *piBufLen); 318 extern int acosNvramConfig_writeHuge (char *pTagName, char *pBuf, 319 int iBufLen); 320 extern int acosNvramConfig_updateProfile (char *pBuf); 321 extern int acosNvramConfig_loadFactoryDefault (char *pFileName); 322 extern int acosNvramConfig_cmiGetVersion (char *pstrVersion, 323 int iBufSize); 324 extern int acosNvramConfig_loadTagDefault (IN char *pTagName, 325 OUT char *pTagValue, 326 IN int iMaxBufSize); 327 extern int acosNvramConfig_readEncryption (IN char *pTagName, 328 OUT char *pValue, 329 IN int iMaxValBufSize); 330 extern int acosNvramConfig_writeEncryption (IN char *pTagName, 331 IN const char *pValue, 332 IN BOOL blSaveImmediately); 333#ifndef foreach 334 335/* Copy each token in wordlist delimited by space into word */ 336#define foreach(word, wordlist, next) \ 337 for (next = &wordlist[strspn(wordlist, " ")], \ 338 strncpy(word, next, sizeof(word)), \ 339 word[strcspn(word, " ")] = '\0', \ 340 word[sizeof(word) - 1] = '\0', \ 341 next = strchr(next, ' '); \ 342 strlen(word); \ 343 next = next ? &next[strspn(next, " ")] : "", \ 344 strncpy(word, next, sizeof(word)), \ 345 word[strcspn(word, " ")] = '\0', \ 346 word[sizeof(word) - 1] = '\0', \ 347 next = strchr(next, ' ')) 348 349#endif 350#ifdef __cplusplus 351} 352#endif 353 354extern int WAN_ith_CONFIG_SET_AS_STR(int wanIdx, char *name, char *value); 355 356#endif /* _ACOSNVRAMCONFIG_H */ 357