diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2017-07-09 07:46:23 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2017-07-09 07:46:23 +0000 |
commit | 22a1dc61ef8e4e1c98e3a088db1dbc84d424c7a7 (patch) | |
tree | efc5d779a40c004e708bd6a99b359c660931249b /src/include | |
parent | 0c9b6b3625dff03b6d590af597aa0f194790addb (diff) | |
download | bcnm-22a1dc61ef8e4e1c98e3a088db1dbc84d424c7a7.tar.xz |
Separate messages via \0, read messages one by one. Add wpactrl_scan_parse() skel.
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/bcnm/wpactrl.h | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/src/include/bcnm/wpactrl.h b/src/include/bcnm/wpactrl.h index af105c3..df5f2c1 100644 --- a/src/include/bcnm/wpactrl.h +++ b/src/include/bcnm/wpactrl.h @@ -5,8 +5,10 @@ #include <sys/types.h> #include <stdint.h> +#include <skalibs/gccattributes.h> #include <skalibs/tai.h> #include <skalibs/stralloc.h> +#include <skalibs/genalloc.h> typedef enum wparesponse_e wparesponse_t, *wparesponse_t_ref ; enum wparesponse_e @@ -36,10 +38,11 @@ struct wpactrl_s int fds ; int fda ; uint32_t options ; + size_t datahead ; stralloc data ; stralloc filters ; } ; -#define WPACTRL_ZERO { .fds = -1, .fda = -1, .options = 0, .data = STRALLOC_ZERO, .filters = STRALLOC_ZERO } +#define WPACTRL_ZERO { .fds = -1, .fda = -1, .options = 0, .datahead = 0, .data = STRALLOC_ZERO, .filters = STRALLOC_ZERO } #define WPACTRL_OPTION_NOFILTER 0x0001U @@ -63,9 +66,25 @@ extern void wpactrl_filter_remove (wpactrl_t *, char const *) ; #define wpactrl_filter_deactivate(a) ((a)->options |= WPACTRL_OPTION_NOFILTER) extern int wpactrl_update (wpactrl_t *) ; -#define wpactrl_data(a) ((a)->data.s) -#define wpactrl_datalen(a) ((a)->data.len)) -#define wpactrl_ackdata(a) ((a)->data.len = 0) +extern char *wpactrl_msg (wpactrl_t *) gccattr_pure ; +extern void wpactrl_ackmsg (wpactrl_t *) ; + + + /* High-level functions */ + +typedef struct wpactrl_scanres_s wpactrl_scanres_t, *wpactrl_scanres_t_ref ; +struct wpactrl_scanres_s +{ + char bssid[6] ; + uint16_t frequency ; + uint16_t signal_level ; + uint32_t flags ; + size_t ssid ; +} ; +#define WPACTRL_SCANRES_ZERO { .bssid = "\0\0\0\0\0", .frequency = 0, .signal_level = 0, .flags = 0, .ssid = 0 } + +extern int wpactrl_scan_parse (char const *, size_t, genalloc * /* wpactrl_scanres_t */, stralloc *) ; + /* |