From 7d9e582d73f440dc920ed2d1e56bca0cf9a730e1 Mon Sep 17 00:00:00 2001 From: vlm Date: Wed, 30 Nov 2005 14:53:04 +0000 Subject: [PATCH] *** empty log message *** git-svn-id: https://asn1c.svn.sourceforge.net/svnroot/asn1c/trunk@1020 59561ff5-6e30-0410-9f3c-9617f08c8826 --- asn1c/webcgi/asn1c.cgi | 276 ++++++++++++++++++++++++++++++++--------- 1 file changed, 220 insertions(+), 56 deletions(-) diff --git a/asn1c/webcgi/asn1c.cgi b/asn1c/webcgi/asn1c.cgi index 3a39df0f..e7650039 100755 --- a/asn1c/webcgi/asn1c.cgi +++ b/asn1c/webcgi/asn1c.cgi @@ -35,8 +35,8 @@ $myName = $ENV{SCRIPT_NAME}; # URL of this particular script (without args) $homePath = "" . "Home" - . " >> asn1c" - . " >> Free Online ASN.1 Compiler" + . " → ASN.1" + . " → Online ASN.1 Compiler" . "

"; ################################################### @@ -49,52 +49,115 @@ $|=1; # Enable AutoFlush (for older versions of Perl) my %binaryDecoders = ( x509 => { order => 1, + shorder => 11, type => 'X.509 Certificate', typeExt => 'X.509 Certificate', + description => 'X.509 in DER (not PEM!)', exe => 'x509dump', cmdopts => '-x', msg => '' }, tap0311 => { order => 2, + shorder => 4, type => TAP3, typeExt => 'GSM TAP3-11 data', + description => 'GSM TAP3-11 binary file', exe => 'tap3dump-11', cmdopts => '-x', msg => '' }, tap0310 => { order => 3, + shorder => 3, type => TAP3, typeExt => 'GSM TAP3-10 data', + description => 'GSM TAP3-10 binary file', exe => 'tap3dump-10', cmdopts => '-x', msg => '' }, tap0309 => { order => 4, + shorder => 2, type => TAP3, typeExt => 'GSM TAP3-09 data', + description => 'GSM TAP3-09 binary file', exe => 'tap3dump-09', cmdopts => '-x', msg => '' }, - mheg5 => { order => 5, + rrcDLCCCH => { order => 5, + shorder => 5, + type => 'RRC DL-CCCH-Message', + typeExt => 'RRC DL-CCCH-Message frame', + description => '3GPP RRC DL-CCCH-Message', + exe => 'rrc-dump', + cmdopts => '-p DL-CCCH-Message', + msg => '' + }, + + rrcULCCCH => { order => 6, + shorder => 6, + type => 'RRC UL-CCCH-Message', + typeExt => 'RRC UL-CCCH-Message frame', + description => '3GPP RRC UL-CCCH-Message', + exe => 'rrc-dump', + cmdopts => '-p UL-CCCH-Message', + msg => '' + }, + + rrcDLDCCH => { order => 7, + shorder => 7, + type => 'RRC DL-DCCH-Message', + typeExt => 'RRC DL-DCCH-Message frame', + description => '3GPP RRC DL-DCCH-Message', + exe => 'rrc-dump', + cmdopts => '-p DL-DCCH-Message', + msg => '' + }, + + rrcULDCCH => { order => 8, + shorder => 8, + type => 'RRC UL-DCCH-Message', + typeExt => 'RRC UL-DCCH-Message frame', + description => '3GPP RRC UL-DCCH-Message', + exe => 'rrc-dump', + cmdopts => '-p UL-DCCH-Message', + msg => '' + }, + + rrcPCCH => { order => 9, + shorder => 9, + type => 'RRC PCCH-Message', + typeExt => 'RRC PCCH-Message frame', + description => '3GPP RRC PCCH-Message', + exe => 'rrc-dump', + cmdopts => '-p PCCH-Message', + msg => '' + }, + + mheg5 => { order => 10, + shorder => 10, type => 'MHEG-5', typeExt => 'ISO MHEG-5 data', + description => 'ISO MHEG-5 stream file', exe => 'mheg5dump', cmdopts => '-x', msg => '' }, - ber => { order => 6, + ber => { order => 11, + shorder => 1, type => BER, typeExt => 'BER encoded data', + description => 'BER/DER/CER binary file', exe => 'unber', cmdopts => '', msg => "\n" } + ); my $redirect = ''; # No redirection by default @@ -193,10 +256,15 @@ sub makeArchive($$) { . "for i in ./*.[ch]; do if [ -L \$i ]; then" . " cp $TMPDIR/skeletons/\$i \$i.-;" . " mv \$i.- \$i;" - . " fi done && tar --dereference --ignore-failed-read --owner nobody --group nobody -zcf +tmp." . $$ . " *.[ch] Makefile* +Compiler.Log *.asn *.asn1" - . " && rm -f ./*.[ch] ./Makefile*" - . " && mv ./+tmp." . $$ . " $archName" - . " || rm -f ./+tmp." . $$); + . " fi done" + . " && find . -name '*.[ch]' -print0" + . " > ./+tmp." . $$ . ".files" + . " && tar --dereference --ignore-failed-read --owner nobody --group nobody -zcf +tmp." . $$ . ".arch --null --files-from +tmp." . $$ . ".files Makefile* +Compiler.Log *.asn *.asn1 *.ber *.cer *.der *.bin *.dat *.mhg *.txt" + . " && (cat ./+tmp.". $$ .".files | xargs -0 rm -f)" + . " && rm -f ./Makefile* ./+tmp.". $$ .".files" + . " && mv ./+tmp." . $$ . ".arch $archName" + . " || rm -f ./+tmp." . $$ . ".*" + ); undef unless -f $archName; } @@ -408,7 +476,7 @@ foreach my $fname (@gotNames) { print LOG "\n"; bark("Too strange filename: \"$fname\""); } - $_ .= '.asn1' unless(/asn[1]{0,1}$/i); + $_ .= '.asn1' unless(/[.](asn[1]?|[bcd]er|bin|dat|mhg|txt)$/i); @gotSafeNames = (@gotSafeNames, $_); print LOG "\t" . $_; } @@ -449,6 +517,8 @@ if($#gotSafeNames >= 0) { my $optEF = param('optEF'); my $optNT = param('optNT'); my $optCN = param('optCN'); + my $optMin = param('optMin'); + my $optNoXER = param('optNoXER'); $options .= " -Wdebug-lexer" if(defined($optDebugL) && $optDebugL eq "on"); $options .= " -E" if(defined($optE) && $optE eq "on"); @@ -478,17 +548,22 @@ if($#gotSafeNames >= 0) { # Unrecognized ASN.1 module format. # Try out several BER decoders. - foreach my $t (sort { $binaryDecoders{$a} cmp $binaryDecoders{$b} } - keys %binaryDecoders) { + foreach my $t (sort { $binaryDecoders{$a}{order} + <=> $binaryDecoders{$b}{order} } keys %binaryDecoders) { next unless ($fType eq 'auto' or $fType eq $t); my %dec = %{$binaryDecoders{$t}}; - my $ec = system("$SUIDHelper $TMPDIR $inChDir $dec{exe} $dec{cmdopts} @gotSafeNames > $TMPDIR/$inChDir/+UNBER.tmp 2>&1"); + $options = $dec{cmdopts}; + $options .= "-m" + if($dec{type} eq 'BER' && $optMin eq "on"); + $options =~ s/-x/-p/g + if($dec{type} ne 'BER' && $optNoXER eq "on"); + my $ec = system("$SUIDHelper $TMPDIR $inChDir $dec{exe} $options @gotSafeNames > $TMPDIR/$inChDir/+UNBER.tmp 2>&1"); next if ($ec != 0 and $t ne $fType and (-s "$TMPDIR/$inChDir/+UNBER.tmp" < 1000)); last unless open(U, "> $TMPDIR/$inChDir/+UNBER"); my $fnames = escapeHTML(join(", ", @gotNames)); print U "\n" . $dec{msg}; open(T, "< $TMPDIR/$inChDir/+UNBER.tmp"); @@ -521,40 +596,80 @@ if(-f $sessionDir . '/lastText') { if(param('resetText')) { unlink $sessionDir . '/lastText'; } else { - $rtt = "
  [refill with sample ASN.1 module text]"; + $rtt = "
[refill with sample ASN.1 module text]"; } } -$form = - "

" -. "
 " -. "Pick the ASN.1 module or binary encoded data file:\n" -. "
" -. "" -. "" -. "" -. "
 " -. "Or paste the ASN.1 text into the following area:$rtt\n" -. "
" -. "\n" -. "
\n" -. "These options may be used to control the compiler's behavior:
\n" -. " Debug lexer (-Wdebug-lexer)
\n" -. " Just parse and dump (do not verify) (-E)
\n" -. " Parse, verify validity, and dump (-E -F)
\n" -. " Use native machine types (e.g. double instead of REAL_t) (-fnative-types)
\n" -. " Prevent name clashes in compiled output (-fcompound-names)
\n" -. "... the command line ASN.1 compiler, asn1c, supports many other parameters." -. "" -. "
" -. "" -. " (What is ASN.1?)" -. "
"; +$form .= << "EOM"; + + + +
+
+These options may be used to control the compiler's behavior:
+ Debug lexer (-Wdebug-lexer)
+ Just parse and dump (do not verify) (-E)
+ Parse, verify validity, and dump (-E -F)
+ Use native machine types (e.g. double instead of REAL_t) (-fnative-types)
+ Prevent name clashes in compiled output (-fcompound-names)
+... the command line ASN.1 compiler, asn1c, supports many other parameters. +
+
+ + +
+
+ Generate terser output while still preserving BER encoding information (BER decoder specific, -m)
+ Generate simple text dump instead of XER (no effect on BER decoder)
+
+
+ +
+ + +EOM +; # # Gather previous transactions to generate the history page. @@ -834,7 +965,7 @@ if($EnvironmentSetOK != 1 && $TMPDIR ne "/") { system("rm -rf $TMPDIR/ >/dev/null 2>&1"); } -print< Free Online ASN.1 Compiler @@ -857,10 +988,43 @@ $redirect TD#inputbox { border-right: dashed 1px rgb(200, 200, 200); } - TD#extrasmall { - font-size: 8pt; + DIV { + font-size: 10pt; font-family: sans-serif; } + DIV#extrasmall { + font-size: 7pt; + font-family: sans-serif; + } + DIV.options { + font-size: 7pt; + font-family: sans-serif; + padding-left: 1em; + margin-left: 1em; + } + DIV.options#options-bin { + visibility: hidden; + position: fixed; + } + DIV.optsbar#optsbar-lite { font-size: 7pt; } + DIV.optsbar { + font-size: 8pt; + font-family: sans-serif; + padding: 4pt; + border-left: dashed 1px rgb(200, 200, 200); + } + + DIV#arrow { + float: left; + color: rgb(160,160,160); + } + + DIV#aarr { + display: block; + margin-left: 1em; + padding-left: 2pt; + } + A#modrefs { color: #606060; text-decoration: none;