Commit Graph

53 Commits

Author SHA1 Message Date
Philip Kaufmann de10efd154 add -timeout default as constant and use them
- update help message text
- simplify code in init to check for -timeout
2014-10-06 13:13:25 +02:00
Pieter Wuille 3f6540ad8f Rename IMPLEMENT_SERIALIZE to ADD_SERIALIZE_METHODS 2014-09-02 09:58:09 +02:00
Pieter Wuille 47eb76597e Serializer simplifications after IMPLEMENT_SERIALIZE overhaul 2014-09-01 22:00:19 +02:00
Pieter Wuille 2e731f24b5
Merge pull request #4737
31e9a83 Use CSizeComputer to avoid counting sizes in SerializationOp (Pieter Wuille)
84881f8 rework overhauled serialization methods to non-static (Kamil Domanski)
5d96b4a remove fields of ser_streamplaceholder (Kamil Domanski)
3d796f8 overhaul serialization code (Kamil Domanski)
2014-09-01 21:23:01 +02:00
Pieter Wuille 31e9a8384a Use CSizeComputer to avoid counting sizes in SerializationOp 2014-08-31 02:18:42 +02:00
Kamil Domanski 84881f8c47 rework overhauled serialization methods to non-static
Thanks to Pieter Wuille for most of the work on this commit.
I did not fixup the overhaul commit, because a rebase conflicted
with "remove fields of ser_streamplaceholder".
I prefer not to risk making a mistake while resolving it.
2014-08-31 02:16:17 +02:00
Kamil Domanski 3d796f8996 overhaul serialization code
The implementation of each class' serialization/deserialization is no longer
passed within a macro. The implementation now lies within a template of form:

template <typename T, typename Stream, typename Operation>
inline static size_t SerializationOp(T thisPtr, Stream& s, Operation ser_action, int nType, int nVersion) {
    size_t nSerSize = 0;
    /* CODE */
    return nSerSize;
}

In cases when codepath should depend on whether or not we are just deserializing
(old fGetSize, fWrite, fRead flags) an additional clause can be used:
bool fRead = boost::is_same<Operation, CSerActionUnserialize>();

The IMPLEMENT_SERIALIZE macro will now be a freestanding clause added within
class' body (similiar to Qt's Q_OBJECT) to implement GetSerializeSize,
Serialize and Unserialize. These are now wrappers around
the "SerializationOp" template.
2014-08-31 02:14:20 +02:00
Philip Kaufmann 093303a887 add missing header end comments
- ensures a consistent usage in header files
- also add a blank line after the copyright header where missing
- also remove orphan new-lines at the end of some files
2014-08-28 22:25:21 +02:00
Wladimir J. van der Laan 3802224110 Remove all other print() methods
All unused.
2014-08-20 20:54:27 +02:00
Wladimir J. van der Laan 075cf49e59 Add GetNetworkName function
Returns the network name for an Network enum.
2014-07-30 15:41:17 +02:00
Philip Kaufmann eaedb59e05 net: add SetSocketNonBlocking() as OS independent wrapper 2014-07-17 22:12:44 +02:00
Wladimir J. van der Laan 43f510d37d Convert closesocket 'compat wrapper' to function in netbase
Simpler alternative to #4348.

The current setup with closesocket() is strange. It poses
as a compatibility wrapper but adds functionality.

Rename it and make it a documented utility function in netbase.

Code movement only, zero effect on the functionality.
2014-07-17 15:46:25 +02:00
Philip Kaufmann 0127a9be14 remove SOCKS4 support from core and GUI
- now we support SOCKS5 only
2014-07-07 08:15:14 +02:00
Cory Fields f3967bcc50 build: fix build weirdness after 54372482.
bitcoin-config.h moved, but the old file is likely to still exist when
reconfiguring or switching branches. This would've caused files to not rebuild
correctly, and other strange problems.

Make the path explicit so that the old one cannot be found.

Core libs use config/bitcoin-config.h.

