40 lines
977 B
C
40 lines
977 B
C
#include "esp_netif.h"
|
|
#include "esp_netif_types.h"
|
|
|
|
#define DHCP_IP CONFIG_DHCP_IP
|
|
#define DNS_SERVER CONFIG_DNS_SERVER
|
|
|
|
// decode DHCP server IP
|
|
esp_ip4_addr_t dhcpIP;
|
|
esp_netif_str_to_ip4(DHCP_IP, dhcpIP);
|
|
|
|
// decode DNS server IP
|
|
esp_ip4_addr_t dnsIP;
|
|
esp_netif_str_to_ip4(DNS_SERVER, dnsIP);
|
|
|
|
struct esp_netif_dns_info_t dns_ip_wraped = {dnsIP}; // wtf is this shit frong
|
|
ESP_ERROR_CHECK(esp_netif_dhcps_start(netifWifi));
|
|
ESP_ERROR_CHECK(esp_netif_set_dns_info(netifWifi, ESP_NETIF_DNS_MAIN, dns_ip_wraped));
|
|
|
|
/*
|
|
// new dhcp server lfggggggg
|
|
dhcps_t dhcps = dhcps_new();
|
|
|
|
// set some silly optionsssss
|
|
u8_t option_id = ;
|
|
|
|
ESP_ERROR_CHECK(dhcps_dns_setserver(*dhcps, dnsIP));
|
|
ESP_ERROR_CHECK(dhcps_set_option_info(*dhcps,
|
|
|
|
// run the fucka
|
|
ESP_ERROR_CHECK(dhcps_start(*dhcps, netifWifi, dhcpIP));
|
|
|
|
|
|
|
|
|
|
// get DHCP option
|
|
// u8_t option_id_ret;
|
|
// u32_t option_len_ret;
|
|
// dhcps_option_info(*dhcps, option_id_ret, option_len_ret);
|
|
|
|
*/ |