Skip to content

A2S_RULES

Binary edited this page Jan 30, 2023 · 2 revisions

Synopsis

Sending and receiving A2S_RULES queries.

Example

#include <ssq/a2s.h>

SSQ_SERVER *server = ssq_server_new(...);

// ...

uint16_t rule_count;
A2S_RULES *rules = ssq_rules(server, &rule_count);
if (!ssq_server_eok(server)) { // query failed
    fprintf(stderr, "ssq_rules: %s\n", ssq_server_emsg(server));
    ssq_server_eclr(server); // clear error once done handling
} else { // query succeeded
    printf("There are %hu rules:\n", rule_count);
    for (uint16_t i = 0; i < rule_count; ++i)
        printf("%s = %s\n", rules[i].name, rules[i].value);
    ssq_rules_free(rules, rule_count); // free returned value once done using
}

// ...

ssq_server_free(server);

Fields

Identifier Type Description
name char * Name of the rule.
name_len size_t Length of the name string.
value char * Value of the rule.
value_len size_t Length of the value field.

Functions

ssq_rules

Sends an A2S_RULES query to a Source game server.

Arguments

Name Type Nullable Description
server SSQ_SERVER * no Source game server to query.
rule_count uint16_t * no Number of rules in the response.

Return value

Returns an A2S_RULES structure array of size *rule_count containing the rules the server is using.

Notes

⚠️ The returned value must be freed using ssq_rules_free.

⚠️ The returned value is NULL when there are 0 rules in the response.

ssq_rules_free

Frees an A2S_RULES structure array.

Arguments

Name Type Nullable Description
rules A2S_RULES * no A2S_RULES structure array to free.
rule_count uint16_t Number of rules in the array.
Clone this wiki locally