Skip to main content

Crate radius_tokio_dict

Crate radius_tokio_dict 

Source
Expand description

Typed FreeRADIUS dictionary tables for RADIUS attribute encoding/decoding.

At build time, a code-generator (see build.rs and the radius-tokio-dict-codegen crate) parses the FreeRADIUS dictionary files under dictionaries/ and emits typed Rust source per dictionary group. Each group is re-exported at the crate root and exposes:

  • typed attrs::* and values::* handles used on the encode path (e.g. radius_tokio_dict::rfc::attrs::USER_NAME);
  • pub const fn dispatchers (attrs::lookup, attrs::lookup_vsa, attrs::lookup_tlv, values::value_name) used internally by the crate-level lookup helpers (attribute, vsa, vendor, tlv_child, value_name) for diagnostics.

Older revisions of this crate emitted pub static ATTRIBUTES and pub static VENDORS slices of full AttributeEntry/VendorEntry records. Those have been replaced by the match-based dispatchers above, which are dramatically smaller in .rodata and let the compiler turn name lookups into jump tables.

The AttrKind enum surfaces the small subset of an attribute’s dictionary type that the diagnostic path actually consumes (string vs integer vs hex-dump vs container). AttrInfo and VendorInfo are the cheap by-value records returned from the lookup helpers.

Modules§

rfc
IETF / RFC attributes vendored under dictionaries/rfc/.

Structs§

Attr
Typed handle to a top-level attribute. Carries only the 1-byte type code plus a zero-sized wire-type marker, so it is Copy, const- constructible, and disappears entirely after monomorphization.
AttrInfo
Diagnostic record for a top-level attribute or single-component VSA, returned by attribute / vsa.
Tagged
Value-plus-tag pair returned for tagged attributes (RFC 2868 §3.1).
TlvAttr
Typed handle to a TLV sub-attribute living inside a top-level tlv-typed parent (e.g. IPv6-6rd-Configuration from RFC 6930 → IPv6-6rd-IPv4MaskLen at OID 173.1).
VendorInfo
Diagnostic record for a vendor entry, returned by vendor.
VsaAttr
Typed handle to a Vendor-Specific Attribute. Pairs the IANA Private Enterprise Number with the per-vendor type code; the wire-type marker drives the value decoder exactly as for Attr.
VsaTlvAttr
Typed handle to a TLV sub-attribute living inside a vendor-specific tlv-typed parent (e.g. Ruckus-TC-Attr-Ids-With-Quota at vendor PEN 25053 vendor-type 146 → Ruckus-TC-Name-Quota at OID 146.1).
WByte
1-byte unsigned integer (byte).
WBytes
Variable-length opaque octets (octets, container types, anything we do not specialize further).
WEther
6-byte Ethernet MAC (ether).
WIfid
8-byte interface identifier (ifid).
WInteger
4-byte big-endian unsigned integer (integer, uint32, date).
WInteger64
8-byte big-endian unsigned integer (integer64).
WIpv4
4-byte IPv4 address (ipaddr).
WIpv6
16-byte IPv6 address (ipv6addr).
WShort
2-byte big-endian unsigned integer (short).
WSigned
4-byte big-endian signed integer (signed).
WTaggedInteger
Tagged 32-bit unsigned integer (RFC 2868 §3.6: integer has_tag).
WTaggedText
Tagged UTF-8 text (RFC 2868 §3.5: string has_tag).
WText
UTF-8 text (string in dictionaries; RFC 8044 §3.4 nominates UTF-8). Decodes via std::str::from_utf8; non-UTF-8 yields None. Reach for WBytes if you need to tolerate legacy non-UTF-8 strings.

Enums§

AttrKind
Coarse classification of a RADIUS attribute’s wire shape, as needed by the dissection / diagnostic path.

Traits§

IntoWire
Conversion from a Rust value into the wire-format value bytes of a dictionary attribute.
WireType
Wire-type marker. Implementors describe how a slice of value octets (the bytes after the 2-byte type+length header) decodes into a borrowed Rust view.

Functions§

attribute
Look up a top-level attribute by its 1-byte type code.
tlv_child
Look up a TLV child by its (parent, child) 1-byte codes inside the top-level (non-vendor) RFC namespace.
value_name
Resolve an enumerator name for attribute’s integer value number.
vendor
Look up a VENDOR directive by its IANA Private Enterprise Number.
vsa
Look up a Vendor-Specific Attribute by (PEN, vendor-type).