mdns: Remove legacy esp_event API

This commit is contained in:
David Cermak 2022-02-17 10:40:32 +01:00
parent 28d09c7dbe
commit e46aa515bd
6 changed files with 17 additions and 28 deletions

View File

@ -11,7 +11,6 @@ extern "C" {
#endif
#include <esp_netif.h>
#include "esp_event.h"
#define MDNS_TYPE_A 0x0001
#define MDNS_TYPE_PTR 0x000C
@ -717,18 +716,6 @@ esp_err_t mdns_query_a(const char * host_name, uint32_t timeout, esp_ip4_addr_t
esp_err_t mdns_query_aaaa(const char * host_name, uint32_t timeout, esp_ip6_addr_t * addr);
#endif
/**
* @brief System event handler
* This method controls the service state on all active interfaces and applications are required
* to call it from the system event handler for normal operation of mDNS service.
*
* Please note that hostname must not contain domain name, as mDNS uses '.local' domain.
*
* @param ctx The system event context
* @param event The system event
*/
esp_err_t mdns_handle_system_event(void *ctx, system_event_t *event) __attribute__((deprecated));
#ifdef __cplusplus
}
#endif

View File

@ -4,16 +4,17 @@
* SPDX-License-Identifier: Apache-2.0
*/
#include "mdns.h"
#include "mdns_private.h"
#include "mdns_networking.h"
#include "esp_log.h"
#include <string.h>
#include <sys/param.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "freertos/queue.h"
#include "freertos/semphr.h"
#include <string.h>
#include <sys/param.h>
#include "esp_log.h"
#include "esp_event.h"
#include "mdns.h"
#include "mdns_private.h"
#include "mdns_networking.h"
#ifdef MDNS_ENABLE_DEBUG
void mdns_debug_packet(const uint8_t * data, size_t len);
@ -4875,12 +4876,6 @@ static esp_err_t _mdns_service_task_stop(void)
* Public Methods
* */
esp_err_t mdns_handle_system_event(void *ctx, system_event_t *event)
{
/* no-op, kept for compatibility */
return ESP_OK;
}
static void event_handler(void* arg, esp_event_base_t event_base,
int32_t event_id, void* event_data)
{

View File

@ -1,5 +1,6 @@
#include "test_utils.h"
#include "mdns.h"
#include "esp_event.h"
#include "unity.h"

View File

@ -20,7 +20,7 @@ CFLAGS=-g -Wno-unused-value -Wno-missing-declarations -Wno-pointer-bool-conversi
-I$(COMPONENTS_DIR)/esp_wifi/include \
-I$(COMPONENTS_DIR)/freertos/FreeRTOS-Kernel \
-I$(COMPONENTS_DIR)/freertos/FreeRTOS-Kernel/include \
-I$(COMPONENTS_DIR)/freertos/FreeRTOS-Kernel/portable/xtensa/include \
-I$(COMPONENTS_DIR)/freertos/esp_additions/include/freertos \
-I$(COMPONENTS_DIR)/hal/include \
-I$(COMPONENTS_DIR)/hal/esp32/include \
-I$(COMPONENTS_DIR)/heap/include \

View File

@ -1,7 +1,7 @@
## Introduction
This test uses [american fuzzy lop](http://lcamtuf.coredump.cx/afl/) to mangle real mdns packets and look for exceptions caused by the parser.
A few actual packets are collected and exported as bins in the ```in``` folder, which is then passed as input to AFL when testing. The setup procedure for the test includes all possible services and scenarios that could be used with the given input packets.The output of the parser before fuzzing can be found in [input_packets.txt](input_packets.txt)
A few actual packets are collected and exported as bins in the `in` folder, which is then passed as input to AFL when testing. The setup procedure for the test includes all possible services and scenarios that could be used with the given input packets.The output of the parser before fuzzing can be found in [input_packets.txt](input_packets.txt)
## Building and running the tests using AFL
To build and run the tests using AFL(afl-clang-fast) instrumentation
@ -14,6 +14,7 @@ make fuzz
(Please note you have to install AFL instrumentation first, check `Installing AFL` section)
## Building the tests using GCC INSTR(off)
To build the tests without AFL instrumentations and instead of that use GCC compiler(In this case it will only check for compilation issues and will not run AFL tests).
```bash
@ -21,8 +22,10 @@ cd $IDF_PATH/components/mdns/test_afl_host
make INSTR=off
```
Note, that this setup is useful if we want to reproduce issues reported by fuzzer tests executed in the CI, or to simulate how the packet parser treats the input packets on the host machine.
## Installing AFL
To run the test yourself, you need to dounload the [latest afl archive](http://lcamtuf.coredump.cx/afl/releases/afl-latest.tgz) and extract it to a folder on your computer.
To run the test yourself, you need to download the [latest afl archive](http://lcamtuf.coredump.cx/afl/releases/afl-latest.tgz) and extract it to a folder on your computer.
The rest of the document will refer to that folder as ```PATH_TO_AFL```.

View File

@ -8,6 +8,9 @@
// Skip these include files
#define ESP_MDNS_NETWORKING_H_
#define INC_FREERTOS_H
#define QUEUE_H
#define SEMAPHORE_H
#define _TCPIP_ADAPTER_H_
#define _ESP_TASK_H_