From 491bf900c44c12b796535ef5d2cd96fd0347fe4f Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Thu, 13 Aug 2015 17:11:07 +1000 Subject: [PATCH 1/2] espressif/esp_wifi.h: Add prereq includes --- include/espressif/esp_wifi.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/espressif/esp_wifi.h b/include/espressif/esp_wifi.h index e2274f1..5dae103 100644 --- a/include/espressif/esp_wifi.h +++ b/include/espressif/esp_wifi.h @@ -8,6 +8,10 @@ #ifndef __ESP_WIFI_H__ #define __ESP_WIFI_H__ +#include +#include + +#include enum { NULL_MODE = 0, From 7f983bc4747560b5699ab3a42a38449c95d2fab1 Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Thu, 20 Aug 2015 15:33:08 +1000 Subject: [PATCH 2/2] Add netbuf_helpers.h temporary header --- lwip/include/netbuf_helpers.h | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 lwip/include/netbuf_helpers.h diff --git a/lwip/include/netbuf_helpers.h b/lwip/include/netbuf_helpers.h new file mode 100644 index 0000000..4f02ba5 --- /dev/null +++ b/lwip/include/netbuf_helpers.h @@ -0,0 +1,28 @@ +/* Some netbuf helpers that should probably be rolled into a patch to lwip soon */ +#ifndef _NETBUF_HELPERS_H +#define _NETBUF_HELPERS_H +#include "lwip/netbuf.h" + +/* Read a 16 bit wide unsigned integer, stored host order, from the netbuf */ +inline static u16_t netbuf_read_u16_h(struct netbuf *netbuf, u16_t offs) +{ + u16_t raw; + netbuf_copy_partial(netbuf, &raw, 2, offs); + return raw; +} + +/* Read a 16 bit wide unsigned integer, stored network order, from the netbuf */ +inline static u16_t netbuf_read_u16_n(struct netbuf *netbuf, u16_t offs) +{ + return ntohs(netbuf_read_u16_h(netbuf, offs)); +} + +/* Read an 8 bit unsigned integer from the netbuf */ +inline static u8_t netbuf_read_u8(struct netbuf *netbuf, u16_t offs) +{ + u8_t result; + netbuf_copy_partial(netbuf, &result, 1, offs); + return result; +} + +#endif