Browse Source

Interface of the isc.net.check module

git-svn-id: svn://bind10.isc.org/svn/bind10/branches/trac353@3068 e5f2f494-b856-4b98-b285-d166d9295462
Michal Vaner 14 years ago
parent
commit
417b7f04af

+ 1 - 0
configure.ac

@@ -487,6 +487,7 @@ AC_CONFIG_FILES([Makefile
                  src/lib/python/isc/config/tests/Makefile
                  src/lib/python/isc/log/Makefile
                  src/lib/python/isc/log/tests/Makefile
+                 src/lib/python/isc/net/Makefile
                  src/lib/python/isc/notify/Makefile
                  src/lib/python/isc/notify/tests/Makefile
                  src/lib/config/Makefile

+ 1 - 1
src/lib/python/isc/Makefile.am

@@ -1,4 +1,4 @@
-SUBDIRS = datasrc cc config log notify utils # Util
+SUBDIRS = datasrc cc config log net notify utils # Util
 
 python_PYTHON = __init__.py
 

+ 5 - 0
src/lib/python/isc/net/Makefile.am

@@ -0,0 +1,5 @@
+SUBDIRS = tests
+
+python_PYTHON = __init__.py check.py
+
+pythondir = $(pyexecdir)/isc/net

+ 3 - 0
src/lib/python/isc/net/__init__.py

@@ -0,0 +1,3 @@
+"""
+Here are function and classes that are related to networking.
+"""

+ 34 - 0
src/lib/python/isc/net/check.py

@@ -0,0 +1,34 @@
+# Copyright (C) 2010  CZ NIC
+#
+# Permission to use, copy, modify, and distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SYSTEMS CONSORTIUM
+# DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+# INTERNET SYSTEMS CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+# FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+"""
+Checking and parsing of ports and IP addresses.
+"""
+
+def port_check(port):
+    """
+    Takes a port as an int or string and checks if it is valid. It returns
+    the port as int. If it is not a valid port (the string doesn't contain
+    number or it is not in the valid range), it raises ValueError.
+    """
+    pass
+
+def addr_check(addr):
+    """
+    Checks and parses an IP address (either IPv4 or IPv6) and returns
+    the IPAddr object. It raises ValueError if the passed string is not
+    valid IP address.
+    """
+    pass