1 /**************************************************************************/
2 /* */
3 /* Copyright (c) Microsoft Corporation. All rights reserved. */
4 /* */
5 /* This software is licensed under the Microsoft Software License */
6 /* Terms for Microsoft Azure RTOS. Full text of the license can be */
7 /* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
8 /* and in the root directory of this software. */
9 /* */
10 /**************************************************************************/
11
12
13 /**************************************************************************/
14 /**************************************************************************/
15 /** */
16 /** NetX Component */
17 /** */
18 /** User Datagram Protocol (UDP) */
19 /** */
20 /**************************************************************************/
21 /**************************************************************************/
22
23 #define NX_SOURCE_CODE
24
25
26 /* Include necessary system files. */
27
28 #include "nx_api.h"
29 #include "nx_udp.h"
30
31 /* Bring in externs for caller checking code. */
32 NX_CALLER_CHECKING_EXTERNS
33
34
35 /**************************************************************************/
36 /* */
37 /* FUNCTION RELEASE */
38 /* */
39 /* _nxde_udp_pacekt_info_extract PORTABLE C */
40 /* 6.1 */
41 /* AUTHOR */
42 /* */
43 /* Yuxin Zhou, Microsoft Corporation */
44 /* */
45 /* DESCRIPTION */
46 /* */
47 /* This function performs error checking for UDP packet info extract */
48 /* service. */
49 /* */
50 /* INPUT */
51 /* */
52 /* packet_ptr Pointer to UDP packet pointer */
53 /* ip_address Pointer to destination for IP */
54 /* address, or NULL */
55 /* protocol Pointer to destination for */
56 /* protocol information, or */
57 /* NULL */
58 /* port Pointer to destination for */
59 /* source port. This service */
60 /* always returns 17 (UDP), or */
61 /* NULL */
62 /* interface_index Index to the interface */
63 /* */
64 /* OUTPUT */
65 /* */
66 /* status Completion status */
67 /* */
68 /* CALLS */
69 /* */
70 /* _nxd_udp_packet_info_extract The actual service routine. */
71 /* */
72 /* CALLED BY */
73 /* */
74 /* Application Code */
75 /* */
76 /* RELEASE HISTORY */
77 /* */
78 /* DATE NAME DESCRIPTION */
79 /* */
80 /* 05-19-2020 Yuxin Zhou Initial Version 6.0 */
81 /* 09-30-2020 Yuxin Zhou Modified comment(s), */
82 /* resulting in version 6.1 */
83 /* */
84 /**************************************************************************/
_nxde_udp_packet_info_extract(NX_PACKET * packet_ptr,NXD_ADDRESS * ip_address,UINT * protocol,UINT * port,UINT * interface_index)85 UINT _nxde_udp_packet_info_extract(NX_PACKET *packet_ptr, NXD_ADDRESS *ip_address,
86 UINT *protocol, UINT *port, UINT *interface_index)
87 {
88 UINT status;
89
90 if (packet_ptr == NX_NULL)
91 {
92 return(NX_PTR_ERROR);
93 }
94
95 /* Check for appropriate caller. */
96 NX_THREADS_ONLY_CALLER_CHECKING
97
98 status = _nxd_udp_packet_info_extract(packet_ptr, ip_address, protocol, port, interface_index);
99
100
101 return(status);
102 }
103
104