networkclient
|
Functions | |
ssize_t | nr_vp2attr (const RADIUS_PACKET *packet, const RADIUS_PACKET *original, const VALUE_PAIR **pvp, uint8_t *data, size_t room) |
ssize_t | nr_vp2rfc (const RADIUS_PACKET *packet, const RADIUS_PACKET *original, const VALUE_PAIR **pvp, uint8_t *data, size_t room) |
ssize_t | nr_attr2vp (const RADIUS_PACKET *packet, const RADIUS_PACKET *original, const uint8_t *data, size_t length, VALUE_PAIR **pvp) |
ssize_t | nr_attr2vp_rfc (const RADIUS_PACKET *packet, const RADIUS_PACKET *original, const uint8_t *data, size_t length, VALUE_PAIR **pvp) |
ssize_t | nr_attr2vp_vsa (const RADIUS_PACKET *packet, const RADIUS_PACKET *original, const uint8_t *data, size_t length, VALUE_PAIR **pvp) |
ssize_t | nr_attr2vp_raw (const RADIUS_PACKET *packet, const RADIUS_PACKET *original, const uint8_t *data, size_t length, VALUE_PAIR **pvp) |
ssize_t | nr_attr2data (const RADIUS_PACKET *packet, ssize_t start, unsigned int attr, unsigned int vendor, const uint8_t **pdata, size_t *plength) |
These routines perform "low level" encoding, decoding, sending, and reception of RADIUS attributes. They are called by the Packet manipulation functions.
ssize_t nr_attr2data | ( | const RADIUS_PACKET * | packet, |
ssize_t | start, | ||
unsigned int | attr, | ||
unsigned int | vendor, | ||
const uint8_t ** | pdata, | ||
size_t * | plength | ||
) |
Returns raw data from the RADIUS packet, for a given attribute.
This function can be called repeatedly to find all instances of a given attribute. The first time it is called, the "start" parameter should be zero. If the function returns a non-zero positive number, it means that there may be more attributes available. The returned value should be then passed via the "start" option in any subsequent calls to the function.
This function should be called by an application when it wants access to data which is not in the pre-defined dictionaries.
[in] | packet | The packet containing the attribute. |
[in] | start | Where in the packet we start searching for the attribute. |
[in] | attr | Value of the attribute to search for |
[in] | vendor | Value of the vendor (use 0 for IETF attributes) |
[out] | pdata | Pointer to the data. If no data was found, the pointer is unchanged. |
[out] | plength | Length of the data. If no data was found, the value pointed to is unchanged. |
References radius_packet::data, nr_dict_vendor::length, radius_packet::length, nr_debug_error, nr_dict_vendor_byvalue(), PW_VENDOR_SPECIFIC, return_NR_ERR, and nr_dict_vendor::type.
ssize_t nr_attr2vp | ( | const RADIUS_PACKET * | packet, |
const RADIUS_PACKET * | original, | ||
const uint8_t * | data, | ||
size_t | length, | ||
VALUE_PAIR ** | pvp | ||
) |
Decodes any attribute into a VALUE_PAIR.
[in] | packet | The packet containing the attribute to be decoded. |
[in] | original | The original request (optional), if "packet" is a response |
[out] | pvp | Where to place the decoded VALUE_PAIR. On any return >=0, it is updated to point to the VALUE_PAIR which was decoded from the packet. |
[in] | data | Where the attribute is to be encoded. |
[in] | length | How many octets are available for attribute decoding. |
References nr_attr2vp_rfc(), nr_attr2vp_vsa(), nr_dict_attr_byvalue(), PW_VENDOR_SPECIFIC, and return_NR_ERR.
Referenced by nr_packet_decode().
ssize_t nr_attr2vp_raw | ( | const RADIUS_PACKET * | packet, |
const RADIUS_PACKET * | original, | ||
const uint8_t * | data, | ||
size_t | length, | ||
VALUE_PAIR ** | pvp | ||
) |
Decodes an attribute with an unexpected length into a VALUE_PAIR.
[in] | packet | The packet containing the attribute to be decoded. |
[in] | original | The original request (optional), if "packet" is a response |
[out] | pvp | Where to place the decoded VALUE_PAIR. On any return >=0, it is updated to point to the VALUE_PAIR which was decoded from the packet. |
[in] | data | Where the attribute is to be encoded. |
[in] | length | How many octets are available for attribute decoding. |
References return_NR_ERR.
Referenced by nr_attr2vp_vsa().
ssize_t nr_attr2vp_rfc | ( | const RADIUS_PACKET * | packet, |
const RADIUS_PACKET * | original, | ||
const uint8_t * | data, | ||
size_t | length, | ||
VALUE_PAIR ** | pvp | ||
) |
Decodes an RFC "standard" attribute into a VALUE_PAIR.
[in] | packet | The packet containing the attribute to be decoded. |
[in] | original | The original request (optional), if "packet" is a response |
[out] | pvp | Where to place the decoded VALUE_PAIR. On any return >=0, it is updated to point to the VALUE_PAIR which was decoded from the packet. |
[in] | data | Where the attribute is to be encoded. |
[in] | length | How many octets are available for attribute decoding. |
References return_NR_ERR.
Referenced by nr_attr2vp(), and nr_attr2vp_vsa().
ssize_t nr_attr2vp_vsa | ( | const RADIUS_PACKET * | packet, |
const RADIUS_PACKET * | original, | ||
const uint8_t * | data, | ||
size_t | length, | ||
VALUE_PAIR ** | pvp | ||
) |
Decodes a Vendor-Specific attribute into a VALUE_PAIR.
[in] | packet | The packet containing the attribute to be decoded. |
[in] | original | The original request (optional), if "packet" is a response |
[out] | pvp | Where to place the decoded VALUE_PAIR. On any return >=0, it is updated to point to the VALUE_PAIR which was decoded from the packet. |
[in] | data | Where the attribute is to be encoded. |
[in] | length | How many octets are available for attribute decoding. |
References nr_dict_vendor::length, nr_attr2vp_raw(), nr_attr2vp_rfc(), nr_debug_error, nr_dict_vendor_byvalue(), nr_tlv_ok(), nr_vp_free(), PW_VENDOR_SPECIFIC, return_NR_ERR, and nr_dict_vendor::type.
Referenced by nr_attr2vp().
ssize_t nr_vp2attr | ( | const RADIUS_PACKET * | packet, |
const RADIUS_PACKET * | original, | ||
const VALUE_PAIR ** | pvp, | ||
uint8_t * | data, | ||
size_t | room | ||
) |
Encodes any VALUE_PAIR into an attribute.
This function can be called for any VALUE_PAIR. It will examine that structure, and call one of nr_vp2rfc() or nr_vp2vsa() as necessary.
[in] | packet | Where to place the encoded attribute. |
[in] | original | The original request (optional), if "packet" is a response |
[in,out] | pvp | The VALUE_PAIR to encode. On any return >=0, it is updated to point to the "next" VALUE_PAIR which should be encoded. |
[in] | data | Where the attribute is to be encoded. |
[in] | room | How many octets are available for attribute encoding. |
References nr_dict_attr::attr, value_pair::da, value_pair::length, value_pair::next, NR_DA_CHAP_PASSWORD, NR_DA_MESSAGE_AUTHENTICATOR, nr_debug_error, NR_MAX_VENDOR, nr_vp2rfc(), nr_vp2vsa(), return_NR_ERR, and nr_dict_attr::vendor.
Referenced by nr_packet_attr_append(), and nr_packet_vps_append().
ssize_t nr_vp2rfc | ( | const RADIUS_PACKET * | packet, |
const RADIUS_PACKET * | original, | ||
const VALUE_PAIR ** | pvp, | ||
uint8_t * | data, | ||
size_t | room | ||
) |
Encodes an RFC "standard" VALUE_PAIR into an attribute.
[in] | packet | Where to place the encoded attribute. |
[in] | original | The original request (optional), if "packet" is a response |
[in,out] | pvp | The VALUE_PAIR to encode. On any return >=0, it is updated to point to the "next" VALUE_PAIR which should be encoded. |
[in] | data | Where the attribute is to be encoded. |
[in] | room | How many octets are available for attribute encoding. |
References nr_dict_attr::attr, value_pair::da, value_pair::length, value_pair::next, NR_DA_CHARGEABLE_USER_IDENTITY, nr_debug_error, return_NR_ERR, and nr_dict_attr::vendor.
Referenced by nr_vp2attr().