[Haskell] Piffle, a Packet Filter Language

Jaap Weel weel at ugcs.caltech.edu
Fri May 25 11:47:35 EDT 2007


I have written a compiler for a packet filter language in Haskell. I
think this is a good example of how Haskell can be used in an
application domain (low level computer networking) where people tend
to use C for everything, including writing compilers. The language
itself is not very fancy, from a Haskell programmer's point of view,
but maybe you will still find this worth having at least a glance at.

This is a very early release. Expect it to blow up in your face, or,
more likely, fail to compile. Please report bugs. Thanks.

   /jaap


---------------------------------------------------------------------------

                   PIFFLE, A PACKET FILTER LANGUAGE

                   http://code.google.com/p/piffle

What is Piffle?

   * "Piffle" is a pronounceable form of PFL, that is, Packet Filter
     Language. ("Piffle" is also an obscure word for "chatter".)

   * Piffle is a programming language for writing network packet
     filters.

   * The Piffle compiler accepts resource limits on the processor time
     and memory used for processing each packet of input; simply pass
     the -C or -M option, and it will check at compile time that your
     program cannot not exceed the limits you specify.

   * Piffle is easy to learn, because it is built around the familiar
     abstractions of procedural languages such as C and Pascal.

   * Piffle programs can be compiled with interchangeable back-ends
     called "boilerplates". The pcap boilerplate, which comes with the
     Piffle compiler, allows Piffle programs to read and write
     pcap/tcpdump dump files, to read packets from network devices,
     and to preprocess packets with Berkeley Packet Filters. You can
     write your own boilerplates to talk to other network monitoring
     interfaces, such as tun/tap.

   * Piffle runs on GNU/Linux systems, and is designed to be portable
     to other POSIX-compliant systems that run the GNU C Compiler gcc
     and the Glasgow Haskell Compiler ghc.

   * Hopefully, Piffle will in the future become available as an
     operation in Streamline, an advanced network monitoring
     framework, formerly known as FFPF, the fairly fast packet
     filter. Streamline is being developed at the VU Amsterdam
     Computer Systems Section. Within Streamline, Piffle will coexist
     with Ruler, a regular-expression based packet rewriting language.

The author

 Piffle was designed and implemented by Jaap Weel as part of the
 Compiler Construction Practical course at the VU Amsterdam CS
 department.

Read the code

 Feel free to have a look at the source and do with it as you please
 (within the bounds of the GPL, of course).

Download the code

 For the most recent tarball release, which may still be broken, check
 the downloads page.

 For the latest (and even more possibly broken) version of Piffle, you
 will have to use subversion.

Read the documentation

 Be sure to have a look at the latest published version of the manual.

Contribute

 I would very much appreciate if people could try to compile and run
 Piffle (in particular make test) on their own machines, and report
 any problems on the issues page or by e-mail.

Get in touch with the author

 You can contact the author at weel at ugcs dot caltech dot edu , or
 visit his web site at http://www.ugcs.caltech.edu/~weel.








More information about the Haskell mailing list