![]() |
Freeciv21
Develop your civilization from humble roots to a global empire
|
#include <memory>#include <optional>#include <variant>
Include dependency graph for sernet.h:
This graph shows which files directly or indirectly include this file:Go to the source code of this file.
Macros | |
| #define | BUF_SIZE 512 |
| #define | SERVER_LAN_PORT 4555 |
| #define | SERVER_LAN_TTL 1 |
| #define | SERVER_LAN_VERSION 2 |
Typedefs | |
| using | socket_server = std::variant< std::unique_ptr< QTcpServer >, std::unique_ptr< QLocalServer > > |
Functions | |
| std::optional< socket_server > | server_open_socket () |
| Open server socket to be used to accept client connections and open a server socket for server LAN announcements. More... | |
| void | flush_packets () |
| Attempt to flush all information in the send buffers for upto 'netwait' seconds. More... | |
| void | incoming_client_packets (connection *pconn) |
| Handle all incoming packets on a client connection. More... | |
| void | close_connections_and_socket () |
| Close all network stuff: connections, listening sockets, metaserver connection... More... | |
| void | really_close_connections () |
| Now really close connections marked as 'is_closing'. More... | |
| void | init_connections () |
| Initialize connection related stuff. More... | |
| int | server_make_connection (QIODevice *new_sock, const QString &client_addr, const QString &ip_addr) |
| Server accepts connection from client: Low level socket stuff, and basic-initialize the connection struct. More... | |
| void | finish_unit_waits () |
| Process all unit waits that are expired. More... | |
| void | connection_ping (struct connection *pconn) |
| Ping a connection. More... | |
| void | handle_conn_pong (struct connection *pconn) |
| Handle response to ping. More... | |
| void | handle_client_heartbeat (struct connection *pconn) |
| Handle client's regular hearbeat. More... | |
| void | get_lanserver_announcement () |
| Listen for UDP packets multicasted from clients requesting announcement of servers on the LAN. More... | |
| using socket_server = std::variant<std::unique_ptr<QTcpServer>, std::unique_ptr<QLocalServer> > |
| void close_connections_and_socket | ( | ) |
Close all network stuff: connections, listening sockets, metaserver connection...
Definition at line 106 of file sernet.cpp.
Referenced by server_quit().
| void connection_ping | ( | struct connection * | pconn | ) |
Ping a connection.
Definition at line 527 of file sernet.cpp.
Referenced by freeciv::server::send_pings().
| void finish_unit_waits | ( | ) |
Process all unit waits that are expired.
Definition at line 503 of file sernet.cpp.
Referenced by freeciv::server::pulse().
| void flush_packets | ( | ) |
Attempt to flush all information in the send buffers for upto 'netwait' seconds.
Definition at line 187 of file sernet.cpp.
Referenced by begin_phase(), dai_do_first_activities(), end_phase(), send_all_known_cities(), send_all_known_tiles(), and send_all_known_units().
| void get_lanserver_announcement | ( | ) |
Listen for UDP packets multicasted from clients requesting announcement of servers on the LAN.
Definition at line 572 of file sernet.cpp.
Referenced by freeciv::server::pulse().
| void handle_client_heartbeat | ( | struct connection * | pconn | ) |
Handle client's regular hearbeat.
Definition at line 563 of file sernet.cpp.
| void handle_conn_pong | ( | struct connection * | pconn | ) |
Handle response to ping.
Definition at line 541 of file sernet.cpp.
Referenced by server_packet_input().
| void incoming_client_packets | ( | struct connection * | pconn | ) |
Handle all incoming packets on a client connection.
Precondition - we have read_socket_data. Postcondition - there are no more packets to handle on this connection.
Definition at line 229 of file sernet.cpp.
Referenced by freeciv::server::input_on_socket().
| void init_connections | ( | ) |
Initialize connection related stuff.
Attention: Logging is not available within this functions!
Definition at line 452 of file sernet.cpp.
Referenced by main().
| void really_close_connections | ( | ) |
Now really close connections marked as 'is_closing'.
Do this here to avoid recursive sending.
Definition at line 140 of file sernet.cpp.
Referenced by freeciv::server::error_on_socket(), and freeciv::server::input_on_socket().
| int server_make_connection | ( | QIODevice * | new_sock, |
| const QString & | client_addr, | ||
| const QString & | ip_addr | ||
| ) |
Server accepts connection from client: Low level socket stuff, and basic-initialize the connection struct.
Returns 0 on success, -1 on failure (bad accept(), or too many connections).
Definition at line 310 of file sernet.cpp.
Referenced by freeciv::server::accept_local_connections(), and freeciv::server::accept_tcp_connections().
| std::optional<socket_server> server_open_socket | ( | ) |
Open server socket to be used to accept client connections and open a server socket for server LAN announcements.
Definition at line 370 of file sernet.cpp.