Trying to use hooks

This commit is contained in:
Florian Hoss 2022-07-25 10:42:07 +02:00
parent 0b94c99567
commit 1d159e6d7c
4 changed files with 27 additions and 8 deletions

View file

@ -0,0 +1,3 @@
#pragma once
#define LWIP_HOOK_IP4_INPUT lwip_hook_ip4_input

9
ESPTest/include/myhook.c Normal file
View file

@ -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
}

15
ESPTest/include/myhook.h Normal file
View file

@ -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

View file

@ -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;