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 /** Address Resolution Protocol (ARP) */
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_arp.h"
30
31
32 /* Bring in externs for caller checking code. */
33
34 NX_CALLER_CHECKING_EXTERNS
35
36
37 /**************************************************************************/
38 /* */
39 /* FUNCTION RELEASE */
40 /* */
41 /* _nxe_arp_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 ARP information get */
50 /* function call. */
51 /* */
52 /* INPUT */
53 /* */
54 /* ip_ptr IP instance pointer */
55 /* arp_requests_sent Destination for number of ARP */
56 /* requests sent */
57 /* arp_requests_received Destination for number of ARP */
58 /* requests received */
59 /* arp_responses_sent Destination for number of ARP */
60 /* responses sent */
61 /* arp_responses_received Destination for number of ARP */
62 /* responses received */
63 /* arp_dynamic_entries Destination for number of ARP */
64 /* dynamic entries */
65 /* arp_static_entries Destination for number of ARP */
66 /* static entries */
67 /* arp_aged_entries Destination for number of ARP */
68 /* aged entries */
69 /* arp_invalid_messages Destination for number of ARP */
70 /* invalid messages */
71 /* */
72 /* OUTPUT */
73 /* */
74 /* status Completion status */
75 /* */
76 /* CALLS */
77 /* */
78 /* _nx_arp_info_get Actual ARP information get */
79 /* function */
80 /* */
81 /* CALLED BY */
82 /* */
83 /* Application Code */
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_arp_info_get(NX_IP * ip_ptr,ULONG * arp_requests_sent,ULONG * arp_requests_received,ULONG * arp_responses_sent,ULONG * arp_responses_received,ULONG * arp_dynamic_entries,ULONG * arp_static_entries,ULONG * arp_aged_entries,ULONG * arp_invalid_messages)94 UINT _nxe_arp_info_get(NX_IP *ip_ptr, ULONG *arp_requests_sent, ULONG *arp_requests_received,
95 ULONG *arp_responses_sent, ULONG *arp_responses_received,
96 ULONG *arp_dynamic_entries, ULONG *arp_static_entries,
97 ULONG *arp_aged_entries, ULONG *arp_invalid_messages)
98 {
99
100 #ifndef NX_DISABLE_IPV4
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 to see if ARP is enabled. */
111 if (!ip_ptr -> nx_ip_arp_allocate)
112 {
113 return(NX_NOT_ENABLED);
114 }
115
116 /* Check for appropriate caller. */
117 NX_THREADS_ONLY_CALLER_CHECKING
118
119 /* Call actual ARP information get function. */
120 status = _nx_arp_info_get(ip_ptr, arp_requests_sent, arp_requests_received,
121 arp_responses_sent, arp_responses_received,
122 arp_dynamic_entries, arp_static_entries,
123 arp_aged_entries, arp_invalid_messages);
124
125 /* Return completion status. */
126 return(status);
127 #else /* NX_DISABLE_IPV4 */
128 NX_PARAMETER_NOT_USED(ip_ptr);
129 NX_PARAMETER_NOT_USED(arp_requests_sent);
130 NX_PARAMETER_NOT_USED(arp_requests_received);
131 NX_PARAMETER_NOT_USED(arp_responses_sent);
132 NX_PARAMETER_NOT_USED(arp_responses_received);
133 NX_PARAMETER_NOT_USED(arp_dynamic_entries);
134 NX_PARAMETER_NOT_USED(arp_static_entries);
135 NX_PARAMETER_NOT_USED(arp_aged_entries);
136 NX_PARAMETER_NOT_USED(arp_invalid_messages);
137
138 return(NX_NOT_SUPPORTED);
139 #endif /* !NX_DISABLE_IPV4 */
140 }
141
142