Unpack Module
The unpack
module unpacks binary data from octets type attributes
into individual attributes.
It is used when vendors put multiple fields into one attribute of type "octets".
The module is useful only for xlat .
|
Syntax
To use it, add it to the raddb/mods-enabled/
directory. Then,
use it on the right-hand side of a variable assignment.
%unpack(<data>, <offset>, <data_type>)
The arguments are three fields:
- data
-
Either
octets
orstring
type data, litteral or expanded attributes. Ifstring
type data contains a representaion of hex data, e.g. 0xabcdef that is first converted tooctets
. - offset
-
The offset into the string from which it starts unpacking. The offset starts at zero, for the first attribute.
- data_type
-
the data type to unpack at that offset. e.g.
integer
,ipaddr
,byte
,short
, etc.