View Source Radius.Packet (Radius v2.0.1)
This module defines a struct and provides the main functions to encode and decode requests and replies.
Link to this section Summary
Functions
Decode radius packet
Return an iolist of encoded packet
Encode the reply packet into an iolist and put the result in the :raw
key. The :auth
key needs
to be filled with the authenticator of the request packet.
Encode the request packet into an iolist and put the result in the :raw
key. The :auth
key will contain
the authenticator used on the request.
Return the value of a given attribute, if found, or default otherwise.
Verify if the packet signature is valid.
Link to this section Types
Link to this section Functions
Decode radius packet
Options:
attributes
- leave attributes as:integers
, defaults to:strings
.:integers
can be pattern matched with the macro's provided byRadius.Dict
Return an iolist of encoded packet
for request packets, leave packet.auth == nil, then I will generate one from random bytes. for reply packets, set packet.auth = request.auth, I will calc the reply hash with it.
packet.attrs :: [attr]
attr :: {type,value}
type :: String.t | integer | {"Vendor-Specific", vendor}
value :: integer | String.t | ipaddr
vendor :: String.t | integer
ipaddr :: {a,b,c,d} | {a,b,c,d,e,f,g,h}
Encode the reply packet into an iolist and put the result in the :raw
key. The :auth
key needs
to be filled with the authenticator of the request packet.
Options:
sign
-true
if you want to sign the request,false
by default
Encode the request packet into an iolist and put the result in the :raw
key. The :auth
key will contain
the authenticator used on the request.
Return the value of a given attribute, if found, or default otherwise.
Verify if the packet signature is valid.
(https://www.ietf.org/rfc/rfc2865.txt) (https://www.ietf.org/rfc/rfc2869.txt)