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