summaryrefslogtreecommitdiff
path: root/tools/extract_asn1_from_spec.pl
diff options
context:
space:
mode:
authorPascal Quantin <pascal.quantin@gmail.com>2013-01-11 19:31:15 +0000
committerPascal Quantin <pascal.quantin@gmail.com>2013-01-11 19:31:15 +0000
commit1ca9d5c2b36957bf1b86b7734195eabfd367eead (patch)
treefce61cf9da6354e5032f7471d7def38e8d741bda /tools/extract_asn1_from_spec.pl
parent660e028212cc75397aaa78bf915e2556987e0430 (diff)
downloadwireshark-1ca9d5c2b36957bf1b86b7734195eabfd367eead.tar.gz
Upgrade LPP dissector to v11.1.0 and modify extract_asn1_from_spec.pl to automatically get ASN.1 from spec
svn path=/trunk/; revision=47034
Diffstat (limited to 'tools/extract_asn1_from_spec.pl')
-rwxr-xr-xtools/extract_asn1_from_spec.pl23
1 files changed, 18 insertions, 5 deletions
diff --git a/tools/extract_asn1_from_spec.pl b/tools/extract_asn1_from_spec.pl
index 52d0f83c13..0c2875ccec 100755
--- a/tools/extract_asn1_from_spec.pl
+++ b/tools/extract_asn1_from_spec.pl
@@ -1,7 +1,8 @@
#$Id$
#!/usr/bin/perl
# 2011 Vincent Helfre and Erwan Yvin
-# This script extracts the ASN1 definition from and TS 36.331/25.331 and generates asn files that can be processed by asn2wrs
+# This script extracts the ASN1 definition from and TS 36.331/36.355/25.331
+# and generates asn files that can be processed by asn2wrs
# First download the specification from 3gpp.org as a word document and open it
# Then in "view" menu, select normal, draft or web layout (any kind that removes page header and footers)
# Finally save the document as a text file
@@ -26,7 +27,7 @@ close(INPUT_FILE);
sub extract_spec_version {
my $line;
while($line = <INPUT_FILE>){
- if($line =~ m/3GPP TS (25|36)\.331 V/){
+ if($line =~ m/3GPP TS ((25|36)\.331|36\.355) V/){
$version = $line;
return;
}
@@ -41,30 +42,42 @@ sub extract_asn1 {
my $line;
my $is_asn1 = 0;
my $output_file_name = 0;
+ my $file_name_found = 0;
while($line = <INPUT_FILE>){
if ($line =~ m/-- ASN1STOP/) {
$is_asn1 = 0;
}
- if($line =~ m/DEFINITIONS AUTOMATIC TAGS ::=/){
+ if($line =~ m/– LPP-PDU-Definitions/){
+ $output_file_name = "LPP.asn";
+ print "generating $output_file_name\n";
+ open(OUTPUT_FILE, "> $output_file_name") or die "Can not open file $output_file_name";
+ syswrite OUTPUT_FILE,"-- $version-- \$Id\$\n--\n";
+ $file_name_found = 1;
+ }
+
+ if(($file_name_found == 0) && ($line =~ m/DEFINITIONS AUTOMATIC TAGS ::=/)){
($output_file_name) = ($line =~ m/^([a-zA-Z\-]+)\s+DEFINITIONS AUTOMATIC TAGS ::=/);
$output_file_name = "$output_file_name".".asn";
print "generating $output_file_name\n";
open(OUTPUT_FILE, "> $output_file_name") or die "Can not open file $output_file_name";
- syswrite OUTPUT_FILE,"-- $version-- \$Id$output_file_name 32781 2010-05-12 05:51:54Z etxrab \$\n--\n";
+ syswrite OUTPUT_FILE,"-- $version-- \$Id\$\n--\n";
$is_asn1 = 1;
+ $file_name_found = 1;
}
- if (($line =~ /END$/) && (defined fileno OUTPUT_FILE)){
+ if (($line =~ /END/) && (defined fileno OUTPUT_FILE)){
syswrite OUTPUT_FILE,"$line";
close(OUTPUT_FILE);
$is_asn1 = 0;
+ $file_name_found = 0;
}
if (($is_asn1 == 1) && (defined fileno OUTPUT_FILE)){
syswrite OUTPUT_FILE,"$line";
}
+
if ($line =~ m/-- ASN1START/) {
$is_asn1 = 1;
}