path: root/include/cidr.h
diff options
authorPablo Neira Ayuso <>2008-11-25 23:34:48 +0100
committerPablo Neira Ayuso <>2008-11-25 23:34:48 +0100
commitb2edf895af82914ab09a842641a45b7a806e9b1e (patch)
tree2b2890418f2f39bd12587288411420e9a0b9b369 /include/cidr.h
parent6262a4a7b7139fb5636228cb0f5a1e72f848d871 (diff)
filter: CIDR-based filtering support
This patch adds CIDR-based filtering support. The current implementation is O(n). This patch also introduces the vector data type which is used to store the IP address and the network mask. Signed-off-by: Pablo Neira Ayuso <>
Diffstat (limited to 'include/cidr.h')
1 files changed, 8 insertions, 0 deletions
diff --git a/include/cidr.h b/include/cidr.h
new file mode 100644
index 0000000..f8a4e2a
--- /dev/null
+++ b/include/cidr.h
@@ -0,0 +1,8 @@
+#ifndef _CIDR_H_
+uint32_t ipv4_cidr2mask_host(uint8_t cidr);
+uint32_t ipv4_cidr2mask_net(uint8_t cidr);
+void ipv6_cidr2mask_host(uint8_t cidr, uint32_t *res);
+void ipv6_cidr2mask_net(uint8_t cidr, uint32_t *res);