Hi David -

Have a look at “Radius/Radius.pm”.

        $p->getUserName

calls getUserName in Radius.pm

        $p->get_attr('User-Name’)

calls get_attr() with the attribute name ‘User-Name’ from the dictionary (see 
“Radius/AttrVal.pm”)

        $p->getAttrByNum($Radius::Radius::USER_NAME)

calls getAttrByNum() with USER_NAME (both are defined in Radius.pm)

This last one is the most efficient (and doesn’t use the dictionary).

regards

Hugh


> On 17 Aug 2019, at 06:10, David Rose <[email protected]> wrote:
> 
> Looking at cleaning up some of our hook processing and was looking through 
> some of the example hooks provided with Radiator. While doing so I noticed 
> there are a number of ways to get attributes and was wondering why certain 
> methods were used in different example hooks.
> 
> For example I found these for getting user names:
> 
> - $p->getUserName
> - $p->get_attr('User-Name')
> - $p->getAttrByNum($Radius::Radius::USER_NAME)
> 
> All seem to be capable of doing the same thing. Even in our hooks there are 
> differences in which is used and I would prefer to change this so that our 
> hooks are at least consistent (unless there is reason not to do so). 
> 
> Are there reasons to use one over the other? For example, do some have better 
> performance or take up fewer resources? Perhaps there are specific use cases 
> when one should be used over another? Or maybe some are decprecated and 
> should be avoided?
> 
> I just want to make sure that I make the best choices while cleaning up our 
> own code and couldn't find anything documenting the differences. Thank you in 
> advance for any information you provide.
> 
> --
> David Rose
> Sr. Network Engineer
> Office of Technology Services
> Illinois Institute of Technology
> (O) 312.567.3249
> (F) 312.567.5968
> [email protected]
> _______________________________________________
> radiator mailing list
> [email protected]
> https://lists.open.com.au/mailman/listinfo/radiator


--

Hugh Irvine
[email protected]

Radiator: the most portable, flexible and configurable RADIUS server 
anywhere. SQL, proxy, DBM, files, LDAP, NIS+, password, NT, Emerald, 
Platypus, Freeside, TACACS+, PAM, external, Active Directory, EAP, TLS, 
TTLS, PEAP, TNC, WiMAX, RSA, Vasco, Yubikey, MOTP, HOTP, TOTP,
DIAMETER, SIM, etc. 
Full source on Unix, Linux, Windows, macOS, Solaris, VMS, NetWare etc.

_______________________________________________
radiator mailing list
[email protected]
https://lists.open.com.au/mailman/listinfo/radiator

Reply via email to