blob: c9988bd64428b3778c23ce4052a36f086ae841fc [file] [log] [blame]
rjw6c1fd8f2022-11-30 14:33:01 +08001/*************************************************************
2*
3* This Software is the property of VIA Telecom, Inc. and may only be used pursuant to a license from VIA Telecom, Inc.
4*
5* Any unauthorized use inconsistent with the terms of such license is strictly prohibited.
6*
7* Copyright (c) 2002-2010 VIA Telecom, Inc. All rights reserved.
8*
9*************************************************************/
10/*************************************************************************
11 *
12 * File Name: 7074stat.h
13 * Project: NSPE stack
14 *
15 * Original Author: Steve Pye
16 * Creation Date: July 13, 1998
17 *
18 * Description:
19 * Restrictions:
20 * Dependencies:
21 *
22 ************************************************************************/
23
24#ifndef _7074STAT_H_
25#define _7074STAT_H_ 1
26#include "kal_public_defs.h"
27#include "kal_public_api.h"
28
29#include "7074CUST.H"
30#include "PPPAPI.H"
31#include "PP_FRAME.H"
32#include "IP_CUSTM.H"
33#include "USER_API.H"
34#include "hlpapi.h"
35
36/* IS-707 Applications */
37#define IS707_APP_ASYNC_TCP 0
38#define IS707_APP_PACKET_RLP 1
39#define IS707_APP_BROWSER_UDP 2
40#define IS707_APP_PACKET_UART 3
41#define IS707_APP_BROWSER_ON_ASYNC 4
42#define IS707_APP_BROWSER_CKT_TCP 5
43#define IS707_APP_BROWSER_PKT_TCP 6
44#define IS707_APP_PPP_ONLY 7
45#define IS707_APP_ACS_STREAM 8
46#define IS707_APP_MAIN_CONN 9
47#define IS707_APP_NULL 10 /* Adding any new type should be before this */
48#define IS707_NUM_APPS 11
49
50/*add for Trace, keep in the same order as IS707_APP...#defines above*/
51typedef enum
52{
53 NSPE_ASYNC_TCP,
54 NSPE_PACKET_RLP,
55 NSPE_BROWSER_UDP,
56 NSPE_PACKET_UART,
57 NSPE_BROWSER_ON_ASYNC,
58 NSPE_BROWSER_CKT_TCP,
59 NSPE_BROWSER_PKT_TCP,
60 NSPE_PPP_ONLY,
61 NSPE_ACS_STREAM,
62 NSPE_MAIN_CONN,
63 NSPE_NULL,
64 NSPE_APP_MAX_NUM
65} NspeAppsT;
66
67/* IS-707 Task states */
68#define IS707_S_IDLE 0
69#define IS707_S_RLP_CONNECTING 1
70#define IS707_S_NET_CONNECTING 2
71#define IS707_S_TCP_CONNECTING 3
72#define IS707_S_PPP_CONNECTING 4
73#define IS707_S_LCP_CONNECTED 5
74#define IS707_S_PPP_CONNECTED 6
75#define IS707_S_NET_CONNECTED 7
76#define IS707_S_ABORTING 8
77#define IS707_S_CLOSING 9
78#define IS707_S_UM_RENEGOTIATION 10
79#define IS707_S_DEREGISTERING 11
80
81/*add for Trace, keep in the same order as IS707_S...#defines above*/
82typedef enum
83{
84 NSPE_IDLE,
85 NSPE_RLP_CONNECTING ,
86 NSPE_NET_CONNECTING,
87 NSPE_TCP_CONNECTING,
88 NSPE_PPP_CONNECTING,
89 NSPE_LCP_CONNECTED,
90 NSPE_PPP_CONNECTED,
91 NSPE_NET_CONNECTED,
92 NSPE_ABORTING,
93 NSPE_CLOSING,
94 NSPE_UM_RENEGO,
95 NSPE_DEREGISTERING,
96 NSPE_STATE_MAX_NUM
97} NspeStatesT;
98
99/* Mobile IP states */
100#define MIP_NULL_STATE 0
101#define MIP_INIT_STATE 1
102#define MIP_AGENT_DIS_STATE 2
103#define MIP_REGISTRATION_STATE 3
104#define MIP_ACTIVE_STATE 4
105#define MIP_TERMINATE_STATE 5
106
107/*add for Trace, keep in the same order as MIP_..._STATE#defines above*/
108typedef enum
109{
110 MIP_NULL_ST,
111 MIP_INIT_ST ,
112 MIP_AGENT_DIS_ST,
113 MIP_REGISTRATION_ST,
114 MIP_ACTIVE_ST,
115 MIP_TERMINATE_ST,
116 MIP_ST_MAX_NUM
117} MipStatesT;
118
119struct nspeBufferType
120{
121 kal_uint8 pppIpScratch[ PPP_BUFFERSIZE*2 ];
122 kal_uint8 mbufPool[ IS707_MBUF_POOL_SIZE ];
123};
124
125struct scb
126{
127 kal_uint8 SocketRxBuf[ IS707_APPINT_RX_BUFFERSIZE ];
128 kal_bool tcpPassive;
129 kal_bool tcpPeerClosing;
130 kal_bool tcpWereClosing;
131
132 kal_uint8 sap;
133 kal_uint8 ipProtocol;
134 kal_uint16 nDataToRead;
135 kal_bool bCloseWaitDefer;
136
137 /* Application Interface variables */
138 kal_bool appIntRecvReady;
139 kal_bool appIntSendPending;
140 kal_bool bDataPending;
141 SendRequest appIntSendRqst;
142 ReceiveRequest appIntRecvRqst;
143 SendToRequest appIntSendToRqst;
144 ReceiveFromRequest appIntRecvFromRqst;
145 /* variables for pending */
146 kal_bool bTCPOrUDPDataReqPending;
147 kal_bool bSocketConnectReqPending;
148 kal_bool bSocketCloseReqPending;
149 kal_bool bSocketShutdownReqPending;
150 HlpTcpbDataSendReqMsgT PendingTCPDataRqstToSend;
151 HlpUpbSendDataMsgT PendingUDPDataRqstToSend;
152 HlpSocketConnectMsgT PendingSktConnMsg;
153 HlpSocketCloseMsgT PendingSktCloseMsg;
154 HlpSocketShutDownMsgT PendingSktShutDownMsg;
155};
156
157struct nspeGlobalsType
158{
159 /* RLP variables */
160 kal_uint8 rlpApp;
161 kal_uint8 uartApp;
162 kal_uint8 rlpAppAccess;
163 kal_bool rlpFlushPending;
164 kal_bool rlpTransparent;
165
166 /* Packet variables */
167 kal_uint8 packetUdpSap;
168 kal_bool packetBrowserMode;
169
170 /* PPP variables */
171 kal_uint8 *pppRxData;
172 kal_uint16 pppRxDataSize;
173 kal_uint16 pppSendMTU;
174
175 /* PPP variables for RM interface to Uart */
176 kal_uint8 *pppUartRxData;
177 kal_uint16 pppUartRxDataSize;
178
179
180 /* TCP variables */
181 kal_bool tcpPassive;
182 kal_bool tcpPeerClosing;
183 kal_bool tcpWereClosing;
184
185 kal_bool tcpFlowOn;
186 kal_uint8 tcpSap;
187
188 /* Application Interface variables */
189 kal_bool appIntRxReady;
190 kal_bool appIntTxPending;
191 SendRequest appIntTxRqst;
192/* ReceiveRequest appIntRxRqst; */
193
194 /* Browser UDP variables */
195 kal_bool DoubleStackUpperLayerDown;
196 /* variable handle rlpresetInd */
197 kal_bool RlpReset; /* set after rlpReset, */
198 kal_bool RlpOpenRspRcvd; /* set after receive rlpOpenRsp which caused by rlpReset */
199 kal_bool Um_Rm_Connected; /*set after UM and RM interface are both connected */
200 kal_bool Um_DataPending; /* set to KAL_TRUE is there is data pending which is ready to be sent to Rm */
201 kal_bool Rm_DataPending; /* set to KAL_TRUE is there is data pending which is ready to be sent to Um */
202 kal_bool Um_Renegotiating;
203#ifdef TEST
204 /* these variablee can be removed */
205 kal_bool enableIpFlowControlIteMessages;
206 kal_bool enableTcpRxDataIteMessages;
207#endif
208};
209
210struct Pending_Data
211{
212 kal_bool canBeSent;
213 kal_bool dormant_flag; /* Remember the current Mode*/
214 kal_bool Data_Pending; /* Set the flag if we saved any data.*/
215 kal_bool Tx_Pending; /* pending flag cuased by UDP busy */
216 SendToRequest saved; /* save the data */
217};
218
219struct Um_Dormant
220{
221 kal_bool dataPending;
222 kal_bool dormant;
223};
224
225void nspeUmDormantReconnect(void);
226void UmProcessPendingData(void);
227
228struct Interface_Busy
229{
230 kal_bool rx_busy;
231 kal_bool tx_busy;
232};
233
234extern struct Interface_Busy um_rlp;
235extern struct Interface_Busy rm_uart;
236
237extern struct nspeGlobalsType nspe;
238extern struct nspeBufferType nspeBuffers;
239extern struct scb nspeSCB[IP_NTCBS];
240extern kal_uint8 pppAccStrmScratch[PPP_BUFFERSIZE*2];
241
242/* Prototypes */
243void Shut_TCP_Quietly( void );
244void nspeTxReq( void );
245void udpTxReq( void );
246void nspeSetState( kal_uint8 app, kal_uint8 state );
247kal_uint8 nspeGetState( kal_uint8 app );
248void nspeSetRlpAppAccess(kal_uint8 rlpAppAcs);
249kal_uint8 nspeGetRlpAppAccess(void);
250void nspeSetIpAddr( kal_uint8 app, kal_uint32 ip_address );
251kal_uint32 nspeGetIpAddr( kal_uint8 app );
252void nspeSetPppPort( kal_uint8 app, kal_uint16 ppp_port );
253kal_uint16 nspeGetPppPort( kal_uint8 app );
254void nspeSetPppSending( kal_uint8 app, kal_bool sending );
255kal_bool nspeGetPppSending( kal_uint8 app );
256kal_uint32 nspeGetApp( kal_uint16 ppp_port );
257void nspeInit( kal_uint8 app );
258void nspeInitApps(void);
259void nspeCleanPort( kal_uint8 app );
260void nspePassIpDataToPpp( kal_uint8 app );
261void nspePurgeIPDataQueue( kal_uint8 app );
262
263kal_uint8 nspeGetAppByPDNId(kal_uint8 PDNId);
264void nspeSetPdnId( kal_uint8 app, kal_uint8 PdnId );
265kal_uint8 nspeGetPdnId( kal_uint8 app);
266void nspeIpData2Ppp(kal_uint8 app);
267#ifdef WeDoPacketMode
268
269kal_bool nspeGetBufferfromTxQueue( kal_uint8 *buffer, kal_uint16 *size, kal_uint8 app );
270void nspePacketBufferRxd( kal_uint8 app, kal_uint8 *data, kal_uint16 len, kal_uint16 prot );
271void nspePassPacketDataToHost( kal_uint8 app );
272void nspePerformMqueueFlowCtl( void );
273void nspeQueuePacket( kal_uint8 app, kal_uint8 *data, kal_uint16 len, kal_uint16 prot );
274void nspeDequeuePacket( kal_uint8 app, kal_uint8 *data, kal_uint16 *len, kal_uint16 *prot );
275void nspePassIpDataToPacket( void );
276void nspePacketInit( void );
277
278#else
279
280#define nspePacketBufferRxd( a,b,c,d )
281#define nspeQueuePacket( a,b,c,d )
282#define nspeDequeuePacket( a,b,c,d )
283#define nspePassIpDataToPacket()
284
285#endif /* WeDoPacketMode */
286
287/* functions support network layer */
288void umReConnected(void);
289
290struct scb* nspeAllocScb(void);
291struct scb* nspeGetScbBySap(kal_uint8 sap);
292
293
294#endif /* _7074STAT_H_ */
295
296