binding for libpcap

Gregory Wright gwright at
Wed Jun 30 17:54:33 EDT 2004


Attached is a binding for libpcap, the packet capture library.

I'm looking for comments on how it might be improved, or any
particular infelicities that you notice. As I don't use hugs regularly
anymore, perhaps someone can point me to a good example
of a network library binding that works on both ghc and hugs.

It' s tested on FreeBSD (5.2.1-current) but should work with
any *nix that can build libpcap. It does not work with Winpcap, a 
library for windows, although it shouldn't be too hard to extend
it to do so.

The marshalling of packet data is purposely very lightweight
(data is returned as Ptr Word8). Having written a lot
of embedded software for network test equipment, I prefer the
flexibility of being able to marshal into IO-mutable arrays if
necessary. But I don't want to impose that on someone who
would be satisfied by [Word8].

Best Wishes,

Gregory Wright
Antiope Associate LLC
gwright at

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Pcap.hsc
Type: application/octet-stream
Size: 31498 bytes
Desc: not available
Url :

More information about the Libraries mailing list