summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2011-09-28 20:01:57 (GMT)
committerRemko Tronçon <git@el-tramo.be>2011-09-29 18:07:17 (GMT)
commitdfccb5703c4d85ab1a54429016b103101bdc54ae (patch)
tree05ac257e6dc7609a5b02e94e59b52f44b74f123d /Swiften/Network/UPnPNATTraversalGetPublicIPRequest.cpp
parent6cea7fdfea93e54543c6757909a8fae7348754fc (diff)
downloadswift-contrib-dfccb5703c4d85ab1a54429016b103101bdc54ae.zip
swift-contrib-dfccb5703c4d85ab1a54429016b103101bdc54ae.tar.bz2
File Transfer refactoring.
NAT traversal classes refactoring. Added beginnings of a NetworkTool.
Diffstat (limited to 'Swiften/Network/UPnPNATTraversalGetPublicIPRequest.cpp')
-rw-r--r--Swiften/Network/UPnPNATTraversalGetPublicIPRequest.cpp57
1 files changed, 0 insertions, 57 deletions
diff --git a/Swiften/Network/UPnPNATTraversalGetPublicIPRequest.cpp b/Swiften/Network/UPnPNATTraversalGetPublicIPRequest.cpp
deleted file mode 100644
index 4ed2f5f..0000000
--- a/Swiften/Network/UPnPNATTraversalGetPublicIPRequest.cpp
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (c) 2011 Tobias Markmann
- * Licensed under the simplified BSD license.
- * See Documentation/Licenses/BSD-simplified.txt for more information.
- */
-
-#include "UPnPNATTraversalGetPublicIPRequest.h"
-
-#include <miniupnpc.h>
-#include <upnpcommands.h>
-#include <upnperrors.h>
-
-namespace Swift {
-
-UPnPNATTraversalGetPublicIPRequest::UPnPNATTraversalGetPublicIPRequest(PlatformNATTraversalWorker* worker) : PlatformNATTraversalRequest(worker) {
-
-}
-
-UPnPNATTraversalGetPublicIPRequest::~UPnPNATTraversalGetPublicIPRequest() {
-
-}
-
-void UPnPNATTraversalGetPublicIPRequest::runBlocking() {
- boost::optional<HostAddress> result;
-
- UPNPDev* deviceList = 0;
- int error = 0;
- char lanAddrress[64];
- char externalIPAddress[40];
- UPNPUrls urls;
- IGDdatas data;
-
- do {
- // find valid IGD
- deviceList = upnpDiscover(1500 /* timeout in ms */, 0, 0, 0, 0 /* do IPv6? */, &error);
- if (!deviceList) {
- break;
- }
-
- if (!UPNP_GetValidIGD(deviceList, &urls, &data, lanAddrress, sizeof(lanAddrress))) {
- break;
- }
-
- int ret = UPNP_GetExternalIPAddress(urls.controlURL, data.first.servicetype, externalIPAddress);
- if (ret != UPNPCOMMAND_SUCCESS) {
- break;
- } else {
- result = HostAddress(std::string(externalIPAddress));
- }
- } while(false);
-
- freeUPNPDevlist(deviceList); deviceList = 0;
-
- onResult(result);
-}
-
-}