Browse Source

[trac905] added more detailed documentation text, which was half automated
from C++ doxygen output.

JINMEI Tatuya 14 years ago
parent
commit
a1a58a7382

+ 7 - 6
src/lib/dns/python/tsigerror_python.cc

@@ -44,6 +44,9 @@ using namespace isc::dns::python;
 s_TSIGError::s_TSIGError() : cppobj(NULL) {
 s_TSIGError::s_TSIGError() : cppobj(NULL) {
 }
 }
 
 
+// Import pydoc text
+#include "tsigerror_python_inc.cc"
+
 namespace {
 namespace {
 // Shortcut type which would be convenient for adding class variables safely.
 // Shortcut type which would be convenient for adding class variables safely.
 typedef CPPPyObjectContainer<s_TSIGError, TSIGError> TSIGErrorContainer;
 typedef CPPPyObjectContainer<s_TSIGError, TSIGError> TSIGErrorContainer;
@@ -77,12 +80,12 @@ PyObject* TSIGError_richcmp(const s_TSIGError* const self,
 PyMethodDef TSIGError_methods[] = {
 PyMethodDef TSIGError_methods[] = {
     { "get_code", reinterpret_cast<PyCFunction>(TSIGError_getCode),
     { "get_code", reinterpret_cast<PyCFunction>(TSIGError_getCode),
       METH_NOARGS,
       METH_NOARGS,
-      "Returns the code value" },
+      TSIGError_getCode_doc },
     { "to_text", reinterpret_cast<PyCFunction>(TSIGError_toText), METH_NOARGS,
     { "to_text", reinterpret_cast<PyCFunction>(TSIGError_toText), METH_NOARGS,
-      "Returns the text representation" },
+      TSIGError_toText_doc },
     { "to_rcode", reinterpret_cast<PyCFunction>(TSIGError_toRcode),
     { "to_rcode", reinterpret_cast<PyCFunction>(TSIGError_toRcode),
       METH_NOARGS,
       METH_NOARGS,
-      "Convert the TSIGError to a Rcode" },
+      TSIGError_toRcode_doc },
     { NULL, NULL, 0, NULL }
     { NULL, NULL, 0, NULL }
 };
 };
 
 
@@ -252,9 +255,7 @@ PyTypeObject tsigerror_type = {
     NULL,                               // tp_setattro
     NULL,                               // tp_setattro
     NULL,                               // tp_as_buffer
     NULL,                               // tp_as_buffer
     Py_TPFLAGS_DEFAULT,                 // tp_flags
     Py_TPFLAGS_DEFAULT,                 // tp_flags
-    "The TSIGError class objects represent standard errors related to "
-    "TSIG protocol operations as defined in related specifications, mainly "
-    "in RFC2845.",
+    TSIGError_doc,
     NULL,                               // tp_traverse
     NULL,                               // tp_traverse
     NULL,                               // tp_clear
     NULL,                               // tp_clear
     // THIS MAY HAVE TO BE CHANGED TO NULL:
     // THIS MAY HAVE TO BE CHANGED TO NULL:

+ 83 - 0
src/lib/dns/python/tsigerror_python_inc.cc

@@ -0,0 +1,83 @@
+namespace {
+const char* const TSIGError_doc = "\n\
+TSIG errors.\n\
+\n\
+\n\
+The TSIGError class objects represent standard errors related to TSIG\n\
+protocol operations as defined in related specifications, mainly in\n\
+RFC2845.\n\
+\n\
+TSIGError(error_code)\n\
+\n\
+Constructor from the code value.\n\
+\n\
+Exceptions:\n\
+  None: \n\
+\n\
+Parameters:\n\
+  error_code: The underlying 16-bit error code value of the TSIGError.\n\
+\n\
+TSIGError(rcode)\n\
+\n\
+Constructor from Rcode.\n\
+\n\
+As defined in RFC2845, error code values from 0 to 15 (inclusive) are\n\
+derived from the DNS RCODEs, which are represented via the Rcode class\n\
+in this library. This constructor works as a converter from these\n\
+RCODEs to corresponding TSIGError objects.\n\
+\n\
+Exceptions:\n\
+  ValueError: Given rcode is not convertible to TSIGErrors.\n\
+\n\
+Parameters:\n\
+  rcode: the Rcode from which the TSIGError should be derived.\n\
+\n\
+";
+const char* const TSIGError_getCode_doc = "get_code() -> integer\n\
+\n\
+Returns the TSIGCode error code value.\n\
+\n\
+Exceptions:\n\
+  None: \n\
+\n\
+Return Value(s):\n\
+  The underlying code value corresponding to the TSIGError.\n\
+";
+const char* const TSIGError_toText_doc = "to_text() -> string\n\
+\n\
+Convert the TSIGError to a string.\n\
+\n\
+For codes derived from RCODEs up to 15, this method returns the same\n\
+string as Rcode.to_text() for the corresponding code. For other pre-\n\
+defined code values (see TSIGError.CodeValue), this method returns a\n\
+string representation of the \"mnemonic' used for the enum and\n\
+constant objects as defined in RFC2845. For example, the string for\n\
+code value 16 is \"BADSIG\", etc. For other code values it returns a\n\
+string representation of the decimal number of the value, e.g. \"32\",\n\
+\"100\", etc.\n\
+\n\
+Exceptions:\n\
+  None\n\
+\n\
+Return Value(s):\n\
+  A string representation of the TSIGError.\n\
+";
+const char* const TSIGError_toRcode_doc = "to_rcode() -> Rcode\n\
+\n\
+Convert the TSIGError to a Rcode.\n\
+\n\
+This method returns an Rcode object that is corresponding to the TSIG\n\
+error. The returned Rcode is expected to be used by a verifying server\n\
+to specify the RCODE of a response when TSIG verification fails.\n\
+\n\
+Specifically, this method returns Rcode.NOTAUTH() for the TSIG\n\
+specific errors, BADSIG, BADKEY, BADTIME, as described in RFC2845. For\n\
+errors derived from the standard Rcode (code 0-15), it returns the\n\
+corresponding Rcode. For others, this method returns Rcode.SERVFAIL()\n\
+as a last resort.\n\
+\n\
+Exceptions:\n\
+  None: \n\
+\n\
+";
+}