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_interface_physical_address_get PORTABLE C */
38 /* 6.1 */
39 /* AUTHOR */
40 /* */
41 /* Yuxin Zhou, Microsoft Corporation */
42 /* */
43 /* DESCRIPTION */
44 /* */
45 /* This function checks errors in the IP physical address get */
46 /* function call. */
47 /* */
48 /* INPUT */
49 /* */
50 /* ip_ptr IP control block pointer */
51 /* interface_index Index of interface */
52 /* physical_msw Physical address MSW pointer */
53 /* physical_lsw Physical address LSW pointer */
54 /* */
55 /* OUTPUT */
56 /* */
57 /* status Completion status */
58 /* */
59 /* CALLS */
60 /* */
61 /* _nx_ip_interface_physical_address_get */
62 /* */
63 /* CALLED BY */
64 /* */
65 /* Application Code */
66 /* */
67 /* RELEASE HISTORY */
68 /* */
69 /* DATE NAME DESCRIPTION */
70 /* */
71 /* 05-19-2020 Yuxin Zhou Initial Version 6.0 */
72 /* 09-30-2020 Yuxin Zhou Modified comment(s), */
73 /* resulting in version 6.1 */
74 /* */
75 /**************************************************************************/
_nxe_ip_interface_physical_address_get(NX_IP * ip_ptr,UINT interface_index,ULONG * physical_msw,ULONG * physical_lsw)76 UINT _nxe_ip_interface_physical_address_get(NX_IP *ip_ptr, UINT interface_index,
77 ULONG *physical_msw, ULONG *physical_lsw)
78 {
79
80 UINT status;
81
82 /* Check for invalid input pointers. */
83 if ((ip_ptr == NX_NULL) || (ip_ptr -> nx_ip_id != NX_IP_ID) || (physical_msw == NX_NULL) || (physical_lsw == NX_NULL))
84 {
85 return(NX_PTR_ERROR);
86 }
87
88 /* Check for invalid interface ID */
89 if (interface_index >= NX_MAX_PHYSICAL_INTERFACES)
90 {
91 return(NX_INVALID_INTERFACE);
92 }
93
94 /* Check for appropriate caller. */
95 NX_INIT_AND_THREADS_CALLER_CHECKING
96
97 status = _nx_ip_interface_physical_address_get(ip_ptr, interface_index, physical_msw, physical_lsw);
98
99 /* Return completion status. */
100 return(status);
101 }
102
103