Skip to content

Navigation Menu

Sign in
Sign up

A2S_INFO

Binary edited this page Oct 30, 2022 · 3 revisions

Synopsis

Structure reflecting the response of an A2S_INFO query.

Example

#include <ssq/a2s.h>
#include <inttypes.h>
#include <stdio.h>
SSQ_SERVER server;
// ...
A2S_INFO *info = ssq_info(&server);
if (ssq_server_ok(&server)) {
 printf("Players: %" PRIu8 "/%" PRIu8 "\n", info->players, info->max_players);
 if (ssq_info_has_keywords(&info))
 printf("Keywords: %s\n", info->keywords);
 ssq_info_free(info);
} else {
 // ...
}
// ...

Fields

Identifier Type Optional Description
protocol uint8_t Protocol version used by the server.
name char * Name of the server.
name_len size_t Length of the name string.
map char * Map the server has currently loaded.
map_len size_t Length of the map string.
folder char * Name of the folder containing the game files.
folder_len size_t Length of the folder string.
game char * Full name of the game.
game_len char * Length of the game string.
id uint16_t Steam Application ID of game.
players uint8_t Number of players on the server.
max_players uint8_t Maximum number of players the server reports it can hold.
bots uint8_t Number of bots on the server.
server_type A2S_SERVER_TYPE The type of server.
environment A2S_ENVIRONMENT The operating system of the server.
visibility bool Whether the server requires a password.
vac bool Whether the server uses VAC.
version char * Version of the game installed on the server.
version_len size_t Length of the version string.
edf uint8_t Extra Data Flag.
port uint16_t yes The server's game port number.
steamid uint64_t yes Server's SteamID.
stv_port uint16_t yes Spectator port number for SourceTV.
stv_name char * yes Name of the spectator server for SourceTV.
stv_name_len size_t yes Length of the stv_name string.
keywords char * yes Tags that describe the game according to the server.
keywords_len size_t yes Length of the keywords string.
gameid uint64_t yes The server's 64-bit Game ID.

Optional Fields

Helper functions are available to check if an optional field is present.

Identifier Helper
port ssq_info_has_port
steamid ssq_info_has_steamid
stv_port ssq_info_has_stv
stv_name ssq_info_has_stv
stv_name_len ssq_info_has_stv
keywords ssq_info_has_keywords
keywords_len ssq_info_has_keywords
gameid ssq_info_has_gameid

Enums

A2S_SERVER_TYPE

  • A2S_SERVER_TYPE_DEDICATED: The server is a dedicated server.
  • A2S_SERVER_TYPE_NON_DEDICATED: The server is a non-dedicated server.
  • A2S_SERVER_TYPE_STV_RELAY: The server is a SourceTV relay (proxy).
  • A2S_SERVER_TYPE_UNKNOWN: Unknown server type.

A2S_ENVIRONMENT

  • A2S_ENVIRONMENT_LINUX: The server runs on Linux.
  • A2S_ENVIRONMENT_WINDOWS: The server runs on Windows.
  • A2S_ENVIRONMENT_MAC: The server runs on Mac.
  • A2S_ENVIRONMENT_UNKNOWN: Unknown operating system.

Functions

ssq_info

Send an A2S_INFO query to a Source game server.

Arguments

Name Type Nullable Description
server SSQ_SERVER * no Source game server to query.

Return value

Returns NULL when an error occurs, otherwise returns an A2S_INFO structure containing basic information about the server.

Notes

⚠️ The A2S_INFO structure must be freed with ssq_info_free when done using it.

⚠️ When an error occurs, it must be cleared with ssq_server_err_clr when done handling it.

ssq_info_free

Free an A2S_INFO structure.

Arguments

Name Type Nullable Description
info A2S_INFO * no A2S_INFO structure to free.

Clone this wiki locally

AltStyle によって変換されたページ (->オリジナル) /