Libs (like crypto) which don't want access to bitcoin's headers continue
to use -Iconfig and #include bitcoin-config.h.
2014-06-23 14:04:38 -04:00
Philip Kaufmann cb7a3edc3d remove dup of extern int nConnectTimeout; in netbase 2014-05-31 12:04:34 +02:00
Wladimir J. van der Laan 0f1040ba52
Merge pull request #4183
f40dbee remove CPubKey::VerifyCompact( ) which is never used (Kamil Domanski)
28b6c1d remove GetMedianTime( ) which is never used (Kamil Domanski)
5bd4adc remove LookupHostNumeric( ) which is never used (Kamil Domanski)
595f691 remove LogException( ) which is never used (Kamil Domanski)
f4057cb remove CTransaction::IsNewerThan which is never used (Kamil Domanski)
0e31e56 remove CWallet::AddReserveKey which is never used (Kamil Domanski)
2014-05-25 16:19:54 +02:00
Wladimir J. van der Laan a60838d09a Replace non-threadsafe strerror
Log the name of the error as well as the error code if a network problem
happens. This makes network troubleshooting more convenient.

Use thread-safe strerror_r and the WIN32 equivalent FormatMessage.
2014-05-23 09:45:04 +02:00
Kamil Domanski 5bd4adca71 remove LookupHostNumeric( ) which is never used 2014-05-20 14:58:21 +02:00
Wladimir J. van der Laan e16be73753 net: Add CSubNet class for subnet matching 2014-05-09 16:45:57 +02:00
Wladimir J. van der Laan e27c4110d9 Remove build-time no-IPv6 setting
The year is 2014. All supported operating systems have IPv6 support,
most certainly at build time (this doesn't mean that IPv6 is configured,
of course).

If noone is exercising the functionality to disable it, that means it
doesn't get tested, and IMO it's better to get rid of it.

(it's also not used consistently in RPC/boost and Net code...)
2014-05-01 12:15:36 +02:00
Brandon Dahler 51ed9ec971 Cleanup code using forward declarations.
Use misc methods of avoiding unnecesary header includes.
Replace int typedefs with int##_t from stdint.h.
Replace PRI64[xdu] with PRI[xdu]64 from inttypes.h.
Normalize QT_VERSION ifs where possible.
Resolve some indirect dependencies as direct ones.
Remove extern declarations from .cpp files.
2013-11-10 09:36:28 -06:00
super3 db0e8ccd90 Bump Year Number to 2013 2013-10-20 15:25:06 -04:00
Philip Kaufmann c1761a5df3 fix #3049 by changing comment for CNetAddr::IsRFC4193() 2013-10-03 15:03:33 +02:00
Cory Fields 35b8af9226 autotools: switch to autotools buildsystem 2013-09-05 21:31:03 -04:00
Wladimir J. van der Laan 24694e24ed Merge pull request #1913 from sipa/noi2p
Remove I2P support from netbase
2012-10-11 00:41:33 -07:00
Pieter Wuille 4e882b7960 Remove I2P support from netbase
I2P apparently needs 256 bits to store a fully routable address. Garlicat
requires a centralized lookup service to map the 80-bit addresses to fully
routable ones (as far as I understood), so that's not really usable in our
situation.

To support I2P routing and peer exchange for it, another solution is needed.
This will most likely imply a network protocol change, and extension of the
'addr' message.
2012-10-07 15:10:14 +02:00
Philip Kaufmann 81bbef2609 add LOCK() for proxy related data-structures
- fix #1560 by properly locking proxy related data-structures
- update GetProxy() and introduce GetNameProxy() to be able to use a
  thread-safe local copy from proxyInfo and nameproxyInfo
- update usage of GetProxy() all over the source to match the new
  behaviour, as it now fills a full proxyType object
- rename GetNameProxy() into HaveNameProxy() to be more clear
2012-10-04 09:35:24 +02:00
Philip Kaufmann 463a1cab43 fix signed/unsigned in strprintf and CNetAddr::GetByte()
- I checked every occurance of strprintf() in the code and used %u, where
  unsigned vars are used
- the change to GetByte() was made, as ip is an unsigned char
2012-09-12 21:30:47 +02:00
Luke Dashjr 814efd6f1f Bugfix: Fix a variety of misspellings 2012-08-01 17:49:51 +00:00
Pieter Wuille d077dd2a6e Rewrite CNetAddr::GetReachabilityFrom()
Add support for Tor/I2P networks, and make code more readable.
2012-06-23 01:11:38 +02:00
Pieter Wuille 70f7f00385 Node support for Tor hidden services
This commit adds support for .onion addresses (mapped into the IPv6
by using OnionCat's range and encoding), and the ability to connect
to them via a SOCKS5 proxy.
2012-06-23 01:11:32 +02:00
Gavin Andresen c5532e188e Merge pull request #1399 from sipa/ipparse
Improve parsing of IPv6 addresses
2012-06-18 11:39:16 -07:00
Gavin Andresen 550c73f4c8 Merge branch 'signbugs' of https://github.com/wizeman/bitcoin
Resolved minor conflict in main.cpp
2012-06-18 10:48:40 -04:00
Pieter Wuille 1e8aeae15a 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
2012-06-14 17:37:15 +02:00
Pieter Wuille 587f929c64 Rework network config settings 2012-05-31 18:12:35 +02:00
Fordy 3a25a2b9b0 Update License in File Headers
I originally created a pull to replace the "COPYING" in crypter.cpp and
crypter.h, but it turned out that COPYING was actually the correct
file.
2012-05-18 22:02:28 +08:00
Ricardo M. Correia 4843b55fd1 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.
2012-05-13 21:42:54 +02:00
Pieter Wuille 8f10a28890 Separate listening sockets, -bind=<addr> 2012-05-11 15:29:20 +02:00
Pieter Wuille 623b987813 Add -noproxy to circumvent proxy for some network 2012-05-11 15:29:19 +02:00
Pieter Wuille 090e5b40f1 Limited relaying/storing of foreign addresses
Introduce a boolean variable for each "network" (ipv4, ipv6, tor, i2p),
and track whether we are likely to able to connect to it. Addresses in
"addr" messages outside of our network get limited relaying and are not
stored in addrman.
2012-05-11 15:29:19 +02:00
Pieter Wuille d32148567f Preliminary support for Tor/I2P hidden services
There are plans to let Bitcoin function as Tor/I2P hidden service.
To do so, we could use the established encoding provided by OnionCat
and GarliCat (without actually using those tools) to embed Tor/I2P
addresses in IPv6.

This patch makes these addresses considered routable, so they can
travel over the Bitcoin network in 'addr' messages. This will hopefully
make it easier to deploy real hidden service support later.
2012-05-11 15:29:19 +02:00
Pieter Wuille 23aa78c405 IPv6 node support
This will make bitcoin relay valid routable IPv6 addresses, and when
USE_IPV6 is enabled, listen on IPv6 interfaces and attempt connections
to IPv6 addresses.
2012-05-11 15:29:19 +02:00
Pieter Wuille 39857190de Support for multiple local addresses 2012-05-04 16:12:23 +02:00
Pieter Wuille 9bab521df8 Support connecting by hostnames passed to proxy (-proxydns) 2012-05-04 16:11:54 +02:00
Pieter Wuille ed6d0b5f85 Remove headers.h 2012-04-17 20:00:55 +02:00
Jeff Garzik 3a78f82a78 Fix sign-compare warnings: netbase's Lookup* max-solutions may be unsigned 2012-04-15 16:58:32 -04:00
Wladimir J. van der Laan 52d3a48128 VC2010 compile fixes 2012-04-03 20:22:41 +02:00
Philip Kaufmann 7e05b97229 fixed typo in comment in netbase.h and bignum.h 2012-03-30 07:44:35 +02:00
Pieter Wuille 6b8de05d0a Begin doxygen-compatible comments 2012-03-26 16:48:23 +02:00
Gavin Andresen 882164196e Update all copyrights to 2012 2012-02-07 11:28:30 -05:00