Browse Source

[1245] remove initModule from headers

and move it to an internal namespace
move the declaration of the functions to pydnspp.cc
Jelte Jansen 13 years ago
parent
commit
9c53309978
35 changed files with 83 additions and 63 deletions
  1. 2 0
      src/lib/dns/python/edns_python.cc
  2. 0 2
      src/lib/dns/python/edns_python.h
  3. 2 0
      src/lib/dns/python/message_python.cc
  4. 0 2
      src/lib/dns/python/message_python.h
  5. 3 0
      src/lib/dns/python/messagerenderer_python.cc
  6. 0 2
      src/lib/dns/python/messagerenderer_python.h
  7. 2 0
      src/lib/dns/python/name_python.cc
  8. 0 2
      src/lib/dns/python/name_python.h
  9. 2 0
      src/lib/dns/python/opcode_python.cc
  10. 0 3
      src/lib/dns/python/opcode_python.h
  11. 33 17
      src/lib/dns/python/pydnspp.cc
  12. 2 0
      src/lib/dns/python/question_python.cc
  13. 0 2
      src/lib/dns/python/question_python.h
  14. 2 0
      src/lib/dns/python/rcode_python.cc
  15. 0 2
      src/lib/dns/python/rcode_python.h
  16. 2 0
      src/lib/dns/python/rdata_python.cc
  17. 0 2
      src/lib/dns/python/rdata_python.h
  18. 2 0
      src/lib/dns/python/rrclass_python.cc
  19. 0 2
      src/lib/dns/python/rrclass_python.h
  20. 2 0
      src/lib/dns/python/rrset_python.cc
  21. 0 2
      src/lib/dns/python/rrset_python.h
  22. 2 0
      src/lib/dns/python/rrttl_python.cc
  23. 0 2
      src/lib/dns/python/rrttl_python.h
  24. 2 0
      src/lib/dns/python/rrtype_python.cc
  25. 0 2
      src/lib/dns/python/rrtype_python.h
  26. 4 1
      src/lib/dns/python/tsig_python.cc
  27. 0 2
      src/lib/dns/python/tsig_python.h
  28. 4 2
      src/lib/dns/python/tsig_rdata_python.cc
  29. 0 2
      src/lib/dns/python/tsig_rdata_python.h
  30. 4 2
      src/lib/dns/python/tsigerror_python.cc
  31. 0 2
      src/lib/dns/python/tsigerror_python.h
  32. 10 4
      src/lib/dns/python/tsigkey_python.cc
  33. 0 3
      src/lib/dns/python/tsigkey_python.h
  34. 3 1
      src/lib/dns/python/tsigrecord_python.cc
  35. 0 2
      src/lib/dns/python/tsigrecord_python.h

+ 2 - 0
src/lib/dns/python/edns_python.cc

@@ -349,6 +349,7 @@ PyTypeObject edns_type = {
     0                                   // tp_version_tag
 };
 
+namespace internal {
 bool
 initModulePart_EDNS(PyObject* mod) {
     // We initialize the static description object with PyType_Ready(),
@@ -366,6 +367,7 @@ initModulePart_EDNS(PyObject* mod) {
 
     return (true);
 }
+} // end namespace internal
 
 } // end namespace python
 } // end namespace dns

+ 0 - 2
src/lib/dns/python/edns_python.h

@@ -35,8 +35,6 @@ public:
 
 extern PyTypeObject edns_type;
 
-bool initModulePart_EDNS(PyObject* mod);
-
 } // namespace python
 } // namespace dns
 } // namespace isc

+ 2 - 0
src/lib/dns/python/message_python.cc

@@ -750,6 +750,7 @@ PyTypeObject message_type = {
 };
 
 // Module Initialization, all statics are initialized here
+namespace internal {
 bool
 initModulePart_Message(PyObject* mod) {
     if (PyType_Ready(&message_type) < 0) {
@@ -816,6 +817,7 @@ initModulePart_Message(PyObject* mod) {
 
     return (true);
 }
+} // end namespace internal
 
 } // end python namespace
 } // end dns namespace

+ 0 - 2
src/lib/dns/python/message_python.h

