]> granicus.if.org Git - esp-idf/commitdiff
add netbios support in restful server example
authorsuda-morris <362953310@qq.com>
Mon, 14 Oct 2019 05:41:46 +0000 (13:41 +0800)
committersuda-morris <362953310@qq.com>
Mon, 14 Oct 2019 06:26:43 +0000 (14:26 +0800)
components/lwip/CMakeLists.txt
components/lwip/component.mk
examples/protocols/http_server/restful_server/README.md
examples/protocols/http_server/restful_server/main/esp_rest_main.c

index 81e8f15055938f650d357c2c39ffcbfb27a3d248..3024c65d4a136cf1e9420afb8df0645e2ef051f5 100644 (file)
@@ -20,6 +20,7 @@ set(srcs
     "lwip/src/api/sockets.c"
     "lwip/src/api/tcpip.c"
     "lwip/src/apps/sntp/sntp.c"
+    "lwip/src/apps/netbiosns/netbiosns.c"
     "lwip/src/core/def.c"
     "lwip/src/core/dns.c"
     "lwip/src/core/inet_chksum.c"
index a92b888693e3d9732a35305611ef0c8043a46b69..bea9d738f0f3adb83eae62d7cd273a5a1ee35b49 100644 (file)
@@ -16,6 +16,7 @@ COMPONENT_SRCDIRS := \
        apps/sntp \
        lwip/src/api \
        lwip/src/apps/sntp \
+       lwip/src/apps/netbiosns \
        lwip/src/core \
        lwip/src/core/ipv4 \
        lwip/src/core/ipv6 \
index 9923d4232c32741f0e376d30042f27dbbd1104b9..84808ae2ec5fa9dfb63ce8fa640d77441bcaf8c0 100644 (file)
@@ -108,6 +108,8 @@ openocd-esp32/bin/openocd -s openocd-esp32/share/openocd/scripts -f interface/ft
 
 In your browser, enter the URL where the website located (e.g. `http://esp-home.local`). You can also enter the IP address that ESP32 obtained if your operating system currently don't have support for mDNS service.
 
+Besides that, this example also enables the NetBIOS feature with the domain name `esp-home`. If your OS supports NetBIOS and has enabled it (e.g. Windows has native support for NetBIOS), then the URL `http://esp-home` should also work.
+
 ![esp_home_local](https://dl.espressif.com/dl/esp-idf/docs/_static/esp_home_local.gif)
 
 ### ESP monitor output
index c82711ca4b6623e9cda5f2b12edc736046f53995..0f03f65a0f57068518151295b8bf13e47fcbbc7d 100644 (file)
@@ -6,6 +6,7 @@
    software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
    CONDITIONS OF ANY KIND, either express or implied.
 */
+#include "sdkconfig.h"
 #include "driver/sdmmc_host.h"
 #include "driver/gpio.h"
 #include "esp_vfs_semihost.h"
@@ -17,8 +18,8 @@
 #include "esp_event.h"
 #include "esp_log.h"
 #include "mdns.h"
+#include "lwip/apps/netbiosns.h"
 #include "protocol_examples_common.h"
-#include "sdkconfig.h"
 
 #define MDNS_INSTANCE "esp home web server"
 
@@ -126,6 +127,8 @@ void app_main(void)
     tcpip_adapter_init();
     ESP_ERROR_CHECK(esp_event_loop_create_default());
     initialise_mdns();
+    netbiosns_init();
+    netbiosns_set_name(CONFIG_EXAMPLE_MDNS_HOST_NAME);
 
     ESP_ERROR_CHECK(example_connect());
     ESP_ERROR_CHECK(init_fs());