ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
April 17th, 2024 | 14:30-16:00 SGT (UTC+8) | Online

Wireshark-dev: Re: [Wireshark-dev] Query regarding GTP protocol

From: Jaap Keuter <jaap.keuter@xxxxxxxxx>
Date: Fri, 15 Sep 2006 22:07:30 +0200 (CEST)

On Fri, 15 Sep 2006, prashanth joshi wrote:

> Hi ,
>   I wanted to print a message in the decode_gtp_cause function. But i did not get any such result in the ethereal display. Please tell me what may be the reason.
> the following is the function :
>   static int decode_gtp_cause(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, p
> roto_tree *tree) {
>           guint8  cause;
>         guint16 length; /* added by me */
>         length = 222;
>         cause = tvb_get_guint8(tvb, offset+1);
>         printf("How are you\n"); /*added by me */
>         proto_tree_add_uint(tree, hf_gtp_cause, tvb, offset, 2, cause);
>         proto_tree_add_text(tree, tvb, offset+3, 2, "Length : %u", length); /*added by  me                */
>           return 2;
> }
>
> The corresponding part of ethereal display is as follows :
>
>   Cause : Request accepted (128)
>   Length : 222
>
>   I wanted my message "Length = 222" to occur along with the above output.
>   But as it is clear here it did not appear.


What do you mean??? You use proto_tree_add_text(..... "Length : %u", length);
and that is what gets printed.

Thanx,
Jaap