Wireshark-dev: Re: [Wireshark-dev] Python wrappers for pcapio.[ch]

From: Shehjar Tikoo <shehjart@xxxxxxxxxxxxxxx>
Date: Wed, 11 Jul 2007 22:24:25 +1000
Guy Harris wrote:
On Jul 10, 2007, at 6:08 PM, Shehjar Tikoo wrote:

Does anyone know of Python bindings for the pcapio.[ch] code in
Wireshark source root?

I am looking for Python wrappers for writing pcap files and I havent
been able to find a library that does it or does it cleanly.

Shehjar
PS: I ask because I intend to use pcapio.c to create a wrapper.
..
..

pylibpcap and pcapy both appear to support writing pcap files, so presumably, if you haven't been able to find a library that does that or does it cleanly, neither of them do it cleanly. What's unclean about how they do it?

Neither of them seem to provide a way to write the pcap_pkthdr's for
individual packets.
To me, it looks like pylibpcap depends on libpcap's internal routing
of packets from the capture source to the dump file. That wont work
for me because I am constructing the packets in-memory.

With pcapy, I dont think it exports/wraps/exposes the struct
pcap_pkthdr which is required by its dump method.


Shehjar