1 /***************************************************************************
2 * Copyright (c) 2024 Microsoft Corporation
3 *
4 * This program and the accompanying materials are made available under the
5 * terms of the MIT License which is available at
6 * https://opensource.org/licenses/MIT.
7 *
8 * SPDX-License-Identifier: MIT
9 **************************************************************************/
10
11
12 /**************************************************************************/
13 /**************************************************************************/
14 /** */
15 /** NetX Component */
16 /** */
17 /** User Datagram Protocol (UDP) */
18 /** */
19 /**************************************************************************/
20 /**************************************************************************/
21
22 #define NX_SOURCE_CODE
23
24
25 /* Include necessary system files. */
26
27 #include "nx_api.h"
28 #include "nx_udp.h"
29
30 /* Bring in externs for caller checking code. */
31
32 NX_CALLER_CHECKING_EXTERNS
33 /**************************************************************************/
34 /* */
35 /* FUNCTION RELEASE */
36 /* */
37 /* _nxe_udp_pacekt_info_extract PORTABLE C */
38 /* 6.1 */
39 /* AUTHOR */
40 /* */
41 /* Yuxin Zhou, Microsoft Corporation */
42 /* */
43 /* DESCRIPTION */
44 /* */
45 /* This function performs error checking for UDP packet info extract */
46 /* service. */
47 /* */
48 /* INPUT */
49 /* */
50 /* packet_ptr Pointer to UDP packet pointer */
51 /* ip_address Pointer to destination for IP */
52 /* address, or NULL */
53 /* protocol Pointer to destination for */
54 /* protocol information, or */
55 /* NULL */
56 /* port Pointer to destination for */
57 /* source port. This service */
58 /* always returns 17 (UDP), or */
59 /* NULL */
60 /* interface_index Pointer to destination for */
61 /* incoming interface ID, or */
62 /* NULL */
63 /* */
64 /* OUTPUT */
65 /* */
66 /* status Completion status */
67 /* */
68 /* CALLS */
69 /* */
70 /* _nx_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 /**************************************************************************/
_nxe_udp_packet_info_extract(NX_PACKET * packet_ptr,ULONG * ip_address,UINT * protocol,UINT * port,UINT * interface_index)85 UINT _nxe_udp_packet_info_extract(NX_PACKET *packet_ptr, ULONG *ip_address,
86 UINT *protocol, UINT *port, UINT *interface_index)
87 {
88 #ifndef NX_DISABLE_IPV4
89 UINT status;
90
91 if (packet_ptr == NX_NULL)
92 {
93 return(NX_PTR_ERROR);
94 }
95
96
97 /* Check for appropriate caller. */
98 NX_THREADS_ONLY_CALLER_CHECKING
99
100 status = _nx_udp_packet_info_extract(packet_ptr, ip_address, protocol, port, interface_index);
101
102
103 return(status);
104 #else
105 NX_PARAMETER_NOT_USED(packet_ptr);
106 NX_PARAMETER_NOT_USED(ip_address);
107 NX_PARAMETER_NOT_USED(protocol);
108 NX_PARAMETER_NOT_USED(port);
109 NX_PARAMETER_NOT_USED(interface_index);
110
111 return(NX_NOT_SUPPORTED);
112 #endif /* NX_DISABLE_IPV4 */
113 }
114
115