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_ip.h"
30 #include "nx_udp.h"
31
32
33 /* Bring in externs for caller checking code. */
34
35 NX_CALLER_CHECKING_EXTERNS
36
37 /**************************************************************************/
38 /* */
39 /* FUNCTION RELEASE */
40 /* */
41 /* _nxe_udp_info_get PORTABLE C */
42 /* 6.1 */
43 /* AUTHOR */
44 /* */
45 /* Yuxin Zhou, Microsoft Corporation */
46 /* */
47 /* DESCRIPTION */
48 /* */
49 /* This function checks for errors in the UDP information get */
50 /* function call. */
51 /* */
52 /* INPUT */
53 /* */
54 /* ip_ptr Pointer to IP control block */
55 /* udp_packets_sent Destination to the number of */
56 /* packets sent */
57 /* udp_bytes_sent Destination to the number of */
58 /* bytes sent */
59 /* udp_packets_received Destination to the number of */
60 /* packets received */
61 /* udp_bytes_received Destination to the number of */
62 /* bytes received */
63 /* udp_invalid_packets Destination to the number of */
64 /* invalid packets */
65 /* udp_receive_packets_dropped Destination to the number of */
66 /* receive packets dropped */
67 /* udp_checksum_errors Destination to the number of */
68 /* checksum errors */
69 /* */
70 /* OUTPUT */
71 /* */
72 /* status Completion status */
73 /* */
74 /* CALLS */
75 /* */
76 /* _nx_udp_info_get Actual UDP information get */
77 /* function */
78 /* */
79 /* CALLED BY */
80 /* */
81 /* Application */
82 /* */
83 /* RELEASE HISTORY */
84 /* */
85 /* DATE NAME DESCRIPTION */
86 /* */
87 /* 05-19-2020 Yuxin Zhou Initial Version 6.0 */
88 /* 09-30-2020 Yuxin Zhou Modified comment(s), */
89 /* resulting in version 6.1 */
90 /* */
91 /**************************************************************************/
_nxe_udp_info_get(NX_IP * ip_ptr,ULONG * udp_packets_sent,ULONG * udp_bytes_sent,ULONG * udp_packets_received,ULONG * udp_bytes_received,ULONG * udp_invalid_packets,ULONG * udp_receive_packets_dropped,ULONG * udp_checksum_errors)92 UINT _nxe_udp_info_get(NX_IP *ip_ptr, ULONG *udp_packets_sent, ULONG *udp_bytes_sent,
93 ULONG *udp_packets_received, ULONG *udp_bytes_received,
94 ULONG *udp_invalid_packets, ULONG *udp_receive_packets_dropped,
95 ULONG *udp_checksum_errors)
96 {
97
98 UINT status;
99
100
101 /* Check for invalid input pointers. */
102 if ((ip_ptr == NX_NULL) || (ip_ptr -> nx_ip_id != NX_IP_ID))
103 {
104 return(NX_PTR_ERROR);
105 }
106
107 /* Check to see if UDP is enabled. */
108 if (!ip_ptr -> nx_ip_udp_packet_receive)
109 {
110 return(NX_NOT_ENABLED);
111 }
112
113 /* Check for appropriate caller. */
114 NX_NOT_ISR_CALLER_CHECKING
115
116 /* Call actual UDP information get function. */
117 status = _nx_udp_info_get(ip_ptr, udp_packets_sent, udp_bytes_sent, udp_packets_received,
118 udp_bytes_received, udp_invalid_packets, udp_receive_packets_dropped,
119 udp_checksum_errors);
120
121 /* Return completion status. */
122 return(status);
123 }
124
125