equal
deleted
inserted
replaced
1 #ifndef NETWORK_CONFIG_HH |
1 #ifndef NETWORK_CONFIG_HH |
2 #define NETWORK_CONFIG_HH |
2 #define NETWORK_CONFIG_HH |
3 |
3 |
4 // socket-related includes |
4 /** |
5 // copied from clanlib code, so should be relatively OS-safe |
5 * @file |
6 #ifndef WIN32 |
6 * |
7 #include <sys/socket.h> |
7 * Network-related configuration |
8 #include <netinet/in.h> |
8 */ |
9 #include <arpa/inet.h> |
|
10 #include <netdb.h> |
|
11 #include <sys/time.h> |
|
12 #include <unistd.h> |
|
13 #else |
|
14 #include <winsock2.h> |
|
15 #include <windows.h> |
|
16 typedef int socklen_t; |
|
17 #endif |
|
18 |
9 |
19 #include <string> |
10 #include <string> |
20 |
11 |
|
12 /** Default port used for network games */ |
21 const std::string NETWORK_PORT_STR = "9338"; |
13 const std::string NETWORK_PORT_STR = "9338"; |
22 |
14 |
|
15 /** Maximum packet size used for normal NetworkPackets... aligned to a sensible UDP mtu */ |
23 const size_t NETWORK_PACKET_SIZE = 1280; |
16 const size_t NETWORK_PACKET_SIZE = 1280; |
|
17 |
|
18 /** Backlog used for TCP server... doesn't really matter all that much */ |
24 const int NETWORK_LISTEN_BACKLOG = 5; |
19 const int NETWORK_LISTEN_BACKLOG = 5; |
25 |
20 |
|
21 /** Magic string used to identify game between client/server */ |
26 const char NETWORK_MAGIC_STR[8+1] = "KISNGLIS"; |
22 const char NETWORK_MAGIC_STR[8+1] = "KISNGLIS"; |
27 const uint64_t NETWORK_MAGIC_ID = * ((const uint64_t *) NETWORK_MAGIC_STR); |
23 const uint64_t NETWORK_MAGIC_ID = * ((const uint64_t *) NETWORK_MAGIC_STR); |
28 |
24 |
29 #endif /* NETWORK_CONFIG_HH */ |
25 #endif /* NETWORK_CONFIG_HH */ |