15 #ifndef SOCKETSTREAM_H 16 #define SOCKETSTREAM_H 18 #include "pandabase.h" 19 #include "trueClock.h" 20 #include "config_express.h" 23 #include "typedReferenceCount.h" 24 #include "pointerTo.h" 41 class EXPCL_PANDAEXPRESS SSReader {
43 SSReader(istream *stream);
47 INLINE
bool receive_datagram(
Datagram &dg);
49 virtual bool is_closed() = 0;
50 virtual void close() = 0;
52 INLINE
void set_tcp_header_size(
int tcp_header_size);
53 INLINE
int get_tcp_header_size()
const;
56 bool do_receive_datagram(
Datagram &dg);
59 size_t _data_expected;
63 #ifdef SIMULATE_NETWORK_DELAY 65 void start_delay(
double min_delay,
double max_delay);
69 void delay_datagram(
const Datagram &datagram);
70 bool get_delayed(
Datagram &datagram);
72 class DelayedDatagram {
81 double _min_delay, _delay_variance;
83 #endif // SIMULATE_NETWORK_DELAY 93 class EXPCL_PANDAEXPRESS SSWriter {
95 SSWriter(ostream *stream);
99 bool send_datagram(
const Datagram &dg);
101 virtual bool is_closed() = 0;
102 virtual void close() = 0;
104 INLINE
void set_collect_tcp(
bool collect_tcp);
105 INLINE
bool get_collect_tcp()
const;
106 INLINE
void set_collect_tcp_interval(
double interval);
107 INLINE
double get_collect_tcp_interval()
const;
109 INLINE
void set_tcp_header_size(
int tcp_header_size);
110 INLINE
int get_tcp_header_size()
const;
112 INLINE
bool consider_flush();
118 double _collect_tcp_interval;
119 double _queued_data_start;
120 int _tcp_header_size;
132 class EXPCL_PANDAEXPRESS ISocketStream :
public istream,
public SSReader {
134 INLINE ISocketStream(streambuf *buf);
135 virtual ~ISocketStream();
145 virtual bool is_closed() = 0;
146 virtual void close() = 0;
147 virtual ReadState get_read_state() = 0;
150 HTTPChannel *_channel;
153 friend class HTTPChannel;
164 class EXPCL_PANDAEXPRESS OSocketStream :
public ostream,
public SSWriter {
166 INLINE OSocketStream(streambuf *buf);
169 virtual bool is_closed() = 0;
170 virtual void close() = 0;
180 class EXPCL_PANDAEXPRESS SocketStream :
public iostream,
public SSReader,
public SSWriter {
182 INLINE SocketStream(streambuf *buf);
185 virtual bool is_closed() = 0;
186 virtual void close() = 0;
188 INLINE
void set_tcp_header_size(
int tcp_header_size);
189 INLINE
int get_tcp_header_size()
const;
195 #include "socketStream.I" 197 #endif // HAVE_OPENSSL This is our own Panda specialization on the default STL deque.
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...