www.usr.com/support/gpl/USR9107_release.1.4.tar.gz
[bcm963xx.git] / userapps / broadcom / cfm / inc / syscall.h
1 /*****************************************************************************
2 //
3 //  Copyright (c) 2000-2001  Broadcom Corporation
4 //  All Rights Reserved
5 //  No portions of this material may be reproduced in any form without the
6 //  written permission of:
7 //          Broadcom Corporation
8 //          16215 Alton Parkway
9 //          Irvine, California 92619
10 //  All information contained in this document is Broadcom Corporation
11 //  company private, proprietary, and trade secret.
12 //
13 ******************************************************************************
14 //
15 //  Filename:       syscall.h
16 //  Author:         Peter T. Tran
17 //  Creation Date:  12/26/01
18 //
19 ******************************************************************************
20 //  Description:
21 //      Define the global constants, and functions for sysCall utility.
22 //
23 *****************************************************************************/
24
25 #ifndef __SYS_CALL_H__
26 #define __SYS_CALL_H__
27 #include <netinet/in.h>
28
29 /********************** Global Functions ************************************/
30
31 #define FILE_OPEN_OK                    0
32 #define FILE_OPEN_ERR                   -1
33
34 #define MNTR_STS_OK                     0
35 #define MNTR_STS_ADSL_DOWN              1
36 #define MNTR_STS_PPP_AUTH_ERR           2
37 #define MNTR_STS_PPP_DOWN               3
38 #define MNTR_STS_OPEN_ERR               4
39 #define MNTR_STS_DHCPC_PROGRESS         5
40 #define MNTR_STS_DHCPC_FAIL             6
41 #define MNTR_STS_ADSL_TRAINING          7
42
43 #define DHCPC_STS_FAIL                  0
44 #define DHCPC_STS_SUCCESS               1
45 #define DHCPC_FAIL_MAX                  15
46
47 // Values for network protocol
48 #define PROTO_PPPOE                     0
49 #define PROTO_PPPOA                     1
50 #define PROTO_MER                       2
51 #define PROTO_BRIDGE                    3
52 #define PROTO_PPPOE_RELAY               4
53 #define PROTO_IPOA                      5
54 #define PROTO_IPOWAN                    6
55 #define PROTO_NONE                      10
56
57 #define SYSTEM_APPID       "SystemInfo"
58 #define SYS_USER_NAME_ID   1
59 #define SYS_PASSWORD_ID    2
60 #define SPT_USER_NAME_ID   3
61 #define SPT_PASSWORD_ID    4
62 #define USR_USER_NAME_ID   5
63 #define USR_PASSWORD_ID    6
64 #define SYS_DFT_GTWY_ID    7
65 #define SYS_DNS_ID         8
66 #define SYS_LOG_ID         9
67 #define SYS_SNMP_ID        10
68 #define SYS_FLAG_ID        11
69 #define SYS_TR69C_ID      12
70
71 // Values that are used in syscall.c
72 #define SYS_CMD_LEN        256
73
74 #define IP_TBL_COL_NUM     0
75 #define IP_TBL_COL_PKTS    1
76 #define IP_TBL_COL_BYTES   2
77 #define IP_TBL_COL_TARGET  3
78 #define IP_TBL_COL_PROT    4
79 #define IP_TBL_COL_OPT     5
80 #define IP_TBL_COL_IN      6
81 #define IP_TBL_COL_OUT     7
82 #define IP_TBL_COL_SRC     8
83 #define IP_TBL_COL_DST     9
84 #define IP_TBL_COL_MAX     10
85
86 #define UPNP_IP_ADDRESS    "239.255.255.250"
87
88
89 #if defined(__cplusplus)
90 extern "C" {
91 #endif
92 #define bcmSystem(cmd)          bcmSystemEx (cmd,1)
93 #define bcmSystemMute(cmd)      bcmSystemEx (cmd,0)
94 int bcmSystemEx (char *command, int printFlag);
95 int bcmSystemNoHang (char *command);
96 int bcmGetPid (char *command);
97 int *bcmGetPidList(char * command);
98 int bcmCreateDhcpCfg(char *ipAddr, char *mask, char *addrStart, char *addrEnd,
99                      char *dns1, char *dns2, int leasedTime, int protocol,
100                      int enblNat, int enblFirewall);
101 int bcmCreateIpExtDhcpCfg(char *lanAddr, char *mask, char *wanAddr);
102 int bcmCreateLocalDhcpCfg(char *addr, char *mask);
103 int bcmCreateResolvCfg(char *dns1, char *dns2);
104 int bcmCreateLoginCfg(char *cp_admin, char *cp_support, char *cp_user);
105 int bcmGetAdslStatus(void);
106 int bcmGetPppStatus(char *str, int len, char *devName);
107 int bcmGetDhcpcStatus(char *str, int len);
108 int bcmGetSystemStatus(char *str, int len);
109 int bcmSetSystemStatus(int status);
110 int bcmSetIpExtension(int ipExt);
111 int bcmGetIpExtension(char *str, int len);
112 void bcmDisplayLed(int status);
113 void bcmGetDns(char *dns);
114 void bcmGetDns2(char *dns);
115 void bcmGetDnsSettings(int *mode, char *primary, char *secondary);
116 void bcmRestartDnsProbe(void);
117 void bcmConfigDns(char *dns1, char *dns2, int dynamic);
118 void bcmRemoveDefaultGatewayByWanIf(char *wanIf);
119 void bcmGetDefaultGateway(char *gtwy, char *wanIf);
120 int  bcmIsDefaultGatewayExisted(char *gw, char *wanIf);
121 void bcmSetAutoDefaultGateway(char *errMsg);
122 void bcmSetStaticDefaultGateway(char *gw, char *wanIf, char *errMsg);
123 void bcmKillAllApps(void);
124 void disconnectPPP(void);
125 void setWanLinkStatus(int up);
126 int bcmCheckInterfaceUp(char *devname);
127 int bcmSetIpExtInfo(char *wan, char *gateway, char *dns);
128 void bcmGetIpExtInfo(char *buf, int type);
129 int bcmGetIfcIndexByName(char *ifcName);
130 int bcmIsValidIfcName(char *ifcName);
131 char *bcmGetIfcNameById(int ifcId, char *ifcName);
132 char *bcmGetIfcNameByIpAddr(unsigned long ipAddr, char *ifcName);
133 void getPppoeServiceName(char *service, char *ifName);
134 void bcmGetDefaultRouteInterfaceName(char *ifcName);
135
136 void bcmSetConnTrackMax(void);
137 void bcmResetConnTrackTable(void);
138 void bcmHandleConnTrack(void);
139 void bcmInsertModules(char *path);
140 void bcmInsertModule(char *modName);
141 int bcmIsModuleInserted(char *modName);
142 int bcmRemoveIpTableRule(char *device, char *table, char *chain);
143 void bcmRemoveAllIpTableRules(char *device);
144 #if SUPPORT_TC
145 void bcmRemoveTrafficControlRules(unsigned short vpi, unsigned short vci,
146                                   unsigned short conId, unsigned char protocol);
147 void bcmAddTrafficControlRules(unsigned short vpi, unsigned short vci,
148                                unsigned short conId, unsigned char protocol);
149 #endif
150 int bcmRemoveRipIpTableRule(void);
151 int bcmRemoveUpnpIpTableRule(void);
152 void bcmInsertAllUpnpIpTableRules(void);
153 int bcmGetIntfNameSocket(int socketfd, char *intfname);
154 int bcmCheckEnable(char *appName, struct in_addr clntAddr);
155
156 int bcmRemoveEbTableRule(char *device, char *table, char *chain);
157 void bcmRemoveAllEbTableRules(char *device);
158
159 void parseStrInfo(char *info, char *var, char *val, int len);
160 void bcmConvertStrToShellStr(char *str, char *buf);
161 void bcmProcessMarkStrChars(char *str);
162 int  bcmIsMarkStrChar(char c);
163 void bcmGetSwVer(char *swVer, int size);
164 void bcmGetBuildVer(char *swVer, int size);     // USR9108
165 int isAccessFromLan(struct in_addr clntAddr);
166 int checkChipId(char *strTagChipId, char *sig2);
167 void bcmRemoveModules(int lanIf);
168 int bcmWaitIntfExists(char *ifName);
169
170 int bcmMacStrToNum(char *macAddr, char *str);
171 int bcmMacNumToStr(char *macAddr, char *str);
172
173 int bcmWanEnetQuerySwitch(char *ifName);
174
175 int bcmConfigPortMirroring (void *pMirrorCfg) ;
176
177 #define BCM_PPPOE_CLIENT_STATE_PADO          0   /* waiting for PADO */
178 #define BCM_PPPOE_CLIENT_STATE_PADS          1   /* got PADO, waiting for PADS */
179 #define BCM_PPPOE_CLIENT_STATE_CONFIRMED     2   /* got PADS, session ID confirmed */
180 #define BCM_PPPOE_CLIENT_STATE_DOWN          3   /* totally down */
181 #define BCM_PPPOE_CLIENT_STATE_UP            4   /* totally up */
182 #define BCM_PPPOE_SERVICE_AVAILABLE          5   /* ppp service is available on the remote */
183
184 #define BCM_PPPOE_AUTH_FAILED                7
185
186 #define BCM_PRIMARY_DNS                      1
187 #define BCM_SECONDARY_DNS                    0
188
189 #if defined(__cplusplus)
190 }
191 #endif
192
193 #endif