about summary refs log tree commit diff
path: root/src/libwpactrl/wpactrl_nextmsg.c
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2017-07-09 07:46:23 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2017-07-09 07:46:23 +0000
commit22a1dc61ef8e4e1c98e3a088db1dbc84d424c7a7 (patch)
treeefc5d779a40c004e708bd6a99b359c660931249b /src/libwpactrl/wpactrl_nextmsg.c
parent0c9b6b3625dff03b6d590af597aa0f194790addb (diff)
downloadbcnm-22a1dc61ef8e4e1c98e3a088db1dbc84d424c7a7.tar.gz
bcnm-22a1dc61ef8e4e1c98e3a088db1dbc84d424c7a7.tar.xz
bcnm-22a1dc61ef8e4e1c98e3a088db1dbc84d424c7a7.zip
Separate messages via \0, read messages one by one. Add wpactrl_scan_parse() skel.
Diffstat (limited to 'src/libwpactrl/wpactrl_nextmsg.c')
-rw-r--r--src/libwpactrl/wpactrl_nextmsg.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/libwpactrl/wpactrl_nextmsg.c b/src/libwpactrl/wpactrl_nextmsg.c
new file mode 100644
index 0000000..4954db9
--- /dev/null
+++ b/src/libwpactrl/wpactrl_nextmsg.c
@@ -0,0 +1,14 @@
+/* ISC license. */
+
+#include <string.h>
+#include <bcnm/wpactrl.h>
+
+void wpactrl_nextmsg (wpactrl_t *a)
+{
+  if (a->datahead < a->data.len) a->datahead += strlen(a->data.s + a->datahead) + 1 ;
+  if (a->datahead >= a->data.len)
+  {
+    a->data.len = 0 ;
+    a->datahead = 0 ;
+  }
+}