1 /***********************************************************************
3 * Copyright (c) 2006-2007 Broadcom Corporation
6 * <:label-BRCM:2011:DUAL/GPL:standard
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License, version 2, as published by
10 * the Free Software Foundation (the "GPL").
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
18 * A copy of the GPL is available at http://www.broadcom.com/licenses/GPLv2.php, or by
19 * writing to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 * Boston, MA 02111-1307, USA.
24 ************************************************************************/
30 * \brief Header file containing common and constant definitions for
31 * the CPE Management System (CMS). Parameters which may change
32 * depending on vendor preference or board configuration are located
33 * in cms_params.h (which is included by this file at the bottom.)
37 #include "cms_version.h"
42 * \brief Return codes for all external functions, and some internal functions too.
44 * Codes from 9000-9799 are reserved for TR69C return values.
45 * All Broadcom return codes should start at 9800.
49 CMSRET_SUCCESS = 0, /**<Success. */
50 CMSRET_METHOD_NOT_SUPPORTED = 9000, /**<Method not supported. */
51 CMSRET_REQUEST_DENIED = 9001, /**< Request denied (no reason specified). */
52 CMSRET_INTERNAL_ERROR = 9002, /**< Internal error. */
53 CMSRET_INVALID_ARGUMENTS = 9003, /**< Invalid arguments. */
54 CMSRET_RESOURCE_EXCEEDED = 9004, /**< Resource exceeded.
55 * (when used in association with
56 * setParameterValues, this MUST not be
57 * used to indicate parameters in error)
59 CMSRET_INVALID_PARAM_NAME = 9005, /**< Invalid parameter name.
60 * (associated with set/getParameterValues,
61 * getParameterNames,set/getParameterAtrributes)
63 CMSRET_INVALID_PARAM_TYPE = 9006, /**< Invalid parameter type.
64 * (associated with set/getParameterValues)
66 CMSRET_INVALID_PARAM_VALUE = 9007, /**< Invalid parameter value.
67 * (associated with set/getParameterValues)
69 CMSRET_SET_NON_WRITABLE_PARAM = 9008,/**< Attempt to set a non-writable parameter.
70 * (associated with setParameterValues)
72 CMSRET_NOTIFICATION_REQ_REJECTED = 9009, /**< Notification request rejected.
73 * (associated with setParameterAttributes)
75 CMSRET_DOWNLOAD_FAILURE = 9010, /**< Download failure.
76 * (associated with download or transferComplete)
78 CMSRET_UPLOAD_FAILURE = 9011, /**< Upload failure.
79 * (associated with upload or transferComplete)
81 CMSRET_FILE_TRANSFER_AUTH_FAILURE = 9012, /**< File transfer server authentication
83 * (associated with upload, download
84 * or transferComplete)
86 CMSRET_UNSUPPORTED_FILE_TRANSFER_PROTOCOL = 9013,/**< Unsupported protocol for file
88 * (associated with upload or
91 CMSRET_FILE_TRANSFER_UNABLE_JOIN_MULTICAST = 9014,/**< File transfer failure,
92 * unable to join multicast
95 CMSRET_FILE_TRANSFER_UNABLE_CONTACT_FILE_SERVER = 9015,/**< File transfer failure,
96 * unable to contact file server.
98 CMSRET_FILE_TRANSFER_UNABLE_ACCESS_FILE = 9016,/**< File transfer failure,
99 * unable to access file.
101 CMSRET_FILE_TRANSFER_UNABLE_COMPLETE = 9017,/**< File transfer failure,
102 * unable to complete download.
104 CMSRET_FILE_TRANSFER_FILE_CORRUPTED = 9018,/**< File transfer failure,
107 CMSRET_FILE_TRANSFER_FILE_AUTHENTICATION_ERROR = 9019,/**< File transfer failure,
108 * file authentication error.
110 CMSRET_FILE_TRANSFER_FILE_TIMEOUT = 9020,/**< File transfer failure,
113 CMSRET_FILE_TRANSFER_FILE_CANCELLATION_NOT_ALLOW = 9021,/**< File transfer failure,
114 * cancellation not permitted.
116 CMSRET_INVALID_UUID_FORMAT = 9022,/**< Invalid UUID Format
117 * (associated with ChangeDUState)
119 CMSRET_UNKNOWN_EE = 9023,/**< Unknown Execution Environment
120 * (associated with ChangeDUState)
123 CMSRET_EE_DISABLED = 9024,/**< Execution Environment disabled
124 * (associated with ChangeDUState)
126 CMSRET_DU_EE_MISMATCH = 9025,/**< Execution Environment and Deployment Unit mismatch
127 * (associated with ChangeDUState:install/update)
129 CMSRET_DU_DUPLICATE = 9026,/**< Duplicate Deployment Unit
130 * (associated with ChangeDUState:install/update)
132 CMSRET_SW_MODULE_SYSTEM_RESOURCE_EXCEEDED = 9027,/**< System resources exceeded
133 * (associated with ChangeDUState:install/update)
135 CMSRET_DU_UNKNOWN = 9028,/**< Unknown Deployment Unit
136 * (associated with ChangeDUState:update/uninstall)
138 CMSRET_DU_STATE_INVALID = 9029,/**< Invalid Deployment Unit State
139 * (associated with ChangeDUState:update)
141 CMSRET_DU_UPDATE_DOWNGRADE_NOT_ALLOWED = 9030,/**< Invalid Deployment Unit Update, downgrade not permitted
142 * (associated with ChangeDUState:update)
144 CMSRET_DU_UPDATE_VERSION_NOT_SPECIFIED = 9031,/**< Invalid Deployment Unit Update, version not specified
145 * (associated with ChangeDUState:update)
148 CMSRET_DU_UPDATE_VERSION_EXISTED= 9032,/**< Invalid Deployment Unit Update, version already exists
149 * (associated with ChangeDUState:update)
151 #if 1 // __MSTC__, Nick Tseng, Login Privilege
152 CMSRET_FAIL_USER_NAME_FORMAT = 9101,/**<User name format error. */
153 CMSRET_FAIL_USER_NAME_LENGTH = 9102,/**<User name length error. */
154 CMSRET_FAIL_USER_NAME_DUPLICATE = 9103,/**<User name duplicate. */
155 CMSRET_FAIL_PASSWORD_FORMAT = 9104,/**<Password format error. */
156 CMSRET_FAIL_PASSWORD_LENGTH = 9105,/**<Password length error. */
157 CMSRET_FAIL_PASSWORD_DUPLICATE = 9106,/**<Password duplicate with 3 previous passowrd. */
159 #if 1 //__MSTC__, Richard Huang,
160 CMSRET_FAIL_RULE_NAME_DUPLICATE = 9107, /**<Rule name duplicate. */
161 CMSRET_FAIL_RULE_IS_USED = 9108, /**<Rule is used. */
162 CMSRET_SKIP_CURR_ACTION = 9813,
164 CMSRET_SUCCESS_REBOOT_REQUIRED = 9800, /**< Config successful, but requires reboot to take effect. */
165 CMSRET_SUCCESS_UNRECOGNIZED_DATA_IGNORED = 9801, /**<Success, but some unrecognized data was ignored. */
166 CMSRET_SUCCESS_OBJECT_UNCHANGED = 9802, /**<Success, furthermore object has not changed, returned by STL handler functions. */
167 CMSRET_FAIL_REBOOT_REQUIRED = 9803, /**<Config failed, and now system is in a bad state requiring reboot. */
168 CMSRET_NO_MORE_INSTANCES = 9804, /**<getnext operation cannot find any more instances to return. */
169 CMSRET_MDM_TREE_ERROR = 9805, /**<Error during MDM tree traversal */
170 CMSRET_WOULD_DEADLOCK = 9806, /**< Caller is requesting a lock while holding the same lock or a different one. */
171 CMSRET_LOCK_REQUIRED = 9807, /**< The MDM lock is required for this operation. */
172 CMSRET_OP_INTR = 9808, /**<Operation was interrupted, most likely by a Linux signal. */
173 CMSRET_TIMED_OUT = 9809, /**<Operation timed out. */
174 CMSRET_DISCONNECTED = 9810, /**< Communications link is disconnected. */
175 CMSRET_MSG_BOUNCED = 9811, /**< Msg was sent to a process not running, and the
176 * bounceIfNotRunning flag was set on the header. */
177 CMSRET_OP_ABORTED_BY_USER = 9812, /**< Operation was aborted/discontinued by the user */
178 CMSRET_RECURSION_ERROR = 9817, /**< too many levels of recursion */
179 CMSRET_OPEN_FILE_ERROR = 9818, /**< open file error */
180 CMSRET_EAGAIN_ERROR = 9820, /**< socket write EAGAIN error */
181 CMSRET_SOCKET_ERROR = 9821, /**< socket error */
182 CMSRET_KEY_GENERATION_ERROR = 9830, /** certificate key generation error */
183 CMSRET_INVALID_CERT_REQ = 9831, /** requested certificate does not match with issued certificate */
184 CMSRET_INVALID_CERT_SUBJECT = 9832, /** certificate has invalid subject information */
185 CMSRET_OBJECT_NOT_FOUND = 9840, /** failed to find object */
187 CMSRET_INVALID_FILENAME = 9850, /**< filename was not given for download */
188 CMSRET_INVALID_IMAGE = 9851, /**< bad image was given for download */
189 CMSRET_INVALID_CONFIG_FILE = 9852, /**< invalid config file was detected */
190 CMSRET_CONFIG_PSI = 9853, /**< old PSI/3.x config file was detected */
191 CMSRET_IMAGE_FLASH_FAILED = 9854, /**< could not write the image to flash */
192 CMSRET_RESOURCE_NOT_CONFIGURED = 9855, /**< requested resource is not configured/found */
193 #if 1 //__MSTC__, TengChang, for firmwareUpgrade.html
194 CMSRET_INVALID_MODELID = 9856,
195 CMSRET_INVALID_BOOTROMSIZE = 9857,
196 #endif //__MSTC__, TengChang, for firmwareUpgrade.html
200 #if 1 //__MSTC__, Amy
213 LSRET_ID_LENGTH = 11,
214 LSRET_ID_FORMAT = 12,
219 /** Check if the CmsRet code is either SUCCESS or SUCCESS_REBOOT_REQUIRED.
220 * CMSRET_SUCCESS_REBOOT is returned in two scenarios:
221 * 1. During a set, the RCL handler function has accepted the new value but
222 * is unable to change the system configuration at run-time, so a reboot
223 * is needed before the change can take effect.
224 * 2. During a AddObject or DeleteObject. The MDM object tree has been
225 * successfully updated, but the RCL handler function is unable to change
226 * the system configuration at run-time, so a reboot is needed before the
227 * change can take effect.
228 * Be very careful if you add any other return codes to this macro.
229 * Make sure you understand what you are doing. Specifically,
230 * do not add CMSRET_SUCCESS_UNRECOGNIZED_DATA_IGNORED or
231 * CMSRET_SUCCESS_OBJECT_UNCHANGED to this macro. These return codes are
232 * used in different contexts.
234 #define IS_CMSRET_A_SUCCESS_VARIANT(r) (((r) == CMSRET_SUCCESS) || \
235 ((r) == CMSRET_SUCCESS_REBOOT_REQUIRED))
237 /** Check if the CmsRet code is a TR69c recognized value.
239 #define IS_CMSRET_A_TR69C_VARIANT(r) (((r) == CMSRET_SUCCESS) || \
240 (((r) >= 9000) && ((r) < 9800)))
256 /** Maximum value for a UINT64 */
257 #define MAX_UINT64 18446744073709551615ULL
259 /** Maximum value for a SINT64 */
260 #define MAX_SINT64 9223372036854775807LL
262 /** Minimum value for a SINT64 */
263 #define MIN_SINT64 (-1 * MAX_SINT64 - 1)
265 /** Maximum value for a UINT32 */
266 #define MAX_UINT32 4294967295U
268 /** Maximum value for a SINT32 */
269 #define MAX_SINT32 2147483647
271 /** Minimum value for a SINT32 */
272 #define MIN_SINT32 (-2147483648)
274 /** Maximum value for a UINT16 */
275 #define MAX_UINT16 65535
277 /** Maximum value for a SINT16 */
278 #define MAX_SINT16 32767
280 /** Minimum value for a SINT16 */
281 #define MIN_SINT16 (-32768)
285 * This is common used string length types.
287 #define BUFLEN_4 4 //!< buffer length 4
288 #define BUFLEN_8 8 //!< buffer length 8
289 #define BUFLEN_16 16 //!< buffer length 16
290 #define BUFLEN_18 18 //!< buffer length 18 -- for ppp session id
291 #define BUFLEN_24 24 //!< buffer length 24 -- mostly for password
292 #define BUFLEN_32 32 //!< buffer length 32
293 #define BUFLEN_40 40 //!< buffer length 40
294 #define BUFLEN_48 48 //!< buffer length 48
295 #define BUFLEN_64 64 //!< buffer length 64
296 #define BUFLEN_80 80 //!< buffer length 80
297 #define BUFLEN_128 128 //!< buffer length 128
298 #define BUFLEN_256 256 //!< buffer length 256
299 #define BUFLEN_264 264 //!< buffer length 264
300 #define BUFLEN_512 512 //!< buffer length 512
301 #define BUFLEN_1024 1024 //!< buffer length 1024
302 #define BUFLEN_4096 4096 //!< buffer length 4096
304 #if 1 //__MSTC__, Dennis, 3 group privilege size
305 #define PRIVILEGE_BUFLEN (512 * 3)
308 #define IIDSTACK_BUF_LEN 40 //!< good length to use for mdm_dumpIidStack
309 #define MAC_ADDR_LEN 6 //!< Mac address len in an array of 6 bytes
310 #define MAC_STR_LEN 17 //!< Mac String len with ":". eg: xx:xx:xx:xx:xx:xx
311 #define VPI_MIN 0 //!< VPI min
312 #define VPI_MAX 255 //!< VPI max
313 #define VCI_MIN 32 //!< VCI min
314 #define VCI_MAX 65535 //!< VCI max
316 #define PPP_CONNECT_ERROR_REASON_LEN 48
318 #define CMS_IFNAME_LENGTH BUFLEN_32 //!< broadcom interface name length
319 #define CMS_MAX_ACS_URL_LENGTH 260 //!< max acs url from dhcp server, specified in TR-181 as max length 256
320 #define CMS_MAX_ACS_PROVISIONING_CODE_LENGTH 68 //!< max acs provisioning code, TR-181 max length is 64
322 #define CMS_AFTR_NAME_LENGTH 256 //!< max aftr name from dhcpv6 server
324 #ifdef DMP_X_5067F0_IPV6_1 /* aka SUPPORT_IPV6 */
325 #define CMS_IPADDR_LENGTH 46 //!< IP address length to hold IPv6 in CIDR notation (match INET6_ADDRSTRLEN)
327 #define CMS_IPADDR_LENGTH BUFLEN_16 //!< IP address length to hold IPv4 in ASCII
328 #endif /* DMP_X_5067F0_IPV6_1 */
330 #define CMS_MAX_DEFAULT_GATEWAY 8 //!< max default gateways allowed in L3 X_5067F0_DefaultConnectionServices
331 #define CMS_MAX_DNSIFNAME 8 //!< max dns wan interface names in X_BROADCOM_Networking.DNSIfName
332 #define CMS_MAX_ACTIVE_DNS_IP 4 //!< max active dns ip (in resolv.conf)
334 #ifdef DMP_X_5067F0_GPONRG_OMCI_LIGHT_1
335 #define CMS_MAX_GPONWAN_INTF 4 //!< max gpon wan layer 2 interfaces for light omci GponRg
337 #ifdef DMP_X_5067F0_GPONRG_OMCI_FULL_1
338 #define CMS_MAX_GPONWAN_INTF 1 //!< max gpon wan layer 2 interfaces for full omci GponRg
340 #define CMS_MAX_GPONWAN_INTF 0 //!< No gpon at all, so no GPONWAN intf
345 * Values for network protocol
347 #define PROTO_PPPOE 0 //!< PPPoE protocol
348 #define PROTO_PPPOA 1 //!< PPPoA protocol
349 #define PROTO_MER 2 //!< MER protocol
350 #define PROTO_BRIDGE 3 //!< bridge protocol
351 #define PROTO_PPPOE_RELA 4 //!< PPPoE relay protocol
352 #define PROTO_IPOA 5 //!< ip over atm protocol
353 #define PROTO_IPOWAN 6 //!< ip over wan protocol
354 #define PROTO_NONE 10 //!< invalid protocol
356 #define IFC_WAN_MAX 16 //!< Max WAN Connection in the system.
357 #define IFC_VLAN_MAX 8 //!< Max VLAN on single PVC
358 #define ATM_QUEUE_MAX 8 //!< Max ATM queues
361 * \brief Enumerated values of WAN interface types.
364 WAN_IFC_ATM=0, /**< ATM */
365 WAN_IFC_PPPOA=1, /**< PPPoA */
366 WAN_IFC_IPOA=2, /**< IPoA */
367 WAN_IFC_ETH=3, /**< Eth */
368 WAN_IFC_PTM=4, /**< Ptm */
369 WAN_IFC_NONE=10 /**< undefined/invalid */
372 #ifdef NOT_USED_AND_USE_CMSWANCONNECTIONTYPE_BELOW
373 /******************* NOTE: DO NOT USE WanProtocal. USE CmsWanConnetctionType Below !!!!! ***********
375 * \brief Enumerated values of WAN connection protocols.
376 * This should be used to replace the same set of defines in cms.h
379 WAN_PROTO_PPPOE=0, /**< PPPoE */
380 WAN_PROTO_PPPOA=1, /** < PPPoA */
381 WAN_PROTO_MER=2, /**< static or dynamic mer */
382 WAN_PROTO_BRIDGE=3, /**< bridge */
383 WAN_PROTO_PPPOE_RELAY=4, /**< pppoe relay */
384 WAN_PROTO_IPOA=5, /**< IPoA */
385 WAN_PROTO_IPOWAN=6, /**< IP over Wan only when SUPPORT ETHWAN */
386 WAN_PROTO_NONE=10 /**< no proto found/defined/invalid */
390 /* try to match with the above old defines PROTO_PPPOE=0 PPPOA=1, MER=2, BRIDGE=3 thing
391 * so that no html changes need */
395 CMS_WAN_TYPE_PPPOE = 0,
396 CMS_WAN_TYPE_PPPOA = 1,
397 CMS_WAN_TYPE_DYNAMIC_IPOE = 2,
398 CMS_WAN_TYPE_BRIDGE = 3,
399 CMS_WAN_TYPE_PPPOE_RELAY = 4,
400 CMS_WAN_TYPE_IPOA = 5,
401 CMS_WAN_TYPE_STATIC_IPOE = 6,
403 CMS_WAN_TYPE_STATIC_ETHERNET_IP = 10,
404 CMS_WAN_TYPE_DYNAMIC_ETHERNET_IP = 11,
405 CMS_WAN_TYPE_ETHERNET_PPPOE = 12,
406 CMS_WAN_TYPE_ETHERNET_BRIDGE = 13,
407 CMS_WAN_TYPE_UNDEFINED = 99
408 } CmsWanConnectionType;
412 #define BRIDGE_PROTO_STR "Bridge"
413 #define IPOA_PROTO_STR "IPoA"
414 #define IPOE_PROTO_STR "IPoE"
415 #define PPPOE_PROTO_STR "PPPoE"
416 #define PPPOA_PROTO_STR "PPPoA"
417 #define IPOW_PROTO_STR "IPoW"
418 #ifdef DMP_X_5067F0_MSTC_WWAN_1 // __MSTC__, Richard Huang,
419 #define PPP_PROTO_STR "PPP"
422 #define ETH_IFC_STR "eth"
423 #define USB_IFC_STR "usb"
424 #define WLAN_IFC_STR "wl"
425 #define MOCA_IFC_STR "moca"
426 #define GPON_IFC_STR "veip"
427 #define EPON_IFC_STR "epon"
428 #define ATM_IFC_STR "atm"
429 #define PTM_IFC_STR "ptm"
430 #define BRIDGE_IFC_STR "br"
431 #define IPOA_IFC_STR "ipoa"
432 #define IPOE_IFC_STR "ipoe"
433 #define PPP_IFC_STR "ppp"
434 #define PPPOE_IFC_STR "pppoe"
435 #define PPPOA_IFC_STR "pppoa"
436 #define IPA_IFC_STR "ipa"
437 #define BRIDGE_SMUX_STR "bridge"
438 #ifdef DMP_X_5067F0_MSTC_WWAN_1 // __MSTC__, Richard Huang, For Telefonica 3G WAN backup, __TELEFONICA__, MitraStar Chehuai, 20110617 */
439 #define PPPO3G_IFC_STR "pppo3G"
442 /* for interface group with routed pvc */
443 #define RT_TABLES_BASE 200
447 ATM=0, /**< WanDev is used for DSL ATM */
448 PTM=1, /**< WanDev is used for DSL PTM */
449 Ethernet=2 /**< WanDev is used for Ethernet */
455 CMS_CONNECTION_MODE_DEFAULT=0, /**< Default connection mdoe - single wan service over 1 connection */
456 CMS_CONNECTION_MODE_VLANMUX=1, /**< Vlan mux connection mdoe - multiple vlan service over 1 connection */
457 CMS_CONNECTION_MODE_MSC=2, /**< MSC connection mdoe - multiple wan service over 1 connection */
458 } ConnectionModeType;
463 ATM_EOA=0, /**< WanDev is used for DSL ATM */
464 ATM_IPOA=1, /**< WanDev is used for DSL ATM IPOA */
465 ATM_PPPOA=2, /**< WanDev is used for DSL ATM PPPoA */
466 PTM_EOA=3 /**< WanDev is used for DSL PTM */
473 ENBL_IPV4_ONLY=0, /**< Wan Connection is IPv4 only */
474 ENBL_IPV4_IPV6=1, /**< Wan Connection is dual stack */
475 ENBL_IPV6_ONLY=2 /**< Wan Connection is IPv6 only */
479 /* RAM size defines */
480 #define SZ_8MB 0x800000
481 #define SZ_16MB 0x1000000
484 #define CFG_FILTER_CMD_SIZE 256
486 #define MAX_PERSISTENT_WAN_PORT 39 /**< Max Ethernet ports can be configured as WAN ports */
487 #define MAX_GMAC_ETH_PORT 5 /**< Max GMAC Ethernet ports in the system */
489 #define DNSINFO_CONF "/var/dnsinfo.conf" /**< This file is created by cms when there is a WAN connection status change and is used
490 * by dnsproxy and can be used by other applications for the finding the WAN dns info.
491 * and has the following fields, WAN Interface; Subnet/Mask; dns1, dns2..; app1, app2.. :
492 * eg. atm1;172.0.0.1/32;10.7.2.8,20.1.2.5;tr69c -- WAN service for TR69
493 * 1). WAN interface name. eg. ppp0, atm0, etc.
494 * 2) subnet/mask in cidr format (bind to this WAN)
495 * 3) dns list for this WAN
496 * 4) process name list uses this WAN
499 /* include cms_params.h after we have defined all other constants. */
500 #include "cms_params.h"
507 OMCI_FLOW_DOWNSTREAM,
514 LOGIN_INVALID=0, /**< This is for httpd login */
515 LOGIN_USER=1, /**< user login */
516 LOGIN_SUPPORT=2, /**< support login */
517 LOGIN_ADMIN=10, /**< admin login */
520 #if 1 //__MSTC__, DingRuei, Run time chage Web UI
521 /*Web UI Style Type*/
522 #define WEBUI_BRICK 1
524 #define WEBUI_BRICK_ODM 3
525 #define UNKNOWN_TYPE 1025
526 #endif //__MSTC__, DingRuei, Run time chage Web UI
528 #ifdef SUPPORT_MSTC_WEB_REDIRECT // __MSTC__, for web redirect
529 #define WAN_REDIRECT_STATUS_FILE "/var/redirect_status"
532 #endif /* __CMS_H__ */