Receive-side mirror of radcli2-avp-by-num: fold radcli_dict_lookup_num() + radcli_avp_get() + the matching typed getter into one call, for the common case of a well-known, single-occurrence attribute a caller already has a legacy PW_* constant for.
More...
|
| const radcli_avp * | radcli_avp_get_by_num (const radcli_avp_list *list, const radcli_ctx *ctx, uint32_t attrid, uint32_t vendor, unsigned idx) |
| | Look up the idx-th occurrence of an attribute by legacy numeric ID.
|
| int | radcli_avp_get_uint32_by_num (const radcli_avp_list *list, const radcli_ctx *ctx, uint32_t attrid, uint32_t vendor, uint32_t *out) |
| | Look up an integer/IPv4-address/date-typed attribute by legacy numeric ID and read its first occurrence.
|
| int | radcli_avp_get_uint64_by_num (const radcli_avp_list *list, const radcli_ctx *ctx, uint32_t attrid, uint32_t vendor, uint64_t *out) |
| | Look up a 64-bit integer-typed attribute by legacy numeric ID and read its first occurrence.
|
| int | radcli_avp_get_ip6_by_num (const radcli_avp_list *list, const radcli_ctx *ctx, uint32_t attrid, uint32_t vendor, struct in6_addr *out, unsigned *prefix) |
| | Look up an IPv6-address or IPv6-prefix-typed attribute by legacy numeric ID and read its first occurrence.
|
| int | radcli_avp_get_ip4prefix_by_num (const radcli_avp_list *list, const radcli_ctx *ctx, uint32_t attrid, uint32_t vendor, struct in_addr *out, unsigned *prefix) |
| | Look up an IPv4-prefix-typed attribute by legacy numeric ID and read its first occurrence.
|
| int | radcli_avp_get_bytes_by_num (const radcli_avp_list *list, const radcli_ctx *ctx, uint32_t attrid, uint32_t vendor, const void **out, size_t *len) |
| | Look up an attribute by legacy numeric ID and read its first occurrence's raw bytes.
|
| const char * | radcli_avp_get_cstr_by_num (const radcli_avp_list *list, const radcli_ctx *ctx, uint32_t attrid, uint32_t vendor) |
| | Look up an attribute by legacy numeric ID and read its first occurrence as a NUL-terminated string.
|
Receive-side mirror of radcli2-avp-by-num: fold radcli_dict_lookup_num() + radcli_avp_get() + the matching typed getter into one call, for the common case of a well-known, single-occurrence attribute a caller already has a legacy PW_* constant for.
Each returns the first occurrence only (idx 0) – the common case for every attribute that is not documented to legitimately repeat. An attribute that can carry more than one meaningful occurrence in a single reply (e.g. Reply-Message, Framed-Route) needs radcli_avp_get_by_num() (this group's plain finder, which does take idx) in a small loop instead – see radcli_avp_concat_str_by_num() for the specific, very common case of concatenating every occurrence of a text attribute.
◆ radcli_avp_get_by_num()
| const radcli_avp * radcli_avp_get_by_num |
( |
const radcli_avp_list * | list, |
|
|
const radcli_ctx * | ctx, |
|
|
uint32_t | attrid, |
|
|
uint32_t | vendor, |
|
|
unsigned | idx ) |
Look up the idx-th occurrence of an attribute by legacy numeric ID.
- Parameters
-
| list | the list to search. |
| ctx | a context with a dictionary loaded. |
| attrid | the attribute ID (a PW_* constant, or a vendor type ID when vendor is non-zero). |
| vendor | the vendor PEN, or 0 for a standard attribute. |
| idx | 0 for the first occurrence, 1 for the second, and so on. |
- Returns
- the matching attribute, or NULL if no such attribute is defined, or fewer than idx+1 occurrences exist in list.
Definition at line 952 of file avp.c.
◆ radcli_avp_get_bytes_by_num()
| int radcli_avp_get_bytes_by_num |
( |
const radcli_avp_list * | list, |
|
|
const radcli_ctx * | ctx, |
|
|
uint32_t | attrid, |
|
|
uint32_t | vendor, |
|
|
const void ** | out, |
|
|
size_t * | len ) |
Look up an attribute by legacy numeric ID and read its first occurrence's raw bytes.
- Parameters
-
| list | the list to search. |
| ctx | a context with a dictionary loaded. |
| attrid | the attribute ID (a PW_* constant, or a vendor type ID when vendor is non-zero). |
| vendor | the vendor PEN, or 0 for a standard attribute. |
| out | where to write a pointer to the value; valid for list's lifetime. May be NULL. |
| len | where to write the value's length in bytes. May be NULL. |
- Returns
- 0 on success, -1 on failure (no such attribute, or no occurrence).
Definition at line 1047 of file avp.c.
◆ radcli_avp_get_cstr_by_num()
| const char * radcli_avp_get_cstr_by_num |
( |
const radcli_avp_list * | list, |
|
|
const radcli_ctx * | ctx, |
|
|
uint32_t | attrid, |
|
|
uint32_t | vendor ) |
Look up an attribute by legacy numeric ID and read its first occurrence as a NUL-terminated string.
- Parameters
-
| list | the list to search. |
| ctx | a context with a dictionary loaded. |
| attrid | the attribute ID (a PW_* constant, or a vendor type ID when vendor is non-zero). |
| vendor | the vendor PEN, or 0 for a standard attribute. |
- Returns
- a pointer valid for list's lifetime (owned by list – never freed by the caller), or NULL if no such attribute is defined, no occurrence exists, or as radcli_avp_get_cstr() (embedded NUL byte, or invalid UTF-8 for a RADCLI_TYPE_TEXT attribute).
Definition at line 1068 of file avp.c.
◆ radcli_avp_get_ip4prefix_by_num()
| int radcli_avp_get_ip4prefix_by_num |
( |
const radcli_avp_list * | list, |
|
|
const radcli_ctx * | ctx, |
|
|
uint32_t | attrid, |
|
|
uint32_t | vendor, |
|
|
struct in_addr * | out, |
|
|
unsigned * | prefix ) |
Look up an IPv4-prefix-typed attribute by legacy numeric ID and read its first occurrence.
- Parameters
-
| list | the list to search. |
| ctx | a context with a dictionary loaded. |
| attrid | the attribute ID (a PW_* constant, or a vendor type ID when vendor is non-zero). |
| vendor | the vendor PEN, or 0 for a standard attribute. |
| out | where to write the address. May be NULL. |
| prefix | where to write the prefix length. May be NULL. |
- Returns
- 0 on success, -1 on failure (no such attribute, no occurrence, or as radcli_avp_get_ip4prefix()).
Definition at line 1027 of file avp.c.
◆ radcli_avp_get_ip6_by_num()
| int radcli_avp_get_ip6_by_num |
( |
const radcli_avp_list * | list, |
|
|
const radcli_ctx * | ctx, |
|
|
uint32_t | attrid, |
|
|
uint32_t | vendor, |
|
|
struct in6_addr * | out, |
|
|
unsigned * | prefix ) |
Look up an IPv6-address or IPv6-prefix-typed attribute by legacy numeric ID and read its first occurrence.
- Parameters
-
| list | the list to search. |
| ctx | a context with a dictionary loaded. |
| attrid | the attribute ID (a PW_* constant, or a vendor type ID when vendor is non-zero). |
| vendor | the vendor PEN, or 0 for a standard attribute. |
| out | where to write the address. May be NULL. |
| prefix | where to write the prefix length. May be NULL. |
- Returns
- 0 on success, -1 on failure (no such attribute, no occurrence, or as radcli_avp_get_ip6()).
Definition at line 1007 of file avp.c.
◆ radcli_avp_get_uint32_by_num()
| int radcli_avp_get_uint32_by_num |
( |
const radcli_avp_list * | list, |
|
|
const radcli_ctx * | ctx, |
|
|
uint32_t | attrid, |
|
|
uint32_t | vendor, |
|
|
uint32_t * | out ) |
Look up an integer/IPv4-address/date-typed attribute by legacy numeric ID and read its first occurrence.
- Parameters
-
| list | the list to search. |
| ctx | a context with a dictionary loaded. |
| attrid | the attribute ID (a PW_* constant, or a vendor type ID when vendor is non-zero). |
| vendor | the vendor PEN, or 0 for a standard attribute. |
| out | where to write the value; an IPv4 address is returned in host byte order. May be NULL. |
- Returns
- 0 on success, -1 on failure (no such attribute, no occurrence, or as radcli_avp_get_uint32()).
Definition at line 970 of file avp.c.
◆ radcli_avp_get_uint64_by_num()
| int radcli_avp_get_uint64_by_num |
( |
const radcli_avp_list * | list, |
|
|
const radcli_ctx * | ctx, |
|
|
uint32_t | attrid, |
|
|
uint32_t | vendor, |
|
|
uint64_t * | out ) |
Look up a 64-bit integer-typed attribute by legacy numeric ID and read its first occurrence.
- Parameters
-
| list | the list to search. |
| ctx | a context with a dictionary loaded. |
| attrid | the attribute ID (a PW_* constant, or a vendor type ID when vendor is non-zero). |
| vendor | the vendor PEN, or 0 for a standard attribute. |
| out | where to write the value. May be NULL. |
- Returns
- 0 on success, -1 on failure (no such attribute, no occurrence, or as radcli_avp_get_uint64()).
Definition at line 988 of file avp.c.