Make CNetAddr::GetHash() return an unsigned val.

This prevents an undefined operation in main.cpp, when shifting the hash value
left by 32 bits.
Shifting a signed int left into the sign bit is undefined in C++11.
Don't overflow signed ints in CBigNum::setint64().

CBigNum::setint64() does 'n <<= 8', where n is of type "long long".

This leads to shifting onto and past the sign bit, which is undefined
behavior in C++11 and can cause problems in the future.
Add test case for CBigNum::setint64().

One of the test cases currently aborts when using gcc's flag -ftrapv, due to
negating an INT64_MIN int64 variable, which is an undefined operation.

This will be fixed in a subsequent commit.
Fix signed subtraction overflow in CBigNum::setint64().

As noticed by sipa (Pieter Wuille), this can happen when CBigNum::setint64() is
called with an integer value of INT64_MIN (-2^63).

When compiled with -ftrapv, the program would crash. Otherwise, it would
execute an undefined operation (although in practice, usually the correct one).
Should only be mapped when the getdata is done.

Without this change, mappings will be created even after AlreadyHave equals true, and will never be erased.
Use asynchronous I/O to handle RPC requests

This allows more flexibility in the RPC code, e.g. making it easier to
handle multiple simultaneous connections later on.

Currently asynchronous I/O is only used to listen for and accept
incoming connections.  Asynchronous reading/writing is more involved.

Signed-off-by: Giel van Schijndel <me@mortis.eu>
Add dual IPv4/IPv6 stack support to the RPC server

The RPC server now listens for, and handles, incoming connections on
both IPv4 as well as IPv6.

If available (and usable) it uses a dual IPv4/IPv6 socket on systems
that support it (e.g. Linux and BSDs) and falls back to separate
IPv4/IPv6 sockets on systems that don't (e.g. Windows).

Signed-off-by: Giel van Schijndel <me@mortis.eu>
Allow clients on the IPv6 loopback as well

Signed-off-by: Giel van Schijndel <me@mortis.eu>
Generalise RPC connection handling code to allow more listening sockets

Using this modification it should be relatively easy to, at a later
time, listen on multiple addresses (even Unix domain sockets should be
possible).

Signed-off-by: Giel van Schijndel <me@mortis.eu>
Allow all addresses on the loopback subnet (127.0.0.0/8) not just 127.0.0.1

Signed-off-by: Giel van Schijndel <me@mortis.eu>
Use the QueueShutdown signal to stop accepting new RPC connections

Signed-off-by: Giel van Schijndel <me@mortis.eu>
Fix noinline definition so that it works for more compilers.
Use C++-style numeric limits instead of C-style.
Don't overflow integer on 32-bit machines.

This was causing test_bitcoin to abort on a 32-bit system likely due to -ftrapv.
Move NOINLINE definition to test where it's used.
set cursor for balance field to IBeamCursor (to show the user it IS selectable) and set autoDefault to false for the buttons that do not need this
Improve parsing of IPv6 addresses

Implement the following rules:
* Interpret [X]:Y as host=X port=Y, if Y is an integer
* Interpret X:Y as host=X port=Y, if Y is an integer and X contains no colon
* Interpret X:Y as host=X:Y port=default otherwise
Add netbase tests
Use a 64-bit nonce in ping

Former code sent '0' as nonce, which was serialized as 32-bit.
Merge pull request #1463 from sipa/fix_1455

Use a 64-bit nonce in ping