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 Control Message Protocol (ICMP) */
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 #include "nx_icmp.h"
30
31 /* Bring in externs for caller checking code. */
32
33
34 NX_CALLER_CHECKING_EXTERNS
35
36
37
38 /**************************************************************************/
39 /* */
40 /* FUNCTION RELEASE */
41 /* */
42 /* _nxe_icmp_info_get PORTABLE C */
43 /* 6.1 */
44 /* AUTHOR */
45 /* */
46 /* Yuxin Zhou, Microsoft Corporation */
47 /* */
48 /* DESCRIPTION */
49 /* */
50 /* This function checks for errors in the ICMP information get */
51 /* function call. */
52 /* */
53 /* INPUT */
54 /* */
55 /* ip_ptr Pointer to IP instance */
56 /* pings_sent Destination for number of */
57 /* pings sent */
58 /* ping_timeouts Destination for number of */
59 /* ping timeouts */
60 /* ping_threads_suspended Destination for number of */
61 /* threads suspended on pings */
62 /* ping_responses_received Destination for number of */
63 /* ping responses received */
64 /* icmp_checksum_errors Destination for number of */
65 /* ICMP checksum errors */
66 /* icmp_unhandled_messages Destination for number of */
67 /* unhandled ICMP messages */
68 /* */
69 /* OUTPUT */
70 /* */
71 /* None */
72 /* */
73 /* CALLS */
74 /* */
75 /* _nx_icmp_info_get Actual ICMP information get */
76 /* function */
77 /* */
78 /* CALLED BY */
79 /* */
80 /* Application Code */
81 /* */
82 /* RELEASE HISTORY */
83 /* */
84 /* DATE NAME DESCRIPTION */
85 /* */
86 /* 05-19-2020 Yuxin Zhou Initial Version 6.0 */
87 /* 09-30-2020 Yuxin Zhou Modified comment(s), */
88 /* resulting in version 6.1 */
89 /* */
90 /**************************************************************************/
_nxe_icmp_info_get(NX_IP * ip_ptr,ULONG * pings_sent,ULONG * ping_timeouts,ULONG * ping_threads_suspended,ULONG * ping_responses_received,ULONG * icmp_checksum_errors,ULONG * icmp_unhandled_messages)91 UINT _nxe_icmp_info_get(NX_IP *ip_ptr, ULONG *pings_sent, ULONG *ping_timeouts,
92 ULONG *ping_threads_suspended, ULONG *ping_responses_received,
93 ULONG *icmp_checksum_errors, ULONG *icmp_unhandled_messages)
94 {
95
96 UINT status;
97
98
99 /* Check for invalid input pointers. */
100 if ((ip_ptr == NX_NULL) || (ip_ptr -> nx_ip_id != NX_IP_ID))
101 {
102 return(NX_PTR_ERROR);
103 }
104
105 /* Check to see if ICMP is enabled. */
106 if (!ip_ptr -> nx_ip_icmp_packet_receive)
107 {
108 return(NX_NOT_ENABLED);
109 }
110
111 /* Check for appropriate caller. */
112 NX_INIT_AND_THREADS_CALLER_CHECKING
113
114 /* Call actual ICMP information get function. */
115 status = _nx_icmp_info_get(ip_ptr, pings_sent, ping_timeouts, ping_threads_suspended,
116 ping_responses_received, icmp_checksum_errors, icmp_unhandled_messages);
117
118 /* Return completion status. */
119 return(status);
120 }
121
122