Allow UPnP mapping when USE_UPNP is defined and miniupnpc is installed at build time(statically linked).

Thanks joepie91 for the translation of the new copyright notices into Dutch.
Thanks sipa for the translation of the new copyright notices into French.
Thanks megu for the translation of the new copyright notices into Spanish.
Thanks justmoon/Blitzboom for the translation of the new copyright notices into German.
Thanks Joozero for the translation of the new copyright notices into Italian.
Remaining translations were provided by Google Translate.
This commit is contained in:
Matt Corallo 2011-03-26 13:01:27 +01:00
parent 454bc86479
commit 8bb5edc1c9
30 changed files with 362 additions and 32 deletions

View file

@ -3,7 +3,8 @@ Distributed under the MIT/X11 software license, see the accompanying
file license.txt or http://www.opensource.org/licenses/mit-license.php. file license.txt or http://www.opensource.org/licenses/mit-license.php.
This product includes software developed by the OpenSSL Project for use in This product includes software developed by the OpenSSL Project for use in
the OpenSSL Toolkit (http://www.openssl.org/). This product includes the OpenSSL Toolkit (http://www.openssl.org/). This product includes
cryptographic software written by Eric Young (eay@cryptsoft.com). cryptographic software written by Eric Young (eay@cryptsoft.com) and UPnP
software written by Thomas Bernard.
WINDOWS BUILD NOTES WINDOWS BUILD NOTES
@ -25,23 +26,26 @@ Dependencies
------------ ------------
Libraries you need to download separately and build: Libraries you need to download separately and build:
default path download default path download
wxWidgets \wxwidgets-2.9.1-mgw http://www.wxwidgets.org/downloads/ wxWidgets \wxwidgets-2.9.1-mgw http://www.wxwidgets.org/downloads/
OpenSSL \openssl-1.0.0c-mgw http://www.openssl.org/source/ OpenSSL \openssl-1.0.0c-mgw http://www.openssl.org/source/
Berkeley DB \db-4.7.25.NC-mgw http://www.oracle.com/technology/software/products/berkeley-db/index.html Berkeley DB \db-4.7.25.NC-mgw http://www.oracle.com/technology/software/products/berkeley-db/index.html
Boost \boost-1.43.0-mgw http://www.boost.org/users/download/ Boost \boost-1.43.0-mgw http://www.boost.org/users/download/
miniupnpc \upnpc-exe-win32-20110215 http://miniupnp.tuxfamily.org/files/
Their licenses: Their licenses:
wxWidgets LGPL 2.1 with very liberal exceptions wxWidgets LGPL 2.1 with very liberal exceptions
OpenSSL Old BSD license with the problematic advertising requirement OpenSSL Old BSD license with the problematic advertising requirement
Berkeley DB New BSD license with additional requirement that linked software must be free open source Berkeley DB New BSD license with additional requirement that linked software must be free open source
Boost MIT-like license Boost MIT-like license
miniupnpc New (3-clause) BSD license
Versions used in this release: Versions used in this release:
wxWidgets 2.9.1 wxWidgets 2.9.1
OpenSSL 1.0.0c OpenSSL 1.0.0c
Berkeley DB 4.7.25.NC Berkeley DB 4.7.25.NC
Boost 1.43.0 Boost 1.43.0
miniupnpc 1.5-20110215
Notes Notes
@ -90,6 +94,15 @@ Note:
building with boost 1.45.0 failed because of boost ticket 4614, 4258 building with boost 1.45.0 failed because of boost ticket 4614, 4258
builds fine with boost 1.43.0 builds fine with boost 1.43.0
MiniUPnPc
---------
Building miniupnpc failed on Windows Server 2003, thus it is expected that a binary copy will be used.
See http://miniupnp.tuxfamily.org/forum/viewtopic.php?t=642
UPnP support is optional, make with USE_UPNP= to disable it.
Get upnpc-exe-win32-20110215.zip and unzip it to \upnpc-exe-win32-20110215
Get miniupnpc-1.5.20110215.tar.gz and copy *.h to \upnpc-exe-win32-20110215\miniupnpc
Bitcoin Bitcoin
------- -------
DOS prompt: DOS prompt:

View file

@ -3,7 +3,8 @@ Distributed under the MIT/X11 software license, see the accompanying
file license.txt or http://www.opensource.org/licenses/mit-license.php. file license.txt or http://www.opensource.org/licenses/mit-license.php.
This product includes software developed by the OpenSSL Project for use in This product includes software developed by the OpenSSL Project for use in
the OpenSSL Toolkit (http://www.openssl.org/). This product includes the OpenSSL Toolkit (http://www.openssl.org/). This product includes
cryptographic software written by Eric Young (eay@cryptsoft.com). cryptographic software written by Eric Young (eay@cryptsoft.com) and UPnP
software written by Thomas Bernard.
Mac OS X build instructions Mac OS X build instructions
@ -108,11 +109,51 @@ file lib/libcrypto.a
output should look like this: output should look like this:
ib/libcrypto.a: Mach-O universal binary with 2 architectures lib/libcrypto.a: Mach-O universal binary with 2 architectures
lib/libcrypto.a (for architecture i386): current ar archive random library lib/libcrypto.a (for architecture i386): current ar archive random library
lib/libcrypto.a (for architecture x86_64): current ar archive random library lib/libcrypto.a (for architecture x86_64): current ar archive random library
miniupnpc
---------
The process for miniupnpc (optional) is similar to that of OpenSSL.
Download from http://miniupnp.tuxfamily.org/files/.
cd ~/bitcoin/deps
tar xvf ~/Downloads/miniupnpc-1.5.tar
mv miniupnpc-1.5 miniupnpc-1.5-x86_64
tar xvf ~/Downloads/miniupnpc-1.5.tar
mv miniupnpc-1.5 miniupnpc-1.5-i386
# build x86_64 (64 bit intel) binary
cd miniupnpc-1.5-x86_64
export CFLAGS="-arch x86_64"
export LDFLAGS="-arch x86_64"
export PREFIX="/Users/macuser/bitcoin/deps"
make && make install
# build i386 (32 bit intel) binary
cd miniupnpc-1.5-i386
export CFLAGS="-arch i386"
export LDFLAGS="-arch i386"
export PREFIX="/Users/macuser/bitcoin/deps"
make
# combine the libs
cd ~/bitcoin/deps
lipo -arch i386 miniupnpc-1.5-i386/libminiupnpc.a -arch x86_64 miniupnpc-1.5-x86_64/libminiupnpc.a -o lib/libminiupnpc.a -create
Verify your binaries
file lib/libminiupnpc.a
output should look like this:
lib/libminiupnpc.a: Mach-O universal binary with 2 architectures
lib/libminiupnpc.a (for architecture i386): current ar archive random library
lib/libminiupnpc.a (for architecture x86_64): current ar archive random library
Berkeley DB Berkeley DB
----------- -----------

View file

@ -3,7 +3,8 @@ Distributed under the MIT/X11 software license, see the accompanying
file license.txt or http://www.opensource.org/licenses/mit-license.php. file license.txt or http://www.opensource.org/licenses/mit-license.php.
This product includes software developed by the OpenSSL Project for use in This product includes software developed by the OpenSSL Project for use in
the OpenSSL Toolkit (http://www.openssl.org/). This product includes the OpenSSL Toolkit (http://www.openssl.org/). This product includes
cryptographic software written by Eric Young (eay@cryptsoft.com). cryptographic software written by Eric Young (eay@cryptsoft.com) and UPnP
software written by Thomas Bernard.
UNIX BUILD NOTES UNIX BUILD NOTES
@ -36,10 +37,15 @@ You need to download wxWidgets from http://www.wxwidgets.org/downloads/
and build it yourself. See the build instructions and configure parameters and build it yourself. See the build instructions and configure parameters
below. below.
Requires miniupnpc for UPnP port mapping. To compile with UPnP support,
install miniupnpc and compile after setting USE_UPNP. It can be downloaded
from http://miniupnp.tuxfamily.org/files/.
Licenses of statically linked libraries: Licenses of statically linked libraries:
wxWidgets LGPL 2.1 with very liberal exceptions wxWidgets LGPL 2.1 with very liberal exceptions
Berkeley DB New BSD license with additional requirement that linked software must be free open source Berkeley DB New BSD license with additional requirement that linked software must be free open source
Boost MIT-like license Boost MIT-like license
miniupnpc New (3-clause) BSD license
Versions used in this release: Versions used in this release:
GCC 4.3.3 GCC 4.3.3
@ -47,6 +53,7 @@ OpenSSL 0.9.8g
wxWidgets 2.9.0 wxWidgets 2.9.0
Berkeley DB 4.7.25.NC Berkeley DB 4.7.25.NC
Boost 1.37 Boost 1.37
miniupnpc 1.5
Notes Notes
@ -73,6 +80,15 @@ make install
ldconfig ldconfig
miniupnpc
---------
tar -xzvf miniupnpc-1.5.tar.gz
cd miniupnpc-1.5
make
sudo su
make install
Berkeley DB Berkeley DB
----------- -----------
You need Berkeley DB 4.7. Don't use 4.8, the database/log0000* files You need Berkeley DB 4.7. Don't use 4.8, the database/log0000* files

4
db.cpp
View file

@ -790,7 +790,7 @@ bool CWalletDB::LoadWallet()
if (strKey == "fMinimizeOnClose") ssValue >> fMinimizeOnClose; if (strKey == "fMinimizeOnClose") ssValue >> fMinimizeOnClose;
if (strKey == "fUseProxy") ssValue >> fUseProxy; if (strKey == "fUseProxy") ssValue >> fUseProxy;
if (strKey == "addrProxy") ssValue >> addrProxy; if (strKey == "addrProxy") ssValue >> addrProxy;
if (fHaveUPnP && strKey == "fUseUPnP") ssValue >> fUseUPnP;
} }
} }
pcursor->close(); pcursor->close();
@ -807,6 +807,8 @@ bool CWalletDB::LoadWallet()
printf("fMinimizeOnClose = %d\n", fMinimizeOnClose); printf("fMinimizeOnClose = %d\n", fMinimizeOnClose);
printf("fUseProxy = %d\n", fUseProxy); printf("fUseProxy = %d\n", fUseProxy);
printf("addrProxy = %s\n", addrProxy.ToString().c_str()); printf("addrProxy = %s\n", addrProxy.ToString().c_str());
if (fHaveUPnP)
printf("fUseUPnP = %d\n", fUseUPnP);
// Upgrade // Upgrade

