summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOthmar Gsenger <otti@anytun.org>2008-03-17 20:06:13 +0000
committerOthmar Gsenger <otti@anytun.org>2008-03-17 20:06:13 +0000
commitec2e3b3ff531daf579f5553096b5fa2284d44f08 (patch)
treead713a403d5b1540a31dcbfe72250d85e6d22b4a
parentadded port window and port range options (diff)
added port window to command handler
-rw-r--r--anyrtpproxy/anyrtpproxy.cpp4
-rw-r--r--anyrtpproxy/commandHandler.cpp8
-rw-r--r--anyrtpproxy/commandHandler.h6
-rw-r--r--anyrtpproxy/portWindow.h2
4 files changed, 12 insertions, 8 deletions
diff --git a/anyrtpproxy/anyrtpproxy.cpp b/anyrtpproxy/anyrtpproxy.cpp
index 2b6184e..951170a 100644
--- a/anyrtpproxy/anyrtpproxy.cpp
+++ b/anyrtpproxy/anyrtpproxy.cpp
@@ -55,6 +55,7 @@
#include "callIdQueue.h"
#include "options.h"
+#include "portWindow.h"
#include <map>
@@ -315,7 +316,8 @@ int main(int argc, char* argv[])
pthread_create(& connectThreads.back(), NULL, syncConnector, point);
}
- CommandHandler cmd(queue, gOpt.getControlInterface().addr_, gOpt.getControlInterface().port_);
+ PortWindow port_window(gOpt.getRtpStartPort(),gOpt.getRtpEndPort());
+ CommandHandler cmd(queue, gOpt.getControlInterface().addr_, gOpt.getControlInterface().port_,port_window);
int ret = sig.run();
return ret;
diff --git a/anyrtpproxy/commandHandler.cpp b/anyrtpproxy/commandHandler.cpp
index 71f4126..dd37fcc 100644
--- a/anyrtpproxy/commandHandler.cpp
+++ b/anyrtpproxy/commandHandler.cpp
@@ -44,14 +44,14 @@
#define MAX_COMMAND_LENGTH 1000
-CommandHandler::CommandHandler(SyncQueue& q, u_int16_t lp) : queue_(q), running_(true), control_sock_(lp),
- local_address_("0.0.0.0"), local_port_(lp)
+CommandHandler::CommandHandler(SyncQueue& q, u_int16_t lp,PortWindow & pw) : queue_(q), running_(true), control_sock_(lp),
+ local_address_("0.0.0.0"), local_port_(lp),port_window_(pw)
{
pthread_create(&thread_, NULL, run, this);
}
-CommandHandler::CommandHandler(SyncQueue& q, string la, u_int16_t lp) : queue_(q), running_(true), control_sock_(la, lp),
- local_address_(la), local_port_(lp)
+CommandHandler::CommandHandler(SyncQueue& q, string la, u_int16_t lp,PortWindow & pw) : queue_(q), running_(true), control_sock_(la, lp),
+ local_address_(la), local_port_(lp),port_window_(pw)
{
pthread_create(&thread_, NULL, run, this);
}
diff --git a/anyrtpproxy/commandHandler.h b/anyrtpproxy/commandHandler.h
index 6e75bc4..97082ca 100644
--- a/anyrtpproxy/commandHandler.h
+++ b/anyrtpproxy/commandHandler.h
@@ -35,14 +35,15 @@
#include "../datatypes.h"
#include "../PracticalSocket.h"
#include "../syncQueue.h"
+#include "portWindow.h"
using std::string;
class CommandHandler
{
public:
- CommandHandler(SyncQueue& q, u_int16_t lp);
- CommandHandler(SyncQueue& q, string la, u_int16_t lp);
+ CommandHandler(SyncQueue& q, u_int16_t lp, PortWindow &);
+ CommandHandler(SyncQueue& q, string la, u_int16_t lp, PortWindow &);
~CommandHandler();
bool isRunning();
@@ -81,6 +82,7 @@ private:
UDPSocket control_sock_;
string local_address_;
u_int16_t local_port_;
+ PortWindow& port_window_;
};
diff --git a/anyrtpproxy/portWindow.h b/anyrtpproxy/portWindow.h
index 85867ff..c97e94f 100644
--- a/anyrtpproxy/portWindow.h
+++ b/anyrtpproxy/portWindow.h
@@ -53,7 +53,7 @@ public:
private:
u_int16_t start_port_;
u_int16_t end_port_;
- Mutex mutex_;
+ ::Mutex mutex_;
PortSet ports_;
PortWindow(const PortWindow &s);