Wireshark-dev: Re: [Wireshark-dev] query regarding gtp_handle funtionanddecoderfunction.
From: prashanth joshi <prashanthsjoshi2000@xxxxxxxxx>
Date: Wed, 6 Sep 2006 11:21:37 -0700 (PDT)
Hi Anders ,
thanks very much.
Your solutions have really been very much informative.
regards,
Prashanth
"Anders Broman (AL/EAB)" <anders.broman@xxxxxxxxxxxx> wrote:
"Anders Broman (AL/EAB)" <anders.broman@xxxxxxxxxxxx> wrote:
Hi,The function val_to_str(GTP_EXT_RAI, gtp_val, "Unknown message"));searches the svalue_string gtp-val for a match to GTP_EXT_RAI and if found returns the matching string, in this case"Routing Area Identity" if no match is found it will print "Unknown message".Best regardsAnders
From: wireshark-dev-bounces@xxxxxxxxxxxxx [mailto:wireshark-dev-bounces@xxxxxxxxxxxxx] On Behalf Of prashanth joshi
Sent: den 6 september 2006 09:25
To: Developer support list for Wireshark
Subject: Re: [Wireshark-dev] query regarding gtp_handle funtionanddecoderfunction.Hi Anders, thanks.Now the things are much clearer. Now i understand why the return value from the decoder function is 3 + length.But yeah in val_to_str(GTP_EXT_XXX, gtp_val, "UNKNOWN") , is the string "UNKNOWN" concatenated with GTP_EXT_XXX and returned ?regards,Prashanth.
"Anders Broman (AL/EAB)" <anders.broman@xxxxxxxxxxxx> wrote:Hi,Are you trying to add something thats defined in 3GPP TS 29.060 or to do someting for a nonstandard extension to the protocol?( 0x7F is also allready used (define GTP_EXT_CHRG_ID 0x7F)).The code:while (gtpopt[++i].optcode)
if (gtpopt[i].optcode == ext_hdr_val)
break;
offset = offset + (*gtpopt[i].decode)(tvb, offset, pinfo, gtp_tree);Will call the function pointed out by the Extension type (GTP_EXT_XXX) with a tvb containing the GTP message and the offset parameter pointing to the Extension type(octet 1 in the IE descriptions of TS 29.060)in the function you'll have to increase offset to pont to the byte you want to "access".Best regardsAnders
From: wireshark-dev-bounces@xxxxxxxxxxxxx [mailto:wireshark-dev-bounces@xxxxxxxxxxxxx] On Behalf Of prashanth joshi
Sent: den 5 september 2006 17:35
To: Developer support list for Wireshark
Subject: Re: [Wireshark-dev] query regarding gtp_handle funtion anddecoderfunction.Hi Anders,Thanks for the reply.But I'm affraid i did not put the whole thing very clearly.I should have been more specific.Actually i need to have in the define statement the following :#define GTP_EXT_XXX 0x7f /* Satement 1 */and then the ( extension field , function pointer) pair :( GTP_EXT_XXX My_decode_fun) /* Statement 2 */And thenI need to check whether the value of the next byte is 0x30 , in the My_decode_fun(...),and then call decode_XXX(...) function. /* Statement 3 */Now in decode_XXX(...) function shall i include the same code that u have specified in your reply or that needs to be modified?Also after Statement 2 , will the pointer tvb automatically incremented by 1 or i have to explicitly increment it? This i need to know because i need to compare the value 0x30 with the content of the next byte of tvb ( as given in Statement 2 )regards,Prashanth
"Anders Broman (AL/EAB)" <anders.broman@xxxxxxxxxxxx> wrote:Hi,Are you adding decoding of:#define GTP_EXT_OMC_ID 0x8F /* 3G 143 TLV OMC Identity 7.7.42 */If so what you need to do is to add code inLine 4487static int
decode_gtp_omc_id(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {guint16 length;length = tvb_get_ntohs(tvb, offset + 1);proto_tree_add_text(tree, tvb, offset, 3+length, "%s length : %u", val_to_str(GTP_EXT_OMC_ID, gtp_val, "Unknown"), length);return 3 + length;}To do the actual decoding.Best regardsAnders
From: wireshark-dev-bounces@xxxxxxxxxxxxx [mailto:wireshark-dev-bounces@xxxxxxxxxxxxx] On Behalf Of prashanth joshi
Sent: den 5 september 2006 12:06
To: wireshark-dev@xxxxxxxxxxxxx
Subject: [Wireshark-dev] query regarding gtp_handle funtion and decoderfunction.Hi all,I'm adding a decoder for the gtp protocol. My query is :1 ) So gtp_handle will do the dissection. It refers to the file packet_gtp.c .Finds the hex value for example in the following statement :#define GTP_EXT_XXX 0x8fand then if its value in the header matches 0x8f, refers to the (val, decode_fun) pair and then calls decode_fun to handle the decoding.Now my question is : will the pointer tvb ( which is tvb_buff * tvb) be incremented automatically when it enters the function decode_fun ? Or we have to explicitly increment the pointer tvb in the decoder functin to account for the byte containing 0x8f value in the tvb?My other questions are :2) I'm trying to locate the file containing the definition for the function gtp_handle. But I'm not able to find it. Kindly can one please tell me where its definition is?3) Before actually starting the decoding in our decode function what is the code that we have to write and what that is for?regards,Prashanth
Get your own web address for just $1.99/1st yr. We'll help. Yahoo! Small Business. _______________________________________________
Wireshark-dev mailing list
Wireshark-dev@xxxxxxxxxxxxx
http://www.wireshark.org/mailman/listinfo/wireshark-dev
Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone calls. Great rates starting at 1¢/min. _______________________________________________
Wireshark-dev mailing list
Wireshark-dev@xxxxxxxxxxxxx
http://www.wireshark.org/mailman/listinfo/wireshark-dev
Get your own web address for just $1.99/1st yr. We'll help. Yahoo! Small Business. _______________________________________________
Wireshark-dev mailing list
Wireshark-dev@xxxxxxxxxxxxx
http://www.wireshark.org/mailman/listinfo/wireshark-dev
Yahoo! Messenger with Voice. Make PC-to-Phone Calls to the US (and 30+ countries) for 2¢/min or less.
- References:
- Re: [Wireshark-dev] query regarding gtp_handle funtionanddecoderfunction.
- From: Anders Broman (AL/EAB)
- Prev by Date: Re: [Wireshark-dev] Easily fixed not-even-a-bug bug...
- Next by Date: [Wireshark-dev] [Patch] update enterprise-numbers
- Previous by thread: Re: [Wireshark-dev] query regarding gtp_handle funtionanddecoderfunction.
- Next by thread: Re: [Wireshark-dev] query regarding gtp_handle funtionanddecoderfunction.
- Index(es):