1 // Copyright (C) 2022 Beken Corporation 2 // 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 #pragma once 16 17 #ifdef __cplusplus 18 extern "C" { 19 #endif 20 21 /** 22 * @brief BK Netif API 23 * @addtogroup bk_api_netif BK Netif API 24 * @{ 25 */ 26 27 /** 28 * @brief BK Netif typedefs 29 * @defgroup bk_api_netif_typedef 30 * @ingroup bk_api_netif 31 * @{ 32 */ 33 34 #define NETIF_IP4_STR_LEN 16 /**< IP4 string length */ 35 36 #define BK_ERR_NETIF_IF (BK_ERR_NETIF_BASE - 1) /**< Invalid interface ID */ 37 38 typedef enum { 39 NETIF_IF_STA = 0, /**< WiFi STA interface */ 40 NETIF_IF_AP, /**< WiFi AP interface */ 41 NETIF_IF_COUNT, /**< Number of BK netif */ 42 NETIF_IF_INVALID, /**< Invalid BK netif */ 43 } netif_if_t; 44 45 typedef enum { 46 EVENT_NETIF_GOT_IP4, /**< Netif get IP4 event */ 47 EVENT_NETIF_DHCP_TIMEOUT, /**get IP4 addr timeout, 20s**/ 48 } netif_event_t; 49 50 typedef struct { 51 char ip[NETIF_IP4_STR_LEN]; /**< Local IP address. */ 52 char mask[NETIF_IP4_STR_LEN]; /**< Netmask. */ 53 char gateway[NETIF_IP4_STR_LEN]; /**< Gateway IP address. */ 54 char dns[NETIF_IP4_STR_LEN]; /**< DNS server IP address. */ 55 } netif_ip4_config_t; 56 57 typedef struct { 58 netif_if_t netif_if; /**< Netif interface ID */ 59 char ip[NETIF_IP4_STR_LEN]; /**< Local IP address. */ 60 } netif_event_got_ip4_t; 61 62 /** 63 * @} 64 */ 65 66 /** 67 * @} 68 */ 69 70 #ifdef __cplusplus 71 } 72 #endif 73