Mukund Sivaraman b8e8e7ed5f [2390] Update std::string NS constructor to use the MasterLexer 12 years ago
..
tests b8e8e7ed5f [2390] Update std::string NS constructor to use the MasterLexer 12 years ago
Makefile.am fb10ec4e31 [2437] Add missing EXTRA_DIST 12 years ago
README ade3b2f49f rename libdns_python to pydnspp 14 years ago
TODO 8f3efd37e9 check types in all richcmp functions 15 years ago
edns_python.cc 718888317b [2278] A number of cppcheck fixes 12 years ago
edns_python.h 059a2a1751 [2357] Update scaffolding using fix-scaffolding.py tool 12 years ago
message_python.cc ace794f6a5 [2165] Make Message::addRRset() to be unaware of signedness 12 years ago
message_python.h 059a2a1751 [2357] Update scaffolding using fix-scaffolding.py tool 12 years ago
message_python_inc.cc f3e8996dc5 [1512] added python wrapper for Message::clearSection(). 13 years ago
messagerenderer_python.cc fb9060e5dc [1697] 1st update: make MessageRenderer constructors parameter-free. 13 years ago
messagerenderer_python.h 059a2a1751 [2357] Update scaffolding using fix-scaffolding.py tool 12 years ago
name_python.cc 412e1fc061 [trac2116/master] don't set pyerr string in Name.split() on success. 12 years ago
name_python.h 059a2a1751 [2357] Update scaffolding using fix-scaffolding.py tool 12 years ago
nsec3hash_python.cc dc8a5a5b10 [1574b] added another version of NSEC3Hash::match, which takes NSEC3PARAM 13 years ago
nsec3hash_python.h 059a2a1751 [2357] Update scaffolding using fix-scaffolding.py tool 12 years ago
nsec3hash_python_inc.cc dc8a5a5b10 [1574b] added another version of NSEC3Hash::match, which takes NSEC3PARAM 13 years ago
opcode_python.cc 3eb0dedb8a [1245] add NULL checks in PyXXX_ToXXX() functions 13 years ago
opcode_python.h 059a2a1751 [2357] Update scaffolding using fix-scaffolding.py tool 12 years ago
pydnspp.cc f1e9ef1f49 [2437] supported python wrapper of checkZone(). 12 years ago
pydnspp_common.cc 5a34019b3d [2379] catch errors when using PyObjectContainer 12 years ago
pydnspp_common.h a8b060aa95 [2379] add standard function for class initialization 12 years ago
pydnspp_towire.h 059a2a1751 [2357] Update scaffolding using fix-scaffolding.py tool 12 years ago
question_python.cc 3eb0dedb8a [1245] add NULL checks in PyXXX_ToXXX() functions 13 years ago
question_python.h 059a2a1751 [2357] Update scaffolding using fix-scaffolding.py tool 12 years ago
rcode_python.cc 3eb0dedb8a [1245] add NULL checks in PyXXX_ToXXX() functions 13 years ago
rcode_python.h 059a2a1751 [2357] Update scaffolding using fix-scaffolding.py tool 12 years ago
rdata_python.cc 1e0e7c3c3a [1457] initial update handling 13 years ago
rdata_python.h 059a2a1751 [2357] Update scaffolding using fix-scaffolding.py tool 12 years ago
rrclass_python.cc abf5722f11 [1883] make sure the conversion to Py_hash_t by tp_hash is safe and avoids -1. 13 years ago
rrclass_python.h 059a2a1751 [2357] Update scaffolding using fix-scaffolding.py tool 12 years ago
rrset_collection_python.cc ce19e77d9f [2438] clarify the relationship of Python/C++ classes of RRsetCollection. 12 years ago
rrset_collection_python.h ce19e77d9f [2438] clarify the relationship of Python/C++ classes of RRsetCollection. 12 years ago
rrset_collection_python_inc.cc 717d619224 Merge branch 'master' into trac2435_2 12 years ago
rrset_python.cc 6afe3a0422 [1604b] Make (Const)RRsetPtr point to an AbstractRRset 13 years ago
rrset_python.h 059a2a1751 [2357] Update scaffolding using fix-scaffolding.py tool 12 years ago
rrttl_python.cc 3eb0dedb8a [1245] add NULL checks in PyXXX_ToXXX() functions 13 years ago
rrttl_python.h 059a2a1751 [2357] Update scaffolding using fix-scaffolding.py tool 12 years ago
rrtype_python.cc abf5722f11 [1883] make sure the conversion to Py_hash_t by tp_hash is safe and avoids -1. 13 years ago
rrtype_python.h 059a2a1751 [2357] Update scaffolding using fix-scaffolding.py tool 12 years ago
serial_python.cc ccdbcf02d9 [master] Remove redundant NULL checks in PySerial 12 years ago
serial_python.h 059a2a1751 [2357] Update scaffolding using fix-scaffolding.py tool 12 years ago
tsig_python.cc f1f86f3538 [1357] a few editorial fixes 12 years ago
tsig_python.h 059a2a1751 [2357] Update scaffolding using fix-scaffolding.py tool 12 years ago
tsig_rdata_python.cc 3eb0dedb8a [1245] add NULL checks in PyXXX_ToXXX() functions 13 years ago
tsig_rdata_python.h 059a2a1751 [2357] Update scaffolding using fix-scaffolding.py tool 12 years ago
tsigerror_python.cc 45ef63790b [1245] move initModulePart calls to pydnspp.cc 13 years ago
tsigerror_python.h 059a2a1751 [2357] Update scaffolding using fix-scaffolding.py tool 12 years ago
tsigerror_python_inc.cc a1a58a7382 [trac905] added more detailed documentation text, which was half automated 14 years ago
tsigkey_python.cc 0cf505f04b [1351] Use TSIGKeyRing class in xfrin 12 years ago
tsigkey_python.h 059a2a1751 [2357] Update scaffolding using fix-scaffolding.py tool 12 years ago
tsigrecord_python.cc 3eb0dedb8a [1245] add NULL checks in PyXXX_ToXXX() functions 13 years ago
tsigrecord_python.h 059a2a1751 [2357] Update scaffolding using fix-scaffolding.py tool 12 years ago
zone_checker_python.cc 27369e24c8 [master] place internal exception class in a separate namespace. 12 years ago
zone_checker_python.h f1e9ef1f49 [2437] supported python wrapper of checkZone(). 12 years ago
zone_checker_python_inc.cc f1e9ef1f49 [2437] supported python wrapper of checkZone(). 12 years ago