View file

@ -157,6 +157,13 @@ bool AppInit2(int argc, char* argv[])
" -addnode=<ip> \t " + _("Add a node to connect to\n") + " -addnode=<ip> \t " + _("Add a node to connect to\n") +
" -connect=<ip> \t\t " + _("Connect only to the specified node\n") + " -connect=<ip> \t\t " + _("Connect only to the specified node\n") +
" -nolisten \t " + _("Don't accept connections from outside\n") + " -nolisten \t " + _("Don't accept connections from outside\n") +
#ifdef USE_UPNP
#if USE_UPNP
" -noupnp \t " + _("Don't attempt to use UPnP to map the listening port\n") +
#else
" -upnp \t " + _("Attempt to use UPnP to map the listening port\n") +
#endif
#endif
" -paytxfee=<amt> \t " + _("Fee per KB to add to transactions you send\n") + " -paytxfee=<amt> \t " + _("Fee per KB to add to transactions you send\n") +
#ifdef GUI #ifdef GUI
" -server \t\t " + _("Accept command line and JSON-RPC commands\n") + " -server \t\t " + _("Accept command line and JSON-RPC commands\n") +
@ -449,6 +456,17 @@ bool AppInit2(int argc, char* argv[])
wxMessageBox(_("Warning: -paytxfee is set very high. This is the transaction fee you will pay if you send a transaction."), "Bitcoin", wxOK | wxICON_EXCLAMATION); wxMessageBox(_("Warning: -paytxfee is set very high. This is the transaction fee you will pay if you send a transaction."), "Bitcoin", wxOK | wxICON_EXCLAMATION);
} }
if (fHaveUPnP)
{
#if USE_UPNP
if (GetBoolArg("-noupnp"))
fUseUPnP = false;
#else
if (GetBoolArg("-upnp"))
fUseUPnP = true;
#endif
}
// //
// Create the main window and start the node // Create the main window and start the node
// //

