Commit 06b8d7aa authored by Lev Walkin's avatar Lev Walkin

implemented unber - the ASN.1 BER Decoder

parent 60a1403a
......@@ -10,18 +10,15 @@ AM_CPPFLAGS = \
-I${top_srcdir}/skeletons \
-DDATADIR=\"$(pkgdatadir)\"
LDADD = \
asn1c_LDADD = \
$(top_builddir)/libasn1parser/libasn1parser.la \
$(top_builddir)/libasn1print/libasn1print.la \
$(top_builddir)/libasn1fix/libasn1fix.la \
$(top_builddir)/libasn1compiler/libasn1compiler.la
asn1c_SOURCES = asn1c.c \
tlv_decoder.c tlv_decoder.h
bin_PROGRAMS = asn1c unber
bin_PROGRAMS = asn1c
dist_man1_MANS = asn1c.1
dist_man1_MANS = asn1c.1 unber.1
check_SCRIPTS = check-parsing.sh
TESTS = check-parsing.sh
......
......@@ -14,7 +14,7 @@
@SET_MAKE@
SOURCES = $(asn1c_SOURCES)
SOURCES = asn1c.c unber.c
srcdir = @srcdir@
top_srcdir = @top_srcdir@
......@@ -37,7 +37,7 @@ NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
host_triplet = @host@
bin_PROGRAMS = asn1c$(EXEEXT)
bin_PROGRAMS = asn1c$(EXEEXT) unber$(EXEEXT)
subdir = asn1c
DIST_COMMON = README $(dist_man1_MANS) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in
......@@ -51,18 +51,19 @@ CONFIG_CLEAN_FILES =
am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"
binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
PROGRAMS = $(bin_PROGRAMS)
am_asn1c_OBJECTS = asn1c.$(OBJEXT) tlv_decoder.$(OBJEXT)
asn1c_OBJECTS = $(am_asn1c_OBJECTS)
asn1c_LDADD = $(LDADD)
asn1c_SOURCES = asn1c.c
asn1c_OBJECTS = asn1c.$(OBJEXT)
asn1c_DEPENDENCIES = $(top_builddir)/libasn1parser/libasn1parser.la \
$(top_builddir)/libasn1print/libasn1print.la \
$(top_builddir)/libasn1fix/libasn1fix.la \
$(top_builddir)/libasn1compiler/libasn1compiler.la
unber_SOURCES = unber.c
unber_OBJECTS = unber.$(OBJEXT)
unber_LDADD = $(LDADD)
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/asn1c.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/tlv_decoder.Po
@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/asn1c.Po ./$(DEPDIR)/unber.Po
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \
......@@ -71,8 +72,8 @@ LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \
CCLD = $(CC)
LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = $(asn1c_SOURCES)
DIST_SOURCES = $(asn1c_SOURCES)
SOURCES = asn1c.c unber.c
DIST_SOURCES = asn1c.c unber.c
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
html-recursive info-recursive install-data-recursive \
install-exec-recursive install-info-recursive \
......@@ -205,16 +206,13 @@ AM_CPPFLAGS = \
-I${top_srcdir}/skeletons \
-DDATADIR=\"$(pkgdatadir)\"
LDADD = \
asn1c_LDADD = \
$(top_builddir)/libasn1parser/libasn1parser.la \
$(top_builddir)/libasn1print/libasn1print.la \
$(top_builddir)/libasn1fix/libasn1fix.la \
$(top_builddir)/libasn1compiler/libasn1compiler.la
asn1c_SOURCES = asn1c.c \
tlv_decoder.c tlv_decoder.h
dist_man1_MANS = asn1c.1
dist_man1_MANS = asn1c.1 unber.1
check_SCRIPTS = check-parsing.sh
TESTS = check-parsing.sh
EXTRA_DIST = check-parsing.sh
......@@ -283,6 +281,9 @@ clean-binPROGRAMS:
asn1c$(EXEEXT): $(asn1c_OBJECTS) $(asn1c_DEPENDENCIES)
@rm -f asn1c$(EXEEXT)
$(LINK) $(asn1c_LDFLAGS) $(asn1c_OBJECTS) $(asn1c_LDADD) $(LIBS)
unber$(EXEEXT): $(unber_OBJECTS) $(unber_DEPENDENCIES)
@rm -f unber$(EXEEXT)
$(LINK) $(unber_LDFLAGS) $(unber_OBJECTS) $(unber_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
......@@ -291,7 +292,7 @@ distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/asn1c.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tlv_decoder.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unber.Po@am__quote@
.c.o:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
......
The ASN.1 Compiler
asn1c - The ASN.1 Compiler
unber - The ASN.1 BER Decoder
......@@ -4,9 +4,8 @@
.TH ASN1C 1 "\*(Dt" "ASN.1 Compiler" "ASN.1 Compiler"
.SH NAME
asn1c \- ASN.1 Compiler
.ND ASN.1 compiler
.SH SYNOPSIS
asn1c [\fB\-E\fR [\fB-F\fR] | \fB\-P\fR | \fB\-R\fR | \fB\-t\fR\fIdata-string\fR]
asn1c [\fB\-E\fR [\fB-F\fR] | \fB\-P\fR | \fB\-R\fR]
[\fB\-S\fR\fIdir\fR]
[\fB\-W\fR\fIdebug-\fR...] [\fB\-f\fR\fIoption\fR...] [\fB\-p\fR\fIrint-\fR...]
\fIinfile\fR...
......@@ -19,7 +18,6 @@ and other encoding standards.
\fIOverall Options\fR
\fB\-E \-F \-P \-R\fR
.BI "\-S " directory
.BI "\-t " data-string
.TP
\fIWarning Options\fR
.br
......@@ -55,10 +53,6 @@ omitting the usual support code.
.TP
\fB\-S\fR \fIdirectory\fR
Use the specified directory with ASN.1 skeleton files.
.TP
\fB\-t\fR \fIdata-string\fR
Interpret the data-string as a sequence of hexadecimal values representing
the start of BER TLV encoding. Print the human readable explanation.
.SH WARNING OPTIONS
.TP
.B \-Werror
......@@ -104,5 +98,8 @@ its internal understanding of subtype constraints.
.TP
.B \-print-lines
Generate "-- #line" comments in \fB-E\fR output.
.SH SEE ALSO
.TP
\&\fIunber\fR\|(1)
.SH AUTHORS
Lev Walkin <vlm@lionet.info>
......@@ -19,9 +19,7 @@
#include <asn1c_compat.h> /* Portable basename(3) and dirname(3) */
#include "tlv_decoder.h" /* -t: decode TL[V?] string */
static void usage(char *av0); /* Print the Usage screen and exit(EX_USAGE) */
static void usage(const char *av0); /* Print the Usage screen and exit */
#undef COPYRIGHT
#define COPYRIGHT \
......@@ -45,7 +43,7 @@ main(int ac, char **av) {
/*
* Process command-line options.
*/
while((ch = getopt(ac, av, "EFf:hLPp:RS:t:vW:")) != -1)
while((ch = getopt(ac, av, "EFf:hLPp:RS:vW:")) != -1)
switch(ch) {
case 'E':
print_arg__print_out = 1;
......@@ -97,10 +95,6 @@ main(int ac, char **av) {
case 'S':
skeletons_dir = optarg;
break;
case 't':
if(decode_tlv_from_string(optarg))
exit(EX_DATAERR);
exit(0);
case 'v':
fprintf(stderr, "ASN.1 Compiler, v" VERSION "\n" COPYRIGHT);
exit(0);
......@@ -264,11 +258,11 @@ main(int ac, char **av) {
* Print the usage screen and exit(EX_USAGE).
*/
static void
usage(char *av0) {
usage(const char *av0) {
fprintf(stderr,
"ASN.1 Compiler, v" VERSION "\n" COPYRIGHT
"Usage: %s [options] infile...\n"
"Where [options] are:\n"
"Usage: %s [options] file ...\n"
"Options:\n"
" -E Run only the ASN.1 parser and print out the tree\n"
" -F During -E operation, also perform tree fixing\n"
"\n"
......@@ -278,10 +272,6 @@ usage(char *av0) {
" (Default is \"%s\")\n"
"\n"
" -t <data-string> Decode the given tag[/length] sequence\n"
" (e.g. -t \"bf 20\")\n"
"\n"
" -Werror Treat warnings as errors; abort if any warning\n"
" -Wdebug-lexer Enable verbose debugging output from lexer\n"
" -Wdebug-fixer --//-- semantics processor\n"
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment