diff options
-rw-r--r-- | CMakeLists.txt | 12 | ||||
-rw-r--r-- | README.md | 14 | ||||
-rw-r--r-- | src/libwifi/core/misc/byteswap.h | 2 | ||||
-rw-r--r-- | src/libwifi/core/radiotap/platform.h | 4 | ||||
-rw-r--r-- | src/libwifi/parse/data/eapol.c | 4 |
5 files changed, 35 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index e33a5fd..acedf75 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt | |||
@@ -1,5 +1,17 @@ | |||
1 | cmake_minimum_required(VERSION 3.18) | 1 | cmake_minimum_required(VERSION 3.18) |
2 | 2 | ||
3 | if (DEFINED ESP_PLATFORM) | ||
4 | file(GLOB_RECURSE libwifi_src | ||
5 | "src/libwifi/*.h" | ||
6 | "src/libwifi/*.c" | ||
7 | ) | ||
8 | idf_component_register( | ||
9 | SRCS ${libwifi_src} | ||
10 | INCLUDE_DIRS "src/" | ||
11 | ) | ||
12 | return() | ||
13 | endif() | ||
14 | |||
3 | project(wifi DESCRIPTION "802.11 Parsing / Generation library" VERSION 0.1) | 15 | project(wifi DESCRIPTION "802.11 Parsing / Generation library" VERSION 0.1) |
4 | 16 | ||
5 | execute_process(COMMAND git rev-parse --abbrev-ref HEAD OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE GITBRANCH) | 17 | execute_process(COMMAND git rev-parse --abbrev-ref HEAD OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE GITBRANCH) |
diff --git a/README.md b/README.md index 542c061..0f5f6c4 100644 --- a/README.md +++ b/README.md | |||
@@ -59,3 +59,17 @@ $ cmake .. | |||
59 | $ make | 59 | $ make |
60 | ``` | 60 | ``` |
61 | 61 | ||
62 | ## ESP32 | ||
63 | This project has been configured to be easily applicable as ESP-IDF component | ||
64 | |||
65 | ### Steps to include (Example) | ||
66 | |||
67 | 1. Put `libwifi` folder in `components/` | ||
68 | 2. Open `main/CMakeLists.txt` and add `libwifi` to `COMPONENT_REQUIRES` | ||
69 | 3. In `main/main.c` add `#include "libwifi.h"` | ||
70 | 4. Test by running following code: ``` | ||
71 | ```C | ||
72 | void app_main(void){ | ||
73 | printf("libwifi version: %s", libwifi_get_version()); | ||
74 | } | ||
75 | ``` \ No newline at end of file | ||
diff --git a/src/libwifi/core/misc/byteswap.h b/src/libwifi/core/misc/byteswap.h index aa91a37..9a7d263 100644 --- a/src/libwifi/core/misc/byteswap.h +++ b/src/libwifi/core/misc/byteswap.h | |||
@@ -38,7 +38,7 @@ | |||
38 | #define be64toh(x) OSSwapBigToHostInt64(x) | 38 | #define be64toh(x) OSSwapBigToHostInt64(x) |
39 | #define le64toh(x) OSSwapLittleToHostInt64(x) | 39 | #define le64toh(x) OSSwapLittleToHostInt64(x) |
40 | #else | 40 | #else |
41 | #include <byteswap.h> | 41 | #include "byteswap.h" |
42 | 42 | ||
43 | #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ | 43 | #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ |
44 | #define BYTESWAP16(x) x | 44 | #define BYTESWAP16(x) x |
diff --git a/src/libwifi/core/radiotap/platform.h b/src/libwifi/core/radiotap/platform.h index e0ad99f..fd92481 100644 --- a/src/libwifi/core/radiotap/platform.h +++ b/src/libwifi/core/radiotap/platform.h | |||
@@ -35,6 +35,10 @@ | |||
35 | #include <sys/types.h> | 35 | #include <sys/types.h> |
36 | #endif | 36 | #endif |
37 | 37 | ||
38 | #if defined(ESP_PLATFORM) | ||
39 | #include "endian.h" | ||
40 | #endif | ||
41 | |||
38 | #ifndef le16_to_cpu | 42 | #ifndef le16_to_cpu |
39 | #define le16_to_cpu le16toh | 43 | #define le16_to_cpu le16toh |
40 | #endif | 44 | #endif |
diff --git a/src/libwifi/parse/data/eapol.c b/src/libwifi/parse/data/eapol.c index b8e3d18..5f4a588 100644 --- a/src/libwifi/parse/data/eapol.c +++ b/src/libwifi/parse/data/eapol.c | |||
@@ -25,6 +25,10 @@ | |||
25 | #include <stdlib.h> | 25 | #include <stdlib.h> |
26 | #include <string.h> | 26 | #include <string.h> |
27 | 27 | ||
28 | #if defined(ESP_PLATFORM) | ||
29 | #include "endian.h" | ||
30 | #endif | ||
31 | |||
28 | /** | 32 | /** |
29 | * A libwifi_frame is deemed to be an EAPOL handshake if the following criteria is met: | 33 | * A libwifi_frame is deemed to be an EAPOL handshake if the following criteria is met: |
30 | * - The frame is of type TYPE_DATA, and | 34 | * - The frame is of type TYPE_DATA, and |