1 /**************************************************************************/
2 /*                                                                        */
3 /*       Copyright (c) Microsoft Corporation. All rights reserved.        */
4 /*                                                                        */
5 /*       This software is licensed under the Microsoft Software License   */
6 /*       Terms for Microsoft Azure RTOS. Full text of the license can be  */
7 /*       found in the LICENSE file at https://aka.ms/AzureRTOS_EULA       */
8 /*       and in the root directory of this software.                      */
9 /*                                                                        */
10 /**************************************************************************/
11 
12 
13 /**************************************************************************/
14 /**************************************************************************/
15 /**                                                                       */
16 /** NetX Component                                                        */
17 /**                                                                       */
18 /**   Internet Protocol (IP)                                              */
19 /**                                                                       */
20 /**************************************************************************/
21 /**************************************************************************/
22 
23 #define NX_SOURCE_CODE
24 
25 
26 /* Include necessary system files.  */
27 
28 #include "nx_api.h"
29 #include "nx_ip.h"
30 
31 /* Bring in externs for caller checking code */
32 NX_CALLER_CHECKING_EXTERNS
33 
34 /**************************************************************************/
35 /*                                                                        */
36 /*  FUNCTION                                               RELEASE        */
37 /*                                                                        */
38 /*    _nxe_ip_interface_info_get                          PORTABLE C      */
39 /*                                                           6.1          */
40 /*  AUTHOR                                                                */
41 /*                                                                        */
42 /*    Yuxin Zhou, Microsoft Corporation                                   */
43 /*                                                                        */
44 /*  DESCRIPTION                                                           */
45 /*                                                                        */
46 /*    This function performs error checking for nx_ip_interface_info_get  */
47 /*    service call.                                                       */
48 /*                                                                        */
49 /*  INPUT                                                                 */
50 /*                                                                        */
51 /*    ip_ptr                                IP control block pointer      */
52 /*    interface_index                       Index to the interface        */
53 /*    interface_name                        Name of the interface         */
54 /*    ip_address                            Pointer to IP address         */
55 /*                                            destination in host byte    */
56 /*                                            order                       */
57 /*    network_mask                          Pointer to network mask       */
58 /*                                            destination, in host byte   */
59 /*                                            order                       */
60 /*    mtu_size                              Pointer to storage space for  */
61 /*                                            MTU                         */
62 /*    physical_address_msw                  Pointer to storage space for  */
63 /*                                            device phsyical address, MSW*/
64 /*    physical_address_lsw                  Pointer to storage space for  */
65 /*                                            device phsyical address, LSW*/
66 /*                                                                        */
67 /*  OUTPUT                                                                */
68 /*                                                                        */
69 /*    status                                Completion status             */
70 /*                                                                        */
71 /*  CALLS                                                                 */
72 /*                                                                        */
73 /*    _nx_ip_interface_info_get             Actual IP interface info get  */
74 /*                                            service call.               */
75 /*                                                                        */
76 /*  CALLED BY                                                             */
77 /*                                                                        */
78 /*    Application Code                                                    */
79 /*                                                                        */
80 /*  RELEASE HISTORY                                                       */
81 /*                                                                        */
82 /*    DATE              NAME                      DESCRIPTION             */
83 /*                                                                        */
84 /*  05-19-2020     Yuxin Zhou               Initial Version 6.0           */
85 /*  09-30-2020     Yuxin Zhou               Modified comment(s),          */
86 /*                                            resulting in version 6.1    */
87 /*                                                                        */
88 /**************************************************************************/
89 
_nxe_ip_interface_info_get(NX_IP * ip_ptr,UINT interface_index,CHAR ** interface_name,ULONG * ip_address,ULONG * network_mask,ULONG * mtu_size,ULONG * physical_address_msw,ULONG * physical_address_lsw)90 UINT _nxe_ip_interface_info_get(NX_IP *ip_ptr, UINT interface_index, CHAR **interface_name,
91                                 ULONG *ip_address, ULONG *network_mask, ULONG *mtu_size,
92                                 ULONG *physical_address_msw, ULONG *physical_address_lsw)
93 {
94 UINT status;
95 
96     if (ip_ptr == NX_NULL)
97     {
98         return(NX_PTR_ERROR);
99     }
100 
101     if (ip_ptr -> nx_ip_id != NX_IP_ID)
102     {
103         return(NX_PTR_ERROR);
104     }
105 
106     if (interface_index >= NX_MAX_PHYSICAL_INTERFACES)
107     {
108         return(NX_INVALID_INTERFACE);
109     }
110 
111     NX_INIT_AND_THREADS_CALLER_CHECKING
112 
113     status = _nx_ip_interface_info_get(ip_ptr, interface_index, interface_name, ip_address, network_mask,
114                                        mtu_size, physical_address_msw, physical_address_lsw);
115 
116     return(status);
117 }
118 
119