forked from espressif/esp-idf
esp-netif: Enable easier configuration of custom DHCP server address
This commit is contained in:
@@ -24,12 +24,6 @@
|
|||||||
// - default init / create functions for basic default interfaces
|
// - default init / create functions for basic default interfaces
|
||||||
//
|
//
|
||||||
|
|
||||||
#define IP4TOUINT32(a,b,c,d) (((uint32_t)((a) & 0xffU) << 24) | \
|
|
||||||
((uint32_t)((b) & 0xffU) << 16) | \
|
|
||||||
((uint32_t)((c) & 0xffU) << 8) | \
|
|
||||||
(uint32_t)((d) & 0xffU))
|
|
||||||
|
|
||||||
#define IP4TOADDR(a,b,c,d) esp_netif_htonl(IP4TOUINT32(a, b, c, d))
|
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -44,7 +38,7 @@ const esp_netif_inherent_config_t _g_esp_netif_inherent_eth_config = ESP_NETIF_I
|
|||||||
const esp_netif_inherent_config_t _g_esp_netif_inherent_ppp_config = ESP_NETIF_INHERENT_DEFAULT_PPP();
|
const esp_netif_inherent_config_t _g_esp_netif_inherent_ppp_config = ESP_NETIF_INHERENT_DEFAULT_PPP();
|
||||||
|
|
||||||
const esp_netif_ip_info_t _g_esp_netif_soft_ap_ip = {
|
const esp_netif_ip_info_t _g_esp_netif_soft_ap_ip = {
|
||||||
.ip = { .addr = IP4TOADDR( 192, 168, 4, 1) },
|
.ip = { .addr = ESP_IP4TOADDR( 192, 168, 4, 1) },
|
||||||
.gw = { .addr = IP4TOADDR( 192, 168, 4, 1) },
|
.gw = { .addr = ESP_IP4TOADDR( 192, 168, 4, 1) },
|
||||||
.netmask = { .addr = IP4TOADDR( 255, 255, 255, 0) },
|
.netmask = { .addr = ESP_IP4TOADDR( 255, 255, 255, 0) },
|
||||||
};
|
};
|
||||||
|
@@ -78,6 +78,12 @@ extern "C" {
|
|||||||
#define ESP_IPADDR_TYPE_V6 6U
|
#define ESP_IPADDR_TYPE_V6 6U
|
||||||
#define ESP_IPADDR_TYPE_ANY 46U
|
#define ESP_IPADDR_TYPE_ANY 46U
|
||||||
|
|
||||||
|
#define ESP_IP4TOUINT32(a,b,c,d) (((uint32_t)((a) & 0xffU) << 24) | \
|
||||||
|
((uint32_t)((b) & 0xffU) << 16) | \
|
||||||
|
((uint32_t)((c) & 0xffU) << 8) | \
|
||||||
|
(uint32_t)((d) & 0xffU))
|
||||||
|
|
||||||
|
#define ESP_IP4TOADDR(a,b,c,d) esp_netif_htonl(ESP_IP4TOUINT32(a, b, c, d))
|
||||||
|
|
||||||
struct esp_ip6_addr {
|
struct esp_ip6_addr {
|
||||||
uint32_t addr[4];
|
uint32_t addr[4];
|
||||||
|
@@ -224,6 +224,8 @@ typedef enum {
|
|||||||
MESH_PROTO_HTTP, /**< HTTP protocol */
|
MESH_PROTO_HTTP, /**< HTTP protocol */
|
||||||
MESH_PROTO_JSON, /**< JSON format */
|
MESH_PROTO_JSON, /**< JSON format */
|
||||||
MESH_PROTO_MQTT, /**< MQTT protocol */
|
MESH_PROTO_MQTT, /**< MQTT protocol */
|
||||||
|
MESH_PROTO_AP,
|
||||||
|
MESH_PROTO_STA,
|
||||||
} mesh_proto_t;
|
} mesh_proto_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -54,6 +54,7 @@
|
|||||||
#include "esp_netif_net_stack.h"
|
#include "esp_netif_net_stack.h"
|
||||||
#include "esp_compiler.h"
|
#include "esp_compiler.h"
|
||||||
|
|
||||||
|
#if !ESP_L2_TO_L3_COPY
|
||||||
/**
|
/**
|
||||||
* @brief Free resources allocated in L2 layer
|
* @brief Free resources allocated in L2 layer
|
||||||
*
|
*
|
||||||
@@ -65,6 +66,7 @@ static void lwip_netif_wifi_free_rx_buffer(struct netif *netif, void *buf)
|
|||||||
esp_netif_t *esp_netif = esp_netif_get_handle_from_netif_impl(netif);
|
esp_netif_t *esp_netif = esp_netif_get_handle_from_netif_impl(netif);
|
||||||
esp_netif_free_rx_buffer(esp_netif, buf);
|
esp_netif_free_rx_buffer(esp_netif, buf);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* In this function, the hardware should be initialized.
|
* In this function, the hardware should be initialized.
|
||||||
@@ -177,14 +179,12 @@ wlanif_input(void *h, void *buffer, size_t len, void* eb)
|
|||||||
#if (ESP_L2_TO_L3_COPY == 1)
|
#if (ESP_L2_TO_L3_COPY == 1)
|
||||||
p = pbuf_alloc(PBUF_RAW, len, PBUF_RAM);
|
p = pbuf_alloc(PBUF_RAW, len, PBUF_RAM);
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
// esp_wifi_internal_free_rx_buffer(eb);
|
|
||||||
esp_netif_free_rx_buffer(esp_netif, eb);
|
esp_netif_free_rx_buffer(esp_netif, eb);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
p->l2_owner = NULL;
|
p->l2_owner = NULL;
|
||||||
memcpy(p->payload, buffer, len);
|
memcpy(p->payload, buffer, len);
|
||||||
esp_netif_free_rx_buffer(esp_netif, eb);
|
esp_netif_free_rx_buffer(esp_netif, eb);
|
||||||
// esp_wifi_internal_free_rx_buffer(eb);
|
|
||||||
#else
|
#else
|
||||||
p = pbuf_alloc(PBUF_RAW, len, PBUF_REF);
|
p = pbuf_alloc(PBUF_RAW, len, PBUF_REF);
|
||||||
if (p == NULL){
|
if (p == NULL){
|
||||||
|
Reference in New Issue
Block a user