summaryrefslogtreecommitdiffstats
path: root/src/util/util.h
diff options
context:
space:
mode:
authorMichal Zidek <mzidek@redhat.com>2013-10-01 16:22:13 +0200
committerJakub Hrozek <jhrozek@redhat.com>2013-10-17 14:11:29 +0200
commit2e57e339798f47ad84cae9121559d19192b79146 (patch)
treeadbcd9630eaad846b93685008b65cdbd0b3123c5 /src/util/util.h
parent6dc5ddd177e3b0ffe4315827aa8df7f33340585c (diff)
downloadsssd-2e57e339798f47ad84cae9121559d19192b79146.tar.gz
sssd-2e57e339798f47ad84cae9121559d19192b79146.tar.xz
sssd-2e57e339798f47ad84cae9121559d19192b79146.zip
util: Add functions to check if IP addresses is special
Added functions to check if given IP address is a special address (broadcast, multicast...).
Diffstat (limited to 'src/util/util.h')
-rw-r--r--src/util/util.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/util/util.h b/src/util/util.h
index 98b86e9db..3789c278c 100644
--- a/src/util/util.h
+++ b/src/util/util.h
@@ -37,6 +37,7 @@
#include <pcre.h>
#include <sys/types.h>
#include <sys/stat.h>
+#include <arpa/inet.h>
#include <talloc.h>
#include <tevent.h>
@@ -438,6 +439,18 @@ errno_t check_and_open_readonly(const char *filename, int *fd, const uid_t uid,
enum check_file_type type);
/* from util.c */
+#define SSS_NO_LINKLOCAL 0x01
+#define SSS_NO_LOOPBACK 0x02
+#define SSS_NO_MULTICAST 0x04
+#define SSS_NO_BROADCAST 0x08
+
+#define SSS_NO_SPECIAL \
+ (SSS_NO_LINKLOCAL|SSS_NO_LOOPBACK|SSS_NO_MULTICAST|SSS_NO_BROADCAST)
+
+/* These two functions accept addr in network order */
+bool check_ipv4_addr(struct in_addr *addr, uint8_t check);
+bool check_ipv6_addr(struct in6_addr *addr, uint8_t check);
+
int split_on_separator(TALLOC_CTX *mem_ctx, const char *str,
const char sep, bool trim, bool skip_empty,
char ***_list, int *size);