Commit b8422db8 authored by JINMEI Tatuya's avatar JINMEI Tatuya
Browse files

[trac871] Revert "[trac871] unrelated cleanup: use unnamed namespace instead of file-scope static."

This was committed to the wrong branch.

This reverts commit cce60bef.
parent da16cc77
......@@ -17,16 +17,15 @@
using namespace isc::dns;
using namespace isc::util;
namespace {
//
// Declaration of the custom exceptions
// Initialization and addition of these go in the initModulePart
// function at the end of this file
//
PyObject* po_MessageTooShort;
PyObject* po_InvalidMessageSection;
PyObject* po_InvalidMessageOperation;
PyObject* po_InvalidMessageUDPSize;
static PyObject* po_MessageTooShort;
static PyObject* po_InvalidMessageSection;
static PyObject* po_InvalidMessageOperation;
static PyObject* po_InvalidMessageUDPSize;
//
// Definition of the classes
......@@ -36,6 +35,10 @@ PyObject* po_InvalidMessageUDPSize;
// and static wrappers around the methods we export), a list of methods,
// and a type description
//
// Section
//
//
// Message
//
......@@ -52,36 +55,36 @@ public:
//
// General creation and destruction
int Message_init(s_Message* self, PyObject* args);
void Message_destroy(s_Message* self);
PyObject* Message_getHeaderFlag(s_Message* self, PyObject* args);
PyObject* Message_setHeaderFlag(s_Message* self, PyObject* args);
PyObject* Message_getQid(s_Message* self);
PyObject* Message_setQid(s_Message* self, PyObject* args);
PyObject* Message_getRcode(s_Message* self);
PyObject* Message_setRcode(s_Message* self, PyObject* args);
PyObject* Message_getOpcode(s_Message* self);
PyObject* Message_setOpcode(s_Message* self, PyObject* args);
PyObject* Message_getEDNS(s_Message* self);
PyObject* Message_setEDNS(s_Message* self, PyObject* args);
PyObject* Message_getRRCount(s_Message* self, PyObject* args);
static int Message_init(s_Message* self, PyObject* args);
static void Message_destroy(s_Message* self);
static PyObject* Message_getHeaderFlag(s_Message* self, PyObject* args);
static PyObject* Message_setHeaderFlag(s_Message* self, PyObject* args);
static PyObject* Message_getQid(s_Message* self);
static PyObject* Message_setQid(s_Message* self, PyObject* args);
static PyObject* Message_getRcode(s_Message* self);
static PyObject* Message_setRcode(s_Message* self, PyObject* args);
static PyObject* Message_getOpcode(s_Message* self);
static PyObject* Message_setOpcode(s_Message* self, PyObject* args);
static PyObject* Message_getEDNS(s_Message* self);
static PyObject* Message_setEDNS(s_Message* self, PyObject* args);
static PyObject* Message_getRRCount(s_Message* self, PyObject* args);
// use direct iterators for these? (or simply lists for now?)
PyObject* Message_getQuestion(s_Message* self);
PyObject* Message_getSection(s_Message* self, PyObject* args);
static PyObject* Message_getQuestion(s_Message* self);
static PyObject* Message_getSection(s_Message* self, PyObject* args);
//static PyObject* Message_beginQuestion(s_Message* self, PyObject* args);
//static PyObject* Message_endQuestion(s_Message* self, PyObject* args);
//static PyObject* Message_beginSection(s_Message* self, PyObject* args);
//static PyObject* Message_endSection(s_Message* self, PyObject* args);
PyObject* Message_addQuestion(s_Message* self, PyObject* args);
PyObject* Message_addRRset(s_Message* self, PyObject* args);
PyObject* Message_clear(s_Message* self, PyObject* args);
PyObject* Message_makeResponse(s_Message* self);
PyObject* Message_toText(s_Message* self);
PyObject* Message_str(PyObject* self);
PyObject* Message_toWire(s_Message* self, PyObject* args);
PyObject* Message_fromWire(s_Message* self, PyObject* args);
static PyObject* Message_addQuestion(s_Message* self, PyObject* args);
static PyObject* Message_addRRset(s_Message* self, PyObject* args);
static PyObject* Message_clear(s_Message* self, PyObject* args);
static PyObject* Message_makeResponse(s_Message* self);
static PyObject* Message_toText(s_Message* self);
static PyObject* Message_str(PyObject* self);
static PyObject* Message_toWire(s_Message* self, PyObject* args);
static PyObject* Message_fromWire(s_Message* self, PyObject* args);
// This list contains the actual set of functions we have in
// python. Each entry has
......@@ -89,7 +92,7 @@ PyObject* Message_fromWire(s_Message* self, PyObject* args);
// 2. Our static function here
// 3. Argument type
// 4. Documentation
PyMethodDef Message_methods[] = {
static PyMethodDef Message_methods[] = {
{ "get_header_flag", reinterpret_cast<PyCFunction>(Message_getHeaderFlag),
METH_VARARGS,
"Return whether the specified header flag bit is set in the "
......@@ -172,7 +175,7 @@ PyMethodDef Message_methods[] = {
// This defines the complete type for reflection in python and
// parsing of PyObject* to s_Message
// Most of the functions are not actually implemented and NULL here.
PyTypeObject message_type = {
static PyTypeObject message_type = {
PyVarObject_HEAD_INIT(NULL, 0)
"pydnspp.Message",
sizeof(s_Message), // tp_basicsize
......@@ -222,7 +225,7 @@ PyTypeObject message_type = {
0 // tp_version_tag
};
int
static int
Message_init(s_Message* self, PyObject* args) {
int i;
......@@ -245,14 +248,14 @@ Message_init(s_Message* self, PyObject* args) {
return (-1);
}
void
static void
Message_destroy(s_Message* self) {
delete self->message;
self->message = NULL;
Py_TYPE(self)->tp_free(self);
}
PyObject*
static PyObject*
Message_getHeaderFlag(s_Message* self, PyObject* args) {
unsigned int messageflag;
if (!PyArg_ParseTuple(args, "I", &messageflag)) {
......@@ -270,7 +273,7 @@ Message_getHeaderFlag(s_Message* self, PyObject* args) {
}
}
PyObject*
static PyObject*
Message_setHeaderFlag(s_Message* self, PyObject* args) {
long messageflag;
PyObject *on = Py_True;
......@@ -301,12 +304,12 @@ Message_setHeaderFlag(s_Message* self, PyObject* args) {
}
}
PyObject*
static PyObject*
Message_getQid(s_Message* self) {
return (Py_BuildValue("I", self->message->getQid()));
}
PyObject*
static PyObject*
Message_setQid(s_Message* self, PyObject* args) {
long id;
if (!PyArg_ParseTuple(args, "l", &id)) {
......@@ -330,7 +333,7 @@ Message_setQid(s_Message* self, PyObject* args) {
}
}
PyObject*
static PyObject*
Message_getRcode(s_Message* self) {
s_Rcode* rcode;
......@@ -353,7 +356,7 @@ Message_getRcode(s_Message* self) {
return (rcode);
}
PyObject*
static PyObject*
Message_setRcode(s_Message* self, PyObject* args) {
s_Rcode* rcode;
if (!PyArg_ParseTuple(args, "O!", &rcode_type, &rcode)) {
......@@ -368,7 +371,7 @@ Message_setRcode(s_Message* self, PyObject* args) {
}
}
PyObject*
static PyObject*
Message_getOpcode(s_Message* self) {
s_Opcode* opcode;
......@@ -391,7 +394,7 @@ Message_getOpcode(s_Message* self) {
return (opcode);
}
PyObject*
static PyObject*
Message_setOpcode(s_Message* self, PyObject* args) {
s_Opcode* opcode;
if (!PyArg_ParseTuple(args, "O!", &opcode_type, &opcode)) {
......@@ -406,7 +409,7 @@ Message_setOpcode(s_Message* self, PyObject* args) {
}
}
PyObject*
static PyObject*
Message_getEDNS(s_Message* self) {
s_EDNS* edns;
EDNS* edns_body;
......@@ -426,7 +429,7 @@ Message_getEDNS(s_Message* self) {
return (edns);
}
PyObject*
static PyObject*
Message_setEDNS(s_Message* self, PyObject* args) {
s_EDNS* edns;
if (!PyArg_ParseTuple(args, "O!", &edns_type, &edns)) {
......@@ -441,7 +444,7 @@ Message_setEDNS(s_Message* self, PyObject* args) {
}
}
PyObject*
static PyObject*
Message_getRRCount(s_Message* self, PyObject* args) {
unsigned int section;
if (!PyArg_ParseTuple(args, "I", &section)) {
......@@ -460,7 +463,7 @@ Message_getRRCount(s_Message* self, PyObject* args) {
}
// TODO use direct iterators for these? (or simply lists for now?)
PyObject*
static PyObject*
Message_getQuestion(s_Message* self) {
QuestionIterator qi, qi_end;
try {
......@@ -499,7 +502,7 @@ Message_getQuestion(s_Message* self) {
return (list);
}
PyObject*
static PyObject*
Message_getSection(s_Message* self, PyObject* args) {
unsigned int section;
if (!PyArg_ParseTuple(args, "I", &section)) {
......@@ -556,7 +559,7 @@ Message_getSection(s_Message* self, PyObject* args) {
//static PyObject* Message_beginSection(s_Message* self, PyObject* args);
//static PyObject* Message_endSection(s_Message* self, PyObject* args);
//static PyObject* Message_addQuestion(s_Message* self, PyObject* args);
PyObject*
static PyObject*
Message_addQuestion(s_Message* self, PyObject* args) {
s_Question *question;
......@@ -569,7 +572,7 @@ Message_addQuestion(s_Message* self, PyObject* args) {
Py_RETURN_NONE;
}
PyObject*
static PyObject*
Message_addRRset(s_Message* self, PyObject* args) {
PyObject *sign = Py_False;
int section;
......@@ -596,7 +599,7 @@ Message_addRRset(s_Message* self, PyObject* args) {
}
}
PyObject*
static PyObject*
Message_clear(s_Message* self, PyObject* args) {
int i;
if (PyArg_ParseTuple(args, "i", &i)) {
......@@ -617,13 +620,13 @@ Message_clear(s_Message* self, PyObject* args) {
}
}
PyObject*
static PyObject*
Message_makeResponse(s_Message* self) {
self->message->makeResponse();
Py_RETURN_NONE;
}
PyObject*
static PyObject*
Message_toText(s_Message* self) {
// Py_BuildValue makes python objects from native data
try {
......@@ -638,7 +641,7 @@ Message_toText(s_Message* self) {
}
}
PyObject*
static PyObject*
Message_str(PyObject* self) {
// Simply call the to_text method we already defined
return (PyObject_CallMethod(self,
......@@ -646,7 +649,7 @@ Message_str(PyObject* self) {
const_cast<char*>("")));
}
PyObject*
static PyObject*
Message_toWire(s_Message* self, PyObject* args) {
s_MessageRenderer* mr;
......@@ -668,7 +671,7 @@ Message_toWire(s_Message* self, PyObject* args) {
return (NULL);
}
PyObject*
static PyObject*
Message_fromWire(s_Message* self, PyObject* args) {
const char* b;
Py_ssize_t len;
......@@ -762,4 +765,3 @@ initModulePart_Message(PyObject* mod) {
return (true);
}
} // end of unnamed namespace
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment