diff --git a/ESPTest/include/lwip_hooks.h b/ESPTest/include/lwip_hooks.h new file mode 100644 index 0000000..6f28d23 --- /dev/null +++ b/ESPTest/include/lwip_hooks.h @@ -0,0 +1,3 @@ +#pragma once + +#define LWIP_HOOK_IP4_INPUT lwip_hook_ip4_input \ No newline at end of file diff --git a/ESPTest/include/myhook.c b/ESPTest/include/myhook.c new file mode 100644 index 0000000..d1cba9b --- /dev/null +++ b/ESPTest/include/myhook.c @@ -0,0 +1,9 @@ +#include "lwip/netif.h" +#include "lwip/pbuf.h" +#include "esp_log.h" + +int IRAM_ATTR lwip_hook_ip4_input(struct pbuf *pbuf, struct netif *input_netif) +{ + ESP_LOGI("HOOK", "Testing..."); + return 0; // we don't consume the packet +} \ No newline at end of file diff --git a/ESPTest/include/myhook.h b/ESPTest/include/myhook.h new file mode 100644 index 0000000..c7c8472 --- /dev/null +++ b/ESPTest/include/myhook.h @@ -0,0 +1,15 @@ +#pragma once + +#include "lwip/netif.h" +#include "lwip/pbuf.h" + +#ifdef __cplusplus +extern "C" +{ +#endif + + int lwip_hook_ip4_input(struct pbuf *pbuf, struct netif *input_netif); + +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/ESPTest/src/main.c b/ESPTest/src/main.c index 4bcc2d9..c34b11b 100644 --- a/ESPTest/src/main.c +++ b/ESPTest/src/main.c @@ -16,14 +16,6 @@ static const char *WIFI_TAG = "wifi station"; static const char *SERVER_TAG = "http server"; -int my_hook(struct pbuf *pbuf, struct netif *input_netif) -{ - ESP_LOGI(WIFI_TAG, "TESTING!"); - return ESP_OK; -} - -#define LWIP_HOOK_IP4_INPUT(pbuf, input_netif) my_hook(pbuf, input_netif) - /* FreeRTOS event group to signal when we are connected*/ static EventGroupHandle_t s_wifi_event_group;