comparison src/g23m-fad/udp/udp_kerp.c @ 1:fa8dc04885d8

src/g23m-*: import from Magnetite
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 16 Oct 2020 06:25:50 +0000
parents
children
comparison
equal deleted inserted replaced
0:4e78acac3d88 1:fa8dc04885d8
1 /*
2 +----------------------------------------------------------------------------
3 | Project :
4 | Modul :
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 processing
18 | of incomming primitives for the component
19 | Internet Protocol of the mobile station
20 +----------------------------------------------------------------------------
21 */
22
23 #define ENTITY_UDP
24
25 /*==== INCLUDES ===================================================*/
26
27 #include <string.h>
28 #include "typedefs.h"
29 #include "pcm.h"
30 #include "pconst.cdg"
31 #include "mconst.cdg"
32 #include "message.h"
33 #include "ccdapi.h"
34 #include "vsi.h"
35 #include "macdef.h" /* To get PFREE_DESC2 */
36 #include "custom.h"
37 #include "gsm.h"
38 #include "prim.h"
39 #include "cnf_udp.h"
40 #include "mon_udp.h"
41 #include "pei.h"
42 #include "tok.h"
43 #include "dti.h" /* To get DTI lib */
44 #include "udp.h"
45
46 /*==== CONST =======================================================*/
47
48 /*==== TYPES =======================================================*/
49
50 /*==== VAR EXPORT ==================================================*/
51
52 /*==== VAR LOCAL ===================================================*/
53
54 /*==== MACROS ======================================================*/
55
56 /*==== Prototypes ==================================================*/
57
58 /*==== FUNCTIONS ===================================================*/
59
60 /*
61 +--------------------------------------------------------------------+
62 | PROJECT : WAP MODULE : UDP_KERP |
63 | STATE : code ROUTINE : ker_udpa_dti_req |
64 +--------------------------------------------------------------------+
65
66 PURPOSE : Process UDPA_DTI_REQ primitive
67 */
68
69 void ker_udpa_dti_req (T_UDPA_DTI_REQ * udpa_dti_req)
70 {
71 BOOL confirm = TRUE;
72 UBYTE dti_conn = UDPA_DISCONNECT_DTI;
73 PACCESS (udpa_dti_req);
74
75 TRACE_FUNCTION ("ker_udpa_dti_req()");
76
77 switch (GET_STATE (KER))
78 {
79 case DEACTIVATED:
80 {
81 switch (udpa_dti_req->dti_conn)
82 {
83 case UDPA_CONNECT_DTI:
84 {
85 switch (udpa_dti_req->dti_direction)
86 {
87 case UDPA_DTI_TO_HIGHER_LAYER:
88 if (! * udp_data->hila.entity_name)
89 {
90 hCommHL = vsi_c_open (
91 VSI_CALLER (char *) udpa_dti_req->entity_name
92 );
93 if (hCommHL > VSI_OK)
94 {
95 udp_data->hila.link_id = udpa_dti_req->link_id;
96 strcpy (
97 udp_data->hila.entity_name,
98 (char *) udpa_dti_req->entity_name
99 );
100 SET_STATE (HILA, CONNECTING);
101 if (dti_open (
102 udp_hDTI,
103 UDP_DTI_DEF_INSTANCE,
104 UDP_DTI_HL_INTERFACE,
105 UDP_DTI_DEF_CHANNEL,
106 UDP_DTI_INIT_QUEUE_SIZE,
107 DTI_CHANNEL_TO_HIGHER_LAYER,
108 FLOW_CNTRL_ENABLED,
109 DTI_VERSION_10,
110 (U8 *) udpa_dti_req->entity_name,
111 udpa_dti_req->link_id
112 ) EQ TRUE)
113 {
114 confirm = FALSE;
115 }
116 else /* dti_open failed, close VSI handle: */
117 {
118 vsi_c_close (VSI_CALLER hCommHL);
119 hCommHL = VSI_ERROR;
120 }
121 }
122 }
123 else
124 {
125 TRACE_ERROR ("DTI link to higher layer already requested");
126 }
127 break;
128
129 case UDPA_DTI_TO_LOWER_LAYER:
130 if (! * udp_data->lola.entity_name)
131 {
132 udp_data->lola.link_id = udpa_dti_req->link_id;
133 strcpy (
134 udp_data->lola.entity_name,
135 (char *) udpa_dti_req->entity_name
136 );
137 SET_STATE (LOLA, CONNECTING);
138 if (dti_open (
139 udp_hDTI,
140 UDP_DTI_DEF_INSTANCE,
141 UDP_DTI_LL_INTERFACE,
142 UDP_DTI_DEF_CHANNEL,
143 UDP_DTI_INIT_QUEUE_SIZE,
144 DTI_CHANNEL_TO_LOWER_LAYER,
145 FLOW_CNTRL_ENABLED,
146 DTI_VERSION_10,
147 (U8 *) udpa_dti_req->entity_name,
148 udpa_dti_req->link_id
149 ) EQ TRUE)
150 {
151 confirm = FALSE;
152 }
153 }
154 else
155 {
156 TRACE_ERROR ("DTI link to lower layer already requested");
157 }
158 break;
159
160 default:
161 TRACE_ERROR("illegal parameter (udpa_dti_req->dti_direction)");
162 } /* End switch (udpa_dti_req->dti_direction) */
163 dti_conn = UDPA_DISCONNECT_DTI;
164 break;
165 }
166
167 case UDPA_DISCONNECT_DTI:
168 {
169 if (udp_data->hila.link_id EQ udpa_dti_req->link_id)
170 {
171 dti_close (
172 udp_hDTI,
173 UDP_DTI_DEF_INSTANCE,
174 UDP_DTI_HL_INTERFACE,
175 UDP_DTI_DEF_CHANNEL,
176 FALSE
177 );
178 *udp_data->hila.entity_name = 0;
179 SET_STATE (HILA, DOWN);
180 dti_conn = UDPA_DISCONNECT_DTI;
181
182 vsi_c_close (VSI_CALLER hCommHL);
183 hCommHL = VSI_ERROR;
184 /*XXX check for remaining UP/DOWN-LINK DTI connections, XXX*/
185 /*XXX terminate_ip() if noting left open XXX*/
186 }
187 else if (udp_data->lola.link_id EQ udpa_dti_req->link_id)
188 {
189 dti_close (
190 udp_hDTI,
191 UDP_DTI_DEF_INSTANCE,
192 UDP_DTI_LL_INTERFACE,
193 UDP_DTI_DEF_CHANNEL,
194 FALSE
195 );
196 *udp_data->lola.entity_name = 0;
197 SET_STATE (LOLA, DOWN);
198 dti_conn = UDPA_DISCONNECT_DTI;
199
200 /*XXX check for remaining UP/DOWN-LINK DTI connections, XXX*/
201 /*XXX terminate_ip() if noting left open XXX*/
202 }
203 else
204 {
205 TRACE_ERROR ("illegal parameter (udpa_dti_req->dti_conn)");
206 dti_conn = UDPA_CONNECT_DTI;
207 }
208 }
209 break;
210 } /* End switch (udpa_dti_req->dti_conn) */
211 break;
212 }
213
214 case ACTIVE_NC:
215 switch (udpa_dti_req->dti_conn)
216 {
217 case UDPA_DISCONNECT_DTI:
218 if (udp_data->hila.link_id EQ udpa_dti_req->link_id)
219 {
220 dti_close (
221 udp_hDTI,
222 UDP_DTI_DEF_INSTANCE,
223 UDP_DTI_HL_INTERFACE,
224 UDP_DTI_DEF_CHANNEL,
225 FALSE
226 );
227 *udp_data->hila.entity_name = 0;
228 SET_STATE (HILA, DOWN);
229 dti_conn = UDPA_DISCONNECT_DTI;
230 SET_STATE (KER, DEACTIVATED);
231
232 vsi_c_close (VSI_CALLER hCommHL);
233 hCommHL = VSI_ERROR;
234 }
235 else if (udp_data->lola.link_id EQ udpa_dti_req->link_id)
236 {
237 dti_close (
238 udp_hDTI,
239 UDP_DTI_DEF_INSTANCE,
240 UDP_DTI_LL_INTERFACE,
241 UDP_DTI_DEF_CHANNEL,
242 FALSE
243 );
244 *udp_data->lola.entity_name = 0;
245 SET_STATE (LOLA, DOWN);
246 dti_conn = UDPA_DISCONNECT_DTI;
247 SET_STATE (KER, DEACTIVATED);
248 }
249 break;
250 default:
251 TRACE_ERROR ("unexpected parameter (udpa_dti_req->dti_conn)");
252 dti_conn = UDPA_DISCONNECT_DTI;
253 break;
254 } /* End switch (udpa_dti_req->dti_conn) */
255 break;
256
257 case CONNECTED:
258 default:
259 TRACE_ERROR ("unexpected UDPA_DTI_REQ");
260 if (udpa_dti_req->dti_conn EQ UDPA_CONNECT_DTI)
261 dti_conn = UDPA_DISCONNECT_DTI;
262 else
263 dti_conn = UDPA_CONNECT_DTI;
264 break;
265 } /* End switch (GET_STATE (KER)) */
266
267 if (confirm)
268 {
269 PALLOC (udpa_dti_cnf, UDPA_DTI_CNF);
270 udpa_dti_cnf->dti_conn = dti_conn;
271 udpa_dti_cnf->link_id = udpa_dti_req->link_id;
272 PSENDX (ACI, udpa_dti_cnf);
273 }
274 PFREE (udpa_dti_req);
275 }
276
277 /*
278 +--------------------------------------------------------------------+
279 | PROJECT : WAP MODULE : UDP_KERP |
280 | STATE : code ROUTINE : sig_dti_ker_tx_buffer_ready_ll_ind |
281 +--------------------------------------------------------------------+
282
283 PURPOSE : Process signal SIG_DTI_KER_TX_BUFFER_READY_DN_IND
284 */
285
286 void sig_dti_ker_tx_buffer_ready_ll_ind ()
287 {
288 TRACE_FUNCTION ("sig_dti_ker_tx_buffer_ready_ll_ind()");
289
290 switch (GET_STATE (KER))
291 {
292 case ACTIVE_NC: /* DTI_READY_IND not received yet */
293 SET_STATE (HILA, WAIT);
294 break;
295
296 case CONNECTED:
297 {
298 T_KER * p_ker = & udp_data->ker;
299 T_HILA * p_ul = & udp_data->hila;
300
301 /* Check if an ICMP message shall be sent */
302
303 if (p_ker->send_icmp)
304 {
305 T_DTI2_DATA_REQ * dti_data_req;
306
307 p_ker->send_icmp = FALSE;
308
309 if(p_ker->dti_data_req_icmp)
310 {
311 dti_data_req = p_ker->dti_data_req_icmp;
312 p_ker->dti_data_req_icmp = NULL;
313 }
314 else
315 {
316 TRACE_ERROR("no ICMP message ready!");
317 return;
318 }
319
320 dti_data_req->parameters.p_id = DTI_PID_IP;
321 dti_data_req->parameters.st_lines.st_flow = DTI_FLOW_ON;
322 dti_data_req->parameters.st_lines.st_line_sa = DTI_SA_ON;
323 dti_data_req->parameters.st_lines.st_line_sb = DTI_SB_ON;
324 dti_data_req->parameters.st_lines.st_break_len = DTI_BREAK_OFF;
325
326 PACCESS (dti_data_req);
327 {
328 PPASS (dti_data_req, dti_data_ind, DTI2_DATA_IND);
329 dti_send_data (
330 udp_hDTI,
331 UDP_DTI_DEF_INSTANCE,
332 UDP_DTI_LL_INTERFACE,
333 UDP_DTI_DEF_CHANNEL,
334 dti_data_ind
335 );
336 }
337
338 /* Call dti_start to indicate ready */
339
340 dti_start (
341 udp_hDTI,
342 UDP_DTI_DEF_INSTANCE,
343 UDP_DTI_HL_INTERFACE,
344 UDP_DTI_DEF_CHANNEL
345 );
346 }
347 /* If we have got a ready indication from LL - send dti_data_req */
348 else if (GET_STATE (HILA) EQ SEND AND p_ul->dti_data_req)
349 {
350 p_ul->dti_data_req->parameters.p_id = DTI_PID_IP;
351 p_ul->dti_data_req->parameters.st_lines.st_flow = DTI_FLOW_ON;
352 p_ul->dti_data_req->parameters.st_lines.st_line_sa = DTI_SA_ON;
353 p_ul->dti_data_req->parameters.st_lines.st_line_sb = DTI_SB_ON;
354 p_ul->dti_data_req->parameters.st_lines.st_break_len = DTI_BREAK_OFF;
355
356 PACCESS (p_ul->dti_data_req);
357 {
358 PPASS (p_ul->dti_data_req, dti_data_ind, DTI2_DATA_IND);
359 dti_send_data (
360 udp_hDTI,
361 UDP_DTI_DEF_INSTANCE,
362 UDP_DTI_LL_INTERFACE,
363 UDP_DTI_DEF_CHANNEL,
364 dti_data_ind
365 );
366 }
367 p_ul->dti_data_req = NULL;
368 dti_start (
369 udp_hDTI,
370 UDP_DTI_DEF_INSTANCE,
371 UDP_DTI_HL_INTERFACE,
372 UDP_DTI_DEF_CHANNEL
373 );
374 }
375 else
376 {
377 SET_STATE (HILA, WAIT);
378 }
379 }
380 break;
381
382 default:
383 break;
384 }
385 }
386
387 /*
388 +--------------------------------------------------------------------+
389 | PROJECT : WAP MODULE : UDP_KERP |
390 | STATE : code ROUTINE : sig_dti_ker_data_received_hl_ind |
391 +--------------------------------------------------------------------+
392
393 PURPOSE : Process signal SIG_DTI_KER_DATA_RECEIVED_UP_IND
394 */
395
396 void sig_dti_ker_data_received_hl_ind (T_DTI2_DATA_REQ * dti_data_req)
397 {
398 PACCESS (dti_data_req);
399
400 TRACE_FUNCTION ("sig_dti_ker_data_received_hl_ind()");
401
402 switch (GET_STATE (KER))
403 {
404 case CONNECTED:
405 {
406 T_HILA * p_ul = & udp_data->hila;
407 T_KER * p_ker = & udp_data->ker;
408
409 dti_stop (
410 udp_hDTI,
411 UDP_DTI_DEF_INSTANCE,
412 UDP_DTI_HL_INTERFACE,
413 UDP_DTI_DEF_CHANNEL
414 );
415
416 #ifdef _SIMULATION_
417 /* Get the T_SRC_DES out of the first and only descriptor
418 * created by DTILIB and put it in a descriptor of its own */
419
420 if (dti_data_req->desc_list2.first &&
421 dti_data_req->desc_list2.list_len >= sizeof(T_SRC_DES))
422 {
423 // The following is mostly taken from UDPa_sendRequest() from module
424 // wap_udpc.c to achieve the same behaviour. (Issue UDP-FIX-21925)
425 // The desc from the desc_list2 is splitted into a linked desc list
426 // to simulate large data chunks (such large data chunks are spread over
427 // in several decs in the list).
428 T_desc2 *desc, *first_desc;
429 ULONG *pLast;
430 USHORT len, dataSize, data_length;
431 const char *data_p;
432 USHORT BLOCK_SIZE = 50;
433
434 first_desc = (T_desc2 *) dti_data_req->desc_list2.first;
435 data_length = dti_data_req->desc_list2.list_len;
436
437 /* Build the T_desc2 for IP addresses and ports */
438 desc = M_ALLOC (offsetof (T_desc2, buffer) + sizeof (T_SRC_DES));
439
440 // update the desc list
441 dti_data_req->desc_list2.first = (ULONG) desc;
442 desc->offset = 0;
443 desc->len = sizeof (T_SRC_DES);
444 desc->size = sizeof (T_SRC_DES);
445
446 // copy IP addresses and ports
447 memcpy(desc->buffer, &first_desc->buffer[first_desc->offset],desc->len);
448
449 /* Build the desc for the UDP data */
450 pLast = &desc->next;
451 len = data_length - desc->len;
452 data_p = &first_desc->buffer [first_desc->offset + desc->len];;
453 while (len >0)
454 {
455 if (len > BLOCK_SIZE)
456 {
457 dataSize = BLOCK_SIZE;
458 }
459 else
460 {
461 dataSize = len;
462 }
463 MALLOC (desc, (USHORT)(sizeof(T_desc2) - 1 + dataSize));
464 memcpy( desc->buffer, data_p, dataSize);
465 desc->offset = 0;
466 desc->len = dataSize;
467 desc->size = dataSize;
468 len -= dataSize;
469 data_p += dataSize;
470 *pLast = (ULONG) desc;
471 pLast = &desc->next;
472 }
473
474 MFREE (first_desc);
475 }
476 #endif /* _SIMULATION_ */
477
478 p_ul->dti_data_req = dti_data_req;
479
480 if (p_ul->drop_packet)
481 {
482 p_ul->drop_packet = FALSE;
483 PFREE_DESC2 (p_ul->dti_data_req);
484 p_ul->dti_data_req = NULL;
485 dti_start (
486 udp_hDTI,
487 UDP_DTI_DEF_INSTANCE,
488 UDP_DTI_LL_INTERFACE,
489 UDP_DTI_DEF_CHANNEL
490 );
491 }
492 else
493 {
494 /* Get the IP addresses and the ports from HL */
495
496 T_desc2 * desc = (T_desc2 *) p_ul->dti_data_req->desc_list2.first;
497 T_SRC_DES * p_SrcDes;
498 USHORT old_len;
499
500 if (desc == NULL) {
501 TRACE_ERROR (
502 "Hila's T_desc2 is NULL in "
503 "sig_dti_ker_data_received_hl_ind()."
504 );
505 return;
506 }
507
508 p_SrcDes = (T_SRC_DES *) (desc->buffer + desc->offset);
509
510 memcpy (& p_ker->src_addr, p_SrcDes->src_ip, 4);
511 memcpy (& p_ker->dst_addr, p_SrcDes->des_ip, 4);
512 memcpy (& p_ker->src_port, p_SrcDes->src_port, 2);
513 memcpy (& p_ker->dst_port, p_SrcDes->des_port, 2);
514
515 old_len = p_ul->dti_data_req->desc_list2.list_len;
516 p_ul->dti_data_req->desc_list2.first = desc->next;
517 p_ul->dti_data_req->desc_list2.list_len =
518 (USHORT) (old_len - sizeof (T_SRC_DES));
519 p_ul = & udp_data->hila;
520 MFREE (desc);
521 }
522
523 /* Send IP_ADDR_REQ to LL */
524 {
525 PALLOC (ip_addr_req, IP_ADDR_REQ);
526 ip_addr_req->dst_addr = p_ker->dst_addr;
527 ip_addr_req->trans_prot = UDP_PROTOCOL;
528 PSENDX (LL, ip_addr_req);
529 }
530 }
531 break;
532
533 default:
534 PFREE_DESC2 (dti_data_req);
535 break;
536 }
537 }
538
539 /*
540 +--------------------------------------------------------------------+
541 | PROJECT : WAP MODULE : udp_kerp.c |
542 | STATE : code ROUTINE : ker_ip_addr_cnf |
543 +--------------------------------------------------------------------+
544
545 PURPOSE : Process primitive T_IP_ADDR_CNF
546 */
547
548 void ker_ip_addr_cnf (T_IP_ADDR_CNF * ip_addr_cnf)
549 {
550 TRACE_FUNCTION ("ker_ip_addr_cnf()");
551 PACCESS (ip_addr_cnf);
552
553 switch (GET_STATE (KER))
554 {
555 case CONNECTED:
556 {
557 T_KER * p_ker = & udp_data->ker;
558 T_HILA * p_ul = & udp_data->hila;
559 BOOL send_ready_ind = FALSE;
560
561 /* No error ? */
562 if (ip_addr_cnf->err NEQ IP_ADDR_NOERROR)
563 {
564 PALLOC (udp_error_ind, UDP_ERROR_IND);
565 udp_error_ind->dst_port = p_ker->dst_port;
566 udp_error_ind->src_port = p_ker->src_port;
567 udp_error_ind->err_msg = ip_addr_cnf->err;
568 udp_error_ind->src_addr = ip_addr_cnf->src_addr;
569 udp_error_ind->dst_addr = p_ker->dst_addr;
570 PSENDX (HL, udp_error_ind);
571 p_ul->drop_packet = TRUE; /* Packet error - drop it */
572 }
573 /* Is the address correct ? */
574 else if (ip_addr_cnf->src_addr NEQ p_ker->src_addr)
575 {
576 PALLOC (udp_error_ind, UDP_ERROR_IND);
577 udp_error_ind->dst_port = p_ker->dst_port;
578 udp_error_ind->src_port = p_ker->src_port;
579 udp_error_ind->err_msg = IP_ADDR_NOROUTE;
580 udp_error_ind->src_addr = ip_addr_cnf->src_addr;
581 udp_error_ind->dst_addr = p_ker->dst_addr;
582 PSENDX (HL, udp_error_ind);
583 p_ul->drop_packet = TRUE; /* Packet error - drop it */
584 }
585 else /* Build the "standard" packet for higher layer */
586 {
587 udp_build_packet (TRUE, B_NORMAL_PACKET);
588 }
589
590 /* ICMP sent at first */
591 if (p_ker->send_icmp && GET_STATE (HILA) EQ WAIT)
592 {
593 T_DTI2_DATA_REQ * dti_data_req;
594 dti_data_req = p_ker->dti_data_req_icmp;
595 dti_data_req->parameters.p_id = DTI_PID_IP;
596 dti_data_req->parameters.st_lines.st_flow = DTI_FLOW_ON;
597 dti_data_req->parameters.st_lines.st_line_sa = DTI_SA_ON;
598 dti_data_req->parameters.st_lines.st_line_sb = DTI_SB_ON;
599 dti_data_req->parameters.st_lines.st_break_len = DTI_BREAK_OFF;
600
601 PACCESS (dti_data_req);
602 {
603 PPASS (dti_data_req, dti_data_ind, DTI2_DATA_IND);
604 dti_send_data (
605 udp_hDTI,
606 UDP_DTI_DEF_INSTANCE,
607 UDP_DTI_LL_INTERFACE,
608 UDP_DTI_DEF_CHANNEL,
609 dti_data_ind
610 );
611 }
612 p_ker->dti_data_req_icmp = NULL;
613 SET_STATE (HILA, SEND);
614
615 /* Call dti_start to indicate ready for new packet */
616 dti_start (
617 udp_hDTI,
618 UDP_DTI_DEF_INSTANCE,
619 UDP_DTI_LL_INTERFACE,
620 UDP_DTI_DEF_CHANNEL
621 );
622 }
623
624 /* Packet not correct - drop it */
625 if (p_ul->drop_packet)
626 {
627 p_ul->drop_packet = FALSE;
628 PFREE_DESC2 (p_ul->dti_data_req);
629 p_ul->dti_data_req = NULL;
630 send_ready_ind = TRUE;
631 }
632 else
633 {
634 /* We have got a ready indication from LL -> send */
635
636 if (GET_STATE (HILA) EQ WAIT) /* Send dti_data_req packet */
637 {
638 p_ul->dti_data_req->parameters.p_id = DTI_PID_IP;
639 p_ul->dti_data_req->parameters.st_lines.st_flow = DTI_FLOW_ON;
640 p_ul->dti_data_req->parameters.st_lines.st_line_sa = DTI_SA_ON;
641 p_ul->dti_data_req->parameters.st_lines.st_line_sb = DTI_SB_ON;
642 p_ul->dti_data_req->parameters.st_lines.st_break_len=DTI_BREAK_OFF;
643
644 PACCESS (p_ul->dti_data_req);
645 {
646 PPASS (p_ul->dti_data_req, dti_data_ind, DTI2_DATA_IND);
647 dti_send_data (
648 udp_hDTI,
649 UDP_DTI_DEF_INSTANCE,
650 UDP_DTI_LL_INTERFACE,
651 UDP_DTI_DEF_CHANNEL,
652 dti_data_ind
653 );
654 }
655 SET_STATE (HILA, IDLE);
656 send_ready_ind = TRUE;
657 p_ul->dti_data_req = NULL;
658 }
659 else
660 {
661 SET_STATE (HILA, SEND);
662 send_ready_ind = FALSE;
663 }
664 }
665
666 /* Send dti_ready indication */
667 if (send_ready_ind)
668 {
669 dti_start (
670 udp_hDTI,
671 UDP_DTI_DEF_INSTANCE,
672 UDP_DTI_HL_INTERFACE,
673 UDP_DTI_DEF_CHANNEL
674 );
675 }
676 PFREE (ip_addr_cnf);
677 }
678 break;
679
680 default:
681 PFREE (ip_addr_cnf);
682 break;
683 }
684 }
685
686 /*
687 +--------------------------------------------------------------------+
688 | PROJECT : WAP MODULE : udp_kerp.c |
689 | STATE : code ROUTINE : sig_dti_ker_data_received_ll_ind |
690 +--------------------------------------------------------------------+
691
692 PURPOSE : Process signal SIG_DTI_KER_DATA_RECEIVED_DN_IND
693 */
694
695 void sig_dti_ker_data_received_ll_ind (T_DTI2_DATA_IND * dti_data_ind)
696 {
697 TRACE_FUNCTION ("sig_dti_ker_data_received_ll_ind()");
698 PACCESS (dti_data_ind);
699
700 switch (GET_STATE (KER))
701 {
702 case CONNECTED:
703 {
704 USHORT calc_chksum, header_chksum, start_udp, udp_len;
705 UBYTE prot;
706 BOOL send_getdata_req = FALSE;
707 UBYTE * ip_header;
708 T_desc_list2 * desc_list;
709 T_desc2 * desc;
710
711 T_KER * p_ker = & udp_data->ker;
712 T_LOLA * p_dl = & udp_data->lola;
713
714 dti_stop (
715 udp_hDTI,
716 UDP_DTI_DEF_INSTANCE,
717 UDP_DTI_LL_INTERFACE,
718 UDP_DTI_DEF_CHANNEL
719 );
720
721 /* Build necessary variable */
722
723 p_dl->dti_data_ind = dti_data_ind;
724 p_dl->state_err = STATE_DL_NO_ERROR;
725
726 desc_list = & p_dl->dti_data_ind->desc_list2;
727 desc = (T_desc2 *) desc_list->first;
728
729 if (
730 desc == NULL ||
731 desc->len < LEN_IP_HEADER_B ||
732 GET_IP_HEADER_LEN_B (desc->buffer + desc->offset) < LEN_IP_HEADER_B ||
733 desc->len < GET_IP_HEADER_LEN_B (desc->buffer + desc->offset) +
734 LEN_UDP_HEADER_B
735 ) {
736 TRACE_ERROR (
737 "Lola's UDP packet is too short in "
738 "sig_dti_ker_data_received_ll_ind()."
739 );
740 return;
741 }
742
743 ip_header = desc->buffer + desc->offset;
744 start_udp = (USHORT) GET_IP_HEADER_LEN_B (ip_header);
745
746 /* Fill in port numbers and IP addresses */
747
748 p_dl->src_addr = GET_IP_SOURCE_ADDR (ip_header);
749 p_dl->dst_addr = GET_IP_DEST_ADDR (ip_header);
750 p_dl->src_port = (USHORT) GET_UDP_SRC_PORT (ip_header, start_udp);
751 p_dl->dst_port = (USHORT) GET_UDP_DST_PORT (ip_header, start_udp);
752
753 udp_len = (USHORT) GET_UDP_LEN (ip_header, start_udp);
754 prot = GET_IP_PROT (ip_header);
755
756 /* Check if ICMP Message, if yes - send UDP_ERROR_IND */
757
758 if (GET_IP_PROT (ip_header) EQ ICMP_PROT)
759 {
760 USHORT pos_icmp = (USHORT) GET_IP_HEADER_LEN_B (ip_header);
761
762 p_dl->drop_packet = TRUE;
763 p_dl->state_err = STATE_DL_ERROR;
764 {
765 PALLOC (udp_error_ind, UDP_ERROR_IND);
766 udp_error_ind->dst_port = p_dl->dst_port;
767 udp_error_ind->src_port = p_dl->src_port;
768 udp_error_ind->err_msg = GET_ICMP_TYPE (ip_header, pos_icmp);
769 udp_error_ind->src_addr = GET_IP_SOURCE_ADDR (ip_header);
770 udp_error_ind->dst_addr = GET_IP_DEST_ADDR (ip_header);
771 PSENDX (HL, udp_error_ind);
772 }
773 }
774 else /* No ICMP_PROT */
775 {
776 {
777 ULONG overlay;
778 UBYTE pseudo_header [LEN_PSEUDO_HEADER_B];
779
780 /* Build the pseudoheader for the calculation of the checksum */
781
782 SET_UDP_PSEUDO_H_SRC_ADDR (pseudo_header, p_dl->src_addr);
783 SET_UDP_PSEUDO_H_DEST_ADDR (pseudo_header, p_dl->dst_addr);
784 SET_UDP_PSEUDO_H_ZERO (pseudo_header, 0);
785 SET_UDP_PSEUDO_H_PROT (pseudo_header, prot);
786 SET_UDP_PSEUDO_H_LEN (pseudo_header, udp_len);
787
788 /* Calculate a part of the checksum for the pseudoheader */
789 overlay = partial_checksum (pseudo_header, LEN_PSEUDO_HEADER_B);
790
791 /* Calculate for the UDP header and the data */
792 header_chksum = (USHORT) GET_UDP_CHK_SUM (ip_header, start_udp);
793 RESET_UDP_CHKSUM (ip_header, start_udp);
794 calc_chksum = desc_checksum (desc_list, start_udp, overlay);
795 SET_UDP_CHKSUM (ip_header, start_udp, header_chksum);
796 }
797
798 /* Packet checksum error ? */
799 if (header_chksum NEQ calc_chksum)
800 {
801 p_dl->drop_packet = TRUE;
802 }
803 else
804 {
805
806 #define POS_UDP_DEST_PORT 1
807
808
809 /* Is it the correct port ? */
810 if (p_ker->src_port EQ p_dl->dst_port)
811 {
812 udp_build_packet (FALSE, B_NORMAL_PACKET);
813 }
814 else
815 {
816 /* Build ICMP packet for no dest port.
817 * If LL is ready to collect then send */
818 udp_build_packet (FALSE, B_NO_DEST_PORT);
819 p_ker->send_icmp = TRUE;
820 }
821 }
822 } /* No ICMP_PROT */
823
824 /* Packet is not correct -> drop it and free the primitive */
825 if (p_dl->drop_packet)
826 {
827 p_dl->drop_packet = FALSE;
828 PFREE_DESC2 (p_dl->dti_data_ind);
829 p_dl->dti_data_ind = NULL;
830 send_getdata_req = TRUE;
831 }
832 else
833 {
834 /* An ICMP message - send it */
835 if (p_ker->send_icmp)
836 {
837 UBYTE state = GET_STATE (LOLA);
838 if (state EQ IDLE OR state EQ WAIT)
839 {
840 T_DTI2_DATA_REQ * dti_data_req;
841
842 udp_data->ker.send_icmp = FALSE;
843
844 dti_data_req = p_ker->dti_data_req_icmp;
845 dti_data_req->parameters.p_id = DTI_PID_IP;
846 dti_data_req->parameters.st_lines.st_flow = DTI_FLOW_ON;
847 dti_data_req->parameters.st_lines.st_line_sa = DTI_SA_ON;
848 dti_data_req->parameters.st_lines.st_line_sb = DTI_SB_ON;
849 dti_data_req->parameters.st_lines.st_break_len = DTI_BREAK_OFF;
850
851 PACCESS (dti_data_req);
852 {
853 PPASS (dti_data_req, dti_data_indication, DTI2_DATA_IND);
854 dti_send_data (
855 udp_hDTI,
856 UDP_DTI_DEF_INSTANCE,
857 UDP_DTI_LL_INTERFACE,
858 UDP_DTI_DEF_CHANNEL,
859 dti_data_indication
860 );
861 }
862 SET_STATE (LOLA, IDLE);
863 p_ker->dti_data_req_icmp = NULL;
864 send_getdata_req = TRUE;
865 }
866 }
867 else
868 {
869 /* We have got a DTI2_GETDATA_REQ from LL. Send the packet. */
870
871 if (GET_STATE (LOLA) EQ WAIT)
872 {
873 SET_STATE (LOLA, IDLE);
874
875 p_dl->dti_data_ind->parameters.p_id = DTI_PID_IP;
876 p_dl->dti_data_ind->parameters.st_lines.st_flow = DTI_FLOW_ON;
877 p_dl->dti_data_ind->parameters.st_lines.st_line_sa = DTI_SA_ON;
878 p_dl->dti_data_ind->parameters.st_lines.st_line_sb = DTI_SB_ON;
879 p_dl->dti_data_ind->parameters.st_lines.st_break_len =
880 DTI_BREAK_OFF;
881
882 dti_send_data (
883 udp_hDTI,
884 UDP_DTI_DEF_INSTANCE,
885 UDP_DTI_HL_INTERFACE,
886 UDP_DTI_DEF_CHANNEL,
887 p_dl->dti_data_ind
888 );
889 send_getdata_req = TRUE;
890 p_dl->dti_data_ind = NULL;
891 }
892 else
893 {
894 SET_STATE (LOLA, SEND);
895 }
896 }
897 }
898
899 if (send_getdata_req) /* Send DTI2_GETDATA_REQ to LL */
900 {
901 dti_start (
902 udp_hDTI,
903 UDP_DTI_DEF_INSTANCE,
904 UDP_DTI_LL_INTERFACE,
905 UDP_DTI_DEF_CHANNEL
906 );
907 }
908 }
909 break;
910
911 default:
912 PFREE_DESC2 (dti_data_ind);
913 break;
914 }
915 }
916
917 /*
918 +--------------------------------------------------------------------+
919 | PROJECT : WAP MODULE : udp_kerp.c |
920 | STATE : code ROUTINE : sig_dti_ker_tx_buffer_ready_hl_ind |
921 +--------------------------------------------------------------------+
922
923 PURPOSE : Process signal SIG_DTI_KER_TX_BUFFER_READY_UP_IND
924 */
925
926 void sig_dti_ker_tx_buffer_ready_hl_ind ()
927 {
928 TRACE_FUNCTION ("sig_dti_ker_tx_buffer_ready_hl_ind()");
929
930 switch (GET_STATE (KER))
931 {
932 case CONNECTED:
933 {
934 T_KER * p_ker = & udp_data->ker;
935 T_LOLA * p_dl = & udp_data->lola;
936
937 /* We have bound a port and got a DTI_GETDATA_REQ */
938
939 if (p_ker->port_state EQ PORT_BOUND)
940 {
941 p_ker->port_state = PORT_ACTIVE;
942 dti_start (
943 udp_hDTI,
944 UDP_DTI_DEF_INSTANCE,
945 UDP_DTI_HL_INTERFACE,
946 UDP_DTI_DEF_CHANNEL
947 );
948 }
949
950 /* Send dti_data_ind packet if we have one */
951
952 if (GET_STATE (LOLA) EQ SEND)
953 {
954 p_dl->dti_data_ind->parameters.p_id = DTI_PID_IP;
955 p_dl->dti_data_ind->parameters.st_lines.st_flow = DTI_FLOW_ON;
956 p_dl->dti_data_ind->parameters.st_lines.st_line_sa = DTI_SA_ON;
957 p_dl->dti_data_ind->parameters.st_lines.st_line_sb = DTI_SB_ON;
958 p_dl->dti_data_ind->parameters.st_lines.st_break_len = DTI_BREAK_OFF;
959
960 dti_send_data (
961 udp_hDTI,
962 UDP_DTI_DEF_INSTANCE,
963 UDP_DTI_HL_INTERFACE,
964 UDP_DTI_DEF_CHANNEL,
965 p_dl->dti_data_ind
966 );
967 p_dl->dti_data_ind = NULL;
968 SET_STATE (LOLA, IDLE);
969
970 /* Send DTI2_GETDATA_REQ and indicate ready for new packet */
971
972 dti_start (
973 udp_hDTI,
974 UDP_DTI_DEF_INSTANCE,
975 UDP_DTI_LL_INTERFACE,
976 UDP_DTI_DEF_CHANNEL
977 );
978 }
979 else
980 {
981 /* No data packet to be sent - change state */
982 SET_STATE (LOLA, WAIT);
983 }
984 }
985 break;
986 default:
987 break;
988 }
989 }
990
991 /*
992 +--------------------------------------------------------------------+
993 | PROJECT : WAP MODULE : udp_kerp.c |
994 | STATE : code ROUTINE : ker_udp_bind_cnf |
995 +--------------------------------------------------------------------+
996
997 PURPOSE : Process primitive T_UDP_BIND_CNF
998 */
999
1000 static void ker_udp_bind_cnf (U16 port, U8 err)
1001 {
1002 PALLOC (udp_bind_cnf, UDP_BIND_CNF);
1003
1004 TRACE_FUNCTION ("ker_udp_bind_cnf()");
1005
1006 udp_bind_cnf->port = port;
1007 udp_bind_cnf->err = err;
1008 PSENDX (HL, udp_bind_cnf);
1009 }
1010
1011 /*
1012 +--------------------------------------------------------------------+
1013 | PROJECT : WAP MODULE : udp_kerp.c |
1014 | STATE : code ROUTINE : ker_udp_bind_req |
1015 +--------------------------------------------------------------------+
1016
1017 PURPOSE : Process primitive T_UDP_BIND_REQ
1018 */
1019
1020 void ker_udp_bind_req (T_UDP_BIND_REQ * udp_bind_req)
1021 {
1022 TRACE_FUNCTION ("ker_udp_bind_req()");
1023 PACCESS (udp_bind_req);
1024
1025 switch (GET_STATE (KER))
1026 {
1027 case ACTIVE_NC:
1028 ker_udp_bind_cnf (udp_bind_req->port, UDP_BIND_UDPDOWN);
1029 break;
1030
1031 case CONNECTED:
1032 {
1033 T_KER * p_ker = & udp_data->ker;
1034
1035 if (p_ker->port_state EQ PORT_DOWN)
1036 {
1037 if (udp_bind_req->port EQ NO_PORT)
1038 {
1039 p_ker->src_port = 1025;
1040 }
1041 else
1042 {
1043 p_ker->src_port = udp_bind_req->port;
1044 }
1045 p_ker->port_state = PORT_BOUND;
1046 ker_udp_bind_cnf (p_ker->src_port, UDP_BIND_NOERROR);
1047 }
1048 else /* Port in use */
1049 {
1050 ker_udp_bind_cnf (udp_bind_req->port, UDP_BIND_PORTINUSE);
1051 }
1052 }
1053 break;
1054
1055 case DEACTIVATED:
1056 TRACE_ERROR ("unexpected UDP_BIND_REQ");
1057 break;
1058
1059 default:
1060 break;
1061 }
1062 PFREE (udp_bind_req);
1063 }
1064
1065 /*
1066 +--------------------------------------------------------------------+
1067 | PROJECT : WAP MODULE : udp_kerp.c |
1068 | STATE : code ROUTINE : ker_udp_closeport_req |
1069 +--------------------------------------------------------------------+
1070
1071 PURPOSE : Process primitive T_UDP_CLOSEPORT_REQ
1072 */
1073
1074 void ker_udp_closeport_req (T_UDP_CLOSEPORT_REQ * udp_closeport_req)
1075 {
1076 T_KER * p_ker;
1077
1078 TRACE_FUNCTION ("ker_udp_closeport_req()");
1079 PACCESS (udp_closeport_req);
1080
1081 p_ker = & udp_data->ker;
1082
1083 switch (GET_STATE (KER))
1084 {
1085 case ACTIVE_NC:
1086 case CONNECTED:
1087 /* Close port */
1088 p_ker->src_port = NO_PORT;
1089 p_ker->port_state = PORT_DOWN;
1090 {
1091 PALLOC (udp_closeport_cnf, UDP_CLOSEPORT_CNF);
1092 PSENDX (HL, udp_closeport_cnf);
1093 }
1094 break;
1095
1096 case DEACTIVATED:
1097 TRACE_ERROR ("unexpected UDP_CLOSEPORT_REQ");
1098 break;
1099
1100 default:
1101 break;
1102 }
1103 PFREE (udp_closeport_req);
1104 }
1105
1106 /*
1107 +--------------------------------------------------------------------+
1108 | PROJECT : WAP MODULE : udp_kerp.c |
1109 | STATE : code ROUTINE : ker_udp_error_res |
1110 +--------------------------------------------------------------------+
1111
1112 PURPOSE : Process primitive T_UDP_ERROR_RES
1113 */
1114
1115 void ker_udp_error_res (T_UDP_ERROR_RES * udp_error_res)
1116 {
1117 TRACE_FUNCTION ("ker_udp_error_res()");
1118 PACCESS (udp_error_res);
1119
1120 /* Confirm the error message from ACI */
1121
1122 switch (GET_STATE (KER))
1123 {
1124 case CONNECTED:
1125 {
1126 T_LOLA * p_dl = & udp_data->lola;
1127
1128 if (p_dl->state_err EQ STATE_DL_ERROR)
1129 p_dl->state_err = STATE_DL_NO_ERROR;
1130 else
1131 dti_start (
1132 udp_hDTI,
1133 UDP_DTI_DEF_INSTANCE,
1134 UDP_DTI_LL_INTERFACE,
1135 UDP_DTI_DEF_CHANNEL
1136 );
1137 }
1138 break;
1139 default:
1140 break;
1141 }
1142 PFREE (udp_error_res);
1143 }
1144
1145 /*
1146 +--------------------------------------------------------------------+
1147 | PROJECT : WAP MODULE : UDP_KERP |
1148 | STATE : code ROUTINE : sig_dti_ker_connection_opened_hl_ind |
1149 +--------------------------------------------------------------------+
1150
1151 PURPOSE : Process signal sig_dti_ker_connection_opened_hl_ind
1152 */
1153
1154 void sig_dti_ker_connection_opened_hl_ind ()
1155 {
1156 TRACE_FUNCTION ("sig_dti_ker_connection_opened_hl_ind()");
1157
1158 if (GET_STATE (HILA) EQ CONNECTING)
1159 {
1160 UBYTE state = GET_STATE (LOLA);
1161 SET_STATE (HILA, IDLE);
1162 if (state NEQ CONNECTING AND state NEQ DOWN)
1163 {
1164 SET_STATE (KER, ACTIVE_NC);
1165 }
1166 {
1167 PALLOC (udpa_dti_cnf, UDPA_DTI_CNF);
1168 udpa_dti_cnf->link_id = udp_data->hila.link_id;
1169 udpa_dti_cnf->dti_conn = UDPA_CONNECT_DTI;
1170 PSENDX (ACI, udpa_dti_cnf);
1171 }
1172 }
1173 else
1174 {
1175 TRACE_ERROR ("unexpected dti_connect_ind (from higher layer)");
1176 }
1177 }
1178
1179 /*
1180 +--------------------------------------------------------------------+
1181 | PROJECT : WAP MODULE : UDP_KERP |
1182 | STATE : code ROUTINE : sig_dti_ker_connection_opened_ll_ind |
1183 +--------------------------------------------------------------------+
1184
1185 PURPOSE : Process signal sig_dti_ker_connection_opened_ll_ind
1186 */
1187
1188 void sig_dti_ker_connection_opened_ll_ind ()
1189 {
1190 TRACE_FUNCTION ("sig_dti_ker_connection_opened_ll_ind()");
1191
1192 if (GET_STATE (LOLA) EQ CONNECTING)
1193 {
1194 UBYTE state = GET_STATE (HILA);
1195 SET_STATE (LOLA, IDLE);
1196 if (state NEQ CONNECTING AND state NEQ DOWN)
1197 {
1198 SET_STATE (KER, ACTIVE_NC);
1199 }
1200 {
1201 PALLOC (udpa_dti_cnf, UDPA_DTI_CNF);
1202 udpa_dti_cnf->link_id = udp_data->lola.link_id;
1203 udpa_dti_cnf->dti_conn = UDPA_CONNECT_DTI;
1204 PSENDX (ACI, udpa_dti_cnf);
1205 }
1206 }
1207 else
1208 {
1209 TRACE_ERROR ("unexpected dti_connect_ind (from lower layer)");
1210 }
1211 }
1212
1213 /*
1214 +--------------------------------------------------------------------+
1215 | PROJECT : WAP MODULE : udp_kerp.c |
1216 | STATE : code ROUTINE : ker_udp_shutdown_ind |
1217 +--------------------------------------------------------------------+
1218
1219 PURPOSE :
1220 */
1221
1222 static void ker_udpa_dti_ind (ULONG link_id)
1223 {
1224 PALLOC (udpa_dti_ind, UDPA_DTI_IND);
1225 udpa_dti_ind->link_id = link_id;
1226 PSENDX (ACI, udpa_dti_ind);
1227 }
1228
1229 /*
1230 +--------------------------------------------------------------------+
1231 | PROJECT : WAP MODULE : udp_kerp.c |
1232 | STATE : code ROUTINE : ker_udp_shutdown_ind |
1233 +--------------------------------------------------------------------+
1234
1235 PURPOSE :
1236 */
1237
1238 static void ker_udp_shutdown_ind (void)
1239 {
1240 PALLOC (udp_shutdown_ind, UDP_SHUTDOWN_IND);
1241 PSENDX (HL, udp_shutdown_ind);
1242 }
1243
1244 /*
1245 +--------------------------------------------------------------------+
1246 | PROJECT : WAP MODULE : udp_kerp.c |
1247 | STATE : code ROUTINE : check_port_shutdown_ind |
1248 +--------------------------------------------------------------------+
1249
1250 PURPOSE :
1251 */
1252
1253 static void check_port_shutdown_ind (void)
1254 {
1255 T_KER * p_ker = & udp_data->ker;
1256
1257 TRACE_FUNCTION ("check_port_shutdown_ind()");
1258
1259 if (p_ker->port_state EQ PORT_ACTIVE)
1260 {
1261 p_ker->src_port = NO_PORT;
1262 p_ker->port_state = PORT_DOWN;
1263 ker_udp_shutdown_ind ();
1264 }
1265 }
1266
1267 /*
1268 +--------------------------------------------------------------------+
1269 | PROJECT : WAP MODULE : UDP_KERP |
1270 | STATE : code ROUTINE : sig_dti_ker_connection_closed_hl_ind |
1271 +--------------------------------------------------------------------+
1272
1273 PURPOSE : Process signal sig_dti_ker_connection_closed_hl_ind
1274 */
1275
1276 void sig_dti_ker_connection_closed_hl_ind ()
1277 {
1278 TRACE_FUNCTION ("sig_dti_ker_connection_closed_hl_ind()");
1279
1280 switch (GET_STATE (KER))
1281 {
1282 case CONNECTED:
1283 /*XXX bad case, switch to DEACTIVATED, prune buffers... XXX*/
1284 TRACE_ERROR ("unexpected DTI connection close from higher layer");
1285 check_port_shutdown_ind ();
1286 SET_STATE (KER, DEACTIVATED);
1287 break;
1288 case ACTIVE_NC:
1289 SET_STATE (KER, DEACTIVATED);
1290 break;
1291 default:
1292 break;
1293 }
1294 vsi_c_close (VSI_CALLER hCommHL);
1295 hCommHL = VSI_ERROR;
1296
1297 SET_STATE (HILA, DOWN);
1298 *udp_data->hila.entity_name = 0;
1299 ker_udpa_dti_ind (udp_data->hila.link_id);
1300 }
1301
1302 /*
1303 +--------------------------------------------------------------------+
1304 | PROJECT : WAP MODULE : UDP_KERP |
1305 | STATE : code ROUTINE : sig_dti_ker_connection_closed_ll_ind |
1306 +--------------------------------------------------------------------+
1307
1308 PURPOSE : Process signal sig_dti_ker_connection_closed_ll_ind
1309 */
1310
1311 void sig_dti_ker_connection_closed_ll_ind ()
1312 {
1313 TRACE_FUNCTION ("sig_dti_ker_connection_closed_ll_ind()");
1314
1315 switch (GET_STATE (KER))
1316 {
1317 case CONNECTED:
1318 /*XXX bad case, switch to DEACTIVATED, prune buffers... XXX*/
1319 TRACE_ERROR ("unexpected DTI connection close from lower layer");
1320 check_port_shutdown_ind ();
1321 SET_STATE (KER, DEACTIVATED);
1322 break;
1323 case ACTIVE_NC:
1324 SET_STATE (KER, DEACTIVATED);
1325 break;
1326 default:
1327 break;
1328 }
1329 SET_STATE (LOLA, DOWN);
1330 *udp_data->lola.entity_name = 0;
1331 ker_udpa_dti_ind (udp_data->lola.link_id);
1332 }
1333
1334 /*
1335 +--------------------------------------------------------------------+
1336 | PROJECT : WAP MODULE : udp_kerp.c |
1337 | STATE : code ROUTINE : ker_udpa_config_req |
1338 +--------------------------------------------------------------------+
1339
1340 PURPOSE : Process primitive T_UDPA_CONFIG_REQ
1341 */
1342
1343 void ker_udpa_config_req (T_UDPA_CONFIG_REQ * udpa_config_req)
1344 {
1345 TRACE_FUNCTION ("ker_udpa_config_req()");
1346 PACCESS (udpa_config_req);
1347
1348 /* Configuration of lower layer -> change to state CONNECTED */
1349
1350 switch (GET_STATE (KER))
1351 {
1352 case CONNECTED:
1353 switch (udpa_config_req->cmd)
1354 {
1355 case UDPA_CONFIG_DOWN:
1356 check_port_shutdown_ind ();
1357 SET_STATE (KER, ACTIVE_NC);
1358 {
1359 PALLOC (udpa_config_cnf, UDPA_CONFIG_CNF);
1360 PSENDX (ACI, udpa_config_cnf);
1361 }
1362 break;
1363 default:
1364 break;
1365 }
1366 break;
1367
1368 case ACTIVE_NC:
1369 switch (udpa_config_req->cmd)
1370 {
1371 case UDPA_CONFIG_UP:
1372 dti_start (
1373 udp_hDTI,
1374 UDP_DTI_DEF_INSTANCE,
1375 UDP_DTI_LL_INTERFACE,
1376 UDP_DTI_DEF_CHANNEL
1377 );
1378 SET_STATE (KER, CONNECTED);
1379 TRACE_EVENT ("KER -> CONNECTED");
1380 {
1381 PALLOC (udpa_config_cnf, UDPA_CONFIG_CNF);
1382 PSENDX (ACI, udpa_config_cnf);
1383 }
1384 break;
1385 case UDPA_CONFIG_DOWN:
1386 {
1387 PALLOC (udpa_config_cnf, UDPA_CONFIG_CNF);
1388 PSENDX (ACI, udpa_config_cnf);
1389 }
1390 break;
1391 default:
1392 break;
1393 }
1394 break;
1395 default:
1396 break;
1397 }
1398 PFREE (udpa_config_req);
1399 }
1400
1401 /*
1402 +--------------------------------------------------------------------+
1403 | PROJECT : WAP MODULE : udp_kerp.c |
1404 | STATE : code ROUTINE : ker_udp_shutdown_res |
1405 +--------------------------------------------------------------------+
1406
1407 PURPOSE : Process primitive T_UDP_SHUTDOWN_RES
1408 */
1409
1410 void ker_udp_shutdown_res (T_UDP_SHUTDOWN_RES * udp_shutdown_res)
1411 {
1412 TRACE_FUNCTION ("DUMMY ker_udp_shutdown_res()");
1413 PACCESS (udp_shutdown_res);
1414 PFREE (udp_shutdown_res);
1415 }
1416
1417 /*
1418 +--------------------------------------------------------------------+
1419 | PROJECT : WAP MODULE : udp_kerp.c |
1420 | STATE : code ROUTINE : sig_dti_ker_tx_buffer_full_hl_ind |
1421 +--------------------------------------------------------------------+
1422
1423 PURPOSE : Process signal SIG_DTI_KER_TX_BUFFER_FULL_UP_IND
1424 */
1425
1426 void sig_dti_ker_tx_buffer_full_hl_ind ()
1427 {
1428 TRACE_FUNCTION ("DUMMY sig_dti_ker_tx_buffer_full_hl_ind()");
1429 }
1430
1431 /*
1432 +--------------------------------------------------------------------+
1433 | PROJECT : WAP MODULE : UDP_KERP |
1434 | STATE : code ROUTINE : sig_dti_ker_tx_buffer_full_ll_ind |
1435 +--------------------------------------------------------------------+
1436
1437 PURPOSE : Process signal SIG_DTI_KER_TX_BUFFER_FULL_DN_IND
1438 */
1439
1440 void sig_dti_ker_tx_buffer_full_ll_ind ()
1441 {
1442 TRACE_FUNCTION ("DUMMY sig_dti_ker_tx_buffer_full_ll_ind()");
1443 }
1444
1445 /*-------------------------------------------------------------------------*/
1446