radcli_avp_concat_str_by_num3
Look up an attribute by legacy numeric id and concatenate every occurrence into a bounded buffer.
Usage
#include <radcli/>
int radcli_avp_concat_str_by_num(
char *buf,
size_t buflen,
const radcli_avp_list *list,
const radcli_ctx *ctx,
uint32_t attrid,
uint32_t vendor,
const char *sep
);
Overview
The _by_num() wrapper for radcli_avp_concat_str(): equivalent to radcli_avp_concat_str(buf, buflen, l, radcli_dict_lookup_num(ctx, attrid,
vendor), sep), except that an unresolvable attribute ID is not itself a failure here it is treated the same as "no occurrence present" (buf set to an empty string, 0 returned), matching this function's legacy-ID convenience role: a caller passing a well-known PW_* constant should not have to separately handle "not in this dictionary" as an error case, the same way rc_aaa()'s msg never failed just because a reply had no Reply-Message.
Parameters
buf-
destination buffer, or NULL to only compute the needed size; see radcli_avp_concat_str().
buflen-
size of buf, in bytes; may be 0.
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.
sep-
separator inserted between occurrences; NULL or "" for none.
Return value
the number of bytes the joined result occupies (excluding the NUL terminator), whether or not it fit in buf; 0 if attrid/vendor resolves to no attribute.