00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef SOCKETSTREAM_H
00020 #define SOCKETSTREAM_H
00021
00022 #include "pandabase.h"
00023 #include "clockObject.h"
00024 #include "config_express.h"
00025
00026
00027
00028
00029
00030 #ifdef HAVE_SSL
00031
00032 class Datagram;
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043 class EXPCL_PANDAEXPRESS ISocketStream : public istream {
00044 public:
00045 INLINE ISocketStream(streambuf *buf);
00046
00047 PUBLISHED:
00048 bool receive_datagram(Datagram &dg);
00049
00050 virtual bool is_closed() = 0;
00051
00052 private:
00053 size_t _data_expected;
00054 string _data_so_far;
00055 };
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065 class EXPCL_PANDAEXPRESS OSocketStream : public ostream {
00066 public:
00067 INLINE OSocketStream(streambuf *buf);
00068
00069 PUBLISHED:
00070 bool send_datagram(const Datagram &dg);
00071
00072 virtual bool is_closed() = 0;
00073
00074 INLINE void set_collect_tcp(bool collect_tcp);
00075 INLINE bool get_collect_tcp() const;
00076 INLINE void set_collect_tcp_interval(double interval);
00077 INLINE double get_collect_tcp_interval() const;
00078
00079 INLINE bool consider_flush();
00080 INLINE bool flush();
00081
00082 private:
00083 bool _collect_tcp;
00084 double _collect_tcp_interval;
00085 double _queued_data_start;
00086 };
00087
00088
00089
00090
00091
00092
00093 class EXPCL_PANDAEXPRESS SocketStream : public iostream {
00094 public:
00095 INLINE SocketStream(streambuf *buf);
00096
00097 PUBLISHED:
00098 bool receive_datagram(Datagram &dg);
00099 bool send_datagram(const Datagram &dg);
00100
00101 virtual bool is_closed() = 0;
00102
00103 INLINE void set_collect_tcp(bool collect_tcp);
00104 INLINE bool get_collect_tcp() const;
00105 INLINE void set_collect_tcp_interval(double interval);
00106 INLINE double get_collect_tcp_interval() const;
00107
00108 INLINE bool consider_flush();
00109 INLINE bool flush();
00110
00111 private:
00112 size_t _data_expected;
00113 string _data_so_far;
00114
00115 bool _collect_tcp;
00116 double _collect_tcp_interval;
00117 double _queued_data_start;
00118 };
00119
00120
00121 #include "socketStream.I"
00122
00123 #endif // HAVE_SSL
00124
00125
00126 #endif
00127
00128