|
Crossfire Client, Trunk
R18666
|
#include <netdb.h>#include <sys/types.h>#include <sys/socket.h>#include <netinet/in.h>#include <arpa/inet.h>#include <ctype.h>#include <stdio.h>#include <stdlib.h>#include <client.h>#include <cconfig.h>#include <external.h>#include <metaserver.h>
Go to the source code of this file.
Functions | |
| int | meta_sort (Meta_Info *m1, Meta_Info *m2) |
| int | check_server_version (int entry) |
| void | metaserver_update_cache (const char *server_name, const char *server_ip) |
| size_t | metaserver2_writer (void *ptr, size_t size, size_t nmemb, void *data) |
| void * | metaserver2_thread (void *junk) |
| int | metaserver2_get_info (void) |
| void | init_metaserver (void) |
| void * | metaserver1_thread (void *junk) |
| int | metaserver1_get_info (void) |
| int | metaserver_check_status (void) |
| int | metaserver_get_info (char *metaserver, int meta_port) |
| void | metaserver_show (int show_selection) |
| int | metaserver_select (char *sel) |
Variables | |
| const char *const | rcsid_common_metaserver_c = "$Id: metaserver.c 15072 2011-09-10 10:59:18Z ryo_saeba $" |
| Meta_Info * | meta_servers = NULL |
| int | meta_numservers = 0 |
| int | cached_servers_num = 0 |
| char * | cached_servers_name [CACHED_SERVERS_MAX] |
| char * | cached_servers_ip [CACHED_SERVERS_MAX] |
| const char * | cached_server_file = NULL |
| pthread_mutex_t | ms2_info_mutex |
Deals with contacting the metaserver, getting a list of hosts, displaying and returning them to calling function, and then connecting to the server when requested.
Definition in file metaserver.c.
| int check_server_version | ( | int | entry | ) |
This checks the servers sc_version and cs_version to see if they are compatible.
| entry | entry number in the metaservers array to check. |
Definition at line 72 of file metaserver.c.

| void init_metaserver | ( | void | ) |
Does single use initalization of metaserver2 variables.
Definition at line 541 of file metaserver.c.

| int metaserver1_get_info | ( | void | ) |
Definition at line 820 of file metaserver.c.


| void* metaserver1_thread | ( | void * | junk | ) |
Definition at line 636 of file metaserver.c.


| int metaserver2_get_info | ( | void | ) |
this is basically a replacement to the metaserver_get_info - idea being that when metaserver 1 support goes away, just yank that entire function and replace it with this.
Definition at line 507 of file metaserver.c.


| void* metaserver2_thread | ( | void * | junk | ) |
Thread function that goes off and collects metaserver data.
Definition at line 479 of file metaserver.c.


| size_t metaserver2_writer | ( | void * | ptr, |
| size_t | size, | ||
| size_t | nmemb, | ||
| void * | data | ||
| ) |
Curl doesn't really have any built in way to get data from the URL into string data - instead, we get a blob of data which we need to find the newlines, etc from. Curl also provides the data in multiple calls if there is lots of data, and does not break the data on newline, so we need to store the extra (unprocessed) data from one call to the next.
| ptr | pointer to data to process. |
| size | |
| nmemb | the size of each piece of data, and the number of these elements. We always presume the data is byte sized, and just multiple these together to get total amount of data. |
| data | user supplied data pointer - in this case, it points to a buffer which is used to store unprocessed information from one call to the next. |
Definition at line 295 of file metaserver.c.

| int metaserver_check_status | ( | void | ) |
Sees if we are gathering data or not. Note that we don't have to check to see what update methods are being used - the is_running flag is initialized to zero no matter if we are using that method to get the data, and unless we are using ms1 or ms2, the is_running flag will never get changed to be non-zero.
Definition at line 865 of file metaserver.c.

| int metaserver_get_info | ( | char * | metaserver, |
| int | meta_port | ||
| ) |
This contacts the metaserver and gets the list of servers. returns 0 on success, 1 on failure. Errors will get dumped to stderr, so most errors should be reasonably clear. metaserver and meta_port are the server name and port number to connect to.
Definition at line 882 of file metaserver.c.


| int metaserver_select | ( | char * | sel | ) |
String contains the selection that the player made for the metaserver. this may not be a a selection, but could be a host name or ip address. this returns 0 on sucessful selection, 1 if failure (invalid selection or the like.
Definition at line 964 of file metaserver.c.

| void metaserver_show | ( | int | show_selection | ) |
Show the metaservers to the player. We use draw_ext_info() to do that, and also let the player know they can enter their own host name.
Definition at line 899 of file metaserver.c.


| void metaserver_update_cache | ( | const char * | server_name, |
| const char * | server_ip | ||
| ) |
Add a server to the players server cache file.
| server_name | |
| server_ip |
Definition at line 178 of file metaserver.c.

| const char* cached_server_file = NULL |
Definition at line 110 of file metaserver.c.
Definition at line 108 of file metaserver.c.
Definition at line 107 of file metaserver.c.
| int cached_servers_num = 0 |
Definition at line 106 of file metaserver.c.
| int meta_numservers = 0 |
Definition at line 57 of file metaserver.c.
| Meta_Info* meta_servers = NULL |
Definition at line 55 of file metaserver.c.
| pthread_mutex_t ms2_info_mutex |
Definition at line 252 of file metaserver.c.
| const char* const rcsid_common_metaserver_c = "$Id: metaserver.c 15072 2011-09-10 10:59:18Z ryo_saeba $" |
Definition at line 1 of file metaserver.c.
1.7.6.1