summaryrefslogtreecommitdiff
path: root/lib/radius/convert.pl
diff options
context:
space:
mode:
authorLuke Howard <lukeh@padl.com>2011-11-14 13:42:10 +1100
committerLuke Howard <lukeh@padl.com>2011-11-14 13:42:10 +1100
commit718bb36ae58944ea6eaa86a3df646e0797ce615c (patch)
treec2a759a74b18d10f3ef315010efeef51004252e7 /lib/radius/convert.pl
parent3fd136cdbc85ddff5ed0a5953ee1827b9a948748 (diff)
don't use GCC extensions in generated code
Diffstat (limited to 'lib/radius/convert.pl')
-rwxr-xr-xlib/radius/convert.pl59
1 files changed, 37 insertions, 22 deletions
diff --git a/lib/radius/convert.pl b/lib/radius/convert.pl
index 9cf8731..7ca424e 100755
--- a/lib/radius/convert.pl
+++ b/lib/radius/convert.pl
@@ -69,19 +69,35 @@ if (scalar keys %vendor > 0) {
print DICT "const DICT_VENDOR nr_dict_vendors[] = {\n";
foreach $v (sort keys %vendor) {
print DICT " { \n";
- print DICT " .name = \"", $v, "\", \n";
- print DICT " .vendor = ", $vendor{$v}{'pec'}, ", \n";
- print DICT " .type = ", $vendor{$v}{'type'}, ",\n";
- print DICT " .length = ", $vendor{$v}{'length'}, ",\n";
+ print DICT " " . $vendor{$v}{'pec'} . ", \n";
+ print DICT " " . $vendor{$v}{'type'} . ",\n";
+ print DICT " " . $vendor{$v}{'length'} . ",\n";
+ print DICT " \"" . $v, "\"\n";
print DICT " },\n";
}
- print DICT "\n { .name = NULL, }\n";
+ print DICT " { \n";
+ print DICT " 0,\n";
+ print DICT " 0,\n";
+ print DICT " 0,\n";
+ print DICT " NULL\n";
+ print DICT " },\n";
print DICT "};\n\n";
}
# needed for later.
$vendor{""}{'pec'} = 0;
+sub printAttrFlag
+{
+ my $tmp = $attributes{$attr_val}{'flags'}{$_[0]};
+
+ if (!$tmp) {
+ $tmp = 0;
+ }
+
+ print DICT $tmp . ", ";
+}
+
#
# Print DICT out the attributes sorted by number.
#
@@ -92,24 +108,23 @@ foreach $attr_val (sort {$a <=> $b} keys %attributes) {
print DICT " { /* $offset */ \n";
if (defined $attributes{$attr_val}{'raw'}) {
- print DICT " .name = NULL, \n";
+ print DICT " 0\n",
} else {
- print DICT " .name = \"", $attributes{$attr_val}{'name'}, "\", \n";
- if ($attributes{$attr_val}{'vendor'}) {
- print DICT " .vendor = ", $attributes{$attr_val}{'vendor'}, ", \n";
- }
-
- print DICT " .attr = ", $attributes{$attr_val}{'value'}, ", \n";
- print DICT " .type = ", $attributes{$attr_val}{'type'}, ", \n";
-
- if ($attributes{$attr_val}{'flags'}) {
- print DICT " .flags = {\n";
- foreach $flag (keys %{$attributes{$attr_val}{'flags'}}) {
- print DICT " .$flag = $attributes{$attr_val}{'flags'}{$flag},\n";
- }
- print DICT " },\n";
- }
-
+ print DICT " ", $attributes{$attr_val}{'value'}, ", \n";
+ print DICT " ", $attributes{$attr_val}{'type'}, ", \n";
+ print DICT " ", $attributes{$attr_val}{'vendor'}, ", \n";
+ print DICT " { ";
+ &printAttrFlag('has_tag');
+ &printAttrFlag('unknown');
+# &printAttrFlag('has_tlv');
+# &printAttrFlag('is_tlv');
+ &printAttrFlag('extended');
+ &printAttrFlag('extended_flags');
+ &printAttrFlag('evs');
+ &printAttrFlag('encrypt');
+ &printAttrFlag('length');
+ print DICT "},\n";
+ print DICT " \"", $attributes{$attr_val}{'name'}, "\", \n";
$num_names++;
}