-
Notifications
You must be signed in to change notification settings - Fork 5
A2S_RULES
Binary edited this page Jan 30, 2023
·
2 revisions
Sending and receiving A2S_RULES queries.
#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);
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. |
Sends an A2S_RULES query to a Source game server.
Name | Type | Nullable | Description |
---|---|---|---|
server | SSQ_SERVER * |
no | Source game server to query. |
rule_count | uint16_t * |
no | Number of rules in the response. |
Returns an A2S_RULES
structure array of size *rule_count
containing the rules the server is using.
ssq_rules_free
.
NULL
when there are 0 rules in the response.
Frees an A2S_RULES structure array.
Name | Type | Nullable | Description |
---|---|---|---|
rules | A2S_RULES * |
no | A2S_RULES structure array to free. |
rule_count | uint16_t |
Number of rules in the array. |