1
// This file may be redistributed and modified only under the terms of
2
// the GNU Lesser General Public License (See COPYING for details).
3
// Copyright (C) 2000-2001 Michael Day, Dmitry Derevyanko, Stefanus Du Toit
5
#ifndef ATLAS_NET_STREAM_H
6
#define ATLAS_NET_STREAM_H
12
#include <Atlas/Negotiate.h>
20
/** Negotiation of codecs for an Atlas connection
22
non blocking negotiation of Codecs
23
requires a list of avalable Codecs,
24
along with the name of sender and a Socket
30
class NegotiateHelper {
34
NegotiateHelper(std::list<std::string> *names);
36
bool get(std::string &buf, const std::string & header);
37
void put(std::string &buf, const std::string & header);
41
std::list<std::string> *names;
45
class StreamConnect : public Atlas::Negotiate<std::iostream>
49
StreamConnect(const std::string& name, std::iostream&, Atlas::Bridge*);
51
virtual ~StreamConnect() {}
53
virtual void poll(bool can_read = true);
55
virtual State getState();
56
virtual Atlas::Codec<std::iostream>* getCodec();
73
std::iostream& socket;
74
Atlas::Bridge* bridge;
75
std::list<std::string> inCodecs;
77
NegotiateHelper codecHelper;
80
void processServerCodecs();
86
class StreamAccept : public Atlas::Negotiate<std::iostream>
90
StreamAccept(const std::string& name, std::iostream&, Atlas::Bridge*);
92
virtual ~StreamAccept() {}
94
virtual void poll(bool can_read = true);
96
virtual State getState();
97
virtual Atlas::Codec<std::iostream>* getCodec();
114
std::iostream& socket;
115
Atlas::Bridge* bridge;
116
std::list<std::string> inCodecs;
118
NegotiateHelper codecHelper;
121
void processClientCodecs();