@@ -40,8 +40,6 @@ public:
 
 extern PyTypeObject message_type;
 
-bool initModulePart_Message(PyObject* mod);
-
 } // namespace python
 } // namespace dns
 } // namespace isc

+ 3 - 0
src/lib/dns/python/messagerenderer_python.cc

@@ -225,6 +225,7 @@ PyTypeObject messagerenderer_type = {
     0                                   // tp_version_tag
 };
 
+namespace internal {
 bool initModulePart_MessageRenderer(PyObject* mod) {
     if (PyType_Ready(&messagerenderer_type) < 0) {
         return (false);
@@ -241,6 +242,8 @@ bool initModulePart_MessageRenderer(PyObject* mod) {
 
     return (true);
 }
+} // end namespace internal
+
 } // namespace python
 } // namespace dns
 } // namespace isc

+ 0 - 2
src/lib/dns/python/messagerenderer_python.h

@@ -38,8 +38,6 @@ public:
 
 extern PyTypeObject messagerenderer_type;
 
-bool initModulePart_MessageRenderer(PyObject* mod);
-
 } // namespace python
 } // namespace dns
 } // namespace isc

+ 2 - 0
src/lib/dns/python/name_python.cc

@@ -624,6 +624,7 @@ PyTypeObject name_type = {
     0                                   // tp_version_tag
 };
 
+namespace internal {
 bool
 initModulePart_Name(PyObject* mod) {
     // Add the classes to the module
@@ -704,6 +705,7 @@ initModulePart_Name(PyObject* mod) {
 
     return (true);
 }
+} // end namespace internal
 
 PyObject*
 createNameObject(const Name& source) {

+ 0 - 2
src/lib/dns/python/name_python.h

@@ -61,8 +61,6 @@ public:
 extern PyTypeObject name_comparison_result_type;
 extern PyTypeObject name_type;
 
-bool initModulePart_Name(PyObject* mod);
-
 /// This is A simple shortcut to create a python Name object (in the
 /// form of a pointer to PyObject) with minimal exception safety.
 /// On success, it returns a valid pointer to PyObject with a reference

+ 2 - 0
src/lib/dns/python/opcode_python.cc

@@ -330,6 +330,7 @@ PyTypeObject opcode_type = {
     0                                   // tp_version_tag
 };
 
+namespace internal {
 bool
 initModulePart_Opcode(PyObject* mod) {
     // We initialize the static description object with PyType_Ready(),
@@ -380,6 +381,7 @@ initModulePart_Opcode(PyObject* mod) {
 
     return (true);
 }
+} // end namespace internal
 
 } // end python namespace
 } // end dns namespace

+ 0 - 3
src/lib/dns/python/opcode_python.h

@@ -36,11 +36,8 @@ public:
     bool static_code;
 };
 
-
 extern PyTypeObject opcode_type;
 
-bool initModulePart_Opcode(PyObject* mod);
-
 } // namespace python
 } // namespace dns
 } // namespace isc

+ 33 - 17
src/lib/dns/python/pydnspp.cc

@@ -38,25 +38,41 @@
 #include <dns/messagerenderer.h>
 
 #include "pydnspp_common.h"
-#include "messagerenderer_python.h"
-#include "name_python.h"
-#include "rrclass_python.h"
-#include "rrtype_python.h"
-#include "rrttl_python.h"
-#include "rdata_python.h"
-#include "rcode_python.h"
-#include "opcode_python.h"
-#include "rrset_python.h"
-#include "tsigkey_python.h"
-#include "tsig_rdata_python.h"
-#include "tsigerror_python.h"
-#include "tsigrecord_python.h"
-#include "tsig_python.h"
-#include "question_python.h"
-#include "message_python.h"
-#include "edns_python.h"
+/* Note that we do forward declarations of the initialization functions here,
+ * and these are not defined in headers (since they are not to be used in any
+ * other place */
+namespace isc {
+namespace dns {
+namespace python {
+namespace internal {
+
+bool initModulePart_EDNS(PyObject* mod);
+bool initModulePart_Message(PyObject* mod);
+bool initModulePart_MessageRenderer(PyObject* mod);
+bool initModulePart_Name(PyObject* mod);
+bool initModulePart_Opcode(PyObject* mod);
+bool initModulePart_Question(PyObject* mod);
+bool initModulePart_Rcode(PyObject* mod);
+bool initModulePart_Rdata(PyObject* mod);
+bool initModulePart_RRClass(PyObject* mod);
+bool initModulePart_RRset(PyObject* mod);
+bool initModulePart_RRTTL(PyObject* mod);
+bool initModulePart_RRType(PyObject* mod);
+bool initModulePart_TSIGError(PyObject* mod);
+bool initModulePart_TSIGKey(PyObject* mod);
+bool initModulePart_TSIGKeyRing(PyObject* mod);
+bool initModulePart_TSIGContext(PyObject* mod);
+bool initModulePart_TSIG(PyObject* mod);
+bool initModulePart_TSIGRecord(PyObject* mod);
+
+}
+} // namespace python
+} // namespace dns
+} // namespace isc
+
 
 using namespace isc::dns::python;
