Wireshark-dev: Re: [Wireshark-dev] function of dissector_try_uint()
From: Vishnu Bhatt <[email protected]>
Date: Tue, 17 Feb 2015 07:48:32 +0000

Thanks for the reply. Can you please tell me what is the function of p_get_proto_data() in Wireshark. Specifically, in case of FP frame, what is the role of this function?

 

    p_fp_info = (fp_info *)p_get_proto_data(wmem_file_scope(), pinfo, proto_fp, 0);

 

Thanks

Vishnu Bhatt

 

From: [email protected] [mailto:[email protected]] On Behalf Of Anders Broman
Sent: Monday, February 16, 2015 7:37 PM
To: Developer support list for Wireshark
Subject: Re: [Wireshark-dev] function of dissector_try_uint()

 

 

 

From: [email protected] [mailto:[email protected]] 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: [email protected] [mailto:[email protected]] 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."

"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."