FreeCalypso > hg > fc-tourmaline
comparison src/g23m-gprs/sndcp/sndcp.h @ 1:fa8dc04885d8
src/g23m-*: import from Magnetite
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Fri, 16 Oct 2020 06:25:50 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
0:4e78acac3d88 | 1:fa8dc04885d8 |
---|---|
1 /* | |
2 +----------------------------------------------------------------------------- | |
3 | Project : GPRS (8441) | |
4 | Modul : sndcp.h | |
5 +----------------------------------------------------------------------------- | |
6 | Copyright 2002 Texas Instruments Berlin, AG | |
7 | All rights reserved. | |
8 | | |
9 | This file is confidential and a trade secret of Texas | |
10 | Instruments Berlin, AG | |
11 | The receipt of or possession of this file does not convey | |
12 | any rights to reproduce or disclose its contents or to | |
13 | manufacture, use, or sell anything it may describe, in | |
14 | whole, or in part, without the specific written consent of | |
15 | Texas Instruments Berlin, AG. | |
16 | | |
17 | These files implement Van Jacobson Compression algorithm which is taken from | |
18 | University of California Berkley's Implementation. | |
19 | | |
20 | | |
21 | "Copyright (c)1989 Regents of the University of California. | |
22 | All rights reserved.Redistribution and use in source and binary forms are | |
23 | permitted, provided that the above copyright notice and this paragraph are | |
24 | duplicated in all such forms and that any documentation advertising materials, | |
25 | and other materials related to such distributionand use acknowledge that the | |
26 | software was developed by the University of California, Berkeley. | |
27 | The name of the University may not be used to endorse or promote products | |
28 | derived from this software without specific prior written permission. | |
29 | THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, | |
30 | INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND | |
31 | FITNESS FOR A PARTICULAR PURPOSE" | |
32 +----------------------------------------------------------------------------- | |
33 | Purpose : Definitions for the Protocol Stack Entity | |
34 | SNDCP | |
35 +----------------------------------------------------------------------------- | |
36 */ | |
37 | |
38 /*---- HISTORY --------------------------------------------------------------*/ | |
39 | |
40 #ifndef SNDCP_H | |
41 #define SNDCP_H | |
42 | |
43 #ifndef _SNDCP_DTI_2_ | |
44 #define _SNDCP_DTI_2_ | |
45 #endif | |
46 | |
47 | |
48 #ifndef SNDCP_UPM_INCLUDED | |
49 #define SNDCP_UPM_INCLUDED | |
50 #endif | |
51 | |
52 | |
53 #include "prim.h" | |
54 | |
55 #ifdef SNDCP_2to1 | |
56 | |
57 #ifndef T_desc_list3 | |
58 #define T_desc_list3 T_LL_desc_list3 | |
59 #endif | |
60 #ifndef T_ll_qos | |
61 #define T_ll_qos T_PS_qos_r97 | |
62 #endif | |
63 | |
64 #endif /* SNDCP_2to1 */ | |
65 | |
66 #ifdef TI_PS_FF_V42BIS | |
67 #include "v42b_type.h" | |
68 #endif /* TI_PS_FF_V42BIS */ | |
69 | |
70 /* | |
71 * Compiler switch for tracing of user data, e.q. TCP/IP header and payload | |
72 * Payload is traced only if config primitive TRACE_PACKET_ON was received. | |
73 */ | |
74 #ifdef SNDCP_TRACE_ALL | |
75 /* | |
76 * compiler switch for tracing of a buffer as hex-dump | |
77 */ | |
78 #define SNDCP_TRACE_BUFFER | |
79 #endif /* SNDCP_TRACE_ALL */ | |
80 | |
81 /* | |
82 * compiler switch for tracing of decoded TCP/IP datagram | |
83 * Per default only the 40 bytes or only decoded TCPIP header is traced. | |
84 * Payload is traced only if config primitive TRACE_PACKET_ON was received. | |
85 */ | |
86 #define SNDCP_TRACE_IP_DATAGRAM | |
87 #define SNDCP_UL_PACKET (0x1) | |
88 #define SNDCP_DL_PACKET (0x2) | |
89 | |
90 /* | |
91 * defines the user of the vsi interface | |
92 */ | |
93 #define VSI_CALLER SNDCP_handle, | |
94 | |
95 | |
96 /* | |
97 * Macros | |
98 */ | |
99 | |
100 /* | |
101 * This is just a TEMPORARY define until the issues with OPTION_MULTITHREAD | |
102 * are settled. This define SHOULD be contained in GSM.H. | |
103 */ | |
104 #undef _ENTITY_PREFIXED | |
105 #define _ENTITY_PREFIXED(N) sndcp_##N | |
106 | |
107 /* | |
108 * Customized Trace Macros | |
109 */ | |
110 #ifndef TRACE_EVENT_P16 | |
111 #define TRACE_EVENT_P16(f,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16)\ | |
112 vsi_o_event_ttrace(f,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16); | |
113 #endif /* TRACE_EVENT_P16 */ | |
114 #ifndef TRACE_EVENT_P14 | |
115 #define TRACE_EVENT_P14(f,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14)\ | |
116 vsi_o_event_ttrace(f,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14); | |
117 #endif /* TRACE_EVENT_P14 */ | |
118 #ifndef TRACE_EVENT_P12 | |
119 #define TRACE_EVENT_P12(f,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12)\ | |
120 vsi_o_event_ttrace(f,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12); | |
121 #endif /* TRACE_EVENT_P12 */ | |
122 #ifndef TRACE_EVENT_P10 | |
123 #define TRACE_EVENT_P10(f,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10)\ | |
124 vsi_o_event_ttrace(f,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10); | |
125 #endif /* TRACE_EVENT_P10 */ | |
126 | |
127 /* | |
128 * The following macro is similar to PFREE_DESC2. Instead of doing | |
129 * a PFREE(P) it does a MFREE(p). This macro is used to free primitives | |
130 * like sn_data_req which are removed from SN SAP and added into this | |
131 * header file. | |
132 */ | |
133 #define MFREE_PRIM(p) { MFREE_DESC2 ((p)->desc_list2.first); \ | |
134 MFREE ((p)); \ | |
135 } | |
136 | |
137 /* | |
138 * Constants | |
139 */ | |
140 | |
141 /* | |
142 * Possible values for su->cia_state. | |
143 */ | |
144 #define CIA_IDLE 23 | |
145 #define CIA_BUSY 23 /*29*/ | |
146 | |
147 /* | |
148 * Maximum number of DTI links. | |
149 */ | |
150 #if defined (SNDCP_2to1) || defined (REL99)|| \ | |
151 defined (_SIMULATION_) | |
152 #define SNDCP_MAX_DTI_LINKS 16 | |
153 #else | |
154 #define SNDCP_MAX_DTI_LINKS 3 | |
155 #endif | |
156 /* | |
157 * Maximum number of Van Jacobson header compressors. | |
158 */ | |
159 #define SNDCP_MAX_VJ_COUNT 1 | |
160 | |
161 | |
162 /* | |
163 * The default value for N201-I according to | |
164 * GSM 4.64, version 6.51, table 9 | |
165 * For test purposes a smaller value is used. | |
166 */ | |
167 #ifdef _SIMULATION_ | |
168 #define N201_I_DEFAULT 70 | |
169 #else /* _SIMULATION_ */ | |
170 #define N201_I_DEFAULT 1503 | |
171 #endif /* _SIMULATION_ */ | |
172 | |
173 | |
174 /* | |
175 * The default value for N201-U according to | |
176 * GSM 4.64, version 6.51, table 9. | |
177 * For test purposes a smaller value is used. | |
178 */ | |
179 #ifdef _SIMULATION_ | |
180 #define N201_U_DEFAULT 70 | |
181 #else /* _SIMULATION_ */ | |
182 #define N201_U_DEFAULT 500 | |
183 #endif /* _SIMULATION_ */ | |
184 | |
185 /* | |
186 * N-PDU size | |
187 */ | |
188 #define SNDCP_N_PDU_SIZE 750 | |
189 | |
190 /* | |
191 * The re-establishment time for GSM 4.65, 6.2.1.4. | |
192 */ | |
193 #ifdef _SIMULATION_ | |
194 #define MG_RE_EST_TIME 3000 | |
195 #else /* _SIMULATION_ */ | |
196 #define MG_RE_EST_TIME 3000 | |
197 #endif /* _SIMULATION_ */ | |
198 | |
199 /* | |
200 * Bitoffset for encoding/decoding | |
201 */ | |
202 | |
203 #define ENCODE_OFFSET (37 * 8) | |
204 | |
205 /* | |
206 * Byteoffset for encoding/decoding | |
207 */ | |
208 | |
209 #define ENCODE_OFFSET_BYTE 37 | |
210 | |
211 /* | |
212 * return values for procedures mg_decode_xid, mg_check_cnf_xid. | |
213 */ | |
214 /* | |
215 * Parsed XID is ok (used for format and/or content). | |
216 */ | |
217 #define MG_XID_OK 0 | |
218 /* | |
219 * Parsed XID block has incorrect content. | |
220 */ | |
221 #define MG_XID_BAD_CONTENT 1 | |
222 /* | |
223 * Parsed XID block was in bad format. | |
224 */ | |
225 #define MG_XID_BAD_FORMAT 2 | |
226 | |
227 /* | |
228 * Other constants for service mg. | |
229 */ | |
230 /* | |
231 * Maximal number of renegotiations in case of invalid cnf. | |
232 */ | |
233 #define MG_MAX_RENEGO 4 | |
234 /* | |
235 * Maximal number of compression entities: 32 each. | |
236 */ | |
237 #define MG_MAX_ENTITIES 32 | |
238 /* | |
239 * Maximum number of PCOMP values: 16. | |
240 */ | |
241 #define MG_MAX_PCOMP 16 | |
242 /* | |
243 * Maximum number of DCOMP values: 16. | |
244 */ | |
245 #define MG_MAX_DCOMP 16 | |
246 /* | |
247 * Possible values for service var 'mod_expects': | |
248 */ | |
249 #define MG_MOD_X_NONE 0xff | |
250 #define MG_MOD_X_REL 1 | |
251 #define MG_MOD_X_EST 2 | |
252 #define MG_MOD_X_READY 0 | |
253 /* | |
254 * State of compression entity or dcomp/pcomp value | |
255 */ | |
256 #define MG_UNASSIGNED 23 | |
257 /* | |
258 * State of compression entity or dcomp/pcomp value | |
259 */ | |
260 #define MG_SELECTED 37 | |
261 /* | |
262 * State of compression entity or dcomp/pcomp value | |
263 */ | |
264 #define MG_ASSIGNED 47 | |
265 /* | |
266 * Possible field lengths in xid blocks in case of omitted parameters. | |
267 * acc. to GSM 4.65, 6.6.2.1. | |
268 * for p bit == 1 | |
269 */ | |
270 #define MG_DATA_P_0_NSAPIS_OM 0 | |
271 #define MG_DATA_P_0_P0_OM 2 | |
272 #define MG_DATA_P_0_P1_OM 3 | |
273 #define MG_DATA_P_0_P2_OM 5 | |
274 | |
275 #define MG_HEADER_P_0_NSAPIS_OM 0 | |
276 #define MG_HEADER_P_0_S0_M_1_OM 2 | |
277 | |
278 /* | |
279 * The same for p bit == 0 | |
280 */ | |
281 #define MG_DATA_P_1_NSAPIS_OM 1 | |
282 #define MG_DATA_P_1_P0_OM 3 | |
283 #define MG_DATA_P_1_P1_OM 4 | |
284 #define MG_DATA_P_1_P2_OM 6 | |
285 | |
286 #define MG_HEADER_P_1_NSAPIS_OM 1 | |
287 #define MG_HEADER_P_1_S0_M_1_OM 3 | |
288 | |
289 | |
290 /* | |
291 * Is the 'nsapis' parameter in xid block for data or header entity? | |
292 */ | |
293 #define MG_XID_V42_NSAPIS 23 | |
294 #define MG_XID_VJ_NSAPIS 19 | |
295 | |
296 | |
297 | |
298 /* | |
299 * number of implemented instances of service nu | |
300 */ | |
301 #define NU_NUM_INC 16 | |
302 | |
303 /* | |
304 * LLC operation modes | |
305 */ | |
306 #define SNDCP_ACK 17 | |
307 #define SNDCP_UNACK 37 | |
308 | |
309 | |
310 /* | |
311 * Number of unacknowledged segment numbers (acc to GSM 4.65: 3) | |
312 */ | |
313 #ifdef _SIMULATION_ | |
314 #define SNDCP_SEGMENT_NUMBERS_UNACK 25 | |
315 #else | |
316 #define SNDCP_SEGMENT_NUMBERS_UNACK 7 | |
317 #endif /* _SIMULATION_ */ | |
318 | |
319 /* | |
320 * Number of acknowledged segment numbers. This value is implementation | |
321 * dependant. Here a bit mask of 32 is used in service sua to check the | |
322 * confirmation status of a segmented N-PDU which then implies a maximum | |
323 * number of 32. | |
324 */ | |
325 #define SNDCP_SEGMENT_NUMBERS_ACK 32 | |
326 | |
327 /* | |
328 * Maximum Segment Number in a Single NPDU which SNDCP will assemble | |
329 * in downlink. If SNDCP receives more than SNDCP_MAX_SEG_NUMBER segments | |
330 * in one NPDU, SNDCP will discard the stored segments and will keep on | |
331 * discarding the incoming segments till it receives the last segment. | |
332 */ | |
333 #define SNDCP_MAX_SEGMENT_NUMBER 100 | |
334 | |
335 | |
336 /* | |
337 * The resulting max value of the fully confirmed 32 segments mask. | |
338 */ | |
339 #define SNDCP_MAX_COMPLETE 4294967295 | |
340 | |
341 /* | |
342 * The length of the queue for N-PDUs (in form of SN_UNITDATA_REQ prims). | |
343 */ | |
344 #define SN_UNITDATA_Q_LEN SNDCP_NUMBER_OF_NSAPIS | |
345 | |
346 /* | |
347 * The length of the queue for N-PDUs (in form of SN_DATA_REQ prims). | |
348 */ | |
349 #define SN_DATA_Q_LEN SNDCP_NUMBER_OF_NSAPIS | |
350 | |
351 /* | |
352 * The length of an SN Unitdata Pdu header, acc. to GSM 4.65 in bytes. | |
353 * This SN-PDU is the first segment of an N-PDU. The octet for DCOMP and PCOMP | |
354 * is included in the SN-UNITDATA PDU format. | |
355 */ | |
356 #define SN_UNITDATA_PDP_HDR_LEN_BIG 4 | |
357 | |
358 | |
359 /* | |
360 * The length of an SN Unitdata Pdu header, acc. to GSM 4.65 in bytes. | |
361 * This SN-PDU is not the first segment of an N-PDU. The octet for DCOMP and | |
362 * PCOMP is not included in SN-UNITDATA PDU format. | |
363 */ | |
364 #define SN_UNITDATA_PDP_HDR_LEN_SMALL 3 | |
365 | |
366 /* | |
367 * The length of an SN Data Pdu header, acc. to GSM 4.65 in bytes. | |
368 * This SN-PDU is the first segment of an N-PDU. The octet for DCOMP and PCOMP | |
369 * is included in the SN-DATA PDU format. | |
370 */ | |
371 #define SN_DATA_PDP_HDR_LEN_BIG 3 | |
372 | |
373 | |
374 /* | |
375 * The length of an SN Data Pdu header, acc. to GSM 4.65 in bytes. | |
376 * This SN-PDU is not the first segment of an N-PDU. The octet for DCOMP and | |
377 * PCOMP is not included in the SN-DATA PDU PDU format. The octet with the | |
378 * N-PDU number is not included in the SN-DATA PDU format. | |
379 */ | |
380 #define SN_DATA_PDP_HDR_LEN_SMALL 1 | |
381 | |
382 | |
383 | |
384 /* | |
385 * Number of implemented instances of service su. | |
386 */ | |
387 #define SU_NUM_INC 4 | |
388 | |
389 /* | |
390 * Number of implemented instances of service sua. | |
391 */ | |
392 #define SUA_NUM_INC 4 | |
393 | |
394 /* | |
395 * number of implemented instances of service nd | |
396 */ | |
397 #define ND_NUM_INC 16 | |
398 | |
399 /* | |
400 * number of implemented instances of service sd | |
401 */ | |
402 #define SD_NUM_INC 4 | |
403 | |
404 /* | |
405 * number of implemented instances of service sda | |
406 */ | |
407 #define SDA_NUM_INC 4 | |
408 | |
409 /* | |
410 * Maximum number of NSAPIs according to specification, implementation | |
411 * independent. | |
412 */ | |
413 #define SNDCP_NUMBER_OF_NSAPIS 16 | |
414 | |
415 /* | |
416 * Maximum number of LLC SAPIs according to specification, implementation | |
417 * independent. | |
418 */ | |
419 #define SNDCP_NUMBER_OF_SAPIS 4 | |
420 | |
421 /* | |
422 * Maximum N-pdu number in unacknowledged LLC operation mode | |
423 */ | |
424 #define MAX_NPDU_NUMBER_UNACK 4096 | |
425 | |
426 /* | |
427 * Maximum N-pdu number in acknowledged LLC operation mode | |
428 */ | |
429 #define MAX_NPDU_NUMBER_ACK 256 | |
430 | |
431 /* | |
432 * The implementation dependant length in bits for an XID block that | |
433 * will be requested by the MS. | |
434 */ | |
435 #define SNDCP_XID_BLOCK_BIT_LEN 192 | |
436 | |
437 /* | |
438 * Constants for filling the requested XID block. | |
439 */ | |
440 /* | |
441 * The parameter type for version. | |
442 */ | |
443 #define SNDCP_XID_PARAM_TYPE_0 0 | |
444 /* | |
445 * Length of parameter type 0 in octets. | |
446 */ | |
447 #define SNDCP_XID_0_LEN 1 | |
448 /* | |
449 * Version number 0. | |
450 */ | |
451 #define SNDCP_XID_VERSION 0 | |
452 /* | |
453 * The parameter type for data compressors. | |
454 */ | |
455 #define SNDCP_XID_PARAM_TYPE_1 1 | |
456 /* | |
457 * Length of parameter type 1 in octets. | |
458 * RES value 2 shorter because algorithm type and dcomp bytes omitted. | |
459 */ | |
460 #define SNDCP_XID_1_LEN 10 | |
461 #define SNDCP_XID_1_LEN_RES 8 | |
462 /* | |
463 * P bit value 1. | |
464 */ | |
465 #define SNDCP_P_BIT_1 1 | |
466 /* | |
467 * P bit value 0. | |
468 */ | |
469 #define SNDCP_P_BIT_0 0 | |
470 /* | |
471 * Compressor entity 0. | |
472 */ | |
473 #define SNDCP_NTT_0 0 | |
474 /* | |
475 * the octet with | X | X | X | algorithm type. | |
476 */ | |
477 #define SNDCP_XID_V42 0 | |
478 /* | |
479 * Length of V42bis parameters in octets. | |
480 * RES values 1 shorter because of omitted dcomp value. | |
481 */ | |
482 #define SNDCP_XID_V42_LEN 7 | |
483 #define SNDCP_XID_V42_LEN_RES 6 | |
484 /* | |
485 * The octet with| DCOMP1 | X | will be set dynamically. | |
486 * One default value. | |
487 */ | |
488 #define SNDCP_DCOMP1 1 | |
489 /* | |
490 * The two octets with applicable nsapis will be set dynamically. | |
491 * default value is SNDCP_NSAPIS_DEFAULT like in case of header compression. | |
492 */ | |
493 /* | |
494 * The direction octet will be set dynamically, values may be | |
495 * SNSM_COMP_NEITHER_DIRECT, | |
496 * SNSM_COMP_MS_SGSN_DIRECT, | |
497 * SNSM_COMP_SGSN_MS_DIRECT, | |
498 * SNSM_COMP_BOTH_DIRECT | |
499 * Default: SNSM_COMP_BOTH_DIRECT | |
500 */ | |
501 #ifndef SNDCP_UPM_INCLUDED | |
502 #define SNDCP_V42_DEFAULT_DIRECTION SNSM_COMP_BOTH_DIRECT | |
503 #else | |
504 #define SNDCP_V42_DEFAULT_DIRECTION NAS_DCOMP_BOTH_DIRECT | |
505 #endif /* Compression parameters */ /* SNDCP_UPM_INCLUDED */ | |
506 /* | |
507 * The 2 P1 octets (max codewords) will be set dynamically. | |
508 * Default value: 2048 | |
509 */ | |
510 #define SNDCP_V42_DEFAULT_P1 2048 | |
511 /* | |
512 * The P2 (max char num) octet will be set dynamically. | |
513 * Default value: 20 | |
514 */ | |
515 #define SNDCP_V42_DEFAULT_P2 20 | |
516 /* | |
517 * The parameter type for header compressors. | |
518 */ | |
519 #define SNDCP_XID_PARAM_TYPE_2 2 | |
520 /* | |
521 * Length of parameter type 2 in octets | |
522 * RES value 2 shorter because algorithm type and pcomp bytes omitted. | |
523 */ | |
524 #define SNDCP_XID_2_LEN_RES 5 | |
525 #define SNDCP_XID_2_LEN 7 | |
526 /* | |
527 * The octet with | X | X | X | algorithm type. | |
528 */ | |
529 #define SNDCP_XID_VJ 0 | |
530 /* | |
531 * Length of VanJacobson parameters in octets. | |
532 * RES value 1 shorter because pcomp byte omitted. | |
533 */ | |
534 #define SNDCP_XID_VJ_LEN 4 | |
535 #define SNDCP_XID_VJ_LEN_RES 3 | |
536 #define SNDCP_MAX_NUMBER_OF_VJ_SLOTS 16 | |
537 | |
538 /* | |
539 * The octet with| PCOMP1 | PCOMP2 | will be set dynamically. | |
540 * Two default values. | |
541 */ | |
542 #define SNDCP_PCOMP1 1 | |
543 #define SNDCP_PCOMP2 2 | |
544 /* | |
545 * The two octets with applicable nsapis will be set dynamically. | |
546 * Default value: 0 | |
547 */ | |
548 #define SNDCP_NSAPIS_DEFAULT 0 | |
549 /* | |
550 * The octet with S0 - 1 will be set dynamically. | |
551 * Default value: 15 | |
552 */ | |
553 #define SNDCP_VJ_DEFAULT_S0_M_1 15 | |
554 | |
555 /* | |
556 * "states" of nsapis and sapis that are stored in the arrays nsapi_state_ra | |
557 * and sapi_state_ra | |
558 */ | |
559 #define MG_IDLE 0 | |
560 /* | |
561 * Waiting for LL_ESTABLISH_CNF. | |
562 */ | |
563 #define MG_EST 1 | |
564 /* | |
565 * Waiting for LL_XID_CNF. | |
566 */ | |
567 #define MG_XID 2 | |
568 /* | |
569 * Must send SNSM_ACTIVATE_RES. | |
570 */ | |
571 #define MG_ACT 4 | |
572 /* | |
573 * Waiting for LL_RELEASE_CNF. | |
574 */ | |
575 #define MG_REL 8 | |
576 /* | |
577 * Must send SNSM_DEACTIVATE_RES. | |
578 */ | |
579 #define MG_DEACT 0x10 | |
580 /* | |
581 * Waiting for SNSM_SEQUEMCE_IND. | |
582 */ | |
583 #define MG_SEQ 0x20 | |
584 /* | |
585 * A local LL_RELEASE_REQ must be sent after the end of the running sub | |
586 * procedure. | |
587 */ | |
588 #define MG_REL_NEC_LOC 0x40 | |
589 /* | |
590 * An LL_XID_REQ must be sent after the end of the running sub procedure. | |
591 */ | |
592 #define MG_XID_NEC 0x80 | |
593 /* | |
594 * An LL_ESTABLISH_REQ must be sent after the end of the running sub procedure. | |
595 */ | |
596 #define MG_EST_NEC 0x100 | |
597 /* | |
598 * A non local LL_RELEASE_REQ must be sent after the end of the running sub | |
599 * procedure. | |
600 */ | |
601 #define MG_REL_NEC_PEER 0x200 | |
602 /* | |
603 * A LL_ESTABLISH_IND is expected or received | |
604 */ | |
605 #define MG_EST_IND 0x400 | |
606 | |
607 /* | |
608 * SNDCP got SN_DTI_REQ and the DTI information is stored ! | |
609 */ | |
610 #define MG_DTI_INFO 0x800 | |
611 | |
612 | |
613 /* | |
614 * Service definitions. Used to access service data with GET/SET_STATE. | |
615 * | |
616 * Services with multiple incarnation have to be defined as xxx-> | |
617 * Services with only one incarnation have to be defined as xxx. | |
618 */ | |
619 #define CIA cia. | |
620 #define MG mg. | |
621 #define NU nu-> | |
622 #define SU su-> | |
623 #define SUA sua-> | |
624 #define ND nd-> | |
625 #define PD pd-> | |
626 #define PDA pda-> | |
627 #define SD sd-> | |
628 #define SDA sda-> | |
629 | |
630 /* | |
631 * workaround for init | |
632 */ | |
633 #define NU_0 nu-> | |
634 #define NU_1 nu-> | |
635 #define NU_2 nu-> | |
636 #define NU_3 nu-> | |
637 #define NU_4 nu-> | |
638 #define NU_5 nu-> | |
639 #define NU_6 nu-> | |
640 #define NU_7 nu-> | |
641 #define NU_8 nu-> | |
642 #define NU_9 nu-> | |
643 #define NU_10 nu-> | |
644 #define NU_11 nu-> | |
645 #define NU_12 nu-> | |
646 #define NU_13 nu-> | |
647 #define NU_14 nu-> | |
648 #define NU_15 nu-> | |
649 | |
650 #define SU_0 su-> | |
651 #define SU_1 su-> | |
652 #define SU_2 su-> | |
653 #define SU_3 su-> | |
654 | |
655 #define SUA_0 sua-> | |
656 #define SUA_1 sua-> | |
657 #define SUA_2 sua-> | |
658 #define SUA_3 sua-> | |
659 | |
660 #define ND_0 nd-> | |
661 #define ND_1 nd-> | |
662 #define ND_2 nd-> | |
663 #define ND_3 nd-> | |
664 #define ND_4 nd-> | |
665 #define ND_5 nd-> | |
666 #define ND_6 nd-> | |
667 #define ND_7 nd-> | |
668 #define ND_8 nd-> | |
669 #define ND_9 nd-> | |
670 #define ND_10 nd-> | |
671 #define ND_11 nd-> | |
672 #define ND_12 nd-> | |
673 #define ND_13 nd-> | |
674 #define ND_14 nd-> | |
675 #define ND_15 nd-> | |
676 | |
677 #define SD_0 sd-> | |
678 #define SD_1 sd-> | |
679 #define SD_2 sd-> | |
680 #define SD_3 sd-> | |
681 | |
682 #define SDA_0 sda-> | |
683 #define SDA_1 sda-> | |
684 #define SDA_2 sda-> | |
685 #define SDA_3 sda-> | |
686 | |
687 #define PD_0 pd-> | |
688 #define PD_1 pd-> | |
689 #define PD_2 pd-> | |
690 #define PD_3 pd-> | |
691 | |
692 #define PDA_0 pda-> | |
693 #define PDA_1 pda-> | |
694 #define PDA_2 pda-> | |
695 #define PDA_3 pda-> | |
696 | |
697 #ifdef NTRACE | |
698 #undef SNDCP_TRACE_ALL /* if NTRACE is defined, SNDCP_TRACE_ALL should be disabled */ | |
699 #endif | |
700 /* | |
701 * Service name definitions for trace purposes. | |
702 */ | |
703 #ifndef NTRACE | |
704 | |
705 #define SERVICE_NAME_CIA "CIA" | |
706 | |
707 #define SERVICE_NAME_MG "MG" | |
708 | |
709 #define SERVICE_NAME_ND_0 "ND_0" | |
710 #define SERVICE_NAME_ND_1 "ND_1" | |
711 #define SERVICE_NAME_ND_2 "ND_2" | |
712 #define SERVICE_NAME_ND_3 "ND_3" | |
713 #define SERVICE_NAME_ND_4 "ND_4" | |
714 #define SERVICE_NAME_ND_5 "ND_5" | |
715 #define SERVICE_NAME_ND_6 "ND_6" | |
716 #define SERVICE_NAME_ND_7 "ND_7" | |
717 #define SERVICE_NAME_ND_8 "ND_8" | |
718 #define SERVICE_NAME_ND_9 "ND_9" | |
719 #define SERVICE_NAME_ND_10 "ND_10" | |
720 #define SERVICE_NAME_ND_11 "ND_11" | |
721 #define SERVICE_NAME_ND_12 "ND_12" | |
722 #define SERVICE_NAME_ND_13 "ND_13" | |
723 #define SERVICE_NAME_ND_14 "ND_14" | |
724 #define SERVICE_NAME_ND_15 "ND_15" | |
725 | |
726 #define SERVICE_NAME_NU_0 "NU_0" | |
727 #define SERVICE_NAME_NU_1 "NU_1" | |
728 #define SERVICE_NAME_NU_2 "NU_2" | |
729 #define SERVICE_NAME_NU_3 "NU_3" | |
730 #define SERVICE_NAME_NU_4 "NU_4" | |
731 #define SERVICE_NAME_NU_5 "NU_5" | |
732 #define SERVICE_NAME_NU_6 "NU_6" | |
733 #define SERVICE_NAME_NU_7 "NU_7" | |
734 #define SERVICE_NAME_NU_8 "NU_8" | |
735 #define SERVICE_NAME_NU_9 "NU_9" | |
736 #define SERVICE_NAME_NU_10 "NU_10" | |
737 #define SERVICE_NAME_NU_11 "NU_11" | |
738 #define SERVICE_NAME_NU_12 "NU_12" | |
739 #define SERVICE_NAME_NU_13 "NU_13" | |
740 #define SERVICE_NAME_NU_14 "NU_14" | |
741 #define SERVICE_NAME_NU_15 "NU_15" | |
742 | |
743 #define SERVICE_NAME_SU_0 "SU_0" | |
744 #define SERVICE_NAME_SU_1 "SU_1" | |
745 #define SERVICE_NAME_SU_2 "SU_2" | |
746 #define SERVICE_NAME_SU_3 "SU_3" | |
747 | |
748 #define SERVICE_NAME_SUA_0 "SUA_0" | |
749 #define SERVICE_NAME_SUA_1 "SUA_1" | |
750 #define SERVICE_NAME_SUA_2 "SUA_2" | |
751 #define SERVICE_NAME_SUA_3 "SUA_3" | |
752 | |
753 #define SERVICE_NAME_SD_0 "SD_0" | |
754 #define SERVICE_NAME_SD_1 "SD_1" | |
755 #define SERVICE_NAME_SD_2 "SD_2" | |
756 #define SERVICE_NAME_SD_3 "SD_3" | |
757 | |
758 #define SERVICE_NAME_SDA_0 "SDA_0" | |
759 #define SERVICE_NAME_SDA_1 "SDA_1" | |
760 #define SERVICE_NAME_SDA_2 "SDA_2" | |
761 #define SERVICE_NAME_SDA_3 "SDA_3" | |
762 | |
763 #define SERVICE_NAME_PD_0 "PD_0" | |
764 #define SERVICE_NAME_PD_1 "PD_1" | |
765 #define SERVICE_NAME_PD_2 "PD_2" | |
766 #define SERVICE_NAME_PD_3 "PD_3" | |
767 | |
768 #define SERVICE_NAME_PDA_0 "PDA_0" | |
769 #define SERVICE_NAME_PDA_1 "PDA_1" | |
770 #define SERVICE_NAME_PDA_2 "PDA_2" | |
771 #define SERVICE_NAME_PDA_3 "PDA_3" | |
772 | |
773 #endif /* !NTRACE */ | |
774 | |
775 | |
776 /* | |
777 * 1 re-establishment timer for each sapi. | |
778 */ | |
779 #define TIMER_MAX 4 | |
780 | |
781 | |
782 /* | |
783 * State definitions for each service. | |
784 */ | |
785 #define CIA_DEFAULT 23 | |
786 | |
787 #define MG_DEFAULT 7 | |
788 | |
789 #define NU_UNACK_SU_RECEPTIVE 8 | |
790 #define NU_UNACK_SU_NOT_RECEPTIVE 9 | |
791 | |
792 #define NU_ACK_SUA_RECEPTIVE 10 | |
793 #define NU_ACK_SUA_NOT_RECEPTIVE 11 | |
794 #define NU_SUS_SUA_RECEPTIVE 12 | |
795 #define NU_SUS_SUA_NOT_RECEPTIVE 13 | |
796 #define NU_REC_SUA_NOT_RECEPTIVE 14 | |
797 | |
798 #ifndef NCONFIG | |
799 | |
800 #define NU_SEND_UNACK_SU_RECEPTIVE 60 | |
801 #define NU_SEND_UNACK_SU_NOT_RECEPTIVE 61 | |
802 | |
803 #define NU_SEND_ACK_SUA_RECEPTIVE 62 | |
804 #define NU_SEND_ACK_SUA_NOT_RECEPTIVE 63 | |
805 #define NU_SEND_SUS_SUA_RECEPTIVE 64 | |
806 #define NU_SEND_SUS_SUA_NOT_RECEPTIVE 65 | |
807 #define NU_SEND_REC_SUA_NOT_RECEPTIVE 66 | |
808 | |
809 #endif | |
810 | |
811 | |
812 #define SU_LLC_NOT_RECEPTIVE 22 | |
813 #define SU_LLC_RECEPTIVE 23 | |
814 #define SU_LLC_RECEPTIVE_SUSPEND 24 | |
815 #define SU_LLC_NOT_RECEPTIVE_SUSPEND 26 | |
816 | |
817 #define SUA_LLC_NOT_RECEPTIVE 82 | |
818 #define SUA_LLC_RECEPTIVE 83 | |
819 #define SUA_LLC_RECEPTIVE_SUSPEND 84 | |
820 #define SUA_LLC_NOT_RECEPTIVE_SUSPEND 86 | |
821 | |
822 #define ND_DEFAULT 31 | |
823 #define ND_RECOVER 37 | |
824 #define ND_SUSPEND 41 | |
825 | |
826 #define SD_DEFAULT 44 | |
827 #define SD_UNACK_DISCARD 45 | |
828 #define SD_UNACK_RECEIVE_FIRST_SEGMENT 46 | |
829 #define SD_UNACK_RECEIVE_SUBSEQUENT_SEGMENT 47 | |
830 #define SD_UNACK_WAIT_NSAPI 48 | |
831 | |
832 #define PD_DEFAULT 50 | |
833 | |
834 #define PDA_DEFAULT 70 | |
835 | |
836 #define SDA_DEFAULT 64 | |
837 #define SDA_ESTABLISH_REQUESTED 65 | |
838 #define SDA_RECEIVE_FIRST_SEGMENT 66 | |
839 #define SDA_RECEIVE_SUBSEQUENT_SEGMENT 67 | |
840 #define SDA_WAIT_NSAPI 68 | |
841 #define SDA_ACK_DISCARD 69 | |
842 | |
843 | |
844 | |
845 /*==== TYPES ======================================================*/ | |
846 /* | |
847 * Value constants for VAL_seg_pos | |
848 */ | |
849 #define SEG_POS_NONE (0x0) /* In between */ | |
850 #define SEG_POS_FIRST (0x1) /* first */ | |
851 #define SEG_POS_LAST (0x2) /* last */ | |
852 #define SEG_POS_FIRST_LAST (0x3) /* both */ | |
853 /* | |
854 * Value constants for algo_type | |
855 */ | |
856 #define CIA_ALGO_V42 (0x0) /* V42bis algorithm */ | |
857 /* | |
858 * Value constants for comp_inst | |
859 */ | |
860 #define CIA_COMP_INST_V42_0 (0x0) /* first instance for V42bis */ | |
861 | |
862 /* | |
863 * The following definitions was originally generated by CCD. | |
864 * The definitions are not used as | |
865 * primitive definitions anymore, only for SNDCP internal usage. | |
866 */ | |
867 | |
868 typedef struct | |
869 { | |
870 U8 delay; /*<1> delay class */ | |
871 U8 relclass; /*<1> Reliability class */ | |
872 U8 peak; /*<1> peak throughput */ | |
873 U8 preced; /*<1> Precedence class */ | |
874 U8 mean; /*<1> main throughput */ | |
875 U8 _align0; /*<1> alignment */ | |
876 U8 _align1; /*<1> alignment */ | |
877 U8 _align2; /*<1> alignment */ | |
878 } T_cia_qos; | |
879 | |
880 #ifndef __T_pdu_ref__ | |
881 #define __T_pdu_ref__ | |
882 typedef struct | |
883 { | |
884 U16 ref_npdu_num; /*<2> ref_npdu_num */ | |
885 U8 ref_seg_num; /*<1> ref_seg_num */ | |
886 U8 ref_nsapi; /*<1> ref_nsapi */ | |
887 } T_pdu_ref; | |
888 #endif | |
889 | |
890 typedef struct | |
891 { | |
892 U8 sapi; /*<1> service access point identifier */ | |
893 U8 algo_type; /*<1> algorithm type */ | |
894 U8 comp_inst; /*<1> compressor instance */ | |
895 U8 packet_type; /*<1> Type of packet. */ | |
896 T_pdu_ref pdu_ref; /*<8> to the segment to be confirmed */ | |
897 T_desc_list2 desc_list2; /*<8> list of generic data descriptors */ | |
898 } T_CIA_COMP_REQ; | |
899 | |
900 | |
901 typedef struct | |
902 { | |
903 U8 sapi; /*<1> service access point identifier */ | |
904 U8 algo_type; /*<1> algorithm type */ | |
905 U8 comp_inst; /*<1> compressor instance */ | |
906 U8 seg_pos; /*<1> First and/or last segment of N-PDU? */ | |
907 U8 packet_type; /*<1> Type of packet. */ | |
908 U8 _align0; /*<1> alignment */ | |
909 U8 _align1; /*<1> alignment */ | |
910 U8 _align2; /*<1> alignment */ | |
911 U32 tlli; /*<4> temporary logical link identifier */ | |
912 T_cia_qos cia_qos; /*<8> quality of service */ | |
913 T_pdu_ref pdu_ref; /*<8> to the segment to be confirmed */ | |
914 T_desc_list3 desc_list3; /*<8> List of generic data descriptors */ | |
915 } T_CIA_COMP_IND; | |
916 | |
917 | |
918 typedef struct | |
919 { | |
920 U8 sapi; /*<1> service access point identifier */ | |
921 U8 _align0; /*<1> alignment */ | |
922 U8 _align1; /*<1> alignment */ | |
923 U8 _align2; /*<1> alignment */ | |
924 U32 tlli; /*<4> temporary logical link identifier */ | |
925 T_pdu_ref pdu_ref; /*<8> to the segment to be confirmed */ | |
926 U8 algo_type; /*<1> algorithm type */ | |
927 U8 comp_inst; /*<1> compressor instance */ | |
928 U8 seg_pos; /*<1> First and/or last segment of N-PDU? */ | |
929 U8 pcomp; /*<1> from sn pdu */ | |
930 T_sdu sdu; /*< > service data unit */ | |
931 } T_CIA_DECOMP_REQ; | |
932 | |
933 typedef struct | |
934 { | |
935 U8 algo_type; /*<1> algorithm type */ | |
936 U8 comp_inst; /*<1> compressor instance */ | |
937 U8 pcomp; /*<1> from sn pdu */ | |
938 U8 _align0; /*<1> alignment */ | |
939 T_pdu_ref pdu_ref; /*<8> to the segment to be confirmed */ | |
940 T_desc_list2 desc_list2; /*< > list of generic data descriptors */ | |
941 } T_CIA_DECOMP_IND; | |
942 | |
943 | |
944 | |
945 /* | |
946 The following definitions was originally generated by CCD. The definitions are not used as | |
947 primitive definitions anymore, only for SNDCP internal usage. | |
948 */ | |
949 typedef struct | |
950 { | |
951 U8 nsapi; /*<1> network layer sapi */ | |
952 U8 p_id; /*<1> protocol identifier */ | |
953 U8 _align0; /*<1> alignment */ | |
954 U8 _align1; /*<1> alignment */ | |
955 T_desc_list2 desc_list2; /*<8> list of generic data descriptors */ | |
956 } T_SN_DATA_REQ; | |
957 | |
958 typedef struct | |
959 { | |
960 U8 nsapi; /*<1> network layer sapi */ | |
961 U8 p_id; /*<1> protocol identifier */ | |
962 U8 _align0; /*<1> alignment */ | |
963 U8 _align1; /*<1> alignment */ | |
964 T_desc_list2 desc_list2; /*<8> list of generic data descriptors */ | |
965 } T_SN_UNITDATA_REQ; | |
966 | |
967 typedef struct | |
968 { | |
969 U8 nsapi; /*<1> network layer sapi */ | |
970 U8 p_id; /*<1> protocol identifier */ | |
971 U8 _align0; /*<1> alignment */ | |
972 U8 _align1; /*<1> alignment */ | |
973 T_desc_list2 desc_list2; /*<8> list of generic data descriptors */ | |
974 } T_SN_UNITDATA_IND; | |
975 | |
976 typedef struct | |
977 { | |
978 U8 nsapi; /*<1> network layer sapi */ | |
979 U8 p_id; /*<1> protocol identifier */ | |
980 U8 _align0; /*<1> alignment */ | |
981 U8 _align1; /*<1> alignment */ | |
982 T_desc_list2 desc_list2; /*<8> list of generic data descriptors */ | |
983 } T_SN_DATA_IND; | |
984 | |
985 typedef struct | |
986 { | |
987 U8 nsapi; /*<1> network layer sapi */ | |
988 U8 p_id; /*<1> protocol identifier */ | |
989 U8 _align0; /*<1> alignment */ | |
990 U8 _align1; /*<1> alignment */ | |
991 T_sdu sdu; /*< > service data unit */ | |
992 } T_SN_DATA_IND_TEST; | |
993 | |
994 typedef struct | |
995 { | |
996 U8 nsapi; /*<1> network layer sapi */ | |
997 U8 p_id; /*<1> protocol identifier */ | |
998 U8 _align0; /*<1> alignment */ | |
999 U8 _align1; /*<1> alignment */ | |
1000 T_sdu sdu; /*< > service data unit */ | |
1001 } T_SN_UNITDATA_IND_TEST; | |
1002 | |
1003 /* | |
1004 * SNDCP global typedefs | |
1005 */ | |
1006 | |
1007 #ifdef SNDCP_UPM_INCLUDED | |
1008 typedef T_PS_qos_r97 T_snsm_qos; | |
1009 typedef T_SN_ACTIVATE_REQ T_SNSM_ACTIVATE_IND; | |
1010 #endif /*SNDCP_UPM_INCLUDED*/ | |
1011 | |
1012 | |
1013 | |
1014 | |
1015 /* | |
1016 * Structs used to store XID parameters. | |
1017 */ | |
1018 /* | |
1019 * Parameters for V42.bis data compression. | |
1020 */ | |
1021 typedef struct /* T_XID_V42_BLOCK */ | |
1022 { | |
1023 /* | |
1024 * Has V42 field been set in the block?. | |
1025 */ | |
1026 BOOL is_set; | |
1027 /* | |
1028 * P bit. | |
1029 */ | |
1030 UBYTE p_bit; | |
1031 /* | |
1032 * Entity number. | |
1033 */ | |
1034 UBYTE ntt; | |
1035 /* | |
1036 * Algorithm type. | |
1037 */ | |
1038 UBYTE algo_type; | |
1039 /* | |
1040 * The one DCOMP value needed for V42.bis. | |
1041 */ | |
1042 UBYTE dcomp; | |
1043 /* | |
1044 * Applicable nsapis set? | |
1045 */ | |
1046 BOOL nsapis_set; | |
1047 /* | |
1048 * Applicable nsapis (bit mask); | |
1049 */ | |
1050 USHORT nsapis; | |
1051 /* | |
1052 * Direction set? | |
1053 */ | |
1054 BOOL p0_set; | |
1055 /* | |
1056 * Direction | |
1057 */ | |
1058 UBYTE p0; | |
1059 /* | |
1060 * Max number of codewords set? | |
1061 */ | |
1062 BOOL p1_set; | |
1063 /* | |
1064 * Max number of codewords. | |
1065 */ | |
1066 USHORT p1; | |
1067 /* | |
1068 * Max char number set? | |
1069 */ | |
1070 BOOL p2_set; | |
1071 /* | |
1072 * Max char number. | |
1073 */ | |
1074 UBYTE p2; | |
1075 | |
1076 } T_XID_V42_BLOCK; | |
1077 | |
1078 /* | |
1079 * Used by VanJacobsen to store TCP-Headers | |
1080 */ | |
1081 typedef struct sndcp_tcp_header/* T_SNDCP_TCP_HEADER */ | |
1082 { | |
1083 /* TCP */ | |
1084 /* | |
1085 * Source Port | |
1086 */ | |
1087 USHORT th_sport; | |
1088 | |
1089 /* | |
1090 * Destination Port | |
1091 */ | |
1092 USHORT th_dport; | |
1093 | |
1094 /* | |
1095 * Sequence Number | |
1096 */ | |
1097 ULONG th_seq; | |
1098 | |
1099 /* | |
1100 * Acknowledgement Number | |
1101 */ | |
1102 ULONG th_ack; | |
1103 | |
1104 /* | |
1105 * Data Offset | |
1106 */ | |
1107 UBYTE th_off; | |
1108 /* | |
1109 * Flags: urg, ack, psh, rst, syn, fin | |
1110 */ | |
1111 UBYTE th_flags; | |
1112 | |
1113 /* | |
1114 * Window | |
1115 */ | |
1116 USHORT th_win; | |
1117 | |
1118 /* | |
1119 * Checksum | |
1120 */ | |
1121 USHORT th_sum; | |
1122 | |
1123 /* | |
1124 * Urgent Pointer | |
1125 */ | |
1126 USHORT th_urp; | |
1127 | |
1128 } T_SNDCP_TCP_HEADER; | |
1129 | |
1130 /* | |
1131 * Used by VanJacobsen to store IP-Headers | |
1132 */ | |
1133 typedef struct sndcp_ip_header/* T_SNDCP_IP_HEADER */ | |
1134 { | |
1135 /* IP */ | |
1136 | |
1137 /* | |
1138 * Protocol Verion, Header Length | |
1139 */ | |
1140 UBYTE ip_vhl; | |
1141 | |
1142 /* | |
1143 * Type of Service | |
1144 */ | |
1145 UBYTE ip_tos; | |
1146 | |
1147 /* | |
1148 * Total Length | |
1149 */ | |
1150 USHORT ip_len; | |
1151 | |
1152 /* | |
1153 * Packet ID | |
1154 */ | |
1155 USHORT ip_id; | |
1156 | |
1157 /* | |
1158 * Don't fragment, More fragments, Fragment Offset | |
1159 */ | |
1160 USHORT ip_off; | |
1161 | |
1162 /* | |
1163 * Time to live | |
1164 */ | |
1165 UBYTE ip_ttl; | |
1166 | |
1167 /* | |
1168 * Protocol | |
1169 */ | |
1170 UBYTE ip_p; | |
1171 | |
1172 /* | |
1173 * Header Checksum | |
1174 */ | |
1175 USHORT ip_sum; | |
1176 | |
1177 /* | |
1178 * Source Address | |
1179 */ | |
1180 ULONG ip_src; | |
1181 | |
1182 /* | |
1183 * Destination Address | |
1184 */ | |
1185 ULONG ip_dst; | |
1186 | |
1187 } T_SNDCP_IP_HEADER; | |
1188 | |
1189 | |
1190 /* | |
1191 * Parameters for VanJacobson header compression. | |
1192 */ | |
1193 typedef struct /* T_XID_VJ_BLOCK */ | |
1194 { | |
1195 /* | |
1196 * Has VJ field been set in the block?. | |
1197 */ | |
1198 BOOL is_set; | |
1199 /* | |
1200 * P bit. | |
1201 */ | |
1202 UBYTE p_bit; | |
1203 /* | |
1204 * Entity number. | |
1205 */ | |
1206 UBYTE ntt; | |
1207 /* | |
1208 * Algorithm type. | |
1209 */ | |
1210 UBYTE algo_type; | |
1211 /* | |
1212 * The first PCOMP value needed for Van Jacobson. | |
1213 */ | |
1214 UBYTE pcomp1; | |
1215 /* | |
1216 * The second PCOMP value needed for Van Jacobson. | |
1217 */ | |
1218 UBYTE pcomp2; | |
1219 /* | |
1220 * Applicable nsapis set? | |
1221 */ | |
1222 BOOL nsapis_set; | |
1223 /* | |
1224 * Applicable nsapis (bit mask); | |
1225 */ | |
1226 USHORT nsapis; | |
1227 /* | |
1228 * Direction. (Note: only for internal purposes, | |
1229 * not included in XID block) | |
1230 */ | |
1231 UBYTE direction; | |
1232 /* | |
1233 * Number of state slots minus set? | |
1234 */ | |
1235 UBYTE s0_m_1_set; | |
1236 /* | |
1237 * Number of state slots minus 1. | |
1238 */ | |
1239 UBYTE s0_m_1; | |
1240 | |
1241 } T_XID_VJ_BLOCK; | |
1242 | |
1243 typedef struct /* T_XID_BLOCK */ | |
1244 { | |
1245 BOOL version_set; | |
1246 UBYTE version; | |
1247 T_XID_V42_BLOCK v42; | |
1248 T_XID_VJ_BLOCK vj; | |
1249 } T_XID_BLOCK; | |
1250 | |
1251 | |
1252 /* | |
1253 * This is used to buffer N-PDUs in service nu. | |
1254 * | |
1255 * Instances of this struct are added to a dynamic list: | |
1256 */ | |
1257 typedef struct t /* T_NPDU_BUFFER */ | |
1258 { | |
1259 struct t* next; | |
1260 T_SN_DATA_REQ* sn_data_req; | |
1261 UBYTE npdu_number; | |
1262 } T_NPDU_BUFFER; | |
1263 | |
1264 /* | |
1265 * This is used to store information about segmented N-PDUs in service sua: | |
1266 * One T_SEG_INFO entry is for 1 segmented N-PDU. | |
1267 * a. How many segments have been sent from 1 N-PDU? | |
1268 * b. Which of these segments have been confirmed by the peer? | |
1269 * c. What is the "reference" struct? | |
1270 * d. Who is the affected NSAPI? | |
1271 * | |
1272 * Instances of this struct are added to a dynamic list: | |
1273 */ | |
1274 typedef struct tt /* T_SEG_INFO */ | |
1275 { | |
1276 struct tt* next; | |
1277 UBYTE number_of_segments; | |
1278 /* | |
1279 * An array of bit flags for 32 possible segments per N-PDU; | |
1280 * This restricts number of segments to 32. | |
1281 */ | |
1282 ULONG cnf_segments; | |
1283 UBYTE npdu_number; | |
1284 UBYTE nsapi; | |
1285 } T_SEG_INFO; | |
1286 | |
1287 /* | |
1288 * Constants and bit-masks used by header compression algorithm | |
1289 */ | |
1290 #define TH_FIN 0x01 /* FIN-Bit Mask */ | |
1291 #define TH_SYN 0x02 /* SYN-Bit Mask */ | |
1292 #define TH_RST 0x04 /* RST-Bit Mask */ | |
1293 #define TH_PUSH 0x08 /* PSH-Bit Mask */ | |
1294 #define TH_ACK 0x10 /* ACK-Bit Mask */ | |
1295 #define TH_URG 0x20 /* URG-Bit Mask */ | |
1296 #define TH_FLAGS (TH_FIN|TH_SYN|TH_RST|TH_ACK|TH_URG) | |
1297 #define TCP_PUSH_BIT 0x10 /* PUSH-Bit Mask */ | |
1298 | |
1299 /* Bits in first octet of compressed packet, for what changed in a packet */ | |
1300 #define NEW_C 0x40 | |
1301 #define NEW_I 0x20 | |
1302 #define NEW_S 0x08 | |
1303 #define NEW_A 0x04 | |
1304 #define NEW_W 0x02 | |
1305 #define NEW_U 0x01 | |
1306 | |
1307 /* reserved, special-case values */ | |
1308 /* echoed interactive traffic */ | |
1309 #define SPECIAL_I (NEW_S|NEW_W|NEW_U) | |
1310 /* unidirectional data */ | |
1311 #define SPECIAL_D (NEW_S|NEW_A|NEW_W|NEW_U) | |
1312 #define SPECIALS_MASK (NEW_S|NEW_A|NEW_W|NEW_U) | |
1313 | |
1314 /* maximal change of values for sending compressed headers */ | |
1315 #define MAX_CHANGE 0xFFFE | |
1316 /* TCP-IP Protocol ID */ | |
1317 #define PROT_TCPIP 6 | |
1318 /* Position number of protocol type within a UBYTE buffer */ | |
1319 #define PR_TYPE_POS 9 | |
1320 /* Header Length Mask */ | |
1321 #define HL_MASK 0x0F | |
1322 /* tossing rcvd frames because of input err */ | |
1323 #define SLF_TOSS 1 | |
1324 /* Max. TCP/IP header length should really be 128 */ | |
1325 #define MAX_HDR_LEN 128 | |
1326 #define TMP_HDR_LEN 168 | |
1327 #define MAX_STATES SNDCP_MAX_NUMBER_OF_VJ_SLOTS | |
1328 | |
1329 /* packet types as defined in RFC 1144 */ | |
1330 #define TYPE_IP 0x40 | |
1331 #define TYPE_UNCOMPRESSED_TCP 0x70 | |
1332 #define TYPE_COMPRESSED_TCP 0x80 | |
1333 #define TYPE_ERROR 0x00 | |
1334 | |
1335 /* | |
1336 * "state" data for each active tcp conversation on the wire. This is | |
1337 * basically a copy of the entire IP/TCP header from the last packet | |
1338 * we saw from the conversation together with a small identifier | |
1339 * the transmit & receive ends of the line use to locate saved header. | |
1340 */ | |
1341 struct cstate { | |
1342 struct cstate *cs_next; /* next most recently used cstate (xmit only) */ | |
1343 USHORT cs_hlen; /* size of hdr (receive only) */ | |
1344 UBYTE cs_id; /* connection # associated with this state */ | |
1345 UBYTE cs_filler; | |
1346 UBYTE cs_hdr[MAX_HDR_LEN]; /* ip/tcp hdr from most recent packet */ | |
1347 T_SNDCP_IP_HEADER *cs_ip; /* ptr to ip/tcp hdr from most recent packet */ | |
1348 }; | |
1349 | |
1350 /* | |
1351 * all the state data for one serial line (we need one of these per line). | |
1352 */ | |
1353 struct slcompress { | |
1354 /* most recently used tstate */ | |
1355 struct cstate *last_cs; | |
1356 /* last rcvd conn. id */ | |
1357 UBYTE last_recv; | |
1358 /* last sent conn. id */ | |
1359 UBYTE last_xmit; | |
1360 USHORT flags; | |
1361 /* xmit connection states */ | |
1362 struct cstate tstate[MAX_STATES]; | |
1363 /* receive connection states */ | |
1364 struct cstate rstate[MAX_STATES]; | |
1365 /* buffer to store temporary received ip/tcp header */ | |
1366 UBYTE tcpip_hdr[TMP_HDR_LEN]; | |
1367 USHORT slots_to_use; | |
1368 }; | |
1369 | |
1370 /* | |
1371 * A struct comp_buf is used in the call cia_comp_vj and cia_decomp_vj because | |
1372 * that routine needs to modify both the start address and length if the | |
1373 * incoming packet is compressed/decompressed | |
1374 */ | |
1375 struct comp_buf { | |
1376 /* length of complete packet */ | |
1377 USHORT pack_len; | |
1378 /* length of header + some data passed to comp/decomp routine */ | |
1379 USHORT hdr_len; | |
1380 /* pointer to start of packet */ | |
1381 ULONG c_hdr; | |
1382 /* packet type */ | |
1383 UBYTE p_type; | |
1384 UBYTE filler; | |
1385 USHORT filler1; | |
1386 }; | |
1387 | |
1388 | |
1389 | |
1390 typedef struct /* T_CIA_DATA */ | |
1391 { | |
1392 UBYTE state; | |
1393 /* | |
1394 * Required for state traces. | |
1395 */ | |
1396 #ifndef NTRACE | |
1397 char *name; | |
1398 char *state_name; | |
1399 #endif | |
1400 /* | |
1401 * Copy of mg.cur_xid_block. | |
1402 */ | |
1403 T_XID_BLOCK cur_xid_block; | |
1404 | |
1405 /* | |
1406 * all the state data for one serial line | |
1407 */ | |
1408 struct slcompress comp; | |
1409 | |
1410 #ifdef SNDCP_TRACE_ALL | |
1411 SHORT cia_decomp_ind_number[SNDCP_NUMBER_OF_NSAPIS]; | |
1412 #endif | |
1413 #ifdef TI_PS_FF_V42BIS | |
1414 T_V42B_DICO* enc; | |
1415 T_V42B_DICO* dec; | |
1416 U16 trabu[1500]; | |
1417 #endif /* TI_PS_FF_V42BIS */ | |
1418 /* | |
1419 * Currently assembled unacknowledged N-PDU downlink. | |
1420 */ | |
1421 T_CIA_DECOMP_IND* cur_cia_decomp_ind[SNDCP_NUMBER_OF_NSAPIS]; | |
1422 | |
1423 } T_CIA_DATA; | |
1424 | |
1425 | |
1426 typedef struct /* T_MG_DATA */ | |
1427 { | |
1428 UBYTE state; | |
1429 /* | |
1430 * Required for state traces. | |
1431 */ | |
1432 #ifndef NTRACE | |
1433 char *name; | |
1434 char *state_name; | |
1435 #endif | |
1436 /* | |
1437 * XID parameters that show what the user requested. | |
1438 */ | |
1439 T_XID_BLOCK user_xid_block [SNDCP_NUMBER_OF_NSAPIS]; | |
1440 /* | |
1441 * XID parameters that are sent with LL_XID_REQ or LL_ESTABLISH_REQ. | |
1442 */ | |
1443 T_XID_BLOCK req_xid_block [SNDCP_NUMBER_OF_SAPIS]; | |
1444 /* | |
1445 * Confirmed XID parameters. | |
1446 */ | |
1447 T_XID_BLOCK cnf_xid_block [SNDCP_NUMBER_OF_SAPIS]; | |
1448 /* | |
1449 * Indicated XID parameters. | |
1450 */ | |
1451 T_XID_BLOCK ind_xid_block [SNDCP_NUMBER_OF_SAPIS]; | |
1452 /* | |
1453 * Responded XID parameters. | |
1454 */ | |
1455 T_XID_BLOCK res_xid_block [SNDCP_NUMBER_OF_SAPIS]; | |
1456 /* | |
1457 * Currently used XID parameters. | |
1458 */ | |
1459 T_XID_BLOCK cur_xid_block [SNDCP_NUMBER_OF_SAPIS]; | |
1460 /* | |
1461 * XID parameters that have not yet been requested, but are now needed, | |
1462 * e.g. when an establishment is pending and another SNSM_ACTIVATE_IND | |
1463 * comes in with compression required. | |
1464 */ | |
1465 T_XID_BLOCK new_xid_block [SNDCP_NUMBER_OF_SAPIS]; | |
1466 /* | |
1467 * index: sapi + data compression entity number, elements: state; | |
1468 * indicates the state of the given entity, one of MG_UNASSIGNED, | |
1469 * MG_SELECTED, MG_ASSIGNED UBYTE . | |
1470 */ | |
1471 UBYTE sapi_dntt_state_ra [SNDCP_NUMBER_OF_SAPIS][MG_MAX_ENTITIES]; | |
1472 /* index: sapi + header compression entity number, elements: state; | |
1473 * indicates the state of the given entity, one of MG_UNASSIGNED, | |
1474 * MG_SELECTED, MG_ASSIGNED UBYTE . | |
1475 */ | |
1476 UBYTE sapi_pntt_state_ra [SNDCP_NUMBER_OF_SAPIS][MG_MAX_ENTITIES]; | |
1477 /* | |
1478 * index: sapi + data compression entity number + nsapi, | |
1479 * elements: is nsapi conneted to given entity?; | |
1480 * indicates whether the NSAPI uses the given entity on the given SAPI. | |
1481 */ | |
1482 BOOL sapi_dntt_nsapi_set_ra [SNDCP_NUMBER_OF_SAPIS] | |
1483 [MG_MAX_ENTITIES] | |
1484 [SNDCP_NUMBER_OF_NSAPIS]; | |
1485 /* | |
1486 * index: sapi + header compression entity number + nsapi, | |
1487 * elements: is nsapi conneted to given entity?; | |
1488 * indictes whether the NSAPI uses the given entity on the given SAPI. | |
1489 */ | |
1490 BOOL sapi_pntt_nsapi_set_ra [SNDCP_NUMBER_OF_SAPIS] | |
1491 [MG_MAX_ENTITIES] | |
1492 [SNDCP_NUMBER_OF_NSAPIS]; | |
1493 /* | |
1494 * index: sapi + dcomp value, elements: state; | |
1495 * indicates the state of the given dcomp value, one of MG_UNASSIGNED, | |
1496 * MG_SELECTED, MG_ASSIGNED UBYTE . | |
1497 */ | |
1498 UBYTE sapi_dcomp_state_ra [SNDCP_NUMBER_OF_SAPIS][MG_MAX_DCOMP]; | |
1499 /* | |
1500 * index: sapi + pcomp value, elements: state; | |
1501 * indicates the state of the given pcomp value, one of MG_UNASSIGNED, | |
1502 * MG_SELECTED, MG_ASSIGNED UBYTE . | |
1503 */ | |
1504 UBYTE sapi_pcomp_state_ra [SNDCP_NUMBER_OF_SAPIS][MG_MAX_PCOMP]; | |
1505 /* | |
1506 * index: sapi + dcomp value, elements: data compression entity number; | |
1507 * indicates the entity to which the given dcomp value in the given SAPi | |
1508 * is assigned. | |
1509 */ | |
1510 UBYTE sapi_dcomp_dntt_ra [SNDCP_NUMBER_OF_SAPIS][MG_MAX_DCOMP]; | |
1511 /* | |
1512 * index: sapi + pcomp value, elements: header compression entity number; | |
1513 * indicates the entity to which the given pcomp value in the given SAPi | |
1514 * is assigned. | |
1515 */ | |
1516 UBYTE sapi_pcomp_pntt_ra [SNDCP_NUMBER_OF_SAPIS][MG_MAX_PCOMP]; | |
1517 /* | |
1518 * index: sapi, elements: number of renegotiations; | |
1519 */ | |
1520 UBYTE renego [SNDCP_NUMBER_OF_SAPIS]; | |
1521 /* | |
1522 * index: sapi + dntt value, elements: will the ntt be rejected? | |
1523 * For entities that are proposed by the network but cannot be set up. | |
1524 */ | |
1525 BOOL sapi_dntt_rej_ra [SNDCP_NUMBER_OF_SAPIS][MG_MAX_ENTITIES]; | |
1526 /* | |
1527 * index: sapi + dntt value, elements: will the ntt be rejected? | |
1528 * For entities that are proposed by the network but cannot be set up. | |
1529 */ | |
1530 BOOL sapi_pntt_rej_ra [SNDCP_NUMBER_OF_SAPIS][MG_MAX_ENTITIES]; | |
1531 /* | |
1532 * What is expected in the course of a context modification? | |
1533 * Possible values: MG_MOD_X_NONE, MG_MOD_X_REL, MG_MOD_X_EST, MOD_X_READY. | |
1534 */ | |
1535 UBYTE mod_expects; | |
1536 /* | |
1537 * Bit_mask for all nsapis waiting with snsm_modify_res for est | |
1538 * and/or rel. | |
1539 */ | |
1540 USHORT waiting_nsapis; | |
1541 /* | |
1542 * Bit_mask for all nsapis currently suspended. | |
1543 */ | |
1544 USHORT suspended_nsapis; | |
1545 | |
1546 } T_MG_DATA; | |
1547 | |
1548 | |
1549 typedef struct /* T_NU_DATA */ | |
1550 { | |
1551 UBYTE state; | |
1552 /* | |
1553 * Required for state traces. | |
1554 */ | |
1555 #ifndef NTRACE | |
1556 char *name; | |
1557 char *state_name; | |
1558 #endif | |
1559 /* | |
1560 * the affected nsapi | |
1561 */ | |
1562 UBYTE nsapi; | |
1563 /* | |
1564 * The Send N-PDU number for unacknowledged data transfer. | |
1565 */ | |
1566 USHORT send_npdu_number_unack; | |
1567 /* | |
1568 * The Send N-PDU number for acknowledged data transfer. | |
1569 */ | |
1570 UBYTE send_npdu_number_ack; | |
1571 /* | |
1572 * The Receive N-PDU number for unacknowledged data transfer. | |
1573 */ | |
1574 UBYTE rec_npdu_number_ack; | |
1575 /* | |
1576 * Here the sent N-PDUs are stored. | |
1577 */ | |
1578 T_NPDU_BUFFER* first_buffered_npdu; | |
1579 /* | |
1580 * This is the next npdu buffer to be resent. | |
1581 */ | |
1582 T_NPDU_BUFFER* next_resend; | |
1583 /* | |
1584 * Is an SN_READY_IND pending? | |
1585 */ | |
1586 BOOL sn_ready_ind_pending; | |
1587 /* | |
1588 * Is an SN_UNITREADY_IND pending? | |
1589 */ | |
1590 BOOL sn_unitready_ind_pending; | |
1591 /* | |
1592 * Is an SN_SWITCH_CNF expected? | |
1593 */ | |
1594 BOOL sn_switch_cnf_expected; | |
1595 #ifdef SNDCP_UPM_INCLUDED | |
1596 /* | |
1597 * Is an SN_DTI_CNF expected? | |
1598 */ | |
1599 BOOL sn_dti_cnf_expected; | |
1600 #endif /* SNDCP_UPM_INCLUDED */ | |
1601 /* | |
1602 * Is DTI connection opened? | |
1603 */ | |
1604 BOOL connection_is_opened; | |
1605 /* | |
1606 * This flag indicates if config prim "DISCARD" or "RESUME" | |
1607 * for certain NSAPI was received. TRUE means "DISCARD" was received. | |
1608 * FALSE is the default state and will be set if "RESUME" was received. | |
1609 */ | |
1610 BOOL discard; | |
1611 | |
1612 /* | |
1613 * This variables are needed for statistics showing how much data was | |
1614 * discarded and how much sent. | |
1615 */ | |
1616 ULONG sent_data; | |
1617 ULONG discarded_data; | |
1618 | |
1619 } T_NU_DATA; | |
1620 | |
1621 | |
1622 typedef struct /* T_SU_DATA */ | |
1623 { | |
1624 UBYTE state; | |
1625 /* | |
1626 * Required for state traces. | |
1627 */ | |
1628 #ifndef NTRACE | |
1629 char *name; | |
1630 char *state_name; | |
1631 #endif | |
1632 /* | |
1633 * The affected sapi. | |
1634 */ | |
1635 UBYTE sapi; | |
1636 /* | |
1637 * The max segment size for unacknowledged data transfer. | |
1638 */ | |
1639 USHORT n201_u; | |
1640 /* | |
1641 * An array with one T_SN_UNITDATA_REQ* per NSAPI. It is ensured by the flow | |
1642 * control with service nu that only one sn_unitdata_req per nsapi may be | |
1643 * present. This array works like a queue with a read and a write pointer. | |
1644 */ | |
1645 T_SN_UNITDATA_REQ* sn_unitdata_q [SN_UNITDATA_Q_LEN]; | |
1646 /* | |
1647 * An array with the N-PDU numbers for the above sn_unitdata_req primitives. | |
1648 */ | |
1649 USHORT npdu_number_q [SN_UNITDATA_Q_LEN]; | |
1650 /* | |
1651 * The read pointer for sn_unitdata_q. | |
1652 */ | |
1653 UBYTE sn_unitdata_q_read; | |
1654 /* | |
1655 * The write pointer for sn_unitdata_q. | |
1656 */ | |
1657 UBYTE sn_unitdata_q_write; | |
1658 #ifdef _SNDCP_DTI_2_ | |
1659 /* | |
1660 * An Array with a number of T_LL_UNITDESC_REQ* to store all segments of | |
1661 * 1 N-PDU after they have been received from cia. | |
1662 */ | |
1663 T_LL_UNITDESC_REQ* ll_unitdesc_q [SNDCP_SEGMENT_NUMBERS_UNACK]; | |
1664 /* | |
1665 * The read pointer for ll_unitdesc_q. | |
1666 */ | |
1667 U8 ll_unitdesc_q_read; | |
1668 /* | |
1669 * The write pointer for ll_unitdesc_q. | |
1670 */ | |
1671 U8 ll_unitdesc_q_write; | |
1672 #else /* _SNDCP_DTI_2_ */ | |
1673 /* | |
1674 * An Array with a number of T_LL_UNITDATA_REQ* to store all segments of | |
1675 * 1 N-PDU after they have been received from cia. | |
1676 */ | |
1677 T_LL_UNITDATA_REQ* ll_unitdata_q [SNDCP_SEGMENT_NUMBERS_UNACK]; | |
1678 /* | |
1679 * The read pointer for ll_unitdata_q. | |
1680 */ | |
1681 UBYTE ll_unitdata_q_read; | |
1682 /* | |
1683 * The write pointer for ll_unitdata_q. | |
1684 */ | |
1685 UBYTE ll_unitdata_q_write; | |
1686 #endif /* _SNDCP_DTI_2_ */ | |
1687 | |
1688 /* | |
1689 * In what state is cia? | |
1690 * Set to CIA_IDLE at init time and when last segment of N-PDU has been sent | |
1691 * to LLC. | |
1692 * Set to CIA_BUSY whenever sig_su_cia_cia_comp_req is sent. | |
1693 */ | |
1694 UBYTE cia_state; | |
1695 } T_SU_DATA; | |
1696 | |
1697 typedef struct /* T_SUA_DATA */ | |
1698 { | |
1699 UBYTE state; | |
1700 /* | |
1701 * Required for state traces. | |
1702 */ | |
1703 #ifndef NTRACE | |
1704 char *name; | |
1705 char *state_name; | |
1706 #endif | |
1707 /* | |
1708 * The affected sapi. | |
1709 */ | |
1710 UBYTE sapi; | |
1711 /* | |
1712 * The max segment size for acknowledged data transfer. | |
1713 */ | |
1714 USHORT n201_i; | |
1715 /* | |
1716 * An array with one T_SN_DATA_REQ* per NSAPI. It is ensured by the flow | |
1717 * control with service nu that only one sn_data_req per nsapi may be | |
1718 * present. This array works like a queue with a read and a write pointer. | |
1719 */ | |
1720 T_SN_DATA_REQ* sn_data_q [SN_DATA_Q_LEN]; | |
1721 /* | |
1722 * An array with the N-PDU numbers for the above sn_data_req primitives. | |
1723 */ | |
1724 UBYTE npdu_number_q [SN_DATA_Q_LEN]; | |
1725 /* | |
1726 * The read pointer for sn_data_q. | |
1727 */ | |
1728 UBYTE sn_data_q_read; | |
1729 /* | |
1730 * The write pointer for sn_data_q. | |
1731 */ | |
1732 UBYTE sn_data_q_write; | |
1733 /* | |
1734 * Information about the outgoing segments, first element in dynamic list. | |
1735 */ | |
1736 T_SEG_INFO* first_seg_info; | |
1737 #ifdef _SNDCP_DTI_2_ | |
1738 /* | |
1739 * An Array with a number of T_LL_DESC_REQ* to store all | |
1740 * segments of 1 N-PDU after they have been received from cia. | |
1741 */ | |
1742 T_LL_DESC_REQ* ll_desc_q [SNDCP_SEGMENT_NUMBERS_ACK]; | |
1743 /* | |
1744 * The read pointer for ll_desc_q. | |
1745 */ | |
1746 U8 ll_desc_q_read; | |
1747 /* | |
1748 * The write pointer for ll_desc_q. | |
1749 */ | |
1750 U8 ll_desc_q_write; | |
1751 #else /* _SNDCP_DTI_2_ */ | |
1752 /* | |
1753 * An Array with a number of T_LL_DATA_REQ* to store all | |
1754 * segments of 1 N-PDU after they have been received from cia. | |
1755 */ | |
1756 T_LL_DATA_REQ* ll_data_q [SNDCP_SEGMENT_NUMBERS_ACK]; | |
1757 /* | |
1758 * The read pointer for ll_data_q. | |
1759 */ | |
1760 UBYTE ll_data_q_read; | |
1761 /* | |
1762 * The write pointer for ll_data_q. | |
1763 */ | |
1764 UBYTE ll_data_q_write; | |
1765 #endif /* _SNDCP_DTI_2_ */ | |
1766 /* | |
1767 * In what state is cia? | |
1768 * Set to CIA_IDLE at init time and when last segment of N-PDU has been sent | |
1769 * to LLC. | |
1770 * Set to CIA_BUSY whenever sig_sua_cia_cia_comp_req is sent. | |
1771 */ | |
1772 UBYTE cia_state; | |
1773 } T_SUA_DATA; | |
1774 | |
1775 | |
1776 | |
1777 typedef struct /* T_ND_DATA */ | |
1778 { | |
1779 UBYTE state; | |
1780 /* | |
1781 * Required for state traces. | |
1782 */ | |
1783 #ifndef NTRACE | |
1784 char *name; | |
1785 char *state_name; | |
1786 #endif | |
1787 /* | |
1788 * the affected nsapi | |
1789 */ | |
1790 UBYTE nsapi; | |
1791 /* | |
1792 * Receive npdu number for recovery state. | |
1793 */ | |
1794 UBYTE npdu_num; | |
1795 } T_ND_DATA; | |
1796 | |
1797 typedef struct /* T_PD_DATA */ | |
1798 { | |
1799 UBYTE state; | |
1800 /* | |
1801 * Required for state traces. | |
1802 */ | |
1803 #ifndef NTRACE | |
1804 char *name; | |
1805 char *state_name; | |
1806 #endif | |
1807 /* | |
1808 * the affected sapi | |
1809 */ | |
1810 UBYTE sapi; | |
1811 } T_PD_DATA; | |
1812 | |
1813 typedef struct /* T_PDA_DATA */ | |
1814 { | |
1815 UBYTE state; | |
1816 /* | |
1817 * Required for state traces. | |
1818 */ | |
1819 #ifndef NTRACE | |
1820 char *name; | |
1821 char *state_name; | |
1822 #endif | |
1823 /* | |
1824 * the affected sapi | |
1825 */ | |
1826 UBYTE sapi; | |
1827 } T_PDA_DATA; | |
1828 | |
1829 | |
1830 typedef struct /* T_SD_DATA */ | |
1831 { | |
1832 UBYTE state; | |
1833 /* | |
1834 * Required for state traces. | |
1835 */ | |
1836 #ifndef NTRACE | |
1837 char *name; | |
1838 char *state_name; | |
1839 #endif | |
1840 /* | |
1841 * the affected sapi | |
1842 */ | |
1843 UBYTE sapi; | |
1844 /* | |
1845 * TRUE if an LL_GETUNITDATA_REQ is pending, FALSE else | |
1846 */ | |
1847 BOOL llc_may_send; | |
1848 /* | |
1849 * The SN_UNITDATA_IND that iscurrently being assembled. | |
1850 */ | |
1851 T_SN_UNITDATA_IND* cur_sn_unitdata_ind[SNDCP_NUMBER_OF_NSAPIS]; | |
1852 /* | |
1853 * Is the affected NSAPI receptive? | |
1854 */ | |
1855 BOOL nsapi_rec_ra[SNDCP_NUMBER_OF_NSAPIS]; | |
1856 | |
1857 } T_SD_DATA; | |
1858 | |
1859 typedef struct /* T_SDA_DATA */ | |
1860 { | |
1861 UBYTE state; | |
1862 /* | |
1863 * Required for state traces. | |
1864 */ | |
1865 #ifndef NTRACE | |
1866 char *name; | |
1867 char *state_name; | |
1868 #endif | |
1869 /* | |
1870 * the affected sapi | |
1871 */ | |
1872 UBYTE sapi; | |
1873 /* | |
1874 * TRUE if an LL_GETDATA_REQ is pending, FALSE else | |
1875 */ | |
1876 BOOL llc_may_send; | |
1877 /* | |
1878 * The SN_DATA_IND that iscurrently being assembled. | |
1879 */ | |
1880 T_SN_DATA_IND* cur_sn_data_ind[SNDCP_NUMBER_OF_NSAPIS]; | |
1881 /* | |
1882 * Is the affected NSAPI receptive? | |
1883 */ | |
1884 BOOL nsapi_rec_ra[SNDCP_NUMBER_OF_NSAPIS]; | |
1885 /* | |
1886 * The N-PDU number of the current uncompressed N-PDU. | |
1887 */ | |
1888 UBYTE uncomp_npdu_num; | |
1889 | |
1890 } T_SDA_DATA; | |
1891 | |
1892 | |
1893 | |
1894 | |
1895 typedef struct /* T_SNDCP_DATA */ | |
1896 { | |
1897 | |
1898 | |
1899 /* | |
1900 * Entity global arrays for organizing purposes | |
1901 */ | |
1902 | |
1903 /* | |
1904 * index: nsapi, elements: qos; | |
1905 * indicating the quality of service for the given NSAPI. | |
1906 */ | |
1907 T_snsm_qos nsapi_qos_ra[SNDCP_NUMBER_OF_NSAPIS]; | |
1908 | |
1909 /* | |
1910 * index: nsapi, elements: flags; | |
1911 * indicating whether the given NSAPI (0..15) is currently in use or not. | |
1912 */ | |
1913 BOOL nsapi_used_ra[SNDCP_NUMBER_OF_NSAPIS]; | |
1914 | |
1915 /* | |
1916 * index: nsapi, elements: flags; | |
1917 * indicating the sapi that is used by a certain nsapi. | |
1918 */ | |
1919 UBYTE nsapi_sapi_ra[SNDCP_NUMBER_OF_NSAPIS]; | |
1920 | |
1921 /* | |
1922 * index: nsapi, elements: the radio priority to be used in lower layers; | |
1923 * indicating the radio priority to be used in LL_(UNIT-)DATA_REQ prims. | |
1924 */ | |
1925 UBYTE nsapi_prio_ra[SNDCP_NUMBER_OF_NSAPIS]; | |
1926 | |
1927 #ifdef REL99 | |
1928 /* | |
1929 * index: nsapi, elements: the packet flwo identifier to be used in lower layers; | |
1930 * indicating the packet flwo identifier to be used in LL_(UNIT-)DATA_REQ prims. | |
1931 */ | |
1932 U16 nsapi_pktflowid_ra[SNDCP_NUMBER_OF_NSAPIS]; | |
1933 #endif /*REL99*/ | |
1934 | |
1935 /* | |
1936 * index: sapi, elements: LLC acknowledged? | |
1937 * indicating acknowledged (TRUE) or unacknowledged (FALSE) LLC operation | |
1938 * mode of the given LLC SAPI. | |
1939 */ | |
1940 BOOL sapi_ack_ra[SNDCP_NUMBER_OF_SAPIS]; | |
1941 | |
1942 /* | |
1943 * index: nsapi, elements: LLC acknowledged? | |
1944 * indicating acknowledged (TRUE) or unacknowledged (FALSE) LLC operation | |
1945 * mode of the given NSAPI. | |
1946 */ | |
1947 BOOL nsapi_ack_ra[SNDCP_NUMBER_OF_NSAPIS]; | |
1948 | |
1949 /* | |
1950 * index: sapi, elements: the state; | |
1951 * indicating one of MG_EST, MG_REL etc... | |
1952 */ | |
1953 USHORT sapi_state_ra[SNDCP_NUMBER_OF_SAPIS]; | |
1954 | |
1955 /* | |
1956 * index: nsapi, elements: the state; | |
1957 * indicating one of MG_EST, MG_REL etc... | |
1958 */ | |
1959 USHORT nsapi_state_ra[SNDCP_NUMBER_OF_NSAPIS]; | |
1960 | |
1961 /* | |
1962 * How many Van Jacobson compressors have been set up? | |
1963 * Must not be bigger than SNDCP_MAX_VJ_COUNT. | |
1964 */ | |
1965 UBYTE vj_count; | |
1966 /* | |
1967 * SNDCP sends an LL_XID_REQ at each context activation. | |
1968 * This may switched off by setting this variable to FALSE. | |
1969 */ | |
1970 BOOL always_xid; | |
1971 | |
1972 #ifndef NCONFIG | |
1973 /* | |
1974 * In case of config primitive SEND_UNITDATA this variable indicates the | |
1975 * number of octets to be sent. | |
1976 */ | |
1977 U32 data_count[SNDCP_NUMBER_OF_NSAPIS]; | |
1978 /* | |
1979 * Number of milliseconds to delay each SSM_ACTIVATE_IND after config prim DELAY. | |
1980 */ | |
1981 USHORT millis; | |
1982 #endif | |
1983 | |
1984 | |
1985 #define _SNDCP_MEAN_TRACE_ | |
1986 #ifdef _SNDCP_MEAN_TRACE_ | |
1987 /* | |
1988 * Used for tracing mean throughput up and down SN SAP. | |
1989 */ | |
1990 /* | |
1991 * Time in ms. | |
1992 */ | |
1993 T_TIME start_time_uplink_ack [SNDCP_NUMBER_OF_NSAPIS]; | |
1994 T_TIME start_time_uplink_unack [SNDCP_NUMBER_OF_NSAPIS]; | |
1995 T_TIME start_time_downlink_ack [SNDCP_NUMBER_OF_NSAPIS]; | |
1996 T_TIME start_time_downlink_unack [SNDCP_NUMBER_OF_NSAPIS]; | |
1997 | |
1998 T_TIME cur_time_uplink_ack [SNDCP_NUMBER_OF_NSAPIS]; | |
1999 T_TIME cur_time_uplink_unack [SNDCP_NUMBER_OF_NSAPIS]; | |
2000 T_TIME cur_time_downlink_ack [SNDCP_NUMBER_OF_NSAPIS]; | |
2001 T_TIME cur_time_downlink_unack [SNDCP_NUMBER_OF_NSAPIS]; | |
2002 | |
2003 /* | |
2004 * Number of transferred octets. | |
2005 * Skipped octets after config prim DISCARD are skipped. | |
2006 */ | |
2007 ULONG cur_num_uplink_ack [SNDCP_NUMBER_OF_NSAPIS]; | |
2008 ULONG cur_num_uplink_unack [SNDCP_NUMBER_OF_NSAPIS]; | |
2009 ULONG cur_num_downlink_ack [SNDCP_NUMBER_OF_NSAPIS]; | |
2010 ULONG cur_num_downlink_unack [SNDCP_NUMBER_OF_NSAPIS]; | |
2011 | |
2012 /* | |
2013 * Number of transferred packets. | |
2014 * Skipped packets after config prim DISCARD are skipped. | |
2015 */ | |
2016 ULONG cur_pac_uplink_ack [SNDCP_NUMBER_OF_NSAPIS]; | |
2017 ULONG cur_pac_uplink_unack [SNDCP_NUMBER_OF_NSAPIS]; | |
2018 ULONG cur_pac_downlink_ack [SNDCP_NUMBER_OF_NSAPIS]; | |
2019 ULONG cur_pac_downlink_unack [SNDCP_NUMBER_OF_NSAPIS]; | |
2020 | |
2021 /* | |
2022 * Direction and ack_mode parameters. | |
2023 */ | |
2024 #define SNDCP_MEAN_UP 1 | |
2025 #define SNDCP_MEAN_DOWN 2 | |
2026 #define SNDCP_MEAN_ACK 3 | |
2027 #define SNDCP_MEAN_UNACK 4 | |
2028 | |
2029 #endif /* _SNDCP_MEAN_TRACE_ */ | |
2030 | |
2031 #ifndef SNDCP_UPM_INCLUDED | |
2032 #define SNDCP_INTERFACE_ACK 1 | |
2033 #endif | |
2034 #define SNDCP_INTERFACE_UNACK 0 | |
2035 | |
2036 #ifdef _SNDCP_DTI_2_ | |
2037 DTI_HANDLE hDTI; | |
2038 #else /* _SNDCP_DTI_2_*/ | |
2039 DTI_HANDLE* hDTI; | |
2040 #endif /* _SNDCP_DTI_2_*/ | |
2041 | |
2042 | |
2043 | |
2044 | |
2045 U32 nsapi_linkid_ra [SNDCP_NUMBER_OF_NSAPIS]; | |
2046 U8* nsapi_neighbor_ra [SNDCP_NUMBER_OF_NSAPIS]; | |
2047 U8 nsapi_interface_ra [SNDCP_NUMBER_OF_NSAPIS]; | |
2048 /* | |
2049 * Possible values from dti.h: HOME or NEIGHBOR | |
2050 * Do not use SN or SNSM values. | |
2051 */ | |
2052 BOOL nsapi_direction_ra [SNDCP_NUMBER_OF_NSAPIS]; | |
2053 | |
2054 #ifdef FLOW_TRACE | |
2055 BOOL flow_control_ra [5][2][2]; | |
2056 #endif /* FLOW_TRACE */ | |
2057 | |
2058 /* | |
2059 * Service data structures | |
2060 * | |
2061 * Services with multiple incarnations require an array of structures | |
2062 * named xxx_base[] with xxx = service abbrevation, and additionally a | |
2063 * pointer named *xxx, which will be accessed instead of xxx_base. | |
2064 * | |
2065 * Services with only one incarnation just have to declare one structure | |
2066 * named xxx (no need for xxx_base[] and *xxx). | |
2067 * | |
2068 * The differentiation between the two access possibilites is made with | |
2069 * the defines of the service names above (SNDCP_SERVICE_XXX). | |
2070 */ | |
2071 T_CIA_DATA cia; | |
2072 | |
2073 T_MG_DATA mg; | |
2074 | |
2075 T_PD_DATA pd_base[SD_NUM_INC]; | |
2076 T_PD_DATA *pd; | |
2077 | |
2078 T_PDA_DATA pda_base[SD_NUM_INC]; | |
2079 T_PDA_DATA *pda; | |
2080 | |
2081 T_NU_DATA nu_base[NU_NUM_INC]; | |
2082 T_NU_DATA *nu; | |
2083 | |
2084 T_SU_DATA su_base[SU_NUM_INC]; | |
2085 T_SU_DATA *su; | |
2086 | |
2087 T_SUA_DATA sua_base[SUA_NUM_INC]; | |
2088 T_SUA_DATA *sua; | |
2089 | |
2090 T_ND_DATA nd_base[ND_NUM_INC]; | |
2091 T_ND_DATA *nd; | |
2092 | |
2093 T_SD_DATA sd_base[SD_NUM_INC]; | |
2094 T_SD_DATA *sd; | |
2095 | |
2096 T_SDA_DATA sda_base[SDA_NUM_INC]; | |
2097 T_SDA_DATA *sda; | |
2098 | |
2099 /* | |
2100 * Receiving states.(Regarding to 3GPP 04.65, capture 6.7.1.2) | |
2101 * index: NSAPI number, elements: SD/SDA receiving states relaiting to NSAPI. | |
2102 * One SAPI can receive SN-PDU's for diffent NSAPI's used currently on | |
2103 * this SAPI. In this case SD/SDA services have to have different receiving | |
2104 * states for each on this SAPI achtive NSAPI. | |
2105 */ | |
2106 UBYTE rec_states[SNDCP_NUMBER_OF_NSAPIS]; | |
2107 | |
2108 /* | |
2109 * Reference to pdu. | |
2110 */ | |
2111 T_pdu_ref cur_pdu_ref[SNDCP_NUMBER_OF_NSAPIS]; | |
2112 /* | |
2113 * The dcomp value in the first segment of the currently reassembled N-PDU. | |
2114 */ | |
2115 UBYTE cur_dcomp[SNDCP_NUMBER_OF_NSAPIS]; | |
2116 /* | |
2117 * The pcomp value in the first segment of the currently reassembled N-PDU. | |
2118 */ | |
2119 UBYTE cur_pcomp[SNDCP_NUMBER_OF_NSAPIS]; | |
2120 /* | |
2121 * First and/or last segment? | |
2122 */ | |
2123 UBYTE cur_seg_pos[SNDCP_NUMBER_OF_NSAPIS]; | |
2124 /* | |
2125 * Has the currently reassembled n-pdu a big header? | |
2126 */ | |
2127 BOOL big_head[SNDCP_NUMBER_OF_NSAPIS]; | |
2128 | |
2129 /* | |
2130 * Global variable indicating if the config primitive | |
2131 * TRACE_HEADER_ON has been received and the IP header | |
2132 * will be traced | |
2133 */ | |
2134 BOOL trace_ip_header; | |
2135 /* | |
2136 * Global variable indicating if the config primitive | |
2137 * TRACE_PACKET_ON has been received and the complete | |
2138 * IP packets (Header+Payload) will traced | |
2139 */ | |
2140 BOOL trace_ip_datagram; | |
2141 /* | |
2142 * Global variable indicating if the config primitive | |
2143 * TRACE_IP_BIN has been received and the complete | |
2144 * IP packets (Header+Payload) will be exported via BIN TRACE | |
2145 */ | |
2146 BOOL trace_ip_bin; | |
2147 /* | |
2148 * This flag indicates if IP filter is activated or not. Per default | |
2149 * the IP filter is disabled and the state is set to FALSE. | |
2150 * TRUE means "IP_FILTER_ON" was received and filter is activated. | |
2151 */ | |
2152 BOOL ip_filter; | |
2153 /* | |
2154 * This Counter indicates the Current Segment Number in single NPDU | |
2155 * which is being assembled currently. | |
2156 * This Counter Value is introduced to encounter the PARTITION | |
2157 * Problem which we may face when there are more than 100 segments in | |
2158 * one NPDU are received in downlink. | |
2159 */ | |
2160 U8 cur_segment_number[SNDCP_NUMBER_OF_NSAPIS]; | |
2161 | |
2162 /* Flag to indicate if flow control is received before NSAPI is used. | |
2163 * If the flow control is received the corresponding bit for the NSAPI | |
2164 * is set in the variable | |
2165 */ | |
2166 USHORT nsapi_rcv_rdy_b4_used; | |
2167 U8 nsapi; | |
2168 BOOL tcp_flow; | |
2169 } T_SNDCP_DATA; | |
2170 | |
2171 | |
2172 /*==== EXPORT =====================================================*/ | |
2173 | |
2174 /* | |
2175 * Entity data base | |
2176 */ | |
2177 #ifdef SNDCP_PEI_C | |
2178 T_SNDCP_DATA sndcp_data_base, *sndcp_data; | |
2179 #else | |
2180 EXTERN T_SNDCP_DATA sndcp_data_base, *sndcp_data; | |
2181 #endif | |
2182 | |
2183 #define ENTITY_DATA sndcp_data | |
2184 | |
2185 | |
2186 /* | |
2187 * Communication handles | |
2188 */ | |
2189 #define hCommMMI _ENTITY_PREFIXED(hCommMMI) | |
2190 | |
2191 #ifdef SNDCP_UPM_INCLUDED | |
2192 #define hCommUPM _ENTITY_PREFIXED(hCommUPM) | |
2193 #else | |
2194 #define hCommSM _ENTITY_PREFIXED(hCommSM) | |
2195 #endif /*#ifdef SNDCP_UPM_INCLUDED*/ | |
2196 | |
2197 #define hCommLLC _ENTITY_PREFIXED(hCommLLC) | |
2198 | |
2199 #ifdef SNDCP_PEI_C | |
2200 T_HANDLE hCommMMI = VSI_ERROR; | |
2201 /* T_HANDLE hCommSM = VSI_ERROR; */ | |
2202 #ifdef SNDCP_UPM_INCLUDED | |
2203 T_HANDLE hCommUPM = VSI_ERROR; | |
2204 #endif /*SNDCP_UPM_INCLUDED*/ | |
2205 T_HANDLE hCommLLC = VSI_ERROR; | |
2206 | |
2207 T_HANDLE SNDCP_handle; | |
2208 /* | |
2209 * make the pei_create function unique | |
2210 */ | |
2211 #define pei_create _ENTITY_PREFIXED(pei_create) | |
2212 | |
2213 | |
2214 #else | |
2215 EXTERN T_HANDLE hCommMMI; | |
2216 /*EXTERN T_HANDLE hCommSM; */ | |
2217 #ifdef SNDCP_UPM_INCLUDED | |
2218 EXTERN T_HANDLE hCommUPM; | |
2219 #endif | |
2220 EXTERN T_HANDLE hCommLLC; | |
2221 | |
2222 EXTERN T_HANDLE SNDCP_handle; | |
2223 | |
2224 #endif /* SNDCP_PEI_C */ | |
2225 | |
2226 | |
2227 #endif /* SNDCP_H */ |