+using namespace isc::dns::python::internal;
 
 //
 // Definition of the module

+ 2 - 0
src/lib/dns/python/question_python.cc

@@ -273,6 +273,7 @@ PyTypeObject question_type = {
     0                                   // tp_version_tag
 };
 
+namespace internal {
 bool
 initModulePart_Question(PyObject* mod) {
     // Add the exceptions to the module
@@ -289,6 +290,7 @@ initModulePart_Question(PyObject* mod) {
 
     return (true);
 }
+} // end namespace internal
 
 } // end python namespace
 } // end dns namespace

+ 0 - 2
src/lib/dns/python/question_python.h

@@ -37,8 +37,6 @@ public:
 
 extern PyTypeObject question_type;
 
-bool initModulePart_Question(PyObject* mod);
-
 } // namespace python
 } // namespace dns
 } // namespace isc

+ 2 - 0
src/lib/dns/python/rcode_python.cc

@@ -361,6 +361,7 @@ PyTypeObject rcode_type = {
     0                                   // tp_version_tag
 };
 
+namespace internal {
 bool
 initModulePart_Rcode(PyObject* mod) {
     // We initialize the static description object with PyType_Ready(),
@@ -413,6 +414,7 @@ initModulePart_Rcode(PyObject* mod) {
 
     return (true);
 }
+} // end namespace internal
 
 } // namespace python
 } // namespace dns

+ 0 - 2
src/lib/dns/python/rcode_python.h

@@ -45,8 +45,6 @@ public:
 
 extern PyTypeObject rcode_type;
 
-bool initModulePart_Rcode(PyObject* mod);
-
 } // namespace python
 } // namespace dns
 } // namespace isc

+ 2 - 0
src/lib/dns/python/rdata_python.cc

@@ -253,6 +253,7 @@ PyTypeObject rdata_type = {
     0                                   // tp_version_tag
 };
 
+namespace internal {
 // Module Initialization, all statics are initialized here
 bool
 initModulePart_Rdata(PyObject* mod) {
@@ -279,6 +280,7 @@ initModulePart_Rdata(PyObject* mod) {
 
     return (true);
 }
+} // end namespace internal
 
 } // end python namespace
 } // end dns namespace

+ 0 - 2
src/lib/dns/python/rdata_python.h

@@ -37,8 +37,6 @@ public:
 
 extern PyTypeObject rdata_type;
 
-bool initModulePart_Rdata(PyObject* mod);
-
 } // namespace python
 } // namespace dns
 } // namespace isc

+ 2 - 0
src/lib/dns/python/rrclass_python.cc

