summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/radius/client.h3
-rwxr-xr-xlib/radius/convert.pl59
2 files changed, 37 insertions, 25 deletions
diff --git a/lib/radius/client.h b/lib/radius/client.h
index df9f834..6c1526d 100644
--- a/lib/radius/client.h
+++ b/lib/radius/client.h
@@ -239,12 +239,9 @@ typedef struct attr_flags {
unsigned int has_tlv : 1; /* has sub attributes */
unsigned int is_tlv : 1; /* is a sub attribute */
#endif
-#ifdef VENDOR_EXTENDED
unsigned int extended : 1; /* extended attribute */
unsigned int extended_flags : 1; /* with flag */
unsigned int evs : 1; /* extended VSA */
-#endif
-
uint8_t encrypt; /**< Attribute encryption method */
uint8_t length; /**< The expected length of the attribute */
} ATTR_FLAGS;
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++;
}