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