diff options
Diffstat (limited to 'Swiften/Network/NATPMPInterface.cpp')
| -rw-r--r-- | Swiften/Network/NATPMPInterface.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/Swiften/Network/NATPMPInterface.cpp b/Swiften/Network/NATPMPInterface.cpp index 0c33c1f..e20fecd 100644 --- a/Swiften/Network/NATPMPInterface.cpp +++ b/Swiften/Network/NATPMPInterface.cpp @@ -2,13 +2,13 @@ * Copyright (c) 2011 Tobias Markmann * Licensed under the simplified BSD license. * See Documentation/Licenses/BSD-simplified.txt for more information. */ /* - * Copyright (c) 2014-2018 Isode Limited. + * Copyright (c) 2014-2019 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #include <Swiften/Network/NATPMPInterface.h> @@ -39,13 +39,13 @@ NATPMPInterface::~NATPMPInterface() { bool NATPMPInterface::isAvailable() { 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; + SWIFT_LOG(debug) << "Failed to send NAT-PMP public address request!"; return boost::optional<HostAddress>(); } int r = 0; natpmpresp_t response; do { @@ -64,26 +64,26 @@ boost::optional<HostAddress> NATPMPInterface::getPublicIP() { } while (false /*r == NATPMP_TRYAGAIN*/); if (r == 0) { return boost::optional<HostAddress>(HostAddress(reinterpret_cast<const unsigned char*>(&(response.pnu.publicaddress.addr)), 4)); } else { - SWIFT_LOG(debug) << "Inavlid NAT-PMP response." << std::endl; + SWIFT_LOG(debug) << "Inavlid NAT-PMP response."; return boost::optional<HostAddress>(); } } boost::optional<NATPortMapping> NATPMPInterface::addPortForward(unsigned short localPort, unsigned short publicPort) { NATPortMapping mapping(localPort, publicPort, NATPortMapping::TCP); if (sendnewportmappingrequest( &p->natpmp, mapping.getProtocol() == NATPortMapping::TCP ? NATPMP_PROTOCOL_TCP : NATPMP_PROTOCOL_UDP, mapping.getLocalPort(), mapping.getPublicPort(), mapping.getLeaseInSeconds()) < 0) { - SWIFT_LOG(debug) << "Failed to send NAT-PMP port forwarding request!" << std::endl; + SWIFT_LOG(debug) << "Failed to send NAT-PMP port forwarding request!"; return boost::optional<NATPortMapping>(); } int r = 0; natpmpresp_t response; do { @@ -103,20 +103,20 @@ boost::optional<NATPortMapping> NATPMPInterface::addPortForward(unsigned short l if (r == 0) { NATPortMapping result(response.pnu.newportmapping.privateport, response.pnu.newportmapping.mappedpublicport, NATPortMapping::TCP, response.pnu.newportmapping.lifetime); return result; } else { - SWIFT_LOG(debug) << "Invalid NAT-PMP response." << std::endl; + SWIFT_LOG(debug) << "Invalid NAT-PMP response."; return boost::optional<NATPortMapping>(); } } bool NATPMPInterface::removePortForward(const NATPortMapping& mapping) { if (sendnewportmappingrequest(&p->natpmp, mapping.getProtocol() == NATPortMapping::TCP ? NATPMP_PROTOCOL_TCP : NATPMP_PROTOCOL_UDP, mapping.getLocalPort(), 0, 0) < 0) { - SWIFT_LOG(debug) << "Failed to send NAT-PMP remove forwarding request!" << std::endl; + SWIFT_LOG(debug) << "Failed to send NAT-PMP remove forwarding request!"; return false; } int r = 0; natpmpresp_t response; do { @@ -130,13 +130,13 @@ bool NATPMPInterface::removePortForward(const NATPortMapping& mapping) { } while(r == NATPMP_TRYAGAIN); if (r == 0) { return true; } else { - SWIFT_LOG(debug) << "Invalid NAT-PMP response." << std::endl; + SWIFT_LOG(debug) << "Invalid NAT-PMP response."; return false; } } } |
Swift