Binary file not shown.

View file

@ -1,9 +1,11 @@
# DataWraith <DataWraith@web.de>, 2010. # DataWraith <DataWraith@web.de>, 2010.
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: \n"
"POT-Creation-Date: 2010-05-26 22:02-0000\n" "POT-Creation-Date: 2010-05-26 22:02-0000\n"
"PO-Revision-Date: 2010-06-03 13:11+0200\n" "PO-Revision-Date: 2010-06-03 13:11+0200\n"
"Last-Translator: DataWraith\n" "Last-Translator: DataWraith\n"
"Language-Team: \n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
@ -707,7 +709,7 @@ msgid ""
"\n" "\n"
"This product includes software developed by the OpenSSL Project for use in the \n" "This product includes software developed by the OpenSSL Project for use in the \n"
"OpenSSL Toolkit (http://www.openssl.org/) and cryptographic software written by \n" "OpenSSL Toolkit (http://www.openssl.org/) and cryptographic software written by \n"
"Eric Young (eay@cryptsoft.com)." "Eric Young (eay@cryptsoft.com) and UPnP software written by Thomas Bernard."
msgstr "" msgstr ""
"Copyright (c) 2009-2010 Bitcoin Developers\n" "Copyright (c) 2009-2010 Bitcoin Developers\n"
"\n" "\n"
@ -718,7 +720,8 @@ msgstr ""
"\n" "\n"
"Dieses Produkt enthält Software, die vom OpenSSL-Projekt zur Nutzung im\n" "Dieses Produkt enthält Software, die vom OpenSSL-Projekt zur Nutzung im\n"
"OpenSSL Toolkit (http://www.openssl.org/) geschrieben wurde sowie\n" "OpenSSL Toolkit (http://www.openssl.org/) geschrieben wurde sowie\n"
"kryptographische Software von Eric Young (eay@cryptsoft.com)." "kryptographische Software von Eric Young (eay@cryptsoft.com)\n"
"und UPnP-Software, entwickelt von Thomas Bernard."
#: ../../../uibase.cpp:619 #: ../../../uibase.cpp:619
msgid "Enter a Bitcoin address (e.g. 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJED9L) or IP address (e.g. 123.45.6.7)" msgid "Enter a Bitcoin address (e.g. 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJED9L) or IP address (e.g. 123.45.6.7)"

Binary file not shown.

View file

@ -734,7 +734,7 @@ msgid ""
"\n" "\n"
"This product includes software developed by the OpenSSL Project for use in the \n" "This product includes software developed by the OpenSSL Project for use in the \n"
"OpenSSL Toolkit (http://www.openssl.org/) and cryptographic software written by \n" "OpenSSL Toolkit (http://www.openssl.org/) and cryptographic software written by \n"
"Eric Young (eay@cryptsoft.com)." "Eric Young (eay@cryptsoft.com) and UPnP software written by Thomas Bernard."
msgstr "" msgstr ""
"Copyright (c) 2009-2010 Bitcoin Developers\n" "Copyright (c) 2009-2010 Bitcoin Developers\n"
"\n" "\n"
@ -745,7 +745,7 @@ msgstr ""
"\n" "\n"
"Este producto incluye software desarrollado por OpenSSL Project para su uso en el\n" "Este producto incluye software desarrollado por OpenSSL Project para su uso en el\n"
"OpenSSL Toolkit (http://www.openssl.org/) y software criptografico escrito por \n" "OpenSSL Toolkit (http://www.openssl.org/) y software criptografico escrito por \n"
"Eric Young (eay@cryptsoft.com)." "Eric Young (eay@cryptsoft.com) y UPnP software escrito por Thomas Bernard."
#: ../../../uibase.cpp:613 #: ../../../uibase.cpp:613
msgid "Enter a Bitcoin address (e.g. 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJED9L) or IP address (e.g. 123.45.6.7)" msgid "Enter a Bitcoin address (e.g. 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJED9L) or IP address (e.g. 123.45.6.7)"

Binary file not shown.

View file

@ -739,7 +739,7 @@ msgid ""
"\n" "\n"
"This product includes software developed by the OpenSSL Project for use in the \n" "This product includes software developed by the OpenSSL Project for use in the \n"
"OpenSSL Toolkit (http://www.openssl.org/) and cryptographic software written by \n" "OpenSSL Toolkit (http://www.openssl.org/) and cryptographic software written by \n"
"Eric Young (eay@cryptsoft.com)." "Eric Young (eay@cryptsoft.com) and UPnP software written by Thomas Bernard."
msgstr "" msgstr ""
"Copyright (c) 2009-2010 Bitcoin Developers\n" "Copyright (c) 2009-2010 Bitcoin Developers\n"
"\n" "\n"
@ -750,7 +750,7 @@ msgstr ""
"\n" "\n"
"Ce produit comprend des composants logiciels développés pour le Projet OpenSSL \n" "Ce produit comprend des composants logiciels développés pour le Projet OpenSSL \n"
"OpenSSL Toolkit (http://www.openssl.org/) ainsi que des composants cryptographiques \n" "OpenSSL Toolkit (http://www.openssl.org/) ainsi que des composants cryptographiques \n"
"écrits par Eric Young (eay@cryptsoft.com)." "écrits par Eric Young (eay@cryptsoft.com) et des logiciels UPnP écrits par Thomas Bernard.."
#: ../../../uibase.cpp:613 #: ../../../uibase.cpp:613
msgid "Enter a Bitcoin address (e.g. 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJED9L) or IP address (e.g. 123.45.6.7)" msgid "Enter a Bitcoin address (e.g. 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJED9L) or IP address (e.g. 123.45.6.7)"

