| rc_aaa_ctx(3) | Radius client library | rc_aaa_ctx(3) |
NAME
rc_aaa_ctx - Builds an authentication/accounting request and submits it to a server, optionally returning context.
SYNOPSIS
#include <radcli/>
int rc_aaa_ctx(
rc_handle *rh,
RC_AAA_CTX **ctx,
uint32_t nas_port,
VALUE_PAIR *send,
VALUE_PAIR **received,
char *msg,
int add_nas_port,
rc_standard_codes request_type
);
DESCRIPTION
Selects the server list from configuration (authserver or acctserver depending on request_type and transport), sends the request with automatic retry and server failover, and returns the server's response.
PARAMETERS
- rh
- a handle to parsed configuration.
- ctx
- if non-NULL, receives an allocated RC_AAA_CTX on success; the caller must free it with rc_aaa_ctx_free(). Pass NULL if not needed.
- nas_port
- the physical NAS port number to include (may be zero).
- send
- VALUE_PAIR list of attributes to send (e.g., PW_USER_NAME).
- received
- on success, receives the server's reply VALUE_PAIR list; the caller must free it with rc_avpair_free().
- msg
- if non-NULL, must point to a buffer of PW_MAX_MSG_SIZE bytes; will contain the concatenation of any PW_REPLY_MESSAGE attributes received.
- add_nas_port
- if non-zero, PW_NAS_PORT is added to the sent pairs.
- request_type
- one of the standard RADIUS codes (e.g., PW_ACCESS_REQUEST).
STRUCTURES
Avoid using this structure directly. Use rc_avpair_get_uint32() for integer/IPv4/date values, rc_avpair_get_in6() for IPv6 addresses and prefixes, rc_avpair_get_raw() for string/binary values, and rc_avpair_get_attr() to read the attribute type and ID. To iterate the list use rc_avpair_next(). Free the entire list with rc_avpair_free().
struct rc_value_pair {
char name[RC_NAME_LENGTH+1]; // attribute name if known.
uint64_t attribute; // attribute numeric value of type rc_attr_id including vendor; use VENDOR() and ATTRID() to separate.
rc_attr_type type; // attribute type.
uint32_t lvalue; // attribute value if type is PW_TYPE_INTEGER, PW_TYPE_DATE or PW_TYPE_IPADDR.
char strvalue[AUTH_STRING_LEN+1]; // contains attribute value in other cases.
struct rc_value_pair *next;
char pad[32]; // unused pad
};
Avoid using this structure directly. Use rc_avpair_get_uint32() for integer/IPv4/date values, rc_avpair_get_in6() for IPv6 addresses and prefixes, rc_avpair_get_raw() for string/binary values, and rc_avpair_get_attr() to read the attribute type and ID. To iterate the list use rc_avpair_next(). Free the entire list with rc_avpair_free().
struct rc_value_pair {
char name[RC_NAME_LENGTH+1]; // attribute name if known.
uint64_t attribute; // attribute numeric value of type rc_attr_id including vendor; use VENDOR() and ATTRID() to separate.
rc_attr_type type; // attribute type.
uint32_t lvalue; // attribute value if type is PW_TYPE_INTEGER, PW_TYPE_DATE or PW_TYPE_IPADDR.
char strvalue[AUTH_STRING_LEN+1]; // contains attribute value in other cases.
struct rc_value_pair *next;
char pad[32]; // unused pad
};
RETURN VALUE
OK_RC (0) on success, CHALLENGE_RC (3) on Access-Challenge, REJECT_RC (2) on Access-Reject, or a negative error code on failure.
SEE ALSO
rc_aaa(3), rc_aaa_ctx_free(3), rc_aaa_ctx_get_secret(3), rc_aaa_ctx_get_vector(3), rc_aaa_ctx_server(3), rc_acct(3), rc_acct_async(3), rc_acct_proxy(3), rc_add_config(3), rc_apply_config(3), rc_auth(3), rc_auth_proxy(3), rc_avpair_add(3), rc_avpair_assign(3), rc_avpair_copy(3), rc_avpair_free(3), rc_avpair_gen(3), rc_avpair_get(3), rc_avpair_get_attr(3), rc_avpair_get_in6(3), rc_avpair_get_raw(3), rc_avpair_get_uint32(3), rc_avpair_insert(3), rc_avpair_log(3), rc_avpair_new(3), rc_avpair_next(3), rc_avpair_parse(3), rc_avpair_remove(3), rc_avpair_tostr(3), rc_buildreq(3), rc_check(3), rc_conf_int(3), rc_conf_srv(3), rc_conf_str(3), rc_config_free(3), rc_config_init(3), rc_destroy(3), rc_dict_addattr(3), rc_dict_addval(3), rc_dict_addvend(3), rc_dict_findattr(3), rc_dict_findval(3), rc_dict_findvend(3), rc_dict_free(3), rc_dict_getattr(3), rc_dict_getval(3), rc_dict_getvend(3), rc_find_server_addr(3), rc_get_socket_type(3), rc_new(3), rc_read_config(3), rc_read_dictionary(3), rc_read_dictionary_from_buffer(3), rc_send_server(3), rc_test_config(3)
| 2026-08-19 | radcli |