Atlas-C++
Stream.h
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
4 
5 // $Id$
6 
7 #ifndef ATLAS_NET_STREAM_H
8 #define ATLAS_NET_STREAM_H
9 
10 #include <Atlas/Negotiate.h>
11 
12 #include <iosfwd>
13 #include <string>
14 #include <list>
15 
16 namespace Atlas {
17 
18 class Bridge;
19 
23 namespace Net {
24 
37 
38  public:
39 
40  NegotiateHelper(std::list<std::string> & names);
41 
42  bool get(std::string &buf, const std::string & header);
43  void put(std::string &buf, const std::string & header);
44 
45  private:
46 
47  std::list<std::string> & m_names;
48 
49  };
50 
59 {
60  public:
61 
62  StreamConnect(const std::string& name, std::iostream&);
63 
64  virtual ~StreamConnect();
65 
66  virtual void poll(bool can_read = true);
67 
68  virtual State getState();
69  virtual Atlas::Codec * getCodec(Atlas::Bridge&);
70 
71  private:
72 
73  enum
74  {
75  SERVER_GREETING,
76  CLIENT_GREETING,
77  CLIENT_CODECS,
78  SERVER_CODECS,
79  // CLIENT_FILTERS,
80  // SERVER_FILTERS,
81  DONE
82  };
83 
84  int m_state;
85 
86  std::string m_outName;
87  std::string m_inName;
88  std::iostream& m_socket;
89  std::list<std::string> m_inCodecs;
90  std::list<std::string> m_inFilters;
91 
92  NegotiateHelper m_codecHelper;
93  NegotiateHelper m_filterHelper;
94  std::string m_buf;
95 
96  void processServerCodecs();
97  void processServerFilters();
98 
99  //void processClientCodecs();
100  //void processClientFilters();
101 
102  bool m_canPacked;
103  bool m_canXML;
104  bool m_canBach;
105 
106  bool m_canGzip;
107  bool m_canBzip2;
108 };
109 
119 {
120  public:
121 
122  StreamAccept(const std::string& name, std::iostream&);
123 
124  virtual ~StreamAccept();
125 
126  virtual void poll(bool can_read = true);
127 
128  virtual State getState();
129  virtual Atlas::Codec * getCodec(Atlas::Bridge&);
130 
131  private:
132 
133  enum
134  {
135  SERVER_GREETING,
136  CLIENT_GREETING,
137  CLIENT_CODECS,
138  SERVER_CODECS,
139  CLIENT_FILTERS,
140  SERVER_FILTERS,
141  DONE
142  };
143 
144  int m_state;
145 
146  std::string m_outName;
147  std::string m_inName;
148  std::iostream& m_socket;
149  std::list<std::string> m_inCodecs;
150  std::list<std::string> m_inFilters;
151 
152  NegotiateHelper m_codecHelper;
153  NegotiateHelper m_filterHelper;
154  std::string m_buf;
155 
156  //void processServerCodecs();
157  //void processServerFilters();
158 
159  void processClientCodecs();
160  void processClientFilters();
161 
162  bool m_canPacked;
163  bool m_canXML;
164  bool m_canBach;
165 
166  bool m_canGzip;
167  bool m_canBzip2;
168 };
169 
170 } } // namespace Atlas::Net
171 
172 #endif
173 
Atlas::Bridge
Atlas stream bridge.
Definition: Bridge.h:36
Atlas::Net::NegotiateHelper
Negotiation of codecs and filters for an Atlas connection.
Definition: Stream.h:36
Atlas::Codec
Atlas stream codec.
Definition: Codec.h:28
Atlas::Net::StreamConnect
Negotiation of clients building a connection to a remote system.
Definition: Stream.h:59
Atlas::Negotiate
Negotiation of codecs and filters for an Atlas connection.
Definition: Negotiate.h:27
Atlas
The Atlas namespace.
Definition: Bridge.h:20
Atlas::Net::StreamAccept
Negotiation of servers accepting a connection from a remote system.
Definition: Stream.h:119

Copyright 2000-2004 the respective authors.

This document can be licensed under the terms of the GNU Free Documentation License or the GNU General Public License and may be freely distributed under the terms given by one of these licenses.