README


This is an implementation of the python wrappers for isc::dns.

When compiled the module is called pydnspp. If we
decide to always need it we can add a default import under
lib/python/isc.

To use it from the source tree, you must add src/lib/dns/python/.libs
to your PYTHONPATH environment variable. Within python you can then use
> import pydnspp
> rrc = pydnspp.RRClass("IN")
etc.

Notes:

this implementation is not a complete 1-to-1 mapping of the C++ API;
some of the functionality is not needed the way we use it in Python.

For instance, we did not implement the buffer classes;
everywhere in the API where buffers are used, you can pass a bytearray
object.

We also (currently) left out some 'lowlevel' wrappers, for instance for
specific Rdata types.

If you have specific functionality you do need, please ask for it and we
will add it.

The 'main' module is defined in pydnspp.cc.
There is a pydnspp_common.[cc|h] for helper functions.

Implementation notes:

Writing wrappers for a lot of classes is mostly a case of repetition.
There are a lot of things one must do, and that is why nearly everyone
immediately and continually has the urge to make generators for this.

We have added a little more documentation than is strictly necessary to
rrclass.h, for reference to new readers.

To keep it maintainable as the original API changes, we use two
techniques;

1. Full unittests. Or at least as full as possible. These unit tests
test the *wrapper* code, not necessarily the underlying c++ code,
which has its own unit tests. There is of course some overlap.
2. Structure. I have tried to structure the wrapper files as much as
possible, see below.

Structure:

Since we are moving a lot of wrappers into one module, the specific
classes are split over several files, each one having the name of the
original header file they are wrapping (e.g. the wrapper for name.h
becomes name_python.cc).

At the top we first declare any exceptions, constants, and enums. These
are all called po_ (the actual python name will be set once
they are added to the module in the module inialization function).

Each class needs a struct that contains a pointer to an instance of the
object (and any helper data). We call these structs s_.

Then we declare (but not define!) all methods we will export to
python. These are named _.

We will also need an _init and _destroy function for all of these.

After the function declarations we define the method array; this
contains the name of the methods as they appear in python, the wrapping
function here, and documentation strings.

Next is the type description; this is used for the wrapper code to
convert native classes from and to python objects, and defines
type-specific pointers (for instance to the method table mentioned above,
but also to a __str__ function should one be defined, how the object
should behave when it is used as a Sequence, etc.). For most classes,
almost all values here shall be NULL.
This has the name _type.

After that we define the exported functions we defined earlier. In some
cases these need the type we just defined, and the type needed the
function names, so for consistency, all functions are defined after,
but declared before the type.

This is repeated for every class we export.

Finally we define the function to add the class, constants, exceptions,
and enums to the module. This function is called from the init function
in pydnspp.cc, has the name
initModulePart_, returns a boolean
(true on success, false on failure), and takes the module as a
PyObject*. There is a convenience function called addClassVariable to
add constants and enums to classes.