summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2011-09-24 18:18:28 (GMT)
committerRemko Tronçon <git@el-tramo.be>2011-09-25 17:42:32 (GMT)
commit94f87ffc9769f2782b2267db813854b0fe752678 (patch)
tree56244712ade2be0d4a0a093d7721d18050e74f87 /Swiften/FileTransfer/ConnectivityManager.cpp
parent4f62e5ec4b42929fe3c1a68667e63cb1b7a35509 (diff)
downloadswift-contrib-94f87ffc9769f2782b2267db813854b0fe752678.zip
swift-contrib-94f87ffc9769f2782b2267db813854b0fe752678.tar.bz2
File transfer changes.
- Introduce 'experimental' flag to conditionally compile FT. - Use LibMiniUPNPC and NATPMP CPPDEFINES only locally in the classes that need them. - Extract abstract interface from NAT traversal classes - Avoid unit test warnings
Diffstat (limited to 'Swiften/FileTransfer/ConnectivityManager.cpp')
-rw-r--r--Swiften/FileTransfer/ConnectivityManager.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/Swiften/FileTransfer/ConnectivityManager.cpp b/Swiften/FileTransfer/ConnectivityManager.cpp
index 174d6ab..cfb0729 100644
--- a/Swiften/FileTransfer/ConnectivityManager.cpp
+++ b/Swiften/FileTransfer/ConnectivityManager.cpp
@@ -6,17 +6,19 @@
#include "ConnectivityManager.h"
+#include <boost/bind.hpp>
+
#include <Swiften/Base/foreach.h>
#include <Swiften/Base/Log.h>
#include <Swiften/Network/NetworkInterface.h>
-#include <Swiften/Network/PlatformNATTraversalGetPublicIPRequest.h>
-#include <Swiften/Network/PlatformNATTraversalRemovePortForwardingRequest.h>
-#include <Swiften/Network/PlatformNATTraversalWorker.h>
+#include <Swiften/Network/NATTraversalGetPublicIPRequest.h>
+#include <Swiften/Network/NATTraversalRemovePortForwardingRequest.h>
+#include <Swiften/Network/NATTraverser.h>
#include <Swiften/Network/PlatformNetworkEnvironment.h>
namespace Swift {
-ConnectivityManager::ConnectivityManager(PlatformNATTraversalWorker* worker) : natTraversalWorker(worker) {
+ConnectivityManager::ConnectivityManager(NATTraverser* worker) : natTraversalWorker(worker) {
}
@@ -29,13 +31,13 @@ ConnectivityManager::~ConnectivityManager() {
void ConnectivityManager::addListeningPort(int port) {
ports.insert(port);
- boost::shared_ptr<PlatformNATTraversalGetPublicIPRequest> getIPRequest = natTraversalWorker->createGetPublicIPRequest();
+ boost::shared_ptr<NATTraversalGetPublicIPRequest> getIPRequest = natTraversalWorker->createGetPublicIPRequest();
if (getIPRequest) {
getIPRequest->onResult.connect(boost::bind(&ConnectivityManager::natTraversalGetPublicIPResult, this, _1));
getIPRequest->run();
}
- boost::shared_ptr<PlatformNATTraversalForwardPortRequest> forwardPortRequest = natTraversalWorker->createForwardPortRequest(port, port);
+ boost::shared_ptr<NATTraversalForwardPortRequest> forwardPortRequest = natTraversalWorker->createForwardPortRequest(port, port);
if (forwardPortRequest) {
forwardPortRequest->onResult.connect(boost::bind(&ConnectivityManager::natTraversalForwardPortResult, this, _1));
forwardPortRequest->run();
@@ -45,7 +47,7 @@ void ConnectivityManager::addListeningPort(int port) {
void ConnectivityManager::removeListeningPort(int port) {
SWIFT_LOG(debug) << "remove listening port " << port << std::endl;
ports.erase(port);
- boost::shared_ptr<PlatformNATTraversalRemovePortForwardingRequest> removePortForwardingRequest = natTraversalWorker->createRemovePortForwardingRequest(port, port);
+ boost::shared_ptr<NATTraversalRemovePortForwardingRequest> removePortForwardingRequest = natTraversalWorker->createRemovePortForwardingRequest(port, port);
if (removePortForwardingRequest) {
removePortForwardingRequest->run();
}
@@ -89,7 +91,7 @@ void ConnectivityManager::natTraversalGetPublicIPResult(boost::optional<HostAddr
}
}
-void ConnectivityManager::natTraversalForwardPortResult(boost::optional<PlatformNATTraversalForwardPortRequest::PortMapping> mapping) {
+void ConnectivityManager::natTraversalForwardPortResult(boost::optional<NATTraversalForwardPortRequest::PortMapping> mapping) {
if (mapping) {
SWIFT_LOG(debug) << "Mapping port was successful." << std::endl;
} else {