summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Network/NATPMPInterface.cpp')
-rw-r--r--Swiften/Network/NATPMPInterface.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/Swiften/Network/NATPMPInterface.cpp b/Swiften/Network/NATPMPInterface.cpp
index c7a41ff..dcae641 100644
--- a/Swiften/Network/NATPMPInterface.cpp
+++ b/Swiften/Network/NATPMPInterface.cpp
@@ -1,15 +1,21 @@
/*
* Copyright (c) 2011 Tobias Markmann
* Licensed under the simplified BSD license.
* See Documentation/Licenses/BSD-simplified.txt for more information.
*/
+/*
+* Copyright (c) 2014 Kevin Smith
+* Licensed under the GNU General Public License v3.
+* See Documentation/Licenses/GPLv3.txt for more information.
+*/
+
#include <Swiften/Network/NATPMPInterface.h>
#include <boost/smart_ptr/make_shared.hpp>
#include <boost/numeric/conversion/cast.hpp>
#include <Swiften/Base/Log.h>
// This has to be included after the previous headers, because of WIN32 macro
// being defined somewhere.
@@ -26,19 +32,19 @@ struct NATPMPInterface::Private {
NATPMPInterface::NATPMPInterface() : p(boost::make_shared<Private>()) {
initnatpmp(&p->natpmp, 0, 0);
}
NATPMPInterface::~NATPMPInterface() {
closenatpmp(&p->natpmp);
}
bool NATPMPInterface::isAvailable() {
- return getPublicIP();
+ return getPublicIP() ? true : false;
}
boost::optional<HostAddress> NATPMPInterface::getPublicIP() {
if (sendpublicaddressrequest(&p->natpmp) < 0) {
SWIFT_LOG(debug) << "Failed to send NAT-PMP public address request!" << std::endl;
return boost::optional<HostAddress>();
}
int r = 0;