From 683165272fa992e3642c5e7606578ffc9510c195 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stig=20Bj=C3=B8rlykke?= Date: Tue, 7 Oct 2014 18:18:32 +0200 Subject: asn2wrs: Added support for #.SYNTAX_NEW MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Tested-by: Stig Bjørlykke --- tools/asn2wrs.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'tools') 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 -- cgit v1.2.3