1 /* 2 * Copyright (C) 2022 Beken Corporation 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef _MXCHIP_NETIF_ADDR_H_ 17 #define _MXCHIP_NETIF_ADDR_H_ 18 #include <lwip/ip_addr.h> 19 20 /** MLAN BSS type */ 21 typedef enum _wifi_interface_type 22 { 23 WIFI_INTERFACE_TYPE_STA = 0, 24 WIFI_INTERFACE_TYPE_UAP = 1, 25 26 WIFI_INTERFACE_TYPE_ANY = 0xff, 27 } wifi_interface_type; 28 29 #define ADDR_TYPE_STATIC 1 30 #define ADDR_TYPE_DHCP 0 31 32 /** This data structure represents an IPv4 address */ 33 struct ipv4_config { 34 /** DHCP_Disable DHCP_Client DHCP_Server */ 35 unsigned addr_type; 36 /** The system's IP address in network order. */ 37 unsigned address; 38 /** The system's default gateway in network order. */ 39 unsigned gw; 40 /** The system's subnet mask in network order. */ 41 unsigned netmask; 42 /** The system's primary dns server in network order. */ 43 unsigned dns1; 44 /** The system's secondary dns server in network order. */ 45 unsigned dns2; 46 }; 47 48 49 #ifdef CONFIG_IPV6 50 #define MAX_IPV6_ADDRESSES 3 51 struct ipv6_config { 52 ip6_addr_t address; 53 u8 addr_state; 54 }; 55 56 #endif 57 58 59 /** Network IP configuration. 60 * 61 * This data structure represents the network IP configuration 62 * for IPv4 as well as IPv6 addresses 63 */ 64 struct wlan_ip_config { 65 #ifdef CONFIG_IPV6 66 /** The network IPv6 address configuration that should be 67 * associated with this interface. */ 68 struct ipv6_config ipv6[MAX_IPV6_ADDRESSES]; 69 #endif 70 /** The network IPv4 address configuration that should be 71 * associated with this interface. */ 72 struct ipv4_config ipv4; 73 }; 74 75 #endif 76