FreeCalypso > hg > freecalypso-sw
comparison gsm-fw/g23m-gsm/sms/sms_rl.c @ 673:2f7df7a314f8
gsm-fw/g23m-gsm subtree: initial import from LoCosto source
author | Michael Spacefalcon <msokolov@ivan.Harhan.ORG> |
---|---|
date | Sun, 28 Sep 2014 23:20:04 +0000 |
parents | |
children | 5767cb509546 |
comparison
equal
deleted
inserted
replaced
672:0dc6f9e8e980 | 673:2f7df7a314f8 |
---|---|
1 /* | |
2 +----------------------------------------------------------------------------- | |
3 | Project : GSM-F&D (8411) | |
4 | Modul : SMS_RL | |
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 defines the functions for the relay layer | |
18 | of the component SMS. | |
19 +----------------------------------------------------------------------------- | |
20 */ | |
21 | |
22 #ifndef SMS_RL_C | |
23 #define SMS_RL_C | |
24 | |
25 #define ENTITY_SMS | |
26 | |
27 /*==== INCLUDES ===================================================*/ | |
28 | |
29 #define SAP_RR /* get RR causes until all causes are in one document */ | |
30 #define SAP_MMCM /* same reason */ | |
31 | |
32 #include <string.h> | |
33 #include <stdlib.h> | |
34 #include <stddef.h> | |
35 #include "typedefs.h" | |
36 #include "pcm.h" | |
37 #include "vsi.h" | |
38 #include "custom.h" | |
39 #include "gsm.h" | |
40 #include "message.h" | |
41 #include "ccdapi.h" | |
42 #include "prim.h" | |
43 #include "cus_sms.h" | |
44 #include "cnf_sms.h" | |
45 #include "mon_sms.h" | |
46 #include "pei.h" | |
47 #include "tok.h" | |
48 #include "sms.h" | |
49 #include "sms_em.h" | |
50 | |
51 /*==== EXPORT ======================================================*/ | |
52 | |
53 /*==== PRIVAT ======================================================*/ | |
54 | |
55 /*==== VARIABLES ===================================================*/ | |
56 | |
57 /*==== FUNCTIONS ===================================================*/ | |
58 | |
59 /* | |
60 +--------------------------------------------------------------------+ | |
61 | PROJECT : GSM-PS (8410) MODULE : SMS_RL | | |
62 | STATE : code ROUTINE : rl_init | | |
63 +--------------------------------------------------------------------+ | |
64 | |
65 PURPOSE : Initialize the relay layer. | |
66 | |
67 */ | |
68 | |
69 GLOBAL void rl_init (void) | |
70 { | |
71 GET_INSTANCE_DATA; | |
72 | |
73 TRACE_FUNCTION ("rl_init()"); | |
74 | |
75 sms_data->data[0].state[STATE_RL] = RL_IDLE; | |
76 sms_data->data[1].state[STATE_RL] = RL_IDLE; | |
77 } | |
78 | |
79 /*---- SIGNALS -----------------------------------------------------*/ | |
80 | |
81 #ifdef GPRS | |
82 GLOBAL void rl_proceed (void) | |
83 { | |
84 GET_INSTANCE_DATA; | |
85 TRACE_FUNCTION ("rl_proceed()"); | |
86 | |
87 if (SMS_INST_GET_STATE (STATE_RL) EQ RL_WAIT_FOR_SEND_ERROR) | |
88 { | |
89 SMS_INST_SET_STATE (STATE_RL, RL_IDLE); | |
90 | |
91 tl_report_ind (NULL, CAUSE_MAKE(DEFBY_STD, ORIGSIDE_MS, | |
92 SMSRP_ORIGINATING_ENTITY, SMS_RP_CS_PROTOCOL_ERROR)); | |
93 } | |
94 } | |
95 #endif | |
96 | |
97 /* | |
98 +--------------------------------------------------------------------+ | |
99 | PROJECT : GSM-PS (8410) MODULE : SMS_RL | | |
100 | STATE : code ROUTINE : rl_data_ind | | |
101 +--------------------------------------------------------------------+ | |
102 | |
103 PURPOSE : Processing the signal RL_DATA_IND. | |
104 | |
105 */ | |
106 | |
107 GLOBAL void rl_data_ind (T_cp_user_data_dl *cp_user_data_dl) | |
108 { | |
109 GET_INSTANCE_DATA; | |
110 TRACE_FUNCTION ("rl_data_ind()"); | |
111 | |
112 if (sms_data) | |
113 { | |
114 if (cp_user_data_dl->rp_mti EQ RP_ERROR_DL) | |
115 TRACE_EVENT_P1 ("RP_ERROR.CAUSE rcvd: 0x%2.2X", | |
116 (int)cp_user_data_dl->rp_error.rp_cause.rp_cause_value); | |
117 | |
118 switch (SMS_INST_GET_STATE (STATE_RL)) | |
119 { | |
120 /* ------------------------------------- */ | |
121 case RL_ESTABLISHED: | |
122 /* ------------------------------------- */ | |
123 case RL_IDLE: | |
124 /* ------------------------------------- */ | |
125 { | |
126 SMS_RP_REF(sms_data) = cp_user_data_dl->reference; | |
127 if (cp_user_data_dl->rp_mti EQ RP_DATA_DL) | |
128 { | |
129 /* | |
130 * RL state transition RL_WAIT_FOR_SEND_ACK | |
131 */ | |
132 SMS_INST_SET_STATE (STATE_RL, RL_WAIT_FOR_SEND_ACK); | |
133 /* | |
134 * start timer TR2M | |
135 */ | |
136 sms_timer_start(TR2M); | |
137 | |
138 SMS_EM_RECEIVE_RP_DATA; | |
139 /* | |
140 * TL_DATA_IND => | |
141 */ | |
142 tl_data_ind (&cp_user_data_dl->rp_data_dl); | |
143 } | |
144 else | |
145 { | |
146 MCAST (cp_data, U_CP_DATA); | |
147 /* | |
148 * If Message Id is unknwon then send RP-ERROR with cause #97 | |
149 */ | |
150 if(cp_user_data_dl->rp_mti > 0x06) | |
151 { | |
152 rl_build_rp_error (cp_user_data_dl->reference, | |
153 SMS_RP_CS_MSG_NON_EXIST, | |
154 cp_data, NULL); | |
155 } | |
156 else | |
157 { | |
158 rl_build_rp_error (cp_user_data_dl->reference, | |
159 SMS_RP_CS_MSG_NOT_COMP, | |
160 cp_data, NULL); | |
161 } | |
162 | |
163 SMS_EM_SEND_RP_ERROR; | |
164 | |
165 cp_data_req (cp_data); | |
166 /* | |
167 * CP_RELEASE_REQ => | |
168 */ | |
169 TRACE_EVENT("CP_RELEASE_REQ_1"); | |
170 | |
171 cp_release_req (SMS_INST.ti); | |
172 /* | |
173 * free instance | |
174 */ | |
175 FREE_SMS_INSTANCE (SMS_INST.ti); | |
176 } | |
177 break; | |
178 } | |
179 | |
180 /* ------------------------------------- */ | |
181 case RL_WAIT_FOR_ACK: | |
182 /* ------------------------------------- */ | |
183 | |
184 TRACE_FUNCTION ("rl_data_ind(): RP_WAIT_FOR_ACK"); | |
185 | |
186 switch (cp_user_data_dl->rp_mti) | |
187 { | |
188 case RP_ACK_DL: | |
189 TRACE_FUNCTION ("rl_data_ind(): RP_ACK_DL"); | |
190 /* | |
191 * stop timer TR1M | |
192 */ | |
193 sms_timer_stop(TR1M); | |
194 /* | |
195 * RL state transition RL_IDLE | |
196 */ | |
197 SMS_INST_SET_STATE (STATE_RL, RL_IDLE); | |
198 | |
199 /* | |
200 * if CMMS mode is 1 or 2 then only make cmm_release_pending TRUE | |
201 */ | |
202 if(CMMS_ACTIVE) | |
203 { | |
204 sms_data->cmms_release_pending = TRUE; | |
205 } | |
206 | |
207 /* | |
208 * TL_REPORT_IND => | |
209 */ | |
210 tl_report_ind (((cp_user_data_dl->rp_ack.v_rp_user_data)? | |
211 &cp_user_data_dl->rp_ack.rp_user_data: | |
212 NULL), SMS_NO_ERROR); | |
213 | |
214 /* Since the transmission is successful, the data stored for | |
215 retransmission can be freed */ | |
216 if (SMS_DATA_REQ(sms_data) NEQ NULL) | |
217 { | |
218 PFREE (SMS_DATA_REQ(sms_data)); | |
219 SMS_DATA_REQ(sms_data) = NULL; | |
220 } | |
221 | |
222 SMS_EM_RECEIVE_RP_AKNOWLEDGE; | |
223 | |
224 break; | |
225 | |
226 case RP_ERROR_DL: | |
227 /* When an RP-error with appropriate case value is | |
228 * is received, Retransmission of SMS is started | |
229 */ | |
230 { | |
231 #ifdef REL99 | |
232 BOOL retrans_flag = FALSE; | |
233 #endif | |
234 TRACE_FUNCTION ("rl_data_ind(): RP_ERROR_DL"); | |
235 /* | |
236 * stop timer TR1M | |
237 */ | |
238 sms_timer_stop(TR1M); | |
239 /* | |
240 * if CMMS mode is 1 or 2 then only make cmm_release_pending TRUE | |
241 */ | |
242 if(CMMS_ACTIVE) | |
243 { | |
244 sms_data->cmms_release_pending = TRUE; | |
245 } | |
246 #ifdef REL99 | |
247 /* | |
248 * This is done for Retransmission for the causes | |
249 * listed in the table 8.4/3gPP TS 24.011(Part 1) | |
250 */ | |
251 if (SMS_INST.tl_retx < TL_MAX_RETANS) | |
252 { | |
253 /* Check whether the cause value satisfies the one for retransmission | |
254 * listed in the table 8.4/3gPP TS 24.011(Part 1) | |
255 */ | |
256 switch(cp_user_data_dl->rp_error.rp_cause.rp_cause_value) | |
257 { | |
258 case SMS_RP_CS_UNASSIGNED_NUMBER: | |
259 case SMS_RP_CS_OPERATOR_DET_BARRED: | |
260 case SMS_RP_CS_CALL_BARRED: | |
261 case SMS_RP_CS_SM_TRANSFER_REJECTED: | |
262 case SMS_RP_CS_MEM_CAP_EXCEEDED: | |
263 case SMS_RP_CS_UNIDENT_SUBSCRIBER: | |
264 case SMS_RP_CS_FACILITY_REJECTED: | |
265 case SMS_RP_CS_UNKNOWN_SUBSCRIBER: | |
266 case SMS_RP_CS_NET_OUT_OF_ORDER: | |
267 case SMS_RP_CS_NO_RESOURCES: | |
268 case SMS_RP_CS_FAC_NOT_SUBSCRIBED: | |
269 case SMS_RP_CS_FAC_NOT_IMPL: | |
270 case SMS_RP_CS_INV_SM_TR_REF_VAL: | |
271 case SMS_RP_CS_SEM_INC_MSG: | |
272 case SMS_RP_CS_INV_MAND_INFO: | |
273 case SMS_RP_CS_MSG_NON_EXIST: | |
274 case SMS_RP_CS_INFO_NON_EXIST: | |
275 case SMS_RP_CS_PROTOCOL_ERROR: | |
276 case SMS_RP_CS_INTERWORKING: | |
277 retrans_flag = FALSE; | |
278 break; | |
279 /* All values other than the ones above are treated as temporary | |
280 failures. This includes SMS_RP_CS_DEST_OUT_OF_ORDER, | |
281 SMS_RP_CS_TEMP_FAILURE, SMS_RP_CS_CONGESTION, | |
282 SMS_RP_CS_MSG_NOT_COMP and others non-standard values | |
283 are taken as temporary error */ | |
284 default: | |
285 retrans_flag = TRUE; | |
286 break; | |
287 } | |
288 } | |
289 if(retrans_flag EQ TRUE) | |
290 { | |
291 TRACE_EVENT ("Retransmission cause received"); | |
292 cp_release_req(SMS_INST.ti); | |
293 TIMERSTART (SMS_INST_TR1M, 20000); | |
294 TRACE_EVENT ("Delay expiry TR1M, retransmit"); | |
295 } | |
296 else | |
297 #endif | |
298 { | |
299 /* | |
300 * RL state transition RL_IDLE | |
301 */ | |
302 SMS_INST_SET_STATE (STATE_RL, RL_IDLE); | |
303 tl_report_ind (((cp_user_data_dl->rp_error.v_rp_user_data)? | |
304 &cp_user_data_dl->rp_error.rp_user_data: NULL), | |
305 CAUSE_MAKE(DEFBY_STD, ORIGSIDE_NET, SMSRP_ORIGINATING_ENTITY, | |
306 cp_user_data_dl->rp_error.rp_cause.rp_cause_value)); | |
307 SMS_EM_RECEIVE_RP_ERROR; | |
308 } | |
309 } | |
310 break; | |
311 | |
312 | |
313 default: | |
314 TRACE_FUNCTION ("rl_data_ind(): default"); | |
315 | |
316 /* | |
317 * stop timer TR1M | |
318 */ | |
319 sms_timer_stop(TR1M); | |
320 | |
321 { | |
322 MCAST (cp_data_ul, U_CP_DATA); | |
323 /* | |
324 * If Message Id is unknwon then send RP-ERROR with cause #97 | |
325 */ | |
326 if(cp_user_data_dl->rp_mti > 0x06) | |
327 { | |
328 rl_build_rp_error (cp_user_data_dl->reference, | |
329 SMS_RP_CS_MSG_NON_EXIST, | |
330 cp_data_ul, NULL); | |
331 } | |
332 else | |
333 { | |
334 rl_build_rp_error (cp_user_data_dl->reference, | |
335 SMS_RP_CS_PROTOCOL_ERROR, | |
336 cp_data_ul, NULL); | |
337 } | |
338 | |
339 cp_data_req (cp_data_ul); | |
340 } | |
341 #ifdef GPRS /* interworking from flow control */ | |
342 if (SMS_LLC_FLOW(sms_data) NEQ SMS_LLC_BUSY_WAITING) | |
343 #endif | |
344 { | |
345 SMS_INST_SET_STATE (STATE_RL, RL_IDLE); | |
346 | |
347 /* | |
348 * if CMMS mode is 1 or 2 and current link used is GSM then only | |
349 * make cmm_release_pending TRUE | |
350 */ | |
351 #ifdef GPRS | |
352 if(CMMS_ACTIVE AND (SMS_INST.downlink EQ SMS_DOWNLINK_MMSMS)) | |
353 { | |
354 sms_data->cmms_release_pending = TRUE; | |
355 } | |
356 #endif | |
357 /* | |
358 * TL_REPORT_IND => | |
359 */ | |
360 /* | |
361 * If Message Id is unknwon then send TL REPORT IND with cause #97 | |
362 */ | |
363 if(cp_user_data_dl->rp_mti > 0x06) | |
364 { | |
365 tl_report_ind (NULL, CAUSE_MAKE(DEFBY_STD, ORIGSIDE_MS, | |
366 SMSRP_ORIGINATING_ENTITY, SMS_RP_CS_MSG_NON_EXIST)); | |
367 } | |
368 else | |
369 { | |
370 tl_report_ind (NULL, CAUSE_MAKE(DEFBY_STD, ORIGSIDE_MS, | |
371 SMSRP_ORIGINATING_ENTITY, SMS_RP_CS_PROTOCOL_ERROR)); | |
372 } | |
373 | |
374 } | |
375 #ifdef GPRS | |
376 else | |
377 { | |
378 SMS_INST_SET_STATE (STATE_RL, RL_WAIT_FOR_SEND_ERROR); | |
379 } | |
380 #endif | |
381 | |
382 SMS_EM_RECEIVE_UNKNOWN_2; | |
383 | |
384 break; | |
385 } | |
386 | |
387 break; | |
388 | |
389 case RL_WAIT_FOR_SEND_ACK: | |
390 TRACE_FUNCTION ("rl_data_ind(): RP_WAIT_FOR_SEND_ACK"); | |
391 { | |
392 MCAST (cp_data_ul, U_CP_DATA); | |
393 /* | |
394 * If Message Id is unknwon then send RP-ERROR with cause #97 | |
395 */ | |
396 if(cp_user_data_dl->rp_mti > 0x06) | |
397 { | |
398 rl_build_rp_error (cp_user_data_dl->reference, | |
399 SMS_RP_CS_MSG_NON_EXIST, | |
400 cp_data_ul, NULL); | |
401 } | |
402 else | |
403 { | |
404 rl_build_rp_error (cp_user_data_dl->reference, | |
405 SMS_RP_CS_PROTOCOL_ERROR, | |
406 cp_data_ul, NULL); | |
407 } | |
408 cp_data_req (cp_data_ul); | |
409 | |
410 } | |
411 break; | |
412 | |
413 /* ------------------------------------- */ | |
414 case RL_WAIT_FOR_SMMA_ACK: | |
415 /* ------------------------------------- */ | |
416 | |
417 TRACE_FUNCTION ("rl_data_ind(): RP_WAIT_FOR_SMMA_ACK"); | |
418 | |
419 switch (cp_user_data_dl->rp_mti) | |
420 { | |
421 case RP_ACK_DL: | |
422 TRACE_FUNCTION ("rl_data_ind(): RP_ACK_DL"); | |
423 /* | |
424 * stop timer TR1M | |
425 */ | |
426 sms_timer_stop(TR1M); | |
427 | |
428 SMS_INST.retrans = FALSE; | |
429 /* | |
430 * RL state transition RL_IDLE | |
431 */ | |
432 SMS_INST_SET_STATE (STATE_RL, RL_IDLE); | |
433 /* | |
434 * TL_REPORT_IND => | |
435 */ | |
436 tl_report_ind (NULL, SMS_NO_ERROR); | |
437 break; | |
438 | |
439 case RP_ERROR_DL: | |
440 TRACE_FUNCTION ("rl_data_ind(): RP_ERROR_DL"); | |
441 | |
442 if (rl_temp_failure (cp_user_data_dl->rp_error. | |
443 rp_cause.rp_cause_value)) | |
444 { | |
445 if (SMS_INST.retrans) | |
446 { | |
447 /* | |
448 * RL state transition RL_IDLE | |
449 */ | |
450 SMS_INST_SET_STATE (STATE_RL, RL_IDLE); | |
451 SMS_INST.retrans = FALSE; | |
452 | |
453 /* | |
454 * TL_REPORT_IND => | |
455 */ | |
456 tl_report_ind (NULL, | |
457 CAUSE_MAKE(DEFBY_STD, ORIGSIDE_NET, SMSRP_ORIGINATING_ENTITY, | |
458 cp_user_data_dl->rp_error.rp_cause.rp_cause_value)); | |
459 sms_timer_stop(TR1M); | |
460 | |
461 tl_sms_memo_exceeded (TRUE); | |
462 /* | |
463 * stop timer TR1M | |
464 */ | |
465 } | |
466 else | |
467 { | |
468 SMS_INST.retrans = TRUE; | |
469 /* | |
470 * RL state transition RL_WAIT_FOR_RETRANS_TIMER | |
471 */ | |
472 SMS_INST_SET_STATE (STATE_RL, RL_WAIT_FOR_RETRANS_TIMER); | |
473 /* | |
474 * stop timer TR1M | |
475 */ | |
476 sms_timer_stop(TR1M); | |
477 /* | |
478 * start timer TRAM | |
479 */ | |
480 sms_timer_start(TRAM); | |
481 /* | |
482 * CP_RELEASE_REQ => | |
483 */ | |
484 TRACE_EVENT("CP_RELEASE_REQ_11"); | |
485 cp_release_req (SMS_INST.ti); | |
486 | |
487 } | |
488 } | |
489 else | |
490 { | |
491 /* | |
492 * stop timer TR1M | |
493 */ | |
494 | |
495 sms_timer_stop(TR1M); | |
496 SMS_INST.retrans = FALSE; | |
497 /* | |
498 * RL state transition RL_IDLE | |
499 */ | |
500 SMS_INST_SET_STATE (STATE_RL, RL_IDLE); | |
501 /* | |
502 * TL_REPORT_IND => | |
503 */ | |
504 | |
505 tl_report_ind (NULL, | |
506 CAUSE_MAKE(DEFBY_STD, ORIGSIDE_NET, SMSRP_ORIGINATING_ENTITY, | |
507 cp_user_data_dl->rp_error.rp_cause.rp_cause_value)); | |
508 | |
509 tl_sms_memo_exceeded (TRUE); | |
510 | |
511 } | |
512 break; | |
513 | |
514 default: | |
515 TRACE_FUNCTION ("rl_data_ind(): default"); | |
516 /* | |
517 * stop timer TR1M | |
518 */ | |
519 sms_timer_stop(TR1M); | |
520 | |
521 SMS_INST.retrans = FALSE; | |
522 /* | |
523 * RL state transition RL_IDLE | |
524 */ | |
525 SMS_INST_SET_STATE (STATE_RL, RL_IDLE); | |
526 /* | |
527 * If Message Id is unknwon then send RP-ERROR with cause #97 | |
528 */ | |
529 if(cp_user_data_dl->rp_mti > 0x06) | |
530 { | |
531 MCAST (cp_data, U_CP_DATA); | |
532 rl_build_rp_error (cp_user_data_dl->reference, | |
533 SMS_RP_CS_MSG_NON_EXIST, | |
534 cp_data, NULL); | |
535 SMS_EM_SEND_RP_ERROR; | |
536 cp_data_req (cp_data); | |
537 tl_report_ind (NULL, CAUSE_MAKE(DEFBY_STD, ORIGSIDE_MS, | |
538 SMSRP_ORIGINATING_ENTITY, SMS_RP_CS_MSG_NON_EXIST)); | |
539 } | |
540 break; | |
541 } | |
542 break; | |
543 } | |
544 } | |
545 } | |
546 | |
547 /* | |
548 +--------------------------------------------------------------------+ | |
549 | PROJECT : GSM-PS (8410) MODULE : SMS_RL | | |
550 | STATE : code ROUTINE : rl_establish_req | | |
551 +--------------------------------------------------------------------+ | |
552 | |
553 PURPOSE : Processing the signal RL_ESTABLISH_REQ. | |
554 | |
555 */ | |
556 | |
557 GLOBAL void rl_establish_req (UBYTE ti) | |
558 { | |
559 GET_INSTANCE_DATA; | |
560 TRACE_FUNCTION_P1 ("rl_establish_req(TI=%u)", ti); | |
561 switch (SMS_INST_GET_STATE (STATE_RL)) | |
562 { | |
563 case RL_IDLE: | |
564 /* | |
565 * RL state transition RL_ESTABLISH | |
566 */ | |
567 SMS_INST_SET_STATE (STATE_RL, RL_ESTABLISH); | |
568 /* | |
569 * CP_ESTABLISH_REQ => | |
570 */ | |
571 cp_establish_req(ti); | |
572 /* | |
573 * start timer TR1M | |
574 */ | |
575 sms_data->timer_ti = ti; | |
576 sms_timer_start(TR1M); | |
577 break; | |
578 default: | |
579 TRACE_ERROR("RL_ESTABLISH_REQ in wrong state received!"); | |
580 } | |
581 } | |
582 | |
583 /* | |
584 +--------------------------------------------------------------------+ | |
585 | PROJECT : GSM-PS (8410) MODULE : SMS_RL | | |
586 | STATE : code ROUTINE : rl_establish_cnf | | |
587 +--------------------------------------------------------------------+ | |
588 | |
589 PURPOSE : Processing the signal RL_ESTABLISH_CNF. | |
590 | |
591 */ | |
592 | |
593 GLOBAL void rl_establish_cnf (BOOL success) | |
594 { | |
595 GET_INSTANCE_DATA; | |
596 TRACE_FUNCTION ("rl_establish_cnf()"); | |
597 switch (SMS_INST_GET_STATE (STATE_RL)) | |
598 { | |
599 case RL_ESTABLISH: | |
600 /* | |
601 * stop timer TR1M | |
602 */ | |
603 sms_timer_stop(TR1M); | |
604 if (success EQ TRUE) | |
605 { | |
606 /* | |
607 * RL state transition RL_ESTABLISHED | |
608 */ | |
609 SMS_INST_SET_STATE (STATE_RL, RL_ESTABLISHED); | |
610 } | |
611 else | |
612 { | |
613 /* | |
614 * RL state transition RL_IDLE | |
615 */ | |
616 SMS_INST_SET_STATE (STATE_RL, RL_IDLE); | |
617 } | |
618 /* | |
619 * TL_ESTABLISH_CNF => | |
620 */ | |
621 tl_establish_cnf(success); | |
622 break; | |
623 default: | |
624 TRACE_ERROR("RL_ESTABLISH_CNF in wrong state received!"); | |
625 } | |
626 } | |
627 | |
628 /* | |
629 +--------------------------------------------------------------------+ | |
630 | PROJECT : GSM-PS (8410) MODULE : SMS_RL | | |
631 | STATE : code ROUTINE : rl_release_req | | |
632 +--------------------------------------------------------------------+ | |
633 | |
634 PURPOSE : Processing the signal RL_RELEASE_REQ. | |
635 | |
636 */ | |
637 | |
638 GLOBAL void rl_release_req ( UBYTE ti) | |
639 { | |
640 TRACE_FUNCTION_P1 ("rl_release_req(TI=%u)", ti); | |
641 /* | |
642 * CP_RELEASE_REQ => | |
643 */ | |
644 TRACE_EVENT("CP_RELEASE_REQ_13"); | |
645 cp_release_req(ti); | |
646 } | |
647 | |
648 /* | |
649 +--------------------------------------------------------------------+ | |
650 | PROJECT : GSM-PS (8410) MODULE : SMS_RL | | |
651 | STATE : code ROUTINE : rl_data_req | | |
652 +--------------------------------------------------------------------+ | |
653 | |
654 PURPOSE : Processing the signal RL_DATA_REQ. | |
655 | |
656 */ | |
657 GLOBAL BOOL rl_data_req (UBYTE msg_ref, | |
658 T_U_CP_DATA *cp_data) | |
659 { | |
660 GET_INSTANCE_DATA; | |
661 TRACE_FUNCTION ("rl_data_req()"); | |
662 | |
663 if (sms_data) | |
664 { | |
665 switch (SMS_INST_GET_STATE (STATE_RL)) | |
666 { | |
667 case RL_ESTABLISHED: | |
668 { | |
669 SMS_INST.msg_ref = msg_ref; | |
670 /* | |
671 * RL state transtion RL_WAIT_FOR_ACK | |
672 */ | |
673 SMS_INST_SET_STATE (STATE_RL, RL_WAIT_FOR_ACK); | |
674 | |
675 SMS_EM_SEND_RP_DATA; | |
676 | |
677 cp_data->cp_user_data_ul.rp_mti = RP_DATA_UL; | |
678 cp_data->cp_user_data_ul.reference = msg_ref; | |
679 /* | |
680 * CP_DATA_REQ => | |
681 */ | |
682 cp_data_req (cp_data); | |
683 /* | |
684 * start timer TR1M | |
685 */ | |
686 sms_timer_start(TR1M); | |
687 | |
688 return TRUE; | |
689 } | |
690 default: | |
691 TRACE_ERROR("RL_DATA_REQ in wrong state received!"); | |
692 break; | |
693 } | |
694 } | |
695 return FALSE; | |
696 } | |
697 | |
698 /* | |
699 +--------------------------------------------------------------------+ | |
700 | PROJECT : GSM-PS (8410) MODULE : SMS_RL | | |
701 | STATE : code ROUTINE : rl_error_ind | | |
702 +--------------------------------------------------------------------+ | |
703 | |
704 PURPOSE : Processing the signal RL_ERROR_IND. | |
705 | |
706 */ | |
707 | |
708 GLOBAL void rl_error_ind (USHORT cause) | |
709 { | |
710 GET_INSTANCE_DATA; | |
711 TRACE_FUNCTION ("rl_error_ind()"); | |
712 | |
713 if (sms_data) | |
714 { | |
715 switch (SMS_INST_GET_STATE (STATE_RL)) | |
716 { | |
717 /* --------------------------------- */ | |
718 case RL_ESTABLISH: | |
719 /* --------------------------------- */ | |
720 | |
721 if ( SMS_INST.tl_retx < TL_MAX_RETANS ) | |
722 { | |
723 switch ( cause ) | |
724 { | |
725 case MMCM_MMCS_MESSAGE_INCOMPAT: | |
726 case RRCS_NORM: | |
727 /* | |
728 * start timer TR1M with value | |
729 */ | |
730 TIMERSTART ( SMS_INST_TR1M, 20000 ); | |
731 TRACE_EVENT ( "Delay expiry TR1M, retransmit" ); | |
732 return; | |
733 | |
734 default: /* No retransmission */ | |
735 break; | |
736 } | |
737 } | |
738 | |
739 /* | |
740 * stop timer TR1M | |
741 */ | |
742 sms_timer_stop(TR1M); | |
743 /*FALLTHROUGH*/ /*lint -fallthrough*/ | |
744 /* --------------------------------- */ | |
745 case RL_ESTABLISHED: | |
746 /* --------------------------------- */ | |
747 /* | |
748 * RL state transition RL_IDLE | |
749 */ | |
750 SMS_INST_SET_STATE (STATE_RL, RL_IDLE); | |
751 /* | |
752 * free instance | |
753 */ | |
754 FREE_SMS_INSTANCE (SMS_INST.ti); | |
755 /* | |
756 * TL_REPORT_IND | |
757 */ | |
758 tl_report_ind (NULL, cause); | |
759 break; | |
760 | |
761 /* --------------------------------- */ | |
762 case RL_WAIT_FOR_ACK: | |
763 /* --------------------------------- */ | |
764 TRACE_FUNCTION ("rl_error_ind(): RL_WAIT_FOR_ACK"); | |
765 /* | |
766 * The following code is to implement a subset of | |
767 * 3GPP 23.040 Release 1999 subclause 9.2.3.6. | |
768 * For certain errors the SMS SUBMIT / SMS COMMAND is repeated | |
769 * after timeout of TR1M. | |
770 */ | |
771 TRACE_EVENT_P2 ("TL retrans #%d, error_cs %04x", | |
772 SMS_INST.tl_retx, | |
773 cause); | |
774 | |
775 if (SMS_INST.tl_retx < TL_MAX_RETANS) | |
776 { | |
777 switch (cause) | |
778 { | |
779 case SMS_CAUSE_NET_TIMEOUT: | |
780 /* 11.10 test case 34.2.2 step 68 */ | |
781 /* | |
782 * start timer TR1M with value | |
783 */ | |
784 TIMERSTART (SMS_INST_TR1M, 20000); | |
785 TRACE_EVENT ("Delay expiry TR1M, retransmit"); | |
786 return; | |
787 | |
788 case RRCS_NORM: | |
789 case MMCM_MMCS_MESSAGE_INCOMPAT: /* Make cingular happy, #19189 */ | |
790 TRACE_EVENT ("Retransmission after TR1M"); | |
791 return; | |
792 | |
793 default: /* No retransmission */ | |
794 break; | |
795 } | |
796 } | |
797 /* | |
798 * stop timer TR1M | |
799 */ | |
800 sms_timer_stop(TR1M); | |
801 /* | |
802 * RL state transition RL_IDLE | |
803 */ | |
804 SMS_INST_SET_STATE (STATE_RL, RL_IDLE); | |
805 /* | |
806 * free instance | |
807 */ | |
808 FREE_SMS_INSTANCE (SMS_INST.ti); | |
809 /* | |
810 * TL_REPORT_IND => | |
811 */ | |
812 tl_report_ind (NULL, cause); | |
813 break; | |
814 | |
815 /* --------------------------------- */ | |
816 case RL_WAIT_FOR_SEND_ACK: | |
817 /* --------------------------------- */ | |
818 | |
819 TRACE_FUNCTION ("rl_error_ind(): RL_WAIT_FOR_SEND_ACK"); | |
820 /* | |
821 * free instance | |
822 */ | |
823 FREE_SMS_INSTANCE (SMS_INST.ti); | |
824 /* | |
825 * stop timer TR2M | |
826 */ | |
827 sms_timer_stop(TR2M); | |
828 /* | |
829 * RL state transition RL_IDLE | |
830 */ | |
831 SMS_INST_SET_STATE (STATE_RL, RL_IDLE); | |
832 /* | |
833 * TL_REPORT_IND => | |
834 */ | |
835 tl_report_ind (NULL, cause); | |
836 break; | |
837 | |
838 /* --------------------------------- */ | |
839 case RL_WAIT_FOR_SMMA_ACK: | |
840 /* --------------------------------- */ | |
841 | |
842 TRACE_FUNCTION ("rl_error_ind(): RL_WAIT_FOR_SMMA_ACK"); | |
843 | |
844 // FREE_SMS_INSTANCE (SMS_INST.ti); | |
845 | |
846 if (SMS_INST.retrans) | |
847 { | |
848 /* | |
849 * RL state transition RL_IDLE | |
850 */ | |
851 SMS_INST_SET_STATE (STATE_RL, RL_IDLE); | |
852 SMS_INST.retrans = FALSE; | |
853 /* | |
854 * TL_REPORT_IND => | |
855 */ | |
856 tl_report_ind (NULL, SMS_CAUSE_NET_TIMEOUT); | |
857 /* | |
858 * stop timer TR1M | |
859 */ | |
860 sms_timer_stop(TR1M); | |
861 tl_sms_memo_exceeded (TRUE); | |
862 | |
863 } | |
864 else | |
865 { | |
866 SMS_INST.retrans = TRUE; | |
867 /* | |
868 * RL state transition RL_WAIT_FOR_RETRANS_TIMER | |
869 */ | |
870 SMS_INST_SET_STATE (STATE_RL, RL_WAIT_FOR_RETRANS_TIMER); | |
871 /* | |
872 * stop timer TR1M | |
873 */ | |
874 sms_timer_stop(TR1M); | |
875 /* | |
876 * start timer TRAM | |
877 */ | |
878 sms_timer_start(TRAM); | |
879 /* | |
880 * CP_RELEASE_REQ => | |
881 */ | |
882 TRACE_EVENT("CP_RELEASE_REQ_15"); | |
883 cp_release_req (SMS_INST.ti); | |
884 | |
885 /* | |
886 * free instance | |
887 */ | |
888 FREE_SMS_INSTANCE (SMS_INST.ti); | |
889 } | |
890 | |
891 break; | |
892 | |
893 | |
894 default: | |
895 | |
896 if(CMMS_ACTIVE) | |
897 { | |
898 tl_cmms_end(); | |
899 } | |
900 /* | |
901 * free instance | |
902 */ | |
903 FREE_SMS_INSTANCE (SMS_INST.ti); | |
904 /* | |
905 * RL state transition RL_IDLE | |
906 */ | |
907 | |
908 SMS_INST_SET_STATE (STATE_RL, RL_IDLE); | |
909 break; | |
910 } | |
911 } | |
912 } | |
913 | |
914 /* | |
915 +--------------------------------------------------------------------+ | |
916 | PROJECT : GSM-PS (8410) MODULE : SMS_RL | | |
917 | STATE : code ROUTINE : rl_mem_avail_req | | |
918 +--------------------------------------------------------------------+ | |
919 | |
920 PURPOSE : Processing the signal RL_MEM_AVAIL_REQ. | |
921 | |
922 */ | |
923 | |
924 GLOBAL BOOL rl_mem_avail_req (void) | |
925 { | |
926 GET_INSTANCE_DATA; | |
927 TRACE_FUNCTION ("rl_mem_avail_req()"); | |
928 | |
929 if (sms_data) | |
930 { | |
931 switch (SMS_INST_GET_STATE (STATE_RL)) | |
932 { | |
933 case RL_ESTABLISHED: | |
934 { | |
935 CCD_START; | |
936 { | |
937 MCAST (cp_data, U_CP_DATA); | |
938 /* | |
939 * RL state transition RL_WAIT_FOR_SMMA_ACK | |
940 */ | |
941 SMS_INST_SET_STATE (STATE_RL, RL_WAIT_FOR_SMMA_ACK); | |
942 SMS_RP_REF(sms_data) = SMS_INST.tp_mr; | |
943 | |
944 rl_build_rp_smma (SMS_RP_REF(sms_data), cp_data); | |
945 | |
946 CCD_END; | |
947 /* | |
948 * CP_DATA_REQ => | |
949 */ | |
950 cp_data_req (cp_data); | |
951 } | |
952 /* | |
953 * start timer TR1M | |
954 */ | |
955 sms_timer_start(TR1M); | |
956 return TRUE; | |
957 | |
958 default: | |
959 TRACE_ERROR("RL_MEM_AVAIL_REQ in wrong state received!"); | |
960 break; | |
961 } | |
962 } | |
963 } | |
964 return FALSE; | |
965 } | |
966 | |
967 /* | |
968 +--------------------------------------------------------------------+ | |
969 | PROJECT : GSM-PS (8410) MODULE : SMS_RL | | |
970 | STATE : code ROUTINE : rl_start_tram_req | | |
971 +--------------------------------------------------------------------+ | |
972 | |
973 PURPOSE : Processing the signal RL_START_TRAM_REQ. | |
974 | |
975 */ | |
976 | |
977 GLOBAL void rl_start_tram_req (void) | |
978 { | |
979 GET_INSTANCE_DATA; | |
980 TRACE_FUNCTION ("rl_start_tram_req()"); | |
981 | |
982 SMS_INST.retrans = TRUE; | |
983 /* | |
984 * RL state transition RL_WAIT_FOR_RETRANS_TIMER | |
985 */ | |
986 SMS_INST_SET_STATE (STATE_RL, RL_WAIT_FOR_RETRANS_TIMER); | |
987 /* | |
988 * start timer TRAM | |
989 */ | |
990 sms_timer_start(TRAM); | |
991 } | |
992 | |
993 /* | |
994 +--------------------------------------------------------------------+ | |
995 | PROJECT : GSM-PS (8410) MODULE : SMS_RL | | |
996 | STATE : code ROUTINE : rl_build_rp_ack | | |
997 +--------------------------------------------------------------------+ | |
998 | |
999 PURPOSE : Processing the function RL_BUILD_RP_ACK. | |
1000 | |
1001 */ | |
1002 | |
1003 LOCAL void rl_build_rp_ack (UBYTE msg_ref, | |
1004 T_U_CP_DATA *cp_data, | |
1005 T_rp_user_data *rp_user_data) | |
1006 { | |
1007 TRACE_FUNCTION ("rl_build_rp_ack()"); | |
1008 | |
1009 memset (&cp_data->cp_user_data_ul.rp_ack, 0, sizeof (T_rp_ack)); | |
1010 | |
1011 cp_data->msg_type = U_CP_DATA; | |
1012 cp_data->cp_user_data_ul.rp_mti = RP_ACK_UL; | |
1013 cp_data->cp_user_data_ul.reference = msg_ref; | |
1014 | |
1015 cp_data->cp_user_data_ul.v_rp_data_ul = FALSE; | |
1016 cp_data->cp_user_data_ul.v_rp_error = FALSE; | |
1017 cp_data->cp_user_data_ul.v_rp_ack = TRUE; | |
1018 | |
1019 if (rp_user_data NEQ NULL AND rp_user_data->v_tpdu) | |
1020 { | |
1021 memcpy (&cp_data->cp_user_data_ul.rp_ack.rp_user_data, | |
1022 rp_user_data, sizeof (T_rp_user_data)); | |
1023 cp_data->cp_user_data_ul.rp_ack.v_rp_user_data = TRUE; | |
1024 } | |
1025 } | |
1026 | |
1027 /* | |
1028 +--------------------------------------------------------------------+ | |
1029 | PROJECT : GSM-PS (8410) MODULE : SMS_RL | | |
1030 | STATE : code ROUTINE : rl_report_req_ack | | |
1031 +--------------------------------------------------------------------+ | |
1032 | |
1033 PURPOSE : Processing the signal RL_REPORT_REQ_ACK. | |
1034 | |
1035 */ | |
1036 | |
1037 GLOBAL void rl_report_req_ack (T_rp_user_data *rp_user_data) | |
1038 { | |
1039 GET_INSTANCE_DATA; | |
1040 TRACE_FUNCTION ("rl_report_req_ack()"); | |
1041 | |
1042 if (sms_data) | |
1043 { | |
1044 switch (SMS_INST_GET_STATE (STATE_RL)) | |
1045 { | |
1046 case RL_WAIT_FOR_SEND_ACK: | |
1047 { | |
1048 MCAST (cp_data, U_CP_DATA); | |
1049 /* | |
1050 * stop timer TR2M | |
1051 */ | |
1052 sms_timer_stop(TR2M); | |
1053 | |
1054 rl_build_rp_ack (SMS_RP_REF(sms_data), cp_data, rp_user_data); | |
1055 /* | |
1056 * RL state transition RL_IDLE | |
1057 */ | |
1058 SMS_INST_SET_STATE (STATE_RL, RL_IDLE); | |
1059 /* | |
1060 * CP_DATA / RP_ACK ==> | |
1061 */ | |
1062 cp_data_req (cp_data); | |
1063 /* | |
1064 * CP_RELEASE_REQ => | |
1065 */ | |
1066 TRACE_EVENT("CP_RELEASE_REQ_16"); | |
1067 cp_release_req (SMS_INST.ti); | |
1068 break; | |
1069 } | |
1070 default: | |
1071 break; | |
1072 } | |
1073 } | |
1074 } | |
1075 | |
1076 /* | |
1077 +--------------------------------------------------------------------+ | |
1078 | PROJECT : GSM-PS (8410) MODULE : SMS_RL | | |
1079 | STATE : code ROUTINE : rl_build_rp_error | | |
1080 +--------------------------------------------------------------------+ | |
1081 | |
1082 PURPOSE : Processing the function RL_BUILD_RP_ERROR. | |
1083 | |
1084 */ | |
1085 | |
1086 GLOBAL void rl_build_rp_error (UBYTE msg_ref, | |
1087 USHORT error, | |
1088 T_U_CP_DATA *cp_data, | |
1089 T_rp_user_data *rp_user_data) | |
1090 { | |
1091 TRACE_FUNCTION ("rl_build_rp_error()"); | |
1092 TRACE_EVENT_P1 ("RP_ERROR.CAUSE sent: 0x%2.2X", (int)error); | |
1093 | |
1094 memset (&cp_data->cp_user_data_ul.rp_error, 0, sizeof (T_rp_error)); | |
1095 | |
1096 cp_data->msg_type = U_CP_DATA; | |
1097 cp_data->cp_user_data_ul.rp_mti = RP_ERROR_UL; | |
1098 cp_data->cp_user_data_ul.reference = msg_ref; | |
1099 | |
1100 cp_data->cp_user_data_ul.v_rp_data_ul = FALSE; | |
1101 cp_data->cp_user_data_ul.v_rp_ack = FALSE; | |
1102 cp_data->cp_user_data_ul.v_rp_error = TRUE; | |
1103 | |
1104 cp_data->cp_user_data_ul.rp_error. | |
1105 rp_cause.v_rp_cause_value = TRUE; | |
1106 if (error < 128) /* GSM 04.11 cause */ | |
1107 { | |
1108 cp_data->cp_user_data_ul.rp_error. | |
1109 rp_cause.rp_cause_value = (UBYTE)error; | |
1110 } | |
1111 else | |
1112 { | |
1113 cp_data->cp_user_data_ul.rp_error. | |
1114 rp_cause.rp_cause_value = SMS_RP_CS_PROTOCOL_ERROR; | |
1115 cp_data->cp_user_data_ul.rp_error. | |
1116 v_rp_user_data = TRUE; | |
1117 } | |
1118 if (rp_user_data NEQ NULL AND rp_user_data->v_tpdu) | |
1119 { | |
1120 memcpy (&cp_data->cp_user_data_ul.rp_error.rp_user_data, | |
1121 rp_user_data, sizeof (T_rp_user_data)); | |
1122 cp_data->cp_user_data_ul.rp_error.v_rp_user_data = TRUE; | |
1123 } | |
1124 } | |
1125 | |
1126 /* | |
1127 +--------------------------------------------------------------------+ | |
1128 | PROJECT : GSM-PS (8410) MODULE : SMS_RL | | |
1129 | STATE : code ROUTINE : rl_report_req_error | | |
1130 +--------------------------------------------------------------------+ | |
1131 | |
1132 PURPOSE : Processing the signal RL_REPORT_REQ_ERROR. | |
1133 | |
1134 */ | |
1135 | |
1136 GLOBAL void rl_report_req_error (USHORT cause, | |
1137 T_rp_user_data *rp_user_data) | |
1138 { | |
1139 GET_INSTANCE_DATA; | |
1140 TRACE_FUNCTION ("rl_report_req_error()"); | |
1141 | |
1142 if (sms_data) | |
1143 { | |
1144 switch (SMS_INST_GET_STATE (STATE_RL)) | |
1145 { | |
1146 case RL_WAIT_FOR_SEND_ACK: | |
1147 { | |
1148 MCAST (cp_data, U_CP_DATA); | |
1149 /* | |
1150 * stop timer TR2M | |
1151 */ | |
1152 sms_timer_stop(TR2M); | |
1153 | |
1154 rl_build_rp_error (SMS_RP_REF(sms_data), cause, | |
1155 cp_data, rp_user_data); | |
1156 /* | |
1157 * RL state transition RL_IDLE | |
1158 */ | |
1159 SMS_INST_SET_STATE (STATE_RL, RL_IDLE); | |
1160 /* | |
1161 * CP_DATA / RP_ERROR ==> | |
1162 */ | |
1163 cp_data_req (cp_data); | |
1164 break; | |
1165 } | |
1166 default: | |
1167 break; | |
1168 } | |
1169 } | |
1170 } | |
1171 | |
1172 #if defined (GPRS) | |
1173 /* | |
1174 +--------------------------------------------------------------------+ | |
1175 | PROJECT : GSM-PS (8410) MODULE : SMS_RL | | |
1176 | STATE : code ROUTINE : rl_build_rp_error_gprs | | |
1177 +--------------------------------------------------------------------+ | |
1178 | |
1179 PURPOSE : Processing the function RL_BUILD_RP_ERROR for GSMS. | |
1180 | |
1181 */ | |
1182 | |
1183 GLOBAL void rl_build_rp_error_gprs (UBYTE ti, | |
1184 T_LL_UNITDATA_REQ *data_req, | |
1185 USHORT error, | |
1186 UBYTE msg_ref, | |
1187 T_U_CP_DATA *cp_data, | |
1188 T_stk_cmd *stk_cmd) | |
1189 { | |
1190 TRACE_FUNCTION ("rl_build_rp_error_gprs()"); | |
1191 TRACE_EVENT_P1 ("RP_ERROR.CAUSE sent: 0x%4.2X", (int)error); | |
1192 | |
1193 data_req->sdu.o_buf = ENCODE_OFFSET; | |
1194 | |
1195 cp_data->msg_type = U_CP_DATA; | |
1196 cp_data->cp_user_data_ul.rp_mti = RP_ERROR_UL; | |
1197 cp_data->cp_user_data_ul.reference = msg_ref; | |
1198 | |
1199 cp_data->cp_user_data_ul.v_rp_data_ul = FALSE; | |
1200 cp_data->cp_user_data_ul.v_rp_error = TRUE; | |
1201 | |
1202 memset (&cp_data->cp_user_data_ul.rp_error.rp_cause, 0, | |
1203 sizeof (T_rp_cause)); | |
1204 | |
1205 cp_data->cp_user_data_ul.rp_error. | |
1206 rp_cause.v_rp_cause_value = TRUE; | |
1207 if (error < 128) /* GSM 04.11 cause */ | |
1208 { | |
1209 cp_data->cp_user_data_ul.rp_error. | |
1210 rp_cause.rp_cause_value = (UBYTE)error; | |
1211 cp_data->cp_user_data_ul.rp_error. | |
1212 v_rp_user_data = FALSE; | |
1213 } | |
1214 else | |
1215 { | |
1216 cp_data->cp_user_data_ul.rp_error. | |
1217 rp_cause.rp_cause_value = SMS_RP_CS_PROTOCOL_ERROR; | |
1218 cp_data->cp_user_data_ul.rp_error. | |
1219 v_rp_user_data = TRUE; | |
1220 memset (&cp_data->cp_user_data_ul.rp_error.rp_user_data, | |
1221 0, sizeof (T_rp_user_data)); | |
1222 if (error >= 256) /* no GSM 03.40 cause */ | |
1223 error = SMS_FCS_UNSPECIFIED; | |
1224 cp_data->cp_user_data_ul.rp_error.rp_user_data. | |
1225 v_tpdu = TRUE; | |
1226 /* | |
1227 cp_data->cp_user_data_ul.rp_error.rp_user_data. | |
1228 sms_deliver_rep_err.tp_fcs = (UBYTE)error; | |
1229 */ | |
1230 } | |
1231 | |
1232 ccd_codeMsg (CCDENT_SMS, | |
1233 UPLINK, | |
1234 (T_MSGBUF *) &data_req->sdu, | |
1235 (UBYTE *) cp_data, | |
1236 NOT_PRESENT_8BIT); | |
1237 /*lint -e415 -e416 Likely creation/access of out-of-bounds pointer */ | |
1238 data_req->sdu.buf[3] = (ti << 4) + PD_SMS; | |
1239 data_req->sdu.o_buf = ENCODE_OFFSET - BSIZE_TI_PD; | |
1240 data_req->sdu.l_buf += BSIZE_TI_PD; | |
1241 | |
1242 if (stk_cmd NEQ NULL) | |
1243 { | |
1244 /* | |
1245 * response from a SIM Toolkit command | |
1246 */ | |
1247 if (stk_cmd->l_cmd NEQ 0) | |
1248 { | |
1249 /* | |
1250 * response TPDU available | |
1251 */ | |
1252 /* change length of rp-error */ | |
1253 data_req->sdu.buf[5] += ((stk_cmd->l_cmd >> 3) + 2); | |
1254 /* add IEI for rp user data */ | |
1255 data_req->sdu.buf[10] = 0x41; | |
1256 /* add length for rp user data */ | |
1257 data_req->sdu.buf [11] = stk_cmd->l_cmd >> 3; | |
1258 /* add TPDU */ | |
1259 memcpy (&data_req->sdu.buf [12], | |
1260 &stk_cmd->cmd[stk_cmd->o_cmd>>3], | |
1261 stk_cmd->l_cmd>>3); | |
1262 /* modify length of CP Data */ | |
1263 data_req->sdu.l_buf += (stk_cmd->l_cmd + 16); | |
1264 } | |
1265 } | |
1266 /*lint +e415 +e416 Likely creation/access of out-of-bounds pointer */ | |
1267 } | |
1268 #endif /* GPRS */ | |
1269 | |
1270 /* | |
1271 +--------------------------------------------------------------------+ | |
1272 | PROJECT : GSM-PS (8410) MODULE : SMS_RL | | |
1273 | STATE : code ROUTINE : rl_build_rp_smma | | |
1274 +--------------------------------------------------------------------+ | |
1275 | |
1276 PURPOSE : Processing the function RL_BUILD_RP_SMMA. | |
1277 | |
1278 */ | |
1279 | |
1280 GLOBAL void rl_build_rp_smma (UBYTE msg_ref, | |
1281 T_U_CP_DATA *cp_data) | |
1282 { | |
1283 TRACE_FUNCTION ("rl_build_rp_smma()"); | |
1284 | |
1285 cp_data->cp_user_data_ul.rp_mti = RP_SMMA_UL; | |
1286 cp_data->cp_user_data_ul.reference = msg_ref; | |
1287 | |
1288 cp_data->cp_user_data_ul.v_rp_data_ul = FALSE; | |
1289 cp_data->cp_user_data_ul.v_rp_error = FALSE; | |
1290 cp_data->cp_user_data_ul.v_rp_ack = FALSE; | |
1291 } | |
1292 | |
1293 /* | |
1294 +--------------------------------------------------------------------+ | |
1295 | PROJECT : GSM-PS (8410) MODULE : SMS_RL | | |
1296 | STATE : code ROUTINE : rl_temp_failure | | |
1297 +--------------------------------------------------------------------+ | |
1298 | |
1299 PURPOSE : Processing the function RL_TEMP_FAILURE. | |
1300 This is valid for memory available notification attempt. | |
1301 [04.11 Table 8.4 part 3] | |
1302 */ | |
1303 | |
1304 GLOBAL UBYTE rl_temp_failure (UBYTE cause) | |
1305 { | |
1306 TRACE_FUNCTION ("rl_temp_failure()"); | |
1307 | |
1308 switch (cause) | |
1309 { | |
1310 case SMS_RP_CS_UNKNOWN_SUBSCRIBER: | |
1311 case SMS_RP_CS_FAC_NOT_IMPL: | |
1312 case SMS_RP_CS_SEM_INC_MSG: | |
1313 case SMS_RP_CS_INV_MAND_INFO: | |
1314 case SMS_RP_CS_MSG_NON_EXIST: | |
1315 case SMS_RP_CS_MSG_NOT_COMP: | |
1316 case SMS_RP_CS_INFO_NON_EXIST: | |
1317 case SMS_RP_CS_PROTOCOL_ERROR: | |
1318 case SMS_RP_CS_INTERWORKING: | |
1319 return FALSE; /* Non-temporary */ | |
1320 | |
1321 default: | |
1322 return TRUE; /* Temporary */ | |
1323 } | |
1324 } | |
1325 | |
1326 #endif /* #ifndef SMS_RL_C */ |