networkclient
|
Data Structures | |
union | value_pair_data |
struct | value_pair |
Typedefs | |
typedef union value_pair_data | VALUE_PAIR_DATA |
typedef struct value_pair | VALUE_PAIR |
Functions | |
VALUE_PAIR * | nr_vp_alloc (const DICT_ATTR *da) |
void | nr_vp_free (VALUE_PAIR **head) |
VALUE_PAIR * | nr_vp_init (VALUE_PAIR *vp, const DICT_ATTR *da) |
VALUE_PAIR * | nr_vp_alloc_raw (unsigned int attr, unsigned int vendor) |
int | nr_vp_set_data (VALUE_PAIR *vp, const void *data, size_t data_len) |
int | nr_vp_set_raw_data (VALUE_PAIR *vp, const void *data, size_t data_len) |
VALUE_PAIR * | nr_vp_create (int attr, int vendor, const void *data, size_t data_len) |
void | nr_vps_append (VALUE_PAIR **head, VALUE_PAIR *vp) |
VALUE_PAIR * | nr_vps_find (VALUE_PAIR *head, unsigned int attr, unsigned int vendor) |
These routines manage structures which map to attributes.
typedef struct value_pair VALUE_PAIR |
C structure version of a RADIUS attribute.
The library APIs use this structure to avoid depending on the details of the protocol.
typedef union value_pair_data VALUE_PAIR_DATA |
Union holding all possible types of data for a VALUE_PAIR.
VALUE_PAIR* nr_vp_alloc | ( | const DICT_ATTR * | da | ) |
Allocate a VALUE_PAIR which refers to a DICT_ATTR.
This returned VALUE_PAIR has no data associated with it. The nr_vp_set_data() function must be called before placing the VALUE_PAIR in a RADIUS_PACKET.
[in] | da | The DICT_ATTR associated with the VALUE_PAIR |
References nr_strerror_printf(), and nr_vp_init().
Referenced by nr_vp_create(), and nr_vp_sscanf().
VALUE_PAIR* nr_vp_alloc_raw | ( | unsigned int | attr, |
unsigned int | vendor | ||
) |
Allocate a VALUE_PAIR which refers to an unknown attribute.
It is used when an attribute is received, and that attribute does not exist in the dictionaries.
The returned VALUE_PAIR has no data (i.e. VALUE_PAIR::length is zero). The nr_vp_set_data() function must be called before placing the VALUE_PAIR in a RADIUS_PACKET.
[in] | attr | The attribute number, 0..2^16 |
[in] | vendor | The vendor number, 0..2^16 |
References da, nr_dict_attr_2struct(), and nr_strerror_printf().
VALUE_PAIR* nr_vp_create | ( | int | attr, |
int | vendor, | ||
const void * | data, | ||
size_t | data_len | ||
) |
Create a VALUE_PAIR and set its data.
[in] | attr | The attribute number of the VALUE_PAIR to create |
[in] | vendor | The vendor number of the VALUE_PAIR to create |
[in] | data | Data to set inside of the VALUE_PAIR |
[in] | data_len | Length of the data field |
References nr_dict_attr_byvalue(), nr_vp_alloc(), nr_vp_free(), and nr_vp_set_data().
void nr_vp_free | ( | VALUE_PAIR ** | head | ) |
Free a VALUE_PAIR.
This function frees the VALUE_PAIR, and sets the head pointer to NULL. If head refers to a VALUE_PAIR list, then all of the structures in the list are freed.
[in,out] | head | The pointer to a VALUE_PAIR, or a VALUE_PAIR list. |
References da, attr_flags::encrypt, nr_dict_attr::flags, and next.
Referenced by main(), nr_attr2vp_vsa(), nr_packet_decode(), nr_track_id_packet_free(), nr_vp_create(), and nr_vp_sscanf().
VALUE_PAIR* nr_vp_init | ( | VALUE_PAIR * | vp, |
const DICT_ATTR * | da | ||
) |
Initializes a VALUE_PAIR from a DICT_ATTR
This function assumes that the VALUE_PAIR points to existing and writable memory.
[in,out] | vp | The VALUE_PAIR to be initialized |
[in] | da | The DICT_ATTR used to initialize the VALUE_PAIR |
References da, nr_dict_attr::flags, attr_flags::length, and length.
Referenced by nr_packet_attr_append(), and nr_vp_alloc().
int nr_vp_set_data | ( | VALUE_PAIR * | vp, |
const void * | data, | ||
size_t | data_len | ||
) |
Set the data associated with a previously allocated VALUE_PAIR.
The data (e.g. integers) is in host byte order. This function should be called by an application when converting application data to VALUE_PAIR structures.
If this function succeeds, VALUE_PAIR::length is no longer zero, and the structure contains the data.
[in,out] | vp | The VALUE_PAIR to update |
[in] | data | Data to set inside of the VALUE_PAIR |
[in] | data_len | Length of the data field |
References da, length, NR_TYPE_BYTE, NR_TYPE_DATE, NR_TYPE_INTEGER, NR_TYPE_IPADDR, NR_TYPE_OCTETS, NR_TYPE_SHORT, NR_TYPE_STRING, return_NR_ERR, and nr_dict_attr::type.
Referenced by nr_packet_attr_append(), nr_vp_create(), and nr_vp_set_raw_data().
int nr_vp_set_raw_data | ( | VALUE_PAIR * | vp, |
const void * | data, | ||
size_t | data_len | ||
) |
Set the data associated with a previously allocated VALUE_PAIR.
The data (e.g. integers) is in network byte order. This function should be called when converting raw RADIUS packets to VALUE_PAIR structures. Most applications will not need to call this function.
If this function succeeds, VALUE_PAIR::length is no longer zero, and the structure contains the data.
[in,out] | vp | The VALUE_PAIR to update |
[in] | data | Data to set inside of the VALUE_PAIR |
[in] | data_len | Length of the data field |
References da, NR_TYPE_DATE, NR_TYPE_INTEGER, NR_TYPE_IPADDR, NR_TYPE_SHORT, nr_vp_set_data(), return_NR_ERR, and nr_dict_attr::type.
void nr_vps_append | ( | VALUE_PAIR ** | head, |
VALUE_PAIR * | vp | ||
) |
Append a VALUE_PAIR to the end of a VALUE_PAIR list.
[in,out] | head | The head of the VALUE_PAIR list. May not be NULL. |
[in] | vp | The VALUE_PAIR to append to the list. |
VALUE_PAIR* nr_vps_find | ( | VALUE_PAIR * | head, |
unsigned int | attr, | ||
unsigned int | vendor | ||
) |
Search a VALUE_PAIR list for one of a given number.
[in] | head | The head of the VALUE_PAIR list to search. |
[in] | attr | The attribute number of the VALUE_PAIR to find |
[in] | vendor | The vendor number of the VALUE_PAIR to find |
References nr_dict_attr::attr, da, next, and nr_dict_attr::vendor.