|
1 /* $Id$ */ |
|
2 |
|
3 #ifndef NETWORK_CORE_TCP_H |
|
4 #define NETWORK_CORE_TCP_H |
|
5 |
|
6 #ifdef ENABLE_NETWORK |
|
7 |
|
8 /** |
|
9 * @file tcp.h Basic functions to receive and send TCP packets. |
|
10 */ |
|
11 |
|
12 /** |
|
13 * Enum with all types of UDP packets. |
|
14 * The order of the first 4 packets MUST not be changed, as |
|
15 * it protects old clients from joining newer servers |
|
16 * (because SERVER_ERROR is the respond to a wrong revision) |
|
17 */ |
|
18 enum { |
|
19 PACKET_SERVER_FULL, |
|
20 PACKET_SERVER_BANNED, |
|
21 PACKET_CLIENT_JOIN, |
|
22 PACKET_SERVER_ERROR, |
|
23 PACKET_CLIENT_COMPANY_INFO, |
|
24 PACKET_SERVER_COMPANY_INFO, |
|
25 PACKET_SERVER_CLIENT_INFO, |
|
26 PACKET_SERVER_NEED_PASSWORD, |
|
27 PACKET_CLIENT_PASSWORD, |
|
28 PACKET_SERVER_WELCOME, |
|
29 PACKET_CLIENT_GETMAP, |
|
30 PACKET_SERVER_WAIT, |
|
31 PACKET_SERVER_MAP, |
|
32 PACKET_CLIENT_MAP_OK, |
|
33 PACKET_SERVER_JOIN, |
|
34 PACKET_SERVER_FRAME, |
|
35 PACKET_SERVER_SYNC, |
|
36 PACKET_CLIENT_ACK, |
|
37 PACKET_CLIENT_COMMAND, |
|
38 PACKET_SERVER_COMMAND, |
|
39 PACKET_CLIENT_CHAT, |
|
40 PACKET_SERVER_CHAT, |
|
41 PACKET_CLIENT_SET_PASSWORD, |
|
42 PACKET_CLIENT_SET_NAME, |
|
43 PACKET_CLIENT_QUIT, |
|
44 PACKET_CLIENT_ERROR, |
|
45 PACKET_SERVER_QUIT, |
|
46 PACKET_SERVER_ERROR_QUIT, |
|
47 PACKET_SERVER_SHUTDOWN, |
|
48 PACKET_SERVER_NEWGAME, |
|
49 PACKET_SERVER_RCON, |
|
50 PACKET_CLIENT_RCON, |
|
51 PACKET_END ///< Must ALWAYS be on the end of this list!! (period) |
|
52 }; |
|
53 |
|
54 void NetworkSend_Packet(Packet *packet, NetworkClientState *cs); |
|
55 Packet *NetworkRecv_Packet(NetworkClientState *cs, NetworkRecvStatus *status); |
|
56 bool NetworkSend_Packets(NetworkClientState *cs); |
|
57 |
|
58 #endif /* ENABLE_NETWORK */ |
|
59 |
|
60 #endif /* NETWORK_CORE_TCP_H */ |