]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - net.h
Put IPv4-specific parts inside the ACL subsystem
[paraslash.git] / net.h
diff --git a/net.h b/net.h
index 0cb2767c72181e4d98222fbf6c8d6f54f312071e..8ec9fa52b9e4a05d259a820e82de56a584351ead 100644 (file)
--- a/net.h
+++ b/net.h
@@ -1,8 +1,9 @@
 /*
- * Copyright (C) 2006-2008 Andre Noll <maan@systemlinux.org>
+ * Copyright (C) 2006-2009 Andre Noll <maan@systemlinux.org>
  *
  * Licensed under the GPL v2. For licencing details see COPYING.
  */
+#include <stdbool.h>
 
 /** \file net.h exported symbols from net.c */
 
 #endif
 /** \endcond */
 
+/**
+ * Ensure that string conforms to the IPv4 address format.
+ *
+ * \param address The address string to check.
+ *
+ * \return 1 if \a address conforms to the IPv4 address format, else 0.
+ */
+_static_inline_ bool is_valid_ipv4_address(const char *address)
+{
+       struct in_addr test_it;
+
+       return inet_pton(AF_INET, address, &test_it) != 0;
+}
+
 /**
  * Generic socket creation (passive and active sockets).
  */