comparison src/g23m-fad/tcpip/tcpip.h @ 1:d393cd9bb723

src/g23m-*: initial import from Magnetite
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 15 Jul 2018 04:40:46 +0000
parents
children
comparison
equal deleted inserted replaced
0:b6a5e36de839 1:d393cd9bb723
1 /*
2 +------------------------------------------------------------------------------
3 | File: tcpip.h
4 +------------------------------------------------------------------------------
5 | Copyright 2002 Texas Instruments Berlin, AG
6 | All rights reserved.
7 |
8 | This file is confidential and a trade secret of Texas
9 | Instruments Berlin, AG
10 | The receipt of or possession of this file does not convey
11 | any rights to reproduce or disclose its contents or to
12 | manufacture, use, or sell anything it may describe, in
13 | whole, or in part, without the specific written consent of
14 | Texas Instruments Berlin, AG.
15 +-----------------------------------------------------------------------------
16 | Purpose : Definitions for the Protocol Stack Entity TCPIP.
17 +-----------------------------------------------------------------------------
18 */
19
20 #ifndef TCPIP_H
21 #define TCPIP_H
22
23 /*==== INCLUDES =============================================================*/
24
25 /*==== CONSTS ===============================================================*/
26
27 #define TCPIP_MAX_DTI_LINKS 4 /* For phase one, this is one DTI link per
28 * application plus one to the lower layer
29 * (PPP or SNDCP. */
30
31 #define TCPIP_DTI_QUEUE_SIZE 5 /* Arbitrary value. */
32
33 #define TCPIP_DEFAULT_WINDOW 1 /* Default window size regarding payload data
34 * between TCPIP and the application. As we do
35 * not really do window-based flow control
36 * yet, this value only means "send another
37 * primitive". */
38
39 #ifdef VSI_CALLER
40 #undef VSI_CALLER
41 #endif /* VSI_CALLER */
42 #define VSI_CALLER tcpip_handle,
43
44 #define hCommMMI tcpip_hCommMMI /* Communication handle */
45
46 /*==== TYPES =================================================================*/
47
48
49 /* Flow control status. */
50 typedef enum { TCPIP_FLOWCTL_XOFF = 0, TCPIP_FLOWCTL_XON } T_flowctl_status ;
51
52 /* Global entity data.
53 *
54 */
55 typedef struct /* T_TCPIP_DATA */
56 {
57 unsigned char version ;
58 BOOL is_initialized ; /* TCPIP/RNET has been initialized. */
59 DTI_HANDLE dti_handle ; /* TCPIP's own DTI handle. */
60 struct /* Data for the DTI link to the lower layer */
61 {
62 U32 link_id ; /* DTI link identifier. */
63 T_flowctl_status flowstat_ul ;
64 /* Flow control status to lower layer
65 * (uplink). */
66 T_flowctl_status flowstat_dl ;
67 /* Flow control status to IP (downlink). */
68 }
69 ll[1] ; /* Indexed by DTI channel number. */
70 U32 config_dns_address ; /* DNS server address, set by config
71 * primitive, in network byte order. Overrides
72 * the first DNS server address in
73 * TCPIP_IFCONFIG_REQ. */
74 } T_TCPIP_DATA;
75
76
77
78
79 /*==== EXPORTS ===============================================================*/
80
81 #ifdef TCPIP_PEI_C
82
83 /* Entity data base */
84 T_TCPIP_DATA tcpip_data_base;
85 T_TCPIP_DATA *tcpip_data;
86
87 /* Communication handles */
88 T_HANDLE hCommMMI = VSI_ERROR;
89 T_HANDLE tcpip_handle;
90 T_HANDLE hCommTCPIP = VSI_ERROR ;
91
92 #else /* TCPIP_PEI_C */
93
94 extern T_TCPIP_DATA tcpip_data_base, *tcpip_data;
95 extern T_HANDLE hCommMMI;
96 extern T_HANDLE tcpip_handle;
97 extern T_HANDLE hCommTCPIP ;
98
99 #endif /* TCPIP_PEI_C */
100
101 /*==== Some functions ========================================================*/
102
103 /** Shut down RNET and deallocate data. This defined as a separate function
104 * because it will also be called by pei_exit().
105 *
106 */
107 void tcpip_do_shutdown(void) ;
108
109
110 /*==== DTI-related functions =================================================*/
111
112 /** DTI callback function according to dti.h.
113 *
114 */
115 void tcpip_dti_callback(U8 instance, U8 interfac, U8 channel, U8 reason,
116 T_DTI2_DATA_IND *dti_data_ind) ;
117
118
119 /** Confirm the result of a TCPIP_DTI_REQ. This function is called
120 * from tcpip_dti.c, so it must not be static.
121 *
122 * @param dti_conn Indicates whether the DTI link is to be established or
123 * disconnected
124 * @param link_id DTI link identifier
125 */
126 void tcpip_dti_cnf(U8 dti_conn, U32 link_id) ;
127
128
129 /** Send the data buffer with the specified length to the lower layer. The
130 * data buffer will be freed by the caller.
131 *
132 * @param data Pointer to the data.
133 * @param length Length of the data.
134 */
135 void tcpip_dti_send_data_ll(U8 *data, U16 length) ;
136
137
138
139 /*==== Primitive handler functions ===========================================*/
140
141 /** Handle the primitive of the same name.
142 *
143 * @param primdata Pointer to primitive data (duh!).
144 */
145 void tcpip_initialize_req(void *primdata) ;
146 void tcpip_shutdown_req(void *primdata) ;
147 void tcpip_ifconfig_req(void *primdata) ;
148 void tcpip_dti_req(void *primdata) ;
149 void tcpip_create_req(void *primdata) ;
150 void tcpip_close_req(void *primdata) ;
151 void tcpip_bind_req(void *primdata) ;
152 void tcpip_listen_req(void *primdata) ;
153 void tcpip_connect_req(void *primdata) ;
154 void tcpip_data_req(void *primdata) ;
155 void tcpip_data_res(void *primdata) ;
156 void tcpip_sockname_req(void *primdata) ;
157 void tcpip_peername_req(void *primdata) ;
158 void tcpip_hostinfo_req(void *primdata) ;
159 void tcpip_mtu_size_req(void *primdata) ;
160 void tcpip_internal_ind(void *primdata) ;
161
162 /** Send a message to self.
163 *
164 * @param msg_p pointer to message
165 * @param msg_id message identification
166 */
167 void tcpip_send_internal_ind(U32 msg_p, U32 msg_id) ;
168
169
170 /* DTI primitive handlers.
171 */
172 void tcpip_dti_ready_ind (T_DTI2_READY_IND *dti_ready_ind) ;
173 void tcpip_dti_data_req (T_DTI2_DATA_REQ *dti_data_req) ;
174 void tcpip_dti_data_ind (T_DTI2_DATA_IND *dti_data_ind) ;
175 void tcpip_dti_getdata_req (T_DTI2_GETDATA_REQ *dti_getdata_req) ;
176 #if defined(_SIMULATION_) /* Used only for simulation test primitives. */
177 void tcpip_dti_data_test_ind (T_DTI2_DATA_TEST_IND *dti_data_test_ind) ;
178 void tcpip_dti_data_test_req (T_DTI2_DATA_TEST_REQ *dti_data_test_req) ;
179 #endif /* _SIMULATION_ */
180 void tcpip_dti_connect_req (T_DTI2_CONNECT_REQ *dti_connect_req) ;
181 void tcpip_dti_disconnect_ind(T_DTI2_DISCONNECT_IND *dti_disconnect_ind) ;
182 void tcpip_dti_connect_cnf (T_DTI2_CONNECT_CNF *dti_connect_cnf) ;
183 void tcpip_dti_connect_ind (T_DTI2_CONNECT_IND *dti_connect_ind) ;
184 void tcpip_dti_connect_res (T_DTI2_CONNECT_RES *dti_connect_res) ;
185 void tcpip_dti_disconnect_req(T_DTI2_DISCONNECT_REQ *dti_disconnect_req) ;
186
187
188
189 #endif /* !TCPIP_H */
190