Freeciv-3.3
|
Go to the source code of this file.
Data Structures | |
struct | server |
struct | server::players |
struct | srv_list |
Typedefs | |
typedef void(* | ServerScanErrorFunc) (struct server_scan *scan, const char *message) |
Enumerations | |
enum | server_scan_type { SERVER_SCAN_LOCAL , SERVER_SCAN_GLOBAL , SERVER_SCAN_LAST } |
enum | server_scan_status { SCAN_STATUS_ERROR = 0 , SCAN_STATUS_WAITING , SCAN_STATUS_PARTIAL , SCAN_STATUS_DONE , SCAN_STATUS_ABORT } |
Functions | |
struct server_scan * | server_scan_begin (enum server_scan_type type, ServerScanErrorFunc error_func) |
enum server_scan_type | server_scan_get_type (const struct server_scan *scan) |
enum server_scan_status | server_scan_poll (struct server_scan *scan) |
struct srv_list * | server_scan_get_list (struct server_scan *scan) |
void | server_scan_finish (struct server_scan *scan) |
#define server_list_iterate | ( | serverlist, | |
pserver | |||
) | TYPED_LIST_ITERATE(struct server, serverlist, pserver) |
#define server_list_iterate_end LIST_ITERATE_END |
struct server_scan * server_scan_begin | ( | enum server_scan_type | type, |
ServerScanErrorFunc | error_func | ||
) |
Creates a new server scan and returns it, or NULL 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 755 of file servers.c.
Referenced by sdl_create_server_list(), fc_client::update_network_lists(), and 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 879 of file servers.c.
Referenced by close_connection_dialog(), destroy_server_scans(), fc_client::destroy_server_scans(), exit_meta_server_dlg_callback(), server_scan_begin(), and server_scan_error().
struct srv_list * server_scan_get_list | ( | struct server_scan * | scan | ) |
Returns the srv_list currently held by the scan (may be NULL).
Definition at line 866 of file servers.c.
Referenced by check_server_scan(), fc_client::check_server_scan(), network_list_callback(), sdl_create_server_list(), and fc_client::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 809 of file servers.c.
Referenced by check_server_scan(), fc_client::check_server_scan(), and server_scan_error().
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 832 of file servers.c.
Referenced by check_server_scan(), fc_client::check_server_scan(), and sdl_create_server_list().