xref: /FreeRTOS-Plus-TCP-v4.0.0/source/include/FreeRTOS_IP_Common.h (revision 2d3f4daa567ffe71aeda2e0f6d0bc02850db0627)
1 /*
2  * FreeRTOS+TCP <DEVELOPMENT BRANCH>
3  * Copyright (C) 2022 Amazon.com, Inc. or its affiliates.  All Rights Reserved.
4  *
5  * SPDX-License-Identifier: MIT
6  *
7  * Permission is hereby granted, free of charge, to any person obtaining a copy of
8  * this software and associated documentation files (the "Software"), to deal in
9  * the Software without restriction, including without limitation the rights to
10  * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
11  * the Software, and to permit persons to whom the Software is furnished to do so,
12  * subject to the following conditions:
13  *
14  * The above copyright notice and this permission notice shall be included in all
15  * copies or substantial portions of the Software.
16  *
17  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
19  * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
20  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
21  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23  *
24  * http://aws.amazon.com/freertos
25  * http://www.FreeRTOS.org
26  */
27 
28 #ifndef FREERTOS_IP_COMMON_H
29 #define FREERTOS_IP_COMMON_H
30 
31 /* *INDENT-OFF* */
32 #ifdef __cplusplus
33     extern "C" {
34 #endif
35 /* *INDENT-ON* */
36 
37 struct xIPv6_Address
38 {
39     uint8_t ucBytes[ 16 ];
40 };
41 
42 typedef struct xIPv6_Address IPv6_Address_t;
43 
44 typedef union IP_Address
45 {
46     uint32_t ulIP_IPv4;      /**< IPv4 address */
47     IPv6_Address_t xIP_IPv6; /**< IPv6 address */
48 } IP_Address_t;
49 
50 /** @brief A struct that can hold either an IPv4 or an IPv6 address. */
51 typedef struct xxIPv46_Address
52 {
53     /* A struct that can hold either an IPv4 or an IPv6 address. */
54     IP_Address_t xIPAddress; /**< IP address contains either IPv4 or IPv6. */
55     BaseType_t xIs_IPv6;     /**< pdTRUE if IPv6 address. */
56 } IPv46_Address_t;
57 
58 struct xNetworkEndPoint;
59 struct xNetworkInterface;
60 
61 /* Return true if a given end-point is up and running.
62 * When FreeRTOS_IsNetworkUp() is called with NULL as a parameter,
63 * it will return pdTRUE when all end-points are up. */
64 BaseType_t FreeRTOS_IsEndPointUp( const struct xNetworkEndPoint * pxEndPoint );
65 
66 /* Return pdTRUE if all end-points are up.
67  * When pxInterface is null, all end-points will be checked. */
68 BaseType_t FreeRTOS_AllEndPointsUp( const struct xNetworkInterface * pxInterface );
69 
70 /* *INDENT-OFF* */
71 #ifdef __cplusplus
72     } /* extern "C" */
73 #endif
74 /* *INDENT-ON* */
75 
76 #endif /* FREERTOS_IP_COMMON_H */
77