]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
add TMP TLV and test
authorAlan T. DeKok <aland@freeradius.org>
Tue, 3 Sep 2024 19:05:11 +0000 (15:05 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Tue, 3 Sep 2024 19:05:27 +0000 (15:05 -0400)
share/dictionary/freeradius/dictionary.freeradius.internal
src/tests/keywords/foreach-tlv.ignore [new file with mode: 0644]

index 7b11c8099b774f07b7eb2f8b04155fd910e7ea3e..615d822c60d8a3324dc2321216b3efc6b5e5e696 100644 (file)
@@ -380,6 +380,12 @@ ATTRIBUTE  Tmp-Time-Delta-7                        1807    time_delta
 ATTRIBUTE      Tmp-Time-Delta-8                        1808    time_delta
 ATTRIBUTE      Tmp-Time-Delta-9                        1809    time_delta
 
+ATTRIBUTE      Tmp-TLV-0                               1810    tlv
+ATTRIBUTE      a                                       .1      uint32
+ATTRIBUTE      b                                       .2      uint32
+ATTRIBUTE      c                                       .3      string
+ATTRIBUTE      d                                       .4      ipaddr
+
 #
 #  1810 - 1879 - unused
 #
diff --git a/src/tests/keywords/foreach-tlv.ignore b/src/tests/keywords/foreach-tlv.ignore
new file mode 100644 (file)
index 0000000..f6c8aab
--- /dev/null
@@ -0,0 +1,39 @@
+#
+#  PRE: foreach
+#
+#  Loop over children of a TLV.
+#
+#  Note that the only data types compatible with all data types are "string" or "octets"
+#
+string out
+
+&Tmp-TLV-0 := {
+       &a = 1
+       &b = 2
+       &c = "foo"
+       &d = 127.0.0.1
+}
+
+&request += {
+       &Tmp-TLV-0 = {
+               &a = 2112
+               &b = 6809
+               &c = "bar"
+               &d = 192.0.2.1
+       }
+}
+
+
+&out = ""
+
+#
+#  Home-brew concat!
+#
+foreach child (&Tmp-TLV-0[*]) {
+       &out += &child.c
+       &out += " "
+}
+
+&out -= " "
+
+"%{out}"