summaryrefslogtreecommitdiff
path: root/src/anyrtpproxy
diff options
context:
space:
mode:
authorOthmar Gsenger <otti@anytun.org>2009-01-12 20:53:14 +0000
committerOthmar Gsenger <otti@anytun.org>2009-01-12 20:53:14 +0000
commit43424d46fbb74958cd5fc358d57c757b53436585 (patch)
treef0b0f1199c0946bca98ed3373191a5a991bd2229 /src/anyrtpproxy
parentclean up Makefile (diff)
moved rtp stuff to anyrtpproxy and removed it from anytun
Diffstat (limited to 'src/anyrtpproxy')
-rw-r--r--src/anyrtpproxy/Makefile15
-rw-r--r--src/anyrtpproxy/anyrtpproxy.cpp10
-rw-r--r--src/anyrtpproxy/commandHandler.cpp8
-rw-r--r--src/anyrtpproxy/rtpSession.cpp154
-rw-r--r--src/anyrtpproxy/rtpSession.h133
-rw-r--r--src/anyrtpproxy/rtpSessionTable.cpp123
-rw-r--r--src/anyrtpproxy/rtpSessionTable.h75
-rw-r--r--src/anyrtpproxy/syncRtpCommand.cpp46
-rw-r--r--src/anyrtpproxy/syncRtpCommand.h61
9 files changed, 604 insertions, 21 deletions
diff --git a/src/anyrtpproxy/Makefile b/src/anyrtpproxy/Makefile
index 90b4645..40ca273 100644
--- a/src/anyrtpproxy/Makefile
+++ b/src/anyrtpproxy/Makefile
@@ -39,23 +39,14 @@ OBJS = anyrtpproxy.o \
../signalController.o \
../log.o \
../buffer.o \
- ../rtpSessionTable.o \
- ../rtpSession.o \
+ rtpSessionTable.o \
+ rtpSession.o \
connectionList.o \
../syncServer.o \
../syncClient.o \
../syncTcpConnection.o \
../syncQueue.o \
- ../seqWindow.o \
- ../connectionParam.o \
- ../routingTable.o \
- ../syncBuffer.o \
- ../syncCommand.o \
- ../syncRouteCommand.o \
- ../syncRtpCommand.o \
- ../syncConnectionCommand.o \
- ../networkAddress.o \
- ../networkPrefix.o \
+ syncRtpCommand.o \
commandHandler.o \
portWindow.o \
callIdQueue.o \
diff --git a/src/anyrtpproxy/anyrtpproxy.cpp b/src/anyrtpproxy/anyrtpproxy.cpp
index 43b4ef9..fdb809e 100644
--- a/src/anyrtpproxy/anyrtpproxy.cpp
+++ b/src/anyrtpproxy/anyrtpproxy.cpp
@@ -43,11 +43,11 @@
#include "../signalController.h"
#include "../buffer.h"
#include "connectionList.h"
-#include "../rtpSessionTable.h"
-#include "../syncCommand.h"
+#include "rtpSessionTable.h"
+#include "syncRtpCommand.h"
#include "../syncQueue.h"
#include "../syncClient.h"
-//#include "../syncOnConnect.h"
+#include "syncOnConnect.hpp"
#include "../threadUtils.hpp"
@@ -104,7 +104,7 @@ void listener(RtpSession::proto::socket* sock1, RtpSession::proto::socket* sock2
session.setRemoteEnd2(remote_end);
if(!gOpt.getNat()) { // with nat enabled sync is not needed
- SyncCommand sc(call_id);
+ SyncRtpCommand sc(call_id);
queue->push(sc);
}
}
@@ -296,7 +296,7 @@ void syncListener(SyncQueue * queue)
SyncServer server(io_service,e);
-// server.onConnect=boost::bind(syncOnConnect,_1);
+ server.onConnect=boost::bind(syncOnConnect,_1);
queue->setSyncServerPtr(&server);
io_service.run();
}
diff --git a/src/anyrtpproxy/commandHandler.cpp b/src/anyrtpproxy/commandHandler.cpp
index c8604d6..01613ec 100644
--- a/src/anyrtpproxy/commandHandler.cpp
+++ b/src/anyrtpproxy/commandHandler.cpp
@@ -42,8 +42,8 @@
#include "../buffer.h"
#include "../log.h"
#include "../syncQueue.h"
-#include "../syncCommand.h"
-#include "../rtpSessionTable.h"
+#include "syncRtpCommand.h"
+#include "rtpSessionTable.h"
#include "callIdQueue.h"
#include "options.h"
@@ -231,7 +231,7 @@ string CommandHandler::handleResponse(string modifiers, string call_id, string a
RtpSession::proto::resolver::query query(addr,port);
session.setRemoteEnd2(*resolver.resolve(query));
session.isComplete(true);
- SyncCommand sc(call_id);
+ SyncRtpCommand sc(call_id);
queue_.push(sc);
ostringstream oss;
@@ -252,7 +252,7 @@ string CommandHandler::handleDelete(string call_id, string from_tag, string to_t
{
RtpSession& session = gRtpSessionTable.getSession(call_id);
session.isDead(true);
- SyncCommand sc(call_id);
+ SyncRtpCommand sc(call_id);
queue_.push(sc);
return RET_OK;
diff --git a/src/anyrtpproxy/rtpSession.cpp b/src/anyrtpproxy/rtpSession.cpp
new file mode 100644
index 0000000..a3551e3
--- /dev/null
+++ b/src/anyrtpproxy/rtpSession.cpp
@@ -0,0 +1,154 @@
+/*
+ * anytun
+ *
+ * The secure anycast tunneling protocol (satp) defines a protocol used
+ * for communication between any combination of unicast and anycast
+ * tunnel endpoints. It has less protocol overhead than IPSec in Tunnel
+ * mode and allows tunneling of every ETHER TYPE protocol (e.g.
+ * ethernet, ip, arp ...). satp directly includes cryptography and
+ * message authentication based on the methodes used by SRTP. It is
+ * intended to deliver a generic, scaleable and secure solution for
+ * tunneling and relaying of packets of any protocol.
+ *
+ *
+ * Copyright (C) 2007-2008 Othmar Gsenger, Erwin Nindl,
+ * Christian Pointner <satp@wirdorange.org>
+ *
+ * This file is part of Anytun.
+ *
+ * Anytun is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 3 as
+ * published by the Free Software Foundation.
+ *
+ * Anytun is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with anytun. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "rtpSession.h"
+
+#include "callIdQueue.h"
+
+RtpSession::RtpSession(const std::string& call_id) : in_sync_(false), call_id_(call_id) , dead_(false), complete_(false),
+ seen1_(false), seen2_(false)
+{
+}
+
+void RtpSession::reinit()
+{
+ gCallIdQueue.push(call_id_);
+}
+
+bool RtpSession::isDead()
+{
+ Lock lock(mutex_);
+ return (dead_ && in_sync_);
+}
+
+bool RtpSession::isDead(bool d)
+{
+ Lock Lock(mutex_);
+ return dead_ = d;
+}
+
+bool RtpSession::isComplete()
+{
+ Lock lock(mutex_);
+ return complete_;
+}
+
+bool RtpSession::isComplete(bool c)
+{
+ Lock lock(mutex_);
+ return complete_ = c;
+}
+
+bool RtpSession::getSeen1()
+{
+ Lock lock(mutex_);
+ return seen1_;
+}
+
+RtpSession& RtpSession::setSeen1()
+{
+ Lock lock(mutex_);
+ //in_sync_ = false;
+ seen1_ = true;
+ return *this;
+}
+
+bool RtpSession::getSeen2()
+{
+ Lock lock(mutex_);
+ return seen2_;
+}
+
+RtpSession& RtpSession::setSeen2()
+{
+ Lock lock(mutex_);
+ //in_sync_ = false;
+ seen2_ = true;
+ return *this;
+}
+
+RtpSession::proto::endpoint RtpSession::getLocalEnd1()
+{
+ Lock lock(mutex_);
+ return local_end1_;
+}
+
+RtpSession& RtpSession::setLocalEnd1(RtpSession::proto::endpoint e)
+{
+ Lock lock(mutex_);
+ in_sync_ = false;
+ local_end1_ = e;
+ return *this;
+}
+
+RtpSession::proto::endpoint RtpSession::getLocalEnd2()
+{
+ Lock lock(mutex_);
+ return local_end2_;
+}
+
+RtpSession& RtpSession::setLocalEnd2(RtpSession::proto::endpoint e)
+{
+ Lock lock(mutex_);
+ in_sync_ = false;
+ local_end2_ = e;
+ return *this;
+}
+
+RtpSession::proto::endpoint RtpSession::getRemoteEnd1()
+{
+ Lock lock(mutex_);
+ return remote_end1_;
+}
+
+RtpSession& RtpSession::setRemoteEnd1(RtpSession::proto::endpoint e)
+{
+ Lock lock(mutex_);
+ in_sync_ = false;
+ remote_end1_ = e;
+ return *this;
+}
+
+RtpSession::proto::endpoint RtpSession::getRemoteEnd2()
+{
+ Lock lock(mutex_);
+ return remote_end2_;
+}
+
+RtpSession& RtpSession::setRemoteEnd2(RtpSession::proto::endpoint e)
+{
+ Lock lock(mutex_);
+ in_sync_ = false;
+ remote_end2_ = e;
+ return *this;
+}
+
+
diff --git a/src/anyrtpproxy/rtpSession.h b/src/anyrtpproxy/rtpSession.h
new file mode 100644
index 0000000..3716c9b
--- /dev/null
+++ b/src/anyrtpproxy/rtpSession.h
@@ -0,0 +1,133 @@
+/*
+ * anytun
+ *
+ * The secure anycast tunneling protocol (satp) defines a protocol used
+ * for communication between any combination of unicast and anycast
+ * tunnel endpoints. It has less protocol overhead than IPSec in Tunnel
+ * mode and allows tunneling of every ETHER TYPE protocol (e.g.
+ * ethernet, ip, arp ...). satp directly includes cryptography and
+ * message authentication based on the methodes used by SRTP. It is
+ * intended to deliver a generic, scaleable and secure solution for
+ * tunneling and relaying of packets of any protocol.
+ *
+ *
+ * Copyright (C) 2007-2008 Othmar Gsenger, Erwin Nindl,
+ * Christian Pointner <satp@wirdorange.org>
+ *
+ * This file is part of Anytun.
+ *
+ * Anytun is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 3 as
+ * published by the Free Software Foundation.
+ *
+ * Anytun is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with anytun. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef _RTPSESSION_H_
+#define _RTPSESSION_H_
+
+#include <boost/asio.hpp>
+
+#include "../threadUtils.hpp"
+
+#include <boost/archive/text_oarchive.hpp>
+#include <boost/archive/text_iarchive.hpp>
+
+class RtpSession
+{
+public:
+ typedef boost::asio::ip::udp proto;
+
+ RtpSession(const std::string& call_id);
+
+ bool isDead();
+ bool isDead(bool d);
+
+ bool isComplete();
+ bool isComplete(bool c);
+
+ proto::endpoint getLocalEnd1();
+ RtpSession& setLocalEnd1(proto::endpoint e);
+ proto::endpoint getLocalEnd2();
+ RtpSession& setLocalEnd2(proto::endpoint e);
+
+ proto::endpoint getRemoteEnd1();
+ RtpSession& setRemoteEnd1(proto::endpoint e);
+ proto::endpoint getRemoteEnd2();
+ RtpSession& setRemoteEnd2(proto::endpoint e);
+
+ RtpSession& setSeen1();
+ bool getSeen1();
+
+ RtpSession& setSeen2();
+ bool getSeen2();
+
+private:
+ RtpSession(const RtpSession & src);
+
+ void reinit();
+
+ //TODO: check if this is ok
+ friend class boost::serialization::access;
+ template<class Archive>
+ void serialize(Archive & ar, const unsigned int version)
+ {
+ Lock lock(mutex_);
+
+ // address of local_end1 and local_end2 are always equal
+ std::string local_addr(local_end1_.address().to_string());
+ u_int16_t local_port1 = local_end1_.port();
+ u_int16_t local_port2 = local_end2_.port();
+
+ std::string remote_addr1(remote_end1_.address().to_string());
+ u_int16_t remote_port1 = remote_end1_.port();
+ std::string remote_addr2(remote_end2_.address().to_string());
+ u_int16_t remote_port2 = remote_end2_.port();
+
+ ar & dead_;
+ ar & complete_;
+ ar & local_addr;
+ ar & local_port1;
+ ar & local_port2;
+ ar & remote_addr1;
+ ar & remote_port1;
+ ar & remote_addr2;
+ ar & remote_port2;
+ ar & seen1_;
+ ar & seen2_;
+
+ proto::endpoint local_end1(boost::asio::ip::address::from_string(local_addr), local_port1);
+ local_end1_ = local_end1;
+ proto::endpoint local_end2(boost::asio::ip::address::from_string(local_addr), local_port2);
+ local_end2_ = local_end2;
+
+ proto::endpoint remote_end1(boost::asio::ip::address::from_string(remote_addr1), remote_port1);
+ remote_end1_ = remote_end1;
+ proto::endpoint remote_end2(boost::asio::ip::address::from_string(remote_addr2), remote_port2);
+ remote_end2_ = remote_end2;
+
+ if(complete_ && !dead_)
+ reinit();
+
+ in_sync_ = true;
+ }
+
+ bool in_sync_;
+ ::Mutex mutex_;
+
+ const std::string& call_id_;
+ bool dead_;
+ bool complete_;
+ proto::endpoint local_end1_, local_end2_;
+ proto::endpoint remote_end1_, remote_end2_;
+ bool seen1_,seen2_; //has at least 1 packet been recieved?
+};
+
+
+#endif
diff --git a/src/anyrtpproxy/rtpSessionTable.cpp b/src/anyrtpproxy/rtpSessionTable.cpp
new file mode 100644
index 0000000..9237866
--- /dev/null
+++ b/src/anyrtpproxy/rtpSessionTable.cpp
@@ -0,0 +1,123 @@
+/*
+ * anytun
+ *
+ * The secure anycast tunneling protocol (satp) defines a protocol used
+ * for communication between any combination of unicast and anycast
+ * tunnel endpoints. It has less protocol overhead than IPSec in Tunnel
+ * mode and allows tunneling of every ETHER TYPE protocol (e.g.
+ * ethernet, ip, arp ...). satp directly includes cryptography and
+ * message authentication based on the methodes used by SRTP. It is
+ * intended to deliver a generic, scaleable and secure solution for
+ * tunneling and relaying of packets of any protocol.
+ *
+ *
+ * Copyright (C) 2007-2008 Othmar Gsenger, Erwin Nindl,
+ * Christian Pointner <satp@wirdorange.org>
+ *
+ * This file is part of Anytun.
+ *
+ * Anytun is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 3 as
+ * published by the Free Software Foundation.
+ *
+ * Anytun is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with anytun. If not, see <http://www.gnu.org/licenses/>.
+ */
+#include "../threadUtils.hpp"
+#include "../datatypes.h"
+
+#include "rtpSessionTable.h"
+
+RtpSessionTable* RtpSessionTable::inst = NULL;
+Mutex RtpSessionTable::instMutex;
+RtpSessionTable& gRtpSessionTable = RtpSessionTable::instance();
+
+
+RtpSessionTable& RtpSessionTable::instance()
+{
+ Lock lock(instMutex);
+ static instanceCleaner c;
+ if(!inst)
+ inst = new RtpSessionTable();
+
+ return *inst;
+}
+
+RtpSessionTable::RtpSessionTable()
+{
+}
+
+RtpSessionTable::~RtpSessionTable()
+{
+}
+
+void RtpSessionTable::delSession(const std::string & call_id)
+{
+ Lock lock(mutex_);
+
+ RtpSessionMap::iterator it = map_.find(call_id);
+ if(it!=map_.end())
+ delete it->second;
+
+ map_.erase(it);
+}
+
+RtpSession& RtpSessionTable::getOrNewSession(const std::string & call_id, bool& is_new)
+{
+ Lock lock(mutex_);
+ return getOrNewSessionUnlocked(call_id, is_new);
+}
+
+RtpSession& RtpSessionTable::getOrNewSessionUnlocked(const std::string & call_id, bool& is_new)
+{
+ is_new = false;
+ RtpSessionMap::iterator it = map_.find(call_id);
+ if(it!=map_.end())
+ return *(it->second);
+
+ is_new = true;
+ std::pair<RtpSessionMap::iterator, bool> ret = map_.insert(RtpSessionMap::value_type(call_id, NULL));
+ ret.first->second = new RtpSession(ret.first->first);
+ return *(ret.first->second);
+}
+
+RtpSession& RtpSessionTable::getSession(const std::string & call_id)
+{
+ RtpSessionMap::iterator it = map_.find(call_id);
+ if(it!=map_.end())
+ return *(it->second);
+
+ throw std::runtime_error("session not found");
+}
+
+RtpSessionMap::iterator RtpSessionTable::getBeginUnlocked()
+{
+ return map_.begin();
+}
+
+RtpSessionMap::iterator RtpSessionTable::getEndUnlocked()
+{
+ return map_.end();
+}
+
+void RtpSessionTable::clear()
+{
+ Lock lock(mutex_);
+ map_.clear();
+}
+
+bool RtpSessionTable::empty()
+{
+ Lock lock(mutex_);
+ return map_.empty();
+}
+
+Mutex& RtpSessionTable::getMutex()
+{
+ return mutex_;
+}
diff --git a/src/anyrtpproxy/rtpSessionTable.h b/src/anyrtpproxy/rtpSessionTable.h
new file mode 100644
index 0000000..a37318d
--- /dev/null
+++ b/src/anyrtpproxy/rtpSessionTable.h
@@ -0,0 +1,75 @@
+/*
+ * anytun
+ *
+ * The secure anycast tunneling protocol (satp) defines a protocol used
+ * for communication between any combination of unicast and anycast
+ * tunnel endpoints. It has less protocol overhead than IPSec in Tunnel
+ * mode and allows tunneling of every ETHER TYPE protocol (e.g.
+ * ethernet, ip, arp ...). satp directly includes cryptography and
+ * message authentication based on the methodes used by SRTP. It is
+ * intended to deliver a generic, scaleable and secure solution for
+ * tunneling and relaying of packets of any protocol.
+ *
+ *
+ * Copyright (C) 2007-2008 Othmar Gsenger, Erwin Nindl,
+ * Christian Pointner <satp@wirdorange.org>
+ *
+ * This file is part of Anytun.
+ *
+ * Anytun is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 3 as
+ * published by the Free Software Foundation.
+ *
+ * Anytun is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with anytun. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef _RTPSESSIONTABLE_H
+#define _RTPSESSIONTABLE_H
+
+#include <map>
+
+#include "../threadUtils.hpp"
+#include "../datatypes.h"
+#include "rtpSession.h"
+typedef std::map<std::string,RtpSession*> RtpSessionMap;
+
+class RtpSessionTable
+{
+public:
+ static RtpSessionTable& instance();
+ RtpSessionTable();
+ ~RtpSessionTable();
+ void delSession(const std::string & call_id);
+ bool empty();
+ void clear();
+ ::Mutex& getMutex();
+ RtpSessionMap::iterator getBeginUnlocked();
+ RtpSessionMap::iterator getEndUnlocked();
+ RtpSession& getOrNewSession(const std::string & call_id, bool& isnew);
+ RtpSession& getOrNewSessionUnlocked(const std::string & call_id, bool& isnew);
+ RtpSession& getSession(const std::string & call_id);
+
+private:
+ static ::Mutex instMutex;
+ static RtpSessionTable* inst;
+ class instanceCleaner {
+ public: ~instanceCleaner() {
+ if(RtpSessionTable::inst != 0)
+ delete RtpSessionTable::inst;
+ }
+ };
+ RtpSessionTable(const RtpSessionTable &s);
+ void operator=(const RtpSessionTable &s);
+ RtpSessionMap map_;
+ ::Mutex mutex_;
+};
+
+extern RtpSessionTable& gRtpSessionTable;
+
+#endif
diff --git a/src/anyrtpproxy/syncRtpCommand.cpp b/src/anyrtpproxy/syncRtpCommand.cpp
new file mode 100644
index 0000000..f612c8a
--- /dev/null
+++ b/src/anyrtpproxy/syncRtpCommand.cpp
@@ -0,0 +1,46 @@
+/*
+ * anytun
+ *
+ * The secure anycast tunneling protocol (satp) defines a protocol used
+ * for communication between any combination of unicast and anycast
+ * tunnel endpoints. It has less protocol overhead than IPSec in Tunnel
+ * mode and allows tunneling of every ETHER TYPE protocol (e.g.
+ * ethernet, ip, arp ...). satp directly includes cryptography and
+ * message authentication based on the methodes used by SRTP. It is
+ * intended to deliver a generic, scaleable and secure solution for
+ * tunneling and relaying of packets of any protocol.
+ *
+ *
+ * Copyright (C) 2007-2008 Othmar Gsenger, Erwin Nindl,
+ * Christian Pointner <satp@wirdorange.org>
+ *
+ * This file is part of Anytun.
+ *
+ * Anytun is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 3 as
+ * published by the Free Software Foundation.
+ *
+ * Anytun is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with anytun. If not, see <http://www.gnu.org/licenses/>.
+ */
+#include "syncRtpCommand.h"
+
+SyncRtpCommand::SyncRtpCommand()
+{
+}
+
+SyncRtpCommand::SyncRtpCommand( const std::string & addr )
+:callid_(addr)
+{
+}
+
+
+std::string SyncRtpCommand::getCallId() const
+{
+ return callid_;
+}
diff --git a/src/anyrtpproxy/syncRtpCommand.h b/src/anyrtpproxy/syncRtpCommand.h
new file mode 100644
index 0000000..282243b
--- /dev/null
+++ b/src/anyrtpproxy/syncRtpCommand.h
@@ -0,0 +1,61 @@
+/*
+ * anytun
+ *
+ * The secure anycast tunneling protocol (satp) defines a protocol used
+ * for communication between any combination of unicast and anycast
+ * tunnel endpoints. It has less protocol overhead than IPSec in Tunnel
+ * mode and allows tunneling of every ETHER TYPE protocol (e.g.
+ * ethernet, ip, arp ...). satp directly includes cryptography and
+ * message authentication based on the methodes used by SRTP. It is
+ * intended to deliver a generic, scaleable and secure solution for
+ * tunneling and relaying of packets of any protocol.
+ *
+ *
+ * Copyright (C) 2007-2008 Othmar Gsenger, Erwin Nindl,
+ * Christian Pointner <satp@wirdorange.org>
+ *
+ * This file is part of Anytun.
+ *
+ * Anytun is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 3 as
+ * published by the Free Software Foundation.
+ *
+ * Anytun is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with anytun. If not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef _SYNCRTPCOMMAND_H
+#define _SYNCRTPCOMMAND_H
+#include <boost/archive/text_oarchive.hpp>
+#include <boost/archive/text_iarchive.hpp>
+
+#include "../threadUtils.hpp"
+#include "rtpSessionTable.h"
+
+class SyncRtpCommand
+{
+public:
+ SyncRtpCommand(const std::string & );
+ SyncRtpCommand();
+ std::string getCallId() const;
+
+private:
+ SyncRtpCommand(const SyncRtpCommand &);
+ std::string callid_;
+ friend class boost::serialization::access;
+ template<class Archive>
+ void serialize(Archive & ar, const unsigned int version)
+ {
+ Lock lock(gRtpSessionTable.getMutex());
+ ar & callid_;
+ bool is_new;
+ ar & gRtpSessionTable.getOrNewSessionUnlocked(callid_, is_new);
+ };
+};
+
+
+#endif // _SYNCCOMMAND_H