![]() |
Freeciv21
Develop your civilization from humble roots to a global empire
|
Include dependency graph for servers.h:
This graph shows which files directly or indirectly include this file:Go to the source code of this file.
Classes | |
| class | fcUdpScan |
| struct | str_players |
| struct | server |
Macros | |
| #define | SERVER_LAN_PORT 4555 |
| #define | SERVER_LAN_TTL 1 |
| #define | SERVER_LAN_VERSION 2 |
| #define | SPECLIST_TAG server |
| #define | SPECLIST_TYPE struct server |
| #define | server_list_iterate(serverlist, pserver) TYPED_LIST_ITERATE(struct server, serverlist, pserver) |
| #define | server_list_iterate_end LIST_ITERATE_END |
Typedefs | |
| typedef void(* | ServerScanErrorFunc) (struct server_scan *scan, const char *message) |
Enumerations | |
| enum | server_scan_status { SCAN_STATUS_ERROR = 0 , SCAN_STATUS_WAITING , SCAN_STATUS_PARTIAL , SCAN_STATUS_DONE , SCAN_STATUS_ABORT } |
| enum | server_scan_type { SERVER_SCAN_LOCAL , SERVER_SCAN_GLOBAL , SERVER_SCAN_LAST } |
Functions | |
| struct server_scan * | server_scan_begin (enum server_scan_type type, ServerScanErrorFunc error_func) |
| Creates a new server scan and returns it, or nullptr if impossible. More... | |
| enum server_scan_type | server_scan_get_type (const struct server_scan *scan) |
| A simple query function to determine the type of a server scan (previously allocated in server_scan_begin). More... | |
| enum server_scan_status | server_scan_poll (struct server_scan *scan) |
| A function to query servers of the server scan. More... | |
| struct server_list * | server_scan_get_list (struct server_scan *scan) |
| Returns the srv_list currently held by the scan (may be nullptr). More... | |
| void | server_scan_finish (struct server_scan *scan) |
| Closes the socket listening on the scan, frees the list of servers, and frees the memory allocated for 'scan' by server_scan_begin(). More... | |
| #define server_list_iterate | ( | serverlist, | |
| pserver | |||
| ) | TYPED_LIST_ITERATE(struct server, serverlist, pserver) |
| #define server_list_iterate_end LIST_ITERATE_END |
| typedef void(* ServerScanErrorFunc) (struct server_scan *scan, const char *message) |
| enum server_scan_status |
| enum server_scan_type |
| struct server_scan* server_scan_begin | ( | enum server_scan_type | type, |
| ServerScanErrorFunc | error_func | ||
| ) |
Creates a new server scan and returns it, or nullptr if impossible.
Depending on 'type' the scan will look for either local or internet games.
error_func provides a callback to be used in case of error; this callback probably should call server_scan_finish.
NB: You must call server_scan_finish() when you are done with the scan to free the memory and resources allocated by it.
Definition at line 518 of file servers.cpp.
Referenced by page_network::update_network_lists().
| void server_scan_finish | ( | struct server_scan * | scan | ) |
Closes the socket listening on the scan, frees the list of servers, and frees the memory allocated for 'scan' by server_scan_begin().
Definition at line 607 of file servers.cpp.
Referenced by page_network::destroy_server_scans().
| struct server_list* server_scan_get_list | ( | struct server_scan * | scan | ) |
Returns the srv_list currently held by the scan (may be nullptr).
Definition at line 594 of file servers.cpp.
Referenced by page_network::check_server_scan(), and page_network::slot_selection_changed().
| enum server_scan_type server_scan_get_type | ( | const struct server_scan * | scan | ) |
A simple query function to determine the type of a server scan (previously allocated in server_scan_begin).
Definition at line 518 of file servers.cpp.
Referenced by page_network::check_server_scan().
| enum server_scan_status server_scan_poll | ( | struct server_scan * | scan | ) |
A function to query servers of the server scan.
This will check any pending network data and update the server list.
The return value indicates the status of the server scan: SCAN_STATUS_ERROR - The scan failed and should be aborted. SCAN_STATUS_WAITING - The scan is in progress (continue polling). SCAN_STATUS_PARTIAL - The scan received some data, with more expected. Get the servers with server_scan_get_list(), and continue polling. SCAN_STATUS_DONE - The scan received all data it expected to receive. Get the servers with server_scan_get_list(), and stop calling this function. SCAN_STATUS_ABORT - The scan has been aborted
Definition at line 518 of file servers.cpp.
Referenced by page_network::check_server_scan().