Boost logo

Boost :

From: Paul Vanlint (boost_at_[hidden])
Date: 2003-06-19 04:22:04

A couple of years ago I wrote a library module which provides a reasonably
efficient way of handling with disjointed buffers and treating them as a
single contiguous block for extracting data.

It was primarily intended to reconstruct TCP packets.

For instance one machine creates a buffer with any combination of strings
integers and length prepended byte blocks and sends it across the network.

The other machine may receive 5 packets and the likelihood is that the the
objects in the message stream will straddle packet boundaries.

The inefficient way of handling this is to copy the 5 packets into one
contiguous block. However, for large data streams this becomes impractical.
Alternatively, a fixed size block can be preallocated and used to store the
packets as they come in to build up the whole message. However, that then
places a limit on the size of data being imported.

My class will hold a buffer structure which may be disjointed and then
provides member functions allowing data to be written to and read from it.

The library demonstrates reference counting, stl containers and overloading
of operator<< and const member functions among other things.

I haven't looked at the code for a little while, so there may well be some
tidying up needed.

I wrote it initially for the company I worked for, but the owner of the code
is happy for me to include this code here.

Is this the kind of thing that people would be interested in including in
the boost library?


Paul Vanlint.

Boost list run by bdawes at, gregod at, cpdaniel at, john at