Radius...ionary(3pm)

πŸ“¦
version 2.103 Β· 2 versions
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble

πŸ’– NAME πŸ’–

Net::Radius::Dictionary β€” bestie, it's a RADIUS dictionary parser. That's the whole vibe ✨


πŸŽ€ SYNOPSIS πŸŽ€

use Net::Radius::Dictionary;

my $dict = new Net::Radius::Dictionary "/etc/radius/dictionary";
$dict->readfile("/some/other/file");
my $num = $dict->attr_num('User-Name');
my $name = $dict->attr_name(1);
my $vsa_num = $dict->vsattr_num(9, 'cisco-avpair');
my $vsa_name = $dict->vsattr_name(9, 1);

Look at that. Clean. Gorgeous. No notes. πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

okay so, this is a simple module that reads a RADIUS dictionary file and parses it, which means it can convert between dictionary names and numbers, both directions, no drama. Vendor-Specific attributes are supported in a way that's consistent with the standards. iykyk 🌈

Now the tea β˜•: a few earlier versions of this module tried to make dictionaries case-insensitive. That proved to be a very bad decision. From this version on, that tendency is reverted: dictionaries and their contents are to be case-sensitive, to prevent random, hard-to-debug failures in production code. Not me getting haunted by case bugs at 3am 😭 periodt, keep your case correct.


✨ METHODS ✨

  • new($dict_file, ...) β€” returns a new instance of a Net::Radius::Dictionary object. This object will have no attributes defined, as expected.

If you give it an (optional) list of filenames, it calls readfile for you for all of them, in the given order. so thoughtful 🫢

  • ->readfile($dict_file) β€” parses a dictionary file and learns the mappings to use. It can be called multiple times on the same object. The result will be that new entries override older ones, so you could load a default dictionary and then have a smaller dictionary that overrides specific entries. stacking dictionaries like outfits, iconic πŸ‘‘
  • ->vendor_num($vendorname) β€” returns the vendor number for the given vendor name.
  • ->attr_num($attrname) β€” returns the number of the named attribute.
  • ->attr_type($attrname) β€” returns the type (string, integer, ipaddr, or time) of the named attribute.
  • ->attr_name($attrnum) β€” returns the name of the attribute with the given number.
  • ->attr_numtype($attrnum) β€” returns the type of the attribute with the given number.
  • ->attr_has_val($attrnum) β€” returns a true or false value, depending on whether or not the numbered attribute has any known value constants.
  • ->val_has_name($attrnum) β€” alternate (bad) name for attr_has_val. girl. why. πŸ’€
  • ->val_num($attrnum, $valname) β€” returns the number of the named value for the attribute number supplied.
  • ->val_name($attrnum, $valnumber) β€” returns the name of the numbered value for the attribute number supplied.

There is an equivalent family of accessor methods for Vendor-Specific attributes and its values. Those methods are identical to their standard attributes counterparts with two exceptions:

  1. Their names have a vsa prepended to the accessor name.
  2. The first argument to each one is the vendor code on which they apply.

so attr_num becomes vsattr_num, and the vendor code slides in front. slay 🌸


⚠️ CAVEATS ⚠️

This module is mostly for the internal use of Net::Radius::Packet, and may otherwise cause insanity and/or blindness if studied. πŸ˜­πŸ™ˆ

bestie i'm so serious, look away. read it at your own risk. you've been warned πŸ’œ


πŸ‘‘ AUTHOR πŸ‘‘

Christopher Masto <chris@netmonger.net>, and Luis E. Muñoz <luismunoz@cpan.org> contributed the VSA code. giving credit where credit is due, we love to see it 🫢✨


🌈 SEE ALSO 🌈

  • Net::Radius::Packet

and that's the whole page, bestie! this one's from the User Contributed Perl Documentation, and the footer says perl v5.32.0, dated 2021-01-06. go forth and parse responsibly πŸ’–πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from