Chetan Gaonker | 7f4bf74 | 2016-05-04 15:56:08 -0700 | [diff] [blame] | 1 | # -*- text -*- |
| 2 | # |
| 3 | # $Id: 2a1e130d315daa247167372773c1994e3200f332 $ |
| 4 | |
| 5 | # |
| 6 | # This module is useful only for 'xlat'. To use it, |
| 7 | # add it to the raddb/mods-enabled/ directory. Then, |
| 8 | # use it on the right-hand side of a variable assignment. |
| 9 | # |
| 10 | # ... = "%{unpack:data 1 integer}" |
| 11 | # |
| 12 | # The arguments are three fields: |
| 13 | # |
| 14 | # data |
| 15 | # Either &Attribute-Name |
| 16 | # the name of the attribute to unpack. |
| 17 | # MUST be a "string" or "octets" type. |
| 18 | # |
| 19 | # or 0xabcdef |
| 20 | # e.g. hex data. |
| 21 | # |
| 22 | # 1 |
| 23 | # The offset into the string from which |
| 24 | # it starts unpacking. The offset starts |
| 25 | # at zero, for the first attribute. |
| 26 | # |
| 27 | # integer |
| 28 | # the data type to unpack at that offset. |
| 29 | # e.g. integer, ipaddr, byte, short, etc. |
| 30 | # |
| 31 | # e.g. if we have Class = 0x00000001020304, then |
| 32 | # |
| 33 | # %{unpack:&Class 4 short} |
| 34 | # |
| 35 | # will unpack octets 4 and 5 as a "short", which has |
| 36 | # value 0x0304. |
| 37 | # |
| 38 | # This module is used when vendors put multiple fields |
| 39 | # into one attribute of type "octets". |
| 40 | # |
| 41 | unpack { |
| 42 | } |