decode any attribute from any protocol.
If you need to store attributes in an external database, then it is
-possible to encode them via `%(encode.internal:...)`. The result will
+possible to encode them via `%(internal.encode:...)`. The result will
be an opaque hex string which can be treated as an opaque blob, and
stored externally. Then, when the data is needed again, it can be
-turned back into attributes via `%(decode.internal:...)`.
+turned back into attributes via `%(internal.decode:...)`.
-=== %(decode.PROTO:<hex>)
+=== %(PROTO.decode:<data>)
-Decodes _hex_ as the named protocol. The _hex_ string can be an expansion, too.
+Decodes _data_ as the named protocol. The _data_ string can be an
+expansion, which is usually a reference to an attribute of type `octets.
-The `decode.PROTO` expansion is automatically registered for every
+The `PROTO.decode` expansion is automatically registered for every
protocol which is used by the server.
Note that the output attributes _must_ come from the same dictionary
as the `request` they are being added to. For example, you cannot use
-`decode.dhcpv4` inside of a virtual server which has `namespace =
+`dhcpv4.decode` inside of a virtual server which has `namespace =
radius`. Doing so would result in DHCPv4 attributes being inside of a
RADIUS virtual server, which is not allowed.
&User-Name = "ABCD"
```
-=== %(encode.PROTO:<list>)
+=== %(PROTO.encode:<list>)
Encodes _list_ as the named protocol. The _list_ can also be a series of attributes.
-The `encode.PROTO` expansion is automatically registered for every
+The `PROTO.encode` expansion is automatically registered for every
protocol which is used by the server.
.Return: _octets_
[source,unlang]
----
-%(encode.dhcpv4:&Relay-Agent-Information.Circuit-Id = 0xabcdef &Relay-Agent-Information.Remote-Id = 0x010203040506)
-%(encode.radius:&User-Name = "ABCD")
+%(dhcpv4.encode:&Relay-Agent-Information.Circuit-Id = 0xabcdef &Relay-Agent-Information.Remote-Id = 0x010203040506)
+%(radius.radius:&User-Name = "ABCD")
----
.Output
*
* Example:
@verbatim
-%(decode.dhcpv4:%{Tmp-Octets-0})
+%(dhcpv4.decode:%{Tmp-Octets-0})
@endverbatim
*
* @ingroup xlat_functions
*
* Example:
@verbatim
-%(encode.dhcpv4:&request[*])
+%(dhcpv4.encode:&request[*])
@endverbatim
*
* @ingroup xlat_functions
snprintf(buffer, sizeof(buffer), "%s_tp_decode_pair", name);
tp_decode = dlsym(dl->handle, buffer);
if (tp_decode) {
- snprintf(buffer, sizeof(buffer), "decode.%s", name);
+ snprintf(buffer, sizeof(buffer), "%s.decode", name);
if (unlikely((xlat = xlat_func_register(NULL, buffer, protocol_decode_xlat, FR_TYPE_UINT32)) == NULL)) return -1;
xlat_func_args_set(xlat, protocol_decode_xlat_args);
snprintf(buffer, sizeof(buffer), "%s_tp_encode_pair", name);
tp_encode = dlsym(dl->handle, buffer);
if (tp_encode) {
- snprintf(buffer, sizeof(buffer), "encode.%s", name);
+ snprintf(buffer, sizeof(buffer), "%s.encode", name);
if (unlikely((xlat = xlat_func_register(NULL, buffer, protocol_encode_xlat, FR_TYPE_OCTETS)) == NULL)) return -1;
xlat_func_args_set(xlat, protocol_encode_xlat_args);