[RADIATOR] Getting attributes in hooks

David Rose rosed at iit.edu
Fri Aug 16 20:10:23 UTC 2019

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
rosed at iit.edu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.open.com.au/pipermail/radiator/attachments/20190816/e8352772/attachment.html>

More information about the radiator mailing list