diff options
author | Stig Bjørlykke <stig@bjorlykke.org> | 2014-10-07 18:18:32 +0200 |
---|---|---|
committer | Stig Bjørlykke <stig@bjorlykke.org> | 2014-10-07 20:28:10 +0000 |
commit | 683165272fa992e3642c5e7606578ffc9510c195 (patch) | |
tree | 78cae3ee82bf5e8b5c9469e3345d349d1baa03d6 /tools | |
parent | d89cc1cf9ada0d91a6819a7d6677f48ddcc54adc (diff) |
asn2wrs: Added support for #.SYNTAX_NEW
This allows syntaxes to be registered as "new" dissectors.
Change-Id: Ibb76688d9d3cbf47222610956aa627fa374bcbce
Reviewed-on: https://code.wireshark.org/review/4524
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Stig Bjørlykke <stig@bjorlykke.org>
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/asn2wrs.py | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/tools/asn2wrs.py b/tools/asn2wrs.py index 6863935e17..203f9d5f79 100755 --- a/tools/asn2wrs.py +++ b/tools/asn2wrs.py @@ -1914,10 +1914,15 @@ class EthCtx: first_decl = True for k in self.conform.get_order('SYNTAX'): reg = self.conform.use_item('SYNTAX', k) + if reg['pdu'] not in self.field: continue + f = self.field[reg['pdu']]['ethname'] + pdu = self.eth_hf[f]['pdu'] + new_prefix = '' + if (pdu['new']): new_prefix = 'new_' if first_decl: fx.write(' /*--- Syntax registrations ---*/\n') first_decl = False - fx.write(' register_ber_syntax_dissector(%s, proto_%s, dissect_%s_PDU);\n' % (k, self.eproto, reg['pdu'])); + fx.write(' %sregister_ber_syntax_dissector(%s, proto_%s, dissect_%s_PDU);\n' % (new_prefix, k, self.eproto, reg['pdu'])); fempty=False self.output.file_close(fx, discard=fempty) @@ -2420,7 +2425,8 @@ class EthCnf: 'OMIT_ASSIGNMENT', 'NO_OMIT_ASSGN', 'VIRTUAL_ASSGN', 'SET_TYPE', 'ASSIGN_VALUE_TO_TYPE', 'TYPE_RENAME', 'FIELD_RENAME', 'TF_RENAME', 'IMPORT_TAG', - 'TYPE_ATTR', 'ETYPE_ATTR', 'FIELD_ATTR', 'EFIELD_ATTR', 'SYNTAX'): + 'TYPE_ATTR', 'ETYPE_ATTR', 'FIELD_ATTR', 'EFIELD_ATTR', + 'SYNTAX', 'SYNTAX_NEW'): ctx = result.group('name') elif result.group('name') in ('OMIT_ALL_ASSIGNMENTS', 'OMIT_ASSIGNMENTS_EXCEPT', 'OMIT_ALL_TYPE_ASSIGNMENTS', 'OMIT_TYPE_ASSIGNMENTS_EXCEPT', @@ -2630,12 +2636,14 @@ class EthCnf: self.add_pdu(par[0:2], is_new, fn, lineno) if (len(par)>=3): self.add_register(par[0], par[2:5], fn, lineno) - elif ctx in ('SYNTAX'): + elif ctx in ('SYNTAX', 'SYNTAX_NEW'): if empty.match(line): continue par = get_par(line, 1, 2, fn=fn, lineno=lineno) if not par: continue if not self.check_item('PDU', par[0]): - self.add_pdu(par[0:1], False, fn, lineno) + is_new = False + if (ctx == 'SYNTAX_NEW'): is_new = True + self.add_pdu(par[0:1], is_new, fn, lineno) self.add_syntax(par, fn, lineno) elif ctx in ('REGISTER', 'REGISTER_NEW'): if empty.match(line): continue |