[asterisk-scf-commits] asterisk-scf/integration/mediatransportudptl.git branch "master" updated.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Mon Sep 26 09:26:01 CDT 2011


branch "master" has been updated
       via  cdf4544166d459a2449d1bbe8899738afee1f483 (commit)
      from  beff2421fcee2c335becc3bf265ff497b0fd43c7 (commit)

Summary of changes:
 .../Replication/UDPTL/UdptlStateReplicationIf.ice  |    3 ++
 src/UDPTLSink.cpp                                  |   21 ++++---------
 src/UDPTLSink.h                                    |    5 +--
 src/UDPTLSource.cpp                                |   24 +++++----------
 src/UDPTLSource.h                                  |    4 +-
 test/TestMediaTransportUDPTL.cpp                   |   30 ++++++++++++--------
 6 files changed, 40 insertions(+), 47 deletions(-)


- Log -----------------------------------------------------------------
commit cdf4544166d459a2449d1bbe8899738afee1f483
Author: Joshua Colp <jcolp at digium.com>
Date:   Mon Sep 26 11:32:58 2011 -0300

    Bring up to date with latest slice changes.

diff --git a/slice/AsteriskSCF/Replication/UDPTL/UdptlStateReplicationIf.ice b/slice/AsteriskSCF/Replication/UDPTL/UdptlStateReplicationIf.ice
index 9a4e254..2893045 100644
--- a/slice/AsteriskSCF/Replication/UDPTL/UdptlStateReplicationIf.ice
+++ b/slice/AsteriskSCF/Replication/UDPTL/UdptlStateReplicationIf.ice
@@ -21,6 +21,7 @@
 
 #include <AsteriskSCF/Media/MediaIf.ice>
 #include <AsteriskSCF/Media/RTP/MediaRTPIf.ice>
+#include <AsteriskSCF/Media/UDPTL/MediaUDPTLIf.ice>
 #include <AsteriskSCF/Core/Discovery/ServiceLocatorIf.ice>
 #include <AsteriskSCF/System/Component/ConfigurationIf.ice>
 
@@ -86,6 +87,8 @@ module V1
 	AsteriskSCF::Media::V1::StreamSource *source;
 	string remoteAddress;
 	int remotePort;
+        int farMaxDatagram;
+        AsteriskSCF::Media::UDPTL::V1::ErrorCorrectionScheme errorCorrectionScheme = AsteriskSCF::Media::UDPTL::V1::NONE;
     };
 
     class UdptlStreamSourceStateItem extends UdptlStateItem
diff --git a/src/UDPTLSink.cpp b/src/UDPTLSink.cpp
index e227acd..6b1cde6 100644
--- a/src/UDPTLSink.cpp
+++ b/src/UDPTLSink.cpp
@@ -33,6 +33,7 @@ using namespace std;
 using namespace AsteriskSCF::Core::Discovery::V1;
 using namespace AsteriskSCF::Media::V1;
 using namespace AsteriskSCF::Media::UDPTL::V1;
+using namespace AsteriskSCF::Network::V1;
 using namespace AsteriskSCF::UDPTL;
 using namespace AsteriskSCF::Replication::UDPTL::V1;
 