Binary file not shown.

View file

@ -705,7 +705,7 @@ msgid ""
"\n" "\n"
"This product includes software developed by the OpenSSL Project for use in the \n" "This product includes software developed by the OpenSSL Project for use in the \n"
"OpenSSL Toolkit (http://www.openssl.org/) and cryptographic software written by \n" "OpenSSL Toolkit (http://www.openssl.org/) and cryptographic software written by \n"
"Eric Young (eay@cryptsoft.com)." "Eric Young (eay@cryptsoft.com) and UPnP software written by Thomas Bernard."
msgstr "" msgstr ""
"Copyright (c) 2009-2010 Bitcoin Developers\n" "Copyright (c) 2009-2010 Bitcoin Developers\n"
"\n" "\n"
@ -714,9 +714,9 @@ msgstr ""
"Distribuito sotto la licenza software MIT/X11, guarda il file license.txt\n" "Distribuito sotto la licenza software MIT/X11, guarda il file license.txt\n"
"incluso oppure su http://www.opensource.org/licenses/mit-license.php.\n" "incluso oppure su http://www.opensource.org/licenses/mit-license.php.\n"
"\n" "\n"
"Questo prodoto include software sviluppato dal progetto OpenSSL per\n" "Questo prodotto include software sviluppato dal progetto OpenSSL per\n"
"l'uso del (http://www.openssl.org/) e il software criptografico scritto\n" "l'uso del (http://www.openssl.org/) e il software criptografico scritto\n"
"da Eric Young (eay@cryptsoft.com)." "da Eric Young (eay@cryptsoft.com) e UPnP software scritto da Thomas Bernard."
#: ../../../uibase.cpp:619 #: ../../../uibase.cpp:619
msgid "Enter a Bitcoin address (e.g. 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJED9L) or IP address (e.g. 123.45.6.7)" msgid "Enter a Bitcoin address (e.g. 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJED9L) or IP address (e.g. 123.45.6.7)"

Binary file not shown.

View file

@ -706,7 +706,7 @@ msgid ""
"\n" "\n"
"This product includes software developed by the OpenSSL Project for use in the \n" "This product includes software developed by the OpenSSL Project for use in the \n"
"OpenSSL Toolkit (http://www.openssl.org/) and cryptographic software written by \n" "OpenSSL Toolkit (http://www.openssl.org/) and cryptographic software written by \n"
"Eric Young (eay@cryptsoft.com)." "Eric Young (eay@cryptsoft.com) and UPnP software written by Thomas Bernard."
msgstr "" msgstr ""
"Copyright (c) 2009-2011 Bitcoin-ontwikkelaars\n" "Copyright (c) 2009-2011 Bitcoin-ontwikkelaars\n"
"\n" "\n"
@ -717,7 +717,8 @@ msgstr ""
"\n" "\n"
"Dit product bevat software ontwikkeld door het OpenSSL project for gebruik \n" "Dit product bevat software ontwikkeld door het OpenSSL project for gebruik \n"
"in de OpenSSL Toolkit (http://www.openssl.org/), en cryptografische \n" "in de OpenSSL Toolkit (http://www.openssl.org/), en cryptografische \n"
"software geschreven door Eric Young (eay@cryptsoft.com)." "software geschreven door Eric Young (eay@cryptsoft.com)) en UPnP software geschreven\n"
"door Thomas Bernard."
#: ../../../uibase.cpp:619 #: ../../../uibase.cpp:619
msgid "Enter a Bitcoin address (e.g. 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJED9L) or IP address (e.g. 123.45.6.7)" msgid "Enter a Bitcoin address (e.g. 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJED9L) or IP address (e.g. 123.45.6.7)"

Binary file not shown.

View file

@ -705,7 +705,7 @@ msgid ""
"\n" "\n"
"This product includes software developed by the OpenSSL Project for use in the \n" "This product includes software developed by the OpenSSL Project for use in the \n"
"OpenSSL Toolkit (http://www.openssl.org/) and cryptographic software written by \n" "OpenSSL Toolkit (http://www.openssl.org/) and cryptographic software written by \n"
"Eric Young (eay@cryptsoft.com)." "Eric Young (eay@cryptsoft.com) and UPnP software written by Thomas Bernard."
msgstr "" msgstr ""
"Copyright (c) 2009-2010 Bitcoin Developers\n" "Copyright (c) 2009-2010 Bitcoin Developers\n"
"\n" "\n"
@ -716,7 +716,8 @@ msgstr ""
"http://www.opensource.org/licenses/mit-license.php.\n" "http://www.opensource.org/licenses/mit-license.php.\n"
"Este producto inclui software desenvolvido pelo projecto OpenSSL, para \n" "Este producto inclui software desenvolvido pelo projecto OpenSSL, para \n"
"ser utilizado no OpenSSL Toolkit (http://www.openssl.org) e software de \n" "ser utilizado no OpenSSL Toolkit (http://www.openssl.org) e software de \n"
"criptografia desenvolvido por Eric Young (eay@cryptsoft.com)." "criptografia desenvolvido por Eric Young (eay@cryptsoft.com)\n"
"e UPnP software escrito por Thomas Bernard."
#: ../../../uibase.cpp:619 #: ../../../uibase.cpp:619
msgid "Enter a Bitcoin address (e.g. 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJED9L) or IP address (e.g. 123.45.6.7)" msgid "Enter a Bitcoin address (e.g. 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJED9L) or IP address (e.g. 123.45.6.7)"

