Boost logo

Boost :

From: Eugene Alterman (eugalt_at_[hidden])
Date: 2005-12-11 20:55:58


At last!
A networking library in the true spirit of Boost.

I have a few thoughts regarding the design that is basically a follow-up to
the discussion started in the asio-users mailing list:
http://sourceforge.net/mailarchive/forum.php?thread_id=9196138&forum_id=42787

The library documents a Stream conecpt that represent a read/write stream
interface over a connection. In addition to this interface classes that
implement Stream contain methods for supporting establishment and management
of the stream's underlying infrastructure - active and passive connection
establishment, accessing socket options, handshakimg etc.
I suggest to decouple this functionality from the Stream into a separate
concept/interface for all the activities leading to the establishment of a
stream as well as accessing connection properties. This IMO would lead to a
more flexible and cleaner design.

Streams could be layered (eg. SSL/TLS over TCP), and stream layering should
be strictly enforced. Once the top level stream has been established there
should be no access to lower level streams. When you have an established
secure connection you don't want to allow direct read/write on the
underlying TCP socket.

Take a look at the Stream doc and notice the lowest_layer() public member
function that exposes a lower layer stream. Interestinlgly, this method is
not related to the documented stream functionality. It is used for
connection establishemnt and accessing connection properties.

The bottom line of my suggestion is to have 2 distinct interfaces. One is
for stream establishment and connection properties management. It provides
efficient protocol stack layer navigation and access (but no stream i/o
operations). The other one is strictly layered streaming interface for data
transfer.

Do you think it makes sense?

Thank you,
Eugene


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk