diff options
Diffstat (limited to 'Swiften/Network/WindowsNetworkEnvironment.cpp')
-rw-r--r-- | Swiften/Network/WindowsNetworkEnvironment.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Swiften/Network/WindowsNetworkEnvironment.cpp b/Swiften/Network/WindowsNetworkEnvironment.cpp index 5163f43..0eedea0 100644 --- a/Swiften/Network/WindowsNetworkEnvironment.cpp +++ b/Swiften/Network/WindowsNetworkEnvironment.cpp @@ -1,16 +1,16 @@ /* * Copyright (c) 2011 Tobias Markmann * Licensed under the simplified BSD license. * See Documentation/Licenses/BSD-simplified.txt for more information. */ -#include "WindowsNetworkEnvironment.h" +#include <Swiften/Network/WindowsNetworkEnvironment.h> #include <string> #include <vector> #include <map> #include <boost/shared_ptr.hpp> #include <boost/smart_ptr/make_shared.hpp> #include <Swiften/Base/boost_bsignals.h> #include <Swiften/Network/HostAddress.h> @@ -27,21 +27,21 @@ std::string winSocketAddressToStdString(const SOCKET_ADDRESS& socketAddress) { std::string result; int ret = WSAAddressToString(socketAddress.lpSockaddr, socketAddress.iSockaddrLength, NULL, text, &bufferSize); if (ret == 0) { result.assign(text, sizeof(text)); } return result; } -std::vector<NetworkInterface::ref> WindowsNetworkEnvironment::getNetworkInterfaces() { - std::map<std::string, WindowsNetworkInterface::ref> interfaces; - std::vector<NetworkInterface::ref> result; +std::vector<NetworkInterface> WindowsNetworkEnvironment::getNetworkInterfaces() { + std::vector<NetworkInterface> result; + std::map<std::string, WindowsNetworkInterface> interfaces; IP_ADAPTER_ADDRESSES preBuffer[5]; PIP_ADAPTER_ADDRESSES adapterStart = preBuffer; ULONG bufferSize = sizeof(preBuffer); ULONG flags = GAA_FLAG_INCLUDE_ALL_INTERFACES | GAA_FLAG_INCLUDE_PREFIX | GAA_FLAG_SKIP_MULTICAST | GAA_FLAG_SKIP_DNS_SERVER; ULONG ret = GetAdaptersAddresses( AF_UNSPEC, flags, NULL, adapterStart, &bufferSize); @@ -72,26 +72,26 @@ std::vector<NetworkInterface::ref> WindowsNetworkEnvironment::getNetworkInterfac if (address->Address.lpSockaddr->sa_family == PF_INET || address->Address.lpSockaddr->sa_family == PF_INET6) { ip = winSocketAddressToStdString(address->Address); if (!ip.empty()) { if (interfaces.find(name) == interfaces.end()) { interfaces[name] = boost::make_shared<WindowsNetworkInterface>(); interfaces[name]->setName(name); } - interfaces[name]->addHostAddress(HostAddress(ip)); + interfaces[name]->addAddress(HostAddress(ip)); } } } } if (adapterStart != preBuffer) { //delete adapterStart; } - for(std::map<std::string, WindowsNetworkInterface::ref>::iterator i = interfaces.begin(); i != interfaces.end(); ++i) { + for (std::map<std::string, WindowsNetworkInterface>::const_iterator i = interfaces.begin(); i != interfaces.end(); ++i) { result.push_back(i->second); } return result; } } |