aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rwxr-xr-xtools/make-sminmpec.pl17
1 files changed, 17 insertions, 0 deletions
diff --git a/tools/make-sminmpec.pl b/tools/make-sminmpec.pl
index c490ce89eb..13c7c92608 100755
--- a/tools/make-sminmpec.pl
+++ b/tools/make-sminmpec.pl
@@ -79,12 +79,14 @@ open OUT, "> sminmpec.c";
my $body = '';
my $code;
+my $prev_code = -1; ## Assumption: First code in enterprise file is 0;
sub escape_non_ascii {
my $val = unpack 'C', $_[0];
return sprintf '\0%.3o',$val;
}
+
for(@in_lines) {
s/[\000-\037]//g;
s/\\/\\\\/g;
@@ -95,6 +97,15 @@ for(@in_lines) {
$code = sprintf("%5d", $1);
} if (/^ (\S.*)/ ) {
my $name = $1;
+ if ($code < $prev_code) {
+ print STDERR ("Input 'Codes' not sorted in ascending order (or duplicate codes)): $prev_code $code\n");
+ exit 1;
+ }
+ while ($code > ($prev_code+1)) {
+ $prev_code = sprintf("%5d", $prev_code+1);
+ $body .= " { $prev_code, sminmpec_unknown }, /* (Added by Wireshark) */\n";
+ }
+ $prev_code = $code;
$body .= " { $code, \"$name\" },\n";
}
}
@@ -106,6 +117,10 @@ print OUT <<"_SMINMPEC";
* THIS FILE IS AUTOGENERATED, DO NOT EDIT
* generated from http://www.iana.org/assignments/enterprise-numbers
* run "tools/make-sminmspec <infile> <outfile>" to regenerate
+ *
+ * Note: "Gaps" in the iana enterprise-numbers list have been "filled in"
+ * with "(Unknown)" as the name so that direct (indexed) access
+ * to the list is possible.
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
@@ -116,6 +131,8 @@ print OUT <<"_SMINMPEC";
#include <epan/value_string.h>
#include <epan/sminmpec.h>
+static const gchar sminmpec_unknown[] = "(Unknown)";
+
static const value_string sminmpec_values[] = {
$body { 0, NULL}
};