@@ -331,6 +331,7 @@ PyTypeObject rrclass_type = {
 
 
 // Module Initialization, all statics are initialized here
+namespace internal {
 bool
 initModulePart_RRClass(PyObject* mod) {
     // Add the exceptions to the module
@@ -353,6 +354,7 @@ initModulePart_RRClass(PyObject* mod) {
 
     return (true);
 }
+} // end namespace internal
 
 PyObject*
 createRRClassObject(const RRClass& source) {

+ 0 - 2
src/lib/dns/python/rrclass_python.h

@@ -39,8 +39,6 @@ public:
 
 extern PyTypeObject rrclass_type;
 
-bool initModulePart_RRClass(PyObject* mod);
-
 /// This is a simple shortcut to create a python RRClass object (in the
 /// form of a pointer to PyObject) with minimal exception safety.
 /// On success, it returns a valid pointer to PyObject with a reference

+ 2 - 0
src/lib/dns/python/rrset_python.cc

@@ -393,6 +393,7 @@ PyTypeObject rrset_type = {
 
 
 // Module Initialization, all statics are initialized here
+namespace internal {
 bool
 initModulePart_RRset(PyObject* mod) {
     // Add the exceptions to the module
@@ -417,6 +418,7 @@ initModulePart_RRset(PyObject* mod) {
 
     return (true);
 }
+} // end namespace internal
 
 PyObject*
 createRRsetObject(const RRset& source) {

+ 0 - 2
src/lib/dns/python/rrset_python.h

@@ -46,8 +46,6 @@ public:
 
 extern PyTypeObject rrset_type;
 
-bool initModulePart_RRset(PyObject* mod);
-
 /// This is a simple shortcut to create a python RRset object (in the
 /// form of a pointer to PyObject) with minimal exception safety.
 /// On success, it returns a valid pointer to PyObject with a reference

+ 2 - 0
src/lib/dns/python/rrttl_python.cc

@@ -285,6 +285,7 @@ PyTypeObject rrttl_type = {
 };
 
 // Module Initialization, all statics are initialized here
+namespace internal {
 bool
 initModulePart_RRTTL(PyObject* mod) {
     // Add the exceptions to the module
@@ -305,6 +306,7 @@ initModulePart_RRTTL(PyObject* mod) {
 
     return (true);
 }
+} // end namespace internal
 
 } // namespace python
 } // namespace dns

+ 0 - 2
src/lib/dns/python/rrttl_python.h

@@ -40,8 +40,6 @@ public:
 
 extern PyTypeObject rrttl_type;
 
-bool initModulePart_RRTTL(PyObject* mod);
-
 } // namespace python
 } // namespace dns
 } // namespace isc

+ 2 - 0
src/lib/dns/python/rrtype_python.cc

@@ -428,6 +428,7 @@ PyTypeObject rrtype_type = {
     0                                   // tp_version_tag
 };
 
+namespace internal {
 bool
 initModulePart_RRType(PyObject* mod) {
     // Add the exceptions to the module
@@ -448,6 +449,7 @@ initModulePart_RRType(PyObject* mod) {
 
     return (true);
 }
+} // end namespace internal
 
 PyObject*
 createRRTypeObject(const RRType& source) {

+ 0 - 2
src/lib/dns/python/rrtype_python.h

@@ -40,8 +40,6 @@ public:
 
 extern PyTypeObject rrtype_type;
 
-bool initModulePart_RRType(PyObject* mod);
-
 /// This is a simple shortcut to create a python RRType object (in the
 /// form of a pointer to PyObject) with minimal exception safety.
 /// On success, it returns a valid pointer to PyObject with a reference

+ 4 - 1
src/lib/dns/python/tsig_python.cc

@@ -264,7 +264,7 @@ PyTypeObject tsigcontext_type = {
     NULL,                               // tp_as_number
     NULL,                               // tp_as_sequence
     NULL,                               // tp_as_mapping
-    NULL,                               // tp_hash 
+    NULL,                               // tp_hash
     NULL,                               // tp_call
     NULL,                               // tp_str
     NULL,                               // tp_getattro
@@ -308,6 +308,7 @@ PyTypeObject tsigcontext_type = {
 };
 
 // Module Initialization, all statics are initialized here
+namespace internal {
 bool
 initModulePart_TSIGContext(PyObject* mod) {
     // We initialize the static description object with PyType_Ready(),
@@ -359,6 +360,8 @@ initModulePart_TSIGContext(PyObject* mod) {
 
     return (true);
 }
+} // end namespace internal
+
 } // namespace python
 } // namespace dns
 } // namespace isc

+ 0 - 2
src/lib/dns/python/tsig_python.h

@@ -35,8 +35,6 @@ extern PyTypeObject tsigcontext_type;
 // Class specific exceptions
 extern PyObject* po_TSIGContextError;
 
-bool initModulePart_TSIGContext(PyObject* mod);
-
 } // namespace python
 } // namespace dns
 } // namespace isc

