diff options
-rwxr-xr-x | tools/wireshark_be.py | 3 | ||||
-rwxr-xr-x | tools/wireshark_gen.py | 11 |
2 files changed, 9 insertions, 5 deletions
diff --git a/tools/wireshark_be.py b/tools/wireshark_be.py index cae15d3aa9..2125e04038 100755 --- a/tools/wireshark_be.py +++ b/tools/wireshark_be.py @@ -258,6 +258,7 @@ class WiresharkVisitor: def run(tree, args): DEBUG = "debug" in args + AGGRESSIVE = "aggressive" in args st = output.Stream(sys.stdout, 4) # set indent for stream ev = WiresharkVisitor(st, DEBUG) # create visitor object @@ -291,7 +292,7 @@ def run(tree, args): # and generate some C code - eg = wireshark_gen_C(ev.st, string.upper(nl), string.lower(nl), string.capitalize(nl) + " Dissector Using GIOP API", debug=DEBUG) + eg = wireshark_gen_C(ev.st, string.upper(nl), string.lower(nl), string.capitalize(nl) + " Dissector Using GIOP API", debug=DEBUG, aggressive=AGGRESSIVE) eg.genCode(ev.oplist, ev.atlist, ev.enlist, ev.stlist, ev.unlist) # pass them onto the C generator # diff --git a/tools/wireshark_gen.py b/tools/wireshark_gen.py index cc970b3631..c8a2905d89 100755 --- a/tools/wireshark_gen.py +++ b/tools/wireshark_gen.py @@ -140,8 +140,9 @@ class wireshark_gen_C: # Constructor # - def __init__(self, st, protocol_name, dissector_name ,description, debug=False): + def __init__(self, st, protocol_name, dissector_name ,description, debug=False, aggressive=False): self.DEBUG = debug + self.AGGRESSIVE = aggressive self.st = output.Stream(tempfile.TemporaryFile(),4) # for first pass only @@ -308,7 +309,7 @@ class wireshark_gen_C: #self.get_CDR_alias(rt, rt.name() ) if (rt.unalias().kind() == idltype.tk_sequence): self.st.out(self.template_hf, name=sname + "_return_loop") - if (self.isSeqNativeType(rt.unalias().seqType())): + if (self.isSeqNativeType(rt.unalias().seqType())) or self.AGGRESSIVE: self.st.out(self.template_hf, name=sname + "_return") elif ((rt.unalias().kind() != idltype.tk_struct) and \ (rt.unalias().kind() != idltype.tk_objref) and \ @@ -324,7 +325,7 @@ class wireshark_gen_C: for p in op.parameters(): if (p.paramType().unalias().kind() == idltype.tk_sequence): self.st.out(self.template_hf, name=sname + "_" + p.identifier() + "_loop") - if (self.isSeqNativeType(p.paramType().unalias().seqType())): + if (self.isSeqNativeType(p.paramType().unalias().seqType())) or self.AGGRESSIVE: self.st.out(self.template_hf, name=sname + "_" + p.identifier()) elif ((p.paramType().unalias().kind() != idltype.tk_any) and \ (p.paramType().unalias().kind() != idltype.tk_struct) and \ @@ -373,7 +374,7 @@ class wireshark_gen_C: for decl in m.declarators(): if (m.memberType().unalias().kind() == idltype.tk_sequence): self.st.out(self.template_hf, name=sname + "_" + decl.identifier() + "_loop") - if (self.isSeqNativeType(m.memberType().unalias().seqType())): + if (self.isSeqNativeType(m.memberType().unalias().seqType())) or self.AGGRESSIVE: self.st.out(self.template_hf, name=sname + "_" + decl.identifier()) else: if (m.memberType().unalias().kind() == idltype.tk_wchar): @@ -1541,6 +1542,8 @@ class wireshark_gen_C: un_need_item = 1 else: un_need_item = 1 + if self.AGGRESSIVE: + un_need_item = 1 sname = self.namespace(un, "_") self.curr_sname = sname # update current opnode/exnode/stnode/unnode scoped name |