Exemplo n.º 1
0
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

    ev.visitAST(tree)  # go find some operations

    #
    # Grab name of main IDL file being compiled.
    #
    # Assumption: Name is of the form   abcdefg.xyz  (eg: CosNaming.idl)
    #

    fname = path.basename(
        tree.file())  # grab basename only, dont care about path
    nl = string.split(
        fname, ".")[0]  # split name of main IDL file using "." as separator
    # and grab first field (eg: CosNaming)

    if DEBUG:
        for i in ev.oplist:
            print "XXX - Operation node ", i, " repoId() = ", i.repoId()
        for i in ev.atlist:
            print "XXX - Attribute node ", i, " identifiers() = ", i.identifiers(
            )
        for i in ev.enlist:
            print "XXX - Enum node ", i, " repoId() = ", i.repoId()
        for i in ev.stlist:
            print "XXX - Struct node ", i, " repoId() = ", i.repoId()
        for i in ev.unlist:
            print "XXX - Union node ", i, " repoId() = ", i.repoId()

    # create a C generator object
    # 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,
                         aggressive=AGGRESSIVE)
    eg.genCode(ev.oplist, ev.atlist, ev.enlist, ev.stlist,
               ev.unlist)  # pass them onto the C generator
Exemplo n.º 2
0
def run(tree, args):

    st = output.Stream(sys.stdout, 4)   # set indent for stream
    ev = WiresharkVisitor(st)            # create visitor object
    
    ev.visitAST(tree)                   # go find some operations
    
    #
    # Grab name of main IDL file being compiled.
    # 
    # Assumption: Name is of the form   abcdefg.xyz  (eg: CosNaming.idl)
    #
    
    fname = path.basename(tree.file())    # grab basename only, dont care about path
    nl = string.split(fname,".")[0]       # split name of main IDL file using "." as separator
                                          # and grab first field (eg: CosNaming)

    if ev.DEBUG:
        for i in ev.oplist:
            print "XXX - Operation node ", i, " repoId() = ", i.repoId()
        for i in ev.atlist:
            print "XXX - Attribute node ", i, " identifiers() = ", i.identifiers()
        for i in ev.enlist:
            print "XXX - Enum node ", i, " repoId() = ", i.repoId()                
        for i in ev.stlist:
            print "XXX - Struct node ", i, " repoId() = ", i.repoId()                                             
        for i in ev.unlist:
            print "XXX - Union node ", i, " repoId() = ", i.repoId()

            
    # create a C generator object
    # and generate some C code



    
    eg = wireshark_gen_C(ev.st, string.upper(nl), string.lower(nl), string.capitalize(nl) + " Dissector Using GIOP API") 
    eg.genCode(ev.oplist, ev.atlist, ev.enlist, ev.stlist, ev.unlist)    # pass them onto the C generator