libspades
Ace of Spades library
Main Page
Related Pages
Topics
Data Structures
common
serverlist.h
1
#ifndef LIBSPADES_SERVERLIST_H
2
#define LIBSPADES_SERVERLIST_H
3
#ifdef __cplusplus
4
extern
"C"
{
5
#endif
6
7
#include <enet/enet.h>
8
#include <stddef.h>
9
#include <time.h>
10
#include "datatypes.h"
11
12
struct
ServerListConnection
{
13
ENetHost *host;
14
char
*domain;
15
int
enabled;
16
uint16_t port;
17
char
serverName[32];
18
char
gameMode[8];
19
char
mapName[21];
20
uint8_t maxPlayers;
21
uint8_t currentPlayers;
22
};
23
24
struct
ServerEntry
{
25
char
name[32];
/* server name */
26
char
identifier[23];
/* aos identifier in format:
27
`aos://address:port:protocol`. address is a single
28
number, and anything after the address is optional,
29
but must be in the sequence shown. */
30
char
map[21];
/* map name */
31
char
game_mode[8];
/* gamemode name */
32
char
country[2];
/* two-letter country code that should conform to ISO
33
3166-1 alpha-2. also see
34
`https://www.buildandshoot.com/assets/js/main.js`,
35
although it seems to be missing a few country codes
36
(specifically BQ). */
37
int
latency;
/* the server's ping in milliseconds */
38
uint_fast8_t players_current;
/* usually the amount of clients connected to the
39
server, regardless of whether they have
40
actually "joined" the game or not */
41
uint_fast8_t players_max;
/* the total amount of clients that can connect
42
to the server at once */
43
time_t last_updated;
/* the last time as a unix timestamp in seconds that the
44
server reported a player count change or map change */
45
char
game_version[5];
/* the protocol version used by the server in format
46
0.XX */
47
};
48
49
struct
ServerList
{
50
size_t
serverCount;
/* amount of serverEntries */
51
struct
ServerEntry
*serverEntries;
52
};
53
54
int
libspades_get_server_list(
struct
ServerList
*serverList);
55
void
libspades_serverlist_major_update(
const
struct
ServerListConnection
*connection);
56
void
libspades_serverlist_player_count_update(
const
struct
ServerListConnection
*connection);
57
int
libspades_serverlist_connection_create2(
struct
ServerListConnection
*connection,
const
char
*domain);
58
int
libspades_serverlist_connection_create(
struct
ServerListConnection
*connection);
59
void
libspades_serverlist_service(
struct
ServerListConnection
*connection);
60
61
#ifdef __cplusplus
62
}
63
#endif
64
#endif
ServerEntry
Definition
serverlist.h:24
ServerListConnection
Definition
serverlist.h:12
ServerList
Definition
serverlist.h:49
This documentation has been rid of all JavaScript for a better experience. Generated by
1.13.2