]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
hostbits: add list API
authorVictor Julien <victor@inliniac.net>
Wed, 21 Dec 2016 10:16:41 +0000 (11:16 +0100)
committerVictor Julien <victor@inliniac.net>
Thu, 16 Feb 2017 09:35:44 +0000 (10:35 +0100)
src/host-bit.c
src/host-bit.h

index 757654f7be729842617b6bcca98ad0df5a355cbd..6710caebf113d4a25c243432d2d9c27fe10d0241 100644 (file)
@@ -181,6 +181,25 @@ int HostBitIsnotset(Host *h, uint32_t idx, uint32_t ts)
     return 0;
 }
 
+int HostBitList(Host *h, XBit **iter)
+{
+    GenericVar *gv = (GenericVar *)*iter;
+    if (gv == NULL) {
+        gv = HostGetStorageById(h, host_bit_id);
+    } else {
+        gv = gv->next;
+    }
+
+    for ( ; gv != NULL; gv = gv->next) {
+        if (gv->type == DETECT_XBITS) {
+            *iter = (XBit *)gv;
+            return 1;
+        }
+    }
+    *iter = NULL;
+    return 0;
+}
+
 /* TESTS */
 #ifdef UNITTESTS
 static int HostBitTest01 (void)
index f125ed09cb51901b59b17a6acc2e974828e64b2e..388147dad58ccfc5b4440521194c323003cbf195 100644 (file)
@@ -38,4 +38,6 @@ void HostBitUnset(Host *, uint32_t);
 void HostBitToggle(Host *, uint32_t, uint32_t);
 int HostBitIsset(Host *, uint32_t, uint32_t);
 int HostBitIsnotset(Host *, uint32_t, uint32_t);
+int HostBitList(Host *, XBit **);
+
 #endif /* __HOST_BIT_H__ */