[Haskell-cafe] Interpreting fields in a buffer

Glynn Clements glynn.clements at virgin.net
Mon Jan 26 13:12:22 EST 2004

Alastair Reid wrote:

> 2) Write access functions in Haskell using functions from the Storable
>    class and associated libraries.

In this case, using Storable probably isn't worth the trouble, given

1. The 16- and 32-bit fields are in network byte order, whereas
Storable assumes host byte order.

2. If you want to read certain IP options (e.g. record route), you
need to read unaligned words.

It would be simpler to just read bytes, and piece them together

Glynn Clements <glynn.clements at virgin.net>

More information about the Haskell-Cafe mailing list