From: JINMEI Tatuya Date: Mon, 28 Jan 2013 22:38:42 +0000 (-0800) Subject: [1866] define Rcode/Opcode python constants, as objects, not via proxy. X-Git-Tag: bind10-1.0.0-rc-release~27^2~8^2~15 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ba7573eb62566aece58b514dfcb3b5a322adfed1;p=thirdparty%2Fkea.git [1866] define Rcode/Opcode python constants, as objects, not via proxy. --- diff --git a/src/lib/dns/python/opcode_python.cc b/src/lib/dns/python/opcode_python.cc index 50436a9f70..8d40d9dd6f 100644 --- a/src/lib/dns/python/opcode_python.cc +++ b/src/lib/dns/python/opcode_python.cc @@ -43,62 +43,12 @@ void Opcode_destroy(s_Opcode* const self); PyObject* Opcode_getCode(const s_Opcode* const self); PyObject* Opcode_toText(const s_Opcode* const self); PyObject* Opcode_str(PyObject* self); -PyObject* Opcode_QUERY(const s_Opcode* self); -PyObject* Opcode_IQUERY(const s_Opcode* self); -PyObject* Opcode_STATUS(const s_Opcode* self); -PyObject* Opcode_RESERVED3(const s_Opcode* self); -PyObject* Opcode_NOTIFY(const s_Opcode* self); -PyObject* Opcode_UPDATE(const s_Opcode* self); -PyObject* Opcode_RESERVED6(const s_Opcode* self); -PyObject* Opcode_RESERVED7(const s_Opcode* self); -PyObject* Opcode_RESERVED8(const s_Opcode* self); -PyObject* Opcode_RESERVED9(const s_Opcode* self); -PyObject* Opcode_RESERVED10(const s_Opcode* self); -PyObject* Opcode_RESERVED11(const s_Opcode* self); -PyObject* Opcode_RESERVED12(const s_Opcode* self); -PyObject* Opcode_RESERVED13(const s_Opcode* self); -PyObject* Opcode_RESERVED14(const s_Opcode* self); -PyObject* Opcode_RESERVED15(const s_Opcode* self); -PyObject* Opcode_richcmp(const s_Opcode* const self, - const s_Opcode* const other, int op); PyMethodDef Opcode_methods[] = { { "get_code", reinterpret_cast(Opcode_getCode), METH_NOARGS, "Returns the code value" }, { "to_text", reinterpret_cast(Opcode_toText), METH_NOARGS, "Returns the text representation" }, - { "QUERY", reinterpret_cast(Opcode_QUERY), - METH_NOARGS | METH_STATIC, "Creates a QUERY Opcode" }, - { "IQUERY", reinterpret_cast(Opcode_IQUERY), - METH_NOARGS | METH_STATIC, "Creates a IQUERY Opcode" }, - { "STATUS", reinterpret_cast(Opcode_STATUS), - METH_NOARGS | METH_STATIC, "Creates a STATUS Opcode" }, - { "RESERVED3", reinterpret_cast(Opcode_RESERVED3), - METH_NOARGS | METH_STATIC, "Creates a RESERVED3 Opcode" }, - { "NOTIFY", reinterpret_cast(Opcode_NOTIFY), - METH_NOARGS | METH_STATIC, "Creates a NOTIFY Opcode" }, - { "UPDATE", reinterpret_cast(Opcode_UPDATE), - METH_NOARGS | METH_STATIC, "Creates a UPDATE Opcode" }, - { "RESERVED6", reinterpret_cast(Opcode_RESERVED6), - METH_NOARGS | METH_STATIC, "Creates a RESERVED6 Opcode" }, - { "RESERVED7", reinterpret_cast(Opcode_RESERVED7), - METH_NOARGS | METH_STATIC, "Creates a RESERVED7 Opcode" }, - { "RESERVED8", reinterpret_cast(Opcode_RESERVED8), - METH_NOARGS | METH_STATIC, "Creates a RESERVED8 Opcode" }, - { "RESERVED9", reinterpret_cast(Opcode_RESERVED9), - METH_NOARGS | METH_STATIC, "Creates a RESERVED9 Opcode" }, - { "RESERVED10", reinterpret_cast(Opcode_RESERVED10), - METH_NOARGS | METH_STATIC, "Creates a RESERVED10 Opcode" }, - { "RESERVED11", reinterpret_cast(Opcode_RESERVED11), - METH_NOARGS | METH_STATIC, "Creates a RESERVED11 Opcode" }, - { "RESERVED12", reinterpret_cast(Opcode_RESERVED12), - METH_NOARGS | METH_STATIC, "Creates a RESERVED12 Opcode" }, - { "RESERVED13", reinterpret_cast(Opcode_RESERVED13), - METH_NOARGS | METH_STATIC, "Creates a RESERVED13 Opcode" }, - { "RESERVED14", reinterpret_cast(Opcode_RESERVED14), - METH_NOARGS | METH_STATIC, "Creates a RESERVED14 Opcode" }, - { "RESERVED15", reinterpret_cast(Opcode_RESERVED15), - METH_NOARGS | METH_STATIC, "Creates a RESERVED15 Opcode" }, { NULL, NULL, 0, NULL } }; @@ -155,96 +105,6 @@ Opcode_str(PyObject* self) { const_cast(""))); } -PyObject* -Opcode_createStatic(const Opcode& opcode) { - s_Opcode* ret = PyObject_New(s_Opcode, &opcode_type); - if (ret != NULL) { - ret->cppobj = &opcode; - ret->static_code = true; - } - return (ret); -} - -PyObject* -Opcode_QUERY(const s_Opcode*) { - return (Opcode_createStatic(Opcode::QUERY())); -} - -PyObject* -Opcode_IQUERY(const s_Opcode*) { - return (Opcode_createStatic(Opcode::IQUERY())); -} - -PyObject* -Opcode_STATUS(const s_Opcode*) { - return (Opcode_createStatic(Opcode::STATUS())); -} - -PyObject* -Opcode_RESERVED3(const s_Opcode*) { - return (Opcode_createStatic(Opcode::RESERVED3())); -} - -PyObject* -Opcode_NOTIFY(const s_Opcode*) { - return (Opcode_createStatic(Opcode::NOTIFY())); -} - -PyObject* -Opcode_UPDATE(const s_Opcode*) { - return (Opcode_createStatic(Opcode::UPDATE())); -} - -PyObject* -Opcode_RESERVED6(const s_Opcode*) { - return (Opcode_createStatic(Opcode::RESERVED6())); -} - -PyObject* -Opcode_RESERVED7(const s_Opcode*) { - return (Opcode_createStatic(Opcode::RESERVED7())); -} - -PyObject* -Opcode_RESERVED8(const s_Opcode*) { - return (Opcode_createStatic(Opcode::RESERVED8())); -} - -PyObject* -Opcode_RESERVED9(const s_Opcode*) { - return (Opcode_createStatic(Opcode::RESERVED9())); -} - -PyObject* -Opcode_RESERVED10(const s_Opcode*) { - return (Opcode_createStatic(Opcode::RESERVED10())); -} - -PyObject* -Opcode_RESERVED11(const s_Opcode*) { - return (Opcode_createStatic(Opcode::RESERVED11())); -} - -PyObject* -Opcode_RESERVED12(const s_Opcode*) { - return (Opcode_createStatic(Opcode::RESERVED12())); -} - -PyObject* -Opcode_RESERVED13(const s_Opcode*) { - return (Opcode_createStatic(Opcode::RESERVED13())); -} - -PyObject* -Opcode_RESERVED14(const s_Opcode*) { - return (Opcode_createStatic(Opcode::RESERVED14())); -} - -PyObject* -Opcode_RESERVED15(const s_Opcode*) { - return (Opcode_createStatic(Opcode::RESERVED15())); -} - PyObject* Opcode_richcmp(const s_Opcode* const self, const s_Opcode* const other, const int op) diff --git a/src/lib/dns/python/pydnspp.cc b/src/lib/dns/python/pydnspp.cc index d6f3046b5d..f6e8e960a6 100644 --- a/src/lib/dns/python/pydnspp.cc +++ b/src/lib/dns/python/pydnspp.cc @@ -294,38 +294,83 @@ initModulePart_Opcode(PyObject* mod) { return (false); } - addClassVariable(opcode_type, "QUERY_CODE", - Py_BuildValue("h", Opcode::QUERY_CODE)); - addClassVariable(opcode_type, "IQUERY_CODE", - Py_BuildValue("h", Opcode::IQUERY_CODE)); - addClassVariable(opcode_type, "STATUS_CODE", - Py_BuildValue("h", Opcode::STATUS_CODE)); - addClassVariable(opcode_type, "RESERVED3_CODE", - Py_BuildValue("h", Opcode::RESERVED3_CODE)); - addClassVariable(opcode_type, "NOTIFY_CODE", - Py_BuildValue("h", Opcode::NOTIFY_CODE)); - addClassVariable(opcode_type, "UPDATE_CODE", - Py_BuildValue("h", Opcode::UPDATE_CODE)); - addClassVariable(opcode_type, "RESERVED6_CODE", - Py_BuildValue("h", Opcode::RESERVED6_CODE)); - addClassVariable(opcode_type, "RESERVED7_CODE", - Py_BuildValue("h", Opcode::RESERVED7_CODE)); - addClassVariable(opcode_type, "RESERVED8_CODE", - Py_BuildValue("h", Opcode::RESERVED8_CODE)); - addClassVariable(opcode_type, "RESERVED9_CODE", - Py_BuildValue("h", Opcode::RESERVED9_CODE)); - addClassVariable(opcode_type, "RESERVED10_CODE", - Py_BuildValue("h", Opcode::RESERVED10_CODE)); - addClassVariable(opcode_type, "RESERVED11_CODE", - Py_BuildValue("h", Opcode::RESERVED11_CODE)); - addClassVariable(opcode_type, "RESERVED12_CODE", - Py_BuildValue("h", Opcode::RESERVED12_CODE)); - addClassVariable(opcode_type, "RESERVED13_CODE", - Py_BuildValue("h", Opcode::RESERVED13_CODE)); - addClassVariable(opcode_type, "RESERVED14_CODE", - Py_BuildValue("h", Opcode::RESERVED14_CODE)); - addClassVariable(opcode_type, "RESERVED15_CODE", - Py_BuildValue("h", Opcode::RESERVED15_CODE)); + try { + installClassVariable(opcode_type, "QUERY_CODE", + Py_BuildValue("h", Opcode::QUERY_CODE)); + installClassVariable(opcode_type, "IQUERY_CODE", + Py_BuildValue("h", Opcode::IQUERY_CODE)); + installClassVariable(opcode_type, "STATUS_CODE", + Py_BuildValue("h", Opcode::STATUS_CODE)); + installClassVariable(opcode_type, "RESERVED3_CODE", + Py_BuildValue("h", Opcode::RESERVED3_CODE)); + installClassVariable(opcode_type, "NOTIFY_CODE", + Py_BuildValue("h", Opcode::NOTIFY_CODE)); + installClassVariable(opcode_type, "UPDATE_CODE", + Py_BuildValue("h", Opcode::UPDATE_CODE)); + installClassVariable(opcode_type, "RESERVED6_CODE", + Py_BuildValue("h", Opcode::RESERVED6_CODE)); + installClassVariable(opcode_type, "RESERVED7_CODE", + Py_BuildValue("h", Opcode::RESERVED7_CODE)); + installClassVariable(opcode_type, "RESERVED8_CODE", + Py_BuildValue("h", Opcode::RESERVED8_CODE)); + installClassVariable(opcode_type, "RESERVED9_CODE", + Py_BuildValue("h", Opcode::RESERVED9_CODE)); + installClassVariable(opcode_type, "RESERVED10_CODE", + Py_BuildValue("h", Opcode::RESERVED10_CODE)); + installClassVariable(opcode_type, "RESERVED11_CODE", + Py_BuildValue("h", Opcode::RESERVED11_CODE)); + installClassVariable(opcode_type, "RESERVED12_CODE", + Py_BuildValue("h", Opcode::RESERVED12_CODE)); + installClassVariable(opcode_type, "RESERVED13_CODE", + Py_BuildValue("h", Opcode::RESERVED13_CODE)); + installClassVariable(opcode_type, "RESERVED14_CODE", + Py_BuildValue("h", Opcode::RESERVED14_CODE)); + installClassVariable(opcode_type, "RESERVED15_CODE", + Py_BuildValue("h", Opcode::RESERVED15_CODE)); + + installClassVariable(opcode_type, "QUERY", + createOpcodeObject(Opcode::QUERY())); + installClassVariable(opcode_type, "IQUERY", + createOpcodeObject(Opcode::IQUERY())); + installClassVariable(opcode_type, "STATUS", + createOpcodeObject(Opcode::STATUS())); + installClassVariable(opcode_type, "RESERVED3", + createOpcodeObject(Opcode::RESERVED3())); + installClassVariable(opcode_type, "NOTIFY", + createOpcodeObject(Opcode::NOTIFY())); + installClassVariable(opcode_type, "UPDATE", + createOpcodeObject(Opcode::UPDATE())); + installClassVariable(opcode_type, "RESERVED6", + createOpcodeObject(Opcode::RESERVED6())); + installClassVariable(opcode_type, "RESERVED7", + createOpcodeObject(Opcode::RESERVED7())); + installClassVariable(opcode_type, "RESERVED8", + createOpcodeObject(Opcode::RESERVED8())); + installClassVariable(opcode_type, "RESERVED9", + createOpcodeObject(Opcode::RESERVED9())); + installClassVariable(opcode_type, "RESERVED10", + createOpcodeObject(Opcode::RESERVED10())); + installClassVariable(opcode_type, "RESERVED11", + createOpcodeObject(Opcode::RESERVED11())); + installClassVariable(opcode_type, "RESERVED12", + createOpcodeObject(Opcode::RESERVED12())); + installClassVariable(opcode_type, "RESERVED13", + createOpcodeObject(Opcode::RESERVED13())); + installClassVariable(opcode_type, "RESERVED14", + createOpcodeObject(Opcode::RESERVED14())); + installClassVariable(opcode_type, "RESERVED15", + createOpcodeObject(Opcode::RESERVED15())); + } catch (const std::exception& ex) { + const std::string ex_what = + "Unexpected failure in Opcode initialization: " + + std::string(ex.what()); + PyErr_SetString(po_IscException, ex_what.c_str()); + return (false); + } catch (...) { + PyErr_SetString(PyExc_SystemError, + "Unexpected failure in Opcode initialization"); + return (false); + } return (true); } @@ -341,40 +386,87 @@ initModulePart_Rcode(PyObject* mod) { return (false); } - addClassVariable(rcode_type, "NOERROR_CODE", - Py_BuildValue("h", Rcode::NOERROR_CODE)); - addClassVariable(rcode_type, "FORMERR_CODE", - Py_BuildValue("h", Rcode::FORMERR_CODE)); - addClassVariable(rcode_type, "SERVFAIL_CODE", - Py_BuildValue("h", Rcode::SERVFAIL_CODE)); - addClassVariable(rcode_type, "NXDOMAIN_CODE", - Py_BuildValue("h", Rcode::NXDOMAIN_CODE)); - addClassVariable(rcode_type, "NOTIMP_CODE", - Py_BuildValue("h", Rcode::NOTIMP_CODE)); - addClassVariable(rcode_type, "REFUSED_CODE", - Py_BuildValue("h", Rcode::REFUSED_CODE)); - addClassVariable(rcode_type, "YXDOMAIN_CODE", - Py_BuildValue("h", Rcode::YXDOMAIN_CODE)); - addClassVariable(rcode_type, "YXRRSET_CODE", - Py_BuildValue("h", Rcode::YXRRSET_CODE)); - addClassVariable(rcode_type, "NXRRSET_CODE", - Py_BuildValue("h", Rcode::NXRRSET_CODE)); - addClassVariable(rcode_type, "NOTAUTH_CODE", - Py_BuildValue("h", Rcode::NOTAUTH_CODE)); - addClassVariable(rcode_type, "NOTZONE_CODE", - Py_BuildValue("h", Rcode::NOTZONE_CODE)); - addClassVariable(rcode_type, "RESERVED11_CODE", - Py_BuildValue("h", Rcode::RESERVED11_CODE)); - addClassVariable(rcode_type, "RESERVED12_CODE", - Py_BuildValue("h", Rcode::RESERVED12_CODE)); - addClassVariable(rcode_type, "RESERVED13_CODE", - Py_BuildValue("h", Rcode::RESERVED13_CODE)); - addClassVariable(rcode_type, "RESERVED14_CODE", - Py_BuildValue("h", Rcode::RESERVED14_CODE)); - addClassVariable(rcode_type, "RESERVED15_CODE", - Py_BuildValue("h", Rcode::RESERVED15_CODE)); - addClassVariable(rcode_type, "BADVERS_CODE", - Py_BuildValue("h", Rcode::BADVERS_CODE)); + try { + installClassVariable(rcode_type, "NOERROR_CODE", + Py_BuildValue("h", Rcode::NOERROR_CODE)); + installClassVariable(rcode_type, "FORMERR_CODE", + Py_BuildValue("h", Rcode::FORMERR_CODE)); + installClassVariable(rcode_type, "SERVFAIL_CODE", + Py_BuildValue("h", Rcode::SERVFAIL_CODE)); + installClassVariable(rcode_type, "NXDOMAIN_CODE", + Py_BuildValue("h", Rcode::NXDOMAIN_CODE)); + installClassVariable(rcode_type, "NOTIMP_CODE", + Py_BuildValue("h", Rcode::NOTIMP_CODE)); + installClassVariable(rcode_type, "REFUSED_CODE", + Py_BuildValue("h", Rcode::REFUSED_CODE)); + installClassVariable(rcode_type, "YXDOMAIN_CODE", + Py_BuildValue("h", Rcode::YXDOMAIN_CODE)); + installClassVariable(rcode_type, "YXRRSET_CODE", + Py_BuildValue("h", Rcode::YXRRSET_CODE)); + installClassVariable(rcode_type, "NXRRSET_CODE", + Py_BuildValue("h", Rcode::NXRRSET_CODE)); + installClassVariable(rcode_type, "NOTAUTH_CODE", + Py_BuildValue("h", Rcode::NOTAUTH_CODE)); + installClassVariable(rcode_type, "NOTZONE_CODE", + Py_BuildValue("h", Rcode::NOTZONE_CODE)); + installClassVariable(rcode_type, "RESERVED11_CODE", + Py_BuildValue("h", Rcode::RESERVED11_CODE)); + installClassVariable(rcode_type, "RESERVED12_CODE", + Py_BuildValue("h", Rcode::RESERVED12_CODE)); + installClassVariable(rcode_type, "RESERVED13_CODE", + Py_BuildValue("h", Rcode::RESERVED13_CODE)); + installClassVariable(rcode_type, "RESERVED14_CODE", + Py_BuildValue("h", Rcode::RESERVED14_CODE)); + installClassVariable(rcode_type, "RESERVED15_CODE", + Py_BuildValue("h", Rcode::RESERVED15_CODE)); + installClassVariable(rcode_type, "BADVERS_CODE", + Py_BuildValue("h", Rcode::BADVERS_CODE)); + + installClassVariable(rcode_type, "NOERROR", + createRcodeObject(Rcode::NOERROR())); + installClassVariable(rcode_type, "FORMERR", + createRcodeObject(Rcode::FORMERR())); + installClassVariable(rcode_type, "SERVFAIL", + createRcodeObject(Rcode::SERVFAIL())); + installClassVariable(rcode_type, "NXDOMAIN", + createRcodeObject(Rcode::NXDOMAIN())); + installClassVariable(rcode_type, "NOTIMP", + createRcodeObject(Rcode::NOTIMP())); + installClassVariable(rcode_type, "REFUSED", + createRcodeObject(Rcode::REFUSED())); + installClassVariable(rcode_type, "YXDOMAIN", + createRcodeObject(Rcode::YXDOMAIN())); + installClassVariable(rcode_type, "YXRRSET", + createRcodeObject(Rcode::YXRRSET())); + installClassVariable(rcode_type, "NXRRSET", + createRcodeObject(Rcode::NXRRSET())); + installClassVariable(rcode_type, "NOTAUTH", + createRcodeObject(Rcode::NOTAUTH())); + installClassVariable(rcode_type, "NOTZONE", + createRcodeObject(Rcode::NOTZONE())); + installClassVariable(rcode_type, "RESERVED11", + createRcodeObject(Rcode::RESERVED11())); + installClassVariable(rcode_type, "RESERVED12", + createRcodeObject(Rcode::RESERVED12())); + installClassVariable(rcode_type, "RESERVED13", + createRcodeObject(Rcode::RESERVED13())); + installClassVariable(rcode_type, "RESERVED14", + createRcodeObject(Rcode::RESERVED14())); + installClassVariable(rcode_type, "RESERVED15", + createRcodeObject(Rcode::RESERVED15())); + installClassVariable(rcode_type, "BADVERS", + createRcodeObject(Rcode::BADVERS())); + } catch (const std::exception& ex) { + const std::string ex_what = + "Unexpected failure in Rcode initialization: " + + std::string(ex.what()); + PyErr_SetString(po_IscException, ex_what.c_str()); + return (false); + } catch (...) { + PyErr_SetString(PyExc_SystemError, + "Unexpected failure in Rcode initialization"); + return (false); + } return (true); } diff --git a/src/lib/dns/python/rcode_python.cc b/src/lib/dns/python/rcode_python.cc index 42b48e7b62..67b45e7f84 100644 --- a/src/lib/dns/python/rcode_python.cc +++ b/src/lib/dns/python/rcode_python.cc @@ -55,23 +55,6 @@ PyObject* Rcode_getCode(const s_Rcode* const self); PyObject* Rcode_getExtendedCode(const s_Rcode* const self); PyObject* Rcode_toText(const s_Rcode* const self); PyObject* Rcode_str(PyObject* self); -PyObject* Rcode_NOERROR(const s_Rcode* self); -PyObject* Rcode_FORMERR(const s_Rcode* self); -PyObject* Rcode_SERVFAIL(const s_Rcode* self); -PyObject* Rcode_NXDOMAIN(const s_Rcode* self); -PyObject* Rcode_NOTIMP(const s_Rcode* self); -PyObject* Rcode_REFUSED(const s_Rcode* self); -PyObject* Rcode_YXDOMAIN(const s_Rcode* self); -PyObject* Rcode_YXRRSET(const s_Rcode* self); -PyObject* Rcode_NXRRSET(const s_Rcode* self); -PyObject* Rcode_NOTAUTH(const s_Rcode* self); -PyObject* Rcode_NOTZONE(const s_Rcode* self); -PyObject* Rcode_RESERVED11(const s_Rcode* self); -PyObject* Rcode_RESERVED12(const s_Rcode* self); -PyObject* Rcode_RESERVED13(const s_Rcode* self); -PyObject* Rcode_RESERVED14(const s_Rcode* self); -PyObject* Rcode_RESERVED15(const s_Rcode* self); -PyObject* Rcode_BADVERS(const s_Rcode* self); PyObject* Rcode_richcmp(const s_Rcode* const self, const s_Rcode* const other, int op); @@ -83,40 +66,6 @@ PyMethodDef Rcode_methods[] = { "Returns the upper 8-bit part of the extended code value" }, { "to_text", reinterpret_cast(Rcode_toText), METH_NOARGS, "Returns the text representation" }, - { "NOERROR", reinterpret_cast(Rcode_NOERROR), - METH_NOARGS | METH_STATIC, "Creates a NOERROR Rcode" }, - { "FORMERR", reinterpret_cast(Rcode_FORMERR), - METH_NOARGS | METH_STATIC, "Creates a FORMERR Rcode" }, - { "SERVFAIL", reinterpret_cast(Rcode_SERVFAIL), - METH_NOARGS | METH_STATIC, "Creates a SERVFAIL Rcode" }, - { "NXDOMAIN", reinterpret_cast(Rcode_NXDOMAIN), - METH_NOARGS | METH_STATIC, "Creates a NXDOMAIN Rcode" }, - { "NOTIMP", reinterpret_cast(Rcode_NOTIMP), - METH_NOARGS | METH_STATIC, "Creates a NOTIMP Rcode" }, - { "REFUSED", reinterpret_cast(Rcode_REFUSED), - METH_NOARGS | METH_STATIC, "Creates a REFUSED Rcode" }, - { "YXDOMAIN", reinterpret_cast(Rcode_YXDOMAIN), - METH_NOARGS | METH_STATIC, "Creates a YXDOMAIN Rcode" }, - { "YXRRSET", reinterpret_cast(Rcode_YXRRSET), - METH_NOARGS | METH_STATIC, "Creates a YYRRSET Rcode" }, - { "NXRRSET", reinterpret_cast(Rcode_NXRRSET), - METH_NOARGS | METH_STATIC, "Creates a NXRRSET Rcode" }, - { "NOTAUTH", reinterpret_cast(Rcode_NOTAUTH), - METH_NOARGS | METH_STATIC, "Creates a NOTAUTH Rcode" }, - { "NOTZONE", reinterpret_cast(Rcode_NOTZONE), - METH_NOARGS | METH_STATIC, "Creates a NOTZONE Rcode" }, - { "RESERVED11", reinterpret_cast(Rcode_RESERVED11), - METH_NOARGS | METH_STATIC, "Creates a RESERVED11 Rcode" }, - { "RESERVED12", reinterpret_cast(Rcode_RESERVED12), - METH_NOARGS | METH_STATIC, "Creates a RESERVED12 Rcode" }, - { "RESERVED13", reinterpret_cast(Rcode_RESERVED13), - METH_NOARGS | METH_STATIC, "Creates a RESERVED13 Rcode" }, - { "RESERVED14", reinterpret_cast(Rcode_RESERVED14), - METH_NOARGS | METH_STATIC, "Creates a RESERVED14 Rcode" }, - { "RESERVED15", reinterpret_cast(Rcode_RESERVED15), - METH_NOARGS | METH_STATIC, "Creates a RESERVED15 Rcode" }, - { "BADVERS", reinterpret_cast(Rcode_BADVERS), - METH_NOARGS | METH_STATIC, "Creates a BADVERS Rcode" }, { NULL, NULL, 0, NULL } }; @@ -192,101 +141,6 @@ Rcode_str(PyObject* self) { const_cast(""))); } -PyObject* -Rcode_createStatic(const Rcode& rcode) { - s_Rcode* ret = PyObject_New(s_Rcode, &rcode_type); - if (ret != NULL) { - ret->cppobj = &rcode; - ret->static_code = true; - } - return (ret); -} - -PyObject* -Rcode_NOERROR(const s_Rcode*) { - return (Rcode_createStatic(Rcode::NOERROR())); -} - -PyObject* -Rcode_FORMERR(const s_Rcode*) { - return (Rcode_createStatic(Rcode::FORMERR())); -} - -PyObject* -Rcode_SERVFAIL(const s_Rcode*) { - return (Rcode_createStatic(Rcode::SERVFAIL())); -} - -PyObject* -Rcode_NXDOMAIN(const s_Rcode*) { - return (Rcode_createStatic(Rcode::NXDOMAIN())); -} - -PyObject* -Rcode_NOTIMP(const s_Rcode*) { - return (Rcode_createStatic(Rcode::NOTIMP())); -} - -PyObject* -Rcode_REFUSED(const s_Rcode*) { - return (Rcode_createStatic(Rcode::REFUSED())); -} - -PyObject* -Rcode_YXDOMAIN(const s_Rcode*) { - return (Rcode_createStatic(Rcode::YXDOMAIN())); -} - -PyObject* -Rcode_YXRRSET(const s_Rcode*) { - return (Rcode_createStatic(Rcode::YXRRSET())); -} - -PyObject* -Rcode_NXRRSET(const s_Rcode*) { - return (Rcode_createStatic(Rcode::NXRRSET())); -} - -PyObject* -Rcode_NOTAUTH(const s_Rcode*) { - return (Rcode_createStatic(Rcode::NOTAUTH())); -} - -PyObject* -Rcode_NOTZONE(const s_Rcode*) { - return (Rcode_createStatic(Rcode::NOTZONE())); -} - -PyObject* -Rcode_RESERVED11(const s_Rcode*) { - return (Rcode_createStatic(Rcode::RESERVED11())); -} - -PyObject* -Rcode_RESERVED12(const s_Rcode*) { - return (Rcode_createStatic(Rcode::RESERVED12())); -} - -PyObject* -Rcode_RESERVED13(const s_Rcode*) { - return (Rcode_createStatic(Rcode::RESERVED13())); -} - -PyObject* -Rcode_RESERVED14(const s_Rcode*) { - return (Rcode_createStatic(Rcode::RESERVED14())); -} - -PyObject* -Rcode_RESERVED15(const s_Rcode*) { - return (Rcode_createStatic(Rcode::RESERVED15())); -} - -PyObject* -Rcode_BADVERS(const s_Rcode*) { - return (Rcode_createStatic(Rcode::BADVERS())); -} - PyObject* Rcode_richcmp(const s_Rcode* const self, const s_Rcode* const other, const int op)