[svn] commit: r2234 - /experiments/python-binding/src/lib/dns/python/
BIND 10 source code commits
bind10-changes at lists.isc.org
Wed Jun 23 09:15:45 UTC 2010
Author: jelte
Date: Wed Jun 23 09:15:45 2010
New Revision: 2234
Log:
review mentioned i wasn't following coding guidelines, updating them
also updated a few typo's in comments
Modified:
experiments/python-binding/src/lib/dns/python/libdns_python.cc
experiments/python-binding/src/lib/dns/python/libdns_python_common.cc
experiments/python-binding/src/lib/dns/python/message_python.cc
experiments/python-binding/src/lib/dns/python/messagerenderer_python.cc
experiments/python-binding/src/lib/dns/python/name_python.cc
experiments/python-binding/src/lib/dns/python/question_python.cc
experiments/python-binding/src/lib/dns/python/rdata_python.cc
experiments/python-binding/src/lib/dns/python/rrclass_python.cc
experiments/python-binding/src/lib/dns/python/rrset_python.cc
experiments/python-binding/src/lib/dns/python/rrttl_python.cc
experiments/python-binding/src/lib/dns/python/rrtype_python.cc
Modified: experiments/python-binding/src/lib/dns/python/libdns_python.cc
==============================================================================
--- experiments/python-binding/src/lib/dns/python/libdns_python.cc (original)
+++ experiments/python-binding/src/lib/dns/python/libdns_python.cc Wed Jun 23 09:15:45 2010
@@ -70,8 +70,7 @@
};
PyMODINIT_FUNC
-PyInit_libdns_python(void)
-{
+PyInit_libdns_python(void) {
PyObject *mod = PyModule_Create(&libdns_python);
if (mod == NULL) {
return NULL;
Modified: experiments/python-binding/src/lib/dns/python/libdns_python_common.cc
==============================================================================
--- experiments/python-binding/src/lib/dns/python/libdns_python_common.cc (original)
+++ experiments/python-binding/src/lib/dns/python/libdns_python_common.cc Wed Jun 23 09:15:45 2010
@@ -17,8 +17,7 @@
#include <Python.h>
int
-readDataFromSequence(uint8_t *data, size_t len, PyObject* sequence)
-{
+readDataFromSequence(uint8_t *data, size_t len, PyObject* sequence) {
PyObject* el = NULL;
for (size_t i = 0; i < len; i++) {
el = PySequence_GetItem(sequence, 0);
@@ -46,7 +45,8 @@
}
-void addClassVariable(PyTypeObject& c, const char* name, PyObject* obj)
+void addClassVariable(PyTypeObject& c, const char* name,
+ PyObject* obj)
{
PyDict_SetItemString(c.tp_dict, name, obj);
}
Modified: experiments/python-binding/src/lib/dns/python/message_python.cc
==============================================================================
--- experiments/python-binding/src/lib/dns/python/message_python.cc (original)
+++ experiments/python-binding/src/lib/dns/python/message_python.cc Wed Jun 23 09:15:45 2010
@@ -125,7 +125,8 @@
static int
-MessageFlag_init(s_MessageFlag* self UNUSED_PARAM, PyObject* args UNUSED_PARAM)
+MessageFlag_init(s_MessageFlag* self UNUSED_PARAM,
+ PyObject* args UNUSED_PARAM)
{
PyErr_SetString(PyExc_NotImplementedError,
"MessageFlag can't be built directly");
@@ -133,8 +134,7 @@
}
static void
-MessageFlag_destroy(s_MessageFlag* self)
-{
+MessageFlag_destroy(s_MessageFlag* self) {
// We only use the consts from MessageFlag, so don't
// delete self->messageflag here
self->messageflag = NULL;
@@ -142,14 +142,12 @@
}
static PyObject*
-MessageFlag_getBit(s_MessageFlag* self)
-{
+MessageFlag_getBit(s_MessageFlag* self) {
return Py_BuildValue("I", self->messageflag->getBit());
}
static PyObject*
-MessageFlag_QR(s_MessageFlag* self UNUSED_PARAM)
-{
+MessageFlag_QR(s_MessageFlag* self UNUSED_PARAM) {
s_MessageFlag* ret = PyObject_New(s_MessageFlag, &messageflag_type);
if (ret != NULL) {
ret->messageflag = &MessageFlag::QR();
@@ -162,8 +160,7 @@
}
static PyObject*
-MessageFlag_AA(s_MessageFlag* self UNUSED_PARAM)
-{
+MessageFlag_AA(s_MessageFlag* self UNUSED_PARAM) {
s_MessageFlag* ret = PyObject_New(s_MessageFlag, &messageflag_type);
if (ret != NULL) {
ret->messageflag = &MessageFlag::AA();
@@ -176,8 +173,7 @@
}
static PyObject*
-MessageFlag_TC(s_MessageFlag* self UNUSED_PARAM)
-{
+MessageFlag_TC(s_MessageFlag* self UNUSED_PARAM) {
s_MessageFlag* ret = PyObject_New(s_MessageFlag, &messageflag_type);
if (ret != NULL) {
ret->messageflag = &MessageFlag::TC();
@@ -190,8 +186,7 @@
}
static PyObject*
-MessageFlag_RD(s_MessageFlag* self UNUSED_PARAM)
-{
+MessageFlag_RD(s_MessageFlag* self UNUSED_PARAM) {
s_MessageFlag* ret = PyObject_New(s_MessageFlag, &messageflag_type);
if (ret != NULL) {
ret->messageflag = &MessageFlag::RD();
@@ -204,8 +199,7 @@
}
static PyObject*
-MessageFlag_RA(s_MessageFlag* self UNUSED_PARAM)
-{
+MessageFlag_RA(s_MessageFlag* self UNUSED_PARAM) {
s_MessageFlag* ret = PyObject_New(s_MessageFlag, &messageflag_type);
if (ret != NULL) {
ret->messageflag = &MessageFlag::RA();
@@ -218,8 +212,7 @@
}
static PyObject*
-MessageFlag_AD(s_MessageFlag* self UNUSED_PARAM)
-{
+MessageFlag_AD(s_MessageFlag* self UNUSED_PARAM) {
s_MessageFlag* ret = PyObject_New(s_MessageFlag, &messageflag_type);
if (ret != NULL) {
ret->messageflag = &MessageFlag::AD();
@@ -232,8 +225,7 @@
}
static PyObject*
-MessageFlag_CD(s_MessageFlag* self UNUSED_PARAM)
-{
+MessageFlag_CD(s_MessageFlag* self UNUSED_PARAM) {
s_MessageFlag* ret = PyObject_New(s_MessageFlag, &messageflag_type);
if (ret != NULL) {
ret->messageflag = &MessageFlag::CD();
@@ -360,16 +352,14 @@
static int
-Opcode_init(s_Opcode* self UNUSED_PARAM, PyObject* args UNUSED_PARAM)
-{
+Opcode_init(s_Opcode* self UNUSED_PARAM, PyObject* args UNUSED_PARAM) {
PyErr_SetString(PyExc_NotImplementedError,
"Opcode can't be built directly");
return -1;
}
static void
-Opcode_destroy(s_Opcode* self)
-{
+Opcode_destroy(s_Opcode* self) {
// We only use the consts from Opcode, so don't
// delete self->opcode here
self->opcode = NULL;
@@ -377,27 +367,23 @@
}
static PyObject*
-Opcode_getCode(s_Opcode* self)
-{
+Opcode_getCode(s_Opcode* self) {
return Py_BuildValue("I", self->opcode->getCode());
}
static PyObject*
-Opcode_toText(s_Opcode* self)
-{
+Opcode_toText(s_Opcode* self) {
return Py_BuildValue("s", self->opcode->toText().c_str());
}
static PyObject*
-Opcode_str(PyObject* self)
-{
+Opcode_str(PyObject* self) {
// Simply call the to_text method we already defined
return PyObject_CallMethod(self, (char*)"to_text", (char*)"");
}
static PyObject*
-Opcode_QUERY(s_Opcode* self UNUSED_PARAM)
-{
+Opcode_QUERY(s_Opcode* self UNUSED_PARAM) {
s_Opcode* ret = PyObject_New(s_Opcode, &opcode_type);
if (ret != NULL) {
ret->opcode = &Opcode::QUERY();
@@ -410,8 +396,7 @@
}
static PyObject*
-Opcode_IQUERY(s_Opcode* self UNUSED_PARAM)
-{
+Opcode_IQUERY(s_Opcode* self UNUSED_PARAM) {
s_Opcode* ret = PyObject_New(s_Opcode, &opcode_type);
if (ret != NULL) {
ret->opcode = &Opcode::IQUERY();
@@ -424,8 +409,7 @@
}
static PyObject*
-Opcode_STATUS(s_Opcode* self UNUSED_PARAM)
-{
+Opcode_STATUS(s_Opcode* self UNUSED_PARAM) {
s_Opcode* ret = PyObject_New(s_Opcode, &opcode_type);
if (ret != NULL) {
ret->opcode = &Opcode::STATUS();
@@ -438,8 +422,7 @@
}
static PyObject*
-Opcode_RESERVED3(s_Opcode* self UNUSED_PARAM)
-{
+Opcode_RESERVED3(s_Opcode* self UNUSED_PARAM) {
s_Opcode* ret = PyObject_New(s_Opcode, &opcode_type);
if (ret != NULL) {
ret->opcode = &Opcode::RESERVED3();
@@ -452,8 +435,7 @@
}
static PyObject*
-Opcode_NOTIFY(s_Opcode* self UNUSED_PARAM)
-{
+Opcode_NOTIFY(s_Opcode* self UNUSED_PARAM) {
s_Opcode* ret = PyObject_New(s_Opcode, &opcode_type);
if (ret != NULL) {
ret->opcode = &Opcode::NOTIFY();
@@ -466,8 +448,7 @@
}
static PyObject*
-Opcode_UPDATE(s_Opcode* self UNUSED_PARAM)
-{
+Opcode_UPDATE(s_Opcode* self UNUSED_PARAM) {
s_Opcode* ret = PyObject_New(s_Opcode, &opcode_type);
if (ret != NULL) {
ret->opcode = &Opcode::UPDATE();
@@ -480,8 +461,7 @@
}
static PyObject*
-Opcode_RESERVED6(s_Opcode* self UNUSED_PARAM)
-{
+Opcode_RESERVED6(s_Opcode* self UNUSED_PARAM) {
s_Opcode* ret = PyObject_New(s_Opcode, &opcode_type);
if (ret != NULL) {
ret->opcode = &Opcode::RESERVED6();
@@ -494,8 +474,7 @@
}
static PyObject*
-Opcode_RESERVED7(s_Opcode* self UNUSED_PARAM)
-{
+Opcode_RESERVED7(s_Opcode* self UNUSED_PARAM) {
s_Opcode* ret = PyObject_New(s_Opcode, &opcode_type);
if (ret != NULL) {
ret->opcode = &Opcode::RESERVED7();
@@ -508,8 +487,7 @@
}
static PyObject*
-Opcode_RESERVED8(s_Opcode* self UNUSED_PARAM)
-{
+Opcode_RESERVED8(s_Opcode* self UNUSED_PARAM) {
s_Opcode* ret = PyObject_New(s_Opcode, &opcode_type);
if (ret != NULL) {
ret->opcode = &Opcode::RESERVED8();
@@ -522,8 +500,7 @@
}
static PyObject*
-Opcode_RESERVED9(s_Opcode* self UNUSED_PARAM)
-{
+Opcode_RESERVED9(s_Opcode* self UNUSED_PARAM) {
s_Opcode* ret = PyObject_New(s_Opcode, &opcode_type);
if (ret != NULL) {
ret->opcode = &Opcode::RESERVED9();
@@ -536,8 +513,7 @@
}
static PyObject*
-Opcode_RESERVED10(s_Opcode* self UNUSED_PARAM)
-{
+Opcode_RESERVED10(s_Opcode* self UNUSED_PARAM) {
s_Opcode* ret = PyObject_New(s_Opcode, &opcode_type);
if (ret != NULL) {
ret->opcode = &Opcode::RESERVED10();
@@ -550,8 +526,7 @@
}
static PyObject*
-Opcode_RESERVED11(s_Opcode* self UNUSED_PARAM)
-{
+Opcode_RESERVED11(s_Opcode* self UNUSED_PARAM) {
s_Opcode* ret = PyObject_New(s_Opcode, &opcode_type);
if (ret != NULL) {
ret->opcode = &Opcode::RESERVED11();
@@ -564,8 +539,7 @@
}
static PyObject*
-Opcode_RESERVED12(s_Opcode* self UNUSED_PARAM)
-{
+Opcode_RESERVED12(s_Opcode* self UNUSED_PARAM) {
s_Opcode* ret = PyObject_New(s_Opcode, &opcode_type);
if (ret != NULL) {
ret->opcode = &Opcode::RESERVED12();
@@ -578,8 +552,7 @@
}
static PyObject*
-Opcode_RESERVED13(s_Opcode* self UNUSED_PARAM)
-{
+Opcode_RESERVED13(s_Opcode* self UNUSED_PARAM) {
s_Opcode* ret = PyObject_New(s_Opcode, &opcode_type);
if (ret != NULL) {
ret->opcode = &Opcode::RESERVED13();
@@ -592,8 +565,7 @@
}
static PyObject*
-Opcode_RESERVED14(s_Opcode* self UNUSED_PARAM)
-{
+Opcode_RESERVED14(s_Opcode* self UNUSED_PARAM) {
s_Opcode* ret = PyObject_New(s_Opcode, &opcode_type);
if (ret != NULL) {
ret->opcode = &Opcode::RESERVED14();
@@ -606,8 +578,7 @@
}
static PyObject*
-Opcode_RESERVED15(s_Opcode* self UNUSED_PARAM)
-{
+Opcode_RESERVED15(s_Opcode* self UNUSED_PARAM) {
s_Opcode* ret = PyObject_New(s_Opcode, &opcode_type);
if (ret != NULL) {
ret->opcode = &Opcode::RESERVED15();
@@ -620,8 +591,7 @@
}
static PyObject*
-Opcode_richcmp(s_Opcode* self, s_Opcode* other, int op)
-{
+Opcode_richcmp(s_Opcode* self, s_Opcode* other, int op) {
bool c = false;
// Check for null and if the types match. If different type,
@@ -788,8 +758,7 @@
static int
-Rcode_init(s_Rcode* self UNUSED_PARAM, PyObject* args UNUSED_PARAM)
-{
+Rcode_init(s_Rcode* self UNUSED_PARAM, PyObject* args UNUSED_PARAM) {
uint16_t code = 0;
if (PyArg_ParseTuple(args, "h", &code)) {
try {
@@ -807,8 +776,7 @@
}
static void
-Rcode_destroy(s_Rcode* self)
-{
+Rcode_destroy(s_Rcode* self) {
// We only use the consts from Rcode, so don't
// delete self->rcode here
if (!self->static_code) {
@@ -819,27 +787,23 @@
}
static PyObject*
-Rcode_getCode(s_Rcode* self)
-{
+Rcode_getCode(s_Rcode* self) {
return Py_BuildValue("I", self->rcode->getCode());
}
static PyObject*
-Rcode_toText(s_Rcode* self)
-{
+Rcode_toText(s_Rcode* self) {
return Py_BuildValue("s", self->rcode->toText().c_str());
}
static PyObject*
-Rcode_str(PyObject* self)
-{
+Rcode_str(PyObject* self) {
// Simply call the to_text method we already defined
return PyObject_CallMethod(self, (char*)"to_text", (char*)"");
}
static PyObject*
-Rcode_NOERROR(s_Rcode* self UNUSED_PARAM)
-{
+Rcode_NOERROR(s_Rcode* self UNUSED_PARAM) {
s_Rcode* ret = PyObject_New(s_Rcode, &rcode_type);
if (ret != NULL) {
ret->rcode = &Rcode::NOERROR();
@@ -853,8 +817,7 @@
}
static PyObject*
-Rcode_FORMERR(s_Rcode* self UNUSED_PARAM)
-{
+Rcode_FORMERR(s_Rcode* self UNUSED_PARAM) {
s_Rcode* ret = PyObject_New(s_Rcode, &rcode_type);
if (ret != NULL) {
ret->rcode = &Rcode::FORMERR();
@@ -868,8 +831,7 @@
}
static PyObject*
-Rcode_SERVFAIL(s_Rcode* self UNUSED_PARAM)
-{
+Rcode_SERVFAIL(s_Rcode* self UNUSED_PARAM) {
s_Rcode* ret = PyObject_New(s_Rcode, &rcode_type);
if (ret != NULL) {
ret->rcode = &Rcode::SERVFAIL();
@@ -883,8 +845,7 @@
}
static PyObject*
-Rcode_NXDOMAIN(s_Rcode* self UNUSED_PARAM)
-{
+Rcode_NXDOMAIN(s_Rcode* self UNUSED_PARAM) {
s_Rcode* ret = PyObject_New(s_Rcode, &rcode_type);
if (ret != NULL) {
ret->rcode = &Rcode::NXDOMAIN();
@@ -898,8 +859,7 @@
}
static PyObject*
-Rcode_NOTIMP(s_Rcode* self UNUSED_PARAM)
-{
+Rcode_NOTIMP(s_Rcode* self UNUSED_PARAM) {
s_Rcode* ret = PyObject_New(s_Rcode, &rcode_type);
if (ret != NULL) {
ret->rcode = &Rcode::NOTIMP();
@@ -913,8 +873,7 @@
}
static PyObject*
-Rcode_REFUSED(s_Rcode* self UNUSED_PARAM)
-{
+Rcode_REFUSED(s_Rcode* self UNUSED_PARAM) {
s_Rcode* ret = PyObject_New(s_Rcode, &rcode_type);
if (ret != NULL) {
ret->rcode = &Rcode::REFUSED();
@@ -928,8 +887,7 @@
}
static PyObject*
-Rcode_YXDOMAIN(s_Rcode* self UNUSED_PARAM)
-{
+Rcode_YXDOMAIN(s_Rcode* self UNUSED_PARAM) {
s_Rcode* ret = PyObject_New(s_Rcode, &rcode_type);
if (ret != NULL) {
ret->rcode = &Rcode::YXDOMAIN();
@@ -943,8 +901,7 @@
}
static PyObject*
-Rcode_YXRRSET(s_Rcode* self UNUSED_PARAM)
-{
+Rcode_YXRRSET(s_Rcode* self UNUSED_PARAM) {
s_Rcode* ret = PyObject_New(s_Rcode, &rcode_type);
if (ret != NULL) {
ret->rcode = &Rcode::YXRRSET();
@@ -958,8 +915,7 @@
}
static PyObject*
-Rcode_NXRRSET(s_Rcode* self UNUSED_PARAM)
-{
+Rcode_NXRRSET(s_Rcode* self UNUSED_PARAM) {
s_Rcode* ret = PyObject_New(s_Rcode, &rcode_type);
if (ret != NULL) {
ret->rcode = &Rcode::NXRRSET();
@@ -973,8 +929,7 @@
}
static PyObject*
-Rcode_NOTAUTH(s_Rcode* self UNUSED_PARAM)
-{
+Rcode_NOTAUTH(s_Rcode* self UNUSED_PARAM) {
s_Rcode* ret = PyObject_New(s_Rcode, &rcode_type);
if (ret != NULL) {
ret->rcode = &Rcode::NOTAUTH();
@@ -988,8 +943,7 @@
}
static PyObject*
-Rcode_NOTZONE(s_Rcode* self UNUSED_PARAM)
-{
+Rcode_NOTZONE(s_Rcode* self UNUSED_PARAM) {
s_Rcode* ret = PyObject_New(s_Rcode, &rcode_type);
if (ret != NULL) {
ret->rcode = &Rcode::NOTZONE();
@@ -1003,8 +957,7 @@
}
static PyObject*
-Rcode_RESERVED11(s_Rcode* self UNUSED_PARAM)
-{
+Rcode_RESERVED11(s_Rcode* self UNUSED_PARAM) {
s_Rcode* ret = PyObject_New(s_Rcode, &rcode_type);
if (ret != NULL) {
ret->rcode = &Rcode::RESERVED11();
@@ -1018,8 +971,7 @@
}
static PyObject*
-Rcode_RESERVED12(s_Rcode* self UNUSED_PARAM)
-{
+Rcode_RESERVED12(s_Rcode* self UNUSED_PARAM) {
s_Rcode* ret = PyObject_New(s_Rcode, &rcode_type);
if (ret != NULL) {
ret->rcode = &Rcode::RESERVED12();
@@ -1033,8 +985,7 @@
}
static PyObject*
-Rcode_RESERVED13(s_Rcode* self UNUSED_PARAM)
-{
+Rcode_RESERVED13(s_Rcode* self UNUSED_PARAM) {
s_Rcode* ret = PyObject_New(s_Rcode, &rcode_type);
if (ret != NULL) {
ret->rcode = &Rcode::RESERVED13();
@@ -1048,8 +999,7 @@
}
static PyObject*
-Rcode_RESERVED14(s_Rcode* self UNUSED_PARAM)
-{
+Rcode_RESERVED14(s_Rcode* self UNUSED_PARAM) {
s_Rcode* ret = PyObject_New(s_Rcode, &rcode_type);
if (ret != NULL) {
ret->rcode = &Rcode::RESERVED14();
@@ -1063,8 +1013,7 @@
}
static PyObject*
-Rcode_RESERVED15(s_Rcode* self UNUSED_PARAM)
-{
+Rcode_RESERVED15(s_Rcode* self UNUSED_PARAM) {
s_Rcode* ret = PyObject_New(s_Rcode, &rcode_type);
if (ret != NULL) {
ret->rcode = &Rcode::RESERVED15();
@@ -1078,8 +1027,7 @@
}
static PyObject*
-Rcode_BADVERS(s_Rcode* self UNUSED_PARAM)
-{
+Rcode_BADVERS(s_Rcode* self UNUSED_PARAM) {
s_Rcode* ret = PyObject_New(s_Rcode, &rcode_type);
if (ret != NULL) {
ret->rcode = &Rcode::BADVERS();
@@ -1093,8 +1041,7 @@
}
static PyObject*
-Rcode_richcmp(s_Rcode* self, s_Rcode* other, int op)
-{
+Rcode_richcmp(s_Rcode* self, s_Rcode* other, int op) {
bool c = false;
// Check for null and if the types match. If different type,
@@ -1227,7 +1174,8 @@
static int
-Section_init(s_Section* self UNUSED_PARAM, PyObject* args UNUSED_PARAM)
+Section_init(s_Section* self UNUSED_PARAM,
+ PyObject* args UNUSED_PARAM)
{
PyErr_SetString(PyExc_NotImplementedError,
"Section can't be built directly");
@@ -1235,8 +1183,7 @@
}
static void
-Section_destroy(s_Section* self)
-{
+Section_destroy(s_Section* self) {
// We only use the consts from Section, so don't
// delete self->section here
self->section = NULL;
@@ -1244,14 +1191,12 @@
}
static PyObject*
-Section_getCode(s_Section* self)
-{
+Section_getCode(s_Section* self) {
return Py_BuildValue("I", self->section->getCode());
}
static PyObject*
-Section_QUESTION(s_Section* self UNUSED_PARAM)
-{
+Section_QUESTION(s_Section* self UNUSED_PARAM) {
s_Section* ret = PyObject_New(s_Section, §ion_type);
if (ret != NULL) {
ret->section = &Section::QUESTION();
@@ -1264,8 +1209,7 @@
}
static PyObject*
-Section_ANSWER(s_Section* self UNUSED_PARAM)
-{
+Section_ANSWER(s_Section* self UNUSED_PARAM) {
s_Section* ret = PyObject_New(s_Section, §ion_type);
if (ret != NULL) {
ret->section = &Section::ANSWER();
@@ -1278,8 +1222,7 @@
}
static PyObject*
-Section_AUTHORITY(s_Section* self UNUSED_PARAM)
-{
+Section_AUTHORITY(s_Section* self UNUSED_PARAM) {
s_Section* ret = PyObject_New(s_Section, §ion_type);
if (ret != NULL) {
ret->section = &Section::AUTHORITY();
@@ -1292,8 +1235,7 @@
}
static PyObject*
-Section_ADDITIONAL(s_Section* self UNUSED_PARAM)
-{
+Section_ADDITIONAL(s_Section* self UNUSED_PARAM) {
s_Section* ret = PyObject_New(s_Section, §ion_type);
if (ret != NULL) {
ret->section = &Section::ADDITIONAL();
@@ -1306,8 +1248,7 @@
}
static PyObject*
-Section_richcmp(s_Section* self, s_Section* other, int op)
-{
+Section_richcmp(s_Section* self, s_Section* other, int op) {
bool c = false;
// Check for null and if the types match. If different type,
@@ -1573,8 +1514,7 @@
};
static int
-Message_init(s_Message* self, PyObject* args)
-{
+Message_init(s_Message* self, PyObject* args) {
unsigned int i;
// The constructor argument can be a string ("IN"), an integer (1),
// or a sequence of numbers between 0 and 255 (wire code)
@@ -1599,8 +1539,7 @@
}
static void
-Message_destroy(s_Message* self)
-{
+Message_destroy(s_Message* self) {
if (self->message != NULL)
delete self->message;
self->message = NULL;
@@ -1608,8 +1547,7 @@
}
static PyObject*
-Message_getHeaderFlag(s_Message* self, PyObject* args)
-{
+Message_getHeaderFlag(s_Message* self, PyObject* args) {
s_MessageFlag* messageflag;
if (!PyArg_ParseTuple(args, "O!", &messageflag_type, &messageflag)) {
return NULL;
@@ -1623,8 +1561,7 @@
}
static PyObject*
-Message_setHeaderFlag(s_Message* self, PyObject* args)
-{
+Message_setHeaderFlag(s_Message* self, PyObject* args) {
s_MessageFlag* messageflag;
if (!PyArg_ParseTuple(args, "O!", &messageflag_type, &messageflag)) {
return NULL;
@@ -1641,8 +1578,7 @@
}
static PyObject*
-Message_clearHeaderFlag(s_Message* self, PyObject* args)
-{
+Message_clearHeaderFlag(s_Message* self, PyObject* args) {
s_MessageFlag* messageflag;
if (!PyArg_ParseTuple(args, "O!", &messageflag_type, &messageflag)) {
return NULL;
@@ -1661,8 +1597,7 @@
}
static PyObject*
-Message_isDNSSECSupported(s_Message* self)
-{
+Message_isDNSSECSupported(s_Message* self) {
if (self->message->isDNSSECSupported()) {
Py_RETURN_TRUE;
} else {
@@ -1671,8 +1606,7 @@
}
static PyObject*
-Message_setDNSSECSupported(s_Message* self, PyObject* args)
-{
+Message_setDNSSECSupported(s_Message* self, PyObject* args) {
PyObject *b;
if (!PyArg_ParseTuple(args, "O!", &PyBool_Type, &b)) {
return NULL;
@@ -1691,14 +1625,12 @@
}
static PyObject*
-Message_getUDPSize(s_Message* self)
-{
+Message_getUDPSize(s_Message* self) {
return Py_BuildValue("I", self->message->getUDPSize());
}
static PyObject*
-Message_setUDPSize(s_Message* self, PyObject* args)
-{
+Message_setUDPSize(s_Message* self, PyObject* args) {
uint16_t size;
if (!PyArg_ParseTuple(args, "I", &size)) {
return NULL;
@@ -1716,14 +1648,12 @@
}
static PyObject*
-Message_getQid(s_Message* self)
-{
+Message_getQid(s_Message* self) {
return Py_BuildValue("I", self->message->getQid());
}
static PyObject*
-Message_setQid(s_Message* self, PyObject* args)
-{
+Message_setQid(s_Message* self, PyObject* args) {
uint16_t id;
if (!PyArg_ParseTuple(args, "I", &id)) {
return NULL;
@@ -1738,8 +1668,7 @@
}
static PyObject*
-Message_getRcode(s_Message* self)
-{
+Message_getRcode(s_Message* self) {
s_Rcode* rcode;
rcode = (s_Rcode*)rcode_type.tp_alloc(&rcode_type, 0);
@@ -1756,8 +1685,7 @@
}
static PyObject*
-Message_setRcode(s_Message* self, PyObject* args)
-{
+Message_setRcode(s_Message* self, PyObject* args) {
s_Rcode* rcode;
if (!PyArg_ParseTuple(args, "O!", &rcode_type, &rcode)) {
return NULL;
@@ -1767,8 +1695,7 @@
}
static PyObject*
-Message_getOpcode(s_Message* self)
-{
+Message_getOpcode(s_Message* self) {
s_Opcode* opcode;
opcode = (s_Opcode*)opcode_type.tp_alloc(&opcode_type, 0);
@@ -1788,8 +1715,7 @@
}
static PyObject*
-Message_setOpcode(s_Message* self, PyObject* args)
-{
+Message_setOpcode(s_Message* self, PyObject* args) {
s_Opcode* opcode;
if (!PyArg_ParseTuple(args, "O!", &opcode_type, &opcode)) {
return NULL;
@@ -1799,8 +1725,7 @@
}
static PyObject*
-Message_getRRCount(s_Message* self, PyObject* args)
-{
+Message_getRRCount(s_Message* self, PyObject* args) {
s_Section *section;
if (!PyArg_ParseTuple(args, "O!", §ion_type, §ion)) {
return NULL;
@@ -1810,8 +1735,7 @@
// TODO use direct iterators for these? (or simply lists for now?)
static PyObject*
-Message_getQuestion(s_Message* self)
-{
+Message_getQuestion(s_Message* self) {
PyObject* list = PyList_New(0);
for (QuestionIterator qi = self->message->beginQuestion();
@@ -1832,8 +1756,7 @@
}
static PyObject*
-Message_getSection(s_Message* self, PyObject* args)
-{
+Message_getSection(s_Message* self, PyObject* args) {
s_Section *section;
if (!PyArg_ParseTuple(args, "O!", §ion_type, §ion)) {
return NULL;
@@ -1868,8 +1791,7 @@
//static PyObject* Message_endSection(s_Message* self, PyObject* args);
//static PyObject* Message_addQuestion(s_Message* self, PyObject* args);
static PyObject*
-Message_addQuestion(s_Message* self, PyObject* args)
-{
+Message_addQuestion(s_Message* self, PyObject* args) {
s_Question *question;
if (!PyArg_ParseTuple(args, "O!", &question_type, &question)) {
@@ -1882,8 +1804,7 @@
}
static PyObject*
-Message_addRRset(s_Message* self, PyObject* args)
-{
+Message_addRRset(s_Message* self, PyObject* args) {
PyObject *sign = Py_False;
s_Section* section;
s_RRset* rrset;
@@ -1903,8 +1824,7 @@
}
static PyObject*
-Message_clear(s_Message* self, PyObject* args)
-{
+Message_clear(s_Message* self, PyObject* args) {
unsigned int i;
// The constructor argument can be a string ("IN"), an integer (1),
// or a sequence of numbers between 0 and 255 (wire code)
@@ -1927,29 +1847,25 @@
}
static PyObject*
-Message_makeResponse(s_Message* self)
-{
+Message_makeResponse(s_Message* self) {
self->message->makeResponse();
Py_RETURN_NONE;
}
static PyObject*
-Message_toText(s_Message* self)
-{
+Message_toText(s_Message* self) {
// Py_BuildValue makes python objects from native data
return Py_BuildValue("s", self->message->toText().c_str());
}
static PyObject*
-Message_str(PyObject* self)
-{
+Message_str(PyObject* self) {
// Simply call the to_text method we already defined
return PyObject_CallMethod(self, (char*)"to_text", (char*)"");
}
static PyObject*
-Message_toWire(s_Message* self, PyObject* args)
-{
+Message_toWire(s_Message* self, PyObject* args) {
s_MessageRenderer* mr;
if (PyArg_ParseTuple(args, "O!", &messagerenderer_type, (PyObject**) &mr)) {
@@ -1971,8 +1887,7 @@
}
static PyObject*
-Message_fromWire(s_Message* self, PyObject* args)
-{
+Message_fromWire(s_Message* self, PyObject* args) {
const char* b;
Py_ssize_t len;
if (!PyArg_ParseTuple(args, "y#", &b, &len)) {
@@ -2000,8 +1915,7 @@
// Module Initialization, all statics are initialized here
bool
-initModulePart_Message(PyObject* mod)
-{
+initModulePart_Message(PyObject* mod) {
/* add methods to class */
if (PyType_Ready(&messageflag_type) < 0) {
Modified: experiments/python-binding/src/lib/dns/python/messagerenderer_python.cc
==============================================================================
--- experiments/python-binding/src/lib/dns/python/messagerenderer_python.cc (original)
+++ experiments/python-binding/src/lib/dns/python/messagerenderer_python.cc Wed Jun 23 09:15:45 2010
@@ -118,16 +118,14 @@
};
static int
-MessageRenderer_init(s_MessageRenderer* self)
-{
+MessageRenderer_init(s_MessageRenderer* self) {
self->outputbuffer = new OutputBuffer(4096);
self->messagerenderer = new MessageRenderer(*self->outputbuffer);
return 0;
}
static void
-MessageRenderer_destroy(s_MessageRenderer* self)
-{
+MessageRenderer_destroy(s_MessageRenderer* self) {
delete self->messagerenderer;
delete self->outputbuffer;
self->messagerenderer = NULL;
@@ -135,20 +133,19 @@
}
static PyObject*
-MessageRenderer_getData(s_MessageRenderer* self)
-{
- return Py_BuildValue("y#", self->messagerenderer->getData(), self->messagerenderer->getLength());
-}
-
-static PyObject*
-MessageRenderer_getLength(s_MessageRenderer* self)
-{
+MessageRenderer_getData(s_MessageRenderer* self) {
+ return Py_BuildValue("y#",
+ self->messagerenderer->getData(),
+ self->messagerenderer->getLength());
+}
+
+static PyObject*
+MessageRenderer_getLength(s_MessageRenderer* self) {
return Py_BuildValue("I", self->messagerenderer->getLength());
}
static PyObject*
-MessageRenderer_isTruncated(s_MessageRenderer* self)
-{
+MessageRenderer_isTruncated(s_MessageRenderer* self) {
if (self->messagerenderer->isTruncated()) {
Py_RETURN_TRUE;
} else {
@@ -157,20 +154,19 @@
}
static PyObject*
-MessageRenderer_getLengthLimit(s_MessageRenderer* self)
-{
+MessageRenderer_getLengthLimit(s_MessageRenderer* self) {
return Py_BuildValue("I", self->messagerenderer->getLengthLimit());
}
static PyObject*
-MessageRenderer_setTruncated(s_MessageRenderer* self)
-{
+MessageRenderer_setTruncated(s_MessageRenderer* self) {
self->messagerenderer->setTruncated();
Py_RETURN_NONE;
}
static PyObject*
-MessageRenderer_setLengthLimit(s_MessageRenderer* self, PyObject* args)
+MessageRenderer_setLengthLimit(s_MessageRenderer* self,
+ PyObject* args)
{
size_t lengthlimit;
if (!PyArg_ParseTuple(args, "I", &lengthlimit)) {
@@ -185,8 +181,7 @@
// Module Initialization, all statics are initialized here
bool
-initModulePart_MessageRenderer(PyObject* mod)
-{
+initModulePart_MessageRenderer(PyObject* mod) {
// Add the exceptions to the module
// Add the enums to the module
Modified: experiments/python-binding/src/lib/dns/python/name_python.cc
==============================================================================
--- experiments/python-binding/src/lib/dns/python/name_python.cc (original)
+++ experiments/python-binding/src/lib/dns/python/name_python.cc Wed Jun 23 09:15:45 2010
@@ -130,7 +130,9 @@
// TODO: is there also a way to just not define it?
static int
-NameComparisonResult_init(s_NameComparisonResult* self UNUSED_PARAM, PyObject* args UNUSED_PARAM) {
+NameComparisonResult_init(s_NameComparisonResult* self UNUSED_PARAM,
+ PyObject* args UNUSED_PARAM)
+{
PyErr_SetString(PyExc_NotImplementedError,
"NameComparisonResult can't be built directly");
return -1;
@@ -281,8 +283,7 @@
static int
-Name_init(s_Name* self, PyObject* args)
-{
+Name_init(s_Name* self, PyObject* args) {
const char* s;
PyObject* downcase = Py_False;
@@ -360,16 +361,14 @@
}
static void
-Name_destroy(s_Name* self)
-{
+Name_destroy(s_Name* self) {
delete self->name;
self->name = NULL;
Py_TYPE(self)->tp_free(self);
}
static PyObject*
-Name_at(s_Name* self, PyObject* args)
-{
+Name_at(s_Name* self, PyObject* args) {
size_t pos;
if (!PyArg_ParseTuple(args, "i", &pos)) {
return NULL;
@@ -384,33 +383,28 @@
}
static PyObject*
-Name_getLength(s_Name* self)
-{
+Name_getLength(s_Name* self) {
return Py_BuildValue("i", self->name->getLength());
}
static PyObject*
-Name_getLabelCount(s_Name* self)
-{
+Name_getLabelCount(s_Name* self) {
return Py_BuildValue("i", self->name->getLabelCount());
}
static PyObject*
-Name_toText(s_Name* self)
-{
+Name_toText(s_Name* self) {
return Py_BuildValue("s", self->name->toText().c_str());
}
static PyObject*
-Name_str(PyObject* self)
-{
+Name_str(PyObject* self) {
// Simply call the to_text method we already defined
return PyObject_CallMethod(self, (char*)"to_text", (char*)"");
}
static PyObject*
-Name_toWire(s_Name* self, PyObject* args)
-{
+Name_toWire(s_Name* self, PyObject* args) {
PyObject* bytes;
s_MessageRenderer* mr;
@@ -470,8 +464,7 @@
}
static PyObject*
-Name_split(s_Name* self, PyObject* args)
-{
+Name_split(s_Name* self, PyObject* args) {
unsigned int first, n;
s_Name* ret = NULL;
@@ -511,8 +504,7 @@
#include <iostream>
static PyObject*
-Name_richcmp(s_Name* n1, s_Name* n2, int op)
-{
+Name_richcmp(s_Name* n1, s_Name* n2, int op) {
bool c;
// Check for null and if the types match. If different type,
@@ -553,8 +545,7 @@
}
static PyObject*
-Name_reverse(s_Name* self)
-{
+Name_reverse(s_Name* self) {
s_Name* ret = PyObject_New(s_Name, &name_type);
if (ret != NULL) {
@@ -568,8 +559,7 @@
}
static PyObject*
-Name_concatenate(s_Name* self, PyObject* args)
-{
+Name_concatenate(s_Name* self, PyObject* args) {
s_Name* other;
if (!PyArg_ParseTuple(args, "O!", &name_type, (PyObject**) &other))
@@ -592,16 +582,14 @@
}
static PyObject*
-Name_downcase(s_Name* self)
-{
+Name_downcase(s_Name* self) {
self->name->downcase();
Py_INCREF(self);
return (PyObject*) self;
}
static PyObject*
-Name_isWildCard(s_Name* self)
-{
+Name_isWildCard(s_Name* self) {
if (self->name->isWildcard()) {
Py_RETURN_TRUE;
} else {
@@ -613,8 +601,7 @@
// Module Initialization, all statics are initialized here
bool
-initModulePart_Name(PyObject* mod)
-{
+initModulePart_Name(PyObject* mod) {
// Add the classes to the module
// We initialize the static description object with PyType_Ready(),
// then add it to the module
Modified: experiments/python-binding/src/lib/dns/python/question_python.cc
==============================================================================
--- experiments/python-binding/src/lib/dns/python/question_python.cc (original)
+++ experiments/python-binding/src/lib/dns/python/question_python.cc Wed Jun 23 09:15:45 2010
@@ -128,8 +128,7 @@
};
static int
-Question_init(s_Question* self, PyObject* args)
-{
+Question_init(s_Question* self, PyObject* args) {
// The constructor argument can be a string ("IN"), an integer (1),
// or a sequence of numbers between 0 and 255 (wire code)
@@ -183,15 +182,13 @@
}
static void
-Question_destroy(s_Question* self)
-{
+Question_destroy(s_Question* self) {
self->question.reset();
Py_TYPE(self)->tp_free(self);
}
static PyObject*
-Question_getName(s_Question* self)
-{
+Question_getName(s_Question* self) {
s_Name* name;
// is this the best way to do this?
@@ -209,8 +206,7 @@
}
static PyObject*
-Question_getType(s_Question* self)
-{
+Question_getType(s_Question* self) {
s_RRType* rrtype;
rrtype = (s_RRType*)rrtype_type.tp_alloc(&rrtype_type, 0);
@@ -227,8 +223,7 @@
}
static PyObject*
-Question_getClass(s_Question* self)
-{
+Question_getClass(s_Question* self) {
s_RRClass* rrclass;
rrclass = (s_RRClass*)rrclass_type.tp_alloc(&rrclass_type, 0);
@@ -246,22 +241,19 @@
static PyObject*
-Question_toText(s_Question* self)
-{
+Question_toText(s_Question* self) {
// Py_BuildValue makes python objects from native data
return Py_BuildValue("s", self->question->toText().c_str());
}
static PyObject*
-Question_str(PyObject* self)
-{
+Question_str(PyObject* self) {
// Simply call the to_text method we already defined
return PyObject_CallMethod(self, (char*)"to_text", (char*)"");
}
static PyObject*
-Question_toWire(s_Question* self, PyObject* args)
-{
+Question_toWire(s_Question* self, PyObject* args) {
PyObject* bytes;
s_MessageRenderer* mr;
@@ -270,13 +262,15 @@
OutputBuffer buffer(255);
self->question->toWire(buffer);
- PyObject* n = PyBytes_FromStringAndSize((const char*) buffer.getData(), buffer.getLength());
+ PyObject* n = PyBytes_FromStringAndSize((const char*) buffer.getData(),
+ buffer.getLength());
PyObject* result = PySequence_InPlaceConcat(bytes_o, n);
// We need to release the object we temporarily created here
// to prevent memory leak
Py_DECREF(n);
return result;
- } else if (PyArg_ParseTuple(args, "O!", &messagerenderer_type, (PyObject**) &mr)) {
+ } else if (PyArg_ParseTuple(args, "O!", &messagerenderer_type,
+ (PyObject**) &mr)) {
self->question->toWire(*mr->messagerenderer);
// If we return NULL it is seen as an error, so use this for
// None returns
@@ -293,8 +287,7 @@
// Module Initialization, all statics are initialized here
bool
-initModulePart_Question(PyObject* mod)
-{
+initModulePart_Question(PyObject* mod) {
// Add the exceptions to the module
// We initialize the static description object with PyType_Ready(),
Modified: experiments/python-binding/src/lib/dns/python/rdata_python.cc
==============================================================================
--- experiments/python-binding/src/lib/dns/python/rdata_python.cc (original)
+++ experiments/python-binding/src/lib/dns/python/rdata_python.cc Wed Jun 23 09:15:45 2010
@@ -137,8 +137,7 @@
};
static int
-Rdata_init(s_Rdata* self, PyObject* args)
-{
+Rdata_init(s_Rdata* self, PyObject* args) {
s_RRType* rrtype;
s_RRClass* rrclass;
const char* s;
@@ -156,8 +155,7 @@
}
static void
-Rdata_destroy(s_Rdata* self)
-{
+Rdata_destroy(s_Rdata* self) {
// Clear the shared_ptr so that its reference count is zero
// before we call tp_free() (there is no direct release())
self->rdata.reset();
@@ -165,22 +163,19 @@
}
static PyObject*
-Rdata_toText(s_Rdata* self)
-{
+Rdata_toText(s_Rdata* self) {
// Py_BuildValue makes python objects from native data
return Py_BuildValue("s", self->rdata->toText().c_str());
}
static PyObject*
-Rdata_str(PyObject* self)
-{
+Rdata_str(PyObject* self) {
// Simply call the to_text method we already defined
return PyObject_CallMethod(self, (char*)"to_text", (char*)"");
}
static PyObject*
-Rdata_toWire(s_Rdata* self, PyObject* args)
-{
+Rdata_toWire(s_Rdata* self, PyObject* args) {
PyObject* bytes;
s_MessageRenderer* mr;
@@ -212,8 +207,7 @@
// Module Initialization, all statics are initialized here
bool
-initModulePart_Rdata(PyObject* mod)
-{
+initModulePart_Rdata(PyObject* mod) {
// We initialize the static description object with PyType_Ready(),
// then add it to the module. This is not just a check! (leaving
// this out results in segmentation faults)
Modified: experiments/python-binding/src/lib/dns/python/rrclass_python.cc
==============================================================================
--- experiments/python-binding/src/lib/dns/python/rrclass_python.cc (original)
+++ experiments/python-binding/src/lib/dns/python/rrclass_python.cc Wed Jun 23 09:15:45 2010
@@ -37,7 +37,7 @@
// RRClass
//
-// The s_* Class simply coverst one instantiation of the object
+// The s_* Class simply covers one instantiation of the object
typedef struct {
PyObject_HEAD
RRClass* rrclass;
@@ -154,8 +154,7 @@
};
static int
-RRClass_init(s_RRClass* self, PyObject* args)
-{
+RRClass_init(s_RRClass* self, PyObject* args) {
const char* s;
unsigned int i;
PyObject* bytes = NULL;
@@ -203,8 +202,7 @@
}
static void
-RRClass_destroy(s_RRClass* self)
-{
+RRClass_destroy(s_RRClass* self) {
if (self->rrclass != NULL)
delete self->rrclass;
self->rrclass = NULL;
@@ -212,22 +210,19 @@
}
static PyObject*
-RRClass_toText(s_RRClass* self)
-{
+RRClass_toText(s_RRClass* self) {
// Py_BuildValue makes python objects from native data
return Py_BuildValue("s", self->rrclass->toText().c_str());
}
static PyObject*
-RRClass_str(PyObject* self)
-{
+RRClass_str(PyObject* self) {
// Simply call the to_text method we already defined
return PyObject_CallMethod(self, (char*)"to_text", (char*)"");
}
static PyObject*
-RRClass_toWire(s_RRClass* self, PyObject* args)
-{
+RRClass_toWire(s_RRClass* self, PyObject* args) {
PyObject* bytes;
s_MessageRenderer* mr;
@@ -255,14 +250,12 @@
}
static PyObject*
-RRClass_getCode(s_RRClass* self)
-{
+RRClass_getCode(s_RRClass* self) {
return Py_BuildValue("I", self->rrclass->getCode());
}
static PyObject*
-RRClass_richcmp(s_RRClass* self, s_RRClass* other, int op)
-{
+RRClass_richcmp(s_RRClass* self, s_RRClass* other, int op) {
bool c;
// Check for null and if the types match. If different type,
@@ -303,8 +296,7 @@
Py_RETURN_FALSE;
}
-static PyObject* RRClass_IN(s_RRClass *self UNUSED_PARAM)
-{
+static PyObject* RRClass_IN(s_RRClass *self UNUSED_PARAM) {
s_RRClass* ret = PyObject_New(s_RRClass, &rrclass_type);
if (ret != NULL) {
ret->rrclass = new RRClass(RRClass::IN());
@@ -316,8 +308,7 @@
return (PyObject*) ret;
}
-static PyObject* RRClass_CH(s_RRClass *self UNUSED_PARAM)
-{
+static PyObject* RRClass_CH(s_RRClass *self UNUSED_PARAM) {
s_RRClass* ret = PyObject_New(s_RRClass, &rrclass_type);
if (ret != NULL) {
ret->rrclass = new RRClass(RRClass::CH());
@@ -329,8 +320,7 @@
return (PyObject*) ret;
}
-static PyObject* RRClass_HS(s_RRClass *self UNUSED_PARAM)
-{
+static PyObject* RRClass_HS(s_RRClass *self UNUSED_PARAM) {
s_RRClass* ret = PyObject_New(s_RRClass, &rrclass_type);
if (ret != NULL) {
ret->rrclass = new RRClass(RRClass::HS());
@@ -342,8 +332,7 @@
return (PyObject*) ret;
}
-static PyObject* RRClass_NONE(s_RRClass *self UNUSED_PARAM)
-{
+static PyObject* RRClass_NONE(s_RRClass *self UNUSED_PARAM) {
s_RRClass* ret = PyObject_New(s_RRClass, &rrclass_type);
if (ret != NULL) {
ret->rrclass = new RRClass(RRClass::NONE());
@@ -355,8 +344,7 @@
return (PyObject*) ret;
}
-static PyObject* RRClass_ANY(s_RRClass *self UNUSED_PARAM)
-{
+static PyObject* RRClass_ANY(s_RRClass *self UNUSED_PARAM) {
s_RRClass* ret = PyObject_New(s_RRClass, &rrclass_type);
if (ret != NULL) {
ret->rrclass = new RRClass(RRClass::ANY());
@@ -372,8 +360,7 @@
// Module Initialization, all statics are initialized here
bool
-initModulePart_RRClass(PyObject* mod)
-{
+initModulePart_RRClass(PyObject* mod) {
// Add the exceptions to the module
po_InvalidRRClass = PyErr_NewException("libdns_python.InvalidRRClass", NULL, NULL);
Py_INCREF(po_InvalidRRClass);
Modified: experiments/python-binding/src/lib/dns/python/rrset_python.cc
==============================================================================
--- experiments/python-binding/src/lib/dns/python/rrset_python.cc (original)
+++ experiments/python-binding/src/lib/dns/python/rrset_python.cc Wed Jun 23 09:15:45 2010
@@ -170,8 +170,7 @@
};
static int
-RRset_init(s_RRset* self, PyObject* args UNUSED_PARAM)
-{
+RRset_init(s_RRset* self, PyObject* args UNUSED_PARAM) {
s_Name* name;
s_RRClass* rrclass;
s_RRType* rrtype;
@@ -192,8 +191,7 @@
}
static void
-RRset_destroy(s_RRset* self)
-{
+RRset_destroy(s_RRset* self) {
// Clear the shared_ptr so that its reference count is zero
// before we call tp_free() (there is no direct release())
self->rrset.reset();
@@ -201,14 +199,12 @@
}
static PyObject*
-RRset_getRdataCount(s_RRset* self)
-{
+RRset_getRdataCount(s_RRset* self) {
return Py_BuildValue("I", self->rrset->getRdataCount());
}
static PyObject*
-RRset_getName(s_RRset* self)
-{
+RRset_getName(s_RRset* self) {
s_Name* name;
// is this the best way to do this?
@@ -226,8 +222,7 @@
}
static PyObject*
-RRset_getClass(s_RRset* self)
-{
+RRset_getClass(s_RRset* self) {
s_RRClass* rrclass;
rrclass = (s_RRClass*)rrclass_type.tp_alloc(&rrclass_type, 0);
@@ -244,8 +239,7 @@
}
static PyObject*
-RRset_getType(s_RRset* self)
-{
+RRset_getType(s_RRset* self) {
s_RRType* rrtype;
rrtype = (s_RRType*)rrtype_type.tp_alloc(&rrtype_type, 0);
@@ -262,8 +256,7 @@
}
static PyObject*
-RRset_getTTL(s_RRset* self)
-{
+RRset_getTTL(s_RRset* self) {
s_RRTTL* rrttl;
rrttl = (s_RRTTL*)rrttl_type.tp_alloc(&rrttl_type, 0);
@@ -280,8 +273,7 @@
}
static PyObject*
-RRset_setName(s_RRset* self, PyObject* args)
-{
+RRset_setName(s_RRset* self, PyObject* args) {
s_Name* name;
if (!PyArg_ParseTuple(args, "O!", &name_type, &name)) {
return NULL;
@@ -291,8 +283,7 @@
}
static PyObject*
-RRset_setTTL(s_RRset* self, PyObject* args)
-{
+RRset_setTTL(s_RRset* self, PyObject* args) {
s_RRTTL* rrttl;
if (!PyArg_ParseTuple(args, "O!", &rrttl_type, &rrttl)) {
return NULL;
@@ -302,8 +293,7 @@
}
static PyObject*
-RRset_toText(s_RRset* self)
-{
+RRset_toText(s_RRset* self) {
try {
return Py_BuildValue("s", self->rrset->toText().c_str());
} catch (EmptyRRset ers) {
@@ -313,15 +303,13 @@
}
static PyObject*
-RRset_str(PyObject* self)
-{
+RRset_str(PyObject* self) {
// Simply call the to_text method we already defined
return PyObject_CallMethod(self, (char*)"to_text", (char*)"");
}
static PyObject*
-RRset_toWire(s_RRset* self, PyObject* args)
-{
+RRset_toWire(s_RRset* self, PyObject* args) {
PyObject* bytes;
s_MessageRenderer* mr;
@@ -355,8 +343,7 @@
}
static PyObject*
-RRset_addRdata(s_RRset* self, PyObject* args)
-{
+RRset_addRdata(s_RRset* self, PyObject* args) {
s_Rdata* rdata;
if (!PyArg_ParseTuple(args, "O!", &rdata_type, &rdata)) {
return NULL;
@@ -373,8 +360,7 @@
}
static PyObject*
-RRset_getRdata(s_RRset* self)
-{
+RRset_getRdata(s_RRset* self) {
PyObject* list = PyList_New(0);
RdataIteratorPtr it = self->rrset->getRdataIterator();
@@ -401,8 +387,7 @@
// Module Initialization, all statics are initialized here
bool
-initModulePart_RRset(PyObject* mod)
-{
+initModulePart_RRset(PyObject* mod) {
// Add the exceptions to the module
po_EmptyRRset = PyErr_NewException("libdns_python.EmptyRRset", NULL, NULL);
PyModule_AddObject(mod, "EmptyRRset", po_EmptyRRset);
Modified: experiments/python-binding/src/lib/dns/python/rrttl_python.cc
==============================================================================
--- experiments/python-binding/src/lib/dns/python/rrttl_python.cc (original)
+++ experiments/python-binding/src/lib/dns/python/rrttl_python.cc Wed Jun 23 09:15:45 2010
@@ -37,7 +37,7 @@
// RRTTL
//
-// The s_* Class simply coverst one instantiation of the object
+// The s_* Class simply covers one instantiation of the object
typedef struct {
PyObject_HEAD
RRTTL* rrttl;
@@ -143,8 +143,7 @@
};
static int
-RRTTL_init(s_RRTTL* self, PyObject* args)
-{
+RRTTL_init(s_RRTTL* self, PyObject* args) {
const char* s;
unsigned long i;
PyObject* bytes = NULL;
@@ -196,8 +195,7 @@
}
static void
-RRTTL_destroy(s_RRTTL* self)
-{
+RRTTL_destroy(s_RRTTL* self) {
if (self->rrttl != NULL)
delete self->rrttl;
self->rrttl = NULL;
@@ -205,22 +203,19 @@
}
static PyObject*
-RRTTL_toText(s_RRTTL* self)
-{
+RRTTL_toText(s_RRTTL* self) {
// Py_BuildValue makes python objects from native data
return Py_BuildValue("s", self->rrttl->toText().c_str());
}
static PyObject*
-RRTTL_str(PyObject* self)
-{
+RRTTL_str(PyObject* self) {
// Simply call the to_text method we already defined
return PyObject_CallMethod(self, (char*)"to_text", (char*)"");
}
static PyObject*
-RRTTL_toWire(s_RRTTL* self, PyObject* args)
-{
+RRTTL_toWire(s_RRTTL* self, PyObject* args) {
PyObject* bytes;
s_MessageRenderer* mr;
@@ -248,14 +243,12 @@
}
static PyObject*
-RRTTL_getValue(s_RRTTL* self)
-{
+RRTTL_getValue(s_RRTTL* self) {
return Py_BuildValue("I", self->rrttl->getValue());
}
static PyObject*
-RRTTL_richcmp(s_RRTTL* self, s_RRTTL* other, int op)
-{
+RRTTL_richcmp(s_RRTTL* self, s_RRTTL* other, int op) {
bool c = false;
// Check for null and if the types match. If different type,
@@ -298,8 +291,7 @@
// Module Initialization, all statics are initialized here
bool
-initModulePart_RRTTL(PyObject* mod)
-{
+initModulePart_RRTTL(PyObject* mod) {
// Add the exceptions to the module
po_InvalidRRTTL = PyErr_NewException("libdns_python.InvalidRRTTL", NULL, NULL);
PyModule_AddObject(mod, "InvalidRRTTL", po_InvalidRRTTL);
Modified: experiments/python-binding/src/lib/dns/python/rrtype_python.cc
==============================================================================
--- experiments/python-binding/src/lib/dns/python/rrtype_python.cc (original)
+++ experiments/python-binding/src/lib/dns/python/rrtype_python.cc Wed Jun 23 09:15:45 2010
@@ -37,7 +37,7 @@
// RRType
//
-// The s_* Class simply coverst one instantiation of the object
+// The s_* Class simply covers one instantiation of the object
typedef struct {
PyObject_HEAD
const RRType* rrtype;
@@ -53,32 +53,56 @@
static void RRType_destroy(s_RRType* self);
// These are the functions we export
-static PyObject* RRType_toText(s_RRType* self);
+static PyObject*
+RRType_toText(s_RRType* self);
// This is a second version of toText, we need one where the argument
// is a PyObject*, for the str() function in python.
-static PyObject* RRType_str(PyObject* self);
-static PyObject* RRType_toWire(s_RRType* self, PyObject* args);
-static PyObject* RRType_getCode(s_RRType* self);
-static PyObject* RRType_richcmp(s_RRType* self, s_RRType* other, int op);
-static PyObject* RRType_NSEC3PARAM(s_RRType *self);
-static PyObject* RRType_DNAME(s_RRType *self);
-static PyObject* RRType_PTR(s_RRType *self);
-static PyObject* RRType_MX(s_RRType *self);
-static PyObject* RRType_DNSKEY(s_RRType *self);
-static PyObject* RRType_TXT(s_RRType *self);
-static PyObject* RRType_RRSIG(s_RRType *self);
-static PyObject* RRType_NSEC(s_RRType *self);
-static PyObject* RRType_AAAA(s_RRType *self);
-static PyObject* RRType_DS(s_RRType *self);
-static PyObject* RRType_OPT(s_RRType *self);
-static PyObject* RRType_A(s_RRType *self);
-static PyObject* RRType_NS(s_RRType *self);
-static PyObject* RRType_CNAME(s_RRType *self);
-static PyObject* RRType_SOA(s_RRType *self);
-static PyObject* RRType_NSEC3(s_RRType *self);
-static PyObject* RRType_IXFR(s_RRType *self);
-static PyObject* RRType_AXFR(s_RRType *self);
-static PyObject* RRType_ANY(s_RRType *self);
+static PyObject*
+RRType_str(PyObject* self);
+static PyObject*
+RRType_toWire(s_RRType* self, PyObject* args);
+static PyObject*
+RRType_getCode(s_RRType* self);
+static PyObject*
+RRType_richcmp(s_RRType* self, s_RRType* other, int op);
+static PyObject*
+RRType_NSEC3PARAM(s_RRType *self);
+static PyObject*
+RRType_DNAME(s_RRType *self);
+static PyObject*
+RRType_PTR(s_RRType *self);
+static PyObject*
+RRType_MX(s_RRType *self);
+static PyObject*
+RRType_DNSKEY(s_RRType *self);
+static PyObject*
+RRType_TXT(s_RRType *self);
+static PyObject*
+RRType_RRSIG(s_RRType *self);
+static PyObject*
+RRType_NSEC(s_RRType *self);
+static PyObject*
+RRType_AAAA(s_RRType *self);
+static PyObject*
+RRType_DS(s_RRType *self);
+static PyObject*
+RRType_OPT(s_RRType *self);
+static PyObject*
+RRType_A(s_RRType *self);
+static PyObject*
+RRType_NS(s_RRType *self);
+static PyObject*
+RRType_CNAME(s_RRType *self);
+static PyObject*
+RRType_SOA(s_RRType *self);
+static PyObject*
+RRType_NSEC3(s_RRType *self);
+static PyObject*
+RRType_IXFR(s_RRType *self);
+static PyObject*
+RRType_AXFR(s_RRType *self);
+static PyObject*
+RRType_ANY(s_RRType *self);
//TODO: do we also want specific equals? (and perhaps not even richcmp?)
@@ -181,8 +205,7 @@
};
static int
-RRType_init(s_RRType* self, PyObject* args)
-{
+RRType_init(s_RRType* self, PyObject* args) {
const char* s;
unsigned int i;
PyObject* bytes = NULL;
@@ -238,8 +261,7 @@
}
static void
-RRType_destroy(s_RRType* self)
-{
+RRType_destroy(s_RRType* self) {
if (self->rrtype != NULL)
delete self->rrtype;
self->rrtype = NULL;
@@ -247,22 +269,19 @@
}
static PyObject*
-RRType_toText(s_RRType* self)
-{
+RRType_toText(s_RRType* self) {
// Py_BuildValue makes python objects from native data
return Py_BuildValue("s", self->rrtype->toText().c_str());
}
static PyObject*
-RRType_str(PyObject* self)
-{
+RRType_str(PyObject* self) {
// Simply call the to_text method we already defined
return PyObject_CallMethod(self, (char*)"to_text", (char*)"");
}
static PyObject*
-RRType_toWire(s_RRType* self, PyObject* args)
-{
+RRType_toWire(s_RRType* self, PyObject* args) {
PyObject* bytes;
s_MessageRenderer* mr;
@@ -290,14 +309,12 @@
}
static PyObject*
-RRType_getCode(s_RRType* self)
-{
+RRType_getCode(s_RRType* self) {
return Py_BuildValue("I", self->rrtype->getCode());
}
static PyObject*
-RRType_richcmp(s_RRType* self, s_RRType* other, int op)
-{
+RRType_richcmp(s_RRType* self, s_RRType* other, int op) {
bool c;
// Check for null and if the types match. If different type,
@@ -338,8 +355,8 @@
Py_RETURN_FALSE;
}
-static PyObject* RRType_NSEC3PARAM(s_RRType *self UNUSED_PARAM)
-{
+static PyObject*
+RRType_NSEC3PARAM(s_RRType *self UNUSED_PARAM) {
s_RRType* ret = PyObject_New(s_RRType, &rrtype_type);
if (ret != NULL) {
ret->rrtype = new RRType(RRType::NSEC3PARAM());
@@ -351,8 +368,8 @@
return (PyObject*) ret;
}
-static PyObject* RRType_DNAME(s_RRType *self UNUSED_PARAM)
-{
+static PyObject*
+RRType_DNAME(s_RRType *self UNUSED_PARAM) {
s_RRType* ret = PyObject_New(s_RRType, &rrtype_type);
if (ret != NULL) {
ret->rrtype = new RRType(RRType::DNAME());
@@ -364,8 +381,8 @@
return (PyObject*) ret;
}
-static PyObject* RRType_PTR(s_RRType *self UNUSED_PARAM)
-{
+static PyObject*
+RRType_PTR(s_RRType *self UNUSED_PARAM) {
s_RRType* ret = PyObject_New(s_RRType, &rrtype_type);
if (ret != NULL) {
ret->rrtype = new RRType(RRType::PTR());
@@ -377,8 +394,8 @@
return (PyObject*) ret;
}
-static PyObject* RRType_MX(s_RRType *self UNUSED_PARAM)
-{
+static PyObject*
+RRType_MX(s_RRType *self UNUSED_PARAM) {
s_RRType* ret = PyObject_New(s_RRType, &rrtype_type);
if (ret != NULL) {
ret->rrtype = new RRType(RRType::MX());
@@ -390,8 +407,8 @@
return (PyObject*) ret;
}
-static PyObject* RRType_DNSKEY(s_RRType *self UNUSED_PARAM)
-{
+static PyObject*
+RRType_DNSKEY(s_RRType *self UNUSED_PARAM) {
s_RRType* ret = PyObject_New(s_RRType, &rrtype_type);
if (ret != NULL) {
ret->rrtype = new RRType(RRType::DNSKEY());
@@ -403,8 +420,8 @@
return (PyObject*) ret;
}
-static PyObject* RRType_TXT(s_RRType *self UNUSED_PARAM)
-{
+static PyObject*
+RRType_TXT(s_RRType *self UNUSED_PARAM) {
s_RRType* ret = PyObject_New(s_RRType, &rrtype_type);
if (ret != NULL) {
ret->rrtype = new RRType(RRType::TXT());
@@ -416,8 +433,8 @@
return (PyObject*) ret;
}
-static PyObject* RRType_RRSIG(s_RRType *self UNUSED_PARAM)
-{
+static PyObject*
+RRType_RRSIG(s_RRType *self UNUSED_PARAM) {
s_RRType* ret = PyObject_New(s_RRType, &rrtype_type);
if (ret != NULL) {
ret->rrtype = new RRType(RRType::RRSIG());
@@ -429,8 +446,8 @@
return (PyObject*) ret;
}
-static PyObject* RRType_NSEC(s_RRType *self UNUSED_PARAM)
-{
+static PyObject*
+RRType_NSEC(s_RRType *self UNUSED_PARAM) {
s_RRType* ret = PyObject_New(s_RRType, &rrtype_type);
if (ret != NULL) {
ret->rrtype = new RRType(RRType::NSEC());
@@ -442,8 +459,8 @@
return (PyObject*) ret;
}
-static PyObject* RRType_AAAA(s_RRType *self UNUSED_PARAM)
-{
+static PyObject*
+RRType_AAAA(s_RRType *self UNUSED_PARAM) {
s_RRType* ret = PyObject_New(s_RRType, &rrtype_type);
if (ret != NULL) {
ret->rrtype = new RRType(RRType::AAAA());
@@ -455,8 +472,8 @@
return (PyObject*) ret;
}
-static PyObject* RRType_DS(s_RRType *self UNUSED_PARAM)
-{
+static PyObject*
+RRType_DS(s_RRType *self UNUSED_PARAM) {
s_RRType* ret = PyObject_New(s_RRType, &rrtype_type);
if (ret != NULL) {
ret->rrtype = new RRType(RRType::DS());
@@ -468,8 +485,8 @@
return (PyObject*) ret;
}
-static PyObject* RRType_OPT(s_RRType *self UNUSED_PARAM)
-{
+static PyObject*
+RRType_OPT(s_RRType *self UNUSED_PARAM) {
s_RRType* ret = PyObject_New(s_RRType, &rrtype_type);
if (ret != NULL) {
ret->rrtype = new RRType(RRType::OPT());
@@ -481,8 +498,8 @@
return (PyObject*) ret;
}
-static PyObject* RRType_A(s_RRType *self UNUSED_PARAM)
-{
+static PyObject*
+RRType_A(s_RRType *self UNUSED_PARAM) {
s_RRType* ret = PyObject_New(s_RRType, &rrtype_type);
if (ret != NULL) {
ret->rrtype = new RRType(RRType::A());
@@ -494,8 +511,8 @@
return (PyObject*) ret;
}
-static PyObject* RRType_NS(s_RRType *self UNUSED_PARAM)
-{
+static PyObject*
+RRType_NS(s_RRType *self UNUSED_PARAM) {
s_RRType* ret = PyObject_New(s_RRType, &rrtype_type);
if (ret != NULL) {
ret->rrtype = new RRType(RRType::NS());
@@ -507,8 +524,8 @@
return (PyObject*) ret;
}
-static PyObject* RRType_CNAME(s_RRType *self UNUSED_PARAM)
-{
+static PyObject*
+RRType_CNAME(s_RRType *self UNUSED_PARAM) {
s_RRType* ret = PyObject_New(s_RRType, &rrtype_type);
if (ret != NULL) {
ret->rrtype = new RRType(RRType::CNAME());
@@ -520,8 +537,8 @@
return (PyObject*) ret;
}
-static PyObject* RRType_SOA(s_RRType *self UNUSED_PARAM)
-{
+static PyObject*
+RRType_SOA(s_RRType *self UNUSED_PARAM) {
s_RRType* ret = PyObject_New(s_RRType, &rrtype_type);
if (ret != NULL) {
ret->rrtype = new RRType(RRType::SOA());
@@ -533,8 +550,8 @@
return (PyObject*) ret;
}
-static PyObject* RRType_NSEC3(s_RRType *self UNUSED_PARAM)
-{
+static PyObject*
+RRType_NSEC3(s_RRType *self UNUSED_PARAM) {
s_RRType* ret = PyObject_New(s_RRType, &rrtype_type);
if (ret != NULL) {
ret->rrtype = new RRType(RRType::NSEC3());
@@ -546,8 +563,8 @@
return (PyObject*) ret;
}
-static PyObject* RRType_IXFR(s_RRType *self UNUSED_PARAM)
-{
+static PyObject*
+RRType_IXFR(s_RRType *self UNUSED_PARAM) {
s_RRType* ret = PyObject_New(s_RRType, &rrtype_type);
if (ret != NULL) {
ret->rrtype = new RRType(RRType::IXFR());
@@ -559,8 +576,8 @@
return (PyObject*) ret;
}
-static PyObject* RRType_AXFR(s_RRType *self UNUSED_PARAM)
-{
+static PyObject*
+RRType_AXFR(s_RRType *self UNUSED_PARAM) {
s_RRType* ret = PyObject_New(s_RRType, &rrtype_type);
if (ret != NULL) {
ret->rrtype = new RRType(RRType::AXFR());
@@ -572,8 +589,8 @@
return (PyObject*) ret;
}
-static PyObject* RRType_ANY(s_RRType *self UNUSED_PARAM)
-{
+static PyObject*
+RRType_ANY(s_RRType *self UNUSED_PARAM) {
s_RRType* ret = PyObject_New(s_RRType, &rrtype_type);
if (ret != NULL) {
ret->rrtype = new RRType(RRType::ANY());
@@ -591,8 +608,7 @@
// Module Initialization, all statics are initialized here
bool
-initModulePart_RRType(PyObject* mod)
-{
+initModulePart_RRType(PyObject* mod) {
// Add the exceptions to the module
po_InvalidRRType = PyErr_NewException("libdns_python.InvalidRRType", NULL, NULL);
PyModule_AddObject(mod, "InvalidRRType", po_InvalidRRType);
More information about the bind10-changes
mailing list