From babf43abf301d072192bda1f72a47440c354b072 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Fri, 4 Aug 2017 22:46:45 +0000 Subject: Add the higher layer of libwpactrl --- src/libwpactrl/wpactrl_bssid_scan.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/libwpactrl/wpactrl_bssid_scan.c (limited to 'src/libwpactrl/wpactrl_bssid_scan.c') diff --git a/src/libwpactrl/wpactrl_bssid_scan.c b/src/libwpactrl/wpactrl_bssid_scan.c new file mode 100644 index 0000000..ad4196c --- /dev/null +++ b/src/libwpactrl/wpactrl_bssid_scan.c @@ -0,0 +1,29 @@ +/* ISC license. */ + +#include +#include +#include +#include +#include + +size_t wpactrl_bssid_scan (char const *s, char *bssid) +{ + unsigned int i = 0 ; + if (!strncmp(s, "any", 3)) + { + memset(bssid, 0, 6) ; + return 3 ; + } + for (; i < 5 ; i++) + { + if (!ucharn_scan(s, bssid + i, 1)) goto eproto ; + if (s[2] != ':') goto eproto ; + s += 3 ; + } + if (!ucharn_scan(s, bssid + 5, 1)) goto eproto ; + return 17 ; + + eproto: + return (errno = EPROTO, 0) ; +} + -- cgit v1.3.1