networkclient
|
Data Structures | |
struct | nr_dict_attr |
struct | nr_dict_value |
struct | nr_dict_vendor |
Macros | |
#define | NR_MAX_PACKET_CODE 46 |
#define | NR_MAX_VENDOR (1 << 24) |
Typedefs | |
typedef enum nr_attr_type_t | nr_attr_type_t |
typedef struct nr_dict_attr | DICT_ATTR |
typedef struct nr_dict_value | DICT_VALUE |
typedef struct nr_dict_vendor | DICT_VENDOR |
Enumerations | |
enum | nr_attr_type_t { NR_TYPE_INVALID = 0, NR_TYPE_STRING, NR_TYPE_INTEGER, NR_TYPE_IPADDR, NR_TYPE_DATE, NR_TYPE_OCTETS, NR_TYPE_IFID, NR_TYPE_IPV6ADDR, NR_TYPE_IPV6PREFIX, NR_TYPE_BYTE, NR_TYPE_SHORT, NR_TYPE_INTEGER64 } |
Functions | |
const DICT_ATTR * | nr_dict_attr_byvalue (unsigned int attr, unsigned int vendor) |
const DICT_ATTR * | nr_dict_attr_byname (const char *name) |
int | nr_dict_attr_2struct (DICT_ATTR *da, unsigned int attr, unsigned int vendor, char *buffer, size_t bufsize) |
const DICT_VALUE * | nr_dict_value_byattr (unsigned int attr, unsigned int vendor, int value) |
const DICT_VALUE * | nr_dict_value_byname (unsigned int attr, unsigned int vendor, const char *name) |
int | nr_dict_vendor_byname (const char *name) |
const DICT_VENDOR * | nr_dict_vendor_byvalue (unsigned int vendor) |
Variables | |
const DICT_VENDOR | nr_dict_vendors [] |
const int | nr_dict_num_attrs |
const DICT_ATTR | nr_dict_attrs [] |
const int | nr_dict_num_names |
DICT_ATTR const * | nr_dict_attr_names [] |
const char * | nr_packet_codes [NR_MAX_PACKET_CODE+1] |
The RADIUS dictionaries perform name to number mappings. The names are used only for administrator convenience, for parsing configuration files, and printing humanly-readable output. The numbers are used when encoding data in a packet.
When attributes are decoded from a packet, the numbers are used to look up the associated name, which is then placed into a data structure.
When the data structures are encoded into a packet, the numbers are used to create RFC and VSA format attributes.
#define NR_MAX_PACKET_CODE 46 |
The maximum RADIUS_PACKET::code which we can accept.
Referenced by nr_packet_can_encode(), nr_packet_init(), nr_packet_ok_raw(), nr_packet_print_hex(), and nr_track_id_init().
#define NR_MAX_VENDOR (1 << 24) |
The maximum vendor number which is permitted.
The RFCs require that the Vendor Id or Private Enterprise Number be encoded as 32 bits, with the upper 8 bits being zero.
Referenced by nr_vp2attr(), and nr_vp2vsa().
typedef struct nr_dict_attr DICT_ATTR |
Defines an dictionary mapping for an attribute.
The RADIUS dictionaries map humanly readable names to protocol numbers. The protocol numbers are used to encode/decode the attributes in a packet.
typedef struct nr_dict_value DICT_VALUE |
Defines a dictionary mapping for a named enumeration.
This structure is currently not used.
typedef struct nr_dict_vendor DICT_VENDOR |
Defines an dictionary mapping for a vendor.
The RADIUS dictionaries map humanly readable vendor names to a Vendor-Id (or Private Enterprise Code) assigned by IANA. The Vendor-Id is used to encode/decode Vendor-Specific attributes in a packet.
typedef enum nr_attr_type_t nr_attr_type_t |
Data Type Definitions.
enum nr_attr_type_t |
Data Type Definitions.
int nr_dict_attr_2struct | ( | DICT_ATTR * | da, |
unsigned int | attr, | ||
unsigned int | vendor, | ||
char * | buffer, | ||
size_t | bufsize | ||
) |
Converts raw data to a DICT_ATTR structure.
It is called when the library is asked to decode an attribute which is not in the pre-defined dictionaries.
[in,out] | da | The DICT_ATTR structure to initialize |
[in] | attr | The attribute number |
[in] | vendor | The vendor number |
[in] | buffer | The buffer where the name of the attribute is stored |
[in] | bufsize | Size of the buffer |
References nr_dict_attr::attr, nr_dict_attr::flags, nr_dict_attr::name, NR_TYPE_OCTETS, return_NR_ERR, nr_dict_attr::type, attr_flags::unknown, and nr_dict_attr::vendor.
Referenced by nr_vp_alloc_raw().
const DICT_ATTR* nr_dict_attr_byname | ( | const char * | name | ) |
Look up an attribute in the dictionaries.
The dictionary mapping contains information about the attribute, such as printable name, data type (ipaddr, integer, etc), and various other things used to encode/decode the attribute in a packet.
[in] | name | Name of the attribute |
References nr_dict_attr_names, and nr_dict_num_names.
Referenced by nr_vp_sscanf().
const DICT_ATTR* nr_dict_attr_byvalue | ( | unsigned int | attr, |
unsigned int | vendor | ||
) |
Look up an attribute in the dictionaries.
The dictionary mapping contains information about the attribute, such as printable name, data type (ipaddr, integer, etc), and various other things used to encode/decode the attribute in a packet.
[in] | attr | Value of the attribute |
[in] | vendor | Value of the vendor |
References nr_dict_attr::attr, nr_dict_attrs, and nr_dict_num_attrs.
Referenced by nr_attr2vp(), and nr_vp_create().
const DICT_VALUE* nr_dict_value_byattr | ( | unsigned int | attr, |
unsigned int | vendor, | ||
int | value | ||
) |
Unused.
const DICT_VALUE* nr_dict_value_byname | ( | unsigned int | attr, |
unsigned int | vendor, | ||
const char * | name | ||
) |
Unused.
int nr_dict_vendor_byname | ( | const char * | name | ) |
Look up a vendor in the dictionaries.
The dictionary mapping contains information about the vendor, such as printable name, VSA encoding method, etc.
[in] | name | Name of the vendor. |
References nr_dict_vendor::name, nr_dict_vendors, and nr_dict_vendor::vendor.
const DICT_VENDOR* nr_dict_vendor_byvalue | ( | unsigned int | vendor | ) |
Look up an vendor in the dictionaries.
The dictionary mapping contains information about the vendor, such as printable name, VSA encoding method, etc.
[in] | vendor | Vendor-Id (or Private Enterprise code) for the vendor. |
References nr_dict_vendor::name, nr_dict_vendors, and nr_dict_vendor::vendor.
Referenced by nr_attr2data(), nr_attr2vp_vsa(), and nr_packet_walk().
DICT_ATTR const* nr_dict_attr_names[] |
The list of attribute definitions, organized by name.
The attributes are orderd by name (case insensitive), in increasing order. This allows the dictionary lookups to find attributes by a binary search.
Referenced by nr_dict_attr_byname().
const DICT_ATTR nr_dict_attrs[] |
The list of attribute definitions.
The "standard" RFC attributes are located in the first 256 entries. Standard attributes without a dictionary definition are given an empty entry.
The attributes are orderd by (vendor, attribute), in increasing order. This allows the dictionary lookups to find attributes by a binary search.
Referenced by nr_dict_attr_byvalue().
const int nr_dict_num_attrs |
The number of attribute definitions in the dictionary.
This number is guaranteed to be at least 256, for speed.
Referenced by nr_dict_attr_byvalue().
const int nr_dict_num_names |
The number of attributes with names.
Referenced by nr_dict_attr_byname().
const DICT_VENDOR nr_dict_vendors[] |
Static array of known vendors.
Referenced by nr_dict_vendor_byname(), and nr_dict_vendor_byvalue().
const char* nr_packet_codes[NR_MAX_PACKET_CODE+1] |
Static array containing names the RADIUS_PACKET::code field.
The names are hard-coded and not in any dictionary because they do not change.
The names are exported because they may be useful in your application. Packet codes which are not handled by the library have NULL for their names.
Referenced by nr_packet_can_encode(), nr_packet_ok_raw(), and nr_packet_print_hex().