@@ -168,7 +169,7 @@ std::string StreamSinkUDPTLImpl::getId(const Ice::Current&)
 }
 
 /**
- * Implementation of the setRemoteDetails method as defined in MediaUDPTLIf.ice
+ * Implementation of the setRemoteDetails method as defined in NetworkIf.ice
  */
 void StreamSinkUDPTLImpl::setRemoteDetails(const string& address, Ice::Int port, const Ice::Current&)
 {
@@ -181,19 +182,11 @@ void StreamSinkUDPTLImpl::setRemoteDetails(const string& address, Ice::Int port,
 }
 
 /**
- * Implementation of the getRemoteAddress method as defined in MediaUDPTLIf.ice
+ * Implementation of the getRemoteDetails method as defined in NetworkIf.ice
  */
-std::string StreamSinkUDPTLImpl::getRemoteAddress(const Ice::Current&)
+AddressInformation StreamSinkUDPTLImpl::getRemoteDetails(const Ice::Current&)
 {
-    return mImpl->mSinkStateItem->remoteAddress;
-}
-
-/**
- * Implementation of the getRemotePort method as defined in MediaUDPTLIf.ice
- */
-Ice::Int StreamSinkUDPTLImpl::getRemotePort(const Ice::Current&)
-{
-    return mImpl->mSinkStateItem->remotePort;
+    return AddressInformation(mImpl->mSinkStateItem->remoteAddress, mImpl->mSinkStateItem->remotePort);
 }
 
 /**
@@ -216,9 +209,9 @@ Ice::Int StreamSinkUDPTLImpl::getFarMaxDatagram(const Ice::Current&)
 }
 
 /**
- * Implemnentation of the getFarMaxIfp method as defined in MediaUDPTLIf.ice
+ * Implemnentation of the getFarMaxIFP method as defined in MediaUDPTLIf.ice
  */
-Ice::Int StreamSinkUDPTLImpl::getFarMaxIfp(const Ice::Current&)
+Ice::Int StreamSinkUDPTLImpl::getFarMaxIFP(const Ice::Current&)
 {
     return udptl_get_far_max_ifp(mImpl->mUdptl);
 }
diff --git a/src/UDPTLSink.h b/src/UDPTLSink.h
index d609ded..4357106 100644
--- a/src/UDPTLSink.h
+++ b/src/UDPTLSink.h
@@ -40,12 +40,11 @@ public:
     AsteriskSCF::Media::V1::FormatSeq getFormats(const Ice::Current&);
     std::string getId(const Ice::Current&);
     void setRemoteDetails(const std::string&, Ice::Int, const Ice::Current&);
-    std::string getRemoteAddress(const Ice::Current&);
-    Ice::Int getRemotePort(const Ice::Current&);
+    AsteriskSCF::Network::V1::AddressInformation getRemoteDetails(const Ice::Current&);
 
     void setFarMaxDatagram(Ice::Int, const Ice::Current&);
     Ice::Int getFarMaxDatagram(const Ice::Current&);
-    Ice::Int getFarMaxIfp(const Ice::Current&);
+    Ice::Int getFarMaxIFP(const Ice::Current&);
     void setErrorCorrectionScheme(AsteriskSCF::Media::UDPTL::V1::ErrorCorrectionScheme, const Ice::Current&);
     AsteriskSCF::Media::UDPTL::V1::ErrorCorrectionScheme getErrorCorrectionScheme(const Ice::Current&);
 
diff --git a/src/UDPTLSource.cpp b/src/UDPTLSource.cpp
index 55d385e..38759d9 100644
--- a/src/UDPTLSource.cpp
+++ b/src/UDPTLSource.cpp
@@ -37,6 +37,7 @@ using namespace AsteriskSCF::Core::Discovery::V1;
 using namespace AsteriskSCF::Media;
 using namespace AsteriskSCF::Media::V1;
 using namespace AsteriskSCF::Media::UDPTL::V1;
+using namespace AsteriskSCF::Network::V1;
 using namespace AsteriskSCF::Replication::UDPTL::V1;
 using namespace AsteriskSCF::System::Logging;
 using namespace AsteriskSCF::UDPTL;
@@ -188,29 +189,20 @@ void StreamSourceUDPTLImpl::requestFormat(const AsteriskSCF::Media::V1::FormatPt
 }
 
 /**
- * Implementation of the getLocalAddress method as defined in MediaUDPTLIf.ice
+ * Implementation of the getLocalDetails method as defined in NetworkIf.ice
  */
-std::string StreamSourceUDPTLImpl::getLocalAddress(const Ice::Current&)
+AddressInformation StreamSourceUDPTLImpl::getLocalDetails(const Ice::Current&)
 {
     AsteriskSCF::Helpers::AddressPtr addr = mImpl->mTransport->localAddress();
-    if (addr)
-    {
-        return addr->hostname();
-    }
-    return "";
-}
+    AddressInformation info;
 
-/**
- * Implementation of the getLocalPort method as defined in MediaUDPTLIf.ice
- */
-Ice::Int StreamSourceUDPTLImpl::getLocalPort(const Ice::Current&)
-{
-    AsteriskSCF::Helpers::AddressPtr addr = mImpl->mTransport->localAddress();
     if (addr)
     {
-        return addr->port();
+        info.ipAddress = addr->hostname();
+        info.port = addr->port();
     }
-    return 0;
+
+    return info;
 }
 
 /**
diff --git a/src/UDPTLSource.h b/src/UDPTLSource.h
index 20c0679..fede4a7 100644
--- a/src/UDPTLSource.h
+++ b/src/UDPTLSource.h
@@ -37,8 +37,8 @@ public:
     AsteriskSCF::Media::V1::FormatSeq getFormats(const Ice::Current&);
     std::string getId(const Ice::Current&);
     void requestFormat(const AsteriskSCF::Media::V1::FormatPtr&, const Ice::Current&);
-    std::string getLocalAddress(const Ice::Current&);
-    Ice::Int getLocalPort(const Ice::Current&);
+
+    AsteriskSCF::Network::V1::AddressInformation getLocalDetails(const Ice::Current&);
 
     void setRemoteDetails(const std::string& address, Ice::Int port);
     void setSinksImpl(const AsteriskSCF::Media::V1::StreamSinkSeq&);
diff --git a/test/TestMediaTransportUDPTL.cpp b/test/TestMediaTransportUDPTL.cpp
index c6898f0..43fc9ed 100644
--- a/test/TestMediaTransportUDPTL.cpp
+++ b/test/TestMediaTransportUDPTL.cpp
@@ -34,6 +34,7 @@
 #include <AsteriskSCF/Core/Discovery/ServiceLocatorIf.h>
 #include <AsteriskSCF/Media/MediaIf.h>
 #include <AsteriskSCF/Media/UDPTL/MediaUDPTLIf.h>
+#include <AsteriskSCF/Media/NetworkIf.h>
 
 #include "UdptlStateReplicationIf.h"
 
@@ -43,6 +44,7 @@ using namespace AsteriskSCF::Media;
 using namespace AsteriskSCF::Media::V1;
 using namespace AsteriskSCF::Media::UDPTL::V1;
 using namespace AsteriskSCF::Replication::UDPTL::V1;
+using namespace AsteriskSCF::Network::V1;
 
 /**
  * Test service, for loading into icebox
@@ -470,7 +472,9 @@ BOOST_AUTO_TEST_CASE(ConfirmInitialReplicatedUDPTLSession)
     StreamSourceSeq sources = Testbed.session->getSources();
     StreamSourceUDPTLPrx source = StreamSourceUDPTLPrx::uncheckedCast(sources.front());
     BOOST_CHECK(Testbed.mListener->mSession->sourceIdentity == source->ice_getIdentity());
-    BOOST_CHECK(Testbed.mListener->mSession->port == source->getLocalPort());
+
+    AddressInformation info = source->getLocalDetails();
+    BOOST_CHECK(Testbed.mListener->mSession->port == info.port);
 }
 
 /**
@@ -535,7 +539,7 @@ BOOST_AUTO_TEST_CASE(VerifyLocalAddressonSources)
         for (StreamSourceSeq::const_iterator i = sources.begin(); i != sources.end(); ++i)
         {
             StreamSourceUDPTLPrx source = StreamSourceUDPTLPrx::checkedCast((*i));
-            std::string address = source->getLocalAddress();
+            AddressInformation info = source->getLocalDetails();
 
 #ifdef IPV6_TEST
         std::string valid_char = ":";
@@ -543,7 +547,7 @@ BOOST_AUTO_TEST_CASE(VerifyLocalAddressonSources)
         std::string valid_char = ".";
 #endif
 
-            if (address.empty() || !source->getLocalPort() || address.find(valid_char) == string::npos)
+            if (info.ipAddress.empty() || !info.port || info.ipAddress.find(valid_char) == string::npos)
             {
                 validaddresses = false;
             }
@@ -605,8 +609,9 @@ BOOST_AUTO_TEST_CASE(ConfirmBlankRemoteAddressonSinks)
         for (StreamSinkSeq::const_iterator i = sinks.begin(); i != sinks.end(); ++i)
         {
             StreamSinkUDPTLPrx sink = StreamSinkUDPTLPrx::checkedCast((*i));
+            AddressInformation info = sink->getRemoteDetails();
 
-            if ((!sink->getRemoteAddress().empty() && sink->getRemoteAddress() != "0.0.0.0") || sink->getRemotePort())
+            if ((!info.ipAddress.empty() && info.ipAddress != "0.0.0.0") || info.port)
             {
                 hasaddresses = true;
             }
@@ -697,7 +702,8 @@ BOOST_AUTO_TEST_CASE(ConfirmRemoteUDPTLAddressSetting)
 #endif
             sink->setRemoteDetails(address, 10000);
 
-            if (sink->getRemoteAddress() == address && sink->getRemotePort() == 10000)
+            AddressInformation info = sink->getRemoteDetails();
+            if (info.ipAddress == address && info.port == 10000)
             {
                 set = true;
             }
@@ -766,16 +772,15 @@ BOOST_AUTO_TEST_CASE(SetupUDPTLLoopback)
          */
         StreamSourceSeq sources = Testbed.session->getSources();
         StreamSourceUDPTLPrx source = StreamSourceUDPTLPrx::uncheckedCast(sources.front());
-        string address = source->getLocalAddress();
-        int port = source->getLocalPort();
+        AddressInformation info = source->getLocalDetails();
 
         /* Okay, changing the remote details of the first sink should have it send media to the above. */
         StreamSinkSeq sinks = Testbed.session->getSinks();
         StreamSinkUDPTLPrx sink = StreamSinkUDPTLPrx::uncheckedCast(sinks.front());
 
-    boost::mutex::scoped_lock lock(Testbed.mLock);
-
-        sink->setRemoteDetails(address, port);
+        boost::mutex::scoped_lock lock(Testbed.mLock);
+    
+        sink->setRemoteDetails(info.ipAddress, info.port);
 
         looped = true;
 
@@ -864,9 +869,10 @@ BOOST_AUTO_TEST_CASE(ConfirmPopulatedReplicatedUDPTLSink)
 {
     StreamSourceSeq sources = Testbed.session->getSources();
     StreamSourceUDPTLPrx source = StreamSourceUDPTLPrx::uncheckedCast(sources.front());
+    AddressInformation info = source->getLocalDetails();
 
-    BOOST_CHECK(Testbed.mListener->mSink->remoteAddress == source->getLocalAddress());
-    BOOST_CHECK(Testbed.mListener->mSink->remotePort == source->getLocalPort());
+    BOOST_CHECK(Testbed.mListener->mSink->remoteAddress == info.ipAddress);
+    BOOST_CHECK(Testbed.mListener->mSink->remotePort == info.port);
     BOOST_CHECK(Testbed.mListener->mSink->farMaxDatagram == 1000);
     BOOST_CHECK(Testbed.mListener->mSink->errorCorrectionScheme == AsteriskSCF::Media::UDPTL::V1::REDUNDANCY);
 }

-----------------------------------------------------------------------


-- 
asterisk-scf/integration/mediatransportudptl.git



More information about the asterisk-scf-commits mailing list