Binary file not shown.

View file

@ -769,7 +769,7 @@ msgid ""
"\n" "\n"
"This product includes software developed by the OpenSSL Project for use in the \n" "This product includes software developed by the OpenSSL Project for use in the \n"
"OpenSSL Toolkit (http://www.openssl.org/) and cryptographic software written by \n" "OpenSSL Toolkit (http://www.openssl.org/) and cryptographic software written by \n"
"Eric Young (eay@cryptsoft.com)." "Eric Young (eay@cryptsoft.com) and UPnP software written by Thomas Bernard."
msgstr "" msgstr ""
"Все права защищены (c) 2009-2010 Bitcoin Developers\n" "Все права защищены (c) 2009-2010 Bitcoin Developers\n"
"\n" "\n"
@ -780,7 +780,7 @@ msgstr ""
"\n" "\n"
"Этот продукт включает ПО, разработанное проектом OpenSSL для использования в\n" "Этот продукт включает ПО, разработанное проектом OpenSSL для использования в\n"
"OpenSSL Toolkit (http://www.openssl.org/), и криптографическое ПО, написанное\n" "OpenSSL Toolkit (http://www.openssl.org/), и криптографическое ПО, написанное\n"
"Eric Young (eay@cryptsoft.com)." "Eric Young (eay@cryptsoft.com) и UPnP программного обеспечения, написанного Thomas Bernard."
#: ../../../uibase.cpp:613 #: ../../../uibase.cpp:613
msgid "Enter a Bitcoin address (e.g. 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJED9L) or IP address (e.g. 123.45.6.7)" msgid "Enter a Bitcoin address (e.g. 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJED9L) or IP address (e.g. 123.45.6.7)"

View file

@ -65,6 +65,14 @@ int fLimitProcessors = false;
int nLimitProcessors = 1; int nLimitProcessors = 1;
int fMinimizeToTray = true; int fMinimizeToTray = true;
int fMinimizeOnClose = true; int fMinimizeOnClose = true;
#ifdef USE_UPNP
#if USE_UPNP
int fUseUPnP = true;
#else
int fUseUPnP = false;
#endif
#endif

6
main.h
View file

@ -22,6 +22,11 @@ static const int64 CENT = 1000000;
static const int64 MAX_MONEY = 21000000 * COIN; static const int64 MAX_MONEY = 21000000 * COIN;
inline bool MoneyRange(int64 nValue) { return (nValue >= 0 && nValue <= MAX_MONEY); } inline bool MoneyRange(int64 nValue) { return (nValue >= 0 && nValue <= MAX_MONEY); }
static const int COINBASE_MATURITY = 100; static const int COINBASE_MATURITY = 100;
#ifdef USE_UPNP
static const int fHaveUPnP = true;
#else
static const int fHaveUPnP = false;
#endif
@ -55,6 +60,7 @@ extern int fLimitProcessors;
extern int nLimitProcessors; extern int nLimitProcessors;
extern int fMinimizeToTray; extern int fMinimizeToTray;
extern int fMinimizeOnClose; extern int fMinimizeOnClose;
extern int fUseUPnP;

View file

