Wireshark-dev: Re: [Wireshark-dev] Unable to Display Simple Protocol Tree
From: "Dix, Steven E" <Steven.E.Dix@xxxxxxxxxx>
Date: Sun, 22 Mar 2009 16:09:41 -0500
1) I think it is. Within my proto_register_x2d routine, I call as follows to register: if (-1 == proto_x2d) { proto_x2d = proto_register_protocol ("X2D Protocol", "X2D", "x2d"); } Variable proto_x2d is a static int, initialized to -1. After the proto_register_protocol call its value is 78246 with the AMIN macro #defined and with it #undef-ed. 2) Desperation. I tried it both ways (static & non-). The change to static was in case there was some pointer set to the x2d_item somewhere within the macro-hidden part of the Wireshark code. I didn't want the variable to go out of scope if that were true. It appeared to make no difference. 3) Good suggestion. The two legs are close to identical right now. I'll try this and post afterwards. Thanks for the quick response on this. Steve -----Original Message----- From: wsgd [mailto:wsgd@xxxxxxx] Sent: Sunday, March 22, 2009 9:32 AM To: Developer support list for Wireshark Subject: Re: [Wireshark-dev] Unable to Display Simple Protocol Tree 1) is proto_x2d well initialized ? 2) why use static for your variables ? 3) take the AMIN example and modify it step by step, you will find the problem 4) I have no idea Olivier Dix, Steven E a écrit : > I've been trying to get dissector plugin that I'm coding to display > subtree information that it has parsed. I can get it to look through > the tvb buffer and extract the data, but I can't get it to display even > the top level protocol name beneath the UDP line. As a debugging aid, I > dropped in code lifted and slightly modified from the AMIN protocol > CodeProject web article (link: > http://www.codeproject.com/KB/IP/custom_dissector.aspx). > > I macroed the code so that if macro AMIN is defined, the AMIN code runs. > Otherwise, my dissector runs. The AMIN code does display the protocol > name. With what looks like an identical proto_tree_add_item call, my > dissector won't display the protocol name. > > I don't understand why the code doesn't work. I've stepped through it > in the debugger, and verified that the structure pointed to by the tree > has a new last_child as a result of the proto_tree_add_item call, and > its finfo element has reasonable looking contents that match what I > expected for this protocol. The tree's last_child appears to be changed > identically for the AMIN dissector (which works) and for my dissector > (which doesn't) when I flip the #define AMIN macro to #undef AMIN and > rebuild the plugin. > > I've included a code snippet from the dissector below. > > #ifndef AMIN > static void > dissect_x2d(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) > { > static guint32 packetCounter = 0; > static proto_item* x2d_item = NULL; > proto_item* x2d_sub_item = NULL; > static proto_tree* x2d_tree = NULL; > static proto_tree* x2d_header_tree = NULL; > ParserNode* topClonePtr = 0; > > ParseInfo* regPtr; /* To retain the result of the parse > operation */ > > guint32 ofst = 0; /* Tracks through tvb */ > /* Debug only */ > #ifdef DBG > if (bailoutPacket <= ++packetCounter) > { > return; > } > #endif > /* Debug only */ > > if (check_col(pinfo->cinfo, COL_PROTOCOL)) > { > col_set_str(pinfo->cinfo, COL_PROTOCOL, "x2d"); > } > /* Clear out stuff in the info column */ > if (check_col(pinfo->cinfo,COL_INFO)) > { > col_clear(pinfo->cinfo,COL_INFO); > } > > if (tree) > { > x2d_item = proto_tree_add_item(tree, proto_x2d, tvb, 0, > -1, FALSE); > return; > } > > I'd appreciate any help possible on this. > > > > Steve Dix > 407-399-5578, Fax 407-249-3599 > steven.e.dix@xxxxxxxxxx > > ___________________________________________________________________________ > Sent via: Wireshark-dev mailing list <wireshark-dev@xxxxxxxxxxxxx> > Archives: http://www.wireshark.org/lists/wireshark-dev > Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev > mailto:wireshark-dev-request@xxxxxxxxxxxxx?subject=unsubscribe > > > -- Wireshark Generic Dissector http://wsgd.free.fr ___________________________________________________________________________ Sent via: Wireshark-dev mailing list <wireshark-dev@xxxxxxxxxxxxx> Archives: http://www.wireshark.org/lists/wireshark-dev Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev mailto:wireshark-dev-request@xxxxxxxxxxxxx?subject=unsubscribe
- References:
- [Wireshark-dev] Unable to Display Simple Protocol Tree
- From: Dix, Steven E
- Re: [Wireshark-dev] Unable to Display Simple Protocol Tree
- From: wsgd
- [Wireshark-dev] Unable to Display Simple Protocol Tree
- Prev by Date: Re: [Wireshark-dev] g_snprintf() and sizeof
- Next by Date: Re: [Wireshark-dev] one possible way to speed up filtering
- Previous by thread: Re: [Wireshark-dev] Unable to Display Simple Protocol Tree
- Next by thread: [Wireshark-dev] Is 'mark all packets' functionality widely used (or is it useful?)?
- Index(es):