# BRCM_VERSION=3
[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 #if SUPPORT_ETHWAN
55 #define PROTO_IPOWAN                    6
56 #endif
57 #define PROTO_NONE                      10
58
59 #define SYSTEM_APPID       "SystemInfo"
60 #define SYS_USER_NAME_ID   1
61 #define SYS_PASSWORD_ID    2
62 #define SPT_USER_NAME_ID   3
63 #define SPT_PASSWORD_ID    4
64 #define USR_USER_NAME_ID   5
65 #define USR_PASSWORD_ID    6
66 #define SYS_DFT_GTWY_ID    7
67 #define SYS_DNS_ID         8
68 #define SYS_LOG_ID         9
69 #define SYS_AUTH_TIME_ID   10
70 #define SYS_SNMP_ID        11
71 #define SYS_FLAG_ID        12
72 #define SYS_ACTIVE_SERVICE_ID 13
73
74 // Values that are used in syscall.c
75 #define SYS_CMD_LEN        256
76
77 #define IP_TBL_COL_NUM     0
78 #define IP_TBL_COL_PKTS    1
79 #define IP_TBL_COL_BYTES   2
80 #define IP_TBL_COL_TARGET  3
81 #define IP_TBL_COL_PROT    4
82 #define IP_TBL_COL_OPT     5
83 #define IP_TBL_COL_IN      6
84 #define IP_TBL_COL_OUT     7
85 #define IP_TBL_COL_SRC     8
86 #define IP_TBL_COL_DST     9
87 #define IP_TBL_COL_MAX     10
88
89 #define UPNP_IP_ADDRESS    "239.255.255.250"
90
91
92 #if defined(__cplusplus)
93 extern "C" {
94 #endif
95 #define bcmSystem(cmd)          bcmSystemEx (cmd,1)
96 #define bcmSystemMute(cmd)      bcmSystemEx (cmd,0)
97 int tcmSystem(char *command);
98 int bcmSystemEx (char *command, int printFlag);
99 /*****Added by echo ****************************/
100 int tcmSystem (char *command);
101 int bcmSystemNoHang (char *command);
102 int bcmGetPid (char *command);
103 int bcmCreateDhcpCfg(char *ipAddr, char *mask, char *addrStart, char *addrEnd,
104                      char *dns1, char *dns2, int leasedTime, int protocol,
105                      int enblNat, int enblFirewall);
106 int bcmCreateIpExtDhcpCfg(char *lanAddr, char *mask, char *wanAddr);
107 int bcmCreateLocalDhcpCfg(char *addr, char *mask);
108 int bcmCreateResolvCfg(char *dns1, char *dns2);
109 int bcmCreateLoginCfg(char *cp_admin, char *cp_support, char *cp_user);
110 int bcmGetAdslStatus(void);
111 int bcmGetPppStatus(char *str, int len, char *devName);
112 int bcmGetDhcpcStatus(char *str, int len);
113 int bcmGetSystemStatus(char *str, int len);
114 int bcmSetSystemStatus(int status);
115 int bcmSetIpExtension(int ipExt);
116 int bcmGetIpExtension(char *str, int len);
117 void bcmDisplayLed(int status);
118 void bcmGetDns(char *dns);
119 void bcmGetDns2(char *dns);
120 void bcmGetDnsSettings(int *mode, char *primary, char *secondary);
121 void bcmRestartDnsProbe(void);
122 void bcmConfigDns(char *dns1, char *dns2, int dynamic);
123 void bcmRemoveDefaultGatewayByWanIf(char *wanIf);
124 void bcmGetDefaultGateway(char *gtwy, char *wanIf);
125 int  bcmIsDefaultGatewayExisted(char *gw, char *wanIf);
126 void bcmSetAutoDefaultGateway(char *errMsg);
127 void bcmSetStaticDefaultGateway(char *gw, char *wanIf, char *errMsg);
128 void bcmKillAllApps(void);
129 void disconnectPPP(void);
130 void setWanLinkStatus(int up);
131 int bcmCheckInterfaceUp(char *devname);
132 int bcmSetIpExtInfo(char *wan, char *gateway, char *dns);
133 void bcmGetIpExtInfo(char *buf, int type);
134 int bcmGetIfcIndexByName(char *ifcName);
135 char *bcmGetIfcNameByIndex(int ifcIdx, char *ifcName);
136 int bcmIsValidIfcName(char *ifcName);
137 char *bcmGetIfcNameById(int ifcId, char *ifcName);
138 void getPppoeServiceName(char *service, char *ifName);
139 void bcmGetDefaultRouteInterfaceName(char *ifcName);
140
141 void bcmSetConnTrackMax(void);
142 void bcmResetConnTrackTable(void);
143 void bcmHandleConnTrack(void);
144 void bcmInsertModules(char *path);
145 void bcmInsertModule(char *modName);
146 int bcmIsModuleInserted(char *modName);
147 int bcmRemoveIpTableRule(char *device, char *table, char *chain);
148 void bcmRemoveAllIpTableRules(char *device);
149 int bcmRemoveRipIpTableRule(void);
150 int bcmRemoveUpnpIpTableRule(void);
151 void bcmInsertAllUpnpIpTableRules(void);
152 int bcmGetIntfNameSocket(int socketfd, char *intfname);
153 int bcmCheckEnable(char *appName, struct in_addr clntAddr);
154
155 int bcmRemoveEbTableRule(char *device, char *table, char *chain);
156 void bcmRemoveAllEbTableRules(char *device);
157
158 void parseStrInfo(char *info, char *var, char *val, int len);
159 void bcmConvertStrToShellStr(char *str, char *buf);
160 void bcmProcessMarkStrChars(char *str);
161 int  bcmIsMarkStrChar(char c);
162 void bcmSetSwVer(char *swVer);
163 void bcmGetSwVer(char *swVer, int size);
164 void bcmSetAdslPhyVer(char *adslPhyVer) ; //add by Ali
165 void bcmSetImageDate(char *imageDate);  //add by Ali
166 void bcmGetImageDate(char *imageVer, int size)  ;       //add by Ali
167 void bcmGetAdslPhyVer(char *hwVer, int size) ;  //add by Ali
168 int isAccessFromLan(struct in_addr clntAddr);
169 int checkChipId(char *strTagChipId, char *sig2);
170 int TecomGetSystemStatus(char *str, int len, int activeServiceID) ;
171
172 void bcmRemoveModules(int lanIf);
173 int bcmWaitIntfExists(char *ifName);
174 int base64Encode(const void *inp, int insize, char **outptr);
175 void base64Decode(unsigned char *dest, char *src, int *rawLength);
176 // Keven Kuo
177 int SHA1Encription( char *input, char *output );
178 void Tcm_Remove_Passwords(char *input);
179 void Tcm_Add_Passwords(char *source_buffer);
180 void Tcm_Set_Passwords(char *input);
181
182 #define BCM_PPPOE_CLIENT_STATE_PADO          0   /* waiting for PADO */
183 #define BCM_PPPOE_CLIENT_STATE_PADS          1   /* got PADO, waiting for PADS */
184 #define BCM_PPPOE_CLIENT_STATE_CONFIRMED     2   /* got PADS, session ID confirmed */
185 #define BCM_PPPOE_CLIENT_STATE_DOWN          3   /* totally down */
186 #define BCM_PPPOE_CLIENT_STATE_UP            4   /* totally up */
187 #define BCM_PPPOE_SERVICE_AVAILABLE          5   /* ppp service is available on the remote */
188
189 #define BCM_PPPOE_AUTH_FAILED                7
190
191 #define BCM_PRIMARY_DNS                      1
192 #define BCM_SECONDARY_DNS                    0
193
194 #if defined(__cplusplus)
195 }
196 #endif
197
198 #endif