From ce8ae5556b90de67f23ddb974da76bee3e43b6fd Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Thu, 13 Mar 2008 17:32:00 +0000 Subject: anyrtpproxy can handled most commands TODO: start threads for relaying --- rtpSession.h | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 59 insertions(+), 4 deletions(-) (limited to 'rtpSession.h') diff --git a/rtpSession.h b/rtpSession.h index 218843c..4a43d3f 100644 --- a/rtpSession.h +++ b/rtpSession.h @@ -33,24 +33,79 @@ #include "threadUtils.hpp" +#include + #include #include class RtpSession { public: - RtpSession(const RtpSession & src); RtpSession(); + ~RtpSession(); + + void init(); + + bool isDead(); + bool isDead(bool d); + + u_int16_t getLocalPort(); + RtpSession& setLocalPort(u_int16_t p); + std::string getLocalAddr(); + RtpSession& setLocalAddr(std::string a); + + u_int16_t getRemotePort1(); + RtpSession& setRemotePort1(u_int16_t p); + std::string getRemoteAddr1(); + RtpSession& setRemoteAddr1(std::string a); + + u_int16_t getRemotePort2(); + RtpSession& setRemotePort2(u_int16_t p); + std::string getRemoteAddr2(); + RtpSession& setRemoteAddr2(std::string a); private: + RtpSession(const RtpSession & src); + + void reinitSock(); + //TODO: check if this is ok - //Mutex mutex_; friend class boost::serialization::access; template void serialize(Archive & ar, const unsigned int version) - { - //Lock lock(mutex_); + { + Lock lock(mutex_); + + std::cout << "seralize called: " << local_port_ << "," << local_addr_ << std::endl; + + + u_int16_t old_local_port = local_port_; + std::string old_local_addr = local_addr_; + + ar & dead_; + ar & local_addr_; + ar & local_port_; + ar & remote_addr1_; + ar & remote_port1_; + ar & remote_addr2_; + ar & remote_port2_; + + if(old_local_port != local_port_ || old_local_addr != local_addr_) + reinitSock(); + + in_sync_ = true; } + + bool in_sync_; + ::Mutex mutex_; + void* sock_; + + bool dead_; + u_int16_t local_port_; + std::string local_addr_; + std::string remote_addr1_, remote_addr2_; + u_int16_t remote_port1_, remote_port2_; }; + #endif -- cgit v1.2.3