author | bjarni |
Wed, 28 Feb 2007 00:33:40 +0000 | |
branch | cpp_gui |
changeset 6268 | 4b5241e5dd10 |
parent 6132 | dcc73c6b395d |
child 6298 | c30fe89622df |
child 6573 | 7624f942237f |
permissions | -rw-r--r-- |
5774
9df45c532d5d
(svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater.
rubidium
parents:
diff
changeset
|
1 |
/* $Id$ */ |
9df45c532d5d
(svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater.
rubidium
parents:
diff
changeset
|
2 |
|
6268
4b5241e5dd10
(svn r8938) [cpp_gui] -Sync with trunk (r8772..r8900)
bjarni
parents:
6132
diff
changeset
|
3 |
/** |
4b5241e5dd10
(svn r8938) [cpp_gui] -Sync with trunk (r8772..r8900)
bjarni
parents:
6132
diff
changeset
|
4 |
* @file core.h Base for all network types (UDP and TCP) |
4b5241e5dd10
(svn r8938) [cpp_gui] -Sync with trunk (r8772..r8900)
bjarni
parents:
6132
diff
changeset
|
5 |
*/ |
4b5241e5dd10
(svn r8938) [cpp_gui] -Sync with trunk (r8772..r8900)
bjarni
parents:
6132
diff
changeset
|
6 |
|
5774
9df45c532d5d
(svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater.
rubidium
parents:
diff
changeset
|
7 |
#ifndef NETWORK_CORE_H |
9df45c532d5d
(svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater.
rubidium
parents:
diff
changeset
|
8 |
#define NETWORK_CORE_H |
9df45c532d5d
(svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater.
rubidium
parents:
diff
changeset
|
9 |
|
9df45c532d5d
(svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater.
rubidium
parents:
diff
changeset
|
10 |
#ifdef ENABLE_NETWORK |
9df45c532d5d
(svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater.
rubidium
parents:
diff
changeset
|
11 |
|
5875
4a1391019791
(svn r8083) -Codechange: make a NetworkSocketHandler as base for all sockets and move a little of NetworkClientState functionality to the NetworkSocketHandler. Move the rest of the NetworkClientState to the new NetworkTCPSocketHandler class/struct, which is not yet implemented in an object oriented manner. The UDP socket handler now extends the NetworkSocketHandler instead of having a reference to a NetworkClientState.
rubidium
parents:
5775
diff
changeset
|
12 |
#include "os_abstraction.h" |
6121
f254b194347f
(svn r8459) -Codechange: move (Send|Recv)GRFIdentifier to NetworkSocketHandler, so it can also be used the TCP socket handler.
rubidium
parents:
6115
diff
changeset
|
13 |
#include "../../newgrf_config.h" |
5875
4a1391019791
(svn r8083) -Codechange: make a NetworkSocketHandler as base for all sockets and move a little of NetworkClientState functionality to the NetworkSocketHandler. Move the rest of the NetworkClientState to the new NetworkTCPSocketHandler class/struct, which is not yet implemented in an object oriented manner. The UDP socket handler now extends the NetworkSocketHandler instead of having a reference to a NetworkClientState.
rubidium
parents:
5775
diff
changeset
|
14 |
|
5775
016a737acde3
(svn r7830) -Codechange: let NetworkCoreInitialize return a bool, so we have to set _network_available only once.
rubidium
parents:
5774
diff
changeset
|
15 |
bool NetworkCoreInitialize(void); |
5774
9df45c532d5d
(svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater.
rubidium
parents:
diff
changeset
|
16 |
void NetworkCoreShutdown(void); |
9df45c532d5d
(svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater.
rubidium
parents:
diff
changeset
|
17 |
|
6115
c5bde03ec914
(svn r8445) -Cleanup: remove some @params from comments as the parameters did not exist anymore and add comments to several variables/functions.
rubidium
parents:
5875
diff
changeset
|
18 |
/** Status of a network client; reasons why a client has quit */ |
5875
4a1391019791
(svn r8083) -Codechange: make a NetworkSocketHandler as base for all sockets and move a little of NetworkClientState functionality to the NetworkSocketHandler. Move the rest of the NetworkClientState to the new NetworkTCPSocketHandler class/struct, which is not yet implemented in an object oriented manner. The UDP socket handler now extends the NetworkSocketHandler instead of having a reference to a NetworkClientState.
rubidium
parents:
5775
diff
changeset
|
19 |
typedef enum { |
4a1391019791
(svn r8083) -Codechange: make a NetworkSocketHandler as base for all sockets and move a little of NetworkClientState functionality to the NetworkSocketHandler. Move the rest of the NetworkClientState to the new NetworkTCPSocketHandler class/struct, which is not yet implemented in an object oriented manner. The UDP socket handler now extends the NetworkSocketHandler instead of having a reference to a NetworkClientState.
rubidium
parents:
5775
diff
changeset
|
20 |
NETWORK_RECV_STATUS_OKAY, ///< Everything is okay |
4a1391019791
(svn r8083) -Codechange: make a NetworkSocketHandler as base for all sockets and move a little of NetworkClientState functionality to the NetworkSocketHandler. Move the rest of the NetworkClientState to the new NetworkTCPSocketHandler class/struct, which is not yet implemented in an object oriented manner. The UDP socket handler now extends the NetworkSocketHandler instead of having a reference to a NetworkClientState.
rubidium
parents:
5775
diff
changeset
|
21 |
NETWORK_RECV_STATUS_DESYNC, ///< A desync did occur |
6123
87aa45c64f8f
(svn r8461) -Feature: check for NewGRF compatability before actually downloading the map from a game server when connecting from the command prompt and internal console.
rubidium
parents:
6121
diff
changeset
|
22 |
NETWORK_RECV_STATUS_NEWGRF_MISMATCH, ///< We did not have the required NewGRFs |
5875
4a1391019791
(svn r8083) -Codechange: make a NetworkSocketHandler as base for all sockets and move a little of NetworkClientState functionality to the NetworkSocketHandler. Move the rest of the NetworkClientState to the new NetworkTCPSocketHandler class/struct, which is not yet implemented in an object oriented manner. The UDP socket handler now extends the NetworkSocketHandler instead of having a reference to a NetworkClientState.
rubidium
parents:
5775
diff
changeset
|
23 |
NETWORK_RECV_STATUS_SAVEGAME, ///< Something went wrong (down)loading the savegame |
4a1391019791
(svn r8083) -Codechange: make a NetworkSocketHandler as base for all sockets and move a little of NetworkClientState functionality to the NetworkSocketHandler. Move the rest of the NetworkClientState to the new NetworkTCPSocketHandler class/struct, which is not yet implemented in an object oriented manner. The UDP socket handler now extends the NetworkSocketHandler instead of having a reference to a NetworkClientState.
rubidium
parents:
5775
diff
changeset
|
24 |
NETWORK_RECV_STATUS_CONN_LOST, ///< The conection is 'just' lost |
4a1391019791
(svn r8083) -Codechange: make a NetworkSocketHandler as base for all sockets and move a little of NetworkClientState functionality to the NetworkSocketHandler. Move the rest of the NetworkClientState to the new NetworkTCPSocketHandler class/struct, which is not yet implemented in an object oriented manner. The UDP socket handler now extends the NetworkSocketHandler instead of having a reference to a NetworkClientState.
rubidium
parents:
5775
diff
changeset
|
25 |
NETWORK_RECV_STATUS_MALFORMED_PACKET, ///< We apparently send a malformed packet |
4a1391019791
(svn r8083) -Codechange: make a NetworkSocketHandler as base for all sockets and move a little of NetworkClientState functionality to the NetworkSocketHandler. Move the rest of the NetworkClientState to the new NetworkTCPSocketHandler class/struct, which is not yet implemented in an object oriented manner. The UDP socket handler now extends the NetworkSocketHandler instead of having a reference to a NetworkClientState.
rubidium
parents:
5775
diff
changeset
|
26 |
NETWORK_RECV_STATUS_SERVER_ERROR, ///< The server told us we made an error |
4a1391019791
(svn r8083) -Codechange: make a NetworkSocketHandler as base for all sockets and move a little of NetworkClientState functionality to the NetworkSocketHandler. Move the rest of the NetworkClientState to the new NetworkTCPSocketHandler class/struct, which is not yet implemented in an object oriented manner. The UDP socket handler now extends the NetworkSocketHandler instead of having a reference to a NetworkClientState.
rubidium
parents:
5775
diff
changeset
|
27 |
NETWORK_RECV_STATUS_SERVER_FULL, ///< The server is full |
4a1391019791
(svn r8083) -Codechange: make a NetworkSocketHandler as base for all sockets and move a little of NetworkClientState functionality to the NetworkSocketHandler. Move the rest of the NetworkClientState to the new NetworkTCPSocketHandler class/struct, which is not yet implemented in an object oriented manner. The UDP socket handler now extends the NetworkSocketHandler instead of having a reference to a NetworkClientState.
rubidium
parents:
5775
diff
changeset
|
28 |
NETWORK_RECV_STATUS_SERVER_BANNED, ///< The server has banned us |
4a1391019791
(svn r8083) -Codechange: make a NetworkSocketHandler as base for all sockets and move a little of NetworkClientState functionality to the NetworkSocketHandler. Move the rest of the NetworkClientState to the new NetworkTCPSocketHandler class/struct, which is not yet implemented in an object oriented manner. The UDP socket handler now extends the NetworkSocketHandler instead of having a reference to a NetworkClientState.
rubidium
parents:
5775
diff
changeset
|
29 |
NETWORK_RECV_STATUS_CLOSE_QUERY, ///< Done quering the server |
4a1391019791
(svn r8083) -Codechange: make a NetworkSocketHandler as base for all sockets and move a little of NetworkClientState functionality to the NetworkSocketHandler. Move the rest of the NetworkClientState to the new NetworkTCPSocketHandler class/struct, which is not yet implemented in an object oriented manner. The UDP socket handler now extends the NetworkSocketHandler instead of having a reference to a NetworkClientState.
rubidium
parents:
5775
diff
changeset
|
30 |
} NetworkRecvStatus; |
4a1391019791
(svn r8083) -Codechange: make a NetworkSocketHandler as base for all sockets and move a little of NetworkClientState functionality to the NetworkSocketHandler. Move the rest of the NetworkClientState to the new NetworkTCPSocketHandler class/struct, which is not yet implemented in an object oriented manner. The UDP socket handler now extends the NetworkSocketHandler instead of having a reference to a NetworkClientState.
rubidium
parents:
5775
diff
changeset
|
31 |
|
6121
f254b194347f
(svn r8459) -Codechange: move (Send|Recv)GRFIdentifier to NetworkSocketHandler, so it can also be used the TCP socket handler.
rubidium
parents:
6115
diff
changeset
|
32 |
/** Forward declaration due to circular dependencies */ |
6132
dcc73c6b395d
(svn r8479) -Fix (r8459): Silenced VC warning C4099: 'Packet' : type name first seen using 'class' now seen using 'struct'
KUDr
parents:
6123
diff
changeset
|
33 |
struct Packet; |
6121
f254b194347f
(svn r8459) -Codechange: move (Send|Recv)GRFIdentifier to NetworkSocketHandler, so it can also be used the TCP socket handler.
rubidium
parents:
6115
diff
changeset
|
34 |
|
5875
4a1391019791
(svn r8083) -Codechange: make a NetworkSocketHandler as base for all sockets and move a little of NetworkClientState functionality to the NetworkSocketHandler. Move the rest of the NetworkClientState to the new NetworkTCPSocketHandler class/struct, which is not yet implemented in an object oriented manner. The UDP socket handler now extends the NetworkSocketHandler instead of having a reference to a NetworkClientState.
rubidium
parents:
5775
diff
changeset
|
35 |
/** |
4a1391019791
(svn r8083) -Codechange: make a NetworkSocketHandler as base for all sockets and move a little of NetworkClientState functionality to the NetworkSocketHandler. Move the rest of the NetworkClientState to the new NetworkTCPSocketHandler class/struct, which is not yet implemented in an object oriented manner. The UDP socket handler now extends the NetworkSocketHandler instead of having a reference to a NetworkClientState.
rubidium
parents:
5775
diff
changeset
|
36 |
* SocketHandler for all network sockets in OpenTTD. |
4a1391019791
(svn r8083) -Codechange: make a NetworkSocketHandler as base for all sockets and move a little of NetworkClientState functionality to the NetworkSocketHandler. Move the rest of the NetworkClientState to the new NetworkTCPSocketHandler class/struct, which is not yet implemented in an object oriented manner. The UDP socket handler now extends the NetworkSocketHandler instead of having a reference to a NetworkClientState.
rubidium
parents:
5775
diff
changeset
|
37 |
*/ |
4a1391019791
(svn r8083) -Codechange: make a NetworkSocketHandler as base for all sockets and move a little of NetworkClientState functionality to the NetworkSocketHandler. Move the rest of the NetworkClientState to the new NetworkTCPSocketHandler class/struct, which is not yet implemented in an object oriented manner. The UDP socket handler now extends the NetworkSocketHandler instead of having a reference to a NetworkClientState.
rubidium
parents:
5775
diff
changeset
|
38 |
class NetworkSocketHandler { |
4a1391019791
(svn r8083) -Codechange: make a NetworkSocketHandler as base for all sockets and move a little of NetworkClientState functionality to the NetworkSocketHandler. Move the rest of the NetworkClientState to the new NetworkTCPSocketHandler class/struct, which is not yet implemented in an object oriented manner. The UDP socket handler now extends the NetworkSocketHandler instead of having a reference to a NetworkClientState.
rubidium
parents:
5775
diff
changeset
|
39 |
public: |
4a1391019791
(svn r8083) -Codechange: make a NetworkSocketHandler as base for all sockets and move a little of NetworkClientState functionality to the NetworkSocketHandler. Move the rest of the NetworkClientState to the new NetworkTCPSocketHandler class/struct, which is not yet implemented in an object oriented manner. The UDP socket handler now extends the NetworkSocketHandler instead of having a reference to a NetworkClientState.
rubidium
parents:
5775
diff
changeset
|
40 |
/* TODO: make socket & has_quit protected once the TCP stuff |
4a1391019791
(svn r8083) -Codechange: make a NetworkSocketHandler as base for all sockets and move a little of NetworkClientState functionality to the NetworkSocketHandler. Move the rest of the NetworkClientState to the new NetworkTCPSocketHandler class/struct, which is not yet implemented in an object oriented manner. The UDP socket handler now extends the NetworkSocketHandler instead of having a reference to a NetworkClientState.
rubidium
parents:
5775
diff
changeset
|
41 |
*is in a real class too */ |
4a1391019791
(svn r8083) -Codechange: make a NetworkSocketHandler as base for all sockets and move a little of NetworkClientState functionality to the NetworkSocketHandler. Move the rest of the NetworkClientState to the new NetworkTCPSocketHandler class/struct, which is not yet implemented in an object oriented manner. The UDP socket handler now extends the NetworkSocketHandler instead of having a reference to a NetworkClientState.
rubidium
parents:
5775
diff
changeset
|
42 |
bool has_quit; ///< Whether the current client has quit/send a bad packet |
4a1391019791
(svn r8083) -Codechange: make a NetworkSocketHandler as base for all sockets and move a little of NetworkClientState functionality to the NetworkSocketHandler. Move the rest of the NetworkClientState to the new NetworkTCPSocketHandler class/struct, which is not yet implemented in an object oriented manner. The UDP socket handler now extends the NetworkSocketHandler instead of having a reference to a NetworkClientState.
rubidium
parents:
5775
diff
changeset
|
43 |
SOCKET sock; ///< The socket currently connected to |
4a1391019791
(svn r8083) -Codechange: make a NetworkSocketHandler as base for all sockets and move a little of NetworkClientState functionality to the NetworkSocketHandler. Move the rest of the NetworkClientState to the new NetworkTCPSocketHandler class/struct, which is not yet implemented in an object oriented manner. The UDP socket handler now extends the NetworkSocketHandler instead of having a reference to a NetworkClientState.
rubidium
parents:
5775
diff
changeset
|
44 |
public: |
6115
c5bde03ec914
(svn r8445) -Cleanup: remove some @params from comments as the parameters did not exist anymore and add comments to several variables/functions.
rubidium
parents:
5875
diff
changeset
|
45 |
/** Create a new unbound socket */ |
5875
4a1391019791
(svn r8083) -Codechange: make a NetworkSocketHandler as base for all sockets and move a little of NetworkClientState functionality to the NetworkSocketHandler. Move the rest of the NetworkClientState to the new NetworkTCPSocketHandler class/struct, which is not yet implemented in an object oriented manner. The UDP socket handler now extends the NetworkSocketHandler instead of having a reference to a NetworkClientState.
rubidium
parents:
5775
diff
changeset
|
46 |
NetworkSocketHandler() { this->sock = INVALID_SOCKET; this->has_quit = false; } |
6115
c5bde03ec914
(svn r8445) -Cleanup: remove some @params from comments as the parameters did not exist anymore and add comments to several variables/functions.
rubidium
parents:
5875
diff
changeset
|
47 |
|
c5bde03ec914
(svn r8445) -Cleanup: remove some @params from comments as the parameters did not exist anymore and add comments to several variables/functions.
rubidium
parents:
5875
diff
changeset
|
48 |
/** Close the socket when distructing the socket handler */ |
5875
4a1391019791
(svn r8083) -Codechange: make a NetworkSocketHandler as base for all sockets and move a little of NetworkClientState functionality to the NetworkSocketHandler. Move the rest of the NetworkClientState to the new NetworkTCPSocketHandler class/struct, which is not yet implemented in an object oriented manner. The UDP socket handler now extends the NetworkSocketHandler instead of having a reference to a NetworkClientState.
rubidium
parents:
5775
diff
changeset
|
49 |
virtual ~NetworkSocketHandler() { this->Close(); } |
4a1391019791
(svn r8083) -Codechange: make a NetworkSocketHandler as base for all sockets and move a little of NetworkClientState functionality to the NetworkSocketHandler. Move the rest of the NetworkClientState to the new NetworkTCPSocketHandler class/struct, which is not yet implemented in an object oriented manner. The UDP socket handler now extends the NetworkSocketHandler instead of having a reference to a NetworkClientState.
rubidium
parents:
5775
diff
changeset
|
50 |
|
4a1391019791
(svn r8083) -Codechange: make a NetworkSocketHandler as base for all sockets and move a little of NetworkClientState functionality to the NetworkSocketHandler. Move the rest of the NetworkClientState to the new NetworkTCPSocketHandler class/struct, which is not yet implemented in an object oriented manner. The UDP socket handler now extends the NetworkSocketHandler instead of having a reference to a NetworkClientState.
rubidium
parents:
5775
diff
changeset
|
51 |
/** Really close the socket */ |
4a1391019791
(svn r8083) -Codechange: make a NetworkSocketHandler as base for all sockets and move a little of NetworkClientState functionality to the NetworkSocketHandler. Move the rest of the NetworkClientState to the new NetworkTCPSocketHandler class/struct, which is not yet implemented in an object oriented manner. The UDP socket handler now extends the NetworkSocketHandler instead of having a reference to a NetworkClientState.
rubidium
parents:
5775
diff
changeset
|
52 |
virtual void Close() {} |
4a1391019791
(svn r8083) -Codechange: make a NetworkSocketHandler as base for all sockets and move a little of NetworkClientState functionality to the NetworkSocketHandler. Move the rest of the NetworkClientState to the new NetworkTCPSocketHandler class/struct, which is not yet implemented in an object oriented manner. The UDP socket handler now extends the NetworkSocketHandler instead of having a reference to a NetworkClientState.
rubidium
parents:
5775
diff
changeset
|
53 |
|
4a1391019791
(svn r8083) -Codechange: make a NetworkSocketHandler as base for all sockets and move a little of NetworkClientState functionality to the NetworkSocketHandler. Move the rest of the NetworkClientState to the new NetworkTCPSocketHandler class/struct, which is not yet implemented in an object oriented manner. The UDP socket handler now extends the NetworkSocketHandler instead of having a reference to a NetworkClientState.
rubidium
parents:
5775
diff
changeset
|
54 |
/** |
4a1391019791
(svn r8083) -Codechange: make a NetworkSocketHandler as base for all sockets and move a little of NetworkClientState functionality to the NetworkSocketHandler. Move the rest of the NetworkClientState to the new NetworkTCPSocketHandler class/struct, which is not yet implemented in an object oriented manner. The UDP socket handler now extends the NetworkSocketHandler instead of having a reference to a NetworkClientState.
rubidium
parents:
5775
diff
changeset
|
55 |
* Close the current connection; for TCP this will be mostly equivalent |
4a1391019791
(svn r8083) -Codechange: make a NetworkSocketHandler as base for all sockets and move a little of NetworkClientState functionality to the NetworkSocketHandler. Move the rest of the NetworkClientState to the new NetworkTCPSocketHandler class/struct, which is not yet implemented in an object oriented manner. The UDP socket handler now extends the NetworkSocketHandler instead of having a reference to a NetworkClientState.
rubidium
parents:
5775
diff
changeset
|
56 |
* to Close(), but for UDP it just means the packet has to be dropped. |
4a1391019791
(svn r8083) -Codechange: make a NetworkSocketHandler as base for all sockets and move a little of NetworkClientState functionality to the NetworkSocketHandler. Move the rest of the NetworkClientState to the new NetworkTCPSocketHandler class/struct, which is not yet implemented in an object oriented manner. The UDP socket handler now extends the NetworkSocketHandler instead of having a reference to a NetworkClientState.
rubidium
parents:
5775
diff
changeset
|
57 |
* @return new status of the connection. |
4a1391019791
(svn r8083) -Codechange: make a NetworkSocketHandler as base for all sockets and move a little of NetworkClientState functionality to the NetworkSocketHandler. Move the rest of the NetworkClientState to the new NetworkTCPSocketHandler class/struct, which is not yet implemented in an object oriented manner. The UDP socket handler now extends the NetworkSocketHandler instead of having a reference to a NetworkClientState.
rubidium
parents:
5775
diff
changeset
|
58 |
*/ |
4a1391019791
(svn r8083) -Codechange: make a NetworkSocketHandler as base for all sockets and move a little of NetworkClientState functionality to the NetworkSocketHandler. Move the rest of the NetworkClientState to the new NetworkTCPSocketHandler class/struct, which is not yet implemented in an object oriented manner. The UDP socket handler now extends the NetworkSocketHandler instead of having a reference to a NetworkClientState.
rubidium
parents:
5775
diff
changeset
|
59 |
virtual NetworkRecvStatus CloseConnection() { this->has_quit = true; return NETWORK_RECV_STATUS_OKAY; } |
4a1391019791
(svn r8083) -Codechange: make a NetworkSocketHandler as base for all sockets and move a little of NetworkClientState functionality to the NetworkSocketHandler. Move the rest of the NetworkClientState to the new NetworkTCPSocketHandler class/struct, which is not yet implemented in an object oriented manner. The UDP socket handler now extends the NetworkSocketHandler instead of having a reference to a NetworkClientState.
rubidium
parents:
5775
diff
changeset
|
60 |
|
4a1391019791
(svn r8083) -Codechange: make a NetworkSocketHandler as base for all sockets and move a little of NetworkClientState functionality to the NetworkSocketHandler. Move the rest of the NetworkClientState to the new NetworkTCPSocketHandler class/struct, which is not yet implemented in an object oriented manner. The UDP socket handler now extends the NetworkSocketHandler instead of having a reference to a NetworkClientState.
rubidium
parents:
5775
diff
changeset
|
61 |
/** |
4a1391019791
(svn r8083) -Codechange: make a NetworkSocketHandler as base for all sockets and move a little of NetworkClientState functionality to the NetworkSocketHandler. Move the rest of the NetworkClientState to the new NetworkTCPSocketHandler class/struct, which is not yet implemented in an object oriented manner. The UDP socket handler now extends the NetworkSocketHandler instead of having a reference to a NetworkClientState.
rubidium
parents:
5775
diff
changeset
|
62 |
* Whether this socket is currently bound to a socket. |
4a1391019791
(svn r8083) -Codechange: make a NetworkSocketHandler as base for all sockets and move a little of NetworkClientState functionality to the NetworkSocketHandler. Move the rest of the NetworkClientState to the new NetworkTCPSocketHandler class/struct, which is not yet implemented in an object oriented manner. The UDP socket handler now extends the NetworkSocketHandler instead of having a reference to a NetworkClientState.
rubidium
parents:
5775
diff
changeset
|
63 |
* @return true when the socket is bound, false otherwise |
4a1391019791
(svn r8083) -Codechange: make a NetworkSocketHandler as base for all sockets and move a little of NetworkClientState functionality to the NetworkSocketHandler. Move the rest of the NetworkClientState to the new NetworkTCPSocketHandler class/struct, which is not yet implemented in an object oriented manner. The UDP socket handler now extends the NetworkSocketHandler instead of having a reference to a NetworkClientState.
rubidium
parents:
5775
diff
changeset
|
64 |
*/ |
4a1391019791
(svn r8083) -Codechange: make a NetworkSocketHandler as base for all sockets and move a little of NetworkClientState functionality to the NetworkSocketHandler. Move the rest of the NetworkClientState to the new NetworkTCPSocketHandler class/struct, which is not yet implemented in an object oriented manner. The UDP socket handler now extends the NetworkSocketHandler instead of having a reference to a NetworkClientState.
rubidium
parents:
5775
diff
changeset
|
65 |
bool IsConnected() { return this->sock != INVALID_SOCKET; } |
4a1391019791
(svn r8083) -Codechange: make a NetworkSocketHandler as base for all sockets and move a little of NetworkClientState functionality to the NetworkSocketHandler. Move the rest of the NetworkClientState to the new NetworkTCPSocketHandler class/struct, which is not yet implemented in an object oriented manner. The UDP socket handler now extends the NetworkSocketHandler instead of having a reference to a NetworkClientState.
rubidium
parents:
5775
diff
changeset
|
66 |
|
4a1391019791
(svn r8083) -Codechange: make a NetworkSocketHandler as base for all sockets and move a little of NetworkClientState functionality to the NetworkSocketHandler. Move the rest of the NetworkClientState to the new NetworkTCPSocketHandler class/struct, which is not yet implemented in an object oriented manner. The UDP socket handler now extends the NetworkSocketHandler instead of having a reference to a NetworkClientState.
rubidium
parents:
5775
diff
changeset
|
67 |
/** |
4a1391019791
(svn r8083) -Codechange: make a NetworkSocketHandler as base for all sockets and move a little of NetworkClientState functionality to the NetworkSocketHandler. Move the rest of the NetworkClientState to the new NetworkTCPSocketHandler class/struct, which is not yet implemented in an object oriented manner. The UDP socket handler now extends the NetworkSocketHandler instead of having a reference to a NetworkClientState.
rubidium
parents:
5775
diff
changeset
|
68 |
* Whether the current client connected to the socket has quit. |
4a1391019791
(svn r8083) -Codechange: make a NetworkSocketHandler as base for all sockets and move a little of NetworkClientState functionality to the NetworkSocketHandler. Move the rest of the NetworkClientState to the new NetworkTCPSocketHandler class/struct, which is not yet implemented in an object oriented manner. The UDP socket handler now extends the NetworkSocketHandler instead of having a reference to a NetworkClientState.
rubidium
parents:
5775
diff
changeset
|
69 |
* In the case of UDP, for example, once a client quits (send bad |
4a1391019791
(svn r8083) -Codechange: make a NetworkSocketHandler as base for all sockets and move a little of NetworkClientState functionality to the NetworkSocketHandler. Move the rest of the NetworkClientState to the new NetworkTCPSocketHandler class/struct, which is not yet implemented in an object oriented manner. The UDP socket handler now extends the NetworkSocketHandler instead of having a reference to a NetworkClientState.
rubidium
parents:
5775
diff
changeset
|
70 |
* data), the socket in not closed; only the packet is dropped. |
4a1391019791
(svn r8083) -Codechange: make a NetworkSocketHandler as base for all sockets and move a little of NetworkClientState functionality to the NetworkSocketHandler. Move the rest of the NetworkClientState to the new NetworkTCPSocketHandler class/struct, which is not yet implemented in an object oriented manner. The UDP socket handler now extends the NetworkSocketHandler instead of having a reference to a NetworkClientState.
rubidium
parents:
5775
diff
changeset
|
71 |
* @return true when the current client has quit, false otherwise |
4a1391019791
(svn r8083) -Codechange: make a NetworkSocketHandler as base for all sockets and move a little of NetworkClientState functionality to the NetworkSocketHandler. Move the rest of the NetworkClientState to the new NetworkTCPSocketHandler class/struct, which is not yet implemented in an object oriented manner. The UDP socket handler now extends the NetworkSocketHandler instead of having a reference to a NetworkClientState.
rubidium
parents:
5775
diff
changeset
|
72 |
*/ |
4a1391019791
(svn r8083) -Codechange: make a NetworkSocketHandler as base for all sockets and move a little of NetworkClientState functionality to the NetworkSocketHandler. Move the rest of the NetworkClientState to the new NetworkTCPSocketHandler class/struct, which is not yet implemented in an object oriented manner. The UDP socket handler now extends the NetworkSocketHandler instead of having a reference to a NetworkClientState.
rubidium
parents:
5775
diff
changeset
|
73 |
bool HasClientQuit() { return this->has_quit; } |
6121
f254b194347f
(svn r8459) -Codechange: move (Send|Recv)GRFIdentifier to NetworkSocketHandler, so it can also be used the TCP socket handler.
rubidium
parents:
6115
diff
changeset
|
74 |
|
f254b194347f
(svn r8459) -Codechange: move (Send|Recv)GRFIdentifier to NetworkSocketHandler, so it can also be used the TCP socket handler.
rubidium
parents:
6115
diff
changeset
|
75 |
void Send_GRFIdentifier(Packet *p, const GRFIdentifier *grf); |
f254b194347f
(svn r8459) -Codechange: move (Send|Recv)GRFIdentifier to NetworkSocketHandler, so it can also be used the TCP socket handler.
rubidium
parents:
6115
diff
changeset
|
76 |
void Recv_GRFIdentifier(Packet *p, GRFIdentifier *grf); |
5875
4a1391019791
(svn r8083) -Codechange: make a NetworkSocketHandler as base for all sockets and move a little of NetworkClientState functionality to the NetworkSocketHandler. Move the rest of the NetworkClientState to the new NetworkTCPSocketHandler class/struct, which is not yet implemented in an object oriented manner. The UDP socket handler now extends the NetworkSocketHandler instead of having a reference to a NetworkClientState.
rubidium
parents:
5775
diff
changeset
|
77 |
}; |
4a1391019791
(svn r8083) -Codechange: make a NetworkSocketHandler as base for all sockets and move a little of NetworkClientState functionality to the NetworkSocketHandler. Move the rest of the NetworkClientState to the new NetworkTCPSocketHandler class/struct, which is not yet implemented in an object oriented manner. The UDP socket handler now extends the NetworkSocketHandler instead of having a reference to a NetworkClientState.
rubidium
parents:
5775
diff
changeset
|
78 |
|
5774
9df45c532d5d
(svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater.
rubidium
parents:
diff
changeset
|
79 |
#endif /* ENABLE_NETWORK */ |
9df45c532d5d
(svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater.
rubidium
parents:
diff
changeset
|
80 |
|
9df45c532d5d
(svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater.
rubidium
parents:
diff
changeset
|
81 |
#endif /* NETWORK_CORE_H */ |