3 ###################################################
4 # package to parse ASN.1 files and generate code for
5 # LDAP functions in Samba
6 # Copyright tridge@samba.org 2002-2003
7 # Copyright metze@samba.org 2004
9 # released under the GNU GPL
13 use FindBin
qw($RealBin);
15 use lib "$RealBin/lib";
24 my $asn1_parser = new asn1;
26 #####################################################################
27 # parse an ASN.1 file returning a structure containing all the data
31 my $asn1 = $asn1_parser->parse_asn1($filename);
32 util::CleanData($asn1);
37 #########################################
42 perl ASN.1 parser and code generator
43 Copyright (C) tridge\@samba.org
44 Copyright (C) metze\@samba.org
46 Usage: pasn1.pl [options] <asn1file>
50 --output OUTNAME put output in OUTNAME
57 'help|h|?' => \$opt_help,
58 'output|o=s' => \$opt_output,
68 my $input_file = shift;
72 my $basename = basename($input_file, ".asn1");
74 if (!defined($opt_output)) {
75 $output_file = util::ChangeExtension($input_file, ".pasn1");
77 $output_file = $opt_output;
80 # if (file is .pasn1) {
81 # $pasn1 = util::LoadStructure($pasn1_file);
82 # defined $pasn1 || die "Failed to load $pasn1_file - maybe you need --parse\n";
84 $pasn1 = ASN1Parse($input_file);
85 defined $pasn1 || die "Failed to parse $input_file";
86 util::SaveStructure($output_file, $pasn1) ||
87 die "Failed to save $output_file\n";
91 foreach my $filename (@ARGV) {
92 process_file($filename);