Trying to use hooks
This commit is contained in:
parent
0b94c99567
commit
1d159e6d7c
4 changed files with 27 additions and 8 deletions
3
ESPTest/include/lwip_hooks.h
Normal file
3
ESPTest/include/lwip_hooks.h
Normal file
|
@ -0,0 +1,3 @@
|
|||
#pragma once
|
||||
|
||||
#define LWIP_HOOK_IP4_INPUT lwip_hook_ip4_input
|
9
ESPTest/include/myhook.c
Normal file
9
ESPTest/include/myhook.c
Normal 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
15
ESPTest/include/myhook.h
Normal 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
|
|
@ -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;
|
||||
|
||||
|
|
Reference in a new issue