From 195eb3a97b67e9ffa179f814ac13b8bdbc574e90 Mon Sep 17 00:00:00 2001 From: ourairquality Date: Fri, 16 Sep 2016 12:22:57 +1000 Subject: [PATCH] libnet80211: start an open_esplib library. --- open_esplibs/component.mk | 11 +++++-- open_esplibs/include/open_esplibs.h | 12 ++++++++ open_esplibs/libnet80211/ieee80211_hostap.c | 31 +++++++++++++++++++ open_esplibs/libnet80211/wl_cnx.c | 34 +++++++++++++++++++++ 4 files changed, 86 insertions(+), 2 deletions(-) create mode 100644 open_esplibs/libnet80211/ieee80211_hostap.c create mode 100644 open_esplibs/libnet80211/wl_cnx.c diff --git a/open_esplibs/component.mk b/open_esplibs/component.mk index 23c8b6a..09fd99e 100644 --- a/open_esplibs/component.mk +++ b/open_esplibs/component.mk @@ -5,11 +5,18 @@ INC_DIRS += $(open_esplibs_ROOT)include $(eval $(call component_compile_rules,open_esplibs)) # args for passing into compile rule generation -open_esplibs_libmain_ROOT = $(open_esplibs_libmain_DEFAULT_ROOT)libmain +open_esplibs_libmain_ROOT = $(open_esplibs_ROOT)libmain open_esplibs_libmain_INC_DIR = open_esplibs_libmain_SRC_DIR = $(open_esplibs_libmain_ROOT) open_esplibs_libmain_EXTRA_SRC_FILES = - open_esplibs_libmain_CFLAGS = $(CFLAGS) $(eval $(call component_compile_rules,open_esplibs_libmain)) + +open_esplibs_libnet80211_ROOT = $(open_esplibs_ROOT)libnet80211 +open_esplibs_libnet80211_INC_DIR = +open_esplibs_libnet80211_SRC_DIR = $(open_esplibs_libnet80211_ROOT) +open_esplibs_libnet80211_EXTRA_SRC_FILES = +open_esplibs_libnet80211_CFLAGS = $(CFLAGS) + +$(eval $(call component_compile_rules,open_esplibs_libnet80211)) diff --git a/open_esplibs/include/open_esplibs.h b/open_esplibs/include/open_esplibs.h index 8db3127..4914a1d 100644 --- a/open_esplibs/include/open_esplibs.h +++ b/open_esplibs/include/open_esplibs.h @@ -36,4 +36,16 @@ #define OPEN_LIBMAIN_USER_INTERFACE (OPEN_LIBMAIN) #endif +#ifndef OPEN_LIBNET80211 +#define OPEN_LIBNET80211 (OPEN_ESPLIBS) +#endif + +#ifndef OPEN_LIBNET80211_WL_CNX +#define OPEN_LIBNET80211_WL_CNX (OPEN_LIBNET80211) +#endif + +#ifndef OPEN_LIBNET80211_HOSTAP +#define OPEN_LIBNET80211_HOSTAP (OPEN_LIBNET80211) +#endif + #endif /* _OPEN_ESPLIBS_H */ diff --git a/open_esplibs/libnet80211/ieee80211_hostap.c b/open_esplibs/libnet80211/ieee80211_hostap.c new file mode 100644 index 0000000..745461e --- /dev/null +++ b/open_esplibs/libnet80211/ieee80211_hostap.c @@ -0,0 +1,31 @@ +/* Recreated Espressif libnet80211 ieee80211_hostap.o contents. + + Copyright (C) 2015 Espressif Systems. Derived from MIT Licensed SDK libraries. + BSD Licensed as described in the file LICENSE +*/ +#include "open_esplibs.h" +#if OPEN_LIBNET80211_HOSTAP +// The contents of this file are only built if OPEN_LIBNET80211_HOSTAP is set to true + +#include "sdk_internal.h" + +void sdk_ieee80211_send_mgmt(void *, int, int); +void sdk_cnx_node_leave(struct sdk_g_ic_netif_info *netif, struct sdk_netif_conninfo *conn); + +void sdk_hostap_handle_timer(struct sdk_netif_conninfo *cnx_node) +{ + uint32_t count1 = *(uint32_t *)(((void *)cnx_node) + 0x108); + uint32_t count2 = TIMER_FRC2.COUNT; + + if ((count2 - count1) > 93599688U) { + struct sdk_g_ic_netif_info *info = sdk_g_ic.v.softap_netif_info; + struct sdk_netif_conninfo *conninfo = info->_unknown88; + info->_unknown88 = cnx_node; + sdk_ieee80211_send_mgmt(info, 160, 4); + sdk_ieee80211_send_mgmt(info, 192, 2); + info->_unknown88 = conninfo; + sdk_cnx_node_leave(info, cnx_node); + } +} + +#endif /* OPEN_LIBNET80211_HOSTAP */ diff --git a/open_esplibs/libnet80211/wl_cnx.c b/open_esplibs/libnet80211/wl_cnx.c new file mode 100644 index 0000000..7ed74f5 --- /dev/null +++ b/open_esplibs/libnet80211/wl_cnx.c @@ -0,0 +1,34 @@ +/* Recreated Espressif libnet80211 wl_cnx.o contents. + + Copyright (C) 2015 Espressif Systems. Derived from MIT Licensed SDK libraries. + BSD Licensed as described in the file LICENSE +*/ +#include "open_esplibs.h" +#if OPEN_LIBNET80211_WL_CNX +// The contents of this file are only built if OPEN_LIBNET80211_WL_CNX is set to true + +#include "espressif/esp_misc.h" +#include "sdk_internal.h" +#include + +void *sdk_cnx_node_search(uint8_t mac[6]) +{ + int count = sdk_g_ic.s._unknown310 + 2; + if (count < 1) + return NULL; + + struct sdk_netif_conninfo **conninfo = sdk_g_ic.v.softap_netif_info->conninfo; + + int i = 0; + do { + struct sdk_netif_conninfo *info = conninfo[i]; + + if (info && memcmp(mac, info, 6) == 0) + return info; + i = i + 1; + } while (i != count); + + return NULL; +} + +#endif /* OPEN_LIBNET80211_WL_CNX */