1 /**********************************************************************
2  Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
3    This program is free software; you can redistribute it and/or modify
4    it under the terms of the GNU General Public License as published by
5    the Free Software Foundation; either version 2, or (at your option)
6    any later version.
7 
8    This program is distributed in the hope that it will be useful,
9    but WITHOUT ANY WARRANTY; without even the implied warranty of
10    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11    GNU General Public License for more details.
12 ***********************************************************************/
13 #ifndef FC__SERNET_H
14 #define FC__SERNET_H
15 
16 #ifdef __cplusplus
17 extern "C" {
18 #endif /* __cplusplus */
19 
20 struct connection;
21 
22 #define BUF_SIZE 512
23 
24 #define SERVER_LAN_PORT 4555
25 #define SERVER_LAN_TTL 1
26 #define SERVER_LAN_VERSION 2
27 
28 enum server_events {
29   S_E_END_OF_TURN_TIMEOUT,
30   S_E_OTHERWISE,
31   S_E_FORCE_END_OF_SNIFF,
32 };
33 
34 enum server_events server_sniff_all_input(void);
35 
36 int server_open_socket(void);
37 void flush_packets(void);
38 void close_connections_and_socket(void);
39 void init_connections(void);
40 int server_make_connection(int new_sock,
41                            const char *client_addr, const char *client_ip);
42 void handle_conn_pong(struct connection *pconn);
43 void handle_client_heartbeat(struct connection *pconn);
44 
45 #ifdef __cplusplus
46 }
47 #endif /* __cplusplus */
48 
49 #endif  /* FC__SERNET_H */
50