Browse Source

[trac983] added basic action constants

JINMEI Tatuya 14 years ago
parent
commit
159caa607f
2 changed files with 13 additions and 1 deletions
  1. 12 0
      src/lib/python/isc/acl/acl.cc
  2. 1 1
      src/lib/python/isc/acl/tests/Makefile.am

+ 12 - 0
src/lib/python/isc/acl/acl.cc

@@ -16,6 +16,8 @@
 
 #include <util/python/pycppwrapper_util.h>
 
+#include <acl/acl.h>
+
 #include "acl.h"
 
 using namespace isc::util::python;
@@ -58,6 +60,16 @@ PyInit_acl(void) {
 
         po_LoaderError = PyErr_NewException("isc.acl.LoaderError", NULL, NULL);
         PyObjectContainer(po_LoaderError).installToModule(mod, "LoaderError");
+
+        // Install module constants.  Note that we can release our own
+        // references to these objects because we don't have corresponding
+        // C++ variables.
+        PyObjectContainer(Py_BuildValue("I", isc::acl::ACCEPT)).
+            installToModule(mod, "ACCEPT", false);
+        PyObjectContainer(Py_BuildValue("I", isc::acl::REJECT)).
+            installToModule(mod, "REJECT", false);
+        PyObjectContainer(Py_BuildValue("I", isc::acl::DROP)).
+            installToModule(mod, "DROP", false);
     } catch (...) {
         Py_DECREF(mod);
         return (NULL);

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

@@ -1,5 +1,5 @@
 PYCOVERAGE_RUN = @PYCOVERAGE_RUN@
-PYTESTS = dns_test.py
+PYTESTS = acl_test.py dns_test.py
 
 EXTRA_DIST = $(PYTESTS)