[ldns-users] Python rdf.data()

Karel Slany karel.slany at nic.cz
Thu Aug 22 12:31:17 UTC 2013


Greetings,

Python's ldns_rdf.data() creates a thin wrapper around the ldns C
function ldns_rdf_data(). Function ldns_rdf_data() returns a pointer to
an internal data field of the manipulated rdf.

Actually, I don't know the actual reason why you are trying to access
this low level structures. Manipulating them from Python can be tricky
as you can easily end up with corrupted memory.

In order to meet your desire I can add a new method ldns_rdf.data_str()
which would return a Python string containing copy of the rdf data
field. However, in Python3 this would be error-prone, because Python3
uses unicode strings. At the moment I cannot guess, whether the approach
would be reliabe in Python3.

Please give more information about the reason why you want to use
ldns_rdf.data(). Perhaps we could think of a more convenient solution.

K.

Am 22.08.2013 10:56, schrieb Willem Toorop:
> Hi Jack,
> 
> I suspect raw access is not supported by pyldns.
> Karel, could shed some light on this?
> 
> -- Willem
> 
> Op 22-08-13 01:13, Jack Bates schreef:
>> I am working with the Python wrapper for ldns.
>>
>> rdf.data() returns something like
>> <Swig Object of type 'uint8_t *' at 0xb742f938>
>>
>> and rdf.size() returns the number of bytes. How do I read the bytes?
>>
>> Thanks!
>> _______________________________________________
>> ldns-users mailing list
>> ldns-users at open.nlnetlabs.nl
>> http://open.nlnetlabs.nl/mailman/listinfo/ldns-users
> 
> _______________________________________________
> ldns-users mailing list
> ldns-users at open.nlnetlabs.nl
> http://open.nlnetlabs.nl/mailman/listinfo/ldns-users
> 




More information about the ldns-users mailing list