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
32 NX_CALLER_CHECKING_EXTERNS
33
34
35 /**************************************************************************/
36 /* */
37 /* FUNCTION RELEASE */
38 /* */
39 /* _nxe_ip_status_check 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 IP status check */
48 /* function call. */
49 /* */
50 /* INPUT */
51 /* */
52 /* ip_ptr Pointer to IP instance */
53 /* needed_status Status needed request */
54 /* actual_status Pointer to return status area */
55 /* wait_option Maximum suspension time */
56 /* */
57 /* OUTPUT */
58 /* */
59 /* status Completion status */
60 /* */
61 /* CALLS */
62 /* */
63 /* _nx_ip_status_check Actual IP status check */
64 /* function */
65 /* */
66 /* CALLED BY */
67 /* */
68 /* Application */
69 /* */
70 /* RELEASE HISTORY */
71 /* */
72 /* DATE NAME DESCRIPTION */
73 /* */
74 /* 05-19-2020 Yuxin Zhou Initial Version 6.0 */
75 /* 09-30-2020 Yuxin Zhou Modified comment(s), */
76 /* resulting in version 6.1 */
77 /* */
78 /**************************************************************************/
_nxe_ip_status_check(NX_IP * ip_ptr,ULONG needed_status,ULONG * actual_status,ULONG wait_option)79 UINT _nxe_ip_status_check(NX_IP *ip_ptr, ULONG needed_status, ULONG *actual_status, ULONG wait_option)
80 {
81
82 UINT status;
83
84
85 /* Check for invalid input pointers. */
86 if ((ip_ptr == NX_NULL) || (ip_ptr -> nx_ip_id != NX_IP_ID) || (actual_status == NX_NULL))
87 {
88 return(NX_PTR_ERROR);
89 }
90
91 /* Check for valid options. */
92 if (needed_status &
93 ~(NX_IP_INITIALIZE_DONE | NX_IP_ADDRESS_RESOLVED | NX_IP_LINK_ENABLED | NX_IP_ARP_ENABLED |
94 NX_IP_UDP_ENABLED | NX_IP_TCP_ENABLED | NX_IP_IGMP_ENABLED | NX_IP_RARP_COMPLETE | NX_IP_INTERFACE_LINK_ENABLED))
95 {
96 return(NX_OPTION_ERROR);
97 }
98
99 /* Check for appropriate caller. */
100 NX_THREADS_ONLY_CALLER_CHECKING
101
102 /* Call actual IP status check function. */
103 status = _nx_ip_status_check(ip_ptr, needed_status, actual_status, wait_option);
104
105 /* Return completion status. */
106 return(status);
107 }
108
109