src/network/core/core.h
changeset 5870 5056f5b1d16a
parent 5864 a95a2849b0e1
child 5872 63eafeb3f393
equal deleted inserted replaced
5869:afb520bafcdc 5870:5056f5b1d16a
     4 #define NETWORK_CORE_H
     4 #define NETWORK_CORE_H
     5 
     5 
     6 #ifdef ENABLE_NETWORK
     6 #ifdef ENABLE_NETWORK
     7 
     7 
     8 #include "os_abstraction.h"
     8 #include "os_abstraction.h"
       
     9 #include "../../newgrf_config.h"
     9 
    10 
    10 /**
    11 /**
    11  * @file core.h Base for all network types (UDP and TCP)
    12  * @file core.h Base for all network types (UDP and TCP)
    12  */
    13  */
    13 
    14 
    24 	NETWORK_RECV_STATUS_SERVER_ERROR,     ///< The server told us we made an error
    25 	NETWORK_RECV_STATUS_SERVER_ERROR,     ///< The server told us we made an error
    25 	NETWORK_RECV_STATUS_SERVER_FULL,      ///< The server is full
    26 	NETWORK_RECV_STATUS_SERVER_FULL,      ///< The server is full
    26 	NETWORK_RECV_STATUS_SERVER_BANNED,    ///< The server has banned us
    27 	NETWORK_RECV_STATUS_SERVER_BANNED,    ///< The server has banned us
    27 	NETWORK_RECV_STATUS_CLOSE_QUERY,      ///< Done quering the server
    28 	NETWORK_RECV_STATUS_CLOSE_QUERY,      ///< Done quering the server
    28 } NetworkRecvStatus;
    29 } NetworkRecvStatus;
       
    30 
       
    31 /** Forward declaration due to circular dependencies */
       
    32 class Packet;
    29 
    33 
    30 /**
    34 /**
    31  * SocketHandler for all network sockets in OpenTTD.
    35  * SocketHandler for all network sockets in OpenTTD.
    32  */
    36  */
    33 class NetworkSocketHandler {
    37 class NetworkSocketHandler {
    64 	 * In the case of UDP, for example, once a client quits (send bad
    68 	 * In the case of UDP, for example, once a client quits (send bad
    65 	 * data), the socket in not closed; only the packet is dropped.
    69 	 * data), the socket in not closed; only the packet is dropped.
    66 	 * @return true when the current client has quit, false otherwise
    70 	 * @return true when the current client has quit, false otherwise
    67 	 */
    71 	 */
    68 	bool HasClientQuit() { return this->has_quit; }
    72 	bool HasClientQuit() { return this->has_quit; }
       
    73 
       
    74 	void Send_GRFIdentifier(Packet *p, const GRFIdentifier *grf);
       
    75 	void Recv_GRFIdentifier(Packet *p, GRFIdentifier *grf);
    69 };
    76 };
    70 
    77 
    71 #endif /* ENABLE_NETWORK */
    78 #endif /* ENABLE_NETWORK */
    72 
    79 
    73 #endif /* NETWORK_CORE_H */
    80 #endif /* NETWORK_CORE_H */