Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-dev: Re: [Wireshark-dev] function of dissector_try_uint()

From: Anders Broman <anders.broman@xxxxxxxxxxxx>
Date: Mon, 16 Feb 2015 14:06:42 +0000

 

 

From: wireshark-dev-bounces@xxxxxxxxxxxxx [mailto:wireshark-dev-bounces@xxxxxxxxxxxxx] On Behalf Of Anders Broman
Sent: den 16 februari 2015 15:05
To: Developer support list for Wireshark
Subject: Re: [Wireshark-dev] function of dissector_try_uint()

 

 

 

From: wireshark-dev-bounces@xxxxxxxxxxxxx [mailto:wireshark-dev-bounces@xxxxxxxxxxxxx] On Behalf Of Vishnu Bhatt
Sent: den 16 februari 2015 14:55
To: Developer support list for Wireshark
Subject: [Wireshark-dev] function of dissector_try_uint()

 

>Hi,

> 

>I have a dissector code (atmii) and I am having problem in understanding the following two lines of code:

> 

>In proto_register_atmii()

> 

>aal_dissector_table = register_dissector_table("atmii.aal2_payload", "AAL payload type", FT_UINT8, BASE_DEC);

 

Registers a dissector table with the name  atmii.aal2_payload in which it will be possible to register a callback for an UINT8 value. Compare with the UDP table where a dissector can

Register to be called for a message with UDP port number. SIP registers for port 5060 for instance.

 

and then in dissect_atmii()

 

if (!dissector_try_port(aal_dissector_table, payload_type, next_tvb, pinfo, tree)) {

proto_tree_add_item(atmii_tree,hf_atmii_aal2_payload, tvb, ATM_HEADER_LENGTH, -1, FALSE);

}

 

The atmii.aal2_payload  table will be searched for a match on payload type if a match is found the callback will be executed handing next_tvb to the called function.

If no match is found(no dissector registered for the payload type FALSE will be returned.

 

>What does these two lines of code do in general as I’ve seen them in other protocols as well?

 

Oh, and you can see who has registered in the table in the Internal menu in the main menu bar and with what value.

 

Thanks

Vishnu

"DISCLAIMER: This message is proprietary to Aricent and is intended solely for the use of the individual to whom it is addressed. It may contain privileged or confidential information and should not be circulated or used for any purpose other than for what it is intended. If you have received this message in error, please notify the originator immediately. If you are not the intended recipient, you are notified that you are strictly prohibited from using, copying, altering, or disclosing the contents of this message. Aricent accepts no responsibility for loss or damage arising from the use of the information transmitted by this email including damage from virus."