1 /***************************************************************************/ /** 2 * @file sl_net_ip_types.h 3 ******************************************************************************* 4 * # License 5 * <b>Copyright 2024 Silicon Laboratories Inc. www.silabs.com</b> 6 ******************************************************************************* 7 * 8 * SPDX-License-Identifier: Zlib 9 * 10 * The licensor of this software is Silicon Laboratories Inc. 11 * 12 * This software is provided 'as-is', without any express or implied 13 * warranty. In no event will the authors be held liable for any damages 14 * arising from the use of this software. 15 * 16 * Permission is granted to anyone to use this software for any purpose, 17 * including commercial applications, and to alter it and redistribute it 18 * freely, subject to the following restrictions: 19 * 20 * 1. The origin of this software must not be misrepresented; you must not 21 * claim that you wrote the original software. If you use this software 22 * in a product, an acknowledgment in the product documentation would be 23 * appreciated but is not required. 24 * 2. Altered source versions must be plainly marked as such, and must not be 25 * misrepresented as being the original software. 26 * 3. This notice may not be removed or altered from any source distribution. 27 * 28 ******************************************************************************/ 29 30 #pragma once 31 32 #include <stdint.h> 33 #include <limits.h> 34 #include "sl_ip_types.h" 35 36 /** \addtogroup SL_NET_TYPES Types 37 * @{ */ 38 39 /** 40 * @brief IPv4 address settings for a network interface. 41 * 42 * @details 43 * This structure holds the IPv4 address configuration for a network interface, including the IP address, gateway, and netmask. 44 * 45 * @note 46 * Each field is of type [sl_ipv4_address_t](../wiseconnect-api-reference-guide-common/sl-ipv4-address-t). 47 */ 48 typedef struct { 49 sl_ipv4_address_t 50 ip_address; ///< IPv4 address of type [sl_ipv4_address_t](../wiseconnect-api-reference-guide-nwk-mgmt/sl-ipv4-address-t) 51 sl_ipv4_address_t 52 gateway; ///< IPv4 gateway address of [sl_ipv4_address_t](../wiseconnect-api-reference-guide-nwk-mgmt/sl-ipv4-address-t) 53 sl_ipv4_address_t 54 netmask; ///< IPv4 netmask of type of [sl_ipv4_address_t](../wiseconnect-api-reference-guide-nwk-mgmt/sl-ipv4-address-t) 55 } sl_net_ipv4_setting_t; 56 57 /** 58 * @brief IPv6 address settings for a network interface. 59 * 60 * @details 61 * This structure holds the IPv6 address configuration for a network interface, including the link-local address, global address, and gateway. 62 * 63 * @note 64 * Each field is of type [sl_ipv6_address_t](../wiseconnect-api-reference-guide-common/sl-ipv6-address-t). 65 */ 66 typedef struct { 67 sl_ipv6_address_t 68 link_local_address; ///< IPv6 link local address of type [sl_ipv6_address_t](../wiseconnect-api-reference-guide-nwk-mgmt/sl-ipv6-address-t) 69 sl_ipv6_address_t 70 global_address; ///< IPv6 global address of type [sl_ipv6_address_t](../wiseconnect-api-reference-guide-nwk-mgmt/sl-ipv6-address-t) 71 sl_ipv6_address_t 72 gateway; ///< IPv6 gateway address of type of [sl_ipv6_address_t](../wiseconnect-api-reference-guide-nwk-mgmt/sl-ipv6-address-t) 73 } sl_net_ipv6_setting_t; 74 75 /** 76 * @brief Structure representing the DHCP configuration for the network manager. 77 * 78 * This structure holds the DHCP configuration parameters for the network manager. 79 * It includes the minimum and maximum retry intervals for discovery and request, 80 * as well as the minimum and maximum number of retries for discovery and request. 81 * 82 * @note 83 * This configuration is not supported for IPv6 in SI91X_INTERNAL_STACK. 84 */ 85 typedef struct { 86 uint16_t min_discover_retry_interval; ///< Minimum retry interval for discovery 87 uint16_t max_discover_retry_interval; ///< Maximum retry interval for discovery 88 uint16_t min_request_retry_interval; ///< Minimum retry interval for request 89 uint16_t max_request_retry_interval; ///< Maximum retry interval for request 90 uint8_t min_discover_retries; ///< Minimum number of retries for discovery 91 uint8_t max_request_retries; ///< Maximum number of retries for request 92 } sl_net_dhcp_configuration_t; 93 94 /// IP configuration for a network interface 95 typedef struct { 96 sl_ip_management_t 97 mode; ///< IP Assignment Type of [sl_ip_management_t](../wiseconnect-api-reference-guide-nwk-mgmt/sl-net-constants#sl-ip-management-t) 98 sl_ip_address_type_t 99 type; ///< IP Address Type of [sl_ip_address_type_t](../wiseconnect-api-reference-guide-nwk-mgmt/sl-net-constants#sl-ip-address-type-t) 100 char *host_name; ///< Host name visible on network 101 struct { 102 sl_net_ipv4_setting_t 103 v4; ///< IPv4 setting to be used in case of static IP address assignment of type @ref sl_net_ipv4_setting_t 104 sl_net_ipv6_setting_t 105 v6; ///< IPv6 setting to be used in case of static IP address assignment of type @ref sl_net_ipv6_setting_t 106 } ip; ///< IP setting to be used for static IP address assignment 107 108 sl_net_dhcp_configuration_t dhcp_config; ///< DHCP configuration for the network manager 109 } sl_net_ip_configuration_t; 110 111 /// IP Address of a network interface 112 typedef struct { 113 sl_ip_management_t 114 mode; ///< IP Assignment Type of [sl_ip_management_t](../wiseconnect-api-reference-guide-common/ip-addresses#sl-ip-management-t) 115 sl_ip_address_type_t 116 type; ///< IP Address Type of [sl_ip_address_type_t](../wiseconnect-api-reference-guide-common/ip-addresses#sl-ip-address-type-t) 117 sl_net_ipv4_setting_t 118 v4; ///< IPv4 setting to be used in case of static IP address assignment of type @ref sl_net_ipv4_setting_t 119 sl_net_ipv6_setting_t 120 v6; ///< IPv6 setting to be used in case of static IP address assignment of type @ref sl_net_ipv6_setting_t 121 } sl_net_ip_address_t; 122 123 /** @} */