FreeCalypso > hg > fc-selenite
comparison src/g23m-gprs/sndcp/sndcp_mgf.c @ 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 | Project : GPRS (8441) | |
| 4 | Modul : sndcp_mgf.c | |
| 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 | Purpose : This modul is part of the entity SNDCP and implements all | |
| 18 | procedures and functions as described in the | |
| 19 | SDL-documentation (MG-statemachine) | |
| 20 +----------------------------------------------------------------------------- | |
| 21 */ | |
| 22 | |
| 23 | |
| 24 #define ENTITY_SNDCP | |
| 25 | |
| 26 /*==== INCLUDES =============================================================*/ | |
| 27 | |
| 28 #include "typedefs.h" /* to get Condat data types */ | |
| 29 #include "vsi.h" /* to get a lot of macros */ | |
| 30 #include "macdef.h" | |
| 31 #include "gsm.h" /* to get a lot of macros */ | |
| 32 #include "prim.h" /* to get the definitions of used SAP and directions */ | |
| 33 | |
| 34 #include "dti.h" | |
| 35 | |
| 36 #include "sndcp.h" /* to get the global entity definitions */ | |
| 37 #include "sndcp_f.h" /* to get the functions to access the global arrays*/ | |
| 38 | |
| 39 #include "sndcp_cias.h" /* to get the signals to service cia */ | |
| 40 #include "sndcp_nds.h" /* to get the signals to service nd */ | |
| 41 #include "sndcp_nus.h" /* to get the signals to service nu */ | |
| 42 #include "sndcp_nuf.h" | |
| 43 #include "sndcp_sus.h" /* to get the signals to service su */ | |
| 44 #include "sndcp_suas.h" /* to get the signals to service su */ | |
| 45 #include "sndcp_sds.h" /* to get the signals to service sd */ | |
| 46 #include "sndcp_sdas.h" /* to get the signals to service sda */ | |
| 47 | |
| 48 #include "sndcp_mgf.h" /* to get ths file */ | |
| 49 #include "sndcp_nup.h" /* nu_sn_[unit]data_req is called from | |
| 50 sig_callback().*/ | |
| 51 | |
| 52 #include <string.h> | |
| 53 | |
| 54 /*==== CONST ================================================================*/ | |
| 55 | |
| 56 /*==== LOCAL VARS ===========================================================*/ | |
| 57 | |
| 58 /*==== PRIVATE FUNCTIONS ====================================================*/ | |
| 59 | |
| 60 LOCAL void mg_get_sapi_dcomp_dntt (UBYTE sapi, UBYTE dcomp, UBYTE* dntt); | |
| 61 | |
| 62 LOCAL void mg_get_sapi_dntt_nsapi (UBYTE sapi, UBYTE dntt, UBYTE nsapi, BOOL* used); | |
| 63 | |
| 64 LOCAL void mg_get_sapi_dntt_state (UBYTE sapi, UBYTE dntt, UBYTE* state); | |
| 65 | |
| 66 LOCAL void mg_get_sapi_dcomp_state (UBYTE sapi, UBYTE dcomp, UBYTE* stat); | |
| 67 | |
| 68 LOCAL void mg_get_sapi_pcomp_state (UBYTE sapi, UBYTE pcomp, UBYTE* stat); | |
| 69 | |
| 70 LOCAL void mg_get_sapi_pntt_state (UBYTE sapi, UBYTE pntt, UBYTE* state); | |
| 71 | |
| 72 LOCAL void mg_set_sapi_dntt_nsapi (UBYTE sapi, UBYTE dntt, UBYTE nsapi, BOOL used); | |
| 73 | |
| 74 LOCAL void mg_set_sapi_dcomp_state (UBYTE sapi, UBYTE dcomp, UBYTE stat); | |
| 75 | |
| 76 LOCAL void mg_set_sapi_dcomp_dntt (UBYTE sapi, UBYTE dcomp, UBYTE dntt); | |
| 77 | |
| 78 LOCAL void mg_set_sapi_dntt_rej (UBYTE sapi, UBYTE dntt, BOOL rej); | |
| 79 | |
| 80 LOCAL void mg_set_sapi_dntt_state (UBYTE sapi, UBYTE dntt, UBYTE state); | |
| 81 | |
| 82 LOCAL void mg_set_sapi_pntt_nsapi (UBYTE sapi, UBYTE pntt, UBYTE nsapi, BOOL used); | |
| 83 | |
| 84 LOCAL void mg_set_sapi_pcomp_state (UBYTE sapi, UBYTE pcomp, UBYTE stat); | |
| 85 | |
| 86 LOCAL void mg_set_sapi_pcomp_pntt (UBYTE sapi, UBYTE pcomp, UBYTE pntt); | |
| 87 | |
| 88 LOCAL void mg_set_sapi_pntt_rej (UBYTE sapi, UBYTE pntt, BOOL rej); | |
| 89 | |
| 90 LOCAL void mg_set_sapi_pntt_state (UBYTE sapi, UBYTE pntt, UBYTE state); | |
| 91 | |
| 92 /* | |
| 93 +------------------------------------------------------------------------------ | |
| 94 | Function : mg_get_sapi_dcomp_dntt | |
| 95 +------------------------------------------------------------------------------ | |
| 96 | Description : The procedures indicates the dntt assigned to a given dcomp | |
| 97 | for a given sapi. | |
| 98 | | |
| 99 | Parameters : FPAR IN sapi UBYTE, | |
| 100 | IN dcomp UBYTE, | |
| 101 | IN/OUT dntt UBYTE | |
| 102 | | |
| 103 +------------------------------------------------------------------------------ | |
| 104 */ | |
| 105 LOCAL void mg_get_sapi_dcomp_dntt (UBYTE sapi, UBYTE dcomp, UBYTE* dntt) | |
| 106 { | |
| 107 TRACE_FUNCTION( "mg_get_sapi_dcomp_dntt" ); | |
| 108 { | |
| 109 UBYTE sapi_index = 0; | |
| 110 sndcp_get_sapi_index(sapi, &sapi_index); | |
| 111 *dntt = sndcp_data->mg.sapi_dcomp_dntt_ra[sapi_index][dcomp]; | |
| 112 } | |
| 113 } /* mg_get_sapi_dcomp_dntt() */ | |
| 114 | |
| 115 /* | |
| 116 +------------------------------------------------------------------------------ | |
| 117 | Function : mg_get_sapi_dntt_nsapi | |
| 118 +------------------------------------------------------------------------------ | |
| 119 | Description : The procedure informs if a given nsapi uses a given dntt on a | |
| 120 | given sapi. | |
| 121 | | |
| 122 | Parameters : FPAR IN sapi UBYTE, | |
| 123 | IN dntt UBYTE, | |
| 124 | IN nsapi UBYTE, | |
| 125 | IN/OUT used BOOL | |
| 126 | | |
| 127 +------------------------------------------------------------------------------ | |
| 128 */ | |
| 129 LOCAL void mg_get_sapi_dntt_nsapi (UBYTE sapi, UBYTE dntt, UBYTE nsapi, BOOL* used) | |
| 130 { | |
| 131 TRACE_FUNCTION( "mg_get_sapi_dntt_nsapi" ); | |
| 132 { | |
| 133 UBYTE sapi_index = 0; | |
| 134 sndcp_get_sapi_index(sapi, &sapi_index); | |
| 135 *used = sndcp_data->mg.sapi_dntt_nsapi_set_ra[sapi_index][dntt][nsapi]; | |
| 136 } | |
| 137 } /* mg_get_sapi_dntt_nsapi() */ | |
| 138 | |
| 139 /* | |
| 140 +------------------------------------------------------------------------------ | |
| 141 | Function : mg_get_sapi_dcomp_state | |
| 142 +------------------------------------------------------------------------------ | |
| 143 | Description : The procedures informs about the state of a given dcomp on a | |
| 144 | given SAPI. | |
| 145 | | |
| 146 | Parameters : FPAR IN sapi UBYTE, | |
| 147 | IN dcomp UBYTE, | |
| 148 | IN/OUT stat UBYTE | |
| 149 | | |
| 150 +------------------------------------------------------------------------------ | |
| 151 */ | |
| 152 LOCAL void mg_get_sapi_dcomp_state (UBYTE sapi, UBYTE dcomp, UBYTE* stat) | |
| 153 { | |
| 154 TRACE_FUNCTION( "mg_get_sapi_dcomp_state" ); | |
| 155 { | |
| 156 UBYTE sapi_index = 0; | |
| 157 sndcp_get_sapi_index(sapi, &sapi_index); | |
| 158 *stat = sndcp_data->mg.sapi_dcomp_state_ra[sapi_index][dcomp]; | |
| 159 } | |
| 160 } /* mg_get_sapi_dcomp_state() */ | |
| 161 | |
| 162 /* | |
| 163 +------------------------------------------------------------------------------ | |
| 164 | Function : mg_get_sapi_dntt_state | |
| 165 +------------------------------------------------------------------------------ | |
| 166 | Description : The procedures informs about the state of a given data | |
| 167 | compression entity on a given SAPI. | |
| 168 | | |
| 169 | Parameters : FPAR IN sapi UBYTE, | |
| 170 | IN dntt UBYTE, | |
| 171 | IN/OUT state UBYTE | |
| 172 | | |
| 173 +------------------------------------------------------------------------------ | |
| 174 */ | |
| 175 LOCAL void mg_get_sapi_dntt_state (UBYTE sapi, UBYTE dntt, UBYTE* state) | |
| 176 { | |
| 177 TRACE_FUNCTION( "mg_get_sapi_dntt_state" ); | |
| 178 { | |
| 179 UBYTE sapi_index = 0; | |
| 180 sndcp_get_sapi_index(sapi, &sapi_index); | |
| 181 *state = sndcp_data->mg.sapi_dntt_state_ra[sapi_index][dntt]; | |
| 182 } | |
| 183 | |
| 184 | |
| 185 | |
| 186 } /* mg_get_sapi_dntt_state() */ | |
| 187 | |
| 188 /* | |
| 189 +------------------------------------------------------------------------------ | |
| 190 | Function : mg_get_sapi_pcomp_state | |
| 191 +------------------------------------------------------------------------------ | |
| 192 | Description : The procedures informs about the state of a given pcomp on a | |
| 193 | given SAPI. | |
| 194 | | |
| 195 | Parameters : FPAR IN sapi UBYTE, | |
| 196 | IN pcomp UBYTE, | |
| 197 | IN/OUT stat UBYTE | |
| 198 | | |
| 199 +------------------------------------------------------------------------------ | |
| 200 */ | |
| 201 LOCAL void mg_get_sapi_pcomp_state (UBYTE sapi, UBYTE pcomp, UBYTE* stat) | |
| 202 { | |
| 203 TRACE_FUNCTION( "mg_get_sapi_pcomp_state" ); | |
| 204 { | |
| 205 UBYTE sapi_index = 0; | |
| 206 sndcp_get_sapi_index(sapi, &sapi_index); | |
| 207 *stat = sndcp_data->mg.sapi_pcomp_state_ra[sapi_index][pcomp]; | |
| 208 } | |
| 209 } /* mg_get_sapi_pcomp_state() */ | |
| 210 | |
| 211 /* | |
| 212 +------------------------------------------------------------------------------ | |
| 213 | Function : mg_get_sapi_pntt_state | |
| 214 +------------------------------------------------------------------------------ | |
| 215 | Description : The procedures informs about the state of a given header | |
| 216 | compression entity on a given SAPI. | |
| 217 | | |
| 218 | Parameters : FPAR IN sapi UBYTE, | |
| 219 | IN pntt UBYTE, | |
| 220 | IN/OUT state UBYTE | |
| 221 | | |
| 222 +------------------------------------------------------------------------------ | |
| 223 */ | |
| 224 LOCAL void mg_get_sapi_pntt_state (UBYTE sapi, UBYTE pntt, UBYTE* state) | |
| 225 { | |
| 226 TRACE_FUNCTION( "mg_get_sapi_pntt_state" ); | |
| 227 { | |
| 228 UBYTE sapi_index = 0; | |
| 229 sndcp_get_sapi_index(sapi, &sapi_index); | |
| 230 *state = sndcp_data->mg.sapi_pntt_state_ra[sapi_index][pntt]; | |
| 231 } | |
| 232 } /* mg_get_sapi_pntt_state() */ | |
| 233 | |
| 234 | |
| 235 | |
| 236 | |
| 237 /* | |
| 238 +------------------------------------------------------------------------------ | |
| 239 | Function : mg_check_sense_bitwise | |
| 240 +------------------------------------------------------------------------------ | |
| 241 | Description : Checks, if "small" is bitwise smaller than or equal to "big" | |
| 242 | | |
| 243 | Parameters : USHORT small, big, BOOL wrong is set to TRUE, if small > big | |
| 244 | | |
| 245 +------------------------------------------------------------------------------ | |
| 246 */ | |
| 247 LOCAL void mg_ushort_sense_bitwise (USHORT small, | |
| 248 USHORT big, | |
| 249 BOOL* wrong) { | |
| 250 UBYTE bit = 0; | |
| 251 TRACE_FUNCTION( "mg_check_sense_bitwise" ); | |
| 252 *wrong = TRUE; | |
| 253 for (bit = 0; bit < 8 * sizeof(USHORT); bit++) { | |
| 254 if ((small & (1 << bit)) > (big & (1 << bit))) { | |
| 255 return; | |
| 256 } | |
| 257 } | |
| 258 *wrong = FALSE; | |
| 259 } /* mg_check_sense_bitwise() */ | |
| 260 | |
| 261 /* | |
| 262 +------------------------------------------------------------------------------ | |
| 263 | Function : mg_check_sense_bitwise | |
| 264 +------------------------------------------------------------------------------ | |
| 265 | Description : Checks, if "small" is bitwise smaller than "big" | |
| 266 | | |
| 267 | Parameters : UBYTE small, big, BOOL wrong is set to TRUE, if small > big | |
| 268 | | |
| 269 +------------------------------------------------------------------------------ | |
| 270 */ | |
| 271 LOCAL void mg_ubyte_sense_bitwise (UBYTE small, | |
| 272 UBYTE big, | |
| 273 BOOL* wrong) { | |
| 274 UBYTE bit = 0; | |
| 275 TRACE_FUNCTION( "mg_check_sense_bitwise" ); | |
| 276 *wrong = TRUE; | |
| 277 for (bit = 0; bit < 8 * sizeof(UBYTE); bit++) { | |
| 278 if ((small & (1 << bit)) > (big & (1 << bit))) { | |
| 279 return; | |
| 280 } | |
| 281 } | |
| 282 *wrong = FALSE; | |
| 283 } /* mg_check_sense_bitwise() */ | |
| 284 | |
| 285 /* | |
| 286 +------------------------------------------------------------------------------ | |
| 287 | Function : mg_decode_v42 | |
| 288 +------------------------------------------------------------------------------ | |
| 289 | Description : decodes the v42 part of given sdu to given xid block | |
| 290 | | |
| 291 | Parameters : source sdu, | |
| 292 | index in sdu, | |
| 293 | field index in sdu (sub index in compression fields, | |
| 294 | destination xid block, | |
| 295 | success ok | |
| 296 | | |
| 297 +------------------------------------------------------------------------------ | |
| 298 */ | |
| 299 LOCAL void mg_decode_v42 (T_sdu* sdu, | |
| 300 USHORT* index, | |
| 301 USHORT* field_index, | |
| 302 T_XID_BLOCK* xid_block, | |
| 303 BOOL* ok, | |
| 304 UBYTE p_bit) { | |
| 305 #define CHECK_XID_BUFFER_LEN2 if (*index + *field_index >= ((sdu->l_buf) >> 3)) return | |
| 306 | |
| 307 USHORT field_length = 0; | |
| 308 TRACE_FUNCTION( "mg_decode_v42" ); | |
| 309 *ok = FALSE; | |
| 310 | |
| 311 /* | |
| 312 * Set field_index to length of field octet. | |
| 313 */ | |
| 314 (*field_index)++; | |
| 315 CHECK_XID_BUFFER_LEN2; | |
| 316 field_length = sdu->buf[*index + *field_index]; | |
| 317 /* | |
| 318 * NSAPIS parameter and followers omitted? | |
| 319 */ | |
| 320 if (p_bit == SNDCP_P_BIT_1) { | |
| 321 if (field_length == MG_DATA_P_1_NSAPIS_OM) { | |
| 322 *ok = TRUE; | |
| 323 return; | |
| 324 } | |
| 325 } else { | |
| 326 if (field_length == MG_DATA_P_0_NSAPIS_OM) { | |
| 327 *ok = TRUE; | |
| 328 return; | |
| 329 } | |
| 330 } | |
| 331 /* | |
| 332 * If p bit set to 1, set field_index to dcomp field. | |
| 333 */ | |
| 334 if (p_bit == SNDCP_P_BIT_1) { | |
| 335 (*field_index)++; | |
| 336 CHECK_XID_BUFFER_LEN2; | |
| 337 xid_block->v42.dcomp = | |
| 338 ((USHORT)sdu->buf[*index + *field_index]) >> 4; | |
| 339 } | |
| 340 /* | |
| 341 * Set field_index to MSB of applicable nsapis short. | |
| 342 */ | |
| 343 (*field_index)++; | |
| 344 CHECK_XID_BUFFER_LEN2; | |
| 345 xid_block->v42.nsapis = | |
| 346 ((USHORT)sdu->buf[*index + *field_index]) << 8; | |
| 347 xid_block->v42.nsapis_set = TRUE; | |
| 348 /* | |
| 349 * Set field_index to LSB of applicable nsapis short. | |
| 350 */ | |
| 351 (*field_index)++; | |
| 352 CHECK_XID_BUFFER_LEN2; | |
| 353 xid_block->v42.nsapis += | |
| 354 ((USHORT)sdu->buf[*index + *field_index]); | |
| 355 /* | |
| 356 * P0 parameter and followers omitted? | |
| 357 */ | |
| 358 if (p_bit == SNDCP_P_BIT_1) { | |
| 359 if (field_length == MG_DATA_P_1_P0_OM) { | |
| 360 *ok = TRUE; | |
| 361 return; | |
| 362 } | |
| 363 } else { | |
| 364 if (field_length == MG_DATA_P_0_P0_OM) { | |
| 365 *ok = TRUE; | |
| 366 return; | |
| 367 } | |
| 368 } | |
| 369 /* | |
| 370 * Set field_index to p0. | |
| 371 */ | |
| 372 (*field_index)++; | |
| 373 CHECK_XID_BUFFER_LEN2; | |
| 374 xid_block->v42.p0 = | |
| 375 sdu->buf[*index + *field_index]; | |
| 376 xid_block->v42.p0_set = TRUE; | |
| 377 /* | |
| 378 * P1 parameter and followers omitted? | |
| 379 */ | |
| 380 if (p_bit == SNDCP_P_BIT_1) { | |
| 381 if (field_length == MG_DATA_P_1_P1_OM) { | |
| 382 *ok =TRUE; | |
| 383 return; | |
| 384 } | |
| 385 } else { | |
| 386 if (field_length == MG_DATA_P_0_P1_OM) { | |
| 387 *ok =TRUE; | |
| 388 return; | |
| 389 } | |
| 390 } | |
| 391 /* | |
| 392 * Set field_index to MSB of p1. | |
| 393 */ | |
| 394 (*field_index)++; | |
| 395 CHECK_XID_BUFFER_LEN2; | |
| 396 xid_block->v42.p1 = | |
| 397 ((USHORT)sdu->buf[*index + *field_index]) << 8; | |
| 398 xid_block->v42.p1_set = TRUE; | |
| 399 /* | |
| 400 * Set field_index to LSB of p1. | |
| 401 */ | |
| 402 (*field_index)++; | |
| 403 CHECK_XID_BUFFER_LEN2; | |
| 404 xid_block->v42.p1 += | |
| 405 ((USHORT)sdu->buf[*index + *field_index]); | |
| 406 /* | |
| 407 * P2 parameter and followers omitted? | |
| 408 */ | |
| 409 if (p_bit == SNDCP_P_BIT_1) { | |
| 410 if (field_length == MG_DATA_P_1_P2_OM) { | |
| 411 *ok = TRUE; | |
| 412 return; | |
| 413 } | |
| 414 } else { | |
| 415 if (field_length == MG_DATA_P_0_P2_OM) { | |
| 416 *ok = TRUE; | |
| 417 return; | |
| 418 } | |
| 419 } | |
| 420 /* | |
| 421 * Set field_index to p2. | |
| 422 */ | |
| 423 (*field_index)++; | |
| 424 CHECK_XID_BUFFER_LEN2; | |
| 425 xid_block->v42.p2 = | |
| 426 sdu->buf[*index + *field_index]; | |
| 427 xid_block->v42.p2_set = TRUE; | |
| 428 | |
| 429 /* | |
| 430 * If length of v42 field is longer than specified, ignore the rest. | |
| 431 */ | |
| 432 while (*field_index < field_length) { | |
| 433 CHECK_XID_BUFFER_LEN2; | |
| 434 (*field_index)++; | |
| 435 } | |
| 436 | |
| 437 *ok = TRUE; | |
| 438 | |
| 439 } /* mg_decode_v42() */ | |
| 440 | |
| 441 /* | |
| 442 +------------------------------------------------------------------------------ | |
| 443 | Function : mg_decode_vj | |
| 444 +------------------------------------------------------------------------------ | |
| 445 | Description : decodes the vj part of given sdu to given xid block | |
| 446 | | |
| 447 | Parameters : source sdu, | |
| 448 | index in sdu, | |
| 449 | field index in sdu (sub index in compression fields, | |
| 450 | destination xid block, | |
| 451 | success ok | |
| 452 | | |
| 453 +------------------------------------------------------------------------------ | |
| 454 */ | |
| 455 LOCAL void mg_decode_vj (T_sdu* sdu, | |
| 456 USHORT* index, | |
| 457 USHORT* field_index, | |
| 458 T_XID_BLOCK* xid_block, | |
| 459 BOOL* ok, | |
| 460 UBYTE p_bit) { | |
| 461 #define CHECK_XID_BUFFER_LEN3 if (*index + *field_index >= ((sdu->l_buf) >> 3)) return | |
| 462 | |
| 463 USHORT field_length = 0; | |
| 464 TRACE_FUNCTION( "mg_decode_vj" ); | |
| 465 | |
| 466 /* | |
| 467 * Set field_index to length of field octet. | |
| 468 */ | |
| 469 (*field_index)++; | |
| 470 CHECK_XID_BUFFER_LEN3; | |
| 471 field_length = sdu->buf[*index + *field_index]; | |
| 472 /* | |
| 473 * NSAPIS parameter and followers omitted? | |
| 474 */ | |
| 475 if (p_bit == SNDCP_P_BIT_1) { | |
| 476 if (field_length == MG_HEADER_P_1_NSAPIS_OM) { | |
| 477 *ok = TRUE; | |
| 478 return; | |
| 479 } | |
| 480 } else { | |
| 481 if (field_length == MG_HEADER_P_0_NSAPIS_OM) { | |
| 482 *ok = TRUE; | |
| 483 return; | |
| 484 } | |
| 485 } | |
| 486 /* | |
| 487 * If p bit set to 1, set field_index to dcomp field. | |
| 488 */ | |
| 489 if (p_bit == SNDCP_P_BIT_1) { | |
| 490 (*field_index)++; | |
| 491 CHECK_XID_BUFFER_LEN3; | |
| 492 xid_block->vj.pcomp1 = | |
| 493 ((USHORT)sdu->buf[*index + *field_index]) >> 4; | |
| 494 xid_block->vj.pcomp2 = | |
| 495 ((USHORT)sdu->buf[*index + *field_index]) & 0xf; | |
| 496 } | |
| 497 | |
| 498 /* | |
| 499 * Set field_index to MSB of applicable nsapis short. | |
| 500 */ | |
| 501 (*field_index)++; | |
| 502 CHECK_XID_BUFFER_LEN3; | |
| 503 xid_block->vj.nsapis = | |
| 504 ((USHORT)sdu->buf[*index + *field_index]) << 8; | |
| 505 xid_block->vj.nsapis_set = TRUE; | |
| 506 /* | |
| 507 * Set field_index to LSB of applicable nsapis short. | |
| 508 */ | |
| 509 (*field_index)++; | |
| 510 CHECK_XID_BUFFER_LEN3; | |
| 511 xid_block->vj.nsapis += | |
| 512 ((USHORT)sdu->buf[*index + *field_index]); | |
| 513 /* | |
| 514 * S0_M_1 parameter omitted? | |
| 515 */ | |
| 516 if (p_bit == SNDCP_P_BIT_1) { | |
| 517 if (field_length == MG_HEADER_P_1_S0_M_1_OM) { | |
| 518 *ok = TRUE; | |
| 519 return; | |
| 520 } | |
| 521 } else { | |
| 522 if (field_length == MG_HEADER_P_0_S0_M_1_OM) { | |
| 523 *ok = TRUE; | |
| 524 return; | |
| 525 } | |
| 526 } | |
| 527 /* | |
| 528 * Set field_index to "s0 - 1" Parameter | |
| 529 */ | |
| 530 (*field_index)++; | |
| 531 CHECK_XID_BUFFER_LEN3; | |
| 532 xid_block->vj.s0_m_1 = sdu->buf[*index + *field_index]; | |
| 533 xid_block->vj.s0_m_1_set = TRUE; | |
| 534 | |
| 535 /* | |
| 536 * If length of vj field is longer than specified, ignore the rest. | |
| 537 */ | |
| 538 while (*field_index < field_length) { | |
| 539 CHECK_XID_BUFFER_LEN3; | |
| 540 (*field_index)++; | |
| 541 } | |
| 542 | |
| 543 | |
| 544 *ok = TRUE; | |
| 545 | |
| 546 } /* mg_decode_vj() */ | |
| 547 | |
| 548 /* | |
| 549 +------------------------------------------------------------------------------ | |
| 550 | Function : mg_detect_mode_clash | |
| 551 +------------------------------------------------------------------------------ | |
| 552 | Description : Unacknowledged and acknowledged contexts may not share the same | |
| 553 | compressor entity. This procdure detects possible violations of that rule. | |
| 554 | | |
| 555 | Parameters : the set of nsapis given as USHORT bit mask, | |
| 556 | violation detected, TRUE if at least 1 acknowledged and 1 | |
| 557 | unacknowledged context share the same compressor. | |
| 558 | | |
| 559 +------------------------------------------------------------------------------ | |
| 560 */ | |
| 561 LOCAL void mg_detect_mode_clash (USHORT nsapis, BOOL* vio) | |
| 562 { | |
| 563 UBYTE nsapi = 0; | |
| 564 BOOL unack_found = FALSE; | |
| 565 BOOL ack_found = FALSE; | |
| 566 BOOL ack = FALSE; | |
| 567 TRACE_FUNCTION( "mg_detect_mode_clash" ); | |
| 568 /* | |
| 569 * Find affected nsapis. | |
| 570 */ | |
| 571 for (nsapi = 0; nsapi < SNDCP_NUMBER_OF_NSAPIS; nsapi++) { | |
| 572 if ((nsapis & (1 << nsapi)) > 0) { | |
| 573 sndcp_get_nsapi_ack(nsapi, &ack); | |
| 574 if (ack) { | |
| 575 ack_found = TRUE; | |
| 576 } else { | |
| 577 unack_found = TRUE; | |
| 578 } | |
| 579 } | |
| 580 } | |
| 581 *vio = unack_found && ack_found; | |
| 582 | |
| 583 | |
| 584 } /* mg_detect_mode_clash() */ | |
| 585 | |
| 586 | |
| 587 /* | |
| 588 +------------------------------------------------------------------------------ | |
| 589 | Function : mg_respond_if_nec | |
| 590 +------------------------------------------------------------------------------ | |
| 591 | Description : All nsapis connected to the given sapi | |
| 592 | that are in state MG_ACT are sent an | |
| 593 | SNSM_ACTIVATE_RES. | |
| 594 | | |
| 595 | Parameters : sapi | |
| 596 | | |
| 597 +------------------------------------------------------------------------------ | |
| 598 */ | |
| 599 LOCAL void mg_respond_if_nec (UBYTE sapi) { | |
| 600 UBYTE nsapi = 0; | |
| 601 UBYTE sapi_index = 0; | |
| 602 #ifdef SNDCP_UPM_INCLUDED | |
| 603 BOOL ack = FALSE; | |
| 604 #endif /* SNDCP_UPM_INCLUDED */ | |
| 605 | |
| 606 TRACE_FUNCTION( "mg_respond_if_nec" ); | |
| 607 | |
| 608 sndcp_get_sapi_index(sapi, &sapi_index); | |
| 609 for (nsapi = 0; nsapi < SNDCP_NUMBER_OF_NSAPIS; nsapi++) { | |
| 610 USHORT nsapi_state = MG_IDLE; | |
| 611 USHORT sapi_state = MG_IDLE; | |
| 612 UBYTE local_sapi = 0; | |
| 613 sndcp_get_nsapi_state(nsapi, &nsapi_state); | |
| 614 sndcp_get_nsapi_sapi(nsapi, &local_sapi); | |
| 615 sndcp_get_sapi_state(local_sapi, &sapi_state); | |
| 616 if (((nsapi_state & MG_ACT) > 0) | |
| 617 && | |
| 618 ((sapi_state & MG_XID) == 0) | |
| 619 && | |
| 620 ((sapi_state & MG_EST) == 0) | |
| 621 && | |
| 622 (local_sapi == sapi)) { | |
| 623 | |
| 624 /* | |
| 625 * Open DTI connection. | |
| 626 */ | |
| 627 #ifndef SNDCP_UPM_INCLUDED | |
| 628 mg_dti_open(nsapi); | |
| 629 #else | |
| 630 sndcp_get_nsapi_ack(nsapi, &ack); | |
| 631 if (ack) { | |
| 632 nu_ready_ind_if_nec(nsapi); | |
| 633 } else { | |
| 634 nu_unitready_ind_if_nec(nsapi); | |
| 635 } | |
| 636 #endif | |
| 637 | |
| 638 mg_send_snsm_activate_res(nsapi); | |
| 639 /* | |
| 640 * Set nsapi state to MG_IDLE. | |
| 641 */ | |
| 642 sndcp_unset_nsapi_state (nsapi, MG_ACT); | |
| 643 } | |
| 644 | |
| 645 if (((nsapi_state & MG_DEACT) > 0) | |
| 646 && | |
| 647 ((sapi_state & MG_XID) == 0) | |
| 648 && | |
| 649 ((sapi_state & MG_REL) == 0) | |
| 650 && | |
| 651 (local_sapi == sapi)) { | |
| 652 | |
| 653 #ifdef SNDCP_UPM_INCLUDED | |
| 654 PALLOC(snsm_deactivate_res, SN_DEACTIVATE_CNF); | |
| 655 #else | |
| 656 PALLOC(snsm_deactivate_res, SNSM_DEACTIVATE_RES); | |
| 657 #endif /*#ifdef SNDCP_UPM_INCLUDED*/ | |
| 658 /* | |
| 659 * Now the NSAPI is not in use anymore: | |
| 660 */ | |
| 661 sndcp_set_nsapi_used(nsapi, FALSE); | |
| 662 sndcp_set_nsapi_ack(nsapi, FALSE); | |
| 663 | |
| 664 snsm_deactivate_res->nsapi = nsapi; | |
| 665 sndcp_unset_nsapi_state(nsapi, MG_DEACT); | |
| 666 #ifdef SNDCP_UPM_INCLUDED | |
| 667 PSEND(hCommUPM, snsm_deactivate_res); | |
| 668 #else | |
| 669 PSEND(hCommSM, snsm_deactivate_res); | |
| 670 #endif /*#ifdef SNDCP_UPM_INCLUDED*/ | |
| 671 } | |
| 672 | |
| 673 } | |
| 674 | |
| 675 } /* mg_respond_if_nec */ | |
| 676 | |
| 677 | |
| 678 | |
| 679 /* | |
| 680 +------------------------------------------------------------------------------ | |
| 681 | Function : mg_set_ntt_comp | |
| 682 +------------------------------------------------------------------------------ | |
| 683 | Description : Sets ntt and comp values acc. to req_xid_block. | |
| 684 | | |
| 685 | Parameters : UBYTE sapi, BOOL is this a renegotiation? | |
| 686 | | |
| 687 +------------------------------------------------------------------------------ | |
| 688 */ | |
| 689 LOCAL void mg_set_ntt_comp (UBYTE sapi) { | |
| 690 UBYTE sapi_index = 0; | |
| 691 UBYTE nsapi = 0; | |
| 692 TRACE_FUNCTION( "mg_set_ntt_comp" ); | |
| 693 sndcp_get_sapi_index(sapi, &sapi_index); | |
| 694 | |
| 695 if (sndcp_data->mg.req_xid_block[sapi_index].v42.is_set) { | |
| 696 mg_set_sapi_dntt_state(sapi, | |
| 697 sndcp_data->mg.req_xid_block[sapi_index].v42.ntt, | |
| 698 MG_SELECTED); | |
| 699 for (nsapi = 0; nsapi < SNDCP_NUMBER_OF_NSAPIS; nsapi++) { | |
| 700 if ((sndcp_data->mg.req_xid_block[sapi_index].v42.nsapis & (1 << nsapi)) | |
| 701 > 0) { | |
| 702 mg_set_sapi_dntt_nsapi(sapi, | |
| 703 sndcp_data->mg.req_xid_block[sapi_index].v42.ntt, | |
| 704 nsapi, | |
| 705 TRUE); | |
| 706 } | |
| 707 } | |
| 708 mg_set_sapi_dcomp_state(sapi, | |
| 709 sndcp_data->mg.req_xid_block[sapi_index].v42.dcomp, | |
| 710 MG_SELECTED); | |
| 711 mg_set_sapi_dcomp_dntt(sapi, | |
| 712 sndcp_data->mg.req_xid_block[sapi_index].v42.dcomp, | |
| 713 sndcp_data->mg.req_xid_block[sapi_index].v42.ntt); | |
| 714 } | |
| 715 if (sndcp_data->mg.req_xid_block[sapi_index].vj.is_set) { | |
| 716 mg_set_sapi_pntt_state(sapi, | |
| 717 sndcp_data->mg.req_xid_block[sapi_index].vj.ntt, | |
| 718 MG_SELECTED); | |
| 719 for (nsapi = 0; nsapi < SNDCP_NUMBER_OF_NSAPIS; nsapi++) { | |
| 720 if ((sndcp_data->mg.req_xid_block[sapi_index].vj.nsapis & (1 << nsapi)) | |
| 721 > 0) { | |
| 722 mg_set_sapi_pntt_nsapi(sapi, | |
| 723 sndcp_data->mg.req_xid_block[sapi_index].vj.ntt, | |
| 724 nsapi, | |
| 725 TRUE); | |
| 726 } | |
| 727 } | |
| 728 mg_set_sapi_pcomp_state(sapi, | |
| 729 sndcp_data->mg.req_xid_block[sapi_index].vj.pcomp1, | |
| 730 MG_SELECTED); | |
| 731 mg_set_sapi_pcomp_state(sapi, | |
| 732 sndcp_data->mg.req_xid_block[sapi_index].vj.pcomp2, | |
| 733 MG_SELECTED); | |
| 734 mg_set_sapi_pcomp_pntt(sapi, | |
| 735 sndcp_data->mg.req_xid_block[sapi_index].vj.pcomp1, | |
| 736 sndcp_data->mg.req_xid_block[sapi_index].vj.ntt); | |
| 737 mg_set_sapi_pcomp_pntt(sapi, | |
| 738 sndcp_data->mg.req_xid_block[sapi_index].vj.pcomp2, | |
| 739 sndcp_data->mg.req_xid_block[sapi_index].vj.ntt); | |
| 740 } | |
| 741 | |
| 742 | |
| 743 } /* mg_set_ntt_comp() */ | |
| 744 | |
| 745 /* | |
| 746 +------------------------------------------------------------------------------ | |
| 747 | Function : mg_set_sapi_dntt_nsapi | |
| 748 +------------------------------------------------------------------------------ | |
| 749 | Description : The procedure stores the info that a given nsapi uses a given | |
| 750 | dntt on a given sapi. | |
| 751 | | |
| 752 | Parameters : FPAR IN sapi UBYTE, | |
| 753 | IN dntt UBYTE, | |
| 754 | IN nsapi UBYTE, | |
| 755 | IN used BOOL | |
| 756 | | |
| 757 +------------------------------------------------------------------------------ | |
| 758 */ | |
| 759 LOCAL void mg_set_sapi_dntt_nsapi (UBYTE sapi, UBYTE dntt, UBYTE nsapi, BOOL used) | |
| 760 { | |
| 761 TRACE_FUNCTION( "mg_set_sapi_dntt_nsapi" ); | |
| 762 { | |
| 763 UBYTE sapi_index = 0; | |
| 764 sndcp_get_sapi_index(sapi, &sapi_index); | |
| 765 sndcp_data->mg.sapi_dntt_nsapi_set_ra[sapi_index][dntt][nsapi] = used; | |
| 766 } | |
| 767 } /* mg_set_sapi_dntt_nsapi() */ | |
| 768 | |
| 769 /* | |
| 770 +------------------------------------------------------------------------------ | |
| 771 | Function : mg_set_sapi_dcomp_state | |
| 772 +------------------------------------------------------------------------------ | |
| 773 | Description : The procedures sets the state of a given dcomp on a given SAPI. | |
| 774 | | |
| 775 | Parameters : FPAR IN sapi UBYTE, | |
| 776 | IN dcomp UBYTE, | |
| 777 | IN stat UBYTE | |
| 778 | | |
| 779 +------------------------------------------------------------------------------ | |
| 780 */ | |
| 781 LOCAL void mg_set_sapi_dcomp_state (UBYTE sapi, UBYTE dcomp, UBYTE stat) | |
| 782 { | |
| 783 TRACE_FUNCTION( "mg_set_sapi_dcomp_state" ); | |
| 784 { | |
| 785 UBYTE sapi_index = 0; | |
| 786 sndcp_get_sapi_index(sapi, &sapi_index); | |
| 787 sndcp_data->mg.sapi_dcomp_state_ra[sapi_index][dcomp] = stat; | |
| 788 } | |
| 789 } /* mg_set_sapi_dcomp_state() */ | |
| 790 | |
| 791 /* | |
| 792 +------------------------------------------------------------------------------ | |
| 793 | Function : mg_set_sapi_dcomp_dntt | |
| 794 +------------------------------------------------------------------------------ | |
| 795 | Description : The procedures sets the dntt assigned to a given dcomp | |
| 796 | for a given sapi. | |
| 797 | | |
| 798 | Parameters : FPAR IN sapi UBYTE, | |
| 799 | IN dcomp UBYTE, | |
| 800 | IN dntt UBYTE | |
| 801 | | |
| 802 +------------------------------------------------------------------------------ | |
| 803 */ | |
| 804 LOCAL void mg_set_sapi_dcomp_dntt (UBYTE sapi, UBYTE dcomp, UBYTE dntt) | |
| 805 { | |
| 806 TRACE_FUNCTION( "mg_set_sapi_dcomp_dntt" ); | |
| 807 { | |
| 808 UBYTE sapi_index = 0; | |
| 809 sndcp_get_sapi_index(sapi, &sapi_index); | |
| 810 sndcp_data->mg.sapi_dcomp_dntt_ra[sapi_index][dcomp] = dntt; | |
| 811 } | |
| 812 } /* mg_set_sapi_dcomp_dntt() */ | |
| 813 | |
| 814 /* | |
| 815 +------------------------------------------------------------------------------ | |
| 816 | Function : mg_set_sapi_dntt_rej | |
| 817 +------------------------------------------------------------------------------ | |
| 818 | Description : The procedures stores if a given data | |
| 819 | compression entity on a given SAPI is to be rejected in | |
| 820 | LL_XID_REQ because it cannot be set up. | |
| 821 | | |
| 822 | Parameters : FPAR IN sapi UBYTE, | |
| 823 | IN dntt UBYTE, | |
| 824 | IN rej BOOL | |
| 825 | | |
| 826 +------------------------------------------------------------------------------ | |
| 827 */ | |
| 828 LOCAL void mg_set_sapi_dntt_rej (UBYTE sapi, UBYTE dntt, BOOL rej) | |
| 829 { | |
| 830 TRACE_FUNCTION( "mg_set_sapi_dntt_rej" ); | |
| 831 { | |
| 832 UBYTE sapi_index = 0; | |
| 833 sndcp_get_sapi_index(sapi, &sapi_index); | |
| 834 sndcp_data->mg.sapi_dntt_rej_ra[sapi_index][dntt] = rej; | |
| 835 } | |
| 836 } /* mg_set_sapi_dntt_rej() */ | |
| 837 | |
| 838 /* | |
| 839 +------------------------------------------------------------------------------ | |
| 840 | Function : mg_set_sapi_dntt_state | |
| 841 +------------------------------------------------------------------------------ | |
| 842 | Description : The procedures sets the state of a given data | |
| 843 | compression entity on a given SAPI. | |
| 844 | | |
| 845 | Parameters : FPAR IN sapi UBYTE, | |
| 846 | IN dntt UBYTE, | |
| 847 | IN state UBYTE | |
| 848 | Note : sapi dntt rej will be set ti FALSE if state is UNASSIGNED | |
| 849 | | |
| 850 +------------------------------------------------------------------------------ | |
| 851 */ | |
| 852 LOCAL void mg_set_sapi_dntt_state (UBYTE sapi, UBYTE dntt, UBYTE state) | |
| 853 { | |
| 854 TRACE_FUNCTION( "mg_set_sapi_dntt_state" ); | |
| 855 { | |
| 856 UBYTE sapi_index = 0; | |
| 857 sndcp_get_sapi_index(sapi, &sapi_index); | |
| 858 sndcp_data->mg.sapi_dntt_state_ra[sapi_index][dntt] = state; | |
| 859 | |
| 860 if (state == MG_UNASSIGNED) { | |
| 861 mg_set_sapi_dntt_rej(sapi, dntt, FALSE); | |
| 862 } | |
| 863 } | |
| 864 } /* mg_set_sapi_dntt_state() */ | |
| 865 | |
| 866 /* | |
| 867 +------------------------------------------------------------------------------ | |
| 868 | Function : mg_set_sapi_pntt_nsapi | |
| 869 +------------------------------------------------------------------------------ | |
| 870 | Description : The procedure stores the info that a given nsapi uses a given | |
| 871 | pntt on a given sapi. | |
| 872 | | |
| 873 | Parameters : FPAR IN sapi UBYTE, | |
| 874 | IN pntt UBYTE, | |
| 875 | IN nsapi UBYTE, | |
| 876 | IN used BOOL | |
| 877 | | |
| 878 +------------------------------------------------------------------------------ | |
| 879 */ | |
| 880 LOCAL void mg_set_sapi_pntt_nsapi (UBYTE sapi, UBYTE pntt, UBYTE nsapi, BOOL used) | |
| 881 { | |
| 882 TRACE_FUNCTION( "mg_set_sapi_pntt_nsapi" ); | |
| 883 { | |
| 884 UBYTE sapi_index = 0; | |
| 885 sndcp_get_sapi_index(sapi, &sapi_index); | |
| 886 sndcp_data->mg.sapi_pntt_nsapi_set_ra[sapi_index][pntt][nsapi] = used; | |
| 887 } | |
| 888 } /* mg_set_sapi_pntt_nsapi() */ | |
| 889 | |
| 890 /* | |
| 891 +------------------------------------------------------------------------------ | |
| 892 | Function : mg_set_sapi_pcomp_state | |
| 893 +------------------------------------------------------------------------------ | |
| 894 | Description : The procedures sets the state of a given pcomp on a given SAPI. | |
| 895 | | |
| 896 | Parameters : FPAR IN sapi UBYTE, | |
| 897 | IN pcomp UBYTE, | |
| 898 | IN stat UBYTE | |
| 899 | | |
| 900 +------------------------------------------------------------------------------ | |
| 901 */ | |
| 902 LOCAL void mg_set_sapi_pcomp_state (UBYTE sapi, UBYTE pcomp, UBYTE stat) | |
| 903 { | |
| 904 TRACE_FUNCTION( "mg_set_sapi_pcomp_state" ); | |
| 905 { | |
| 906 UBYTE sapi_index = 0; | |
| 907 sndcp_get_sapi_index(sapi, &sapi_index); | |
| 908 sndcp_data->mg.sapi_pcomp_state_ra[sapi_index][pcomp] = stat; | |
| 909 } | |
| 910 } /* mg_set_sapi_pcomp_state() */ | |
| 911 | |
| 912 /* | |
| 913 +------------------------------------------------------------------------------ | |
| 914 | Function : mg_set_sapi_pcomp_pntt | |
| 915 +------------------------------------------------------------------------------ | |
| 916 | Description : The procedures sets the pntt assigned to a given pcomp | |
| 917 | for a given sapi. | |
| 918 | | |
| 919 | Parameters : FPAR IN sapi UBYTE, | |
| 920 | IN pcomp UBYTE, | |
| 921 | IN pntt UBYTE | |
| 922 | | |
| 923 +------------------------------------------------------------------------------ | |
| 924 */ | |
| 925 LOCAL void mg_set_sapi_pcomp_pntt (UBYTE sapi, UBYTE pcomp, UBYTE pntt) | |
| 926 { | |
| 927 TRACE_FUNCTION( "mg_set_sapi_pcomp_pntt" ); | |
| 928 { | |
| 929 UBYTE sapi_index = 0; | |
| 930 sndcp_get_sapi_index(sapi, &sapi_index); | |
| 931 sndcp_data->mg.sapi_pcomp_pntt_ra[sapi_index][pcomp] = pntt; | |
| 932 } | |
| 933 } /* mg_get_sapi_pcomp_pntt() */ | |
| 934 | |
| 935 /* | |
| 936 +------------------------------------------------------------------------------ | |
| 937 | Function : mg_set_sapi_pntt_rej | |
| 938 +------------------------------------------------------------------------------ | |
| 939 | Description : The procedures stores if a given data | |
| 940 | compression entity on a given SAPI is to be rejected in | |
| 941 | LL_XID_REQ because it cannot be set up. | |
| 942 | | |
| 943 | Parameters : FPAR IN sapi UBYTE, | |
| 944 | IN pntt UBYTE, | |
| 945 | IN rej BOOL | |
| 946 | | |
| 947 +------------------------------------------------------------------------------ | |
| 948 */ | |
| 949 LOCAL void mg_set_sapi_pntt_rej (UBYTE sapi, UBYTE pntt, BOOL rej) | |
| 950 { | |
| 951 TRACE_FUNCTION( "mg_set_sapi_pntt_rej" ); | |
| 952 { | |
| 953 UBYTE sapi_index = 0; | |
| 954 sndcp_get_sapi_index(sapi, &sapi_index); | |
| 955 sndcp_data->mg.sapi_pntt_rej_ra[sapi_index][pntt] = rej; | |
| 956 } | |
| 957 } /* mg_set_sapi_pntt_rej() */ | |
| 958 | |
| 959 /* | |
| 960 +------------------------------------------------------------------------------ | |
| 961 | Function : mg_set_sapi_pntt_state | |
| 962 +------------------------------------------------------------------------------ | |
| 963 | Description : The procedures sets the state of a given header | |
| 964 | compression entity on a given SAPI. | |
| 965 | | |
| 966 | Parameters : FPAR IN sapi UBYTE, | |
| 967 | IN pntt UBYTE, | |
| 968 | IN state UBYTE | |
| 969 | Note : sapi pntt rej will be set ti FALSE if state is UNASSIGNED | |
| 970 | | |
| 971 +------------------------------------------------------------------------------ | |
| 972 */ | |
| 973 LOCAL void mg_set_sapi_pntt_state (UBYTE sapi, UBYTE pntt, UBYTE state) | |
| 974 { | |
| 975 TRACE_FUNCTION( "mg_set_sapi_pntt_state" ); | |
| 976 { | |
| 977 UBYTE sapi_index = 0; | |
| 978 sndcp_get_sapi_index(sapi, &sapi_index); | |
| 979 sndcp_data->mg.sapi_pntt_state_ra[sapi_index][pntt] = state; | |
| 980 | |
| 981 if (state == MG_UNASSIGNED) { | |
| 982 mg_set_sapi_pntt_rej(sapi, pntt, FALSE); | |
| 983 } | |
| 984 } | |
| 985 } /* mg_set_sapi_pntt_state() */ | |
| 986 | |
| 987 #ifndef NCONFIG | |
| 988 /* | |
| 989 +------------------------------------------------------------------------------ | |
| 990 | Function : mg_config_delay | |
| 991 +------------------------------------------------------------------------------ | |
| 992 | Description : after config prim DELAY each new context activation will be | |
| 993 | computed with a delay. | |
| 994 | | |
| 995 | Parameters : delay in milliseconds | |
| 996 | | |
| 997 +------------------------------------------------------------------------------ | |
| 998 */ | |
| 999 GLOBAL void mg_config_delay (USHORT millis) | |
| 1000 { | |
| 1001 | |
| 1002 TRACE_FUNCTION("mg_config_delay"); | |
| 1003 | |
| 1004 sndcp_data->millis = millis; | |
| 1005 | |
| 1006 } /* mg_config_delay() */ | |
| 1007 #endif | |
| 1008 | |
| 1009 | |
| 1010 /* | |
| 1011 +------------------------------------------------------------------------------ | |
| 1012 | Function : mg_reset_compressors | |
| 1013 +------------------------------------------------------------------------------ | |
| 1014 | Description : All compressors used by this nsapi are reset. | |
| 1015 | | |
| 1016 | Parameters : nsapi | |
| 1017 | | |
| 1018 +------------------------------------------------------------------------------ | |
| 1019 */ | |
| 1020 GLOBAL void mg_reset_compressors (UBYTE nsapi) | |
| 1021 { | |
| 1022 BOOL compressed = FALSE; | |
| 1023 TRACE_FUNCTION( "mg_reset_compressors" ); | |
| 1024 | |
| 1025 sndcp_is_nsapi_data_compressed(nsapi, &compressed); | |
| 1026 if (compressed) { | |
| 1027 /* | |
| 1028 * Must be added when data compression is added. | |
| 1029 */ | |
| 1030 } | |
| 1031 | |
| 1032 sndcp_is_nsapi_header_compressed(nsapi, &compressed); | |
| 1033 if (compressed) { | |
| 1034 UBYTE sapi = 0; | |
| 1035 UBYTE sapi_index = 0; | |
| 1036 /* | |
| 1037 * This is implementation dependent and only works as long as only 1 | |
| 1038 * header compressor is used in cia service. | |
| 1039 */ | |
| 1040 sndcp_get_nsapi_sapi(nsapi, &sapi); | |
| 1041 sndcp_get_sapi_index(sapi, &sapi_index); | |
| 1042 sig_mg_cia_new_xid(&sndcp_data->mg.cur_xid_block[sapi_index]); | |
| 1043 } | |
| 1044 | |
| 1045 } /* mg_reset_compressors() */ | |
| 1046 | |
| 1047 | |
| 1048 | |
| 1049 /* | |
| 1050 +------------------------------------------------------------------------------ | |
| 1051 | Function : mg_reset_comp_ack | |
| 1052 +------------------------------------------------------------------------------ | |
| 1053 | Description : all compression entities using | |
| 1054 | acknowledged peer-to-peer LLC operation on this SAPI are reset. | |
| 1055 | | |
| 1056 | Parameters : sapi | |
| 1057 | | |
| 1058 +------------------------------------------------------------------------------ | |
| 1059 */ | |
| 1060 GLOBAL void mg_reset_comp_ack (UBYTE sapi) { | |
| 1061 UBYTE nsapi = 0; | |
| 1062 TRACE_FUNCTION( "mg_reset_comp_ack" ); | |
| 1063 /* | |
| 1064 * All nsapis at this sapi that use ack mode reset their compressors. | |
| 1065 */ | |
| 1066 for (nsapi = 0; nsapi < SNDCP_NUMBER_OF_NSAPIS; nsapi ++) { | |
| 1067 UBYTE s = 0; | |
| 1068 BOOL ack = FALSE; | |
| 1069 BOOL used = FALSE; | |
| 1070 sndcp_is_nsapi_used(nsapi, &used); | |
| 1071 if (!used) { | |
| 1072 continue; | |
| 1073 } | |
| 1074 sndcp_get_nsapi_sapi(nsapi, &s); | |
| 1075 sndcp_get_nsapi_ack(nsapi, &ack); | |
| 1076 if (ack && s == sapi) { | |
| 1077 mg_reset_compressors(nsapi); | |
| 1078 } | |
| 1079 } /* for all nsapis */ | |
| 1080 | |
| 1081 } /* mg_reset_comp_ack() */ | |
| 1082 | |
| 1083 | |
| 1084 /* | |
| 1085 +------------------------------------------------------------------------------ | |
| 1086 | Function : mg_reset_states_n_rej | |
| 1087 +------------------------------------------------------------------------------ | |
| 1088 | Description : Resets all states for ntts and p/dcomp to "unassigned". | |
| 1089 | Resets the arrays with information on rejcted entities. | |
| 1090 | | |
| 1091 | Parameters : index of the affected sapi | |
| 1092 | | |
| 1093 +------------------------------------------------------------------------------ | |
| 1094 */ | |
| 1095 GLOBAL void mg_reset_states_n_rej (UBYTE sapi_index) | |
| 1096 { | |
| 1097 | |
| 1098 UBYTE ntt = 0; | |
| 1099 UBYTE nsapi = 0; | |
| 1100 UBYTE dcomp = 0; | |
| 1101 UBYTE pcomp = 0; | |
| 1102 TRACE_FUNCTION( "mg_reset_states_n_rej" ); | |
| 1103 | |
| 1104 for (ntt = 0; ntt < MG_MAX_ENTITIES; ntt++) { | |
| 1105 sndcp_data->mg.sapi_dntt_state_ra[sapi_index][ntt] = MG_UNASSIGNED; | |
| 1106 sndcp_data->mg.sapi_pntt_state_ra[sapi_index][ntt] = MG_UNASSIGNED; | |
| 1107 for (nsapi = 0; nsapi < SNDCP_NUMBER_OF_NSAPIS; nsapi++) { | |
| 1108 sndcp_data->mg.sapi_dntt_nsapi_set_ra[sapi_index][ntt][nsapi] = FALSE; | |
| 1109 sndcp_data->mg.sapi_pntt_nsapi_set_ra[sapi_index][ntt][nsapi] = FALSE; | |
| 1110 } | |
| 1111 sndcp_data->mg.sapi_dntt_rej_ra[sapi_index][ntt] = FALSE; | |
| 1112 sndcp_data->mg.sapi_pntt_rej_ra[sapi_index][ntt] = FALSE; | |
| 1113 } | |
| 1114 for (dcomp = 0; dcomp < MG_MAX_DCOMP; dcomp++) { | |
| 1115 sndcp_data->mg.sapi_dcomp_state_ra[sapi_index][dcomp] = MG_UNASSIGNED; | |
| 1116 } | |
| 1117 for (pcomp = 0; pcomp < MG_MAX_PCOMP; pcomp++) { | |
| 1118 sndcp_data->mg.sapi_pcomp_state_ra[sapi_index][pcomp] = MG_UNASSIGNED; | |
| 1119 } | |
| 1120 /* | |
| 1121 * sapi_dcomp_dntt_ra, sapi_pcomp_pntt_ra not initialized. | |
| 1122 */ | |
| 1123 | |
| 1124 } /* mg_reset_states_n_rej() */ | |
| 1125 | |
| 1126 /* | |
| 1127 +------------------------------------------------------------------------------ | |
| 1128 | Function : mg_set_xid_nsapis | |
| 1129 +------------------------------------------------------------------------------ | |
| 1130 | Description : AN LL_XID_IND has delivered a desired set of nsapis for | |
| 1131 | a V42.bis or VJ compressor entity. Now this is compared to a possibly | |
| 1132 | already existing set of nsapis connected to the given entity. | |
| 1133 | Also the rules in GSM 4.65, 6.8.x are checked. | |
| 1134 | | |
| 1135 | Parameters : a flag telling if we work on V42 or VanJacobson 'nsapis': | |
| 1136 | MG_XID_V42_NSAPIS or MG_XID_VJ_NSAPIS. | |
| 1137 | affected sapi, | |
| 1138 | | |
| 1139 +------------------------------------------------------------------------------ | |
| 1140 */ | |
| 1141 LOCAL void mg_set_xid_nsapis (UBYTE sapi, UBYTE p_type) | |
| 1142 { | |
| 1143 USHORT* cur_nsapis = 0; | |
| 1144 USHORT* ind_nsapis = 0; | |
| 1145 USHORT* res_nsapis = 0; | |
| 1146 BOOL* ind_nsapis_set = NULL; | |
| 1147 UBYTE sapi_index = 0; | |
| 1148 UBYTE* p_bit = NULL; | |
| 1149 UBYTE ntt_state = MG_UNASSIGNED; | |
| 1150 U8 nsapi = 0; | |
| 1151 U8 s0_m_1_min = 0; | |
| 1152 | |
| 1153 | |
| 1154 TRACE_FUNCTION( "mg_set_xid_nsapis" ); | |
| 1155 | |
| 1156 sndcp_get_sapi_index(sapi, &sapi_index); | |
| 1157 | |
| 1158 /* | |
| 1159 * V42.bis or VanJacobson? | |
| 1160 */ | |
| 1161 if (p_type == MG_XID_V42_NSAPIS) { | |
| 1162 cur_nsapis = &(sndcp_data->mg.cur_xid_block[sapi_index].v42.nsapis); | |
| 1163 ind_nsapis = &(sndcp_data->mg.ind_xid_block[sapi_index].v42.nsapis); | |
| 1164 res_nsapis = &(sndcp_data->mg.res_xid_block[sapi_index].v42.nsapis); | |
| 1165 ind_nsapis_set = | |
| 1166 &(sndcp_data->mg.ind_xid_block[sapi_index].v42.nsapis_set); | |
| 1167 p_bit = &(sndcp_data->mg.ind_xid_block[sapi_index].v42.p_bit); | |
| 1168 | |
| 1169 *res_nsapis = 0; | |
| 1170 /* | |
| 1171 * Only those nsapis will be set in the response for which the user | |
| 1172 * requested compression. | |
| 1173 * Note: te other params are not yet set, must be implemented later. | |
| 1174 */ | |
| 1175 sndcp_data->mg.res_xid_block[sapi_index].v42.nsapis_set = FALSE; | |
| 1176 for (nsapi = 0; nsapi < SNDCP_NUMBER_OF_NSAPIS; nsapi++) { | |
| 1177 if ((((1 << nsapi) & sndcp_data->mg.user_xid_block[nsapi].v42.nsapis) > | |
| 1178 0) && | |
| 1179 (((1 << nsapi) & | |
| 1180 sndcp_data->mg.ind_xid_block[sapi_index].v42.nsapis) > 0)) { | |
| 1181 | |
| 1182 *res_nsapis |= (1 << nsapi); | |
| 1183 sndcp_data->mg.res_xid_block[sapi_index].v42.nsapis_set = TRUE; | |
| 1184 | |
| 1185 } | |
| 1186 } /* for nsapi */ | |
| 1187 | |
| 1188 } else { | |
| 1189 cur_nsapis = &(sndcp_data->mg.cur_xid_block[sapi_index].vj.nsapis); | |
| 1190 ind_nsapis = &(sndcp_data->mg.ind_xid_block[sapi_index].vj.nsapis); | |
| 1191 res_nsapis = &(sndcp_data->mg.res_xid_block[sapi_index].vj.nsapis); | |
| 1192 ind_nsapis_set = | |
| 1193 &(sndcp_data->mg.ind_xid_block[sapi_index].vj.nsapis_set); | |
| 1194 p_bit = &(sndcp_data->mg.ind_xid_block[sapi_index].vj.p_bit); | |
| 1195 | |
| 1196 *res_nsapis = 0; | |
| 1197 /* | |
| 1198 * Only those nsapis will be set in the response for which the user | |
| 1199 * requested compression. | |
| 1200 * In the same loop we set the s0_m_1 to the minimum of | |
| 1201 * the indicated value and the values requested by the user. | |
| 1202 * Also the direction is set to the minimum of all requested | |
| 1203 * directions. | |
| 1204 */ | |
| 1205 if (sndcp_data->mg.ind_xid_block[sapi_index].vj.s0_m_1 > 0) { | |
| 1206 s0_m_1_min = sndcp_data->mg.ind_xid_block[sapi_index].vj.s0_m_1; | |
| 1207 } else if (sndcp_data->mg.cur_xid_block[sapi_index].vj.s0_m_1 > 0) { | |
| 1208 s0_m_1_min = sndcp_data->mg.cur_xid_block[sapi_index].vj.s0_m_1; | |
| 1209 } else { | |
| 1210 s0_m_1_min = SNDCP_VJ_DEFAULT_S0_M_1; | |
| 1211 } | |
| 1212 #ifdef SNDCP_UPM_INCLUDED | |
| 1213 sndcp_data->mg.res_xid_block[sapi_index].vj.direction = | |
| 1214 NAS_HCOMP_BOTH_DIRECT; | |
| 1215 #else | |
| 1216 sndcp_data->mg.res_xid_block[sapi_index].vj.direction = | |
| 1217 SNSM_COMP_BOTH_DIRECT; | |
| 1218 #endif | |
| 1219 | |
| 1220 sndcp_data->mg.res_xid_block[sapi_index].vj.nsapis_set = FALSE; | |
| 1221 for (nsapi = 0; nsapi < SNDCP_NUMBER_OF_NSAPIS; nsapi++) { | |
| 1222 if (((1 << nsapi) & sndcp_data->mg.user_xid_block[nsapi].vj.nsapis) > | |
| 1223 0 && | |
| 1224 (((1 << nsapi) & | |
| 1225 sndcp_data->mg.ind_xid_block[sapi_index].vj.nsapis) > 0)) { | |
| 1226 | |
| 1227 *res_nsapis |= (1 << nsapi); | |
| 1228 sndcp_data->mg.res_xid_block[sapi_index].vj.nsapis_set = TRUE; | |
| 1229 if (sndcp_data->mg.user_xid_block[nsapi].vj.s0_m_1 < s0_m_1_min) { | |
| 1230 s0_m_1_min = sndcp_data->mg.user_xid_block[nsapi].vj.s0_m_1; | |
| 1231 } | |
| 1232 sndcp_data->mg.res_xid_block[sapi_index].vj.direction &= | |
| 1233 sndcp_data->mg.user_xid_block[nsapi].vj.direction; | |
| 1234 } | |
| 1235 } /* for nsapi */ | |
| 1236 sndcp_data->mg.res_xid_block[sapi_index].vj.s0_m_1 = s0_m_1_min; | |
| 1237 if (s0_m_1_min > 0) { | |
| 1238 sndcp_data->mg.res_xid_block[sapi_index].vj.s0_m_1_set = TRUE; | |
| 1239 } else { | |
| 1240 sndcp_data->mg.res_xid_block[sapi_index].vj.direction = 0; | |
| 1241 } | |
| 1242 } | |
| 1243 | |
| 1244 | |
| 1245 | |
| 1246 /* | |
| 1247 * Rules in GSM 4.65, 6.8.1: acknowledged and unacknowlegded contexts may not | |
| 1248 * share the same compressor. If that is demanded by the indication, reset | |
| 1249 * nsapis parameter to the ones currently used. | |
| 1250 */ | |
| 1251 if (*ind_nsapis_set && | |
| 1252 *ind_nsapis > 0) { | |
| 1253 BOOL vio = FALSE; | |
| 1254 mg_detect_mode_clash(*ind_nsapis, &vio); | |
| 1255 if (!vio) { | |
| 1256 /* | |
| 1257 * Modes are the same, set cur to res. | |
| 1258 */ | |
| 1259 *cur_nsapis = *res_nsapis; | |
| 1260 } else { | |
| 1261 *res_nsapis = *cur_nsapis; | |
| 1262 } | |
| 1263 } | |
| 1264 | |
| 1265 /* | |
| 1266 * Also from 6.8.3: If an unassigned entity number is included with the | |
| 1267 * p bit set to 0, then the Applicable NSAPIs field shall be set to 0. | |
| 1268 */ | |
| 1269 if (p_type == MG_XID_V42_NSAPIS) { | |
| 1270 mg_get_sapi_dntt_state | |
| 1271 (sapi, sndcp_data->mg.ind_xid_block[sapi_index].v42.ntt, &ntt_state); | |
| 1272 } else { | |
| 1273 mg_get_sapi_pntt_state | |
| 1274 (sapi, sndcp_data->mg.ind_xid_block[sapi_index].vj.ntt, &ntt_state); | |
| 1275 } | |
| 1276 if (ntt_state == MG_UNASSIGNED && *p_bit == 0) { | |
| 1277 *cur_nsapis = 0; | |
| 1278 *res_nsapis = 0; | |
| 1279 } | |
| 1280 | |
| 1281 } /* mg_set_xid_nsapis() */ | |
| 1282 | |
| 1283 | |
| 1284 /*==== PUBLIC FUNCTIONS =====================================================*/ | |
| 1285 | |
| 1286 | |
| 1287 /* | |
| 1288 +------------------------------------------------------------------------------ | |
| 1289 | Function : mg_check_cnf_xid | |
| 1290 +------------------------------------------------------------------------------ | |
| 1291 | Description : The confirmation of a requested XID negotiation has been | |
| 1292 | received. The answer is now checked. | |
| 1293 | A main issue is the comparison with the service variable | |
| 1294 | req_xid_block which holds the requested xid block sent to the | |
| 1295 | network. | |
| 1296 | Detected errors: | |
| 1297 | - SNDCP version number not correct | |
| 1298 | - incorrect entity number (must be proposed one) | |
| 1299 | - incorrect sense of negotiation for each parameter (down mainly, | |
| 1300 | NSAPI down bitwise) | |
| 1301 | - an entity is included in the cnf that was not requested, does not exist | |
| 1302 | Not checked: | |
| 1303 | - out of range value of parameters (must be in range if sense ofnegotiation was right. | |
| 1304 | - parameters with duplicated instances. | |
| 1305 | If one of these errors occurs ret is set to MG_XID_BAD_CONTENT, else | |
| 1306 | MG_XID_OK. | |
| 1307 | | |
| 1308 | Parameters : ret, affected sapi | |
| 1309 | | |
| 1310 +------------------------------------------------------------------------------ | |
| 1311 */ | |
| 1312 GLOBAL void mg_check_cnf_xid (UBYTE* ret, UBYTE sapi) | |
| 1313 { | |
| 1314 UBYTE sapi_index = 0; | |
| 1315 BOOL wrong = FALSE; | |
| 1316 TRACE_FUNCTION( "mg_check_cnf_xid" ); | |
| 1317 sndcp_get_sapi_index(sapi, &sapi_index); | |
| 1318 *ret = MG_XID_BAD_CONTENT; | |
| 1319 /* | |
| 1320 * Check SNDCP version. | |
| 1321 */ | |
| 1322 if (sndcp_data->mg.cnf_xid_block[sapi_index].version_set) { | |
| 1323 if (sndcp_data->mg.cnf_xid_block[sapi_index].version != | |
| 1324 SNDCP_XID_VERSION) { | |
| 1325 return; | |
| 1326 } | |
| 1327 } | |
| 1328 /* | |
| 1329 * If an entity is included that has not been requested / does not exist: | |
| 1330 * bad content! | |
| 1331 */ | |
| 1332 if (sndcp_data->mg.cnf_xid_block[sapi_index].v42.is_set && | |
| 1333 ! sndcp_data->mg.req_xid_block[sapi_index].v42.is_set && | |
| 1334 ! sndcp_data->mg.cur_xid_block[sapi_index].v42.is_set) { | |
| 1335 | |
| 1336 return; | |
| 1337 } | |
| 1338 if (sndcp_data->mg.cnf_xid_block[sapi_index].vj.is_set && | |
| 1339 ! sndcp_data->mg.req_xid_block[sapi_index].vj.is_set && | |
| 1340 ! sndcp_data->mg.cur_xid_block[sapi_index].vj.is_set) { | |
| 1341 | |
| 1342 return; | |
| 1343 } | |
| 1344 | |
| 1345 /* | |
| 1346 * Check V42 parameters, if they are set. | |
| 1347 */ | |
| 1348 if (sndcp_data->mg.cnf_xid_block[sapi_index].v42.is_set) { | |
| 1349 if (sndcp_data->mg.cnf_xid_block[sapi_index].v42.p_bit == 1) { | |
| 1350 return; | |
| 1351 } | |
| 1352 if (sndcp_data->mg.cnf_xid_block[sapi_index].v42.ntt != | |
| 1353 sndcp_data->mg.req_xid_block[sapi_index].v42.ntt) { | |
| 1354 return; | |
| 1355 } | |
| 1356 /* | |
| 1357 * Sense of negotiation. If cnf value has been set, but req has not been | |
| 1358 * set then cnf value will be compared with cur value. This | |
| 1359 * is not applied to "applicable nsapis". | |
| 1360 */ | |
| 1361 if (sndcp_data->mg.cnf_xid_block[sapi_index].v42.nsapis_set) { | |
| 1362 if (sndcp_data->mg.req_xid_block[sapi_index].v42.nsapis_set) { | |
| 1363 mg_ushort_sense_bitwise | |
| 1364 (sndcp_data->mg.cnf_xid_block[sapi_index].v42.nsapis, | |
| 1365 sndcp_data->mg.req_xid_block[sapi_index].v42.nsapis, | |
| 1366 &wrong); | |
| 1367 } | |
| 1368 if (wrong) { | |
| 1369 return; | |
| 1370 } | |
| 1371 } | |
| 1372 if (sndcp_data->mg.cnf_xid_block[sapi_index].v42.p0_set) { | |
| 1373 if (sndcp_data->mg.req_xid_block[sapi_index].v42.p0_set) { | |
| 1374 mg_ubyte_sense_bitwise(sndcp_data->mg.cnf_xid_block[sapi_index].v42.p0, | |
| 1375 sndcp_data->mg.req_xid_block[sapi_index].v42.p0, | |
| 1376 &wrong); | |
| 1377 } else { | |
| 1378 mg_ubyte_sense_bitwise(sndcp_data->mg.cnf_xid_block[sapi_index].v42.p0, | |
| 1379 sndcp_data->mg.cur_xid_block[sapi_index].v42.p0, | |
| 1380 &wrong); | |
| 1381 } | |
| 1382 if (wrong) { | |
| 1383 return; | |
| 1384 } | |
| 1385 } | |
| 1386 if (sndcp_data->mg.cnf_xid_block[sapi_index].v42.p1_set) { | |
| 1387 if (sndcp_data->mg.req_xid_block[sapi_index].v42.p1_set) { | |
| 1388 if (sndcp_data->mg.cnf_xid_block[sapi_index].v42.p1 > | |
| 1389 sndcp_data->mg.req_xid_block[sapi_index].v42.p1) { | |
| 1390 return; | |
| 1391 } | |
| 1392 } else { | |
| 1393 if (sndcp_data->mg.cnf_xid_block[sapi_index].v42.p1 > | |
| 1394 sndcp_data->mg.cur_xid_block[sapi_index].v42.p1) { | |
| 1395 return; | |
| 1396 } | |
| 1397 } | |
| 1398 } | |
| 1399 if (sndcp_data->mg.cnf_xid_block[sapi_index].v42.p2_set) { | |
| 1400 if (sndcp_data->mg.req_xid_block[sapi_index].v42.p2_set) { | |
| 1401 if (sndcp_data->mg.cnf_xid_block[sapi_index].v42.p2 > | |
| 1402 sndcp_data->mg.req_xid_block[sapi_index].v42.p2) { | |
| 1403 return; | |
| 1404 } | |
| 1405 } else { | |
| 1406 if (sndcp_data->mg.cnf_xid_block[sapi_index].v42.p2 > | |
| 1407 sndcp_data->mg.cur_xid_block[sapi_index].v42.p2) { | |
| 1408 return; | |
| 1409 } | |
| 1410 } | |
| 1411 } | |
| 1412 } | |
| 1413 /* | |
| 1414 * Check VJ parameters, if they are set. | |
| 1415 */ | |
| 1416 if (sndcp_data->mg.cnf_xid_block[sapi_index].vj.is_set) { | |
| 1417 if (sndcp_data->mg.cnf_xid_block[sapi_index].vj.p_bit == 1) { | |
| 1418 return; | |
| 1419 } | |
| 1420 if (sndcp_data->mg.cnf_xid_block[sapi_index].vj.ntt != | |
| 1421 sndcp_data->mg.req_xid_block[sapi_index].vj.ntt) { | |
| 1422 return; | |
| 1423 } | |
| 1424 /* | |
| 1425 * Sense of negotiation. | |
| 1426 */ | |
| 1427 if (sndcp_data->mg.cnf_xid_block[sapi_index].vj.nsapis_set) { | |
| 1428 if (sndcp_data->mg.req_xid_block[sapi_index].vj.nsapis_set) { | |
| 1429 mg_ushort_sense_bitwise(sndcp_data->mg.cnf_xid_block[sapi_index].vj.nsapis, | |
| 1430 sndcp_data->mg.req_xid_block[sapi_index].vj.nsapis, | |
| 1431 &wrong); | |
| 1432 } | |
| 1433 if (wrong) { | |
| 1434 return; | |
| 1435 } | |
| 1436 } | |
| 1437 if (sndcp_data->mg.cnf_xid_block[sapi_index].vj.s0_m_1_set) { | |
| 1438 if (sndcp_data->mg.req_xid_block[sapi_index].vj.s0_m_1_set) { | |
| 1439 if (sndcp_data->mg.cnf_xid_block[sapi_index].vj.s0_m_1 > | |
| 1440 sndcp_data->mg.req_xid_block[sapi_index].vj.s0_m_1) { | |
| 1441 return; | |
| 1442 } | |
| 1443 } else { | |
| 1444 if (sndcp_data->mg.cnf_xid_block[sapi_index].vj.s0_m_1 > | |
| 1445 sndcp_data->mg.cur_xid_block[sapi_index].vj.s0_m_1) { | |
| 1446 return; | |
| 1447 } | |
| 1448 } | |
| 1449 } | |
| 1450 } | |
| 1451 *ret = MG_XID_OK; | |
| 1452 | |
| 1453 } /* mg_check_cnf_xid() */ | |
| 1454 | |
| 1455 /* | |
| 1456 +------------------------------------------------------------------------------ | |
| 1457 | Function : mg_check_ind_xid | |
| 1458 +------------------------------------------------------------------------------ | |
| 1459 | Description : Service variable ind_xid_block holds the xid block indicated | |
| 1460 | by the peer. The ind_xid_block is now checked: (from 4.65 6.8.2). | |
| 1461 | Criterium 1: | |
| 1462 | If the indicated ntt is already used and pcomp or dcomp values are different, | |
| 1463 | ret is set to MG_XID_BAD_CONTENT. | |
| 1464 | Criterium 2: | |
| 1465 | If the indicated algorithm type is already used and pcomp or dcomp values | |
| 1466 | are different, ret is set to MG_XID_BAD_CONTENT. | |
| 1467 | | |
| 1468 | Note: implementation dependent: if data compression is proposed, it will | |
| 1469 | be rejected. | |
| 1470 | | |
| 1471 | Otherwise ret is set to MG_XID_OK. | |
| 1472 | Parameters : ret, affected sapi | |
| 1473 | | |
| 1474 +------------------------------------------------------------------------------ | |
| 1475 */ | |
| 1476 GLOBAL void mg_check_ind_xid (UBYTE* ret, UBYTE sapi) | |
| 1477 { | |
| 1478 UBYTE sapi_index = 0; | |
| 1479 UBYTE status = MG_UNASSIGNED; | |
| 1480 TRACE_FUNCTION( "mg_check_ind_xid" ); | |
| 1481 sndcp_get_sapi_index(sapi, &sapi_index); | |
| 1482 *ret = MG_XID_OK; | |
| 1483 | |
| 1484 /* | |
| 1485 * Check criterium 1. | |
| 1486 */ | |
| 1487 if (sndcp_data->mg.ind_xid_block[sapi_index].v42.is_set && | |
| 1488 sndcp_data->mg.ind_xid_block[sapi_index].v42.p_bit == SNDCP_P_BIT_1) { | |
| 1489 mg_get_sapi_dntt_state | |
| 1490 (sapi, sndcp_data->mg.ind_xid_block[sapi_index].v42.ntt, &status); | |
| 1491 if (status == MG_ASSIGNED) { | |
| 1492 /* | |
| 1493 * Entity already used. DCOMP values differ? | |
| 1494 */ | |
| 1495 mg_get_sapi_dcomp_state | |
| 1496 (sapi, sndcp_data->mg.ind_xid_block[sapi_index].v42.dcomp, &status); | |
| 1497 if (status != MG_ASSIGNED) { | |
| 1498 /* | |
| 1499 * The indicated dcomp is not assigned. Error. | |
| 1500 */ | |
| 1501 mg_set_sapi_dntt_rej(sapi, | |
| 1502 sndcp_data->mg.ind_xid_block[sapi_index].v42.ntt, | |
| 1503 TRUE); | |
| 1504 *ret = MG_XID_BAD_CONTENT; | |
| 1505 } else { | |
| 1506 UBYTE dntt = 0; | |
| 1507 mg_get_sapi_dcomp_dntt | |
| 1508 (sapi, sndcp_data->mg.ind_xid_block[sapi_index].v42.dcomp, &dntt); | |
| 1509 if (dntt != sndcp_data->mg.ind_xid_block[sapi_index].v42.ntt) { | |
| 1510 /* | |
| 1511 * Dcomp values differ, Error. | |
| 1512 */ | |
| 1513 mg_set_sapi_dntt_rej(sapi, | |
| 1514 sndcp_data->mg.ind_xid_block[sapi_index].v42.ntt, | |
| 1515 TRUE); | |
| 1516 *ret = MG_XID_BAD_CONTENT; | |
| 1517 } | |
| 1518 } | |
| 1519 } | |
| 1520 } | |
| 1521 if (sndcp_data->mg.ind_xid_block[sapi_index].vj.is_set && | |
| 1522 sndcp_data->mg.ind_xid_block[sapi_index].vj.p_bit == SNDCP_P_BIT_1) { | |
| 1523 mg_get_sapi_pntt_state | |
| 1524 (sapi, sndcp_data->mg.ind_xid_block[sapi_index].vj.ntt, &status); | |
| 1525 if (status == MG_ASSIGNED) { | |
| 1526 /* | |
| 1527 * Entity already used. PCOMP values differ? | |
| 1528 */ | |
| 1529 /* | |
| 1530 * PCOMP 1. | |
| 1531 */ | |
| 1532 mg_get_sapi_pcomp_state | |
| 1533 (sapi, sndcp_data->mg.ind_xid_block[sapi_index].vj.pcomp1, &status); | |
| 1534 if (status != MG_ASSIGNED) { | |
| 1535 /* | |
| 1536 * The indicated pcomp is not assigned. Error. | |
| 1537 */ | |
| 1538 mg_set_sapi_pntt_rej(sapi, | |
| 1539 sndcp_data->mg.ind_xid_block[sapi_index].vj.ntt, | |
| 1540 TRUE); | |
| 1541 *ret = MG_XID_BAD_CONTENT; | |
| 1542 } else { | |
| 1543 UBYTE pntt = 0; | |
| 1544 mg_get_sapi_pcomp_pntt | |
| 1545 (sapi, sndcp_data->mg.ind_xid_block[sapi_index].vj.pcomp1, &pntt); | |
| 1546 if (pntt != sndcp_data->mg.ind_xid_block[sapi_index].vj.ntt) { | |
| 1547 /* | |
| 1548 * Pcomp values differ, Error. | |
| 1549 */ | |
| 1550 mg_set_sapi_pntt_rej(sapi, | |
| 1551 sndcp_data->mg.ind_xid_block[sapi_index].vj.ntt, | |
| 1552 TRUE); | |
| 1553 *ret = MG_XID_BAD_CONTENT; | |
| 1554 } | |
| 1555 } | |
| 1556 /* | |
| 1557 * PCOMP 2. | |
| 1558 */ | |
| 1559 mg_get_sapi_pcomp_state | |
| 1560 (sapi, sndcp_data->mg.ind_xid_block[sapi_index].vj.pcomp1, &status); | |
| 1561 if (status != MG_ASSIGNED) { | |
| 1562 /* | |
| 1563 * The indicated pcomp is not assigned. Error. | |
| 1564 */ | |
| 1565 mg_set_sapi_pntt_rej(sapi, | |
| 1566 sndcp_data->mg.ind_xid_block[sapi_index].vj.ntt, | |
| 1567 TRUE); | |
| 1568 *ret = MG_XID_BAD_CONTENT; | |
| 1569 } else { | |
| 1570 UBYTE pntt = 0; | |
| 1571 mg_get_sapi_pcomp_pntt | |
| 1572 (sapi, sndcp_data->mg.ind_xid_block[sapi_index].vj.pcomp1, &pntt); | |
| 1573 if (pntt != sndcp_data->mg.ind_xid_block[sapi_index].vj.ntt) { | |
| 1574 /* | |
| 1575 * Dcomp values differ, Error. | |
| 1576 */ | |
| 1577 mg_set_sapi_pntt_rej(sapi, | |
| 1578 sndcp_data->mg.ind_xid_block[sapi_index].vj.ntt, | |
| 1579 TRUE); | |
| 1580 *ret = MG_XID_BAD_CONTENT; | |
| 1581 } | |
| 1582 } | |
| 1583 } | |
| 1584 } | |
| 1585 | |
| 1586 /* | |
| 1587 * Check criterium 2. | |
| 1588 * Since in the current implementation there is only SNDCP_XID_VJ and | |
| 1589 * SNDCP_XID_V42, and only 1 instance of each, | |
| 1590 * it will be sufficient to compare the proposed values for pcomp/dcomp | |
| 1591 * with the ones in cur_xid_block. | |
| 1592 * An error may only occur if cur and ind are set. | |
| 1593 */ | |
| 1594 if (sndcp_data->mg.ind_xid_block[sapi_index].v42.is_set && | |
| 1595 sndcp_data->mg.cur_xid_block[sapi_index].v42.is_set && | |
| 1596 sndcp_data->mg.ind_xid_block[sapi_index].v42.p_bit == SNDCP_P_BIT_1) { | |
| 1597 if (sndcp_data->mg.ind_xid_block[sapi_index].v42.dcomp != | |
| 1598 sndcp_data->mg.cur_xid_block[sapi_index].v42.dcomp) { | |
| 1599 mg_set_sapi_dntt_rej(sapi, | |
| 1600 sndcp_data->mg.ind_xid_block[sapi_index].v42.ntt, | |
| 1601 TRUE); | |
| 1602 *ret = MG_XID_BAD_CONTENT; | |
| 1603 } | |
| 1604 } | |
| 1605 if (sndcp_data->mg.ind_xid_block[sapi_index].vj.is_set && | |
| 1606 sndcp_data->mg.cur_xid_block[sapi_index].vj.is_set && | |
| 1607 sndcp_data->mg.ind_xid_block[sapi_index].v42.p_bit == SNDCP_P_BIT_1) { | |
| 1608 if (sndcp_data->mg.ind_xid_block[sapi_index].vj.pcomp1 != | |
| 1609 sndcp_data->mg.cur_xid_block[sapi_index].vj.pcomp1) { | |
| 1610 mg_set_sapi_pntt_rej(sapi, | |
| 1611 sndcp_data->mg.ind_xid_block[sapi_index].vj.ntt, | |
| 1612 TRUE); | |
| 1613 *ret = MG_XID_BAD_CONTENT; | |
| 1614 } | |
| 1615 if (sndcp_data->mg.ind_xid_block[sapi_index].vj.pcomp2 != | |
| 1616 sndcp_data->mg.cur_xid_block[sapi_index].vj.pcomp2) { | |
| 1617 mg_set_sapi_pntt_rej(sapi, | |
| 1618 sndcp_data->mg.ind_xid_block[sapi_index].vj.ntt, | |
| 1619 TRUE); | |
| 1620 *ret = MG_XID_BAD_CONTENT; | |
| 1621 } | |
| 1622 } | |
| 1623 | |
| 1624 #ifndef TI_PS_FF_V42BIS | |
| 1625 /* | |
| 1626 * Implementation dependent: If data compression is proposed, reject it! | |
| 1627 */ | |
| 1628 if (sndcp_data->mg.ind_xid_block[sapi_index].v42.is_set) { | |
| 1629 mg_set_sapi_dntt_rej(sapi, | |
| 1630 sndcp_data->mg.ind_xid_block[sapi_index].v42.ntt, | |
| 1631 TRUE); | |
| 1632 } | |
| 1633 #endif /* !TI_PS_FF_V42BIS */ | |
| 1634 } /* mg_check_ind_xid() */ | |
| 1635 | |
| 1636 | |
| 1637 /* | |
| 1638 +------------------------------------------------------------------------------ | |
| 1639 | Function : mg_clean_xid | |
| 1640 +------------------------------------------------------------------------------ | |
| 1641 | Description : Cleans up the XID organizing arrays for nsapis and ntts | |
| 1642 | | |
| 1643 | Parameters : | |
| 1644 | | |
| 1645 +------------------------------------------------------------------------------ | |
| 1646 */ | |
| 1647 GLOBAL void mg_clean_xid (UBYTE sapi) { | |
| 1648 UBYTE nsapi = 0; | |
| 1649 UBYTE sapi_index = 0; | |
| 1650 UBYTE stat = MG_UNASSIGNED; | |
| 1651 TRACE_FUNCTION( "mg_clean_xid" ); | |
| 1652 sndcp_get_sapi_index(sapi, &sapi_index); | |
| 1653 | |
| 1654 | |
| 1655 /* | |
| 1656 * NSAPIs that were assigned to a compressor unit but are not any more. | |
| 1657 */ | |
| 1658 for (nsapi = 0; nsapi < SNDCP_NUMBER_OF_NSAPIS; nsapi++) { | |
| 1659 BOOL connected = | |
| 1660 ((1 << nsapi) & (sndcp_data->mg.cur_xid_block[sapi_index].v42.nsapis)) > 0; | |
| 1661 mg_set_sapi_dntt_nsapi(sapi, | |
| 1662 sndcp_data->mg.cur_xid_block[sapi_index].v42.ntt, | |
| 1663 nsapi, | |
| 1664 connected); | |
| 1665 connected = | |
| 1666 ((1 << nsapi) & (sndcp_data->mg.cur_xid_block[sapi_index].vj.nsapis)) > 0; | |
| 1667 mg_set_sapi_pntt_nsapi(sapi, | |
| 1668 sndcp_data->mg.cur_xid_block[sapi_index].vj.ntt, | |
| 1669 nsapi, | |
| 1670 connected); | |
| 1671 | |
| 1672 | |
| 1673 } | |
| 1674 | |
| 1675 /* | |
| 1676 * Formerly assigned ntts that are now unassigned are cleaned. | |
| 1677 * Implemented here: the one dntt and the one pntt in cur_xid_block are now | |
| 1678 * checked. If they are in state MG_ASSIGNED but the affected 'nsapis' | |
| 1679 * element is set to all '0' then the entities enter state MG_UNASSIGNED, | |
| 1680 * all nsapis re set to FALSE in the sapi_?ntt_nsapi_ra, all | |
| 1681 * affected pcomp/dcomp values are set to MG_UNASSIGNED. | |
| 1682 */ | |
| 1683 mg_get_sapi_dntt_state(sapi, | |
| 1684 sndcp_data->mg.cur_xid_block[sapi_index].v42.ntt, | |
| 1685 &stat); | |
| 1686 if (stat == MG_ASSIGNED && | |
| 1687 sndcp_data->mg.cur_xid_block[sapi_index].v42.nsapis == 0) { | |
| 1688 /* | |
| 1689 * Reset dntt state. | |
| 1690 */ | |
| 1691 mg_set_sapi_dntt_state(sapi, | |
| 1692 sndcp_data->mg.cur_xid_block[sapi_index].v42.ntt, | |
| 1693 MG_UNASSIGNED); | |
| 1694 | |
| 1695 /* | |
| 1696 * reset nsapi connections. | |
| 1697 */ | |
| 1698 for (nsapi = 0; nsapi < SNDCP_NUMBER_OF_NSAPIS; nsapi++) { | |
| 1699 mg_set_sapi_dntt_nsapi(sapi, | |
| 1700 sndcp_data->mg.cur_xid_block[sapi_index].v42.ntt, | |
| 1701 nsapi, | |
| 1702 FALSE); | |
| 1703 } | |
| 1704 /* | |
| 1705 * Reset dcomp. | |
| 1706 */ | |
| 1707 mg_set_sapi_dcomp_state(sapi, | |
| 1708 sndcp_data->mg.cur_xid_block[sapi_index].v42.dcomp, | |
| 1709 MG_UNASSIGNED); | |
| 1710 } | |
| 1711 | |
| 1712 | |
| 1713 /* | |
| 1714 * The same for header compresion. | |
| 1715 */ | |
| 1716 mg_get_sapi_pntt_state(sapi, | |
| 1717 sndcp_data->mg.cur_xid_block[sapi_index].vj.ntt, | |
| 1718 &stat); | |
| 1719 if (stat == MG_ASSIGNED && | |
| 1720 sndcp_data->mg.cur_xid_block[sapi_index].vj.nsapis == 0) { | |
| 1721 /* | |
| 1722 * Reset pntt state. | |
| 1723 */ | |
| 1724 mg_set_sapi_pntt_state(sapi, | |
| 1725 sndcp_data->mg.cur_xid_block[sapi_index].vj.ntt, | |
| 1726 MG_UNASSIGNED); | |
| 1727 /* | |
| 1728 * reset nsapi connections. | |
| 1729 */ | |
| 1730 for (nsapi = 0; nsapi < SNDCP_NUMBER_OF_NSAPIS; nsapi++) { | |
| 1731 mg_set_sapi_pntt_nsapi(sapi, | |
| 1732 sndcp_data->mg.cur_xid_block[sapi_index].vj.ntt, | |
| 1733 nsapi, | |
| 1734 FALSE); | |
| 1735 } | |
| 1736 /* | |
| 1737 * Reset pcomps. | |
| 1738 */ | |
| 1739 mg_set_sapi_pcomp_state(sapi, | |
| 1740 sndcp_data->mg.cur_xid_block[sapi_index].vj.pcomp1, | |
| 1741 MG_UNASSIGNED); | |
| 1742 mg_set_sapi_pcomp_state(sapi, | |
| 1743 sndcp_data->mg.cur_xid_block[sapi_index].vj.pcomp2, | |
| 1744 MG_UNASSIGNED); | |
| 1745 } | |
| 1746 | |
| 1747 | |
| 1748 | |
| 1749 } /* mg_clean_xid() */ | |
| 1750 | |
| 1751 /* | |
| 1752 +------------------------------------------------------------------------------ | |
| 1753 | Function : mg_col_no_re | |
| 1754 +------------------------------------------------------------------------------ | |
| 1755 | Description : The function mg_col_no_re represents the SDL label | |
| 1756 | COL_NO_RE: an LL_ESTABLISH_IND has been received, we do | |
| 1757 | have a collision situation like given in [GSM 4.65, 6.2.1.4], | |
| 1758 | we do not have a re-establishment situation. | |
| 1759 | | |
| 1760 | Parameters : the received LL_ESTABLISH_IND | |
| 1761 | | |
| 1762 +------------------------------------------------------------------------------ | |
| 1763 */ | |
| 1764 GLOBAL void mg_col_no_re (T_LL_ESTABLISH_IND* ll_establish_ind) | |
| 1765 { | |
| 1766 TRACE_FUNCTION( "mg_col_no_re" ); | |
| 1767 | |
| 1768 /* | |
| 1769 * Resume data transfer suspended due to pending establishment; | |
| 1770 */ | |
| 1771 sig_mg_su_resume(ll_establish_ind->sapi); | |
| 1772 sig_mg_sua_resume(ll_establish_ind->sapi); | |
| 1773 mg_resume_affected_nus(ll_establish_ind->sapi); | |
| 1774 | |
| 1775 /* | |
| 1776 * Now proceed like without collision. | |
| 1777 */ | |
| 1778 mg_no_col_no_re(ll_establish_ind); | |
| 1779 | |
| 1780 | |
| 1781 } /* mg_col_no_re() */ | |
| 1782 | |
| 1783 | |
| 1784 /* | |
| 1785 +------------------------------------------------------------------------------ | |
| 1786 | Function : mg_col_re | |
| 1787 +------------------------------------------------------------------------------ | |
| 1788 | Description : The function mg_col_re represents the SDL label | |
| 1789 | COL_RE: an LL_ESTABLISH_IND has been received, we do | |
| 1790 | have a collision situation like given in [GSM 4.65, 6.2.1.4], | |
| 1791 | we do have a re-establishment situation. | |
| 1792 | | |
| 1793 | Parameters : the received LL_ESTABLISH_IND | |
| 1794 | | |
| 1795 +------------------------------------------------------------------------------ | |
| 1796 */ | |
| 1797 GLOBAL void mg_col_re (T_LL_ESTABLISH_IND* ll_establish_ind) | |
| 1798 { | |
| 1799 TRACE_FUNCTION( "mg_col_re" ); | |
| 1800 /* | |
| 1801 * Resume data transfer suspended due to pending establishment; | |
| 1802 */ | |
| 1803 sig_mg_su_resume(ll_establish_ind->sapi); | |
| 1804 sig_mg_sua_resume(ll_establish_ind->sapi); | |
| 1805 mg_resume_affected_nus(ll_establish_ind->sapi); | |
| 1806 /* | |
| 1807 * Now proceed like without collision. | |
| 1808 */ | |
| 1809 mg_no_col_re(ll_establish_ind); | |
| 1810 } /* mg_col_re() */ | |
| 1811 | |
| 1812 /* | |
| 1813 +------------------------------------------------------------------------------ | |
| 1814 | Function : mg_decode_xid | |
| 1815 +------------------------------------------------------------------------------ | |
| 1816 | Description : Implementation dependent. | |
| 1817 | The entity number | |
| 1818 | Works only for algorithm types 0 | |
| 1819 | (V42 for data and VanJacobson for header). | |
| 1820 | This procedure reads the given xid block (in form of an sdu) | |
| 1821 | and writes the fields to the given xid_block variable, if | |
| 1822 | compression fields for algorithms 0 (V42 or VanJacobson) are | |
| 1823 | given. | |
| 1824 | If the parsed sdu starts a negotiation then the p bit will be | |
| 1825 | set to 1 and the "algorithm type" field will be included. If | |
| 1826 | the parsed sdu ends a negotiation then the p bit will be set | |
| 1827 | to 0 and the "algorithm type" field will not be included. | |
| 1828 | In this case it will be checked if the "entity number" field | |
| 1829 | corresponds with the entity number set in req_xid_block. | |
| 1830 | | |
| 1831 | Note: This procedure only re-formats the xid_block. The content | |
| 1832 | of the xid_block are not checked. This will be done in a later | |
| 1833 | procedure on the basis of the xid_block filled in here. | |
| 1834 | The only error possibly detected is returned, if the byte format | |
| 1835 | of the given xid block sdu is not correct: MG_XID_BAD_FORMAT. | |
| 1836 | Then parameter type 1 list is read. If a data comp field has | |
| 1837 | an algorithm of type 0 (V42bis) then its values are written | |
| 1838 | to the given xid_block. If the algorithm is not 0 (V42bis) then | |
| 1839 | the entity is rejected. | |
| 1840 | The same for parameter type 2, here only algorithm type 0 | |
| 1841 | (VanJacobson) is written to the xid_block. | |
| 1842 | Note: it is assumed here that the parameters come in line 0, 1, 2. | |
| 1843 | If that will no be the case, the parsing will have to modified | |
| 1844 | slightly. | |
| 1845 | If an unknown parameter type (not 0, 1, 2) is detected, an | |
| 1846 | MG_XID_BAD_FORMAT is returned. | |
| 1847 | | |
| 1848 | Parameters : the sdu to be parsed, is negotiation started here?, the | |
| 1849 | destination T_XID_BLOCK, a return value that should be MG_XID_OK | |
| 1850 | | |
| 1851 +------------------------------------------------------------------------------ | |
| 1852 */ | |
| 1853 GLOBAL void mg_decode_xid (T_sdu* sdu, | |
| 1854 T_XID_BLOCK* xid_block, | |
| 1855 UBYTE* ret, | |
| 1856 UBYTE sapi) | |
| 1857 { | |
| 1858 | |
| 1859 #define CHECK_XID_BUFFER_LEN if (index + field_index >= ((sdu->l_buf) >> 3)) return | |
| 1860 UBYTE sapi_index = 0; | |
| 1861 /* | |
| 1862 * Index for the whole sdu. | |
| 1863 */ | |
| 1864 USHORT index = sdu->o_buf / 8; | |
| 1865 /* | |
| 1866 * Sub index used in compression fields. | |
| 1867 */ | |
| 1868 USHORT field_index = 0; | |
| 1869 /* | |
| 1870 * This is the index where the parameter 2 for header compression begins. | |
| 1871 */ | |
| 1872 USHORT beginning_of_header_comp = 0; | |
| 1873 /* | |
| 1874 * Length of complete parameter blocks of type 1 or 2. | |
| 1875 */ | |
| 1876 USHORT length = 0; | |
| 1877 /* | |
| 1878 * Was decoding successful? | |
| 1879 */ | |
| 1880 BOOL ok = FALSE; | |
| 1881 | |
| 1882 TRACE_FUNCTION( "mg_decode_xid" ); | |
| 1883 | |
| 1884 /* | |
| 1885 * Reset xid_block. | |
| 1886 */ | |
| 1887 sndcp_reset_xid_block(xid_block); | |
| 1888 | |
| 1889 sndcp_get_sapi_index(sapi, &sapi_index); | |
| 1890 *ret = MG_XID_BAD_FORMAT; | |
| 1891 | |
| 1892 /* | |
| 1893 * If end is reached, return with ok. | |
| 1894 */ | |
| 1895 if (sdu->l_buf == 0) { | |
| 1896 *ret = MG_XID_OK; | |
| 1897 return; | |
| 1898 } | |
| 1899 /* | |
| 1900 * If parameter type 0 is included, store it. | |
| 1901 */ | |
| 1902 CHECK_XID_BUFFER_LEN; | |
| 1903 if (sdu->buf[index] == SNDCP_XID_PARAM_TYPE_0) { | |
| 1904 index++; | |
| 1905 xid_block->version_set = TRUE; | |
| 1906 /* | |
| 1907 * Length should be SNDCP_XID_0_LEN, but is not checked. | |
| 1908 */ | |
| 1909 CHECK_XID_BUFFER_LEN; | |
| 1910 length = sdu->buf[index]; | |
| 1911 | |
| 1912 index++; | |
| 1913 /* | |
| 1914 * Set the version in xid_block. | |
| 1915 */ | |
| 1916 CHECK_XID_BUFFER_LEN; | |
| 1917 xid_block->version = sdu->buf[index]; | |
| 1918 index+= length; | |
| 1919 } | |
| 1920 | |
| 1921 /* | |
| 1922 * If end is reached, return with ok. | |
| 1923 */ | |
| 1924 if (index == ((sdu->l_buf) >> 3)) { | |
| 1925 *ret = MG_XID_OK; | |
| 1926 return; | |
| 1927 } | |
| 1928 | |
| 1929 /* | |
| 1930 * If parameter type 1 is included, store it. | |
| 1931 */ | |
| 1932 if (sdu->buf[index] == SNDCP_XID_PARAM_TYPE_1) { | |
| 1933 /* | |
| 1934 * Length of all data compression parameters. | |
| 1935 */ | |
| 1936 index++; | |
| 1937 CHECK_XID_BUFFER_LEN; | |
| 1938 length = sdu->buf[index]; | |
| 1939 /* | |
| 1940 * This is the index where the parameter 2 infos for header compression | |
| 1941 * begin. | |
| 1942 */ | |
| 1943 beginning_of_header_comp = index + length + 1; | |
| 1944 | |
| 1945 /* | |
| 1946 * Search data compression parameters for algorithm type 1. | |
| 1947 */ | |
| 1948 while (length > 0) { | |
| 1949 /* | |
| 1950 * Index is now on p-bit-entity-octet for one field. | |
| 1951 * If the p bit is set to 1 then we read the algorithm | |
| 1952 * type and drop the field if it is not SNDCP_XID_V42. | |
| 1953 * If the p bit is not set to 1 then we read the | |
| 1954 * entity number and drop the field if it is not the entity number | |
| 1955 * proposed in req_xid_block. | |
| 1956 */ | |
| 1957 | |
| 1958 /* | |
| 1959 * Set field_index to beginning of next data compression field. | |
| 1960 */ | |
| 1961 field_index++; | |
| 1962 | |
| 1963 CHECK_XID_BUFFER_LEN; | |
| 1964 if ((sdu->buf[index + field_index] & 0x80) > 0) { | |
| 1965 /* | |
| 1966 * P bit set to 1. Check algorithm type and drop field if | |
| 1967 * type is not known. | |
| 1968 * Set ntt. | |
| 1969 */ | |
| 1970 xid_block->v42.ntt = sdu->buf[index + field_index] & 0x1F; | |
| 1971 /* | |
| 1972 * Set field_index to algorithm type. | |
| 1973 */ | |
| 1974 field_index ++; | |
| 1975 CHECK_XID_BUFFER_LEN; | |
| 1976 if ((sdu->buf[index + field_index] & 0xf) != SNDCP_XID_V42) { | |
| 1977 /* | |
| 1978 * Wrong algorithm type. Add the ntt to list of rejected ones. | |
| 1979 */ | |
| 1980 mg_set_sapi_dntt_rej(sapi, xid_block->v42.ntt, TRUE); | |
| 1981 /* | |
| 1982 * Set index to length octet. | |
| 1983 */ | |
| 1984 field_index ++; | |
| 1985 /* | |
| 1986 * Set index to next field. Check field length. | |
| 1987 */ | |
| 1988 CHECK_XID_BUFFER_LEN; | |
| 1989 field_index += sdu->buf[index + field_index]; | |
| 1990 if (field_index > length) { | |
| 1991 /* | |
| 1992 * Field is too long, bad format. | |
| 1993 */ | |
| 1994 return; | |
| 1995 } | |
| 1996 if (field_index == length) { | |
| 1997 /* | |
| 1998 * Field is completed but entity number has not been found because in | |
| 1999 * that case the loop would have been left with break; | |
| 2000 */ | |
| 2001 xid_block->v42.is_set = FALSE; | |
| 2002 break; | |
| 2003 } | |
| 2004 continue; | |
| 2005 } else { | |
| 2006 /* | |
| 2007 * Correct algorithm type. | |
| 2008 */ | |
| 2009 if (xid_block->v42.is_set == FALSE) { | |
| 2010 /* | |
| 2011 * This is the first occurrence. | |
| 2012 */ | |
| 2013 xid_block->v42.is_set = TRUE; | |
| 2014 xid_block->v42.p_bit = 1; | |
| 2015 | |
| 2016 | |
| 2017 mg_decode_v42(sdu, | |
| 2018 &index, | |
| 2019 &field_index, | |
| 2020 xid_block, | |
| 2021 &ok, | |
| 2022 SNDCP_P_BIT_1); | |
| 2023 if (!ok) { | |
| 2024 /* | |
| 2025 * Decoding was not successful. | |
| 2026 */ | |
| 2027 return; | |
| 2028 } | |
| 2029 } else { | |
| 2030 /* | |
| 2031 * There has been an occurrence of this algorithm. | |
| 2032 */ | |
| 2033 /* | |
| 2034 * Set index to length octet. | |
| 2035 */ | |
| 2036 field_index ++; | |
| 2037 /* | |
| 2038 * Set index to next field. Check field length. | |
| 2039 */ | |
| 2040 CHECK_XID_BUFFER_LEN; | |
| 2041 field_index += sdu->buf[index + field_index]; | |
| 2042 if (field_index > length) { | |
| 2043 /* | |
| 2044 * Field is too long, bad format. | |
| 2045 */ | |
| 2046 return; | |
| 2047 } | |
| 2048 if (field_index == length) { | |
| 2049 /* | |
| 2050 * Field is completed. | |
| 2051 */ | |
| 2052 break; | |
| 2053 } | |
| 2054 | |
| 2055 } | |
| 2056 /* | |
| 2057 * If all data parameters are read, go ahead for header ones. | |
| 2058 */ | |
| 2059 if (field_index == length) { | |
| 2060 break; | |
| 2061 } | |
| 2062 } | |
| 2063 } else { | |
| 2064 /* | |
| 2065 * P bit set to 0. | |
| 2066 * Check entity number and drop field if it is not the proposed one or | |
| 2067 * V42 has not been proposed yet. | |
| 2068 * field_index is already on p-bit-entity-octet. | |
| 2069 */ | |
| 2070 CHECK_XID_BUFFER_LEN; | |
| 2071 if (((sdu->buf[index + field_index] & 0x1f) != | |
| 2072 xid_block->v42.ntt) && xid_block->v42.is_set) { | |
| 2073 /* | |
| 2074 * Wrong entity number. | |
| 2075 */ | |
| 2076 /* | |
| 2077 * Set field_index to length octet. | |
| 2078 */ | |
| 2079 field_index ++; | |
| 2080 /* | |
| 2081 * Set index to next field. Check field length. | |
| 2082 */ | |
| 2083 CHECK_XID_BUFFER_LEN; | |
| 2084 field_index += sdu->buf[index + field_index]; | |
| 2085 if (field_index > length) { | |
| 2086 /* | |
| 2087 * Field is too long, bad format. | |
| 2088 */ | |
| 2089 return; | |
| 2090 } | |
| 2091 if (field_index == length) { | |
| 2092 /* | |
| 2093 * Field is completed but entity number has not been found because in | |
| 2094 * that case the loop would have been left with break; | |
| 2095 */ | |
| 2096 xid_block->v42.is_set = FALSE; | |
| 2097 break; | |
| 2098 } | |
| 2099 continue; | |
| 2100 } else { | |
| 2101 /* | |
| 2102 * The entity number of this field equals the entity number in | |
| 2103 * ththat is already in the xid block or there is no entity in | |
| 2104 * the xid block yet. | |
| 2105 */ | |
| 2106 xid_block->v42.is_set = TRUE; | |
| 2107 xid_block->v42.p_bit = 0; | |
| 2108 xid_block->v42.ntt = | |
| 2109 (sdu->buf[index + field_index] & 0x1f); | |
| 2110 | |
| 2111 mg_decode_v42(sdu, | |
| 2112 &index, | |
| 2113 &field_index, | |
| 2114 xid_block, | |
| 2115 &ok, | |
| 2116 SNDCP_P_BIT_0); | |
| 2117 if (!ok) { | |
| 2118 /* | |
| 2119 * Decoding was not successful. | |
| 2120 */ | |
| 2121 return; | |
| 2122 } | |
| 2123 | |
| 2124 /* | |
| 2125 * If all data parameters are read, go ahead for header ones. | |
| 2126 */ | |
| 2127 if (field_index == length) { | |
| 2128 break; | |
| 2129 } | |
| 2130 } | |
| 2131 } /* p bit set to 0 */ | |
| 2132 } /* while */ | |
| 2133 field_index = 0; | |
| 2134 index = beginning_of_header_comp; | |
| 2135 } | |
| 2136 | |
| 2137 /* | |
| 2138 * Now comes the header compression parameter type 2. | |
| 2139 * Is it omitted? | |
| 2140 */ | |
| 2141 if (index == ((sdu->l_buf) >> 3)) { | |
| 2142 *ret = MG_XID_OK; | |
| 2143 return; | |
| 2144 } | |
| 2145 | |
| 2146 /* | |
| 2147 * Parameter type should be SNDCP_XID_PARAM_TYPE_2. | |
| 2148 */ | |
| 2149 CHECK_XID_BUFFER_LEN; | |
| 2150 if (sdu->buf[index] != SNDCP_XID_PARAM_TYPE_2) { | |
| 2151 return; | |
| 2152 } | |
| 2153 /* | |
| 2154 * Length of all header compression parameters. | |
| 2155 */ | |
| 2156 index++; | |
| 2157 CHECK_XID_BUFFER_LEN; | |
| 2158 length = sdu->buf[index]; | |
| 2159 | |
| 2160 | |
| 2161 /* | |
| 2162 * Search header compression parameters for algorithm type 2. | |
| 2163 */ | |
| 2164 while (length > 0) { | |
| 2165 /* | |
| 2166 * Index is now on p-bit-entity-octet for one field. | |
| 2167 * If the p bit is set to 1 then we read the algorithm | |
| 2168 * type and drop the field if it is not SNDCP_XID_VJ. | |
| 2169 * If the p bit is not set to 1 then we read the | |
| 2170 * entity number and drop the field if it is not the entity number | |
| 2171 * proposed in req_xid_block. | |
| 2172 */ | |
| 2173 /* | |
| 2174 * Set field_index to beginning of next header compression field. | |
| 2175 */ | |
| 2176 field_index++; | |
| 2177 CHECK_XID_BUFFER_LEN; | |
| 2178 if ((sdu->buf[index + field_index] & 0x80) > 0) { | |
| 2179 UBYTE ntt = 0; | |
| 2180 /* | |
| 2181 * P bit set to 1. Check algorithm type and drop field if | |
| 2182 * type is not known. | |
| 2183 * Set ntt. | |
| 2184 */ | |
| 2185 ntt = sdu->buf[index + field_index] & 0x1F; | |
| 2186 | |
| 2187 /* | |
| 2188 * Set index to algorithm type. | |
| 2189 */ | |
| 2190 field_index ++; | |
| 2191 CHECK_XID_BUFFER_LEN; | |
| 2192 if (((sdu->buf[index + field_index] & 0xf) != SNDCP_XID_VJ) | |
| 2193 || | |
| 2194 ((sndcp_data->mg.cur_xid_block[sapi_index].vj.is_set) && | |
| 2195 (xid_block->vj.is_set == FALSE) && | |
| 2196 (ntt != sndcp_data->mg.cur_xid_block[sapi_index].vj.ntt) | |
| 2197 ) | |
| 2198 ) { | |
| 2199 /* | |
| 2200 * Wrong algorithm type or | |
| 2201 * vj comp is currently used and proposed ntt is not equal to currently | |
| 2202 * used one. | |
| 2203 * Add ntt to list of rejected ones. | |
| 2204 */ | |
| 2205 mg_set_sapi_pntt_rej(sapi, ntt, TRUE); | |
| 2206 /* | |
| 2207 * Set index to length octet. | |
| 2208 */ | |
| 2209 field_index ++; | |
| 2210 /* | |
| 2211 * Set index to next field. Check field length. | |
| 2212 */ | |
| 2213 CHECK_XID_BUFFER_LEN; | |
| 2214 field_index += sdu->buf[index + field_index]; | |
| 2215 if (field_index > length) { | |
| 2216 /* | |
| 2217 * Field is too long, bad format. | |
| 2218 */ | |
| 2219 return; | |
| 2220 } | |
| 2221 if (field_index == length) { | |
| 2222 /* | |
| 2223 * Field is completed but entity number has not been found because in | |
| 2224 * that case the loop would have been left with break; | |
| 2225 */ | |
| 2226 xid_block->vj.is_set = FALSE; | |
| 2227 break; | |
| 2228 } | |
| 2229 continue; | |
| 2230 } | |
| 2231 /* | |
| 2232 * Correct algorithm type and vj requested. | |
| 2233 */ | |
| 2234 /* | |
| 2235 * If no vj comp is currently used and xid_block.vj is not set yet, take | |
| 2236 * the proposed one. | |
| 2237 * Also if vj comp is currently used and xid block is not yet set and | |
| 2238 * proposed ntt is equal to currently used one. | |
| 2239 */ | |
| 2240 if (((! sndcp_data->mg.cur_xid_block[sapi_index].vj.is_set) && | |
| 2241 (xid_block->vj.is_set == FALSE)) | |
| 2242 || | |
| 2243 ((sndcp_data->mg.cur_xid_block[sapi_index].vj.is_set) && | |
| 2244 (xid_block->vj.is_set == FALSE) && | |
| 2245 (ntt == sndcp_data->mg.cur_xid_block[sapi_index].vj.ntt))) { | |
| 2246 | |
| 2247 xid_block->vj.is_set = TRUE; | |
| 2248 xid_block->vj.p_bit = 1; | |
| 2249 xid_block->vj.ntt = ntt; | |
| 2250 | |
| 2251 mg_decode_vj (sdu, | |
| 2252 &index, | |
| 2253 &field_index, | |
| 2254 xid_block, | |
| 2255 &ok, | |
| 2256 SNDCP_P_BIT_1); | |
| 2257 if (!ok) { | |
| 2258 /* | |
| 2259 * Decoding was not successful. | |
| 2260 */ | |
| 2261 return; | |
| 2262 } | |
| 2263 /* | |
| 2264 * If all header parameters are read, go ahead for header ones. | |
| 2265 */ | |
| 2266 if (field_index == length) { | |
| 2267 break; | |
| 2268 } | |
| 2269 continue; | |
| 2270 } | |
| 2271 /* | |
| 2272 * This is not the first occurrence. Ignore. | |
| 2273 */ | |
| 2274 /* | |
| 2275 * Set index to length octet. | |
| 2276 */ | |
| 2277 field_index ++; | |
| 2278 /* | |
| 2279 * Set index to next field. Check field length. | |
| 2280 */ | |
| 2281 CHECK_XID_BUFFER_LEN; | |
| 2282 field_index += sdu->buf[index + field_index]; | |
| 2283 if (field_index > length) { | |
| 2284 /* | |
| 2285 * Field is too long, bad format. | |
| 2286 */ | |
| 2287 return; | |
| 2288 } | |
| 2289 if (field_index == length) { | |
| 2290 /* | |
| 2291 * Field is completed. | |
| 2292 */ | |
| 2293 break; | |
| 2294 } | |
| 2295 | |
| 2296 } else { | |
| 2297 /* | |
| 2298 * P bit set to 0. | |
| 2299 * Check entity number and drop field if it is not the proposed one or | |
| 2300 * VJ has not been proposed yet. | |
| 2301 * Index is already on p-bit-entity-octet. | |
| 2302 */ | |
| 2303 CHECK_XID_BUFFER_LEN; | |
| 2304 if (((sdu->buf[index + field_index] & 0x1f) != | |
| 2305 xid_block->vj.ntt) && xid_block->vj.is_set) { | |
| 2306 /* | |
| 2307 * Wrong entity number. | |
| 2308 * Set index to length octet. | |
| 2309 */ | |
| 2310 field_index ++; | |
| 2311 /* | |
| 2312 * Set index to next field. Check field length. | |
| 2313 */ | |
| 2314 CHECK_XID_BUFFER_LEN; | |
| 2315 field_index += sdu->buf[index + field_index]; | |
| 2316 if (field_index > length) { | |
| 2317 /* | |
| 2318 * Field is too long, bad format. | |
| 2319 */ | |
| 2320 return; | |
| 2321 } | |
| 2322 if (field_index == length) { | |
| 2323 /* | |
| 2324 * Field is completed but entity number has not been found because in | |
| 2325 * that case the loop would have been left with break; | |
| 2326 */ | |
| 2327 break; | |
| 2328 } | |
| 2329 continue; | |
| 2330 } else { | |
| 2331 /* | |
| 2332 * The entity number of this field equals the entity number in | |
| 2333 * that is already in the xid_block or there is no entity number | |
| 2334 * in the block yet. | |
| 2335 */ | |
| 2336 xid_block->vj.is_set = TRUE; | |
| 2337 xid_block->vj.p_bit = 0; | |
| 2338 xid_block->vj.ntt = | |
| 2339 (sdu->buf[index + field_index] & 0x1f); | |
| 2340 | |
| 2341 mg_decode_vj (sdu, | |
| 2342 &index, | |
| 2343 &field_index, | |
| 2344 xid_block, | |
| 2345 &ok, | |
| 2346 SNDCP_P_BIT_0); | |
| 2347 if (!ok) { | |
| 2348 /* | |
| 2349 * Decoding was not successful. | |
| 2350 */ | |
| 2351 return; | |
| 2352 } | |
| 2353 /* | |
| 2354 * The one field with same entity number as in req_xid_block has been | |
| 2355 * found and loop of data compression field may be left. | |
| 2356 * If errors in not used fields are to be detected then we must continue here! | |
| 2357 */ | |
| 2358 /* | |
| 2359 * If all header parameters are read, leave. | |
| 2360 */ | |
| 2361 if (field_index == length) { | |
| 2362 break; | |
| 2363 } | |
| 2364 } | |
| 2365 } | |
| 2366 } /* while */ | |
| 2367 /* | |
| 2368 * It is not checked here whether the sdu is completely read. | |
| 2369 */ | |
| 2370 *ret = MG_XID_OK; | |
| 2371 | |
| 2372 } /* mg_decode_xid() */ | |
| 2373 | |
| 2374 | |
| 2375 /* | |
| 2376 +------------------------------------------------------------------------------ | |
| 2377 | Function : mg_dti_close | |
| 2378 +------------------------------------------------------------------------------ | |
| 2379 | Description : Closes DTI connection | |
| 2380 | Parameters : nsapi | |
| 2381 +------------------------------------------------------------------------------ | |
| 2382 */ | |
| 2383 GLOBAL void mg_dti_close (UBYTE nsapi) | |
| 2384 { | |
| 2385 | |
| 2386 #ifdef _SNDCP_DTI_2_ | |
| 2387 UBYTE interfac = SNDCP_INTERFACE_UNACK; | |
| 2388 #ifndef SNDCP_UPM_INCLUDED | |
| 2389 sndcp_get_nsapi_interface(nsapi, &interfac); | |
| 2390 #endif /*#ifdef SNDCP_UPM_INCLUDED*/ | |
| 2391 dti_close(sndcp_data->hDTI, /* DTI_HANDLE *hDTI, */ | |
| 2392 0, /* U8 instance, */ | |
| 2393 interfac, /* U8 interface, */ | |
| 2394 nsapi, | |
| 2395 NULL/* U8 channel); */ | |
| 2396 ); | |
| 2397 #else /*_SNDCP_DTI_2_*/ | |
| 2398 UBYTE interfac = SNDCP_INTERFACE_UNACK; | |
| 2399 | |
| 2400 sndcp_get_nsapi_interface(nsapi, &interfac); | |
| 2401 dti_close(sndcp_data->hDTI, /* DTI_HANDLE *hDTI, */ | |
| 2402 0, /* U8 instance, */ | |
| 2403 interfac, /* U8 interface, */ | |
| 2404 nsapi /* U8 channel); */ | |
| 2405 | |
| 2406 ); | |
| 2407 #endif /*_SNDCP_DTI_2_*/ | |
| 2408 | |
| 2409 /* | |
| 2410 * The following is done in any case since the callback will not be called. | |
| 2411 */ | |
| 2412 nu_connection_state(nsapi, FALSE); | |
| 2413 | |
| 2414 /*FIXME ! Added newly. To be verified.*/ | |
| 2415 #ifdef SNDCP_UPM_INCLUDED | |
| 2416 { | |
| 2417 U32 linkid = 0; | |
| 2418 PALLOC (sn_dti_cnf, SN_DTI_CNF); | |
| 2419 sndcp_get_nsapi_linkid(nsapi, &linkid); | |
| 2420 sn_dti_cnf->dti_linkid = linkid; | |
| 2421 sn_dti_cnf->dti_conn = NAS_DISCONNECT_DTI; | |
| 2422 PSEND(hCommMMI, sn_dti_cnf); | |
| 2423 } | |
| 2424 #endif /*#ifdef SNDCP_UPM_INCLUDED*/ | |
| 2425 } /* mg_dti_close() */ | |
| 2426 | |
| 2427 /* | |
| 2428 +------------------------------------------------------------------------------ | |
| 2429 | Function : mg_dti_open | |
| 2430 +------------------------------------------------------------------------------ | |
| 2431 | Description : Opens DTI connection | |
| 2432 | Parameters : nsapi | |
| 2433 +------------------------------------------------------------------------------ | |
| 2434 */ | |
| 2435 GLOBAL void mg_dti_open (UBYTE nsapi) | |
| 2436 { | |
| 2437 #ifdef _SNDCP_DTI_2_ | |
| 2438 UBYTE* neighbor = NULL; | |
| 2439 ULONG linkid = 0; | |
| 2440 #ifndef SNDCP_UPM_INCLUDED | |
| 2441 BOOL ack = FALSE; | |
| 2442 #endif | |
| 2443 U8 direction = DTI_CHANNEL_TO_LOWER_LAYER; | |
| 2444 UBYTE interfac = SNDCP_INTERFACE_UNACK; | |
| 2445 | |
| 2446 sndcp_get_nsapi_linkid(nsapi, &linkid); | |
| 2447 sndcp_get_nsapi_neighbor(nsapi, &neighbor); | |
| 2448 #ifndef SNDCP_UPM_INCLUDED | |
| 2449 sndcp_get_nsapi_ack(nsapi, &ack); | |
| 2450 #endif | |
| 2451 sndcp_get_nsapi_direction(nsapi, &direction); | |
| 2452 #ifndef SNDCP_UPM_INCLUDED | |
| 2453 if (ack) { | |
| 2454 interfac = SNDCP_INTERFACE_ACK; | |
| 2455 sndcp_set_nsapi_interface(nsapi, interfac); | |
| 2456 } | |
| 2457 #endif | |
| 2458 | |
| 2459 dti_open(sndcp_data->hDTI, /* DTI_HANDLE hDTI */ | |
| 2460 0, /* U8 instance */ | |
| 2461 interfac, /* U8 interface */ | |
| 2462 nsapi, /* U8 channel */ | |
| 2463 0, /* U8 queue_size */ | |
| 2464 direction, /* U8 direction */ | |
| 2465 DTI_QUEUE_WATERMARK, /* U8 link options */ | |
| 2466 DTI_VERSION_10, /* U32 version */ | |
| 2467 neighbor, /* U8 *neighbor_entity */ | |
| 2468 linkid/* U32 link_id */ | |
| 2469 ); | |
| 2470 #else /*_SNDCP_DTI_2_*/ | |
| 2471 UBYTE* neighbor = NULL; | |
| 2472 ULONG linkid = 0; | |
| 2473 BOOL ack = FALSE; | |
| 2474 BOOL direction = HOME; | |
| 2475 UBYTE interfac = SNDCP_INTERFACE_UNACK; | |
| 2476 | |
| 2477 sndcp_get_nsapi_linkid(nsapi, &linkid); | |
| 2478 sndcp_get_nsapi_neighbor(nsapi, &neighbor); | |
| 2479 sndcp_get_nsapi_ack(nsapi, &ack); | |
| 2480 sndcp_get_nsapi_direction(nsapi, &direction); | |
| 2481 #ifndef SNDCP_UPM_INCLUDED | |
| 2482 if (ack) { | |
| 2483 interfac = SNDCP_INTERFACE_ACK; | |
| 2484 sndcp_set_nsapi_interface(nsapi, interfac); | |
| 2485 } | |
| 2486 #endif | |
| 2487 | |
| 2488 dti_open(sndcp_data->hDTI, /* DTI_HANDLE *hDTI */ | |
| 2489 0, /* U8 instance */ | |
| 2490 interfac, /* U8 interface */ | |
| 2491 nsapi, /* U8 channel */ | |
| 2492 0, /* U8 queue_size */ | |
| 2493 direction, /* BOOL direction */ | |
| 2494 FLOW_CNTRL_ENABLED, /* U8 comm_type */ | |
| 2495 DTI_VERSION_10, /* U32 version */ | |
| 2496 neighbor, /* U8 *neighbor_entity */ | |
| 2497 linkid/* U32 link_id */ | |
| 2498 ); | |
| 2499 | |
| 2500 #endif /*_SNDCP_DTI_2_*/ | |
| 2501 } /* mg_dti_open() */ | |
| 2502 | |
| 2503 /* | |
| 2504 +------------------------------------------------------------------------------ | |
| 2505 | Function : mg_init | |
| 2506 +------------------------------------------------------------------------------ | |
| 2507 | Description : The function mg_init() .... | |
| 2508 | | |
| 2509 | Parameters : | |
| 2510 | | |
| 2511 +------------------------------------------------------------------------------ | |
| 2512 */ | |
| 2513 GLOBAL void mg_init (void) | |
| 2514 { | |
| 2515 | |
| 2516 UBYTE sapi_index = 0; | |
| 2517 UBYTE nsapi = 0; | |
| 2518 TRACE_FUNCTION( "mg_init" ); | |
| 2519 INIT_STATE(MG, MG_DEFAULT); | |
| 2520 /* | |
| 2521 * req_xid_block, cnf_xid_block, cur_xid_block not initialized. | |
| 2522 */ | |
| 2523 for (sapi_index = 0; sapi_index < SNDCP_NUMBER_OF_SAPIS; sapi_index++) { | |
| 2524 | |
| 2525 mg_reset_states_n_rej(sapi_index); | |
| 2526 /* | |
| 2527 * Init renegotiation counter and cur_xid_block with default values. | |
| 2528 */ | |
| 2529 sndcp_data->mg.renego[sapi_index] = 0; | |
| 2530 | |
| 2531 sndcp_reset_xid_block(&sndcp_data->mg.req_xid_block[sapi_index]); | |
| 2532 sndcp_reset_xid_block(&sndcp_data->mg.cnf_xid_block[sapi_index]); | |
| 2533 sndcp_reset_xid_block(&sndcp_data->mg.ind_xid_block[sapi_index]); | |
| 2534 sndcp_reset_xid_block(&sndcp_data->mg.res_xid_block[sapi_index]); | |
| 2535 sndcp_reset_xid_block(&sndcp_data->mg.cur_xid_block[sapi_index]); | |
| 2536 sndcp_reset_xid_block(&sndcp_data->mg.new_xid_block[sapi_index]); | |
| 2537 | |
| 2538 } | |
| 2539 for (nsapi = 0; nsapi < SNDCP_NUMBER_OF_NSAPIS; nsapi++) { | |
| 2540 sndcp_reset_xid_block(&sndcp_data->mg.user_xid_block[nsapi]); | |
| 2541 sndcp_data->mg.user_xid_block[nsapi].vj.s0_m_1 = 0; | |
| 2542 sndcp_data->cur_pcomp[nsapi] = 0; | |
| 2543 sndcp_data->cur_dcomp[nsapi] = 0; | |
| 2544 sndcp_data->cur_seg_pos[nsapi] = 0; | |
| 2545 sndcp_data->cur_pdu_ref[nsapi].ref_nsapi = 0; | |
| 2546 sndcp_data->cur_pdu_ref[nsapi].ref_npdu_num = 0; | |
| 2547 sndcp_data->cur_pdu_ref[nsapi].ref_seg_num = 0; | |
| 2548 sndcp_data->big_head[nsapi] = FALSE; | |
| 2549 } | |
| 2550 | |
| 2551 | |
| 2552 sndcp_data->mg.mod_expects = MG_MOD_X_NONE; | |
| 2553 sndcp_data->mg.waiting_nsapis = 0; | |
| 2554 sndcp_data->mg.suspended_nsapis = 0; | |
| 2555 | |
| 2556 } /* mg_init() */ | |
| 2557 | |
| 2558 | |
| 2559 | |
| 2560 /* | |
| 2561 +------------------------------------------------------------------------------ | |
| 2562 | Function : mg_is_ack | |
| 2563 +------------------------------------------------------------------------------ | |
| 2564 | Description : This procedure takes the snsm_qos!rely | |
| 2565 | information: | |
| 2566 | | |
| 2567 | 0 SNSM_RELCLASS_SUB Subscribed reliability class | |
| 2568 | 1 SNSM_GTP_LLC_RLC_PROT Acknowledged GTP, LLC, and RLC; Protected data | |
| 2569 | 2 SNSM_LLC_RLC_PROT Unacknowledged GTP; Acknowledged LLC and RLC, Protected data | |
| 2570 | 3 SNSM_RLC_PROT Unacknowledged GTP and LLC; Acknowledged RLC, Protected data | |
| 2571 | 4 SNSM_PROT Unacknowledged GTP, LLC, and RLC, Protected data | |
| 2572 | 5 SNSM_NO_REL Unacknowledged GTP, LLC, and RLC, Unprotected data | |
| 2573 | | |
| 2574 | and sets "spec" to TRUE, "b" to TRUE in case of SNSM_GTP_LLC_RLC_PROT or | |
| 2575 | SNSM_LLC_RLC_PROT, | |
| 2576 | [should be, is not:["spec" to FALSE in case of SNSM_RELCLASS_SUB]] and "spec" | |
| 2577 | to TRUE, "b" to FALSE else. | |
| 2578 | | |
| 2579 | Important note: in case of SNSM_RELCLASS_SUB "spec" will actually be set to | |
| 2580 | to TRUE, "b" to FALSE, to be robust in case of downlink protocol error! | |
| 2581 | | |
| 2582 | Parameters : snsm_qos | |
| 2583 | BOOL* spec (FALSE for REL_CLASS_SUB), | |
| 2584 | BOOL* b) | |
| 2585 | | |
| 2586 +------------------------------------------------------------------------------ | |
| 2587 */ | |
| 2588 GLOBAL void mg_is_ack (T_snsm_qos snsm_qos, | |
| 2589 BOOL* spec, | |
| 2590 BOOL* b) | |
| 2591 { | |
| 2592 TRACE_FUNCTION( "mg_is_ack" ); | |
| 2593 | |
| 2594 | |
| 2595 #ifdef SNDCP_UPM_INCLUDED | |
| 2596 if (snsm_qos.relclass == PS_GTP_LLC_RLC_PROT || | |
| 2597 snsm_qos.relclass == PS_LLC_RLC_PROT) { | |
| 2598 #else | |
| 2599 if (snsm_qos.relclass == SNSM_GTP_LLC_RLC_PROT || | |
| 2600 snsm_qos.relclass == SNSM_LLC_RLC_PROT) { | |
| 2601 #endif /*#ifdef SNDCP_UPM_INCLUDED*/ | |
| 2602 *spec = TRUE; | |
| 2603 *b = TRUE; | |
| 2604 /* } else if (snsm_qos.relclass == SNSM_RELCLASS_SUB) { | |
| 2605 *spec = FALSE; | |
| 2606 */ | |
| 2607 } else { | |
| 2608 *spec = TRUE; | |
| 2609 *b = FALSE; | |
| 2610 } | |
| 2611 | |
| 2612 | |
| 2613 } /* mg_is_ack() */ | |
| 2614 | |
| 2615 /* | |
| 2616 +------------------------------------------------------------------------------ | |
| 2617 | Function : mg_no_col_no_re | |
| 2618 +------------------------------------------------------------------------------ | |
| 2619 | Description : The function mg_no_col_no_re represents the SDL label | |
| 2620 | NO_COL_NO_RE: an LL_ESTABLISH_IND has been received, we do not | |
| 2621 | have a collision situation like given in [GSM 4.65, 6.2.1.4], | |
| 2622 | we do not have a re-establishment situation. | |
| 2623 | | |
| 2624 | Parameters : the received LL_ESTABLISH_IND | |
| 2625 | | |
| 2626 +------------------------------------------------------------------------------ | |
| 2627 */ | |
| 2628 GLOBAL void mg_no_col_no_re (T_LL_ESTABLISH_IND* ll_establish_ind) | |
| 2629 { | |
| 2630 UBYTE dec_ret = 0; | |
| 2631 UBYTE check_ret = 0; | |
| 2632 UBYTE sapi_index = 0; | |
| 2633 U8 nsapi = 0; | |
| 2634 TRACE_FUNCTION( "mg_no_col_no_re" ); | |
| 2635 sndcp_get_sapi_index(ll_establish_ind->sapi, &sapi_index); | |
| 2636 | |
| 2637 TRACE_EVENT_P3("l3_valid?: %d, N201_I: %d, N201_U: %d", | |
| 2638 ll_establish_ind->xid_valid, ll_establish_ind->n201_i, | |
| 2639 ll_establish_ind->n201_u); | |
| 2640 /* | |
| 2641 * Set N201 values in uplink services. | |
| 2642 */ | |
| 2643 sig_mg_su_n201(ll_establish_ind->sapi, ll_establish_ind->n201_u); | |
| 2644 sig_mg_sua_n201(ll_establish_ind->sapi, ll_establish_ind->n201_i); | |
| 2645 /* | |
| 2646 * If SNDCP XID block is not valid, we are ready. | |
| 2647 */ | |
| 2648 if (ll_establish_ind->xid_valid == LL_XID_INVALID) { | |
| 2649 | |
| 2650 PALLOC_SDU (ll_establish_res, LL_ESTABLISH_RES, 0); | |
| 2651 /* | |
| 2652 * Set sapi in ll_establish_res. | |
| 2653 */ | |
| 2654 ll_establish_res->sapi = ll_establish_ind->sapi; | |
| 2655 ll_establish_res->xid_valid = ll_establish_ind->xid_valid; | |
| 2656 ll_establish_res->sdu.l_buf = 0; | |
| 2657 | |
| 2658 /* | |
| 2659 * Mark the affected sapi as MG_XID_IDLE. | |
| 2660 */ | |
| 2661 sndcp_unset_sapi_state(ll_establish_ind->sapi, MG_EST); | |
| 2662 | |
| 2663 sig_mg_sda_end_est(ll_establish_res->sapi, TRUE); | |
| 2664 | |
| 2665 sndcp_set_sapi_ack(ll_establish_res->sapi, TRUE); | |
| 2666 | |
| 2667 PSEND(hCommLLC, ll_establish_res); | |
| 2668 | |
| 2669 /* | |
| 2670 * All nsapis at this sapi that use ack mode, enter recovery state. | |
| 2671 */ | |
| 2672 for (nsapi = 0; nsapi < SNDCP_NUMBER_OF_NSAPIS; nsapi ++) { | |
| 2673 UBYTE sapi = 0; | |
| 2674 BOOL ack = FALSE; | |
| 2675 | |
| 2676 sndcp_get_nsapi_sapi(nsapi, &sapi); | |
| 2677 sndcp_get_nsapi_ack(nsapi, &ack); | |
| 2678 if (ack && (sapi == ll_establish_ind->sapi)) { | |
| 2679 sig_mg_cia_delete_npdus(nsapi); | |
| 2680 sig_mg_sua_delete_pdus(nsapi, sapi, FALSE); | |
| 2681 sig_mg_nu_recover(nsapi); | |
| 2682 sig_mg_nd_recover(nsapi); | |
| 2683 } | |
| 2684 } /* for all nsapis */ | |
| 2685 | |
| 2686 return; | |
| 2687 } | |
| 2688 /* | |
| 2689 * SNDCP XID block is valid and checked now. | |
| 2690 */ | |
| 2691 mg_decode_xid(&(ll_establish_ind->sdu), | |
| 2692 &(sndcp_data->mg.ind_xid_block[sapi_index]), | |
| 2693 &dec_ret, | |
| 2694 ll_establish_ind->sapi); | |
| 2695 if (dec_ret == MG_XID_OK) { | |
| 2696 mg_check_ind_xid(&check_ret, ll_establish_ind->sapi); | |
| 2697 if (check_ret == MG_XID_OK) { | |
| 2698 /* | |
| 2699 * Label MG_IND_OK_EST | |
| 2700 */ | |
| 2701 USHORT res_sdu_bit_len = 0; | |
| 2702 UBYTE ntt = 0; | |
| 2703 BOOL v42_rej = FALSE; | |
| 2704 BOOL vj_rej = FALSE; | |
| 2705 | |
| 2706 mg_set_res_cur_xid_block(ll_establish_ind->sapi, &res_sdu_bit_len); | |
| 2707 /* | |
| 2708 * Add the extra space for ntts with nsapis == 0. | |
| 2709 */ | |
| 2710 for (ntt = 0; ntt < MG_MAX_ENTITIES; ntt++) { | |
| 2711 BOOL rej = FALSE; | |
| 2712 mg_get_sapi_dntt_rej(ll_establish_ind->sapi, ntt, &rej); | |
| 2713 if (rej) { | |
| 2714 /* | |
| 2715 * length of ntt octet and nsapis. | |
| 2716 */ | |
| 2717 res_sdu_bit_len += 32; | |
| 2718 v42_rej = TRUE; | |
| 2719 } | |
| 2720 mg_get_sapi_pntt_rej(ll_establish_ind->sapi, ntt, &rej); | |
| 2721 if (rej) { | |
| 2722 /* | |
| 2723 * length of ntt octet and nsapis. | |
| 2724 */ | |
| 2725 res_sdu_bit_len += 32; | |
| 2726 vj_rej = TRUE; | |
| 2727 } | |
| 2728 } | |
| 2729 if (! sndcp_data->mg.res_xid_block[sapi_index].v42.is_set && | |
| 2730 v42_rej) { | |
| 2731 /* | |
| 2732 * Add length of parameter type and length. | |
| 2733 */ | |
| 2734 res_sdu_bit_len += 16; | |
| 2735 } | |
| 2736 if (! sndcp_data->mg.res_xid_block[sapi_index].vj.is_set && | |
| 2737 vj_rej) { | |
| 2738 /* | |
| 2739 * Add length of parameter type and length. | |
| 2740 */ | |
| 2741 res_sdu_bit_len += 16; | |
| 2742 } | |
| 2743 | |
| 2744 /* | |
| 2745 * SDL Label MG_CNF_OK_ACK | |
| 2746 */ | |
| 2747 | |
| 2748 { | |
| 2749 | |
| 2750 USHORT sapi_state = MG_IDLE; | |
| 2751 | |
| 2752 PALLOC_SDU (ll_establish_res, LL_ESTABLISH_RES, res_sdu_bit_len); | |
| 2753 /* | |
| 2754 * Set sapi in ll_establish_res. | |
| 2755 */ | |
| 2756 ll_establish_res->sapi = ll_establish_ind->sapi; | |
| 2757 ll_establish_res->xid_valid = ll_establish_ind->xid_valid; | |
| 2758 /* | |
| 2759 * Write res_xid_block struct to sdu byte buffer. Implementation dep.. | |
| 2760 */ | |
| 2761 mg_set_res_xid_params(&ll_establish_res->sdu, ll_establish_res->sapi); | |
| 2762 | |
| 2763 /* | |
| 2764 * Mark the affected nsapis and sapi as MG_XID_IDLE. | |
| 2765 */ | |
| 2766 sndcp_unset_sapi_state(ll_establish_ind->sapi, MG_XID); | |
| 2767 sndcp_unset_sapi_state(ll_establish_ind->sapi, MG_EST); | |
| 2768 | |
| 2769 sig_mg_sda_end_est(ll_establish_res->sapi, TRUE); | |
| 2770 | |
| 2771 sndcp_set_sapi_ack(ll_establish_res->sapi, TRUE); | |
| 2772 | |
| 2773 PSEND(hCommLLC, ll_establish_res); | |
| 2774 | |
| 2775 /* | |
| 2776 * All nsapis at this sapi that use ack mode, enter recovery state. | |
| 2777 */ | |
| 2778 for (nsapi = 0; nsapi < SNDCP_NUMBER_OF_NSAPIS; nsapi ++) { | |
| 2779 UBYTE sapi = 0; | |
| 2780 BOOL ack = FALSE; | |
| 2781 | |
| 2782 sndcp_get_nsapi_sapi(nsapi, &sapi); | |
| 2783 sndcp_get_nsapi_ack(nsapi, &ack); | |
| 2784 if (ack && (sapi == ll_establish_ind->sapi)) { | |
| 2785 sig_mg_cia_delete_npdus(nsapi); | |
| 2786 sig_mg_sua_delete_pdus(nsapi, sapi, FALSE); | |
| 2787 sig_mg_nu_recover(nsapi); | |
| 2788 sig_mg_nd_recover(nsapi); | |
| 2789 } | |
| 2790 } /* for all nsapis */ | |
| 2791 | |
| 2792 /* | |
| 2793 * Reset nsapis or ntts that were assigned, but are not any more. | |
| 2794 */ | |
| 2795 mg_clean_xid(ll_establish_ind->sapi); | |
| 2796 /* | |
| 2797 * If there was a collision and xid has not been negotiated | |
| 2798 * sufficiently. | |
| 2799 */ | |
| 2800 mg_resend_xid_if_nec(ll_establish_ind->sapi); | |
| 2801 | |
| 2802 /* | |
| 2803 * If nsapi has been in state xid_pending or est_pending then | |
| 2804 * an snsm_activate_res will be sent now.!!! | |
| 2805 */ | |
| 2806 mg_respond_if_nec(ll_establish_ind->sapi); | |
| 2807 sndcp_get_sapi_state(ll_establish_ind->sapi, &sapi_state); | |
| 2808 if ((sapi_state & MG_XID) == 0) { | |
| 2809 mg_xid_cnf_ok_res(ll_establish_ind->sapi); | |
| 2810 } | |
| 2811 | |
| 2812 | |
| 2813 } | |
| 2814 | |
| 2815 } else { | |
| 2816 /* | |
| 2817 * not (check_ret == MG_IND_XID_OK) | |
| 2818 */ | |
| 2819 /* | |
| 2820 * Label MG_CHECK_FAIL_EST | |
| 2821 */ | |
| 2822 USHORT res_sdu_bit_len = 0; | |
| 2823 UBYTE ntt = 0; | |
| 2824 BOOL v42_rej = FALSE; | |
| 2825 BOOL vj_rej = FALSE; | |
| 2826 /* | |
| 2827 * Add the extra space for ntts with nsapis == 0. | |
| 2828 */ | |
| 2829 for (ntt = 0; ntt < MG_MAX_ENTITIES; ntt++) { | |
| 2830 BOOL rej = FALSE; | |
| 2831 mg_get_sapi_dntt_rej(ll_establish_ind->sapi, ntt, &rej); | |
| 2832 if (rej) { | |
| 2833 /* | |
| 2834 * length of ntt octet and nsapis. | |
| 2835 */ | |
| 2836 res_sdu_bit_len += 32; | |
| 2837 v42_rej = TRUE; | |
| 2838 } | |
| 2839 mg_get_sapi_pntt_rej(ll_establish_ind->sapi, ntt, &rej); | |
| 2840 if (rej) { | |
| 2841 /* | |
| 2842 * length of ntt octet and nsapis. | |
| 2843 */ | |
| 2844 res_sdu_bit_len += 32; | |
| 2845 vj_rej = TRUE; | |
| 2846 } | |
| 2847 } | |
| 2848 if (v42_rej) { | |
| 2849 /* | |
| 2850 * Add length of parameter type and length. | |
| 2851 */ | |
| 2852 res_sdu_bit_len += 16; | |
| 2853 } | |
| 2854 if (vj_rej) { | |
| 2855 /* | |
| 2856 * Add length of parameter type and length. | |
| 2857 */ | |
| 2858 res_sdu_bit_len += 16; | |
| 2859 } | |
| 2860 /* | |
| 2861 * Allocate response and send it. | |
| 2862 */ | |
| 2863 { | |
| 2864 | |
| 2865 PALLOC_SDU (ll_establish_res, LL_ESTABLISH_RES, res_sdu_bit_len); | |
| 2866 /* | |
| 2867 * Reset res_xid_block, ind_xid_block. | |
| 2868 */ | |
| 2869 sndcp_reset_xid_block(&sndcp_data->mg.res_xid_block[sapi_index]); | |
| 2870 sndcp_reset_xid_block(&sndcp_data->mg.ind_xid_block[sapi_index]); | |
| 2871 /* | |
| 2872 * Set sapi in ll_establish_res. | |
| 2873 */ | |
| 2874 ll_establish_res->sapi = ll_establish_ind->sapi; | |
| 2875 ll_establish_res->xid_valid = ll_establish_ind->xid_valid; | |
| 2876 /* | |
| 2877 * Write res_xid_block struct to sdu byte buffer. Implementation dep.. | |
| 2878 */ | |
| 2879 mg_set_res_xid_params(&ll_establish_res->sdu, ll_establish_ind->sapi); | |
| 2880 /* | |
| 2881 * Modify the affected sapi state. | |
| 2882 */ | |
| 2883 sndcp_unset_sapi_state(ll_establish_ind->sapi, MG_XID); | |
| 2884 sndcp_unset_sapi_state(ll_establish_ind->sapi, MG_EST); | |
| 2885 | |
| 2886 sndcp_set_sapi_ack(ll_establish_res->sapi, TRUE); | |
| 2887 /* | |
| 2888 * Send the XID block to LLC. | |
| 2889 */ | |
| 2890 PSEND(hCommLLC, ll_establish_res); | |
| 2891 /* | |
| 2892 * All nsapis at this sapi that use ack mode, enter recovery state. | |
| 2893 */ | |
| 2894 for (nsapi = 0; nsapi < SNDCP_NUMBER_OF_NSAPIS; nsapi ++) { | |
| 2895 UBYTE sapi = 0; | |
| 2896 BOOL ack = FALSE; | |
| 2897 | |
| 2898 sndcp_get_nsapi_sapi(nsapi, &sapi); | |
| 2899 sndcp_get_nsapi_ack(nsapi, &ack); | |
| 2900 if (ack && (sapi == ll_establish_ind->sapi)) { | |
| 2901 sig_mg_cia_delete_npdus(nsapi); | |
| 2902 sig_mg_sua_delete_pdus(nsapi, sapi, FALSE); | |
| 2903 sig_mg_nu_recover(nsapi); | |
| 2904 sig_mg_nd_recover(nsapi); | |
| 2905 } | |
| 2906 } /* for all nsapis */ | |
| 2907 | |
| 2908 } | |
| 2909 | |
| 2910 /* | |
| 2911 * Reset nsapis or ntts that were assigned before | |
| 2912 * but are not anymore. | |
| 2913 */ | |
| 2914 sndcp_reset_xid_block(&sndcp_data->mg.cur_xid_block[sapi_index]); | |
| 2915 mg_clean_xid(ll_establish_ind->sapi); | |
| 2916 /* | |
| 2917 * Allocate status req and send it (label MG_SEND_STATUS_REQ_EST). | |
| 2918 */ | |
| 2919 { | |
| 2920 #ifdef SNDCP_UPM_INCLUDED | |
| 2921 PALLOC (snsm_status_req, SN_STATUS_IND); | |
| 2922 #else | |
| 2923 PALLOC (snsm_status_req, SNSM_STATUS_REQ); | |
| 2924 #endif /*#ifdef SNDCP_UPM_INCLUDED*/ | |
| 2925 snsm_status_req->sapi = ll_establish_ind->sapi; | |
| 2926 #ifdef SNDCP_UPM_INCLUDED | |
| 2927 snsm_status_req->ps_cause.ctrl_value = CAUSE_is_from_sndcp; | |
| 2928 snsm_status_req->ps_cause.value.sn_cause = CAUSE_SN_INVALID_XID; | |
| 2929 PSEND (hCommUPM, snsm_status_req); | |
| 2930 #else | |
| 2931 snsm_status_req->status_cause = SNSM_RELCS_INVALID_XID; | |
| 2932 PSEND (hCommSM, snsm_status_req); | |
| 2933 #endif /*#ifdef SNDCP_UPM_INCLUDED*/ | |
| 2934 } | |
| 2935 } | |
| 2936 } else { /* not if (dec_ret == MG_XID_OK_EST) */ | |
| 2937 /* | |
| 2938 * Reset nsapis or ntts that were assigned before | |
| 2939 * but are not anymore. | |
| 2940 */ | |
| 2941 sndcp_reset_xid_block(&sndcp_data->mg.cur_xid_block[sapi_index]); | |
| 2942 mg_clean_xid(ll_establish_ind->sapi); | |
| 2943 /* | |
| 2944 * Decoding of ll_establish_ind failed (label MG_SEND_STATUS_REQ). | |
| 2945 * Allocate status req and send it. | |
| 2946 */ | |
| 2947 | |
| 2948 { | |
| 2949 #ifdef SNDCP_UPM_INCLUDED | |
| 2950 PALLOC (snsm_status_req, SN_STATUS_IND); | |
| 2951 snsm_status_req->sapi = ll_establish_ind->sapi; | |
| 2952 snsm_status_req->ps_cause.ctrl_value = CAUSE_is_from_sndcp; | |
| 2953 snsm_status_req->ps_cause.value.sn_cause = CAUSE_SN_INVALID_XID; | |
| 2954 PSEND (hCommUPM, snsm_status_req); | |
| 2955 #else | |
| 2956 PALLOC (snsm_status_req, SNSM_STATUS_REQ); | |
| 2957 snsm_status_req->sapi = ll_establish_ind->sapi; | |
| 2958 snsm_status_req->status_cause = SNSM_RELCS_INVALID_XID; | |
| 2959 PSEND (hCommSM, snsm_status_req); | |
| 2960 #endif /*#ifdef SNDCP_UPM_INCLUDED*/ | |
| 2961 } | |
| 2962 | |
| 2963 } | |
| 2964 | |
| 2965 } /* mg_no_col_no_re() */ | |
| 2966 | |
| 2967 /* | |
| 2968 +------------------------------------------------------------------------------ | |
| 2969 | Function : mg_no_col_re | |
| 2970 +------------------------------------------------------------------------------ | |
| 2971 | Description : The function mg_no_col_no_re represents the SDL label | |
| 2972 | NO_COL_RE: an LL_ESTABLISH_IND has been received, we do not | |
| 2973 | have a collision situation like given in [GSM 4.65, 6.2.1.4], | |
| 2974 | we do have a re-establishment situation. | |
| 2975 | | |
| 2976 | Parameters : the received LL_ESTABLISH_IND | |
| 2977 | | |
| 2978 +------------------------------------------------------------------------------ | |
| 2979 */ | |
| 2980 GLOBAL void mg_no_col_re (T_LL_ESTABLISH_IND* ll_establish_ind) | |
| 2981 { | |
| 2982 | |
| 2983 TRACE_FUNCTION( "mg_no_col_re" ); | |
| 2984 /* | |
| 2985 * Do the same things as without collision. | |
| 2986 */ | |
| 2987 mg_no_col_no_re (ll_establish_ind); | |
| 2988 | |
| 2989 } /* mg_no_col_re() */ | |
| 2990 | |
| 2991 /* | |
| 2992 +------------------------------------------------------------------------------ | |
| 2993 | Function : mg_re_negotiate | |
| 2994 +------------------------------------------------------------------------------ | |
| 2995 | Description : The answer to the sent LL_XID_REQ has been invalid | |
| 2996 | (bad format or content). If service var renego < MG_MAX_RENEGO then | |
| 2997 | same LL_XID_REQ is resent, else SNSM_STATUS_REQ is sent. | |
| 2998 | This function represents the SDl label MG_RE_NEGOTIATE. | |
| 2999 | | |
| 3000 | Parameters : the affected sapi | |
| 3001 | | |
| 3002 +------------------------------------------------------------------------------ | |
| 3003 */ | |
| 3004 GLOBAL void mg_re_negotiate (UBYTE sapi) { | |
| 3005 UBYTE sapi_index = 0; | |
| 3006 | |
| 3007 TRACE_FUNCTION( "mg_re_negotiate" ); | |
| 3008 sndcp_get_sapi_index(sapi, &sapi_index); | |
| 3009 | |
| 3010 /* | |
| 3011 * If number of re-negotiations is reached, deactivate all pdp contexts for | |
| 3012 * the affected sapi. | |
| 3013 */ | |
| 3014 if (sndcp_data->mg.renego[sapi_index] < MG_MAX_RENEGO) { | |
| 3015 PALLOC_SDU(ll_xid_req, LL_XID_REQ, SNDCP_XID_BLOCK_BIT_LEN); | |
| 3016 /* | |
| 3017 * Set sapi in ll_xid_req. | |
| 3018 */ | |
| 3019 ll_xid_req->sapi = sapi; | |
| 3020 | |
| 3021 /* | |
| 3022 * Fill the XID block. Implementation dependent. | |
| 3023 */ | |
| 3024 mg_set_xid_params(ll_xid_req->sapi, | |
| 3025 &ll_xid_req->sdu, | |
| 3026 sndcp_data->mg.req_xid_block[sapi_index]); | |
| 3027 /* | |
| 3028 * Send the XID block to LLC. | |
| 3029 */ | |
| 3030 | |
| 3031 sndcp_unset_sapi_state(sapi, MG_XID_NEC); | |
| 3032 sndcp_set_sapi_state(ll_xid_req->sapi, MG_XID); | |
| 3033 PSEND(hCommLLC, ll_xid_req); | |
| 3034 /* | |
| 3035 * Increment renegotiation counter. | |
| 3036 */ | |
| 3037 sndcp_data->mg.renego[sapi_index]++; | |
| 3038 } else { | |
| 3039 | |
| 3040 #ifdef SNDCP_UPM_INCLUDED | |
| 3041 PALLOC (snsm_status_req, SN_STATUS_IND); | |
| 3042 #else | |
| 3043 PALLOC (snsm_status_req, SNSM_STATUS_REQ); | |
| 3044 #endif /*#ifdef SNDCP_UPM_INCLUDED*/ | |
| 3045 /* | |
| 3046 * Set all ntts and dcomp/pcomp states to "unassigned". | |
| 3047 */ | |
| 3048 mg_reset_states_n_rej(sapi_index); | |
| 3049 /* | |
| 3050 * Set prim parameters. | |
| 3051 */ | |
| 3052 #ifdef SNDCP_UPM_INCLUDED | |
| 3053 snsm_status_req->sapi = sapi; | |
| 3054 snsm_status_req->ps_cause.ctrl_value = CAUSE_is_from_sndcp; | |
| 3055 snsm_status_req->ps_cause.value.sn_cause = CAUSE_SN_INVALID_XID; | |
| 3056 #else | |
| 3057 snsm_status_req->sapi = sapi; | |
| 3058 snsm_status_req->status_cause = SNSM_RELCS_INVALID_XID; | |
| 3059 #endif /*#ifdef SNDCP_UPM_INCLUDED*/ | |
| 3060 | |
| 3061 sndcp_data->mg.renego[sapi_index] = 0; | |
| 3062 /* | |
| 3063 * Reset cur_xid_block. | |
| 3064 */ | |
| 3065 sndcp_reset_xid_block(&sndcp_data->mg.cur_xid_block[sapi_index]); | |
| 3066 /* | |
| 3067 * Reset all compression entities for the affected sapi. | |
| 3068 */ | |
| 3069 mg_clean_xid(sapi); | |
| 3070 | |
| 3071 #ifdef SNDCP_UPM_INCLUDED | |
| 3072 PSEND (hCommUPM, snsm_status_req); | |
| 3073 #else | |
| 3074 PSEND (hCommSM, snsm_status_req); | |
| 3075 #endif | |
| 3076 } | |
| 3077 | |
| 3078 | |
| 3079 } /* mg_re_negotiate() */ | |
| 3080 | |
| 3081 /* | |
| 3082 +------------------------------------------------------------------------------ | |
| 3083 | Function : mg_re_negotiate_ack | |
| 3084 +------------------------------------------------------------------------------ | |
| 3085 | Description : The answer to the sent LL_ESTABLISH_REQ has been invalid | |
| 3086 | (bad format or content). If service var renego < MG_MAX_RENEGO then | |
| 3087 | same LL_ESTABLISH_REQ is resent, else SNSM_STATUS_REQ is sent. | |
| 3088 | This function represents the SDl label MG_RE_NEGOTIATE_ACK. | |
| 3089 | | |
| 3090 | Parameters : the affected sapi, cause | |
| 3091 | | |
| 3092 +------------------------------------------------------------------------------ | |
| 3093 */ | |
| 3094 GLOBAL void mg_re_negotiate_ack (UBYTE sapi, U16 cause) { | |
| 3095 UBYTE sapi_index = 0; | |
| 3096 | |
| 3097 TRACE_FUNCTION( "mg_re_negotiate_ack" ); | |
| 3098 sndcp_get_sapi_index(sapi, &sapi_index); | |
| 3099 | |
| 3100 /* | |
| 3101 * If number of re-negotiations is reached, deactivate all pdp contexts for | |
| 3102 * the affected sapi. | |
| 3103 */ | |
| 3104 if (sndcp_data->mg.renego[sapi_index] < MG_MAX_RENEGO) { | |
| 3105 PALLOC_SDU(ll_establish_req, | |
| 3106 LL_ESTABLISH_REQ, | |
| 3107 SNDCP_XID_BLOCK_BIT_LEN); | |
| 3108 /* | |
| 3109 * Set sapi in ll_establish_req. | |
| 3110 */ | |
| 3111 ll_establish_req->sapi = sapi; | |
| 3112 | |
| 3113 /* | |
| 3114 * Fill the XID block. Implementation dependent. | |
| 3115 */ | |
| 3116 mg_set_xid_params(ll_establish_req->sapi, | |
| 3117 &ll_establish_req->sdu, | |
| 3118 sndcp_data->mg.req_xid_block[sapi_index]); | |
| 3119 /* | |
| 3120 * Send the XID block to LLC, with establish request. | |
| 3121 */ | |
| 3122 sig_mg_sda_start_est(sapi); | |
| 3123 | |
| 3124 PSEND(hCommLLC, ll_establish_req); | |
| 3125 /* | |
| 3126 * Increment renegotiation counter. | |
| 3127 */ | |
| 3128 sndcp_data->mg.renego[sapi_index]++; | |
| 3129 } else { | |
| 3130 | |
| 3131 #ifdef SNDCP_UPM_INCLUDED | |
| 3132 PALLOC (snsm_status_req, SN_STATUS_IND); | |
| 3133 #else | |
| 3134 PALLOC (snsm_status_req, SNSM_STATUS_REQ); | |
| 3135 #endif /*#ifdef SNDCP_UPM_INCLUDED*/ | |
| 3136 /* | |
| 3137 * Service sda may now leave state SDA_ESTABLISH_REQUESTED. | |
| 3138 */ | |
| 3139 sig_mg_sda_end_est(sapi, FALSE); | |
| 3140 /* | |
| 3141 * Set all ntts and dcomp/pcomp states to "unassigned". | |
| 3142 */ | |
| 3143 mg_reset_states_n_rej(sapi_index); | |
| 3144 /* | |
| 3145 * Set prim parameters. | |
| 3146 */ | |
| 3147 #ifdef SNDCP_UPM_INCLUDED | |
| 3148 snsm_status_req->sapi = sapi; | |
| 3149 snsm_status_req->ps_cause.ctrl_value = CAUSE_is_from_sndcp; | |
| 3150 #else | |
| 3151 snsm_status_req->sapi = sapi; | |
| 3152 #endif /*#ifdef SNDCP_UPM_INCLUDED*/ | |
| 3153 | |
| 3154 sndcp_data->mg.renego[sapi_index] = 0; | |
| 3155 /* | |
| 3156 * Reset cur_xid_block. | |
| 3157 */ | |
| 3158 sndcp_reset_xid_block(&sndcp_data->mg.cur_xid_block[sapi_index]); | |
| 3159 sndcp_reset_xid_block(&sndcp_data->mg.req_xid_block[sapi_index]); | |
| 3160 /* | |
| 3161 * Reset all compression entities for the affected sapi. | |
| 3162 */ | |
| 3163 mg_clean_xid(sapi); | |
| 3164 /* | |
| 3165 * The renegotiation is failed. If the cause is NO_PEER_RESPONSE | |
| 3166 * or DM_RECEIVED, set it to RELCS_NORMAL to make SM deactivate | |
| 3167 * PDP context. Otherwise the cause is forwarded to SM and the SM | |
| 3168 * will deactivate PDP context depending on cause. | |
| 3169 */ | |
| 3170 #ifdef SNDCP_UPM_INCLUDED | |
| 3171 if((cause == CAUSE_SN_NO_PEER_RESPONSE) || | |
| 3172 (cause == CAUSE_SN_DM_RECEIVED) ){ | |
| 3173 snsm_status_req->ps_cause.value.sn_cause = CAUSE_SN_NORMAL_RELEASE; | |
| 3174 #else /* SNDCP_UPM_INCLUDED */ | |
| 3175 #ifdef _SNDCP_DTI_2_ | |
| 3176 if((cause == LL_RELCS_NO_PEER_RES) || | |
| 3177 (cause == LL_RELCS_DM_RECEIVED) ){ | |
| 3178 snsm_status_req->ps_cause.value.sn_cause = LL_RELCS_NORMAL; | |
| 3179 #else | |
| 3180 if((cause == CAUSE_SN_NO_PEER_RESPONSE) || | |
| 3181 (cause == CAUSE_SN_DM_RECEIVED) ){ | |
| 3182 snsm_status_req->ps_cause.value.sn_cause = CAUSE_SN_NORMAL_RELEASE; | |
| 3183 #endif | |
| 3184 #endif /* SNDCP_UPM_INCLUDED */ | |
| 3185 sig_mg_su_resume(sapi); | |
| 3186 sig_mg_sua_resume(sapi); | |
| 3187 mg_resume_affected_nus(sapi); | |
| 3188 sndcp_unset_sapi_state (sapi, MG_EST); | |
| 3189 } else { | |
| 3190 #ifdef SNDCP_UPM_INCLUDED | |
| 3191 snsm_status_req->ps_cause.value.sn_cause = cause; | |
| 3192 #else | |
| 3193 snsm_status_req->status_cause = cause; | |
| 3194 #endif | |
| 3195 } | |
| 3196 | |
| 3197 #ifdef SNDCP_UPM_INCLUDED | |
| 3198 PSEND (hCommUPM, snsm_status_req); | |
| 3199 #else | |
| 3200 PSEND (hCommSM, snsm_status_req); | |
| 3201 #endif | |
| 3202 | |
| 3203 } | |
| 3204 | |
| 3205 } /* mg_re_negotiate_ack() */ | |
| 3206 | |
| 3207 | |
| 3208 /* | |
| 3209 +------------------------------------------------------------------------------ | |
| 3210 | Function : mg_resend_xid_if_nec | |
| 3211 +------------------------------------------------------------------------------ | |
| 3212 | Description : This procedure will be called after reception and computation | |
| 3213 | of an LL_XID_IND or LL_ESTABLISH_IND in case of a collision | |
| 3214 | or after receiving LL_XID_CNF or LL_ESTABLISH_CNF and does the | |
| 3215 | following: | |
| 3216 | (GSM 04.65 version 6.5.1 Release 1997), 6.2.1.4: | |
| 3217 | If the | |
| 3218 | LL-ESTABLISH.request or LL-XID.request contains one or more XID parameters, | |
| 3219 | or one or more compression fields | |
| 3220 | in an XID parameter, or one or more parameters in a compression field, | |
| 3221 | that are not negotiated as part of the collision | |
| 3222 | resolution, then negotiation of these XID parameters shall be performed at | |
| 3223 | the earliest opportunity after conclusion of | |
| 3224 | the collision resolution. | |
| 3225 | | |
| 3226 | Parameters : Affected sapi, out: was LL_XID_REQ sent? | |
| 3227 | | |
| 3228 +------------------------------------------------------------------------------ | |
| 3229 */ | |
| 3230 GLOBAL void mg_resend_xid_if_nec (UBYTE sapi) { | |
| 3231 UBYTE sapi_index = 0; | |
| 3232 BOOL resend_necessary = FALSE; | |
| 3233 USHORT sapi_state = MG_IDLE; | |
| 3234 T_XID_BLOCK* req_xid_block = NULL; | |
| 3235 T_XID_BLOCK* cur_xid_block = NULL; | |
| 3236 T_XID_BLOCK* new_xid_block = NULL; | |
| 3237 | |
| 3238 TRACE_FUNCTION( "mg_resend_xid_if_nec" ); | |
| 3239 | |
| 3240 sndcp_get_sapi_index(sapi, &sapi_index); | |
| 3241 req_xid_block = &sndcp_data->mg.req_xid_block[sapi_index]; | |
| 3242 cur_xid_block = &sndcp_data->mg.cur_xid_block[sapi_index]; | |
| 3243 new_xid_block = &sndcp_data->mg.new_xid_block[sapi_index]; | |
| 3244 | |
| 3245 /* | |
| 3246 * Data compression. | |
| 3247 */ | |
| 3248 /* | |
| 3249 * If a context is deactivated, maybe compressors must be switched off. | |
| 3250 */ | |
| 3251 if (cur_xid_block->v42.is_set) { | |
| 3252 USHORT nsapis = cur_xid_block->v42.nsapis; | |
| 3253 UBYTE nsapi = 0; | |
| 3254 | |
| 3255 /* | |
| 3256 * XID renegotiation will only be necessary if one of the nsapis | |
| 3257 * that are requested to use the data compression is in state | |
| 3258 * MG_DEACT. | |
| 3259 */ | |
| 3260 for (nsapi = 0; nsapi < SNDCP_NUMBER_OF_NSAPIS; nsapi++) { | |
| 3261 if (((1 << nsapi) & nsapis) > 0) { | |
| 3262 USHORT state = MG_IDLE; | |
| 3263 sndcp_get_nsapi_state(nsapi, &state); | |
| 3264 if ((state & MG_DEACT) > 0) { | |
| 3265 UBYTE dntt = cur_xid_block->v42.ntt; | |
| 3266 resend_necessary = TRUE; | |
| 3267 mg_set_sapi_dntt_rej(sapi, dntt, TRUE); | |
| 3268 } | |
| 3269 } | |
| 3270 } | |
| 3271 } | |
| 3272 | |
| 3273 if (req_xid_block->v42.is_set && ! cur_xid_block->v42.is_set) { | |
| 3274 UBYTE sapi_index_local = 0; | |
| 3275 BOOL used = FALSE; | |
| 3276 /* | |
| 3277 * If one instance of v42 is used at a different sapi, | |
| 3278 * we may not use another one here. | |
| 3279 */ | |
| 3280 for (sapi_index_local = 0; | |
| 3281 sapi_index_local < SNDCP_NUMBER_OF_SAPIS; | |
| 3282 sapi_index_local++) { | |
| 3283 | |
| 3284 if (sndcp_data->mg.cur_xid_block[sapi_index_local].v42.is_set) { | |
| 3285 used = TRUE; | |
| 3286 } | |
| 3287 } | |
| 3288 if (! used) { | |
| 3289 USHORT nsapis = req_xid_block->v42.nsapis; | |
| 3290 UBYTE nsapi = 0; | |
| 3291 | |
| 3292 /* | |
| 3293 * XID renegotiation will only be necessary if one of the nsapis | |
| 3294 * that are requested to use the data compression are not all in state | |
| 3295 * MG_DEACT. | |
| 3296 */ | |
| 3297 for (nsapi = 0; nsapi < SNDCP_NUMBER_OF_NSAPIS; nsapi++) { | |
| 3298 if (((1 << nsapi) & nsapis) > 0) { | |
| 3299 USHORT state = MG_IDLE; | |
| 3300 sndcp_get_nsapi_state(nsapi, &state); | |
| 3301 if ((state & MG_DEACT) == 0) { | |
| 3302 resend_necessary = TRUE; | |
| 3303 } | |
| 3304 } | |
| 3305 } | |
| 3306 | |
| 3307 } | |
| 3308 } | |
| 3309 /* | |
| 3310 * Header compression. | |
| 3311 */ | |
| 3312 /* | |
| 3313 * If a context is deactivated, maybe compressors must be switched off. | |
| 3314 */ | |
| 3315 if (cur_xid_block->vj.is_set) { | |
| 3316 USHORT nsapis = cur_xid_block->vj.nsapis; | |
| 3317 UBYTE nsapi = 0; | |
| 3318 | |
| 3319 /* | |
| 3320 * XID renegotiation will only be necessary if one of the nsapis | |
| 3321 * that are requested to use the header compression is in state | |
| 3322 * MG_DEACT. | |
| 3323 */ | |
| 3324 for (nsapi = 0; nsapi < SNDCP_NUMBER_OF_NSAPIS; nsapi++) { | |
| 3325 if (((1 << nsapi) & nsapis) > 0) { | |
| 3326 USHORT state = MG_IDLE; | |
| 3327 sndcp_get_nsapi_state(nsapi, &state); | |
| 3328 if ((state & MG_DEACT) > 0) { | |
| 3329 UBYTE pntt = cur_xid_block->vj.ntt; | |
| 3330 resend_necessary = TRUE; | |
| 3331 mg_set_sapi_pntt_rej(sapi, pntt, TRUE); | |
| 3332 } | |
| 3333 } | |
| 3334 } | |
| 3335 | |
| 3336 } | |
| 3337 /* | |
| 3338 * If a compressor is requested and not yet negotiated it must be requested | |
| 3339 * now. | |
| 3340 */ | |
| 3341 if (req_xid_block->vj.is_set && !cur_xid_block->vj.is_set) { | |
| 3342 USHORT nsapis = req_xid_block->vj.nsapis; | |
| 3343 UBYTE nsapi = 0; | |
| 3344 | |
| 3345 req_xid_block->vj.p_bit = 1; | |
| 3346 | |
| 3347 /* | |
| 3348 * XID renegotiation will only be necessary if the affected nsapis | |
| 3349 * is not currently being deactivated. | |
| 3350 */ | |
| 3351 for (nsapi = 0; nsapi < SNDCP_NUMBER_OF_NSAPIS; nsapi++) { | |
| 3352 if (((1 << nsapi) & nsapis) > 0) { | |
| 3353 USHORT state = MG_IDLE; | |
| 3354 sndcp_get_nsapi_state(nsapi, &state); | |
| 3355 if ((state & MG_DEACT) == 0) { | |
| 3356 resend_necessary = TRUE; | |
| 3357 } | |
| 3358 } | |
| 3359 } | |
| 3360 | |
| 3361 } | |
| 3362 | |
| 3363 /* | |
| 3364 * If in the meantime more compression has been requested, | |
| 3365 * or compressors must be deactivated, | |
| 3366 * re-negotiate. | |
| 3367 */ | |
| 3368 if (new_xid_block->v42.is_set) { | |
| 3369 if ((! req_xid_block->v42.is_set) || | |
| 3370 (req_xid_block->v42.is_set && | |
| 3371 (new_xid_block->v42.nsapis != req_xid_block->v42.nsapis))) { | |
| 3372 | |
| 3373 *req_xid_block = *new_xid_block; | |
| 3374 resend_necessary = TRUE; | |
| 3375 } | |
| 3376 } | |
| 3377 | |
| 3378 /* | |
| 3379 * If in the meantime more compression has been requested, | |
| 3380 * or compressors must be deactivated, | |
| 3381 * re-negotiate. | |
| 3382 */ | |
| 3383 if (new_xid_block->vj.is_set) { | |
| 3384 if ((! req_xid_block->vj.is_set) || | |
| 3385 (req_xid_block->vj.is_set && | |
| 3386 (new_xid_block->vj.nsapis != req_xid_block->vj.nsapis))) { | |
| 3387 | |
| 3388 *req_xid_block = *new_xid_block; | |
| 3389 resend_necessary = TRUE; | |
| 3390 } | |
| 3391 } | |
| 3392 | |
| 3393 | |
| 3394 sndcp_get_sapi_state(sapi, &sapi_state); | |
| 3395 /* | |
| 3396 * If re-negotiation is necessary but not possible because MG_REL or | |
| 3397 * MG_XID, set MG_XID_NEC. | |
| 3398 */ | |
| 3399 if (resend_necessary | |
| 3400 && | |
| 3401 ((sapi_state & (MG_REL + MG_XID)) > 0)) | |
| 3402 { | |
| 3403 sndcp_set_sapi_state(sapi, MG_XID_NEC); | |
| 3404 mg_set_cur_xid_block(sapi); | |
| 3405 return; | |
| 3406 } | |
| 3407 | |
| 3408 | |
| 3409 /* | |
| 3410 * If renegotiation of XID is necessary, send LL_XID_REQ. | |
| 3411 */ | |
| 3412 if (! resend_necessary) { | |
| 3413 // mg_set_cur_xid_block(sapi); | |
| 3414 return; | |
| 3415 } | |
| 3416 | |
| 3417 | |
| 3418 /* | |
| 3419 * Now req_xid_block is in good shape. Send it. | |
| 3420 */ | |
| 3421 { | |
| 3422 PALLOC_SDU(ll_xid_req, LL_XID_REQ, SNDCP_XID_BLOCK_BIT_LEN); | |
| 3423 /* | |
| 3424 * Set sapi in ll_xid_req. | |
| 3425 */ | |
| 3426 ll_xid_req->sapi = sapi; | |
| 3427 /* | |
| 3428 * Write data from snsm_activate_ind to service variable req_xid_block. | |
| 3429 */ | |
| 3430 mg_set_ntt_comp(sapi); | |
| 3431 /* | |
| 3432 * Fill the XID block. Implementation dependent. | |
| 3433 */ | |
| 3434 mg_set_xid_params(ll_xid_req->sapi, | |
| 3435 &ll_xid_req->sdu, | |
| 3436 sndcp_data->mg.req_xid_block[sapi_index]); | |
| 3437 /* | |
| 3438 * Mark the affected sapi as MG_XID. | |
| 3439 */ | |
| 3440 sndcp_set_sapi_state(sapi, MG_XID); | |
| 3441 sndcp_unset_sapi_state(sapi, MG_XID_NEC); | |
| 3442 | |
| 3443 /* | |
| 3444 * Uplink data transfer on SAPI is completely suspended. | |
| 3445 */ | |
| 3446 sig_mg_su_suspend(sapi); | |
| 3447 sig_mg_sua_suspend(sapi); | |
| 3448 mg_suspend_affected_nus(sapi); | |
| 3449 /* | |
| 3450 * Send the XID block to LLC. | |
| 3451 */ | |
| 3452 | |
| 3453 sndcp_unset_sapi_state(sapi, MG_XID_NEC); | |
| 3454 sndcp_set_sapi_state(ll_xid_req->sapi, MG_XID); | |
| 3455 PSEND(hCommLLC, ll_xid_req); | |
| 3456 } | |
| 3457 | |
| 3458 } /* mg_resend_xid_if_nec() */ | |
| 3459 | |
| 3460 | |
| 3461 | |
| 3462 /* | |
| 3463 +------------------------------------------------------------------------------ | |
| 3464 | Function : mg_resume_affected_nus | |
| 3465 +------------------------------------------------------------------------------ | |
| 3466 | Description : Resumes all nu service instances affected by | |
| 3467 | If nsapi is waiting for SNSM_SEQUENCE_IND, fct. returns. | |
| 3468 | | |
| 3469 | Parameters : sapi | |
| 3470 | | |
| 3471 +------------------------------------------------------------------------------ | |
| 3472 */ | |
| 3473 GLOBAL void mg_resume_affected_nus (UBYTE sapi) { | |
| 3474 UBYTE nsapi = 0; | |
| 3475 TRACE_FUNCTION( "mg_resume_affected_nus" ); | |
| 3476 for (nsapi = 0; nsapi < SNDCP_NUMBER_OF_NSAPIS; nsapi++) { | |
| 3477 UBYTE local_sapi = 0; | |
| 3478 sndcp_get_nsapi_sapi(nsapi, &local_sapi); | |
| 3479 if (local_sapi == sapi) { | |
| 3480 USHORT nsapi_state = 0; | |
| 3481 sndcp_get_nsapi_state(nsapi, &nsapi_state); | |
| 3482 if ((nsapi_state & MG_SEQ) > 0) { | |
| 3483 return; | |
| 3484 } | |
| 3485 if (((1 << nsapi) & sndcp_data->mg.suspended_nsapis) > 0) { | |
| 3486 sig_mg_nu_resume(nsapi); | |
| 3487 sndcp_data->mg.suspended_nsapis &= (~ (ULONG)(1 << nsapi)); | |
| 3488 } | |
| 3489 } | |
| 3490 } | |
| 3491 } /* mg_resume_affected_nus() */ | |
| 3492 | |
| 3493 | |
| 3494 /* | |
| 3495 +------------------------------------------------------------------------------ | |
| 3496 | Function : mg_is_rel_comp_nec | |
| 3497 +------------------------------------------------------------------------------ | |
| 3498 | Description : This function will be called in course of the deactivation of | |
| 3499 | the given nsapi. If the nsapi used a certain compressor, | |
| 3500 | but has been the only one to do this, then with the | |
| 3501 | compressor entity will also have to | |
| 3502 | be deactivated and all affected | |
| 3503 | arrays will be modified. | |
| 3504 | Parameters : UBYTE nsapi -- the given nsapi | |
| 3505 | BOOL* nec, a compressor | |
| 3506 | Post : An "mg_set_sapi_[p/d]ntt_rej(sapi, pntt, TRUE);" will be called | |
| 3507 | for | |
| 3508 | each entity to be released. Later this information may be used | |
| 3509 | to build up the right xid negotiation. | |
| 3510 | | |
| 3511 +------------------------------------------------------------------------------ | |
| 3512 */ | |
| 3513 GLOBAL void mg_is_rel_comp_nec (UBYTE nsapi, BOOL* nec) | |
| 3514 { | |
| 3515 UBYTE dntt = 0; | |
| 3516 UBYTE pntt = 0; | |
| 3517 UBYTE sapi = 0; | |
| 3518 UBYTE nsp = 0; | |
| 3519 | |
| 3520 TRACE_FUNCTION( "mg_is_rel_comp_nec" ); | |
| 3521 | |
| 3522 sndcp_get_nsapi_sapi(nsapi, &sapi); | |
| 3523 | |
| 3524 | |
| 3525 /* | |
| 3526 * Which pntt is used? | |
| 3527 */ | |
| 3528 for (pntt = 0; pntt < MG_MAX_ENTITIES; pntt++) { | |
| 3529 UBYTE state = MG_UNASSIGNED; | |
| 3530 BOOL used = FALSE; | |
| 3531 BOOL another = FALSE; | |
| 3532 BOOL rej_known = FALSE; | |
| 3533 /* | |
| 3534 * Is pntt already known to be deactivated? | |
| 3535 */ | |
| 3536 mg_get_sapi_pntt_rej(sapi, pntt, &rej_known); | |
| 3537 if (rej_known) { | |
| 3538 *nec = TRUE; | |
| 3539 continue; | |
| 3540 } | |
| 3541 /* | |
| 3542 * Is ntt used? | |
| 3543 */ | |
| 3544 mg_get_sapi_pntt_state(sapi, pntt, &state); | |
| 3545 if (state == MG_UNASSIGNED) { | |
| 3546 continue; | |
| 3547 } | |
| 3548 /* | |
| 3549 * Does the given nsapi use it? | |
| 3550 */ | |
| 3551 mg_get_sapi_pntt_nsapi(sapi, pntt, nsapi, &used); | |
| 3552 if (! used) { | |
| 3553 continue; | |
| 3554 } | |
| 3555 /* | |
| 3556 * Is the given nsapi the only user? | |
| 3557 */ | |
| 3558 for (nsp = 0; nsp < SNDCP_NUMBER_OF_NSAPIS; nsp++) { | |
| 3559 mg_get_sapi_pntt_nsapi(sapi, pntt, nsp, &used); | |
| 3560 if (used && nsapi != nsp) { | |
| 3561 another = TRUE; | |
| 3562 } | |
| 3563 } | |
| 3564 if (another) { | |
| 3565 continue; | |
| 3566 } | |
| 3567 mg_set_sapi_pntt_rej(sapi, pntt, TRUE); | |
| 3568 *nec = TRUE; | |
| 3569 } | |
| 3570 | |
| 3571 /* | |
| 3572 * Which dntt is used? | |
| 3573 */ | |
| 3574 for (dntt = 0; dntt < MG_MAX_ENTITIES; dntt++) { | |
| 3575 UBYTE state = MG_UNASSIGNED; | |
| 3576 BOOL used = FALSE; | |
| 3577 BOOL another = FALSE; | |
| 3578 BOOL rej_known = FALSE; | |
| 3579 /* | |
| 3580 * Is pntt already known to be deactivated? | |
| 3581 */ | |
| 3582 mg_get_sapi_dntt_rej(sapi, dntt, &rej_known); | |
| 3583 if (rej_known) { | |
| 3584 *nec = TRUE; | |
| 3585 continue; | |
| 3586 } | |
| 3587 /* | |
| 3588 * Is ntt used? | |
| 3589 */ | |
| 3590 mg_get_sapi_dntt_state(sapi, dntt, &state); | |
| 3591 if (state == MG_UNASSIGNED) { | |
| 3592 continue; | |
| 3593 } | |
| 3594 /* | |
| 3595 * Does the given nsapi use it? | |
| 3596 */ | |
| 3597 mg_get_sapi_dntt_nsapi(sapi, dntt, nsapi, &used); | |
| 3598 if (! used) { | |
| 3599 continue; | |
| 3600 } | |
| 3601 /* | |
| 3602 * Is the given nsapi the only user? | |
| 3603 */ | |
| 3604 for (nsp = 0; nsp < SNDCP_NUMBER_OF_NSAPIS; nsp++) { | |
| 3605 mg_get_sapi_dntt_nsapi(sapi, dntt, nsp, &used); | |
| 3606 if (used && nsapi != nsp) { | |
| 3607 another = TRUE; | |
| 3608 } | |
| 3609 } | |
| 3610 if (another) { | |
| 3611 continue; | |
| 3612 } | |
| 3613 | |
| 3614 mg_set_sapi_dntt_rej(sapi, dntt, TRUE); | |
| 3615 *nec = TRUE; | |
| 3616 } | |
| 3617 | |
| 3618 } /* mg_is_rel_comp_nec() */ | |
| 3619 | |
| 3620 | |
| 3621 /* | |
| 3622 +------------------------------------------------------------------------------ | |
| 3623 | Function : mg_rel_nsapi_nec | |
| 3624 +------------------------------------------------------------------------------ | |
| 3625 | Description : The SAPI connected to this NSAPI shall release acknowledged LLC | |
| 3626 | operation mode if the indicated NSAPI is the last one using | |
| 3627 | acknowledged mode on this SAPI. If an LL_RELEASE_REQ is sent | |
| 3628 | then the given NSAPI (the one in parameter!) shall enter state | |
| 3629 | MG_REL and wait for an LL_RELEASE_CNF. If the affected | |
| 3630 | NSAPI doesn't use ack mode then the procedure just returns. | |
| 3631 | If the affected sapi does not use acknowledged LLC operation | |
| 3632 | mode then the procedure just returns. | |
| 3633 | If an LL_ESTABLISH_REQ or LL_XID_REQ for the affected sapi is | |
| 3634 | pending, no LL_RELEASE_REQ primitive will be sent, but the | |
| 3635 | flag MG_REL_NEC_LOC will be set. | |
| 3636 | Pre : This procedure is called after receipt of an | |
| 3637 | SNSM_DEACTIVATE_IND, so the "local" parameter in an | |
| 3638 | LL_RELEASE_REQ will be set to LL_REL_LOCAL. | |
| 3639 | The procedure will only be called if the given nsapi is | |
| 3640 | currently using acknowledged LLC operation mode, so this | |
| 3641 | does not have to be checked. | |
| 3642 | Parameters : UBYTE nsapi -- the given nsapi | |
| 3643 | | |
| 3644 +------------------------------------------------------------------------------ | |
| 3645 */ | |
| 3646 GLOBAL void mg_rel_nsapi_nec (UBYTE nsapi) | |
| 3647 { | |
| 3648 UBYTE sapi = 0; | |
| 3649 UBYTE npi = 0; | |
| 3650 UBYTE spi = 0; | |
| 3651 USHORT sapi_state = MG_IDLE; | |
| 3652 /* | |
| 3653 * Are there other contexts using acknowledged mode on the same SAPI? | |
| 3654 */ | |
| 3655 BOOL another_ack = FALSE; | |
| 3656 BOOL sack = FALSE; | |
| 3657 TRACE_FUNCTION( "mg_rel_nsapi_nec" ); | |
| 3658 /* | |
| 3659 * Which SAPI is connected to the given NSAPI? | |
| 3660 */ | |
| 3661 sndcp_get_nsapi_sapi(nsapi, &sapi); | |
| 3662 sndcp_get_sapi_ack(sapi, &sack); | |
| 3663 sndcp_get_sapi_state(sapi, &sapi_state); | |
| 3664 | |
| 3665 if(!sack){ | |
| 3666 if ((sapi_state & MG_EST) != 0) { | |
| 3667 sndcp_set_sapi_state(sapi, MG_REL_NEC_LOC); | |
| 3668 } | |
| 3669 return; | |
| 3670 } | |
| 3671 /* | |
| 3672 * If release is pending, no need to send an other release. | |
| 3673 */ | |
| 3674 if ((sapi_state & MG_REL) > 0) { | |
| 3675 return; | |
| 3676 } | |
| 3677 /* | |
| 3678 * Are there other contexts using acknowledged mode on the same SAPI? | |
| 3679 */ | |
| 3680 for (npi = 0; npi < SNDCP_NUMBER_OF_NSAPIS; npi++) { | |
| 3681 BOOL used = FALSE; | |
| 3682 sndcp_is_nsapi_used(npi, &used); | |
| 3683 if (!used) { | |
| 3684 continue; | |
| 3685 } | |
| 3686 sndcp_get_nsapi_sapi(npi, &spi); | |
| 3687 if (spi == sapi && npi != nsapi) { | |
| 3688 BOOL is_ack = FALSE; | |
| 3689 sndcp_get_nsapi_ack(npi, &is_ack); | |
| 3690 if (is_ack) { | |
| 3691 another_ack = TRUE; | |
| 3692 } | |
| 3693 break; | |
| 3694 } | |
| 3695 } | |
| 3696 if (!another_ack) { | |
| 3697 | |
| 3698 if (((sapi_state & MG_EST) == 0) | |
| 3699 && | |
| 3700 ((sapi_state & MG_XID) == 0)) | |
| 3701 { | |
| 3702 /* | |
| 3703 * No LL_ESTABLISH_REQ or LL_XID_REQ pending. | |
| 3704 * LL_RELEASE_REQ may be sent. | |
| 3705 */ | |
| 3706 | |
| 3707 PALLOC(ll_release_req, LL_RELEASE_REQ); | |
| 3708 ll_release_req->sapi = sapi; | |
| 3709 /* | |
| 3710 * Note: this is always set to TRUE because the preconditions include that | |
| 3711 * this procedure has been called after an SNSM_DEACTIVATE_IND. | |
| 3712 * If this precondition changes the local flag will have to be a parameter. | |
| 3713 * (GSM 4.65, 6.2.2.2). | |
| 3714 */ | |
| 3715 ll_release_req->local = TRUE; | |
| 3716 /* | |
| 3717 * Set the "state" for the affected sapi to MG_REL. | |
| 3718 */ | |
| 3719 sndcp_set_sapi_state(sapi, MG_REL); | |
| 3720 sndcp_unset_sapi_state(sapi, MG_EST); | |
| 3721 | |
| 3722 PSEND(hCommLLC, ll_release_req); | |
| 3723 | |
| 3724 } else { | |
| 3725 /* | |
| 3726 * LL_ESTABLISH_REQ or LL_XID_REQ pending. | |
| 3727 * LL_RELEASE_REQ may not be sent. | |
| 3728 */ | |
| 3729 sndcp_set_sapi_state(sapi, MG_REL_NEC_LOC); | |
| 3730 | |
| 3731 } | |
| 3732 } /* if (!another_ack) */ | |
| 3733 | |
| 3734 | |
| 3735 } /* mg_rel_nsapi_nec() */ | |
| 3736 | |
| 3737 /* | |
| 3738 +------------------------------------------------------------------------------ | |
| 3739 | Function : mg_send_empty_xid_req | |
| 3740 +------------------------------------------------------------------------------ | |
| 3741 | Description : This procedure sets the pending-states of the affected sapi | |
| 3742 | and nsapi to MG_XID_PENDING and sends an LL_XID_REQ with | |
| 3743 | the sapi from the given snsm_activate_ind and an empty XID | |
| 3744 | block. | |
| 3745 | | |
| 3746 | Parameters : the SNSM_ACTIVATE_IND | |
| 3747 | | |
| 3748 +------------------------------------------------------------------------------ | |
| 3749 */ | |
| 3750 #ifdef SNDCP_UPM_INCLUDED | |
| 3751 GLOBAL void mg_send_empty_xid_req (T_SN_ACTIVATE_REQ* snsm_activate_ind) | |
| 3752 #else | |
| 3753 GLOBAL void mg_send_empty_xid_req (T_SNSM_ACTIVATE_IND* snsm_activate_ind) | |
| 3754 #endif /*#ifdef SNDCP_UPM_INCLUDED*/ | |
| 3755 { | |
| 3756 TRACE_FUNCTION( "mg_send_empty_xid_req" ); | |
| 3757 { | |
| 3758 PALLOC_SDU(ll_xid_req, LL_XID_REQ, SNDCP_XID_BLOCK_BIT_LEN); | |
| 3759 /* | |
| 3760 * Set sapi in ll_xid_req. | |
| 3761 */ | |
| 3762 ll_xid_req->sapi = snsm_activate_ind->sapi; | |
| 3763 ll_xid_req->sdu.l_buf = 0; | |
| 3764 | |
| 3765 /* | |
| 3766 * Mark sapi as pending. | |
| 3767 */ | |
| 3768 sndcp_set_sapi_state(snsm_activate_ind->sapi, MG_XID); | |
| 3769 /* | |
| 3770 * Send the XID block to LLC. | |
| 3771 */ | |
| 3772 | |
| 3773 sndcp_unset_sapi_state(ll_xid_req->sapi, MG_XID_NEC); | |
| 3774 sndcp_set_sapi_state(ll_xid_req->sapi, MG_XID); | |
| 3775 PSEND(hCommLLC, ll_xid_req); | |
| 3776 } | |
| 3777 } /* mg_send_xid_req() */ | |
| 3778 | |
| 3779 /* | |
| 3780 +------------------------------------------------------------------------------ | |
| 3781 | Function : mg_send_snsm_activate_res | |
| 3782 +------------------------------------------------------------------------------ | |
| 3783 | Description : Allocates prim, sets parameters and sends prim | |
| 3784 | | |
| 3785 | Parameters : the affected nsapi | |
| 3786 | | |
| 3787 +------------------------------------------------------------------------------ | |
| 3788 */ | |
| 3789 GLOBAL void mg_send_snsm_activate_res (UBYTE nsapi) | |
| 3790 { | |
| 3791 | |
| 3792 TRACE_FUNCTION( "mg_send_snsm_activate_res" ); | |
| 3793 { | |
| 3794 UBYTE sapi_index = 0; | |
| 3795 UBYTE sapi = 0; | |
| 3796 | |
| 3797 #ifdef SNDCP_UPM_INCLUDED | |
| 3798 PALLOC(snsm_activate_res, SN_ACTIVATE_CNF); | |
| 3799 #else | |
| 3800 PALLOC(snsm_activate_res, SNSM_ACTIVATE_RES); | |
| 3801 #endif /*#ifdef SNDCP_UPM_INCLUDED*/ | |
| 3802 | |
| 3803 sndcp_get_nsapi_sapi(nsapi, &sapi); | |
| 3804 sndcp_get_sapi_index(sapi, &sapi_index); | |
| 3805 | |
| 3806 snsm_activate_res->nsapi = nsapi; | |
| 3807 | |
| 3808 /* | |
| 3809 * If nsapi uses data compressor, set dcomp parameter | |
| 3810 * in snsm_activate_res. | |
| 3811 */ | |
| 3812 if (sndcp_data->mg.cur_xid_block[sapi_index].v42.is_set && | |
| 3813 ((sndcp_data->mg.cur_xid_block[sapi_index].v42.nsapis & | |
| 3814 (1 << nsapi)) > 0)) { | |
| 3815 | |
| 3816 #ifdef SNDCP_UPM_INCLUDED | |
| 3817 snsm_activate_res->comp_params.dcomp = | |
| 3818 sndcp_data->mg.cur_xid_block[sapi_index].v42.p0; | |
| 3819 #else | |
| 3820 snsm_activate_res->dcomp = | |
| 3821 sndcp_data->mg.cur_xid_block[sapi_index].v42.p0; | |
| 3822 #endif /*#ifdef SNDCP_UPM_INCLUDED*/ | |
| 3823 } else | |
| 3824 { | |
| 3825 #ifdef SNDCP_UPM_INCLUDED | |
| 3826 snsm_activate_res->comp_params.dcomp = 0; | |
| 3827 #else | |
| 3828 snsm_activate_res->dcomp = 0; | |
| 3829 #endif /*#ifdef SNDCP_UPM_INCLUDED*/ | |
| 3830 } | |
| 3831 | |
| 3832 /* | |
| 3833 * If nsapi uses header compressor, set hcomp parameter | |
| 3834 * and msid field in snsm_activate_res. | |
| 3835 */ | |
| 3836 | |
| 3837 #ifdef SNDCP_UPM_INCLUDED | |
| 3838 if (sndcp_data->mg.cur_xid_block[sapi_index].vj.is_set && | |
| 3839 ((sndcp_data->mg.cur_xid_block[sapi_index].vj.nsapis & | |
| 3840 (1 << nsapi)) > 0)) { | |
| 3841 snsm_activate_res->comp_params.msid = | |
| 3842 sndcp_data->mg.cur_xid_block[sapi_index].vj.s0_m_1 + 1; | |
| 3843 /* | |
| 3844 * How is that one negotiated? | |
| 3845 * Missing in VJ XID block. | |
| 3846 */ | |
| 3847 snsm_activate_res->comp_params.hcomp = | |
| 3848 sndcp_data->mg.cur_xid_block[sapi_index].vj.direction; | |
| 3849 } else { | |
| 3850 snsm_activate_res->comp_params.hcomp = 0; | |
| 3851 snsm_activate_res->comp_params.msid = 0; | |
| 3852 } | |
| 3853 | |
| 3854 PSEND(hCommUPM, snsm_activate_res); | |
| 3855 #else /*#ifdef SNDCP_UPM_INCLUDED*/ | |
| 3856 if (sndcp_data->mg.cur_xid_block[sapi_index].vj.is_set && | |
| 3857 ((sndcp_data->mg.cur_xid_block[sapi_index].vj.nsapis & | |
| 3858 (1 << nsapi)) > 0)) { | |
| 3859 snsm_activate_res->msid = | |
| 3860 sndcp_data->mg.cur_xid_block[sapi_index].vj.s0_m_1 + 1; | |
| 3861 /* | |
| 3862 * How is that one negotiated? | |
| 3863 * Missing in VJ XID block. | |
| 3864 */ | |
| 3865 snsm_activate_res->hcomp = | |
| 3866 sndcp_data->mg.cur_xid_block[sapi_index].vj.direction; | |
| 3867 } else { | |
| 3868 snsm_activate_res->hcomp = 0; | |
| 3869 snsm_activate_res->msid = 0; | |
| 3870 } | |
| 3871 PSEND(hCommSM, snsm_activate_res); | |
| 3872 #endif /*#ifdef SNDCP_UPM_INCLUDED*/ | |
| 3873 } | |
| 3874 } /* mg_send_snsm_activate_res() */ | |
| 3875 | |
| 3876 | |
| 3877 | |
| 3878 /* | |
| 3879 +------------------------------------------------------------------------------ | |
| 3880 | Function : mg_send_xid_req | |
| 3881 +------------------------------------------------------------------------------ | |
| 3882 | Description : This procedure sets the pending-states of the affected sapi | |
| 3883 | and nsapi to MG_XID_PENDING and sends an LL_XID_REQ with | |
| 3884 | parameters set according to the compression informations in | |
| 3885 | the given snsm_activate_ind and according to constants that | |
| 3886 | determine the capabilities of the data compression entity. | |
| 3887 | The part of this procedure that deals with the constant | |
| 3888 | compressor capabilities is implementation dependent. | |
| 3889 | | |
| 3890 | Parameters : the SNSM_ACTIVATE_IND | |
| 3891 | | |
| 3892 +------------------------------------------------------------------------------ | |
| 3893 */ | |
| 3894 #ifdef SNDCP_UPM_INCLUDED | |
| 3895 GLOBAL void mg_send_xid_req (T_SN_ACTIVATE_REQ* snsm_activate_ind) | |
| 3896 #else | |
| 3897 GLOBAL void mg_send_xid_req (T_SNSM_ACTIVATE_IND* snsm_activate_ind) | |
| 3898 #endif /*#ifdef SNDCP_UPM_INCLUDED*/ | |
| 3899 { | |
| 3900 UBYTE sapi_index = 0; | |
| 3901 TRACE_FUNCTION( "mg_send_xid_req" ); | |
| 3902 sndcp_get_sapi_index(snsm_activate_ind->sapi, &sapi_index); | |
| 3903 { | |
| 3904 PALLOC_SDU(ll_xid_req, LL_XID_REQ, SNDCP_XID_BLOCK_BIT_LEN); | |
| 3905 /* | |
| 3906 * Set sapi in ll_xid_req. | |
| 3907 */ | |
| 3908 ll_xid_req->sapi = snsm_activate_ind->sapi; | |
| 3909 /* | |
| 3910 * Write data from snsm_activate_ind to service variable req_xid_block. | |
| 3911 */ | |
| 3912 | |
| 3913 mg_set_req_xid_block(snsm_activate_ind); | |
| 3914 /* | |
| 3915 * Fill the XID block. Implementation dependent. | |
| 3916 */ | |
| 3917 mg_set_xid_params(ll_xid_req->sapi, | |
| 3918 &ll_xid_req->sdu, | |
| 3919 sndcp_data->mg.req_xid_block[sapi_index]); | |
| 3920 /* | |
| 3921 * Mark the affected sapi as xid pending | |
| 3922 */ | |
| 3923 | |
| 3924 sndcp_set_sapi_state(snsm_activate_ind->sapi, MG_XID); | |
| 3925 | |
| 3926 /* | |
| 3927 * Trace xid block. | |
| 3928 */ | |
| 3929 #ifdef SNDCP_TRACE_ALL | |
| 3930 TRACE_EVENT("outcoming xid block:"); | |
| 3931 sndcp_trace_sdu(&ll_xid_req->sdu); | |
| 3932 #endif | |
| 3933 /* | |
| 3934 * Send the XID block to LLC. | |
| 3935 */ | |
| 3936 | |
| 3937 sndcp_unset_sapi_state(ll_xid_req->sapi, MG_XID_NEC); | |
| 3938 sndcp_set_sapi_state(ll_xid_req->sapi, MG_XID); | |
| 3939 PSEND(hCommLLC, ll_xid_req); | |
| 3940 } | |
| 3941 } /* mg_send_xid_req() */ | |
| 3942 | |
| 3943 /* | |
| 3944 +------------------------------------------------------------------------------ | |
| 3945 | Function : mg_send_xid_req_del | |
| 3946 +------------------------------------------------------------------------------ | |
| 3947 | Description : If mg_get_sapi_pntt_rej() or mg_get_sapi_dntt_rej() indicate | |
| 3948 | that compressors must be removed, this function will | |
| 3949 | send an LL_XID_REQ which does this, or if an XID is pending, | |
| 3950 | the information about the rejected compressors will be stored | |
| 3951 | to new_xid_block and the MG_XID_NEC will be set. | |
| 3952 | | |
| 3953 | Parameters : the SNSM_ACTIVATE_IND | |
| 3954 | | |
| 3955 +------------------------------------------------------------------------------ | |
| 3956 */ | |
| 3957 GLOBAL void mg_send_xid_req_del (UBYTE sapi) | |
| 3958 { | |
| 3959 UBYTE sapi_index = 0; | |
| 3960 UBYTE ntt = 0; | |
| 3961 T_XID_BLOCK mt_xid_block; | |
| 3962 /* | |
| 3963 * Only length of parameter type 0. | |
| 3964 */ | |
| 3965 USHORT res_sdu_bit_len = 24; | |
| 3966 BOOL v42_rej = FALSE; | |
| 3967 BOOL vj_rej = FALSE; | |
| 3968 | |
| 3969 TRACE_FUNCTION( "mg_send_xid_req_del" ); | |
| 3970 | |
| 3971 sndcp_reset_xid_block(&mt_xid_block); | |
| 3972 | |
| 3973 sndcp_get_sapi_index(sapi, &sapi_index); | |
| 3974 /* | |
| 3975 * How long will xid_block be? | |
| 3976 */ | |
| 3977 /* | |
| 3978 * Add the extra space for ntts with nsapis == 0. | |
| 3979 */ | |
| 3980 for (ntt = 0; ntt < MG_MAX_ENTITIES; ntt++) { | |
| 3981 BOOL rej = FALSE; | |
| 3982 mg_get_sapi_dntt_rej(sapi, ntt, &rej); | |
| 3983 if (rej) { | |
| 3984 /* | |
| 3985 * length of ntt octet and nsapis. | |
| 3986 */ | |
| 3987 res_sdu_bit_len += 32; | |
| 3988 v42_rej = TRUE; | |
| 3989 /* | |
| 3990 * Change new_xid_block. | |
| 3991 */ | |
| 3992 sndcp_data->mg.new_xid_block[sapi_index].v42.nsapis = 0; | |
| 3993 sndcp_data->mg.new_xid_block[sapi_index].v42.nsapis_set = TRUE; | |
| 3994 sndcp_data->mg.new_xid_block[sapi_index].v42.is_set = TRUE; | |
| 3995 } | |
| 3996 | |
| 3997 mg_get_sapi_pntt_rej(sapi, ntt, &rej); | |
| 3998 if (rej) { | |
| 3999 /* | |
| 4000 * length of ntt octet and nsapis. | |
| 4001 */ | |
| 4002 res_sdu_bit_len += 32; | |
| 4003 vj_rej = TRUE; | |
| 4004 /* | |
| 4005 * Change req_xid_block. | |
| 4006 */ | |
| 4007 sndcp_data->mg.new_xid_block[sapi_index].vj.nsapis = 0; | |
| 4008 sndcp_data->mg.new_xid_block[sapi_index].vj.nsapis_set = TRUE; | |
| 4009 sndcp_data->mg.new_xid_block[sapi_index].vj.is_set = TRUE; | |
| 4010 | |
| 4011 } | |
| 4012 } | |
| 4013 if (v42_rej) { | |
| 4014 /* | |
| 4015 * Add length of parameter type and length. | |
| 4016 */ | |
| 4017 res_sdu_bit_len += 16; | |
| 4018 } | |
| 4019 if (vj_rej) { | |
| 4020 /* | |
| 4021 * Add length of parameter type and length. | |
| 4022 */ | |
| 4023 res_sdu_bit_len += 16; | |
| 4024 } | |
| 4025 | |
| 4026 if (v42_rej || vj_rej) { | |
| 4027 | |
| 4028 USHORT state = MG_IDLE; | |
| 4029 | |
| 4030 sndcp_get_sapi_state(sapi, &state); | |
| 4031 if ((state & MG_XID) == 0) { | |
| 4032 | |
| 4033 PALLOC_SDU(ll_xid_req, LL_XID_REQ, res_sdu_bit_len); | |
| 4034 | |
| 4035 sndcp_data->mg.req_xid_block[sapi_index] = | |
| 4036 sndcp_data->mg.new_xid_block[sapi_index]; | |
| 4037 /* | |
| 4038 * Set sapi in ll_xid_req. | |
| 4039 */ | |
| 4040 ll_xid_req->sapi = sapi; | |
| 4041 /* | |
| 4042 * Write data from snsm_activate_ind to service variable req_xid_block. | |
| 4043 */ | |
| 4044 sndcp_reset_xid_block(&mt_xid_block); | |
| 4045 sndcp_reset_xid_block(&sndcp_data->mg.new_xid_block[sapi_index]); | |
| 4046 /* | |
| 4047 * Fill the XID block. Implementation dependent. | |
| 4048 */ | |
| 4049 mg_set_xid_params(ll_xid_req->sapi, | |
| 4050 &ll_xid_req->sdu, | |
| 4051 mt_xid_block); | |
| 4052 /* | |
| 4053 * Mark the affected sapi as MG_DEL_XID_PENDING. | |
| 4054 */ | |
| 4055 sndcp_set_sapi_state(sapi, MG_XID); | |
| 4056 /* | |
| 4057 * Send the XID block to LLC. | |
| 4058 */ | |
| 4059 | |
| 4060 sndcp_unset_sapi_state(sapi, MG_XID_NEC); | |
| 4061 sndcp_set_sapi_state(ll_xid_req->sapi, MG_XID); | |
| 4062 PSEND(hCommLLC, ll_xid_req); | |
| 4063 } else { | |
| 4064 sndcp_set_sapi_state(sapi, MG_XID_NEC); | |
| 4065 } | |
| 4066 } | |
| 4067 } /* mg_send_xid_req_del() */ | |
| 4068 | |
| 4069 | |
| 4070 /* | |
| 4071 +------------------------------------------------------------------------------ | |
| 4072 | Function : mg_set_cur_xid_block | |
| 4073 +------------------------------------------------------------------------------ | |
| 4074 | Description : This procedure sets the cur_xid_block service variable | |
| 4075 | according to the values given in req_xid_block and cnf_xid_block. | |
| 4076 | It also sets the unassigned, selected, assigned states of the affected | |
| 4077 | dcomp, pcomp, ntt. | |
| 4078 | The p bit in the req_xid_block is unset, if affected. | |
| 4079 | See GSM 4.65, 6.8.2. | |
| 4080 | | |
| 4081 | Parameters : the affected sapi | |
| 4082 | | |
| 4083 +------------------------------------------------------------------------------ | |
| 4084 */ | |
| 4085 GLOBAL void mg_set_cur_xid_block (UBYTE sapi) { | |
| 4086 UBYTE sapi_index = 0; | |
| 4087 T_XID_BLOCK* cur_xid_block; | |
| 4088 T_XID_BLOCK* req_xid_block; | |
| 4089 T_XID_BLOCK* cnf_xid_block; | |
| 4090 TRACE_FUNCTION( "mg_set_cur_xid_block" ); | |
| 4091 sndcp_get_sapi_index(sapi, &sapi_index); | |
| 4092 cur_xid_block = &sndcp_data->mg.cur_xid_block[sapi_index]; | |
| 4093 req_xid_block = &sndcp_data->mg.req_xid_block[sapi_index]; | |
| 4094 cnf_xid_block = &sndcp_data->mg.cnf_xid_block[sapi_index]; | |
| 4095 /* | |
| 4096 * SNDCP version has been tested to be SNDCP_XID_VERSION. | |
| 4097 */ | |
| 4098 cur_xid_block->version = SNDCP_XID_VERSION; | |
| 4099 | |
| 4100 /* | |
| 4101 * V42bis parameters. | |
| 4102 */ | |
| 4103 if (req_xid_block->v42.is_set) { | |
| 4104 cur_xid_block->v42.is_set = TRUE; | |
| 4105 cur_xid_block->v42.ntt = req_xid_block->v42.ntt; | |
| 4106 mg_set_sapi_dntt_state(sapi, | |
| 4107 req_xid_block->v42.ntt, | |
| 4108 MG_ASSIGNED); | |
| 4109 req_xid_block->v42.p_bit = SNDCP_P_BIT_0; | |
| 4110 | |
| 4111 /* | |
| 4112 * Algorithm type and DCOMP are only set in req. | |
| 4113 */ | |
| 4114 cur_xid_block->v42.algo_type = req_xid_block->v42.algo_type; | |
| 4115 cur_xid_block->v42.dcomp = req_xid_block->v42.dcomp; | |
| 4116 mg_set_sapi_dcomp_state(sapi, | |
| 4117 req_xid_block->v42.dcomp, | |
| 4118 MG_ASSIGNED); | |
| 4119 | |
| 4120 if (cnf_xid_block->v42.is_set) { | |
| 4121 | |
| 4122 if (cnf_xid_block->v42.nsapis_set) { | |
| 4123 cur_xid_block->v42.nsapis = cnf_xid_block->v42.nsapis; | |
| 4124 cur_xid_block->v42.nsapis_set = TRUE; | |
| 4125 } else if (req_xid_block->v42.nsapis_set) { | |
| 4126 cur_xid_block->v42.nsapis = req_xid_block->v42.nsapis; | |
| 4127 cur_xid_block->v42.nsapis_set = TRUE; | |
| 4128 } | |
| 4129 if (cnf_xid_block->v42.p0_set) { | |
| 4130 cur_xid_block->v42.p0 = cnf_xid_block->v42.p0; | |
| 4131 cur_xid_block->v42.p0_set = TRUE; | |
| 4132 } else if (req_xid_block->v42.p0_set) { | |
| 4133 cur_xid_block->v42.p0 = req_xid_block->v42.p0; | |
| 4134 cur_xid_block->v42.p0_set = TRUE; | |
| 4135 } | |
| 4136 if (cnf_xid_block->v42.p1_set) { | |
| 4137 cur_xid_block->v42.p1 = cnf_xid_block->v42.p1; | |
| 4138 cur_xid_block->v42.p1_set = TRUE; | |
| 4139 } else if (req_xid_block->v42.p1_set) { | |
| 4140 cur_xid_block->v42.p1 = req_xid_block->v42.p1; | |
| 4141 cur_xid_block->v42.p1_set = TRUE; | |
| 4142 } | |
| 4143 if (cnf_xid_block->v42.p2_set) { | |
| 4144 cur_xid_block->v42.p2 = cnf_xid_block->v42.p2; | |
| 4145 cur_xid_block->v42.p2_set = TRUE; | |
| 4146 } else if (req_xid_block->v42.p2_set) { | |
| 4147 cur_xid_block->v42.p2 = req_xid_block->v42.p2; | |
| 4148 cur_xid_block->v42.p2_set = TRUE; | |
| 4149 } | |
| 4150 | |
| 4151 } else { | |
| 4152 /* | |
| 4153 * NOT cnf_xid_block->v42.is_set. | |
| 4154 */ | |
| 4155 | |
| 4156 if (req_xid_block->v42.nsapis_set) { | |
| 4157 cur_xid_block->v42.nsapis = req_xid_block->v42.nsapis; | |
| 4158 cur_xid_block->v42.nsapis_set = TRUE; | |
| 4159 } | |
| 4160 if (req_xid_block->v42.p0_set) { | |
| 4161 cur_xid_block->v42.p0 = req_xid_block->v42.p0; | |
| 4162 cur_xid_block->v42.p0_set = TRUE; | |
| 4163 } | |
| 4164 if (req_xid_block->v42.p1_set) { | |
| 4165 cur_xid_block->v42.p1 = req_xid_block->v42.p1; | |
| 4166 cur_xid_block->v42.p1_set = TRUE; | |
| 4167 } | |
| 4168 if (req_xid_block->v42.p2_set) { | |
| 4169 cur_xid_block->v42.p2 = req_xid_block->v42.p2; | |
| 4170 cur_xid_block->v42.p2_set = TRUE; | |
| 4171 } | |
| 4172 | |
| 4173 } | |
| 4174 } else { | |
| 4175 /* | |
| 4176 * NOT req_xid_block->v42.is_set. | |
| 4177 */ | |
| 4178 if (cnf_xid_block->v42.is_set) { | |
| 4179 | |
| 4180 cur_xid_block->v42.is_set = TRUE; | |
| 4181 if (cnf_xid_block->v42.nsapis_set) { | |
| 4182 cur_xid_block->v42.nsapis = cnf_xid_block->v42.nsapis; | |
| 4183 cur_xid_block->v42.nsapis_set = TRUE; | |
| 4184 } | |
| 4185 if (cnf_xid_block->v42.p0_set) { | |
| 4186 cur_xid_block->v42.p0 = cnf_xid_block->v42.p0; | |
| 4187 cur_xid_block->v42.p0_set = TRUE; | |
| 4188 } | |
| 4189 if (cnf_xid_block->v42.p1_set) { | |
| 4190 cur_xid_block->v42.p1 = cnf_xid_block->v42.p1; | |
| 4191 cur_xid_block->v42.p1_set = TRUE; | |
| 4192 } | |
| 4193 if (cnf_xid_block->v42.p2_set) { | |
| 4194 cur_xid_block->v42.p2 = cnf_xid_block->v42.p2; | |
| 4195 cur_xid_block->v42.p2_set = TRUE; | |
| 4196 } | |
| 4197 | |
| 4198 } else { | |
| 4199 /* | |
| 4200 * Req and cnf are not set, cur_xid_block keeps its values. | |
| 4201 */ | |
| 4202 } | |
| 4203 } | |
| 4204 | |
| 4205 | |
| 4206 /* | |
| 4207 * VJ parameters. | |
| 4208 */ | |
| 4209 if (req_xid_block->vj.is_set) { | |
| 4210 cur_xid_block->vj.is_set = TRUE; | |
| 4211 cur_xid_block->vj.ntt = req_xid_block->vj.ntt; | |
| 4212 mg_set_sapi_pntt_state(sapi, | |
| 4213 req_xid_block->vj.ntt, | |
| 4214 MG_ASSIGNED); | |
| 4215 req_xid_block->vj.p_bit = SNDCP_P_BIT_0; | |
| 4216 /* | |
| 4217 * Algorithm type and PCOMPs are only set in req. | |
| 4218 * The direction is only set in req. | |
| 4219 */ | |
| 4220 cur_xid_block->vj.algo_type = req_xid_block->vj.algo_type; | |
| 4221 cur_xid_block->vj.pcomp1 = req_xid_block->vj.pcomp1; | |
| 4222 mg_set_sapi_pcomp_state(sapi, | |
| 4223 req_xid_block->vj.pcomp1, | |
| 4224 MG_ASSIGNED); | |
| 4225 cur_xid_block->vj.pcomp2 = req_xid_block->vj.pcomp2; | |
| 4226 mg_set_sapi_pcomp_state(sapi, | |
| 4227 req_xid_block->vj.pcomp2, | |
| 4228 MG_ASSIGNED); | |
| 4229 cur_xid_block->vj.direction = req_xid_block->vj.direction; | |
| 4230 if (cnf_xid_block->vj.is_set) { | |
| 4231 if (cnf_xid_block->vj.nsapis_set) { | |
| 4232 cur_xid_block->vj.nsapis = cnf_xid_block->vj.nsapis; | |
| 4233 cur_xid_block->vj.nsapis_set = TRUE; | |
| 4234 } else { | |
| 4235 cur_xid_block->vj.nsapis = req_xid_block->vj.nsapis; | |
| 4236 cur_xid_block->vj.nsapis_set = TRUE; | |
| 4237 } | |
| 4238 if (cnf_xid_block->vj.s0_m_1_set) { | |
| 4239 cur_xid_block->vj.s0_m_1 = cnf_xid_block->vj.s0_m_1; | |
| 4240 cur_xid_block->vj.s0_m_1_set = TRUE; | |
| 4241 } else { | |
| 4242 cur_xid_block->vj.s0_m_1 = req_xid_block->vj.s0_m_1; | |
| 4243 cur_xid_block->vj.s0_m_1_set = TRUE; | |
| 4244 } | |
| 4245 } else { | |
| 4246 if (req_xid_block->vj.nsapis_set) { | |
| 4247 cur_xid_block->vj.nsapis = req_xid_block->vj.nsapis; | |
| 4248 cur_xid_block->vj.nsapis_set = TRUE; | |
| 4249 } | |
| 4250 if (req_xid_block->vj.s0_m_1_set) { | |
| 4251 cur_xid_block->vj.s0_m_1 = req_xid_block->vj.s0_m_1; | |
| 4252 cur_xid_block->vj.s0_m_1_set = TRUE; | |
| 4253 } | |
| 4254 } | |
| 4255 } else { | |
| 4256 /* | |
| 4257 * NOT req_xid_block->vj.es_set. | |
| 4258 */ | |
| 4259 if (cnf_xid_block->vj.is_set) { | |
| 4260 cur_xid_block->vj.is_set = TRUE; | |
| 4261 if (cnf_xid_block->vj.nsapis_set) { | |
| 4262 cur_xid_block->vj.nsapis = cnf_xid_block->vj.nsapis; | |
| 4263 cur_xid_block->vj.nsapis_set = TRUE; | |
| 4264 } | |
| 4265 if (cnf_xid_block->vj.s0_m_1_set) { | |
| 4266 cur_xid_block->vj.s0_m_1 = cnf_xid_block->vj.s0_m_1; | |
| 4267 cur_xid_block->vj.s0_m_1_set = TRUE; | |
| 4268 } | |
| 4269 } else { | |
| 4270 /* | |
| 4271 * Req and cnf are not set, cur_xid_block keeps it's values. | |
| 4272 */ | |
| 4273 } | |
| 4274 } | |
| 4275 | |
| 4276 /* | |
| 4277 * If nsapis are 0, deactivate compressor. | |
| 4278 */ | |
| 4279 if (cur_xid_block->v42.nsapis == 0 || | |
| 4280 cur_xid_block->v42.nsapis_set == FALSE) { | |
| 4281 | |
| 4282 /* | |
| 4283 * Find the affected compressor entity. | |
| 4284 */ | |
| 4285 UBYTE dntt = 0; | |
| 4286 mg_get_sapi_dcomp_dntt(sapi, req_xid_block->v42.dcomp, &dntt); | |
| 4287 | |
| 4288 cur_xid_block->v42.is_set = FALSE; | |
| 4289 mg_set_sapi_dcomp_state(sapi, | |
| 4290 req_xid_block->v42.dcomp, | |
| 4291 MG_UNASSIGNED); | |
| 4292 mg_set_sapi_dntt_state(sapi, | |
| 4293 dntt, | |
| 4294 MG_UNASSIGNED); | |
| 4295 /* | |
| 4296 * One compressor less, something like sndcp_data->v42_count--; | |
| 4297 * should come here! | |
| 4298 */ | |
| 4299 | |
| 4300 } | |
| 4301 if (cur_xid_block->vj.nsapis == 0 || | |
| 4302 cur_xid_block->vj.nsapis_set == FALSE) { | |
| 4303 | |
| 4304 /* | |
| 4305 * Find the affected compressor entity. | |
| 4306 */ | |
| 4307 UBYTE pntt = 0; | |
| 4308 mg_get_sapi_pcomp_pntt(sapi, req_xid_block->vj.pcomp1, &pntt); | |
| 4309 mg_get_sapi_pcomp_pntt(sapi, req_xid_block->vj.pcomp2, &pntt); | |
| 4310 cur_xid_block->vj.is_set = FALSE; | |
| 4311 mg_set_sapi_pcomp_state(sapi, | |
| 4312 req_xid_block->vj.pcomp1, | |
| 4313 MG_UNASSIGNED); | |
| 4314 mg_set_sapi_pcomp_state(sapi, | |
| 4315 req_xid_block->vj.pcomp2, | |
| 4316 MG_UNASSIGNED); | |
| 4317 mg_set_sapi_pntt_state(sapi, | |
| 4318 pntt, | |
| 4319 MG_UNASSIGNED); | |
| 4320 /* | |
| 4321 * One compressor less. | |
| 4322 */ | |
| 4323 if (sndcp_data->vj_count > 0) { | |
| 4324 sndcp_data->vj_count--; | |
| 4325 } | |
| 4326 } | |
| 4327 | |
| 4328 | |
| 4329 /* | |
| 4330 * Send new block to service cia. | |
| 4331 */ | |
| 4332 sig_mg_cia_new_xid(cur_xid_block); | |
| 4333 | |
| 4334 } /* mg_set_cur_xid_block() */ | |
| 4335 | |
| 4336 /* | |
| 4337 +------------------------------------------------------------------------------ | |
| 4338 | Function : mg_set_new_xid_block | |
| 4339 +------------------------------------------------------------------------------ | |
| 4340 | Description : This procedure reads data from the given snsm_activate_ind and | |
| 4341 | from the already requested xid block and | |
| 4342 | writes them to the service variable new_xid_block. | |
| 4343 | When the pending establishment or xid negotiation is finished | |
| 4344 | this new_xid_block will be newly evaluated. | |
| 4345 | | |
| 4346 | Parameters : | |
| 4347 | the new SNSM_ACTIVATE_IND | |
| 4348 | | |
| 4349 +------------------------------------------------------------------------------ | |
| 4350 */ | |
| 4351 #ifdef SNDCP_UPM_INCLUDED | |
| 4352 GLOBAL void mg_set_new_xid_block (T_SN_ACTIVATE_REQ* snsm_activate_ind) | |
| 4353 #else | |
| 4354 GLOBAL void mg_set_new_xid_block (T_SNSM_ACTIVATE_IND* snsm_activate_ind) | |
| 4355 #endif /*#ifdef SNDCP_UPM_INCLUDED*/ | |
| 4356 { | |
| 4357 UBYTE sapi_index = 0; | |
| 4358 TRACE_FUNCTION( "mg_set_new_xid_block" ); | |
| 4359 sndcp_get_sapi_index(snsm_activate_ind->sapi, &sapi_index); | |
| 4360 /* | |
| 4361 * Set the version number. | |
| 4362 */ | |
| 4363 sndcp_data->mg.new_xid_block[sapi_index].version = SNDCP_XID_VERSION; | |
| 4364 /* | |
| 4365 * Set the V42.bis parameters, | |
| 4366 */ | |
| 4367 #ifdef TI_PS_FF_V42BIS | |
| 4368 sndcp_data->mg.new_xid_block[sapi_index].v42.is_set = | |
| 4369 #ifdef SNDCP_UPM_INCLUDED | |
| 4370 (snsm_activate_ind->comp_params.dcomp != NAS_DCOMP_NEITHER_DIRECT); | |
| 4371 #else | |
| 4372 (snsm_activate_ind->dcomp != SNSM_COMP_NEITHER_DIRECT); | |
| 4373 #endif /*#ifdef SNDCP_UPM_INCLUDED*/ | |
| 4374 sndcp_data->mg.new_xid_block[sapi_index].v42.p_bit = SNDCP_P_BIT_1; | |
| 4375 sndcp_data->mg.new_xid_block[sapi_index].v42.ntt = SNDCP_NTT_0; | |
| 4376 sndcp_data->mg.new_xid_block[sapi_index].v42.algo_type = SNDCP_XID_V42; | |
| 4377 sndcp_data->mg.new_xid_block[sapi_index].v42.dcomp = SNDCP_DCOMP1; | |
| 4378 sndcp_data->mg.new_xid_block[sapi_index].v42.nsapis = | |
| 4379 1 << (snsm_activate_ind->nsapi); | |
| 4380 sndcp_data->mg.new_xid_block[sapi_index].v42.nsapis_set = TRUE; | |
| 4381 #ifdef SNDCP_UPM_INCLUDED | |
| 4382 sndcp_data->mg.new_xid_block[sapi_index].v42.p0 = snsm_activate_ind->comp_params.dcomp; | |
| 4383 #else | |
| 4384 sndcp_data->mg.new_xid_block[sapi_index].v42.p0 = snsm_activate_ind->dcomp; | |
| 4385 #endif /*#ifdef SNDCP_UPM_INCLUDED*/ | |
| 4386 sndcp_data->mg.new_xid_block[sapi_index].v42.p0_set = TRUE; | |
| 4387 | |
| 4388 /* | |
| 4389 * Set p1 and p2 to default values. | |
| 4390 */ | |
| 4391 sndcp_data->mg.new_xid_block[sapi_index].v42.p1 = SNDCP_V42_DEFAULT_P1; | |
| 4392 sndcp_data->mg.new_xid_block[sapi_index].v42.p1_set = TRUE; | |
| 4393 sndcp_data->mg.new_xid_block[sapi_index].v42.p2 = | |
| 4394 SNDCP_V42_DEFAULT_P2; | |
| 4395 sndcp_data->mg.new_xid_block[sapi_index].v42.p2_set = TRUE; | |
| 4396 | |
| 4397 /* | |
| 4398 * Set affected entities and dcomp/pcomp values. | |
| 4399 */ | |
| 4400 mg_set_ntt_comp(snsm_activate_ind->sapi); | |
| 4401 | |
| 4402 #else /* !TI_PS_FF_V42BIS */ | |
| 4403 | |
| 4404 | |
| 4405 sndcp_data->mg.new_xid_block[sapi_index].v42.is_set = FALSE; | |
| 4406 | |
| 4407 sndcp_data->mg.new_xid_block[sapi_index].v42.nsapis = 0; | |
| 4408 | |
| 4409 sndcp_data->mg.new_xid_block[sapi_index].v42.nsapis_set = FALSE; | |
| 4410 sndcp_data->mg.new_xid_block[sapi_index].v42.p0_set = FALSE; | |
| 4411 | |
| 4412 /* | |
| 4413 * Set p1 and p2 to default values. | |
| 4414 */ | |
| 4415 sndcp_data->mg.new_xid_block[sapi_index].v42.p1 = SNDCP_V42_DEFAULT_P1; | |
| 4416 sndcp_data->mg.new_xid_block[sapi_index].v42.p1_set = TRUE; | |
| 4417 sndcp_data->mg.new_xid_block[sapi_index].v42.p2 = | |
| 4418 SNDCP_V42_DEFAULT_P2; | |
| 4419 sndcp_data->mg.new_xid_block[sapi_index].v42.p2_set = TRUE; | |
| 4420 | |
| 4421 #endif /* TI_PS_FF_V42BIS */ | |
| 4422 | |
| 4423 /* | |
| 4424 * Set the Van Jacobson parameters, | |
| 4425 */ | |
| 4426 sndcp_data->mg.new_xid_block[sapi_index].vj.is_set = | |
| 4427 #ifdef SNDCP_UPM_INCLUDED | |
| 4428 (snsm_activate_ind->comp_params.hcomp != NAS_HCOMP_OFF) || | |
| 4429 #else | |
| 4430 (snsm_activate_ind->hcomp != SNSM_COMP_NEITHER_DIRECT) || | |
| 4431 #endif /*#ifdef SNDCP_UPM_INCLUDED*/ | |
| 4432 sndcp_data->mg.new_xid_block[sapi_index].vj.is_set || | |
| 4433 sndcp_data->mg.req_xid_block[sapi_index].vj.is_set; | |
| 4434 | |
| 4435 if (! sndcp_data->mg.req_xid_block[sapi_index].vj.is_set) { | |
| 4436 sndcp_data->mg.new_xid_block[sapi_index].vj.p_bit = SNDCP_P_BIT_1; | |
| 4437 } else { | |
| 4438 sndcp_data->mg.new_xid_block[sapi_index].vj.p_bit = SNDCP_P_BIT_0; | |
| 4439 } | |
| 4440 | |
| 4441 sndcp_data->mg.new_xid_block[sapi_index].vj.ntt = SNDCP_NTT_0; | |
| 4442 sndcp_data->mg.new_xid_block[sapi_index].vj.algo_type = SNDCP_XID_VJ; | |
| 4443 sndcp_data->mg.new_xid_block[sapi_index].vj.pcomp1 = SNDCP_PCOMP1; | |
| 4444 sndcp_data->mg.new_xid_block[sapi_index].vj.pcomp2 = SNDCP_PCOMP2; | |
| 4445 | |
| 4446 sndcp_data->mg.new_xid_block[sapi_index].vj.nsapis |= | |
| 4447 (sndcp_data->mg.req_xid_block[sapi_index].vj.nsapis | | |
| 4448 1 << (snsm_activate_ind->nsapi)); | |
| 4449 sndcp_data->mg.new_xid_block[sapi_index].vj.nsapis_set = TRUE; | |
| 4450 | |
| 4451 #ifdef SNDCP_UPM_INCLUDED | |
| 4452 sndcp_data->mg.new_xid_block[sapi_index].vj.s0_m_1 = | |
| 4453 snsm_activate_ind->comp_params.msid - 1; | |
| 4454 #else | |
| 4455 sndcp_data->mg.new_xid_block[sapi_index].vj.s0_m_1 = | |
| 4456 snsm_activate_ind->msid - 1; | |
| 4457 #endif /*#ifdef SNDCP_UPM_INCLUDED*/ | |
| 4458 sndcp_data->mg.new_xid_block[sapi_index].vj.s0_m_1_set = TRUE; | |
| 4459 /* | |
| 4460 * Only used internally, not in XID block. | |
| 4461 * Not: it is assumed that the indicated values match the existing ones! | |
| 4462 */ | |
| 4463 #ifdef SNDCP_UPM_INCLUDED | |
| 4464 sndcp_data->mg.new_xid_block[sapi_index].vj.direction = | |
| 4465 snsm_activate_ind->comp_params.hcomp; | |
| 4466 #else | |
| 4467 sndcp_data->mg.new_xid_block[sapi_index].vj.direction = | |
| 4468 snsm_activate_ind->hcomp; | |
| 4469 #endif /*#ifdef SNDCP_UPM_INCLUDED*/ | |
| 4470 | |
| 4471 } /* mg_set_new_xid_block() */ | |
| 4472 | |
| 4473 | |
| 4474 | |
| 4475 /* | |
| 4476 +------------------------------------------------------------------------------ | |
| 4477 | Function : mg_set_req_xid_block | |
| 4478 +------------------------------------------------------------------------------ | |
| 4479 | Description : This procedure reads data from the given snsm_activate_ind and | |
| 4480 | writes it to the service variable req_xid_block. | |
| 4481 | | |
| 4482 | Parameters : | |
| 4483 | the SNSM_ACTIVATE_IND that caused the negotiation. | |
| 4484 | | |
| 4485 +------------------------------------------------------------------------------ | |
| 4486 */ | |
| 4487 #ifdef SNDCP_UPM_INCLUDED | |
| 4488 GLOBAL void mg_set_req_xid_block (T_SN_ACTIVATE_REQ* snsm_activate_ind) | |
| 4489 #else | |
| 4490 GLOBAL void mg_set_req_xid_block (T_SNSM_ACTIVATE_IND* snsm_activate_ind) | |
| 4491 #endif /*#ifdef SNDCP_UPM_INCLUDED*/ | |
| 4492 { | |
| 4493 UBYTE sapi_index = 0; | |
| 4494 BOOL vio; | |
| 4495 TRACE_FUNCTION( "mg_set_req_xid_block" ); | |
| 4496 sndcp_get_sapi_index(snsm_activate_ind->sapi, &sapi_index); | |
| 4497 /* | |
| 4498 * Set the version number. | |
| 4499 */ | |
| 4500 sndcp_data->mg.req_xid_block[sapi_index].version = SNDCP_XID_VERSION; | |
| 4501 /* | |
| 4502 * Set the V42.bis parameters, | |
| 4503 */ | |
| 4504 #ifdef TI_PS_FF_V42BIS | |
| 4505 | |
| 4506 #ifdef SNDCP_UPM_INCLUDED | |
| 4507 sndcp_data->mg.req_xid_block[sapi_index].v42.is_set = | |
| 4508 (snsm_activate_ind->comp_params.dcomp != NAS_DCOMP_NEITHER_DIRECT); | |
| 4509 #else | |
| 4510 sndcp_data->mg.req_xid_block[sapi_index].v42.is_set = | |
| 4511 (snsm_activate_ind->dcomp != SNSM_COMP_NEITHER_DIRECT); | |
| 4512 #endif /*#ifdef SNDCP_UPM_INCLUDED*/ | |
| 4513 sndcp_data->mg.req_xid_block[sapi_index].v42.p_bit = SNDCP_P_BIT_1; | |
| 4514 sndcp_data->mg.req_xid_block[sapi_index].v42.ntt = SNDCP_NTT_0; | |
| 4515 sndcp_data->mg.req_xid_block[sapi_index].v42.algo_type = SNDCP_XID_V42; | |
| 4516 sndcp_data->mg.req_xid_block[sapi_index].v42.dcomp = SNDCP_DCOMP1; | |
| 4517 | |
| 4518 sndcp_data->mg.req_xid_block[sapi_index].v42.nsapis = | |
| 4519 1 << (snsm_activate_ind->nsapi); | |
| 4520 sndcp_data->mg.req_xid_block[sapi_index].v42.nsapis_set = TRUE; | |
| 4521 #ifdef SNDCP_UPM_INCLUDED | |
| 4522 sndcp_data->mg.req_xid_block[sapi_index].v42.p0 = snsm_activate_ind->comp_params.dcomp; | |
| 4523 #else | |
| 4524 sndcp_data->mg.req_xid_block[sapi_index].v42.p0 = snsm_activate_ind->dcomp; | |
| 4525 #endif /*#ifdef SNDCP_UPM_INCLUDED*/ | |
| 4526 sndcp_data->mg.req_xid_block[sapi_index].v42.p0_set = TRUE; | |
| 4527 | |
| 4528 /* | |
| 4529 * Set p1 and p2 to default values. | |
| 4530 */ | |
| 4531 sndcp_data->mg.req_xid_block[sapi_index].v42.p1 = SNDCP_V42_DEFAULT_P1; | |
| 4532 sndcp_data->mg.req_xid_block[sapi_index].v42.p1_set = TRUE; | |
| 4533 sndcp_data->mg.req_xid_block[sapi_index].v42.p2 = | |
| 4534 SNDCP_V42_DEFAULT_P2; | |
| 4535 sndcp_data->mg.req_xid_block[sapi_index].v42.p2_set = TRUE; | |
| 4536 sndcp_data->mg.user_xid_block[snsm_activate_ind->nsapi].v42.is_set = | |
| 4537 #ifdef SNDCP_UPM_INCLUDED | |
| 4538 (snsm_activate_ind->comp_params.dcomp != NAS_DCOMP_NEITHER_DIRECT); | |
| 4539 #else | |
| 4540 (snsm_activate_ind->dcomp != SNSM_COMP_NEITHER_DIRECT); | |
| 4541 #endif /*#ifdef SNDCP_UPM_INCLUDED*/ | |
| 4542 sndcp_data->mg.user_xid_block[snsm_activate_ind->nsapi].v42.p_bit = SNDCP_P_BIT_1; | |
| 4543 sndcp_data->mg.user_xid_block[snsm_activate_ind->nsapi].v42.ntt = SNDCP_NTT_0; | |
| 4544 sndcp_data->mg.user_xid_block[snsm_activate_ind->nsapi].v42.algo_type = SNDCP_XID_V42; | |
| 4545 sndcp_data->mg.user_xid_block[snsm_activate_ind->nsapi].v42.dcomp = SNDCP_DCOMP1; | |
| 4546 sndcp_data->mg.user_xid_block[snsm_activate_ind->nsapi].v42.nsapis = | |
| 4547 1 << (snsm_activate_ind->nsapi); | |
| 4548 sndcp_data->mg.user_xid_block[snsm_activate_ind->nsapi].v42.nsapis_set = TRUE; | |
| 4549 #ifdef SNDCP_UPM_INCLUDED | |
| 4550 sndcp_data->mg.user_xid_block[snsm_activate_ind->nsapi].v42.p0 = snsm_activate_ind->comp_params.dcomp; | |
| 4551 #else | |
| 4552 sndcp_data->mg.user_xid_block[snsm_activate_ind->nsapi].v42.p0 = snsm_activate_ind->dcomp; | |
| 4553 #endif /*#ifdef SNDCP_UPM_INCLUDED*/ | |
| 4554 sndcp_data->mg.user_xid_block[snsm_activate_ind->nsapi].v42.p0_set = TRUE; | |
| 4555 | |
| 4556 /* | |
| 4557 * Set p1 and p2 to default values. | |
| 4558 */ | |
| 4559 sndcp_data->mg.user_xid_block[snsm_activate_ind->nsapi].v42.p1 = SNDCP_V42_DEFAULT_P1; | |
| 4560 sndcp_data->mg.user_xid_block[snsm_activate_ind->nsapi].v42.p1_set = TRUE; | |
| 4561 sndcp_data->mg.user_xid_block[snsm_activate_ind->nsapi].v42.p2 = | |
| 4562 SNDCP_V42_DEFAULT_P2; | |
| 4563 sndcp_data->mg.user_xid_block[snsm_activate_ind->nsapi].v42.p2_set = TRUE; | |
| 4564 | |
| 4565 /* | |
| 4566 * Set affected entities and dcomp/pcomp values. | |
| 4567 */ | |
| 4568 mg_set_ntt_comp(snsm_activate_ind->sapi); | |
| 4569 | |
| 4570 | |
| 4571 #else /* !TI_PS_FF_V42BIS */ | |
| 4572 | |
| 4573 sndcp_data->mg.req_xid_block[sapi_index].v42.is_set = FALSE; | |
| 4574 | |
| 4575 sndcp_data->mg.req_xid_block[sapi_index].v42.nsapis = 0; | |
| 4576 | |
| 4577 sndcp_data->mg.req_xid_block[sapi_index].v42.nsapis_set = FALSE; | |
| 4578 sndcp_data->mg.req_xid_block[sapi_index].v42.p0_set = FALSE; | |
| 4579 | |
| 4580 /* | |
| 4581 * Set p1 and p2 to default values. | |
| 4582 */ | |
| 4583 sndcp_data->mg.req_xid_block[sapi_index].v42.p1 = SNDCP_V42_DEFAULT_P1; | |
| 4584 sndcp_data->mg.req_xid_block[sapi_index].v42.p1_set = TRUE; | |
| 4585 sndcp_data->mg.req_xid_block[sapi_index].v42.p2 = | |
| 4586 SNDCP_V42_DEFAULT_P2; | |
| 4587 sndcp_data->mg.req_xid_block[sapi_index].v42.p2_set = TRUE; | |
| 4588 | |
| 4589 #endif /* TI_PS_FF_V42BIS */ | |
| 4590 | |
| 4591 /* | |
| 4592 * Set the Van Jacobson parameters. | |
| 4593 * Note: | |
| 4594 * If number of state slots is set to 0, do not request VJ in XID request. | |
| 4595 */ | |
| 4596 #ifdef SNDCP_UPM_INCLUDED | |
| 4597 if (snsm_activate_ind->comp_params.msid == 0) { | |
| 4598 #else | |
| 4599 if (snsm_activate_ind->msid == 0) { | |
| 4600 #endif /*#ifdef SNDCP_UPM_INCLUDED*/ | |
| 4601 sndcp_data->mg.req_xid_block[sapi_index].vj.is_set = FALSE; | |
| 4602 return; | |
| 4603 } | |
| 4604 | |
| 4605 sndcp_data->mg.req_xid_block[sapi_index].vj.is_set = | |
| 4606 #ifdef SNDCP_UPM_INCLUDED | |
| 4607 (snsm_activate_ind->comp_params.hcomp != NAS_HCOMP_OFF); | |
| 4608 #else | |
| 4609 (snsm_activate_ind->hcomp != SNSM_COMP_NEITHER_DIRECT); | |
| 4610 #endif /*#ifdef SNDCP_UPM_INCLUDED*/ | |
| 4611 if (!sndcp_data->mg.req_xid_block[sapi_index].vj.is_set) { | |
| 4612 return; | |
| 4613 } | |
| 4614 /* | |
| 4615 * This function will only be called after snsm_activate_ind. So the | |
| 4616 * user_xid_block will be set for the affected nsapi. | |
| 4617 */ | |
| 4618 if (sndcp_data->mg.cur_xid_block[sapi_index].vj.is_set) { | |
| 4619 sndcp_data->mg.user_xid_block[snsm_activate_ind->nsapi].vj.p_bit = | |
| 4620 SNDCP_P_BIT_0; | |
| 4621 } else { | |
| 4622 sndcp_data->mg.user_xid_block[snsm_activate_ind->nsapi].vj.p_bit = | |
| 4623 SNDCP_P_BIT_1; | |
| 4624 } | |
| 4625 | |
| 4626 sndcp_data->mg.user_xid_block[snsm_activate_ind->nsapi].vj.ntt = | |
| 4627 SNDCP_NTT_0; | |
| 4628 sndcp_data->mg.user_xid_block[snsm_activate_ind->nsapi].vj.algo_type = | |
| 4629 SNDCP_XID_VJ; | |
| 4630 sndcp_data->mg.user_xid_block[snsm_activate_ind->nsapi].vj.pcomp1 = | |
| 4631 SNDCP_PCOMP1; | |
| 4632 sndcp_data->mg.user_xid_block[snsm_activate_ind->nsapi].vj.pcomp2 = | |
| 4633 SNDCP_PCOMP2; | |
| 4634 sndcp_data->mg.user_xid_block[snsm_activate_ind->nsapi].vj.nsapis += | |
| 4635 1 << (snsm_activate_ind->nsapi); | |
| 4636 sndcp_data->mg.user_xid_block[snsm_activate_ind->nsapi].vj.nsapis_set = TRUE; | |
| 4637 #ifdef SNDCP_UPM_INCLUDED | |
| 4638 if (snsm_activate_ind->comp_params.msid > SNDCP_MAX_NUMBER_OF_VJ_SLOTS) { | |
| 4639 sndcp_data->mg.user_xid_block[snsm_activate_ind->nsapi].vj.s0_m_1 = | |
| 4640 SNDCP_MAX_NUMBER_OF_VJ_SLOTS - 1; | |
| 4641 } else { | |
| 4642 sndcp_data->mg.user_xid_block[snsm_activate_ind->nsapi].vj.s0_m_1 = | |
| 4643 snsm_activate_ind->comp_params.msid - 1; | |
| 4644 } | |
| 4645 #else | |
| 4646 if (snsm_activate_ind->msid > SNDCP_MAX_NUMBER_OF_VJ_SLOTS) { | |
| 4647 sndcp_data->mg.user_xid_block[snsm_activate_ind->nsapi].vj.s0_m_1 = | |
| 4648 SNDCP_MAX_NUMBER_OF_VJ_SLOTS - 1; | |
| 4649 } else { | |
| 4650 sndcp_data->mg.user_xid_block[snsm_activate_ind->nsapi].vj.s0_m_1 = | |
| 4651 snsm_activate_ind->msid - 1; | |
| 4652 } | |
| 4653 #endif /*#ifdef SNDCP_UPM_INCLUDED*/ | |
| 4654 sndcp_data->mg.user_xid_block[snsm_activate_ind->nsapi].vj.s0_m_1_set = TRUE; | |
| 4655 /* | |
| 4656 * Only used internally, not in XID block. | |
| 4657 */ | |
| 4658 #ifdef SNDCP_UPM_INCLUDED | |
| 4659 sndcp_data->mg.user_xid_block[snsm_activate_ind->nsapi].vj.direction = | |
| 4660 snsm_activate_ind->comp_params.hcomp; | |
| 4661 #else | |
| 4662 sndcp_data->mg.user_xid_block[snsm_activate_ind->nsapi].vj.direction = | |
| 4663 snsm_activate_ind->hcomp; | |
| 4664 #endif /*#ifdef SNDCP_UPM_INCLUDED*/ | |
| 4665 | |
| 4666 /* | |
| 4667 * Set affected entities and dcomp/pcomp values. | |
| 4668 */ | |
| 4669 mg_set_ntt_comp(snsm_activate_ind->sapi); | |
| 4670 | |
| 4671 mg_detect_mode_clash ((USHORT) | |
| 4672 (sndcp_data->mg.cur_xid_block[sapi_index].vj.nsapis + | |
| 4673 (1 << (snsm_activate_ind->nsapi))), | |
| 4674 &vio); | |
| 4675 if (vio) { | |
| 4676 return; | |
| 4677 } | |
| 4678 | |
| 4679 if (sndcp_data->mg.cur_xid_block[sapi_index].vj.is_set) { | |
| 4680 sndcp_data->mg.req_xid_block[sapi_index].vj.p_bit = SNDCP_P_BIT_0; | |
| 4681 } else { | |
| 4682 sndcp_data->mg.req_xid_block[sapi_index].vj.p_bit = SNDCP_P_BIT_1; | |
| 4683 } | |
| 4684 sndcp_data->mg.req_xid_block[sapi_index].vj.ntt = SNDCP_NTT_0; | |
| 4685 sndcp_data->mg.req_xid_block[sapi_index].vj.algo_type = SNDCP_XID_VJ; | |
| 4686 sndcp_data->mg.req_xid_block[sapi_index].vj.pcomp1 = SNDCP_PCOMP1; | |
| 4687 sndcp_data->mg.req_xid_block[sapi_index].vj.pcomp2 = SNDCP_PCOMP2; | |
| 4688 | |
| 4689 /* | |
| 4690 * All the nsapis that currently use the compressor and the new one | |
| 4691 * shall be set in the nsapis field of the XID block. | |
| 4692 */ | |
| 4693 sndcp_data->mg.req_xid_block[sapi_index].vj.nsapis = | |
| 4694 (sndcp_data->mg.cur_xid_block[sapi_index].vj.nsapis | | |
| 4695 (1 << (snsm_activate_ind->nsapi))); | |
| 4696 | |
| 4697 sndcp_data->mg.req_xid_block[sapi_index].vj.nsapis_set = TRUE; | |
| 4698 #ifdef SNDCP_UPM_INCLUDED | |
| 4699 if (snsm_activate_ind->comp_params.msid > SNDCP_MAX_NUMBER_OF_VJ_SLOTS) { | |
| 4700 sndcp_data->mg.req_xid_block[sapi_index].vj.s0_m_1 = | |
| 4701 SNDCP_MAX_NUMBER_OF_VJ_SLOTS - 1; | |
| 4702 } else { | |
| 4703 sndcp_data->mg.req_xid_block[sapi_index].vj.s0_m_1 = | |
| 4704 snsm_activate_ind->comp_params.msid - 1; | |
| 4705 } | |
| 4706 #else | |
| 4707 if (snsm_activate_ind->msid > SNDCP_MAX_NUMBER_OF_VJ_SLOTS) { | |
| 4708 sndcp_data->mg.req_xid_block[sapi_index].vj.s0_m_1 = | |
| 4709 SNDCP_MAX_NUMBER_OF_VJ_SLOTS - 1; | |
| 4710 } else { | |
| 4711 sndcp_data->mg.req_xid_block[sapi_index].vj.s0_m_1 = | |
| 4712 snsm_activate_ind->msid - 1; | |
| 4713 } | |
| 4714 #endif /*#ifdef SNDCP_UPM_INCLUDED*/ | |
| 4715 sndcp_data->mg.req_xid_block[sapi_index].vj.s0_m_1_set = TRUE; | |
| 4716 /* | |
| 4717 * Only used internally, not in XID block. | |
| 4718 */ | |
| 4719 #ifdef SNDCP_UPM_INCLUDED | |
| 4720 sndcp_data->mg.req_xid_block[sapi_index].vj.direction = | |
| 4721 snsm_activate_ind->comp_params.hcomp; | |
| 4722 #else | |
| 4723 sndcp_data->mg.req_xid_block[sapi_index].vj.direction = | |
| 4724 snsm_activate_ind->hcomp; | |
| 4725 #endif /*#ifdef SNDCP_UPM_INCLUDED*/ | |
| 4726 /* | |
| 4727 * Set affected entities and dcomp/pcomp values. | |
| 4728 */ | |
| 4729 mg_set_ntt_comp(snsm_activate_ind->sapi); | |
| 4730 | |
| 4731 } /* mg_set_req_xid_block() */ | |
| 4732 | |
| 4733 | |
| 4734 /* | |
| 4735 +------------------------------------------------------------------------------ | |
| 4736 | Function : mg_set_res_cur_xid_block | |
| 4737 +------------------------------------------------------------------------------ | |
| 4738 | Description : This procedure sets the service variables res_xid_block and | |
| 4739 | cur_xid_block. The needed data comes from the service variable ind_xid_block, | |
| 4740 | and from default settings. | |
| 4741 | Note: if the indicated compressors do not match with compressors requested | |
| 4742 | or currently used then they will be unset by adding them to the list of | |
| 4743 | rejected compressors. | |
| 4744 | | |
| 4745 | | |
| 4746 | Parameters : | |
| 4747 | the affected sapi, | |
| 4748 | the necessary bit length of an sdu that will later store the | |
| 4749 | xid block derived from res_xid_block. | |
| 4750 | | |
| 4751 +------------------------------------------------------------------------------ | |
| 4752 */ | |
| 4753 GLOBAL void mg_set_res_cur_xid_block (UBYTE sapi, USHORT* res_sdu_bit_len) | |
| 4754 { | |
| 4755 UBYTE sapi_index = 0; | |
| 4756 UBYTE nsapi = 0; | |
| 4757 /* | |
| 4758 * Which compressors are indicated? | |
| 4759 */ | |
| 4760 BOOL v42_ind, vj_ind; | |
| 4761 /* | |
| 4762 * Which compressors are possible? | |
| 4763 * (The indicated set of nsapis must overlap with the | |
| 4764 * currently used one.) | |
| 4765 */ | |
| 4766 BOOL v42_possible, vj_possible; | |
| 4767 /* | |
| 4768 * Is compressor going to rejected? In this case the compressor should not | |
| 4769 * be requested. | |
| 4770 */ | |
| 4771 BOOL v42_rejected, vj_rejected; | |
| 4772 | |
| 4773 TRACE_FUNCTION( "mg_set_res_cur_xid_block" ); | |
| 4774 | |
| 4775 sndcp_get_sapi_index(sapi, &sapi_index); | |
| 4776 sndcp_reset_xid_block(&(sndcp_data->mg.res_xid_block[sapi_index])); | |
| 4777 | |
| 4778 /* | |
| 4779 * Set bit length to "only version", 3 bytes. | |
| 4780 */ | |
| 4781 *res_sdu_bit_len = 24; | |
| 4782 /* | |
| 4783 * Set the version number. | |
| 4784 */ | |
| 4785 sndcp_data->mg.res_xid_block[sapi_index].version = SNDCP_XID_VERSION; | |
| 4786 | |
| 4787 v42_ind = sndcp_data->mg.ind_xid_block[sapi_index].v42.is_set; | |
| 4788 v42_possible = FALSE; | |
| 4789 for (nsapi = 0; nsapi < SNDCP_NUMBER_OF_NSAPIS; nsapi++) { | |
| 4790 if ((sndcp_data->mg.user_xid_block[nsapi].v42.nsapis & | |
| 4791 sndcp_data->mg.ind_xid_block[sapi_index].v42.nsapis) > 0) { | |
| 4792 | |
| 4793 U8 local_sapi = 0; | |
| 4794 sndcp_get_nsapi_sapi(nsapi, &local_sapi); | |
| 4795 if (local_sapi == sapi) { | |
| 4796 v42_possible = TRUE; | |
| 4797 } | |
| 4798 } | |
| 4799 } | |
| 4800 | |
| 4801 | |
| 4802 if (v42_ind && ! v42_possible) { | |
| 4803 sndcp_data->mg.res_xid_block[sapi_index].v42.is_set = FALSE; | |
| 4804 mg_set_sapi_dntt_rej (sapi, | |
| 4805 sndcp_data->mg.ind_xid_block[sapi_index].v42.ntt, | |
| 4806 TRUE); | |
| 4807 } | |
| 4808 | |
| 4809 mg_get_sapi_dntt_rej (sapi, | |
| 4810 sndcp_data->mg.ind_xid_block[sapi_index].v42.ntt, | |
| 4811 &v42_rejected); | |
| 4812 | |
| 4813 | |
| 4814 if (v42_ind && ! v42_rejected) { | |
| 4815 /* | |
| 4816 * Data compression will be included, increment bit len (+ 10 bytes). | |
| 4817 */ | |
| 4818 *res_sdu_bit_len += 80; | |
| 4819 | |
| 4820 /* | |
| 4821 * Set the V42.bis parameters, | |
| 4822 */ | |
| 4823 sndcp_data->mg.res_xid_block[sapi_index].v42.is_set = TRUE; | |
| 4824 | |
| 4825 sndcp_data->mg.res_xid_block[sapi_index].v42.p_bit = SNDCP_P_BIT_0; | |
| 4826 | |
| 4827 sndcp_data->mg.res_xid_block[sapi_index].v42.ntt = | |
| 4828 sndcp_data->mg.ind_xid_block[sapi_index].v42.ntt; | |
| 4829 | |
| 4830 | |
| 4831 sndcp_data->mg.res_xid_block[sapi_index].v42.algo_type = SNDCP_XID_V42; | |
| 4832 | |
| 4833 sndcp_data->mg.res_xid_block[sapi_index].v42.dcomp = | |
| 4834 sndcp_data->mg.ind_xid_block[sapi_index].v42.dcomp; | |
| 4835 | |
| 4836 /* | |
| 4837 * Set the 'nsapis' parameter in res_xid_block: | |
| 4838 * Check rules in 4.65, subclause 6.8.1, compare with cur_xid_block. | |
| 4839 */ | |
| 4840 mg_set_xid_nsapis(sapi, MG_XID_V42_NSAPIS); | |
| 4841 | |
| 4842 /* | |
| 4843 * It is assumed that the values desired by the user / the | |
| 4844 * values possible with the current implementation are written in | |
| 4845 * req_xid_block, the responded values are then the minimum of | |
| 4846 * req and ind values: | |
| 4847 */ | |
| 4848 /* | |
| 4849 * For the direction parameter p0 take the logical AND: | |
| 4850 */ | |
| 4851 sndcp_data->mg.res_xid_block[sapi_index].v42.p0 = | |
| 4852 (sndcp_data->mg.req_xid_block[sapi_index].v42.p0 & | |
| 4853 sndcp_data->mg.ind_xid_block[sapi_index].v42.p0); | |
| 4854 sndcp_data->mg.res_xid_block[sapi_index].v42.p0_set = TRUE; | |
| 4855 | |
| 4856 /* | |
| 4857 * For p1 and p2 take minimum. | |
| 4858 */ | |
| 4859 sndcp_data->mg.res_xid_block[sapi_index].v42.p1 = | |
| 4860 (sndcp_data->mg.req_xid_block[sapi_index].v42.p1 < | |
| 4861 sndcp_data->mg.ind_xid_block[sapi_index].v42.p1)? | |
| 4862 sndcp_data->mg.req_xid_block[sapi_index].v42.p1 : | |
| 4863 sndcp_data->mg.ind_xid_block[sapi_index].v42.p1; | |
| 4864 sndcp_data->mg.res_xid_block[sapi_index].v42.p1_set = TRUE; | |
| 4865 | |
| 4866 sndcp_data->mg.res_xid_block[sapi_index].v42.p2 = | |
| 4867 (sndcp_data->mg.req_xid_block[sapi_index].v42.p2 < | |
| 4868 sndcp_data->mg.ind_xid_block[sapi_index].v42.p2)? | |
| 4869 sndcp_data->mg.req_xid_block[sapi_index].v42.p2 : | |
| 4870 sndcp_data->mg.ind_xid_block[sapi_index].v42.p2; | |
| 4871 sndcp_data->mg.res_xid_block[sapi_index].v42.p2_set = TRUE; | |
| 4872 | |
| 4873 } /* v42.is_set */ | |
| 4874 | |
| 4875 | |
| 4876 /* | |
| 4877 * Header compression, | |
| 4878 */ | |
| 4879 | |
| 4880 | |
| 4881 vj_ind = sndcp_data->mg.ind_xid_block[sapi_index].vj.is_set; | |
| 4882 vj_possible = FALSE; | |
| 4883 for (nsapi = 0; nsapi < SNDCP_NUMBER_OF_NSAPIS; nsapi++) { | |
| 4884 if ((sndcp_data->mg.user_xid_block[nsapi].vj.nsapis & | |
| 4885 sndcp_data->mg.ind_xid_block[sapi_index].vj.nsapis) > 0) { | |
| 4886 | |
| 4887 U8 local_sapi = 0; | |
| 4888 sndcp_get_nsapi_sapi(nsapi, &local_sapi); | |
| 4889 if (local_sapi == sapi) { | |
| 4890 vj_possible = TRUE; | |
| 4891 } | |
| 4892 } | |
| 4893 } | |
| 4894 | |
| 4895 if (vj_ind && ! vj_possible) { | |
| 4896 sndcp_data->mg.res_xid_block[sapi_index].vj.is_set = FALSE; | |
| 4897 mg_set_sapi_pntt_rej (sapi, | |
| 4898 sndcp_data->mg.ind_xid_block[sapi_index].vj.ntt, | |
| 4899 TRUE); | |
| 4900 } | |
| 4901 | |
| 4902 mg_get_sapi_pntt_rej (sapi, | |
| 4903 sndcp_data->mg.ind_xid_block[sapi_index].vj.ntt, | |
| 4904 &vj_rejected); | |
| 4905 | |
| 4906 if (vj_ind && ! vj_rejected) { | |
| 4907 /* | |
| 4908 * Header compression will be included, increment bit len (+ 7 bytes). | |
| 4909 */ | |
| 4910 *res_sdu_bit_len += 56; | |
| 4911 | |
| 4912 /* | |
| 4913 * Set the VJ parameters, | |
| 4914 */ | |
| 4915 sndcp_data->mg.res_xid_block[sapi_index].vj.is_set = TRUE; | |
| 4916 | |
| 4917 sndcp_data->mg.res_xid_block[sapi_index].vj.p_bit = SNDCP_P_BIT_0; | |
| 4918 | |
| 4919 sndcp_data->mg.res_xid_block[sapi_index].vj.ntt = | |
| 4920 sndcp_data->mg.ind_xid_block[sapi_index].vj.ntt; | |
| 4921 | |
| 4922 sndcp_data->mg.res_xid_block[sapi_index].vj.algo_type = SNDCP_XID_VJ; | |
| 4923 | |
| 4924 if (sndcp_data->mg.ind_xid_block[sapi_index].vj.p_bit == SNDCP_P_BIT_1) { | |
| 4925 sndcp_data->mg.res_xid_block[sapi_index].vj.pcomp1 = | |
| 4926 sndcp_data->mg.ind_xid_block[sapi_index].vj.pcomp1; | |
| 4927 sndcp_data->mg.res_xid_block[sapi_index].vj.pcomp2 = | |
| 4928 sndcp_data->mg.ind_xid_block[sapi_index].vj.pcomp2; | |
| 4929 } else { | |
| 4930 sndcp_data->mg.res_xid_block[sapi_index].vj.pcomp1 = | |
| 4931 sndcp_data->mg.cur_xid_block[sapi_index].vj.pcomp1; | |
| 4932 sndcp_data->mg.res_xid_block[sapi_index].vj.pcomp2 = | |
| 4933 sndcp_data->mg.cur_xid_block[sapi_index].vj.pcomp2; | |
| 4934 } | |
| 4935 | |
| 4936 /* | |
| 4937 * Set the 'nsapis' parameter in res_xid_block: | |
| 4938 * Check rules in 4.65, subclause 6.8.1, compare with cur_xid_block. | |
| 4939 * State slots and direction are also set here. | |
| 4940 */ | |
| 4941 mg_set_xid_nsapis(sapi, MG_XID_VJ_NSAPIS); | |
| 4942 | |
| 4943 | |
| 4944 } /* vj.is_set */ | |
| 4945 | |
| 4946 | |
| 4947 /* | |
| 4948 * Set affected entities and dcomp/pcomp values. | |
| 4949 */ | |
| 4950 if (v42_ind && v42_possible) { | |
| 4951 mg_set_sapi_dntt_state(sapi, | |
| 4952 sndcp_data->mg.res_xid_block[sapi_index].v42.ntt, | |
| 4953 MG_ASSIGNED); | |
| 4954 | |
| 4955 mg_set_sapi_dcomp_state(sapi, | |
| 4956 sndcp_data->mg.res_xid_block[sapi_index].v42.dcomp, | |
| 4957 MG_ASSIGNED); | |
| 4958 mg_set_sapi_dcomp_dntt(sapi, | |
| 4959 sndcp_data->mg.res_xid_block[sapi_index].v42.dcomp, | |
| 4960 sndcp_data->mg.res_xid_block[sapi_index].v42.ntt); | |
| 4961 for (nsapi = 0; nsapi < SNDCP_NUMBER_OF_NSAPIS; nsapi++) { | |
| 4962 if (((1 << nsapi) & sndcp_data->mg.ind_xid_block[sapi_index].v42.nsapis) > 0) { | |
| 4963 mg_set_sapi_dntt_nsapi(sapi, | |
| 4964 sndcp_data->mg.res_xid_block[sapi_index].v42.ntt, | |
| 4965 nsapi, | |
| 4966 TRUE); | |
| 4967 } /* if nsapi is selected */ | |
| 4968 } /* for loop over all nsapis */ | |
| 4969 | |
| 4970 } | |
| 4971 /* | |
| 4972 * If VJ is indicated and possible, switch on compressor. | |
| 4973 */ | |
| 4974 if (vj_ind && vj_possible) { | |
| 4975 mg_set_sapi_pntt_state(sapi, | |
| 4976 sndcp_data->mg.res_xid_block[sapi_index].vj.ntt, | |
| 4977 MG_ASSIGNED); | |
| 4978 mg_set_sapi_pcomp_state(sapi, | |
| 4979 sndcp_data->mg.res_xid_block[sapi_index].vj.pcomp1, | |
| 4980 MG_ASSIGNED); | |
| 4981 mg_set_sapi_pcomp_state(sapi, | |
| 4982 sndcp_data->mg.res_xid_block[sapi_index].vj.pcomp2, | |
| 4983 MG_ASSIGNED); | |
| 4984 mg_set_sapi_pcomp_pntt(sapi, | |
| 4985 sndcp_data->mg.res_xid_block[sapi_index].vj.pcomp1, | |
| 4986 sndcp_data->mg.res_xid_block[sapi_index].vj.ntt); | |
| 4987 mg_set_sapi_pcomp_pntt(sapi, | |
| 4988 sndcp_data->mg.res_xid_block[sapi_index].vj.pcomp2, | |
| 4989 sndcp_data->mg.res_xid_block[sapi_index].vj.ntt); | |
| 4990 for (nsapi = 0; nsapi < SNDCP_NUMBER_OF_NSAPIS; nsapi++) { | |
| 4991 if (((1 << nsapi) & sndcp_data->mg.ind_xid_block[sapi_index].v42.nsapis) > 0) { | |
| 4992 mg_set_sapi_pntt_nsapi(sapi, | |
| 4993 sndcp_data->mg.res_xid_block[sapi_index].vj.ntt, | |
| 4994 nsapi, | |
| 4995 TRUE); | |
| 4996 } /* if nsapi is selected */ | |
| 4997 } /* for loop over all nsapis */ | |
| 4998 } | |
| 4999 | |
| 5000 /* | |
| 5001 * If VJ has been switched on and is now indicated to be switched off: | |
| 5002 * switch off compressor. | |
| 5003 */ | |
| 5004 if (vj_ind | |
| 5005 && | |
| 5006 sndcp_data->mg.ind_xid_block[sapi_index].vj.nsapis == 0 | |
| 5007 && | |
| 5008 sndcp_data->mg.cur_xid_block[sapi_index].vj.nsapis > 0) | |
| 5009 { | |
| 5010 mg_set_sapi_pntt_state(sapi, | |
| 5011 sndcp_data->mg.res_xid_block[sapi_index].vj.ntt, | |
| 5012 MG_UNASSIGNED); | |
| 5013 mg_set_sapi_pcomp_state(sapi, | |
| 5014 sndcp_data->mg.res_xid_block[sapi_index].vj.pcomp1, | |
| 5015 MG_UNASSIGNED); | |
| 5016 mg_set_sapi_pcomp_state(sapi, | |
| 5017 sndcp_data->mg.res_xid_block[sapi_index].vj.pcomp2, | |
| 5018 MG_UNASSIGNED); | |
| 5019 /* mg_set_sapi_pcomp_pntt(sapi, | |
| 5020 sndcp_data->mg.res_xid_block[sapi_index].vj.pcomp1, | |
| 5021 sndcp_data->mg.res_xid_block[sapi_index].vj.ntt); | |
| 5022 mg_set_sapi_pcomp_pntt(sapi, | |
| 5023 sndcp_data->mg.res_xid_block[sapi_index].vj.pcomp2, | |
| 5024 sndcp_data->mg.res_xid_block[sapi_index].vj.ntt); | |
| 5025 */ | |
| 5026 for (nsapi = 0; nsapi < SNDCP_NUMBER_OF_NSAPIS; nsapi++) { | |
| 5027 if (((1 << nsapi) & sndcp_data->mg.ind_xid_block[sapi_index].v42.nsapis) > 0) { | |
| 5028 mg_set_sapi_pntt_nsapi(sapi, | |
| 5029 sndcp_data->mg.cur_xid_block[sapi_index].vj.ntt, | |
| 5030 nsapi, | |
| 5031 FALSE); | |
| 5032 } /* if nsapi is selected */ | |
| 5033 } /* for loop over all nsapis */ | |
| 5034 } | |
| 5035 | |
| 5036 | |
| 5037 /* | |
| 5038 * Add same values for cur_xid_block. | |
| 5039 */ | |
| 5040 | |
| 5041 if (sndcp_data->mg.res_xid_block[sapi_index].v42.is_set) { | |
| 5042 if (sndcp_data->mg.cur_xid_block[sapi_index].v42.is_set) { | |
| 5043 sndcp_data->mg.cur_xid_block[sapi_index].v42.nsapis = | |
| 5044 sndcp_data->mg.res_xid_block[sapi_index].v42.nsapis; | |
| 5045 if (sndcp_data->mg.cur_xid_block[sapi_index].v42.p0_set) { | |
| 5046 sndcp_data->mg.cur_xid_block[sapi_index].v42.p0 = | |
| 5047 sndcp_data->mg.res_xid_block[sapi_index].v42.p0; | |
| 5048 } | |
| 5049 if (sndcp_data->mg.cur_xid_block[sapi_index].v42.p1_set) { | |
| 5050 sndcp_data->mg.cur_xid_block[sapi_index].v42.p1 = | |
| 5051 sndcp_data->mg.res_xid_block[sapi_index].v42.p1; | |
| 5052 } | |
| 5053 if (sndcp_data->mg.cur_xid_block[sapi_index].v42.p2_set) { | |
| 5054 sndcp_data->mg.cur_xid_block[sapi_index].v42.p2 = | |
| 5055 sndcp_data->mg.res_xid_block[sapi_index].v42.p2; | |
| 5056 } | |
| 5057 } else { | |
| 5058 sndcp_data->mg.cur_xid_block[sapi_index].v42 = | |
| 5059 sndcp_data->mg.res_xid_block[sapi_index].v42; | |
| 5060 } | |
| 5061 } | |
| 5062 | |
| 5063 if (sndcp_data->mg.res_xid_block[sapi_index].vj.is_set) { | |
| 5064 if (sndcp_data->mg.cur_xid_block[sapi_index].vj.is_set) { | |
| 5065 sndcp_data->mg.cur_xid_block[sapi_index].vj.nsapis = | |
| 5066 sndcp_data->mg.res_xid_block[sapi_index].vj.nsapis; | |
| 5067 if (sndcp_data->mg.cur_xid_block[sapi_index].vj.s0_m_1_set) { | |
| 5068 sndcp_data->mg.cur_xid_block[sapi_index].vj.s0_m_1 = | |
| 5069 sndcp_data->mg.res_xid_block[sapi_index].vj.s0_m_1; | |
| 5070 } | |
| 5071 } else { | |
| 5072 sndcp_data->mg.cur_xid_block[sapi_index].vj = | |
| 5073 sndcp_data->mg.res_xid_block[sapi_index].vj; | |
| 5074 } | |
| 5075 } | |
| 5076 | |
| 5077 | |
| 5078 if (vj_rejected) { | |
| 5079 sndcp_data->mg.cur_xid_block[sapi_index].vj.nsapis = 0; | |
| 5080 } | |
| 5081 if (sndcp_data->mg.cur_xid_block[sapi_index].vj.nsapis == 0) { | |
| 5082 sndcp_data->mg.cur_xid_block[sapi_index].vj.is_set = FALSE; | |
| 5083 } | |
| 5084 | |
| 5085 if (v42_rejected) { | |
| 5086 sndcp_data->mg.cur_xid_block[sapi_index].v42.nsapis = 0; | |
| 5087 } | |
| 5088 if (sndcp_data->mg.cur_xid_block[sapi_index].v42.nsapis == 0) { | |
| 5089 sndcp_data->mg.cur_xid_block[sapi_index].v42.is_set = FALSE; | |
| 5090 } | |
| 5091 | |
| 5092 sig_mg_cia_new_xid(& sndcp_data->mg.cur_xid_block[sapi_index]); | |
| 5093 | |
| 5094 | |
| 5095 } /* mg_set_res_cur_xid_block */ | |
| 5096 | |
| 5097 /* | |
| 5098 +------------------------------------------------------------------------------ | |
| 5099 | Function : mg_set_res_xid_params | |
| 5100 +------------------------------------------------------------------------------ | |
| 5101 | Description : This procedure fills the XID block. It is implementation | |
| 5102 | dependent. In the current version V42bis and VanJacobson | |
| 5103 | header compression are applied. | |
| 5104 | | |
| 5105 | Parameters : | |
| 5106 | the sdu that will be filled, | |
| 5107 | Post : Reset arrays with reject information to all FALSE. | |
| 5108 | | |
| 5109 +------------------------------------------------------------------------------ | |
| 5110 */ | |
| 5111 GLOBAL void mg_set_res_xid_params (T_sdu* sdu, UBYTE sapi) | |
| 5112 { | |
| 5113 /* | |
| 5114 * Byte index in destination sdu. | |
| 5115 */ | |
| 5116 UBYTE index = 3; | |
| 5117 UBYTE type_2_header_index = 0; | |
| 5118 UBYTE sapi_index = 0; | |
| 5119 UBYTE ntt = 0; | |
| 5120 BOOL type_1_header_set = FALSE; | |
| 5121 BOOL type_2_header_set = FALSE; | |
| 5122 TRACE_FUNCTION( "mg_set_res_xid_params" ); | |
| 5123 sndcp_get_sapi_index(sapi, &sapi_index); | |
| 5124 /* | |
| 5125 * Set the values for parameter type 0 (version number). | |
| 5126 */ | |
| 5127 sdu->buf[0] = SNDCP_XID_PARAM_TYPE_0; | |
| 5128 /*lint -e{415} (Warning -- access of out-of-bounds pointer)*/ | |
| 5129 sdu->buf[1] = SNDCP_XID_0_LEN; | |
| 5130 /*lint -e{415, 416} (Warning -- access/creation of out-of-bounds pointer)*/ | |
| 5131 sdu->buf[2] = | |
| 5132 sndcp_data->mg.res_xid_block[sapi_index].version; | |
| 5133 | |
| 5134 sdu->l_buf = 3 * 8; | |
| 5135 sdu->o_buf = 0; | |
| 5136 /* | |
| 5137 * Set the values for data compression, if necessary. | |
| 5138 */ | |
| 5139 /*lint -e{415, 416} (Warning -- access/creation of out-of-bounds pointer)*/ | |
| 5140 if (sndcp_data->mg.res_xid_block[sapi_index].v42.is_set) { | |
| 5141 sdu->buf[3] = SNDCP_XID_PARAM_TYPE_1; | |
| 5142 sdu->buf[4] = SNDCP_XID_1_LEN_RES; | |
| 5143 sdu->buf[5] = | |
| 5144 (UBYTE)(sndcp_data->mg.res_xid_block[sapi_index].v42.p_bit << 7) + | |
| 5145 sndcp_data->mg.res_xid_block[sapi_index].v42.ntt; | |
| 5146 sdu->buf[6] = SNDCP_XID_V42_LEN_RES; | |
| 5147 sdu->buf[7] = | |
| 5148 (UBYTE)(sndcp_data->mg.res_xid_block[sapi_index].v42.nsapis >> 8); | |
| 5149 sdu->buf[8] = | |
| 5150 (UBYTE)(sndcp_data->mg.res_xid_block[sapi_index].v42.nsapis & 0xff); | |
| 5151 sdu->buf[9] = sndcp_data->mg.res_xid_block[sapi_index].v42.p0; | |
| 5152 sdu->buf[10] = | |
| 5153 (UBYTE)(sndcp_data->mg.res_xid_block[sapi_index].v42.p1 >> 8); | |
| 5154 sdu->buf[11] = | |
| 5155 (UBYTE)(sndcp_data->mg.res_xid_block[sapi_index].v42.p1 & 0xff); | |
| 5156 sdu->buf[12] = sndcp_data->mg.res_xid_block[sapi_index].v42.p2; | |
| 5157 | |
| 5158 index = 13; | |
| 5159 sdu->l_buf = 13 * 8; | |
| 5160 | |
| 5161 type_1_header_set = TRUE; | |
| 5162 } | |
| 5163 /* | |
| 5164 * Add rejected data compression entities. | |
| 5165 */ | |
| 5166 for (ntt = 0; ntt < MG_MAX_ENTITIES; ntt++) { | |
| 5167 BOOL rej = FALSE; | |
| 5168 mg_get_sapi_dntt_rej(sapi, ntt, &rej); | |
| 5169 /*lint -e{661, 662} (Warning -- Possible access/creation of out-of-bounds pointer)*/ | |
| 5170 if (rej) { | |
| 5171 if (! type_1_header_set) { | |
| 5172 sdu->buf[index] = SNDCP_XID_PARAM_TYPE_1; | |
| 5173 index++; | |
| 5174 sdu->buf[index] = 0; | |
| 5175 index++; | |
| 5176 type_1_header_set = TRUE; | |
| 5177 sdu->l_buf += 16; | |
| 5178 } | |
| 5179 | |
| 5180 sdu->buf[index] = ntt; | |
| 5181 index++; | |
| 5182 /* | |
| 5183 * Length of field. | |
| 5184 */ | |
| 5185 sdu->buf[index] = 2; | |
| 5186 index++; | |
| 5187 /* | |
| 5188 * Set 2 'nsapis' octets to 0. | |
| 5189 */ | |
| 5190 sdu->buf[index] = 0; | |
| 5191 index++; | |
| 5192 sdu->buf[index] = 0; | |
| 5193 index++; | |
| 5194 /* | |
| 5195 * Increment sdu length. | |
| 5196 */ | |
| 5197 sdu->l_buf = sdu->l_buf + 32; | |
| 5198 /* | |
| 5199 * Increment parameter type 1 length octet. | |
| 5200 */ | |
| 5201 /*lint -e{415, 416} (Warning -- access/creation of out-of-bounds pointer)*/ | |
| 5202 sdu->buf[4] += 4; | |
| 5203 } | |
| 5204 } | |
| 5205 type_2_header_index = index; | |
| 5206 | |
| 5207 /* | |
| 5208 * Set the values for header compression, if requested. | |
| 5209 */ | |
| 5210 /*lint -e{661, 662} (Warning -- Possible access/creation of out-of-bounds pointer)*/ | |
| 5211 if (sndcp_data->mg.res_xid_block[sapi_index].vj.is_set) { | |
| 5212 sdu->buf[index] = SNDCP_XID_PARAM_TYPE_2; | |
| 5213 index++; | |
| 5214 sdu->buf[index] = SNDCP_XID_2_LEN_RES; | |
| 5215 index++; | |
| 5216 sdu->buf[index] = | |
| 5217 (UBYTE)(sndcp_data->mg.res_xid_block[sapi_index].vj.p_bit << 7) + | |
| 5218 sndcp_data->mg.res_xid_block[sapi_index].vj.ntt; | |
| 5219 index++; | |
| 5220 sdu->buf[index] = SNDCP_XID_VJ_LEN_RES; | |
| 5221 index++; | |
| 5222 sdu->buf[index] = | |
| 5223 (UBYTE)(sndcp_data->mg.res_xid_block[sapi_index].vj.nsapis >> 8); | |
| 5224 index++; | |
| 5225 sdu->buf[index] = | |
| 5226 (UBYTE)(sndcp_data->mg.res_xid_block[sapi_index].vj.nsapis & 0xff); | |
| 5227 index++; | |
| 5228 sdu->buf[index] = | |
| 5229 sndcp_data->mg.res_xid_block[sapi_index].vj.s0_m_1; | |
| 5230 index++; | |
| 5231 | |
| 5232 sdu->l_buf = sdu->l_buf + 7 * 8; | |
| 5233 | |
| 5234 type_2_header_set = TRUE; | |
| 5235 } | |
| 5236 /* | |
| 5237 * Add rejected header compression entities. | |
| 5238 */ | |
| 5239 /*lint -e{661, 662} (Warning -- Possible access/creation of out-of-bounds pointer)*/ | |
| 5240 for (ntt = 0; ntt < MG_MAX_ENTITIES; ntt++) { | |
| 5241 BOOL rej = FALSE; | |
| 5242 mg_get_sapi_pntt_rej(sapi, ntt, &rej); | |
| 5243 if (rej) { | |
| 5244 if (! type_2_header_set) { | |
| 5245 sdu->buf[index] = SNDCP_XID_PARAM_TYPE_2; | |
| 5246 index++; | |
| 5247 sdu->buf[index] = 0; | |
| 5248 index++; | |
| 5249 type_2_header_set = TRUE; | |
| 5250 sdu->l_buf += 16; | |
| 5251 } | |
| 5252 sdu->buf[index] = ntt; | |
| 5253 index++; | |
| 5254 /* | |
| 5255 * Length of field. | |
| 5256 */ | |
| 5257 sdu->buf[index] = 2; | |
| 5258 index++; | |
| 5259 /* | |
| 5260 * Set 2 'nsapis' octets to 0. | |
| 5261 */ | |
| 5262 sdu->buf[index] = 0; | |
| 5263 index++; | |
| 5264 sdu->buf[index] = 0; | |
| 5265 index++; | |
| 5266 /* | |
| 5267 * Increment sdu length. | |
| 5268 */ | |
| 5269 sdu->l_buf = sdu->l_buf + 32; | |
| 5270 /* | |
| 5271 * Increment parameter type 2 length octet. | |
| 5272 */ | |
| 5273 sdu->buf[type_2_header_index + 1] += 4; | |
| 5274 } | |
| 5275 } | |
| 5276 /* | |
| 5277 * Set sdu offset to 0. | |
| 5278 */ | |
| 5279 sdu->o_buf = 0; | |
| 5280 /* | |
| 5281 * Reset the arrays with rejected params to all FALSE. | |
| 5282 */ | |
| 5283 for (ntt = 0; ntt < MG_MAX_ENTITIES; ntt++) { | |
| 5284 sndcp_data->mg.sapi_dntt_rej_ra[sapi_index][ntt] = FALSE; | |
| 5285 sndcp_data->mg.sapi_pntt_rej_ra[sapi_index][ntt] = FALSE; | |
| 5286 } | |
| 5287 | |
| 5288 } /* mg_set_res_xid_params() */ | |
| 5289 | |
| 5290 | |
| 5291 /* | |
| 5292 +------------------------------------------------------------------------------ | |
| 5293 | Function : mg_set_xid_params | |
| 5294 +------------------------------------------------------------------------------ | |
| 5295 | Description : This procedure fills the XID block. It is implementation | |
| 5296 | dependent. In the current version V42bis and VanJacobson | |
| 5297 | header compression are applied. | |
| 5298 | | |
| 5299 | Parameters : | |
| 5300 | sapi and sdu from the LL_XID_REQ that will be filled and | |
| 5301 | xid_block that defines the desired compressors | |
| 5302 | | |
| 5303 +------------------------------------------------------------------------------ | |
| 5304 */ | |
| 5305 GLOBAL void mg_set_xid_params (UBYTE sapi, T_sdu* sdu, T_XID_BLOCK xid_block) | |
| 5306 { | |
| 5307 /* | |
| 5308 * Byte index in destination sdu. | |
| 5309 */ | |
| 5310 UBYTE index = 3; | |
| 5311 UBYTE sapi_index = 0; | |
| 5312 UBYTE ntt = 0; | |
| 5313 BOOL type_1_header_set = FALSE; | |
| 5314 BOOL type_2_header_set = FALSE; | |
| 5315 UBYTE type_2_header_index = 0; | |
| 5316 UBYTE type_1_header_index = 3; | |
| 5317 USHORT p1 = SNDCP_V42_DEFAULT_P1; | |
| 5318 TRACE_FUNCTION( "mg_set_xid_params" ); | |
| 5319 sndcp_get_sapi_index(sapi, &sapi_index); | |
| 5320 /* | |
| 5321 * Set the values for parameter type 0 (version number). | |
| 5322 */ | |
| 5323 sdu->buf[0] = SNDCP_XID_PARAM_TYPE_0; | |
| 5324 /*lint -e{415} (Warning -- access of out-of-bounds pointer)*/ | |
| 5325 sdu->buf[1] = SNDCP_XID_0_LEN; | |
| 5326 /*lint -e{415, 416} (Warning -- access/creation of out-of-bounds pointer)*/ | |
| 5327 sdu->buf[2] = SNDCP_XID_VERSION; | |
| 5328 | |
| 5329 sdu->l_buf = 24; /* 3 * 8 */ | |
| 5330 sdu->o_buf = 0; | |
| 5331 /* | |
| 5332 * Set the values for data compression, if necessary. | |
| 5333 */ | |
| 5334 /*lint -e{415, 416} (Warning -- access/creation of out-of-bounds pointer)*/ | |
| 5335 if (xid_block.v42.is_set && | |
| 5336 #ifdef SNDCP_UPM_INCLUDED | |
| 5337 xid_block.v42.p0 != NAS_DCOMP_OFF && | |
| 5338 #else | |
| 5339 xid_block.v42.p0 != SNSM_COMP_NEITHER_DIRECT && | |
| 5340 #endif /*#ifdef SNDCP_UPM_INCLUDED*/ | |
| 5341 xid_block.v42.nsapis_set && | |
| 5342 xid_block.v42.nsapis > 0) { | |
| 5343 | |
| 5344 if (xid_block.v42.p_bit > 0) { | |
| 5345 sdu->buf[3] = SNDCP_XID_PARAM_TYPE_1; | |
| 5346 sdu->buf[4] = SNDCP_XID_1_LEN; | |
| 5347 sdu->buf[5] = (UBYTE)(xid_block.v42.p_bit << 7) + xid_block.v42.ntt; | |
| 5348 sdu->buf[6] = xid_block.v42.algo_type; | |
| 5349 sdu->buf[7] = SNDCP_XID_V42_LEN; | |
| 5350 sdu->buf[8] = (UBYTE)(xid_block.v42.dcomp << 4); | |
| 5351 sdu->buf[9] = (UBYTE)(xid_block.v42.nsapis >> 8); | |
| 5352 sdu->buf[10] = (UBYTE)(xid_block.v42.nsapis & 0xff); | |
| 5353 sdu->buf[11] = xid_block.v42.p0; | |
| 5354 /* | |
| 5355 * P1, P2 | |
| 5356 */ | |
| 5357 sdu->buf[12] = (p1 & 0xff00) >> 8; | |
| 5358 sdu->buf[13] = p1 & 0x00ff; | |
| 5359 sdu->buf[14] = SNDCP_V42_DEFAULT_P2; | |
| 5360 | |
| 5361 index = 15; | |
| 5362 sdu->l_buf = 15 * 8; | |
| 5363 } else { | |
| 5364 sdu->buf[3] = SNDCP_XID_PARAM_TYPE_1; | |
| 5365 sdu->buf[4] = SNDCP_XID_1_LEN_RES; | |
| 5366 sdu->buf[5] = xid_block.v42.ntt; | |
| 5367 sdu->buf[6] = SNDCP_XID_V42_LEN_RES; | |
| 5368 sdu->buf[7] = (UBYTE)(xid_block.v42.nsapis >> 8); | |
| 5369 sdu->buf[8] = (UBYTE)(xid_block.v42.nsapis & 0xff); | |
| 5370 sdu->buf[9] = xid_block.v42.p0; | |
| 5371 /* | |
| 5372 * P1, P2 | |
| 5373 */ | |
| 5374 sdu->buf[10] = (p1 & 0xff00) >> 8; | |
| 5375 sdu->buf[11] = p1 & 0x00ff; | |
| 5376 sdu->buf[12] = SNDCP_V42_DEFAULT_P2; | |
| 5377 | |
| 5378 index = 13; | |
| 5379 sdu->l_buf = 13 * 8; | |
| 5380 | |
| 5381 } | |
| 5382 } | |
| 5383 type_2_header_index = index; | |
| 5384 /* | |
| 5385 * Set the values for header compression, if requested. | |
| 5386 */ | |
| 5387 /*lint -e{661, 662} (Warning -- Possible access/creation of out-of-bounds pointer)*/ | |
| 5388 if (xid_block.vj.is_set && | |
| 5389 #ifdef SNDCP_UPM_INCLUDED | |
| 5390 xid_block.vj.direction != NAS_HCOMP_OFF && | |
| 5391 #else | |
| 5392 xid_block.vj.direction != SNSM_COMP_NEITHER_DIRECT && | |
| 5393 #endif /*#ifdef SNDCP_UPM_INCLUDED*/ | |
| 5394 xid_block.vj.nsapis_set && | |
| 5395 xid_block.vj.nsapis > 0) { | |
| 5396 | |
| 5397 if (xid_block.vj.p_bit > 0) { | |
| 5398 | |
| 5399 sdu->buf[index] = SNDCP_XID_PARAM_TYPE_2; | |
| 5400 sdu->buf[index + 1] = SNDCP_XID_2_LEN; | |
| 5401 sdu->buf[index + 2] = | |
| 5402 (UBYTE)(xid_block.vj.p_bit << 7) + xid_block.vj.ntt; | |
| 5403 sdu->buf[index + 3] = SNDCP_XID_VJ; | |
| 5404 sdu->buf[index + 4] = SNDCP_XID_VJ_LEN; | |
| 5405 sdu->buf[index + 5] = | |
| 5406 (UBYTE)(xid_block.vj.pcomp1 << 4) + xid_block.vj.pcomp2; | |
| 5407 sdu->buf[index + 6] = | |
| 5408 (UBYTE)(xid_block.vj.nsapis >> 8); | |
| 5409 sdu->buf[index + 7] = | |
| 5410 (UBYTE)(xid_block.vj.nsapis & 0xff); | |
| 5411 sdu->buf[index + 8] = xid_block.vj.s0_m_1; | |
| 5412 | |
| 5413 sdu->l_buf = sdu->l_buf + 9 * 8; | |
| 5414 | |
| 5415 type_2_header_set = TRUE; | |
| 5416 } else { | |
| 5417 sdu->buf[index] = SNDCP_XID_PARAM_TYPE_2; | |
| 5418 sdu->buf[index + 1] = SNDCP_XID_2_LEN_RES; | |
| 5419 sdu->buf[index + 2] = xid_block.vj.ntt; | |
| 5420 | |
| 5421 sdu->buf[index + 3] = SNDCP_XID_VJ_LEN_RES; | |
| 5422 | |
| 5423 sdu->buf[index + 4] = | |
| 5424 (UBYTE)(xid_block.vj.nsapis >> 8); | |
| 5425 sdu->buf[index + 5] = | |
| 5426 (UBYTE)(xid_block.vj.nsapis & 0xff); | |
| 5427 sdu->buf[index + 6] = xid_block.vj.s0_m_1; | |
| 5428 | |
| 5429 sdu->l_buf = sdu->l_buf + 7 * 8; | |
| 5430 | |
| 5431 type_2_header_set = TRUE; | |
| 5432 } | |
| 5433 } | |
| 5434 /* | |
| 5435 * Add rejected data compression entities. | |
| 5436 */ | |
| 5437 /*lint -e{661, 662} (Warning -- Possible access/creation of out-of-bounds pointer)*/ | |
| 5438 for (ntt = 0; ntt < MG_MAX_ENTITIES; ntt++) { | |
| 5439 BOOL rej = FALSE; | |
| 5440 mg_get_sapi_dntt_rej(sapi, ntt, &rej); | |
| 5441 if (rej) { | |
| 5442 if (! type_1_header_set) { | |
| 5443 sdu->buf[index] = SNDCP_XID_PARAM_TYPE_1; | |
| 5444 index++; | |
| 5445 sdu->buf[index] = 0; | |
| 5446 index++; | |
| 5447 type_1_header_set = TRUE; | |
| 5448 sdu->l_buf += 16; | |
| 5449 } | |
| 5450 sdu->buf[index] = ntt; | |
| 5451 index++; | |
| 5452 /* | |
| 5453 * Length of field. | |
| 5454 */ | |
| 5455 sdu->buf[index] = 2; | |
| 5456 index++; | |
| 5457 /* | |
| 5458 * Set 2 'nsapis' octets to 0. | |
| 5459 */ | |
| 5460 sdu->buf[index] = 0; | |
| 5461 index++; | |
| 5462 sdu->buf[index] = 0; | |
| 5463 index++; | |
| 5464 /* | |
| 5465 * Increment sdu length. | |
| 5466 */ | |
| 5467 sdu->l_buf = sdu->l_buf + 32; | |
| 5468 /* | |
| 5469 * Increment parameter type 2 length octet. | |
| 5470 */ | |
| 5471 /*lint -e{415, 416} (Warning -- access/creation of out-of-bounds pointer)*/ | |
| 5472 sdu->buf[type_1_header_index + 1] += 4; | |
| 5473 } | |
| 5474 } /* for (ntt = 0; ntt < MG_MAX_ENTITIES; ntt++) */ | |
| 5475 /* | |
| 5476 * Add rejected header compression entities. | |
| 5477 */ | |
| 5478 /*lint -e{661, 662} (Warning -- Possible access/creation of out-of-bounds pointer)*/ | |
| 5479 for (ntt = 0; ntt < MG_MAX_ENTITIES; ntt++) { | |
| 5480 BOOL rej = FALSE; | |
| 5481 mg_get_sapi_pntt_rej(sapi, ntt, &rej); | |
| 5482 if (rej) { | |
| 5483 if (! type_2_header_set) { | |
| 5484 sdu->buf[index] = SNDCP_XID_PARAM_TYPE_2; | |
| 5485 index++; | |
| 5486 sdu->buf[index] = 0; | |
| 5487 index++; | |
| 5488 type_2_header_set = TRUE; | |
| 5489 sdu->l_buf += 16; | |
| 5490 } | |
| 5491 sdu->buf[index] = ntt; | |
| 5492 index++; | |
| 5493 /* | |
| 5494 * Length of field. | |
| 5495 */ | |
| 5496 sdu->buf[index] = 2; | |
| 5497 index++; | |
| 5498 /* | |
| 5499 * Set 2 'nsapis' octets to 0. | |
| 5500 */ | |
| 5501 sdu->buf[index] = 0; | |
| 5502 index++; | |
| 5503 sdu->buf[index] = 0; | |
| 5504 index++; | |
| 5505 /* | |
| 5506 * Increment sdu length. | |
| 5507 */ | |
| 5508 sdu->l_buf = sdu->l_buf + 32; | |
| 5509 /* | |
| 5510 * Increment parameter type 2 length octet. | |
| 5511 */ | |
| 5512 sdu->buf[type_2_header_index + 1] += 4; | |
| 5513 } | |
| 5514 } /* for (ntt = 0; ntt < MG_MAX_ENTITIES; ntt++) */ | |
| 5515 /* | |
| 5516 * Set sdu offset to 0. | |
| 5517 */ | |
| 5518 sdu->o_buf = 0; | |
| 5519 /* | |
| 5520 * Reset the arrays with rejected params to all FALSE. | |
| 5521 */ | |
| 5522 for (ntt = 0; ntt < MG_MAX_ENTITIES; ntt++) { | |
| 5523 sndcp_data->mg.sapi_dntt_rej_ra[sapi_index][ntt] = FALSE; | |
| 5524 sndcp_data->mg.sapi_pntt_rej_ra[sapi_index][ntt] = FALSE; | |
| 5525 } | |
| 5526 | |
| 5527 } /* mg_set_xid_params() */ | |
| 5528 | |
| 5529 | |
| 5530 | |
| 5531 /* | |
| 5532 +------------------------------------------------------------------------------ | |
| 5533 | Function : mg_del_comp_pdus_ack | |
| 5534 +------------------------------------------------------------------------------ | |
| 5535 | Description : The function mg_del_comp_pdus_ack() | |
| 5536 | GSM 4.65, 5.1.2.7: | |
| 5537 | "compressed N-PDUs queuing to be forwarded to the affected | |
| 5538 | SAPI are deleted from the SNDCP layer." | |
| 5539 | Assumption: It is assumed here that acknowledged and | |
| 5540 | unacknowledged npdus are deleted the same. | |
| 5541 | | |
| 5542 | Parameters : UBYTE sapi: the affected sapi | |
| 5543 | | |
| 5544 +------------------------------------------------------------------------------ | |
| 5545 */ | |
| 5546 GLOBAL void mg_del_comp_pdus_ack (UBYTE sapi) | |
| 5547 { | |
| 5548 UBYTE nsapi = 0; | |
| 5549 | |
| 5550 TRACE_FUNCTION( "mg_del_comp_pdus_ack" ); | |
| 5551 | |
| 5552 for (nsapi = 0; nsapi < SNDCP_NUMBER_OF_NSAPIS; nsapi++) { | |
| 5553 UBYTE sp = 0; | |
| 5554 sndcp_get_nsapi_sapi(nsapi, &sp); | |
| 5555 if (sp == sapi) { | |
| 5556 sig_mg_cia_delete_npdus(nsapi); | |
| 5557 sig_mg_su_delete_pdus(nsapi, sapi); | |
| 5558 sig_mg_sua_delete_pdus(nsapi, sapi, TRUE); | |
| 5559 sig_mg_sd_delete_npdus(nsapi, sapi); | |
| 5560 sig_mg_sda_delete_npdus(nsapi, sapi); | |
| 5561 } | |
| 5562 } | |
| 5563 } /* mg_del_comp_pdus_ack() */ | |
| 5564 | |
| 5565 /* | |
| 5566 +------------------------------------------------------------------------------ | |
| 5567 | Function : mg_delete_npdus | |
| 5568 +------------------------------------------------------------------------------ | |
| 5569 | Description : The function mg_delete_npdus() sends signals to all affected | |
| 5570 | services to delete the buffered npdus. | |
| 5571 | | |
| 5572 | Parameters : UBYTE nsapi: the affected nsapi | |
| 5573 | | |
| 5574 +------------------------------------------------------------------------------ | |
| 5575 */ | |
| 5576 GLOBAL void mg_delete_npdus (UBYTE nsapi) | |
| 5577 { | |
| 5578 UBYTE sapi = 0; | |
| 5579 TRACE_FUNCTION( "mg_delete_npdus" ); | |
| 5580 sndcp_get_nsapi_sapi(nsapi, &sapi); | |
| 5581 | |
| 5582 sig_mg_cia_delete_npdus(nsapi); | |
| 5583 sig_mg_su_delete_pdus(nsapi, sapi); | |
| 5584 sig_mg_sua_delete_pdus(nsapi, sapi, TRUE); | |
| 5585 sig_mg_sd_delete_npdus(nsapi, sapi); | |
| 5586 sig_mg_sda_delete_npdus(nsapi, sapi); | |
| 5587 | |
| 5588 sig_mg_nu_delete_npdus(nsapi); | |
| 5589 | |
| 5590 } /* mg_delete_npdus() */ | |
| 5591 | |
| 5592 | |
| 5593 /* | |
| 5594 +------------------------------------------------------------------------------ | |
| 5595 | Function : mg_suspend_affected_nus | |
| 5596 +------------------------------------------------------------------------------ | |
| 5597 | Description : Suspends all nu service instances affected by XID negotiation | |
| 5598 | Sets service variable 'suspended_nsapis'. | |
| 5599 | | |
| 5600 | Parameters : sapi | |
| 5601 | | |
| 5602 +------------------------------------------------------------------------------ | |
| 5603 */ | |
| 5604 GLOBAL void mg_suspend_affected_nus (UBYTE sapi) { | |
| 5605 UBYTE nsapi = 0; | |
| 5606 UBYTE sapi_index = 0; | |
| 5607 TRACE_FUNCTION( "mg_resume_affected_nus" ); | |
| 5608 sndcp_get_sapi_index(sapi, &sapi_index); | |
| 5609 for (nsapi = 0; nsapi < SNDCP_NUMBER_OF_NSAPIS; nsapi++) { | |
| 5610 if (1 << nsapi & sndcp_data->mg.req_xid_block[sapi_index].vj.nsapis || | |
| 5611 1 << nsapi & sndcp_data->mg.cur_xid_block[sapi_index].vj.nsapis || | |
| 5612 1 << nsapi & sndcp_data->mg.req_xid_block[sapi_index].v42.nsapis || | |
| 5613 1 << nsapi & sndcp_data->mg.cur_xid_block[sapi_index].v42.nsapis) { | |
| 5614 | |
| 5615 sndcp_data->mg.suspended_nsapis |= (1 << nsapi); | |
| 5616 sig_mg_nu_suspend(nsapi); | |
| 5617 } | |
| 5618 } | |
| 5619 } /* mg_suspend_affected_nus() */ | |
| 5620 | |
| 5621 | |
| 5622 | |
| 5623 | |
| 5624 | |
| 5625 | |
| 5626 /* | |
| 5627 * Getters and setters for the organizing arrays. | |
| 5628 */ | |
| 5629 /* | |
| 5630 +------------------------------------------------------------------------------ | |
| 5631 | Function : mg_get_sapi_dntt_rej | |
| 5632 +------------------------------------------------------------------------------ | |
| 5633 | Description : The procedures informs about if a given data | |
| 5634 | compression entity on a given SAPI is to be rejected in | |
| 5635 | LL_XID_REQ because it cannot be set up. | |
| 5636 | | |
| 5637 | Parameters : FPAR IN sapi UBYTE, | |
| 5638 | IN dntt UBYTE, | |
| 5639 | IN/OUT rej BOOL | |
| 5640 | | |
| 5641 +------------------------------------------------------------------------------ | |
| 5642 */ | |
| 5643 GLOBAL void mg_get_sapi_dntt_rej (UBYTE sapi, UBYTE dntt, BOOL* rej) | |
| 5644 { | |
| 5645 TRACE_FUNCTION( "mg_get_sapi_dntt_rej" ); | |
| 5646 { | |
| 5647 UBYTE sapi_index = 0; | |
| 5648 sndcp_get_sapi_index(sapi, &sapi_index); | |
| 5649 *rej = sndcp_data->mg.sapi_dntt_rej_ra[sapi_index][dntt]; | |
| 5650 } | |
| 5651 } /* mg_get_sapi_dntt_rej() */ | |
| 5652 | |
| 5653 /* | |
| 5654 +------------------------------------------------------------------------------ | |
| 5655 | Function : mg_get_sapi_pntt_rej | |
| 5656 +------------------------------------------------------------------------------ | |
| 5657 | Description : The procedures informs about if a given header | |
| 5658 | compression entity on a given SAPI is to be rejected in | |
| 5659 | LL_XID_REQ because it cannot be set up. | |
| 5660 | | |
| 5661 | Parameters : FPAR IN sapi UBYTE, | |
| 5662 | IN pntt UBYTE, | |
| 5663 | IN/OUT rej BOOL | |
| 5664 | | |
| 5665 +------------------------------------------------------------------------------ | |
| 5666 */ | |
| 5667 GLOBAL void mg_get_sapi_pntt_rej (UBYTE sapi, UBYTE pntt, BOOL* rej) | |
| 5668 { | |
| 5669 TRACE_FUNCTION( "mg_get_sapi_pntt_rej" ); | |
| 5670 { | |
| 5671 UBYTE sapi_index = 0; | |
| 5672 sndcp_get_sapi_index(sapi, &sapi_index); | |
| 5673 *rej = sndcp_data->mg.sapi_pntt_rej_ra[sapi_index][pntt]; | |
| 5674 } | |
| 5675 } /* mg_get_sapi_pntt_rej() */ | |
| 5676 | |
| 5677 | |
| 5678 | |
| 5679 | |
| 5680 /* | |
| 5681 +------------------------------------------------------------------------------ | |
| 5682 | Function : mg_get_sapi_pntt_nsapi | |
| 5683 +------------------------------------------------------------------------------ | |
| 5684 | Description : The procedure informs if a given nsapi uses a given pntt on a | |
| 5685 | given sapi. | |
| 5686 | | |
| 5687 | Parameters : FPAR IN sapi UBYTE, | |
| 5688 | IN pntt UBYTE, | |
| 5689 | IN nsapi UBYTE, | |
| 5690 | IN/OUT used BOOL | |
| 5691 | | |
| 5692 +------------------------------------------------------------------------------ | |
| 5693 */ | |
| 5694 GLOBAL void mg_get_sapi_pntt_nsapi (UBYTE sapi, UBYTE pntt, UBYTE nsapi, BOOL* used) | |
| 5695 { | |
| 5696 TRACE_FUNCTION( "mg_get_sapi_pntt_nsapi" ); | |
| 5697 { | |
| 5698 UBYTE sapi_index = 0; | |
| 5699 sndcp_get_sapi_index(sapi, &sapi_index); | |
| 5700 *used = sndcp_data->mg.sapi_pntt_nsapi_set_ra[sapi_index][pntt][nsapi]; | |
| 5701 } | |
| 5702 } /* mg_get_sapi_pntt_nsapi() */ | |
| 5703 | |
| 5704 | |
| 5705 | |
| 5706 | |
| 5707 /* | |
| 5708 +------------------------------------------------------------------------------ | |
| 5709 | Function : mg_get_sapi_pcomp_pntt | |
| 5710 +------------------------------------------------------------------------------ | |
| 5711 | Description : The procedures indicates the pntt assigned to a given pcomp | |
| 5712 | for a given sapi. | |
| 5713 | | |
| 5714 | Parameters : FPAR IN sapi UBYTE, | |
| 5715 | IN pcomp UBYTE, | |
| 5716 | IN/OUT dntt UBYTE | |
| 5717 | | |
| 5718 +------------------------------------------------------------------------------ | |
| 5719 */ | |
| 5720 GLOBAL void mg_get_sapi_pcomp_pntt (UBYTE sapi, UBYTE pcomp, UBYTE* pntt) | |
| 5721 { | |
| 5722 TRACE_FUNCTION( "mg_get_sapi_pcomp_pntt" ); | |
| 5723 { | |
| 5724 UBYTE sapi_index = 0; | |
| 5725 sndcp_get_sapi_index(sapi, &sapi_index); | |
| 5726 *pntt = sndcp_data->mg.sapi_pcomp_pntt_ra[sapi_index][pcomp]; | |
| 5727 } | |
| 5728 } /* mg_get_sapi_pcomp_pntt() */ | |
| 5729 | |
| 5730 | |
| 5731 | |
| 5732 /* | |
| 5733 +------------------------------------------------------------------------------ | |
| 5734 | Function : mg_xid_cnf_ok_res | |
| 5735 +------------------------------------------------------------------------------ | |
| 5736 | Description : | |
| 5737 | After an LL_XID_REQ has been sent there are contexts in state MG_XID. | |
| 5738 | These are now reset after reception of the LL_XID_CNF. | |
| 5739 | The "applicable nsapis" in req_xid_block.v42 and req_xid_block.vj, each one | |
| 5740 | only once. | |
| 5741 | SIG_MG_NU_RESET(nsapi, discard_ready) is used. | |
| 5742 | In every nu instance: N-PDU number is set to 0 for this instance and an | |
| 5743 | SN_UNITREADY_IND is sent. State is set to NU_UNACK_SU_RECEPTIVE | |
| 5744 | Then the SNSM_ACTIVATE_RES is sent for each one of these. | |
| 5745 | | |
| 5746 | Parameters : affected sapi | |
| 5747 | | |
| 5748 +------------------------------------------------------------------------------ | |
| 5749 */ | |
| 5750 GLOBAL void mg_xid_cnf_ok_res (UBYTE sapi) | |
| 5751 { | |
| 5752 UBYTE nsapi = 0; | |
| 5753 | |
| 5754 TRACE_FUNCTION( "mg_xid_cnf_ok_res" ); | |
| 5755 for (nsapi = 0; nsapi < SNDCP_NUMBER_OF_NSAPIS; nsapi++) { | |
| 5756 USHORT nsapi_state = MG_IDLE; | |
| 5757 USHORT sapi_state = MG_IDLE; | |
| 5758 UBYTE sapi_index = 0; | |
| 5759 UBYTE func_sapi = 0; | |
| 5760 sndcp_get_nsapi_sapi(nsapi, &func_sapi); | |
| 5761 if (func_sapi != sapi) { | |
| 5762 continue; | |
| 5763 } | |
| 5764 sndcp_get_sapi_index(sapi, &sapi_index); | |
| 5765 sndcp_get_nsapi_state(nsapi, &nsapi_state); | |
| 5766 sndcp_get_sapi_state(func_sapi, &sapi_state); | |
| 5767 | |
| 5768 | |
| 5769 if (((sapi_state & MG_XID_NEC) > 0) | |
| 5770 && | |
| 5771 ((sapi_state & MG_REL) == 0)) { | |
| 5772 mg_resend_xid_if_nec(sapi); | |
| 5773 | |
| 5774 sndcp_get_sapi_state(func_sapi, &sapi_state); | |
| 5775 /* | |
| 5776 * If now XID is sent, no further actions for this nsapi. | |
| 5777 */ | |
| 5778 if ((sapi_state & MG_XID) > 0) { | |
| 5779 continue; | |
| 5780 } | |
| 5781 | |
| 5782 } else if ((nsapi_state & MG_ACT) > 0 && | |
| 5783 (sapi_state & MG_EST) == 0) { | |
| 5784 | |
| 5785 BOOL ack = FALSE; | |
| 5786 | |
| 5787 sndcp_get_nsapi_ack(nsapi, &ack); | |
| 5788 /* | |
| 5789 * Open DTI connection. | |
| 5790 */ | |
| 5791 #ifndef SNDCP_UPM_INCLUDED | |
| 5792 mg_dti_open(nsapi); | |
| 5793 #endif | |
| 5794 if (ack) { | |
| 5795 sig_mg_nu_reset_ack(nsapi, 0, 0, FALSE); | |
| 5796 sig_mg_sda_getdata(sapi, nsapi); | |
| 5797 } else { | |
| 5798 sig_mg_nu_reset(nsapi, FALSE); | |
| 5799 sig_mg_sd_getunitdata(sapi, nsapi); | |
| 5800 } | |
| 5801 | |
| 5802 if ((sapi_state & MG_XID) == 0) { | |
| 5803 mg_send_snsm_activate_res(nsapi); | |
| 5804 /* | |
| 5805 * Set nsapi state to MG_IDLE. | |
| 5806 */ | |
| 5807 sndcp_unset_nsapi_state(nsapi, MG_ACT); | |
| 5808 } | |
| 5809 } /* if state is MG_ACT and not MG_EST */ | |
| 5810 | |
| 5811 if ((nsapi_state & MG_DEACT) > 0) { | |
| 5812 | |
| 5813 USHORT local_sapi_state = MG_IDLE; | |
| 5814 | |
| 5815 sndcp_get_sapi_state(sapi, &local_sapi_state); | |
| 5816 | |
| 5817 if ((local_sapi_state & | |
| 5818 (MG_REL_NEC_LOC + MG_REL_NEC_PEER + MG_XID_NEC + MG_XID)) | |
| 5819 == 0) | |
| 5820 { | |
| 5821 /* | |
| 5822 * No LL_RELEASE_REQ necessary. Notify sndcp. | |
| 5823 */ | |
| 5824 #ifdef SNDCP_UPM_INCLUDED | |
| 5825 PALLOC(snsm_deactivate_res, SN_DEACTIVATE_CNF); | |
| 5826 #else | |
| 5827 PALLOC(snsm_deactivate_res, SNSM_DEACTIVATE_RES); | |
| 5828 #endif /*#ifdef SNDCP_UPM_INCLUDED*/ | |
| 5829 /* | |
| 5830 * Now the NSAPI is not in use anymore: | |
| 5831 */ | |
| 5832 sndcp_set_nsapi_used(nsapi, FALSE); | |
| 5833 sndcp_set_nsapi_ack(nsapi, FALSE); | |
| 5834 | |
| 5835 snsm_deactivate_res->nsapi = nsapi; | |
| 5836 sndcp_unset_nsapi_state(nsapi, MG_DEACT); | |
| 5837 #ifdef SNDCP_UPM_INCLUDED | |
| 5838 PSEND(hCommUPM, snsm_deactivate_res); | |
| 5839 #else | |
| 5840 PSEND(hCommSM, snsm_deactivate_res); | |
| 5841 #endif /*#ifdef SNDCP_UPM_INCLUDED*/ | |
| 5842 /* | |
| 5843 * Resume nsapi. | |
| 5844 */ | |
| 5845 mg_resume_affected_nus(sapi); | |
| 5846 | |
| 5847 } else if ((local_sapi_state & (MG_REL_NEC_LOC + MG_REL_NEC_PEER)) > 0) { | |
| 5848 /* | |
| 5849 * LL_RELEASE_REQ must be sent. | |
| 5850 */ | |
| 5851 | |
| 5852 PALLOC(ll_release_req, LL_RELEASE_REQ); | |
| 5853 | |
| 5854 sndcp_unset_sapi_state(sapi, MG_REL_NEC_LOC); | |
| 5855 ll_release_req->sapi = sapi; | |
| 5856 ll_release_req->local = TRUE; | |
| 5857 /* | |
| 5858 * Set the "state" for the affected and sapi to MG_REL_PENDING. | |
| 5859 */ | |
| 5860 sndcp_set_sapi_state(sapi, MG_REL); | |
| 5861 | |
| 5862 PSEND(hCommLLC, ll_release_req); | |
| 5863 } else { | |
| 5864 | |
| 5865 UBYTE local_sapi = 0; | |
| 5866 UBYTE local_nsapi = 0; | |
| 5867 BOOL local_nec = FALSE; | |
| 5868 for (local_nsapi = 0; | |
| 5869 local_nsapi < SNDCP_NUMBER_OF_NSAPIS; | |
| 5870 local_nsapi++) { | |
| 5871 | |
| 5872 sndcp_get_nsapi_sapi(local_nsapi, &local_sapi); | |
| 5873 if (sapi == local_sapi) { | |
| 5874 /* | |
| 5875 * is compressor deactivation necessary? | |
| 5876 */ | |
| 5877 sndcp_get_nsapi_state(local_nsapi, &nsapi_state); | |
| 5878 if ((nsapi_state & MG_DEACT) > 0) { | |
| 5879 mg_is_rel_comp_nec(local_nsapi, &local_nec); | |
| 5880 } | |
| 5881 } | |
| 5882 } | |
| 5883 | |
| 5884 /* | |
| 5885 * Negotiate possible deactivation of compressors. | |
| 5886 */ | |
| 5887 if (local_nec) { | |
| 5888 mg_send_xid_req_del(sapi); | |
| 5889 } | |
| 5890 } | |
| 5891 | |
| 5892 } | |
| 5893 | |
| 5894 } | |
| 5895 | |
| 5896 } /* mg_xid_cnf_ok_res */ | |
| 5897 | |
| 5898 | |
| 5899 #ifdef TI_DUAL_MODE | |
| 5900 /* | |
| 5901 +------------------------------------------------------------------------------ | |
| 5902 | Function : mg_get_unsent_unconfirmed_npdus | |
| 5903 +------------------------------------------------------------------------------ | |
| 5904 | Description : This procedure retrieves any unsent or unconfirmed acknowledged | |
| 5905 | NPDU from SNDCP's internal buffers. ANY retrieved NPDU is packed | |
| 5906 | the primitive SN_GET_PENDING_PDU_CNF data. | |
| 5907 | | |
| 5908 | Parameters : nsapi, pointer to the primitive. | |
| 5909 | | |
| 5910 +------------------------------------------------------------------------------ | |
| 5911 */ | |
| 5912 GLOBAL T_SN_GET_PENDING_PDU_CNF* mg_get_unsent_unconfirmed_npdus | |
| 5913 (U8 nsapi, | |
| 5914 T_SN_GET_PENDING_PDU_CNF* sn_get_pending_pdu_cnf) | |
| 5915 { | |
| 5916 | |
| 5917 int count = 0; | |
| 5918 U8 used_sapi=0, sapi_index=0; | |
| 5919 T_NPDU_BUFFER* help = NULL; | |
| 5920 | |
| 5921 TRACE_FUNCTION( "mg_get_unsent_unconfirmed_npdus" ); | |
| 5922 | |
| 5923 /* | |
| 5924 * set service instance according to nsapi in primitive | |
| 5925 */ | |
| 5926 sndcp_data->nu = & sndcp_data->nu_base[nsapi]; | |
| 5927 | |
| 5928 /* | |
| 5929 * Find number of unconfirmed NPDUs | |
| 5930 */ | |
| 5931 help = sndcp_data->nu->first_buffered_npdu; | |
| 5932 while(help != NULL) | |
| 5933 { | |
| 5934 count++; | |
| 5935 help = help->next; | |
| 5936 } | |
| 5937 | |
| 5938 sn_get_pending_pdu_cnf->ul_pdus[nsapi].ptr_desc_list2 = | |
| 5939 (T_SN_desc_list2*)DRP_ALLOC( count * sizeof( T_SN_desc_list2 ), 0 ); | |
| 5940 | |
| 5941 sn_get_pending_pdu_cnf->ul_pdus[nsapi].nsapi = nsapi; | |
| 5942 sn_get_pending_pdu_cnf->ul_pdus[nsapi].dl_sequence_number = | |
| 5943 sndcp_data->nu->rec_npdu_number_ack; | |
| 5944 sn_get_pending_pdu_cnf->ul_pdus[nsapi].c_desc_list2 = count; | |
| 5945 | |
| 5946 count = 0; | |
| 5947 | |
| 5948 /* | |
| 5949 * Check if there are buffered any acknowledged type NPDUs. | |
| 5950 */ | |
| 5951 help = sndcp_data->nu->first_buffered_npdu; | |
| 5952 while(help != NULL) | |
| 5953 { | |
| 5954 | |
| 5955 sn_get_pending_pdu_cnf->ul_pdus[nsapi].ptr_desc_list2[count].first = | |
| 5956 help->sn_data_req->desc_list2.first; | |
| 5957 sn_get_pending_pdu_cnf->ul_pdus[nsapi].ptr_desc_list2[count].list_len = | |
| 5958 help->sn_data_req->desc_list2.list_len; | |
| 5959 count++; | |
| 5960 help = help->next; | |
| 5961 } | |
| 5962 return sn_get_pending_pdu_cnf; | |
| 5963 } | |
| 5964 | |
| 5965 /* | |
| 5966 +------------------------------------------------------------------------------ | |
| 5967 | Function : mg_clean_ack_npdu_queues_leave_data | |
| 5968 +------------------------------------------------------------------------------ | |
| 5969 | Description : This procedure deletes SNDCP's internal buffers containing | |
| 5970 | unconfirmed acknowledged type NPDU's. | |
| 5971 | The data stored in the queues are not deleted. | |
| 5972 | | |
| 5973 | Parameters : nsapi | |
| 5974 | | |
| 5975 +------------------------------------------------------------------------------ | |
| 5976 */ | |
| 5977 GLOBAL void mg_clean_ack_npdu_queues_leave_data(U8 nsapi) | |
| 5978 { | |
| 5979 | |
| 5980 U8 used_sapi=0, sapi_index=0; | |
| 5981 T_NPDU_BUFFER* help = NULL; | |
| 5982 T_SN_DATA_REQ* sn_data_req = NULL; | |
| 5983 | |
| 5984 TRACE_FUNCTION( "mg_clean_ack_npdu_queues_leave_data" ); | |
| 5985 | |
| 5986 /* | |
| 5987 * set service instance according to sapi | |
| 5988 */ | |
| 5989 sndcp_get_nsapi_sapi(nsapi, &used_sapi); | |
| 5990 sndcp_get_sapi_index(used_sapi, &sapi_index); | |
| 5991 sndcp_data->sua = & sndcp_data->sua_base[sapi_index]; | |
| 5992 | |
| 5993 if (sndcp_data->sua->sn_data_q_write != sndcp_data->sua->sn_data_q_read) | |
| 5994 { | |
| 5995 /* | |
| 5996 * remove unhandled sn_data_req from queue. | |
| 5997 */ | |
| 5998 sn_data_req = sndcp_data->sua->sn_data_q[sndcp_data->sua->sn_data_q_read]; | |
| 5999 FREE(sn_data_req); | |
| 6000 } | |
| 6001 | |
| 6002 /* | |
| 6003 * set service instance according to nsapi | |
| 6004 */ | |
| 6005 | |
| 6006 sndcp_data->nu = & sndcp_data->nu_base[nsapi]; | |
| 6007 | |
| 6008 /* | |
| 6009 * clean buffer with unconfirmed NPDUs | |
| 6010 */ | |
| 6011 | |
| 6012 while(sndcp_data->nu->first_buffered_npdu != NULL) | |
| 6013 { | |
| 6014 help = sndcp_data->nu->first_buffered_npdu; | |
| 6015 sndcp_data->nu->first_buffered_npdu = help->next; | |
| 6016 MFREE(help->sn_data_req); | |
| 6017 MFREE(help); | |
| 6018 } | |
| 6019 } | |
| 6020 | |
| 6021 | |
| 6022 /* | |
| 6023 +------------------------------------------------------------------------------ | |
| 6024 | Function : mg_clean_unack_npdu_queues_including_data | |
| 6025 +------------------------------------------------------------------------------ | |
| 6026 | Description : This procedure deletes SNDCP's internal buffers containing | |
| 6027 | unacknowledged type NPDU's. | |
| 6028 | The data stored in the queues are also deleted. | |
| 6029 | | |
| 6030 | Parameters : nsapi | |
| 6031 | | |
| 6032 +------------------------------------------------------------------------------ | |
| 6033 */ | |
| 6034 GLOBAL void mg_clean_unack_npdu_queues_including_data(U8 nsapi) | |
| 6035 { | |
| 6036 /* | |
| 6037 * Delete affected N-PDUS from sn_unitdata_q. | |
| 6038 */ | |
| 6039 BOOL still = TRUE; | |
| 6040 U8 index = sndcp_data->su->sn_unitdata_q_read; | |
| 6041 | |
| 6042 while (still) | |
| 6043 { | |
| 6044 if (index == sndcp_data->su->sn_unitdata_q_write) { | |
| 6045 break; | |
| 6046 } | |
| 6047 if (sndcp_data->su->sn_unitdata_q[index]->nsapi == nsapi) { | |
| 6048 /* | |
| 6049 * The index for the prims to be shifted when 1 entry is deleted. | |
| 6050 */ | |
| 6051 U8 i = 0; | |
| 6052 | |
| 6053 if (sndcp_data->su->sn_unitdata_q[index] != NULL) { | |
| 6054 PFREE_DESC2(sndcp_data->su->sn_unitdata_q[index]); | |
| 6055 sndcp_data->su->sn_unitdata_q[index] = NULL; | |
| 6056 } | |
| 6057 | |
| 6058 for (i = index; | |
| 6059 i != sndcp_data->su->sn_unitdata_q_write; | |
| 6060 i = (i + 1) % SN_UNITDATA_Q_LEN) | |
| 6061 { | |
| 6062 sndcp_data->su->sn_unitdata_q[i] = | |
| 6063 sndcp_data->su->sn_unitdata_q[(i + 1) % SN_UNITDATA_Q_LEN]; | |
| 6064 | |
| 6065 sndcp_data->su->sn_unitdata_q[(i + 1) % SN_UNITDATA_Q_LEN]=NULL; | |
| 6066 } | |
| 6067 sndcp_data->su->sn_unitdata_q_write = | |
| 6068 (sndcp_data->su->sn_unitdata_q_write - 1 | |
| 6069 + SN_UNITDATA_Q_LEN) % SN_UNITDATA_Q_LEN; | |
| 6070 } | |
| 6071 else | |
| 6072 { | |
| 6073 index = (index + 1) % SN_UNITDATA_Q_LEN; | |
| 6074 } /* else (sndcp_data->su->sn_unitdata_q[index]->nsapi == nsapi) */ | |
| 6075 } | |
| 6076 } | |
| 6077 | |
| 6078 /* | |
| 6079 +------------------------------------------------------------------------------ | |
| 6080 | Function : sm_make_test_pending_pdu_cnf | |
| 6081 +------------------------------------------------------------------------------ | |
| 6082 | Description : Initialize SN_TEST_GET_PENDING_PDU_CNF primitive | |
| 6083 | Parameters : sn_get_pending_pdu_cnf - primitive | |
| 6084 | sn_test_get_pending_pdu_cnf - primitive | |
| 6085 | | |
| 6086 +------------------------------------------------------------------------------ | |
| 6087 */ | |
| 6088 | |
| 6089 GLOBAL void sm_make_test_pending_pdu_cnf | |
| 6090 (T_SN_GET_PENDING_PDU_CNF* sn_get_pending_pdu_cnf, | |
| 6091 T_SN_TEST_GET_PENDING_PDU_CNF* sn_test_get_pending_pdu_cnf) | |
| 6092 { | |
| 6093 int i,j; | |
| 6094 | |
| 6095 for (i = 0; i < SN_SIZE_NSAPI; i++) { | |
| 6096 sn_test_get_pending_pdu_cnf->c_test_ul_pdus = | |
| 6097 sn_get_pending_pdu_cnf->c_ul_pdus; | |
| 6098 sn_test_get_pending_pdu_cnf->test_ul_pdus[i].nsapi = | |
| 6099 sn_get_pending_pdu_cnf->ul_pdus[i].nsapi; | |
| 6100 sn_test_get_pending_pdu_cnf->test_ul_pdus[i].test_dl_sequence_number = | |
| 6101 sn_get_pending_pdu_cnf->ul_pdus[i].dl_sequence_number; | |
| 6102 sn_test_get_pending_pdu_cnf->test_ul_pdus[i].c_test_desc_list2 = | |
| 6103 sn_get_pending_pdu_cnf->ul_pdus[i].c_desc_list2; | |
| 6104 | |
| 6105 if (sn_get_pending_pdu_cnf->ul_pdus[i].c_desc_list2) { | |
| 6106 for(j = 0; j < sn_get_pending_pdu_cnf->ul_pdus[i].c_desc_list2; j++) { | |
| 6107 sn_test_get_pending_pdu_cnf->test_ul_pdus[i].c_test_desc_list2 = | |
| 6108 sn_get_pending_pdu_cnf->ul_pdus[i].c_desc_list2; | |
| 6109 sn_test_get_pending_pdu_cnf->test_ul_pdus[i].test_desc_list2[j].c_test_pending_pdu = | |
| 6110 (U8)sn_get_pending_pdu_cnf->ul_pdus[i].ptr_desc_list2[j].list_len; | |
| 6111 memcpy( | |
| 6112 sn_test_get_pending_pdu_cnf->test_ul_pdus[i].test_desc_list2[j].test_pending_pdu, | |
| 6113 ((T_desc2 *)sn_get_pending_pdu_cnf->ul_pdus[i].ptr_desc_list2[j].first)->buffer, | |
| 6114 sn_get_pending_pdu_cnf->ul_pdus[i].ptr_desc_list2[j].list_len); | |
| 6115 } | |
| 6116 } | |
| 6117 } | |
| 6118 } | |
| 6119 | |
| 6120 #endif /*#ifdef TI_DUAL_MODE*/ |
