Boost logo

Boost :

From: Larry Evans (cppljevans_at_[hidden])
Date: 2004-08-31 21:18:24


On 08/31/2004 08:43 PM, Carlo Wood wrote:
> On Tue, Aug 31, 2004 at 06:41:36PM -0500, Larry Evans wrote:
>
>>I haven't thought deeply about this, but could this message idea and
>>stack of streambuf's be used to implement a part of the upper layers
>>of the OSI model:
>>
>>http://www.geocities.com/SiliconValley/Monitor/3131/ne/osimodel.html
>
>
> Well, the idea coming from my work on libcw ... one description of
> libcw is "An Object Oriented C++ library for networking applications",
> so yes - the whole idea has always been to be a general though efficient
> method to deal with networking protocols (the top layer of OSI).
>
>
>>? For example, each layer would correspond to an element in the stack
>>of streambufs, and each streambuf could have a state associated with it.
>>For example, the state could be a complex fsm, as with TCP:
>
>
> You lost me here. stack elements of streambufs are not related to
> OSI layers (which even include the hardware?! A horse != cow).

Well, I figured it could be used in the lower layers (the hardware)
for that reason, but I figured it might be usable in the higher layers.

> Also, I talked about 'messages' (chunks of data) and not about stacked
> streambufs; mulitple streambufs means copying of data and I am trying

Well, streambufs deal with characters, either wide or regular, depending
on a template parameter, I guess. Why couldn't the template parameter
indicate a message (a chunk of data) instead of a single character.
If you look at:

http://cvs.sourceforge.net/viewcvs.py/boost-sandbox/boost-sandbox/boost/io/filters/

again, you'll see the template parameter is called "Fluid" :) . So I
was thinking that maybe, in the case of characters, the fluid would be
char or wchar, but in your case, the fluid would be messages.

> to talk Jonathan out of that :p. Finally, a TCP statemachine is an
> ISO layer lower - and a statemachine that would decode a specific
> protocol would be a layer higher then my 'Message' objects.

OK. Maybe I'm thinking more in the line of a parser which gather's
lower level data, chars, into higher level structures (AST nodes),
and comparing that to network layers which gather lower level data
(TCP/IP) and transform (filter it) into higher level data (whatever
the application layer uses), and also does the reverse. In other words,
somewhat like Jonathan's dual-use streambufs. I realize this is way
beyond what Jonathan had in mind, but I just couldn't help speculating.

>>indicate the width of the current margin. An example of a streambuf
>>with such a simple state is:
>>
>>http://cvs.sourceforge.net/viewcvs.py/boost-sandbox/boost-sandbox/boost/io/filters/ofilter_leftmargin_adjustable.hpp?view=markup
>
>
> There is no streambuf on that page.
>
Sorry. See:

http://cvs.sourceforge.net/viewcvs.py/boost-sandbox/boost-sandbox/boost/io/filters/marg_ostream.hpp?view=markup

for how that class in combination with opipeline_from_streambuf is used
to create a filtered stream. I can't remember exactly where the
streambuf is created, but I believe it doesn't use any buffers
other than that already in the sink.


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