summaryrefslogtreecommitdiff
path: root/orkbasecxx/Utils.cpp
diff options
context:
space:
mode:
authorHenri Herscher <henri@oreka.org>2006-12-27 18:26:52 +0000
committerHenri Herscher <henri@oreka.org>2006-12-27 18:26:52 +0000
commit320f2a9dd5fd59b09e1977aa1f9344e219bf3d1a (patch)
tree0fddefd965d6816418a02cc3a25937636cb975fc /orkbasecxx/Utils.cpp
parent4da9cdff7f824859048184371fc524fbe5d326f3 (diff)
1. Subsequent SIP INVITES that could be associated to an existing session now disregarded because they could be disrupting valid sessions. We need to store the new INVITES and only use them when they are validated by a matching RTP stream.
2. New RTP streams are now logged within one session by the VoIP plugin. 3. Added a Debug config boolean that has the trackingId alpha counter reset to 0 (AAA) when enabled. git-svn-id: https://oreka.svn.sourceforge.net/svnroot/oreka/trunk@380 09dcff7a-b715-0410-9601-b79a96267cd0
Diffstat (limited to 'orkbasecxx/Utils.cpp')
-rw-r--r--orkbasecxx/Utils.cpp44
1 files changed, 44 insertions, 0 deletions
diff --git a/orkbasecxx/Utils.cpp b/orkbasecxx/Utils.cpp
index cec44eb..d4e7f8a 100644
--- a/orkbasecxx/Utils.cpp
+++ b/orkbasecxx/Utils.cpp
@@ -1,5 +1,6 @@
#include "Utils.h"
#include "ace/OS_NS_stdio.h"
+#include "ace/OS_NS_arpa_inet.h"
//========================================================
// file related stuff
@@ -63,3 +64,46 @@ bool FileCanOpen(CStdString& path)
}
return false;
}
+
+//=====================================================
+// Network related stuff
+
+void TcpAddress::ToString(CStdString& string)
+{
+ char szIp[16];
+ ACE_OS::inet_ntop(AF_INET, (void*)&ip, szIp, sizeof(szIp));
+
+ string.Format("%s,%u", szIp, port);
+}
+
+
+void TcpAddressList::AddAddress(struct in_addr ip, unsigned short port)
+{
+ TcpAddress addr;
+ addr.ip = ip;
+ addr.port = port;
+ m_addresses.push_back(addr);
+}
+
+bool TcpAddressList::HasAddress(struct in_addr ip, unsigned short port)
+{
+ for(std::list<TcpAddress>::iterator it = m_addresses.begin(); it != m_addresses.end(); it++)
+ {
+ if ((unsigned int)((*it).ip.s_addr) == (unsigned int)ip.s_addr && (*it).port == port)
+ {
+ return true;
+ }
+ }
+ return false;
+}
+
+bool TcpAddressList::HasAddressOrAdd(struct in_addr ip, unsigned short port)
+{
+ if(HasAddress(ip, port) == false)
+ {
+ AddAddress(ip, port);
+ return false;
+ }
+ return true;
+}
+