@ -2,6 +2,7 @@
# Distributed under the MIT/X11 software license, see the accompanying # Distributed under the MIT/X11 software license, see the accompanying
# file license.txt or http://www.opensource.org/licenses/mit-license.php. # file license.txt or http://www.opensource.org/licenses/mit-license.php.
USE_UPNP:=0
INCLUDEPATHS= \ INCLUDEPATHS= \
-I"C:\boost-1.43.0-mgw" \ -I"C:\boost-1.43.0-mgw" \
@ -25,8 +26,7 @@ LIBS= \
-l boost_program_options-mgw45-mt-s-1_43 \ -l boost_program_options-mgw45-mt-s-1_43 \
-l boost_thread-mgw45-mt-s-1_43 \ -l boost_thread-mgw45-mt-s-1_43 \
-l db_cxx \ -l db_cxx \
-l eay32 \ -l eay32
-l kernel32 -l user32 -l gdi32 -l comdlg32 -l winspool -l winmm -l shell32 -l comctl32 -l ole32 -l oleaut32 -l uuid -l rpcrt4 -l advapi32 -l ws2_32 -l shlwapi
DEFS=-DWIN32 -D__WXMSW__ -D_WINDOWS -DNOPCH DEFS=-DWIN32 -D__WXMSW__ -D_WINDOWS -DNOPCH
DEBUGFLAGS=-g -D__WXDEBUG__ DEBUGFLAGS=-g -D__WXDEBUG__
@ -34,6 +34,15 @@ CFLAGS=-mthreads -O2 -w -Wno-invalid-offsetof -Wformat $(DEBUGFLAGS) $(DEFS) $(I
HEADERS=headers.h strlcpy.h serialize.h uint256.h util.h key.h bignum.h base58.h \ HEADERS=headers.h strlcpy.h serialize.h uint256.h util.h key.h bignum.h base58.h \
script.h db.h net.h irc.h main.h rpc.h uibase.h ui.h noui.h init.h script.h db.h net.h irc.h main.h rpc.h uibase.h ui.h noui.h init.h
ifdef USE_UPNP
INCLUDEPATHS += -I"C:\upnpc-exe-win32-20110215"
LIBPATHS += -L"C:\upnpc-exe-win32-20110215"
LIBS += -l miniupnpc -l iphlpapi
DEFS += -DSTATICLIB -DUSE_UPNP=$(USE_UPNP)
endif
LIBS += -l kernel32 -l user32 -l gdi32 -l comdlg32 -l winspool -l winmm -l shell32 -l comctl32 -l ole32 -l oleaut32 -l uuid -l rpcrt4 -l advapi32 -l ws2_32 -l shlwapi
OBJS= \ OBJS= \
obj/util.o \ obj/util.o \
obj/script.o \ obj/script.o \

View file

@ -16,6 +16,8 @@ LIBPATHS= \
WXLIBS=$(shell $(DEPSDIR)/bin/wx-config --libs --static) WXLIBS=$(shell $(DEPSDIR)/bin/wx-config --libs --static)
USE_UPNP:=0
LIBS= -dead_strip \ LIBS= -dead_strip \
$(DEPSDIR)/lib/libdb_cxx-4.8.a \ $(DEPSDIR)/lib/libdb_cxx-4.8.a \
$(DEPSDIR)/lib/libboost_system.a \ $(DEPSDIR)/lib/libboost_system.a \
@ -44,6 +46,11 @@ OBJS= \
obj/init.o \ obj/init.o \
cryptopp/obj/sha.o \ cryptopp/obj/sha.o \
cryptopp/obj/cpu.o cryptopp/obj/cpu.o
ifdef USE_UPNP
LIBS += $(DEPSDIR)/lib/libminiupnpc.a
DEFS += -DUSE_UPNP=$(USE_UPNP)
endif
all: bitcoin all: bitcoin

View file

@ -8,6 +8,10 @@ WXINCLUDEPATHS=$(shell wx-config --cxxflags)
WXLIBS=$(shell wx-config --libs) WXLIBS=$(shell wx-config --libs)
USE_UPNP:=0
DEFS=-DNOPCH -DFOURWAYSSE2 -DUSE_SSL
# for boost 1.37, add -mt to the boost libraries # for boost 1.37, add -mt to the boost libraries
LIBS= \ LIBS= \
-Wl,-Bstatic \ -Wl,-Bstatic \
@ -17,13 +21,20 @@ LIBS= \
-l boost_thread \ -l boost_thread \
-l db_cxx \ -l db_cxx \
-l ssl \ -l ssl \
-l crypto \ -l crypto
ifdef USE_UPNP
LIBS += -l miniupnpc
DEFS += -DUSE_UPNP=$(USE_UPNP)
endif
LIBS+= \
-Wl,-Bdynamic \ -Wl,-Bdynamic \
-l gthread-2.0 \ -l gthread-2.0 \
-l z \ -l z \
-l dl -l dl
DEFS=-DNOPCH -DFOURWAYSSE2 -DUSE_SSL
DEBUGFLAGS=-g -D__WXDEBUG__ DEBUGFLAGS=-g -D__WXDEBUG__
CXXFLAGS=-O2 -Wno-invalid-offsetof -Wformat $(DEBUGFLAGS) $(DEFS) CXXFLAGS=-O2 -Wno-invalid-offsetof -Wformat $(DEBUGFLAGS) $(DEFS)
HEADERS=headers.h strlcpy.h serialize.h uint256.h util.h key.h bignum.h base58.h \ HEADERS=headers.h strlcpy.h serialize.h uint256.h util.h key.h bignum.h base58.h \

124
net.cpp
View file

@ -4,11 +4,21 @@
#include "headers.h" #include "headers.h"
#ifdef USE_UPNP
#include <miniupnpc/miniwget.h>
#include <miniupnpc/miniupnpc.h>
#include <miniupnpc/upnpcommands.h>
#include <miniupnpc/upnperrors.h>
#endif
static const int MAX_OUTBOUND_CONNECTIONS = 8; static const int MAX_OUTBOUND_CONNECTIONS = 8;
void ThreadMessageHandler2(void* parg); void ThreadMessageHandler2(void* parg);
void ThreadSocketHandler2(void* parg); void ThreadSocketHandler2(void* parg);
void ThreadOpenConnections2(void* parg); void ThreadOpenConnections2(void* parg);
#ifdef USE_UPNP
void ThreadMapPort2(void* parg);
#endif
bool OpenNetworkConnection(const CAddress& addrConnect); bool OpenNetworkConnection(const CAddress& addrConnect);
@ -857,6 +867,109 @@ void ThreadSocketHandler2(void* parg)
#ifdef USE_UPNP
void ThreadMapPort(void* parg)
{
IMPLEMENT_RANDOMIZE_STACK(ThreadMapPort(parg));
try
{
vnThreadsRunning[5]++;
ThreadMapPort2(parg);
vnThreadsRunning[5]--;
}
catch (std::exception& e) {
vnThreadsRunning[5]--;
PrintException(&e, "ThreadMapPort()");
} catch (...) {
vnThreadsRunning[5]--;
PrintException(NULL, "ThreadMapPort()");
}
printf("ThreadMapPort exiting\n");
}
void ThreadMapPort2(void* parg)
{
printf("ThreadMapPort started\n");
char port[6];
sprintf(port, "%d", ntohs(GetDefaultPort()));
const char * rootdescurl = 0;
const char * multicastif = 0;
const char * minissdpdpath = 0;
struct UPNPDev * devlist = 0;
char lanaddr[64];
devlist = upnpDiscover(2000, multicastif, minissdpdpath, 0);
struct UPNPUrls urls;
struct IGDdatas data;
int r;
if (UPNP_GetValidIGD(devlist, &urls, &data, lanaddr, sizeof(lanaddr)) == 1)
{
char intClient[16];
char intPort[6];
#ifndef __WXMSW__
r = UPNP_AddPortMapping(urls.controlURL, data.first.servicetype,
port, port, lanaddr, 0, "TCP", 0);
#else
r = UPNP_AddPortMapping(urls.controlURL, data.first.servicetype,
port, port, lanaddr, 0, "TCP", 0, "0");
#endif
if(r!=UPNPCOMMAND_SUCCESS)
printf("AddPortMapping(%s, %s, %s) failed with code %d (%s)\n",
port, port, lanaddr, r, strupnperror(r));
else
printf("UPnP Port Mapping successful.\n");
loop {
if (fShutdown || !fUseUPnP)
{
r = UPNP_DeletePortMapping(urls.controlURL, data.first.servicetype, port, "TCP", 0);
printf("UPNP_DeletePortMapping() returned : %d\n", r);
freeUPNPDevlist(devlist); devlist = 0;
FreeUPNPUrls(&urls);
return;
}
Sleep(2000);
}
} else {
printf("No valid UPnP IGDs found\n");
freeUPNPDevlist(devlist); devlist = 0;
FreeUPNPUrls(&urls);
loop {
if (fShutdown)
return;
Sleep(2000);
}
}
}
void MapPort(bool fMapPort)
{
if (fUseUPnP != fMapPort)
{
fUseUPnP = fMapPort;
CWalletDB().WriteSetting("fUseUPnP", fUseUPnP);
}
if (fUseUPnP && vnThreadsRunning[5] < 1)
{
if (!CreateThread(ThreadMapPort, NULL))
printf("Error: ThreadMapPort(ThreadMapPort) failed\n");
}
}
#endif
static const char *strDNSSeed[] = { static const char *strDNSSeed[] = {
"bitseed.xf2.org", "bitseed.xf2.org",
}; };
@ -1409,6 +1522,10 @@ void StartNode(void* parg)
// Start threads // Start threads
// //
// Map ports with UPnP
if (fHaveUPnP)
MapPort(fUseUPnP);
// Get addresses from IRC and advertise ours // Get addresses from IRC and advertise ours
if (!CreateThread(ThreadIRCSeed, NULL)) if (!CreateThread(ThreadIRCSeed, NULL))
printf("Error: CreateThread(ThreadIRCSeed) failed\n"); printf("Error: CreateThread(ThreadIRCSeed) failed\n");
@ -1434,7 +1551,11 @@ bool StopNode()
fShutdown = true; fShutdown = true;
nTransactionsUpdated++; nTransactionsUpdated++;
int64 nStart = GetTime(); int64 nStart = GetTime();
while (vnThreadsRunning[0] > 0 || vnThreadsRunning[2] > 0 || vnThreadsRunning[3] > 0 || vnThreadsRunning[4] > 0) while (vnThreadsRunning[0] > 0 || vnThreadsRunning[2] > 0 || vnThreadsRunning[3] > 0 || vnThreadsRunning[4] > 0
#ifdef USE_UPNP
|| vnThreadsRunning[5] > 0
#endif
)
{ {
if (GetTime() - nStart > 20) if (GetTime() - nStart > 20)
break; break;
@ -1445,6 +1566,7 @@ bool StopNode()
if (vnThreadsRunning[2] > 0) printf("ThreadMessageHandler still running\n"); if (vnThreadsRunning[2] > 0) printf("ThreadMessageHandler still running\n");
if (vnThreadsRunning[3] > 0) printf("ThreadBitcoinMiner still running\n"); if (vnThreadsRunning[3] > 0) printf("ThreadBitcoinMiner still running\n");
if (vnThreadsRunning[4] > 0) printf("ThreadRPCServer still running\n"); if (vnThreadsRunning[4] > 0) printf("ThreadRPCServer still running\n");
if (fHaveUPnP && vnThreadsRunning[5] > 0) printf("ThreadMapPort still running\n");
while (vnThreadsRunning[2] > 0 || vnThreadsRunning[4] > 0) while (vnThreadsRunning[2] > 0 || vnThreadsRunning[4] > 0)
Sleep(20); Sleep(20);
Sleep(50); Sleep(50);

1
net.h
View file

@ -30,6 +30,7 @@ CNode* FindNode(unsigned int ip);
CNode* ConnectNode(CAddress addrConnect, int64 nTimeout=0); CNode* ConnectNode(CAddress addrConnect, int64 nTimeout=0);
void AbandonRequests(void (*fn)(void*, CDataStream&), void* param1); void AbandonRequests(void (*fn)(void*, CDataStream&), void* param1);
bool AnySubscribed(unsigned int nChannel); bool AnySubscribed(unsigned int nChannel);
void MapPort(bool fMapPort);
void DNSAddressSeed(); void DNSAddressSeed();
bool BindListenPort(string& strError=REF(string())); bool BindListenPort(string& strError=REF(string()));
void StartNode(void* parg); void StartNode(void* parg);

11
ui.cpp
View file

@ -1665,6 +1665,10 @@ COptionsDialog::COptionsDialog(wxWindow* parent) : COptionsDialogBase(parent)
m_checkBoxStartOnSystemStartup->SetValue(fTmpStartOnSystemStartup = GetStartOnSystemStartup()); m_checkBoxStartOnSystemStartup->SetValue(fTmpStartOnSystemStartup = GetStartOnSystemStartup());
m_checkBoxMinimizeToTray->SetValue(fMinimizeToTray); m_checkBoxMinimizeToTray->SetValue(fMinimizeToTray);
m_checkBoxMinimizeOnClose->SetValue(fMinimizeOnClose); m_checkBoxMinimizeOnClose->SetValue(fMinimizeOnClose);
if (fHaveUPnP)
m_checkBoxUseUPnP->SetValue(fUseUPnP);
else
m_checkBoxUseUPnP->Enable(false);
m_checkBoxUseProxy->SetValue(fUseProxy); m_checkBoxUseProxy->SetValue(fUseProxy);
m_textCtrlProxyIP->Enable(fUseProxy); m_textCtrlProxyIP->Enable(fUseProxy);
m_textCtrlProxyPort->Enable(fUseProxy); m_textCtrlProxyPort->Enable(fUseProxy);
@ -1784,6 +1788,13 @@ void COptionsDialog::OnButtonApply(wxCommandEvent& event)
walletdb.WriteSetting("fMinimizeOnClose", fMinimizeOnClose); walletdb.WriteSetting("fMinimizeOnClose", fMinimizeOnClose);
} }
if (fHaveUPnP && fUseUPnP != m_checkBoxUseUPnP->GetValue())
{
fUseUPnP = m_checkBoxUseUPnP->GetValue();
walletdb.WriteSetting("fUseUPnP", fUseUPnP);
MapPort(fUseUPnP);
}
fUseProxy = m_checkBoxUseProxy->GetValue(); fUseProxy = m_checkBoxUseProxy->GetValue();
walletdb.WriteSetting("fUseProxy", fUseProxy); walletdb.WriteSetting("fUseProxy", fUseProxy);

View file

@ -371,6 +371,9 @@ COptionsDialogBase::COptionsDialogBase( wxWindow* parent, wxWindowID id, const w
m_checkBoxMinimizeToTray = new wxCheckBox( m_panelMain, wxID_ANY, _("&Minimize to the tray instead of the taskbar"), wxDefaultPosition, wxDefaultSize, 0 ); m_checkBoxMinimizeToTray = new wxCheckBox( m_panelMain, wxID_ANY, _("&Minimize to the tray instead of the taskbar"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer69->Add( m_checkBoxMinimizeToTray, 0, wxALL, 5 ); bSizer69->Add( m_checkBoxMinimizeToTray, 0, wxALL, 5 );
m_checkBoxUseUPnP = new wxCheckBox( m_panelMain, wxID_ANY, _("Map port using &UPnP"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer69->Add( m_checkBoxUseUPnP, 0, wxALL, 5 );
m_checkBoxMinimizeOnClose = new wxCheckBox( m_panelMain, wxID_ANY, _("M&inimize to the tray on close"), wxDefaultPosition, wxDefaultSize, 0 ); m_checkBoxMinimizeOnClose = new wxCheckBox( m_panelMain, wxID_ANY, _("M&inimize to the tray on close"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer69->Add( m_checkBoxMinimizeOnClose, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); bSizer69->Add( m_checkBoxMinimizeOnClose, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
@ -544,7 +547,7 @@ CAboutDialogBase::CAboutDialogBase( wxWindow* parent, wxWindowID id, const wxStr
bSizer631->Add( 0, 4, 0, wxEXPAND, 5 ); bSizer631->Add( 0, 4, 0, wxEXPAND, 5 );
m_staticTextMain = new wxStaticText( this, wxID_ANY, _("Copyright (c) 2009-2011 Bitcoin Developers\n\nThis is experimental software.\n\nDistributed under the MIT/X11 software license, see the accompanying file \nlicense.txt or http://www.opensource.org/licenses/mit-license.php.\n\nThis product includes software developed by the OpenSSL Project for use in the \nOpenSSL Toolkit (http://www.openssl.org/) and cryptographic software written by \nEric Young (eay@cryptsoft.com)."), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextMain = new wxStaticText( this, wxID_ANY, _("Copyright (c) 2009-2011 Bitcoin Developers\n\nThis is experimental software.\n\nDistributed under the MIT/X11 software license, see the accompanying file \nlicense.txt or http://www.opensource.org/licenses/mit-license.php.\n\nThis product includes software developed by the OpenSSL Project for use in the \nOpenSSL Toolkit (http://www.openssl.org/) and cryptographic software written by \nEric Young (eay@cryptsoft.com) and UPnP software written by Thomas Bernard."), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextMain->Wrap( -1 ); m_staticTextMain->Wrap( -1 );
bSizer631->Add( m_staticTextMain, 0, wxALL, 5 ); bSizer631->Add( m_staticTextMain, 0, wxALL, 5 );

View file

@ -170,6 +170,7 @@ class COptionsDialogBase : public wxDialog
wxStaticText* m_staticText35; wxStaticText* m_staticText35;
wxCheckBox* m_checkBoxStartOnSystemStartup; wxCheckBox* m_checkBoxStartOnSystemStartup;
wxCheckBox* m_checkBoxMinimizeToTray; wxCheckBox* m_checkBoxMinimizeToTray;
wxCheckBox* m_checkBoxUseUPnP;
wxCheckBox* m_checkBoxMinimizeOnClose; wxCheckBox* m_checkBoxMinimizeOnClose;
wxCheckBox* m_checkBoxUseProxy; wxCheckBox* m_checkBoxUseProxy;

View file

@ -2122,6 +2122,62 @@
<event name="OnUpdateUI"></event> <event name="OnUpdateUI"></event>
</object> </object>
</object> </object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="1">
<property name="bg"></property>
<property name="checked">0</property>
<property name="context_help"></property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Map port using &amp;UPnP</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">m_checkBoxUseUPnP</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnCheckBox"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxALL|wxALIGN_CENTER_VERTICAL</property> <property name="flag">wxALL|wxALIGN_CENTER_VERTICAL</property>
@ -3345,7 +3401,7 @@
<property name="font"></property> <property name="font"></property>
<property name="hidden">0</property> <property name="hidden">0</property>
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="label">Copyright (c) 2009-2011 Bitcoin Developers&#x0A;&#x0A;This is experimental software.&#x0A;&#x0A;Distributed under the MIT/X11 software license, see the accompanying file &#x0A;license.txt or http://www.opensource.org/licenses/mit-license.php.&#x0A;&#x0A;This product includes software developed by the OpenSSL Project for use in the &#x0A;OpenSSL Toolkit (http://www.openssl.org/) and cryptographic software written by &#x0A;Eric Young (eay@cryptsoft.com).</property> <property name="label">Copyright (c) 2009-2011 Bitcoin Developers&#x0A;&#x0A;This is experimental software.&#x0A;&#x0A;Distributed under the MIT/X11 software license, see the accompanying file &#x0A;license.txt or http://www.opensource.org/licenses/mit-license.php.&#x0A;&#x0A;This product includes software developed by the OpenSSL Project for use in the &#x0A;OpenSSL Toolkit (http://www.openssl.org/) and cryptographic software written by &#x0A;Eric Young (eay@cryptsoft.com) and UPnP software written by Thomas Bernard.</property>
<property name="maximum_size"></property> <property name="maximum_size"></property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">m_staticTextMain</property> <property name="name">m_staticTextMain</property>