]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
rename to "PROTO.encode"
authorAlan T. DeKok <aland@freeradius.org>
Mon, 3 Apr 2023 20:53:07 +0000 (16:53 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Tue, 4 Apr 2023 15:11:29 +0000 (11:11 -0400)
as most everything else is hiearchical based on protocol name

doc/antora/modules/reference/pages/xlat/builtin.adoc
src/lib/unlang/xlat_builtin.c
src/tests/keywords/xlat-dhcpv4

index b320af3056db61c03cb4410ab5c487eeec6048fd..fb6b6c15414f3471f66511c92c44af10b5e28c67 100644 (file)
@@ -182,21 +182,22 @@ That being said, the main use of these expansions is for the
 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.
 
@@ -219,11 +220,11 @@ It returns the number of attributes which were decoded.
 &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_
@@ -234,8 +235,8 @@ It returns the raw encoded data
 
 [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
index 08e104badc4e3c472ceb2af9bed9295fcae3fd38..213e175aa62c0d9b237d48cfb3c9795d4b57b9af 100644 (file)
@@ -3011,7 +3011,7 @@ static xlat_arg_parser_t const protocol_decode_xlat_args[] = {
  *
  * Example:
 @verbatim
-%(decode.dhcpv4:%{Tmp-Octets-0})
+%(dhcpv4.decode:%{Tmp-Octets-0})
 @endverbatim
  *
  * @ingroup xlat_functions
@@ -3068,7 +3068,7 @@ static xlat_arg_parser_t const protocol_encode_xlat_args[] = {
  *
  * Example:
 @verbatim
-%(encode.dhcpv4:&request[*])
+%(dhcpv4.encode:&request[*])
 @endverbatim
  *
  * @ingroup xlat_functions
@@ -3189,7 +3189,7 @@ static int xlat_protocol_register(fr_dict_t const *dict)
        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);
@@ -3204,7 +3204,7 @@ static int xlat_protocol_register(fr_dict_t const *dict)
        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);
index 8503d7207a821c91334a8a7a411a64a128589f48..6035c5d0fac6cd87ff93eae56ef9bccc5caaa78e 100644 (file)
@@ -3,7 +3,7 @@
 #
 
 &Tmp-Octets-0 := 0x520d0103abcdef0206010203040506
-if (!("%(decode.dhcpv4:%{Tmp-Octets-0})" == 2)) {
+if (!("%(dhcpv4.decode:%{Tmp-Octets-0})" == 2)) {
        test_fail
 }
 
@@ -15,7 +15,7 @@ if (!(&Relay-Agent-Information.Remote-Id == 0x010203040506)) {
        test_fail
 }
 
-&Tmp-Octets-1 := %(encode.dhcpv4:&request.[*])
+&Tmp-Octets-1 := %(dhcpv4.encode:&request.[*])
 
 if !(&Tmp-Octets-1 == 0x520d0103abcdef0206010203040506) {
        test_fail