linuxdcpp-team team mailing list archive
-
linuxdcpp-team team
-
Mailing list archive
-
Message #06202
[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 3090: Remove the "Windows UPnP" port mapper in favor of MiniUPnP
------------------------------------------------------------
revno: 3090
committer: poy <poy@xxxxxxxxxx>
branch nick: trunk
timestamp: Sat 2012-10-27 16:30:14 +0200
message:
Remove the "Windows UPnP" port mapper in favor of MiniUPnP
removed:
dcpp/Mapper_WinUPnP.cpp
dcpp/Mapper_WinUPnP.h
mingw/preload/natupnp.h
modified:
SConstruct
changelog.txt
dcpp/MappingManager.cpp
help/settings_connectivity_manual.html
mingw/preload/htmlhelp.h
utils/portmap.cpp
--
lp:dcplusplus
https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk
Your team Dcplusplus-team is subscribed to branch lp:dcplusplus.
To unsubscribe from this branch go to https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk/+edit-subscription
=== modified file 'SConstruct'
--- SConstruct 2012-10-06 03:20:43 +0000
+++ SConstruct 2012-10-27 14:30:14 +0000
@@ -265,8 +265,6 @@
conf = Configure(env, conf_dir = dev.get_build_path('.sconf_temp'), log_file = dev.get_build_path('config.log'), clean = False, help = False)
if conf.CheckCXXHeader(['windows.h', 'htmlhelp.h'], '<>'):
conf.env.Append(CPPDEFINES='HAVE_HTMLHELP_H')
-if conf.CheckCXXHeader('natupnp.h', '<>'):
- conf.env.Append(CPPDEFINES='HAVE_NATUPNP_H')
env = conf.Finish()
dev.boost = dev.build('boost/')
=== modified file 'changelog.txt'
--- changelog.txt 2012-10-27 14:16:21 +0000
+++ changelog.txt 2012-10-27 14:30:14 +0000
@@ -1,6 +1,8 @@
* Fix a race condition on file list download (thanks bigmuscle)
* [L#668548] Fix a potential infinite loop in BufferedSocket->setDataMode (crise)
* Add "chunked" transfer encoding as per the HTTP/1.1 spec (crise)
+* [L#1072041] Fix DPI conversion problems (poy
+* Remove the "Windows UPnP" port mapper in favor of MiniUPnP (poy)
-- 0.802 2012-10-20 --
* Perf improvements using lock-free queues, requires P6 CPUs (poy)
@@ -10,7 +12,6 @@
* Plug resource leaks (poy)
* [L#411484] [ADC] Fix BLOM when h > 32 (thanks yorhel)
* [L#198416] Fix a crash when closing the download queue (poy)
-* [L#1072041] Fix DPI conversion problems (poy)
-- 0.801 2012-09-29 --
* [L#1029629] Prevent crashes on heavy use by updating Boost.Atomic
=== removed file 'dcpp/Mapper_WinUPnP.cpp'
--- dcpp/Mapper_WinUPnP.cpp 2012-06-18 15:56:01 +0000
+++ dcpp/Mapper_WinUPnP.cpp 1970-01-01 00:00:00 +0000
@@ -1,214 +0,0 @@
-/*
- * Copyright (C) 2001-2012 Jacek Sieka, arnetheduck on gmail point com
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#include "stdinc.h"
-#include "Mapper_WinUPnP.h"
-
-#include "Util.h"
-#include "Text.h"
-#include "w.h"
-
-#ifdef HAVE_NATUPNP_H
-#include <ole2.h>
-#include <natupnp.h>
-#else // HAVE_NATUPNP_H
-struct IUPnPNAT { };
-struct IStaticPortMappingCollection { };
-#endif // HAVE_NATUPNP_H
-
-namespace dcpp {
-
-const string Mapper_WinUPnP::name = "Windows UPnP";
-
-Mapper_WinUPnP::Mapper_WinUPnP(string&& localIp) :
-Mapper(move(localIp)),
-pUN(0),
-lastPort(0)
-{
-}
-
-#ifdef HAVE_NATUPNP_H
-
-bool Mapper_WinUPnP::init() {
- HRESULT hr = ::CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
- if(FAILED(hr))
- return false;
-
- if(pUN)
- return true;
-
- // Lacking the __uuidof in mingw...
- CLSID upnp;
- OLECHAR upnps[] = L"{AE1E00AA-3FD5-403C-8A27-2BBDC30CD0E1}";
- CLSIDFromString(upnps, &upnp);
- IID iupnp;
- OLECHAR iupnps[] = L"{B171C812-CC76-485A-94D8-B6B3A2794E99}";
- CLSIDFromString(iupnps, &iupnp);
- pUN = 0;
- hr = ::CoCreateInstance(upnp, 0, CLSCTX_INPROC_SERVER, iupnp, reinterpret_cast<LPVOID*>(&pUN));
- if(FAILED(hr))
- pUN = 0;
- return pUN;
-}
-
-void Mapper_WinUPnP::uninit() {
- ::CoUninitialize();
-}
-
-bool Mapper_WinUPnP::add(const string& port, const Protocol protocol, const string& description) {
- IStaticPortMappingCollection* pSPMC = getStaticPortMappingCollection();
- if(!pSPMC)
- return false;
-
- /// @todo use a BSTR wrapper
- BSTR protocol_ = SysAllocString(Text::toT(protocols[protocol]).c_str());
- BSTR description_ = SysAllocString(Text::toT(description).c_str());
- BSTR localIP = SysAllocString(Text::toT(localIp).c_str());
- auto port_ = Util::toInt(port);
-
- IStaticPortMapping* pSPM = 0;
- HRESULT hr = pSPMC->Add(port_, protocol_, port_, localIP, VARIANT_TRUE, description_, &pSPM);
-
- SysFreeString(protocol_);
- SysFreeString(description_);
- SysFreeString(localIP);
-
- bool ret = SUCCEEDED(hr);
- if(ret) {
- pSPM->Release();
-
- lastPort = port_;
- lastProtocol = protocol;
- }
- pSPMC->Release();
- return ret;
-}
-
-bool Mapper_WinUPnP::remove(const string& port, const Protocol protocol) {
- IStaticPortMappingCollection* pSPMC = getStaticPortMappingCollection();
- if(!pSPMC)
- return false;
-
- /// @todo use a BSTR wrapper
- BSTR protocol_ = SysAllocString(Text::toT(protocols[protocol]).c_str());
- auto port_ = Util::toInt(port);
-
- HRESULT hr = pSPMC->Remove(port_, protocol_);
- pSPMC->Release();
-
- SysFreeString(protocol_);
-
- bool ret = SUCCEEDED(hr);
- if(ret && port_ == lastPort && protocol == lastProtocol) {
- lastPort = 0;
- }
- return ret;
-}
-
-string Mapper_WinUPnP::getDeviceName() {
- /// @todo use IUPnPDevice::ModelName <http://msdn.microsoft.com/en-us/library/aa381670(VS.85).aspx>?
- return Util::emptyString;
-}
-
-string Mapper_WinUPnP::getExternalIP() {
- // Get the External IP from the last added mapping
- if(!lastPort)
- return Util::emptyString;
-
- IStaticPortMappingCollection* pSPMC = getStaticPortMappingCollection();
- if(!pSPMC)
- return Util::emptyString;
-
- /// @todo use a BSTR wrapper
- BSTR protocol_ = SysAllocString(Text::toT(protocols[lastProtocol]).c_str());
-
- // Lets Query our mapping
- IStaticPortMapping* pSPM;
- HRESULT hr = pSPMC->get_Item(lastPort, protocol_, &pSPM);
-
- SysFreeString(protocol_);
-
- // Query failed!
- if(FAILED(hr) || !pSPM) {
- pSPMC->Release();
- return Util::emptyString;
- }
-
- BSTR bstrExternal = 0;
- hr = pSPM->get_ExternalIPAddress(&bstrExternal);
- if(FAILED(hr) || !bstrExternal) {
- pSPM->Release();
- pSPMC->Release();
- return Util::emptyString;
- }
-
- // convert the result
- string ret = Text::wideToAcp(bstrExternal);
-
- // no longer needed
- SysFreeString(bstrExternal);
-
- // no longer needed
- pSPM->Release();
- pSPMC->Release();
-
- return ret;
-}
-
-IStaticPortMappingCollection* Mapper_WinUPnP::getStaticPortMappingCollection() {
- if(!pUN)
- return 0;
- IStaticPortMappingCollection* ret = 0;
- HRESULT hr = pUN->get_StaticPortMappingCollection(&ret);
- if(FAILED(hr))
- return 0;
- return ret;
-}
-
-#else // HAVE_NATUPNP_H
-
-bool Mapper_WinUPnP::init() {
- return false;
-}
-
-void Mapper_WinUPnP::uninit() {
-}
-
-bool Mapper_WinUPnP::add(const string& port, const Protocol protocol, const string& description) {
- return false;
-}
-
-bool Mapper_WinUPnP::remove(const string& port, const Protocol protocol) {
- return false;
-}
-
-string Mapper_WinUPnP::getDeviceName() {
- return Util::emptyString;
-}
-
-string Mapper_WinUPnP::getExternalIP() {
- return Util::emptyString;
-}
-
-IStaticPortMappingCollection* Mapper_WinUPnP::getStaticPortMappingCollection() {
- return 0;
-}
-
-#endif // HAVE_NATUPNP_H
-
-} // dcpp namespace
=== removed file 'dcpp/Mapper_WinUPnP.h'
--- dcpp/Mapper_WinUPnP.h 2012-01-13 20:55:20 +0000
+++ dcpp/Mapper_WinUPnP.h 1970-01-01 00:00:00 +0000
@@ -1,62 +0,0 @@
-/*
- * Copyright (C) 2001-2012 Jacek Sieka, arnetheduck on gmail point com
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#ifndef DCPLUSPLUS_DCPP_MAPPER_WINUPNP_H
-#define DCPLUSPLUS_DCPP_MAPPER_WINUPNP_H
-
-#include "Mapper.h"
-
-struct IUPnPNAT;
-struct IStaticPortMappingCollection;
-
-namespace dcpp {
-
-/// @todo this class is far from complete (should register callbacks, etc)
-class Mapper_WinUPnP : public Mapper
-{
-public:
- Mapper_WinUPnP(string&& localIp);
-
- static const string name;
-
-private:
- bool init();
- void uninit();
-
- bool add(const string& port, const Protocol protocol, const string& description);
- bool remove(const string& port, const Protocol protocol);
-
- uint32_t renewal() const { return 0; }
-
- string getDeviceName();
- string getExternalIP();
-
- const string& getName() const { return name; }
-
- IUPnPNAT* pUN;
- // this one can become invalid so we can't cache it
- IStaticPortMappingCollection* getStaticPortMappingCollection();
-
- // need to save these to get the external IP...
- long lastPort;
- Protocol lastProtocol;
-};
-
-} // dcpp namespace
-
-#endif
=== modified file 'dcpp/MappingManager.cpp'
--- dcpp/MappingManager.cpp 2012-09-03 19:14:25 +0000
+++ dcpp/MappingManager.cpp 2012-10-27 14:30:14 +0000
@@ -25,7 +25,6 @@
#include "LogManager.h"
#include "Mapper_MiniUPnPc.h"
#include "Mapper_NATPMP.h"
-#include "Mapper_WinUPnP.h"
#include "ScopedFunctor.h"
#include "SearchManager.h"
#include "version.h"
@@ -37,7 +36,6 @@
MappingManager::MappingManager() : renewal(0) {
addMapper<Mapper_NATPMP>();
addMapper<Mapper_MiniUPnPc>();
- addMapper<Mapper_WinUPnP>();
}
StringList MappingManager::getMappers() const {
=== modified file 'help/settings_connectivity_manual.html'
--- help/settings_connectivity_manual.html 2012-09-04 21:10:41 +0000
+++ help/settings_connectivity_manual.html 2012-10-27 14:30:14 +0000
@@ -99,8 +99,6 @@
<li>NAT-PMP: A lightweight protocol that is not widely used by generic routers; but
open-source firmwares generally implement it.</li>
<li>MiniUPnP: An open-source UPnP library.</li>
- <li>Windows UPnP: Use Windows discovery services. Note that the DC++ implementation of
- Windows UPnP is partial and prone to random failures. MiniUPnP is recommended instead.</li>
</ul>
The interface selected here will be tried first; other available interfaces will then be tried
if the preferred port mapping interface were to fail.
=== modified file 'mingw/preload/htmlhelp.h'
--- mingw/preload/htmlhelp.h 2012-09-17 18:25:16 +0000
+++ mingw/preload/htmlhelp.h 2012-10-27 14:30:14 +0000
@@ -6,13 +6,6 @@
#define __in_opt
#define _In_
#define _In_opt_
-#define __RPC__in
-#define __RPC__in_opt
-#define __RPC__in_xcount(x)
-#define __RPC__inout_xcount(x)
-#define __RPC__out
-#define __RPC__deref_out_opt
-#define __REQUIRED_RPCNDR_H_VERSION__ 400
#include_next <htmlhelp.h>
@@ -20,12 +13,5 @@
#undef __in_opt
#undef _In_
#undef _In_opt_
-#undef __RPC__in
-#undef __RPC__in_opt
-#undef __RPC__in_xcount
-#undef __RPC__inout_xcount
-#undef __RPC__out
-#undef __RPC__deref_out_opt
-#undef __REQUIRED_RPCNDR_H_VERSION__
#undef _MSC_VER
=== removed file 'mingw/preload/natupnp.h'
--- mingw/preload/natupnp.h 2012-09-17 18:25:16 +0000
+++ mingw/preload/natupnp.h 1970-01-01 00:00:00 +0000
@@ -1,31 +0,0 @@
-// support includes from recent MS SDKs.
-
-#define _MSC_VER 1400 // simulate a high enough version to make sure the include doesn't define junk
-
-#define __in
-#define __in_opt
-#define _In_
-#define _In_opt_
-#define __RPC__in
-#define __RPC__in_opt
-#define __RPC__in_xcount(x)
-#define __RPC__inout_xcount(x)
-#define __RPC__out
-#define __RPC__deref_out_opt
-#define __REQUIRED_RPCNDR_H_VERSION__ 400
-
-#include_next <natupnp.h>
-
-#undef __in
-#undef __in_opt
-#undef _In_
-#undef _In_opt_
-#undef __RPC__in
-#undef __RPC__in_opt
-#undef __RPC__in_xcount
-#undef __RPC__inout_xcount
-#undef __RPC__out
-#undef __RPC__deref_out_opt
-#undef __REQUIRED_RPCNDR_H_VERSION__
-
-#undef _MSC_VER
=== modified file 'utils/portmap.cpp'
--- utils/portmap.cpp 2012-09-09 13:55:46 +0000
+++ utils/portmap.cpp 2012-10-27 14:30:14 +0000
@@ -7,7 +7,6 @@
#include <dcpp/Mapper_MiniUPnPc.h>
#include <dcpp/Mapper_NATPMP.h>
-#include <dcpp/Mapper_WinUPnP.h>
#include <dcpp/ScopedFunctor.h>
#include <dcpp/Util.h>
#include <dcpp/w.h>
@@ -79,7 +78,6 @@
switch(argv[Method][0]) {
case '0': pMapper.reset(new Mapper_NATPMP(getLocalIp())); break;
case '1': pMapper.reset(new Mapper_MiniUPnPc(getLocalIp())); break;
- case '2': pMapper.reset(new Mapper_WinUPnP(getLocalIp())); break;
default: cout << "Error: invalid method." << endl; help(); return 1;
}
auto& mapper = *pMapper;