diff options
author | Michael Mann <mmann78@netscape.net> | 2015-12-09 21:50:10 -0500 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2015-12-10 17:06:02 +0000 |
commit | a33209d69e95d025466f4efaebe22f6ae686c214 (patch) | |
tree | b54114223af7e8b9abd93dca58b8673bc8bbc823 /tools/asn2wrs.py | |
parent | 1ffbd2ae9d4e839460717e9886aeb2661dd1e3ea (diff) |
Convert ASN.1 dissectors to remove "new" from "new-style" dissector function names that were generated from asn2wrs.py
This includes:
1. new_create_dissector_handle -> create_dissector_handle
2. new_register_dissector -> register_dissector
3. new_register_ber_oid_dissector -> register_ber_oid_dissector
4. new_register_ber_syntax_dissector -> register_ber_syntax_dissector
Also remove PDU_NEW, SYNTAX_NEW and REGISTER_NEW as there is no need for the distinction anymore.
Change-Id: I82c7de7c8ffeeab3259d1b55bb4afc5f6a1e0329
Reviewed-on: https://code.wireshark.org/review/12491
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'tools/asn2wrs.py')
-rwxr-xr-x | tools/asn2wrs.py | 59 |
1 files changed, 19 insertions, 40 deletions
diff --git a/tools/asn2wrs.py b/tools/asn2wrs.py index 13c5eb29ec..cff519a5cc 100755 --- a/tools/asn2wrs.py +++ b/tools/asn2wrs.py @@ -1556,16 +1556,11 @@ class EthCtx: #--- eth_out_pdu_decl ---------------------------------------------------------- def eth_out_pdu_decl(self, f): t = self.eth_hf[f]['ethtype'] - is_new = self.eth_hf[f]['pdu']['new'] out = '' if (not self.eth_hf[f]['pdu']['export']): out += 'static ' - if (is_new): - out += 'int ' - out += 'dissect_'+f+'(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_);\n' - else: - out += 'void ' - out += 'dissect_'+f+'(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_);\n' + out += 'int ' + out += 'dissect_'+f+'(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_);\n' return out #--- eth_output_hf ---------------------------------------------------------- @@ -1746,24 +1741,15 @@ class EthCtx: def eth_output_types(self): def out_pdu(f): t = self.eth_hf[f]['ethtype'] - is_new = self.eth_hf[f]['pdu']['new'] impl = 'FALSE' out = '' if (not self.eth_hf[f]['pdu']['export']): out += 'static ' - if (is_new): - out += 'int ' - out += 'dissect_'+f+'(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_) {\n' - else: - out += 'void ' - out += 'dissect_'+f+'(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) {\n' - if (is_new): - out += ' int offset = 0;\n' - off_par = 'offset' - ret_par = 'offset' - else: - off_par = '0' - ret_par = None + out += 'int ' + out += 'dissect_'+f+'(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_) {\n' + out += ' int offset = 0;\n' + off_par = 'offset' + ret_par = 'offset' if (self.Per()): if (self.Aligned()): aligned = 'TRUE' @@ -1780,10 +1766,9 @@ class EthCtx: else: par=((),) out += self.eth_fn_call('dissect_%s_%s' % (self.eth_type[t]['proto'], t), ret=ret_par, par=par) - if (self.Per() and is_new): + if (self.Per()): out += ' offset += 7; offset >>= 3;\n' - if (is_new): - out += ' return offset;\n' + out += ' return offset;\n' out += '}\n' return out #end out_pdu() @@ -2275,12 +2260,12 @@ class EthCnf: out = '#line %u "%s"\n%s\n' % (self.fn[name][ctx]['lineno'], rel_dissector_path(self.fn[name][ctx]['fn']), out); return out - def add_pdu(self, par, is_new, fn, lineno): + def add_pdu(self, par, fn, lineno): #print "add_pdu(par=%s, %s, %d)" % (str(par), fn, lineno) (reg, hidden) = (None, False) if (len(par) > 1): reg = par[1] if (reg and reg[0]=='@'): (reg, hidden) = (reg[1:], True) - attr = {'new' : is_new, 'reg' : reg, 'hidden' : hidden, 'need_decl' : False, 'export' : False} + attr = {'new' : False, 'reg' : reg, 'hidden' : hidden, 'need_decl' : False, 'export' : False} self.add_item('PDU', par[0], attr=attr, fn=fn, lineno=lineno) return @@ -2419,13 +2404,13 @@ class EthCnf: if not par: continue self.set_opt(par[0], par[1:], fn, lineno) ctx = None - elif result.group('name') in ('PDU', 'PDU_NEW', 'REGISTER', 'REGISTER_NEW', + elif result.group('name') in ('PDU', 'REGISTER', 'MODULE', 'MODULE_IMPORT', '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', 'SYNTAX_NEW'): + 'SYNTAX'): ctx = result.group('name') elif result.group('name') in ('OMIT_ALL_ASSIGNMENTS', 'OMIT_ASSIGNMENTS_EXCEPT', 'OMIT_ALL_TYPE_ASSIGNMENTS', 'OMIT_TYPE_ASSIGNMENTS_EXCEPT', @@ -2626,32 +2611,26 @@ class EthCnf: if not par: continue flags = default_flags self.add_item('USE_VALS_EXT', par[0], flag=flags, fn=fn, lineno=lineno) - elif ctx in ('PDU', 'PDU_NEW'): + elif ctx == 'PDU': if empty.match(line): continue par = get_par(line, 1, 5, fn=fn, lineno=lineno) if not par: continue - is_new = False - if (ctx == 'PDU_NEW'): is_new = True - self.add_pdu(par[0:2], is_new, fn, lineno) + self.add_pdu(par[0:2], fn, lineno) if (len(par)>=3): self.add_register(par[0], par[2:5], fn, lineno) - elif ctx in ('SYNTAX', 'SYNTAX_NEW'): + elif ctx == 'SYNTAX': 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]): - is_new = False - if (ctx == 'SYNTAX_NEW'): is_new = True - self.add_pdu(par[0:1], is_new, fn, lineno) + self.add_pdu(par[0:1], fn, lineno) self.add_syntax(par, fn, lineno) - elif ctx in ('REGISTER', 'REGISTER_NEW'): + elif ctx == 'REGISTER': if empty.match(line): continue par = get_par(line, 3, 4, fn=fn, lineno=lineno) if not par: continue if not self.check_item('PDU', par[0]): - is_new = False - if (ctx == 'REGISTER_NEW'): is_new = True - self.add_pdu(par[0:1], is_new, fn, lineno) + self.add_pdu(par[0:1], fn, lineno) self.add_register(par[0], par[1:4], fn, lineno) elif ctx in ('MODULE', 'MODULE_IMPORT'): if empty.match(line): continue |