00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef SOCKETSTREAMRECORDER_H
00016 #define SOCKETSTREAMRECORDER_H
00017
00018 #include "pandabase.h"
00019 #include "socketStream.h"
00020 #include "recorderBase.h"
00021 #include "pdeque.h"
00022
00023 class BamReader;
00024 class BamWriter;
00025 class FactoryParams;
00026 class DatagramIterator;
00027
00028
00029
00030
00031
00032 #ifdef HAVE_OPENSSL
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045 class EXPCL_PANDA_RECORDER SocketStreamRecorder : public RecorderBase {
00046 PUBLISHED:
00047 INLINE SocketStreamRecorder();
00048 INLINE SocketStreamRecorder(SocketStream *stream, bool owns_stream);
00049 INLINE ~SocketStreamRecorder();
00050
00051 bool receive_datagram(Datagram &dg);
00052 INLINE bool send_datagram(const Datagram &dg);
00053
00054 INLINE bool is_closed();
00055 INLINE void close();
00056
00057 INLINE void set_collect_tcp(bool collect_tcp);
00058 INLINE bool get_collect_tcp() const;
00059 INLINE void set_collect_tcp_interval(double interval);
00060 INLINE double get_collect_tcp_interval() const;
00061
00062 INLINE bool consider_flush();
00063 INLINE bool flush();
00064
00065 public:
00066 virtual void record_frame(BamWriter *manager, Datagram &dg);
00067 virtual void play_frame(DatagramIterator &scan, BamReader *manager);
00068
00069 private:
00070 SocketStream *_stream;
00071 bool _owns_stream;
00072
00073 typedef pdeque<Datagram> Data;
00074 Data _data;
00075 bool _closed;
00076
00077 public:
00078 static void register_with_read_factory();
00079 virtual void write_recorder(BamWriter *manager, Datagram &dg);
00080
00081 protected:
00082 static RecorderBase *make_recorder(const FactoryParams ¶ms);
00083 void fillin_recorder(DatagramIterator &scan, BamReader *manager);
00084
00085 public:
00086 static TypeHandle get_class_type() {
00087 return _type_handle;
00088 }
00089 static void init_type() {
00090 RecorderBase::init_type();
00091 register_type(_type_handle, "SocketStreamRecorder",
00092 RecorderBase::get_class_type());
00093 }
00094 virtual TypeHandle get_type() const {
00095 return get_class_type();
00096 }
00097 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00098
00099 private:
00100 static TypeHandle _type_handle;
00101 };
00102
00103 #include "socketStreamRecorder.I"
00104
00105 #endif // HAVE_OPENSSL
00106
00107 #endif // SOCKETSTREAMRECORDER_H