From c70783d8dbbe1373989f72b413389d23892c1000 Mon Sep 17 00:00:00 2001 From: Eric Leblond Date: Wed, 8 Aug 2012 00:06:04 +0200 Subject: addr: add file containing addr utility functions. --- include/ulogd/addr.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 include/ulogd/addr.h (limited to 'include') diff --git a/include/ulogd/addr.h b/include/ulogd/addr.h new file mode 100644 index 0000000..9c91270 --- /dev/null +++ b/include/ulogd/addr.h @@ -0,0 +1,18 @@ +#ifndef _ADDR_H +#define _ADDR_H + +u_int32_t ulogd_bits2netmask(int bits); +void ulogd_ipv6_cidr2mask_host(uint8_t cidr, uint32_t *res); +void ulogd_ipv6_addr2addr_host(uint32_t *addr, uint32_t *res); + +struct ulogd_addr { + union { + uint32_t ipv4; + uint32_t ipv6[4]; + } in; + uint32_t netmask; +}; + +int ulogd_parse_addr(char *string, size_t len, struct ulogd_addr *addr); + +#endif -- cgit v1.2.3