+ 4 - 2
src/lib/dns/python/tsig_rdata_python.cc

@@ -236,7 +236,7 @@ TSIG_toWire(const s_TSIG* const self, PyObject* args) {
                 self, args));
 }
 
-PyObject* 
+PyObject*
 TSIG_richcmp(const s_TSIG* const self,
                    const s_TSIG* const other,
                    const int op)
@@ -303,7 +303,7 @@ PyTypeObject tsig_type = {
     NULL,                               // tp_as_number
     NULL,                               // tp_as_sequence
     NULL,                               // tp_as_mapping
-    NULL,                               // tp_hash 
+    NULL,                               // tp_hash
     NULL,                               // tp_call
     TSIG_str,                       // tp_str
     NULL,                               // tp_getattro
@@ -342,6 +342,7 @@ PyTypeObject tsig_type = {
 };
 
 // Module Initialization, all statics are initialized here
+namespace internal {
 bool
 initModulePart_TSIG(PyObject* mod) {
     // We initialize the static description object with PyType_Ready(),
@@ -358,6 +359,7 @@ initModulePart_TSIG(PyObject* mod) {
 
     return (true);
 }
+} // end namespace internal
 
 PyObject*
 createTSIGObject(const any::TSIG& source) {

+ 0 - 2
src/lib/dns/python/tsig_rdata_python.h

@@ -36,8 +36,6 @@ public:
 
 extern PyTypeObject tsig_type;
 
-bool initModulePart_TSIG(PyObject* mod);
-
 /// This is A simple shortcut to create a python TSIG object (in the
 /// form of a pointer to PyObject) with minimal exception safety.
 /// On success, it returns a valid pointer to PyObject with a reference

+ 4 - 2
src/lib/dns/python/tsigerror_python.cc

@@ -190,7 +190,7 @@ TSIGError_toRcode(const s_TSIGError* const self) {
     return (NULL);
 }
 
-PyObject* 
+PyObject*
 TSIGError_richcmp(const s_TSIGError* const self,
                    const s_TSIGError* const other,
                    const int op)
@@ -252,7 +252,7 @@ PyTypeObject tsigerror_type = {
     NULL,                               // tp_as_number
     NULL,                               // tp_as_sequence
     NULL,                               // tp_as_mapping
-    NULL,                               // tp_hash 
+    NULL,                               // tp_hash
     NULL,                               // tp_call
     // THIS MAY HAVE TO BE CHANGED TO NULL:
     TSIGError_str,                       // tp_str
@@ -300,6 +300,7 @@ installTSIGErrorConstant(const char* name, const TSIGError& val) {
 }
 
 // Module Initialization, all statics are initialized here
+namespace internal {
 bool
 initModulePart_TSIGError(PyObject* mod) {
     // We initialize the static description object with PyType_Ready(),
@@ -358,6 +359,7 @@ initModulePart_TSIGError(PyObject* mod) {
 
     return (true);
 }
+} // end namespace internal
 
 PyObject*
 createTSIGErrorObject(const TSIGError& source) {

+ 0 - 2
src/lib/dns/python/tsigerror_python.h

@@ -32,8 +32,6 @@ public:
 
 extern PyTypeObject tsigerror_type;
 
-bool initModulePart_TSIGError(PyObject* mod);
-
 /// This is A simple shortcut to create a python TSIGError object (in the
 /// form of a pointer to PyObject) with minimal exception safety.
 /// On success, it returns a valid pointer to PyObject with a reference

+ 10 - 4
src/lib/dns/python/tsigkey_python.cc

@@ -196,7 +196,7 @@ PyTypeObject tsigkey_type = {
     NULL,                               // tp_as_number
     NULL,                               // tp_as_sequence
     NULL,                               // tp_as_mapping
-    NULL,                               // tp_hash 
+    NULL,                               // tp_hash
     NULL,                               // tp_call
     NULL,                               // tp_str
     NULL,                               // tp_getattro
@@ -234,6 +234,7 @@ PyTypeObject tsigkey_type = {
 };
 
 // Module Initialization, all statics are initialized here
+namespace internal {
 bool
 initModulePart_TSIGKey(PyObject* mod) {
     // We initialize the static description object with PyType_Ready(),
@@ -276,6 +277,8 @@ initModulePart_TSIGKey(PyObject* mod) {
 
     return (true);
 }
+} // end namespace internal
+
 } // namespace python
 } // namespace dns
 } // namespace isc
@@ -329,7 +332,7 @@ TSIGKeyRing_init(s_TSIGKeyRing* self, PyObject* args) {
                         "Invalid arguments to TSIGKeyRing constructor");
         return (-1);
     }
-    
+
     self->cppobj = new(nothrow) TSIGKeyRing();
     if (self->cppobj == NULL) {
         PyErr_SetString(po_IscException, "Allocating TSIGKeyRing failed");
@@ -354,7 +357,7 @@ TSIGKeyRing_size(const s_TSIGKeyRing* const self) {
 PyObject*
 TSIGKeyRing_add(const s_TSIGKeyRing* const self, PyObject* args) {
     s_TSIGKey* tsigkey;
-    
+
     if (PyArg_ParseTuple(args, "O!", &tsigkey_type, &tsigkey)) {
         try {
             const TSIGKeyRing::Result result =
@@ -436,7 +439,7 @@ PyTypeObject tsigkeyring_type = {
     NULL,                               // tp_as_number
     NULL,                               // tp_as_sequence
     NULL,                               // tp_as_mapping
-    NULL,                               // tp_hash 
+    NULL,                               // tp_hash
     NULL,                               // tp_call
     NULL,                               // tp_str
     NULL,                               // tp_getattro
@@ -472,6 +475,7 @@ PyTypeObject tsigkeyring_type = {
     0                                   // tp_version_tag
 };
 
+namespace internal {
 bool
 initModulePart_TSIGKeyRing(PyObject* mod) {
     if (PyType_Ready(&tsigkeyring_type) < 0) {
@@ -494,6 +498,8 @@ initModulePart_TSIGKeyRing(PyObject* mod) {
 
     return (true);
 }
+} // end namespace internal
+
 } // namespace python
 } // namespace dns
 } // namespace isc

+ 0 - 3
src/lib/dns/python/tsigkey_python.h

@@ -39,9 +39,6 @@ public:
 extern PyTypeObject tsigkey_type;
 extern PyTypeObject tsigkeyring_type;
 
-bool initModulePart_TSIGKey(PyObject* mod);
-bool initModulePart_TSIGKeyRing(PyObject* mod);
-
 } // namespace python
 } // namespace dns
 } // namespace isc

+ 3 - 1
src/lib/dns/python/tsigrecord_python.cc

@@ -226,7 +226,7 @@ PyTypeObject tsigrecord_type = {
     NULL,                               // tp_as_number
     NULL,                               // tp_as_sequence
     NULL,                               // tp_as_mapping
-    NULL,                               // tp_hash 
+    NULL,                               // tp_hash
     NULL,                               // tp_call
     TSIGRecord_str,                       // tp_str
     NULL,                               // tp_getattro
@@ -263,6 +263,7 @@ PyTypeObject tsigrecord_type = {
 };
 
 // Module Initialization, all statics are initialized here
+namespace internal {
 bool
 initModulePart_TSIGRecord(PyObject* mod) {
     // We initialize the static description object with PyType_Ready(),
@@ -298,6 +299,7 @@ initModulePart_TSIGRecord(PyObject* mod) {
 
     return (true);
 }
+} // end namespace internal
 
 PyObject*
 createTSIGRecordObject(const TSIGRecord& source) {

+ 0 - 2
src/lib/dns/python/tsigrecord_python.h

@@ -32,8 +32,6 @@ public:
 
 extern PyTypeObject tsigrecord_type;
 
-bool initModulePart_TSIGRecord(PyObject* mod);
-
 /// This is A simple shortcut to create a python TSIGRecord object (in the
 /// form of a pointer to PyObject) with minimal exception safety.
 /// On success, it returns a valid pointer to PyObject with a reference