aboutsummaryrefslogtreecommitdiffstats
path: root/tools/asn2wrs.py
diff options
context:
space:
mode:
authorGraeme Lunt <graeme.lunt@smhs.co.uk>2010-06-28 09:26:41 +0000
committerGraeme Lunt <graeme.lunt@smhs.co.uk>2010-06-28 09:26:41 +0000
commit0d9ad5016e2321574904dea7166cc98bc54ceb8b (patch)
treee430ee0642105e4750314bf4e8549766aa308e67 /tools/asn2wrs.py
parent6d60493b8a546441d6efe2e0593fb6cbafb6cad3 (diff)
Remove the -R flag (used to generate syntax registrations) and replace with a
packet-<proto>-syn-reg.c output file. This is more generic and allows the syntax registrations to the directed from the template file. svn path=/trunk/; revision=33342
Diffstat (limited to 'tools/asn2wrs.py')
-rwxr-xr-xtools/asn2wrs.py30
1 files changed, 15 insertions, 15 deletions
diff --git a/tools/asn2wrs.py b/tools/asn2wrs.py
index b3f10d077f..75e6ee47f9 100755
--- a/tools/asn2wrs.py
+++ b/tools/asn2wrs.py
@@ -1851,15 +1851,19 @@ class EthCtx:
fx.write(' %sregister_%s_oid_dissector(%s, dissect_%s, proto_%s, %s);\n' % (new_prefix, reg['rtype'].lower(), roid, f, self.eproto, reg['roidname']))
fempty = False
fx.write('\n')
- if (self.conform.register_syntaxes and len(self.eth_hfpdu_ord)):
- first_decl = True
- for p in self.eth_hfpdu_ord:
- if first_decl:
- fx.write('/*--- Syntax registrations ---*/\n')
- first_decl = False
- fx.write(self.eth_out_syntax_reg(self.eproto, p))
- if not first_decl:
- fx.write('\n')
+ self.output.file_close(fx, discard=fempty)
+
+ #--- eth_output_syn_reg -----------------------------------------------------
+ def eth_output_syn_reg(self):
+ fx = self.output.file_open('syn-reg')
+ fempty = True
+ first_decl = True
+ for p in self.eth_hfpdu_ord:
+ if first_decl:
+ fx.write(' /*--- Syntax registrations ---*/\n')
+ first_decl = False
+ fx.write(self.eth_out_syntax_reg(self.eproto, p))
+ fempty=False
self.output.file_close(fx, discard=fempty)
#--- eth_output_table -----------------------------------------------------
@@ -2024,6 +2028,7 @@ class EthCtx:
self.eth_output_dis_hnd()
self.eth_output_dis_reg()
self.eth_output_dis_tab()
+ self.eth_output_syn_reg()
self.eth_output_table()
if self.expcnf:
self.eth_output_expcnf()
@@ -2067,7 +2072,6 @@ class EthCnf:
self.fn = {}
self.report = {}
self.suppress_line = False
- self.register_syntaxes = False
self.include_path = []
# Value name Default value Duplicity check Usage check
self.tblcfg['EXPORTS'] = { 'val_nm' : 'flag', 'val_dflt' : 0, 'chk_dup' : True, 'chk_use' : True }
@@ -2693,9 +2697,6 @@ class EthCnf:
par = self.check_par(par, 1, 1, fn, lineno)
if not par: return
self.ectx.default_external_type_cb = par[0]
- elif opt in ("-R",):
- par = self.check_par(par, 0, 0, fn, lineno)
- self.register_syntaxes = True
elif opt in ("-r",):
par = self.check_par(par, 1, 1, fn, lineno)
if not par: return
@@ -7665,7 +7666,6 @@ asn2wrs [-h|?] [-d dbg] [-b] [-p proto] [-c cnf_file] [-e] input_file(s) ...
-L : Suppress #line directive from .cnf file
-D dir : Directory for input_file(s) (default: '.')
-C : Add check for SIZE constraints
- -R : Register PDUs as BER syntaxes
-r prefix : Remove the prefix from type names
input_file(s) : Input ASN.1 file(s)
@@ -7688,7 +7688,7 @@ def eth_main():
global lexer
print "ASN.1 to Wireshark dissector compiler";
try:
- opts, args = getopt.getopt(sys.argv[1:], "h?d:D:buXp:FTo:O:c:I:eESs:kLCRr:");
+ opts, args = getopt.getopt(sys.argv[1:], "h?d:D:buXp:FTo:O:c:I:eESs:kLCr:");
except getopt.GetoptError:
eth_usage(); sys.exit(2)
if len(args) < 1: