summaryrefslogtreecommitdiff
path: root/src/network/core/address.h
AgeCommit message (Collapse)Author
2021-07-16Feature: allow the use of STUN to connect client and server togetherPatric Stout
This method doesn't require port-forwarding to be used, and works for most common NAT routers in home setups. But, for sure it doesn't work for all setups, and not everyone will be able to use this.
2021-07-11Change: groundwork to allow ServerAddress to use invite codesPatric Stout
Normally TCPConnecter will do a DNS resolving of the connection_string and connect to it. But for SERVER_ADDRESS_INVITE_CODE this is different: the Game Coordinator does the "resolving". This means we need to allow TCPConnecter to not setup a connection and allow it to be told when a connection has been setup by an external (to TCPConnecter) part of the code. We do this by telling the (active) socket for the connection. This means the rest of the code doesn't need to know the TCPConnecter is not doing a simple resolve+connect. The rest of the code only cares the connection is established; not how it was established.
2021-07-11Codechange: track servers with a ServerAddress instead of a NetworkAddressPatric Stout
This allows future extensions to have different ways of referencing a server, instead of forcing to use IP:port.
2021-06-15Codechange: [Network] Make hostname/client IP return strings instead of a ↵rubidium42
C-string
2021-06-15Codechange: [Network] Let IsInNetmask use std::stringrubidium42
2021-06-15Codechange: [Network] Simplify formatting of network addresses to stringrubidium42
2021-05-06Feature: use Happy Eyeballs to make network connections (TCP-only) (#9199)Patric Stout
Hostnames like "content.openttd.org" resolve into multiple IPv4 and IPv6. It is possible that either of the IPs is not working, either due to a poorly configured OS (having IPv6 but no valid route), broken network paths, or a service that is temporary unavailable. Instead of trying the IPs one by one, waiting for a 3s timeout between each, be a bit more like browsers, and stack attempts on top of each other with slight delays. This is called Happy Eyebells. Initially, try the first IPv6 address. If within 250ms there is no connection yet, try the first IPv4 address. 250ms later, try the second IPv6 address, etc, till all addresses are tried. If any connection is created, abort all the other (pending) connections and use the one that is created. If all fail 3s after the last connect(), trigger a timeout for all.
2021-05-06Codechange: [Network] Use std::string for NetworkAddress' host namerubidium42
2020-06-21Fix: Thread unsafe use of NetworkAddress::GetAddressAsStringJonathan G Rennison
Remove static buffer form of NetworkAddress::GetAddressAsString. This is used in multiple threads concurrently, and is not thread-safe. Replace it with a form returning std::string.
2019-11-10Cleanup: Removed SVN headersS. D. Cloudt
2019-09-30Fix: GCC9's warnings about deprecated implicit assignment operatorsCharles Pigott
2019-04-10Codechange: Use null pointer literal instead of the NULL macroHenry Wilson
2019-04-09Codechange: If something is a vector of strings, use a vector of strings ↵Michael Lutz
instead of an AutoFreeSmallVector.
2019-03-26Cleanup: Remove unused size template parameters from SmallMap and ↵Henry Wilson
Auto[Free|Delete]SmallVector
2019-03-26Codechange: Removed SmallVector completelyHenry Wilson
2019-03-20Remove: ENABLE_NETWORK switchPatric Stout
This switch has been a pain for years. Often disabling broke compilation, as no developer compiles OpenTTD without, neither do any of our official binaries. Additionaly, it has grown so hugely in our codebase, that it clearly shows that the current solution was a poor one. 350+ instances of "#ifdef ENABLE_NETWORK" were in the code, of which only ~30 in the networking code itself. The rest were all around the code to do the right thing, from GUI to NewGRF. A more proper solution would be to stub all the functions, and make sure the rest of the code can simply assume network is available. This was also partially done, and most variables were correct if networking was disabled. Despite that, often the #ifdefs were still used. With the recent removal of DOS, there is also no platform anymore which we support where networking isn't working out-of-the-box. All in all, it is time to remove the ENABLE_NETWORK switch. No replacement is planned, but if you feel we really need this option, we welcome any Pull Request which implements this in a way that doesn't crawl through the code like this diff shows we used to.
2011-07-30(svn r22695) -Fix [FS#4697]: mark addresses that could not be resolved as ↵rubidium
'do not resolve anymore' as well, instead of trying to resolve them each and every time the address is accessed
2011-05-01(svn r22403) -Document: some more network/core coderubidium
2011-01-22(svn r21886) -Codechange: move documentation towards the code to make it ↵rubidium
more likely to be updated [n].
2010-12-22(svn r21595) -Codechange: Some header files had their name changed, update ↵alberth
the ifndef/define/endif lines.
2010-04-12(svn r19614) -Codechange: "it's" => "its" where appropriatesmatz
2009-10-04(svn r17699) -Codechange: move #ifdef ENABLE_NETWORK till after the ↵rubidium
'generic' includes so compilation without network support doesn't get broken as easily by changes in header files
2009-08-21(svn r17248) -Fix: add GPL license notice where appropriaterubidium
2009-05-06(svn r16238) -Change: improve/clarify some network related debug "error" ↵rubidium
messages by adding more information to them. Also give some clues on how to fix certain issues (like failing advertising).
2009-04-24(svn r16134) -Change: do not add duplicates to the broadcast listrubidium
2009-04-15(svn r16065) -Fix: don't readd (and resolve) the last joined server each ↵rubidium
time the window gets repainted
2009-04-11(svn r16034) -Fix: compile warnings generated by 64 bits MSVC.rubidium
2009-04-10(svn r16007) -Fix (r16004): when we want to bind to both IPv4 and IPv6, make ↵rubidium
the master socket do that too; too bad getaddrinfo can't handle binding to any address on any port at the same time :(
2009-04-09(svn r16000) -Feature: IPv6 supportrubidium
2009-04-08(svn r15993) -Codechange: clean up/generalise the handling of the server listrubidium
2009-04-08(svn r15990) -Codechange: provide a thread safe variant of GetAddressAsString.rubidium
2009-04-08(svn r15981) -Fix: don't print the address family when writing the IP+port ↵rubidium
to the config file.
2009-04-08(svn r15978) -Codechange: support parsing [] enclosed IPv6 addresses.rubidium
2009-04-08(svn r15975) -Codechange: register each of the IPs we have bound to to the ↵rubidium
masterserver
2009-04-08(svn r15972) -Codechange: remove unneeded parameterrubidium
2009-04-07(svn r15970) -Codechange: make it possible to resolve a single address into ↵rubidium
multiple sockets.
2009-04-07(svn r15969) -Codechange: make the list of broadcast addresses virtually ↵rubidium
unlimited.
2009-04-07(svn r15968) -Codechange: do not allocate a buffer for NetworkAddresses so ↵rubidium
passing it around is easier.
2009-04-04(svn r15954) -Fix: comparing addresses kinda fails (sometimes) causing ↵rubidium
duplicates in the game list
2009-04-04(svn r15948) -Fix: resolve network addresses before comparing themrubidium
2009-04-04(svn r15946) -Codechange: move netmask matching to NetworkAddress and add ↵rubidium
some support for IPv6 netmask matching.
2009-04-03(svn r15941) -Codechange: jonty-comp's wish partly implemented (content ↵rubidium
server) ;)
2009-04-03(svn r15935) -Codechange: function to compare IP addresses (to sort them)rubidium
2009-04-03(svn r15926) -Codechange: make the broadcast IP list less AF dependent.rubidium
2009-04-03(svn r15924) -Codechange: replace NetworkResolveHost with something less AF ↵rubidium
dependant.
2009-04-03(svn r15922) -Codechange: unify the ways to listen on a socketrubidium
2009-04-03(svn r15921) -Fix: some OSes don't like sizeof(sockaddr_storage) but want ↵rubidium
sizeof(sockaddr) or whatever is 'valid' for the given protocol
2009-04-02(svn r15920) -Codechange: make the (TCP) connecting less AF dependent.rubidium
2009-04-02(svn r15917) -Codechange: remove the latest traces of NetworkAddress::GetIP.rubidium
2009-04-02(svn r15916) -Codechange: let the network game list use NetworkAddressrubidium