Ethereal-dev: Re: [Ethereal-dev] ICE, RTP and STUN

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Jon Ringle <ml-ethereal@xxxxxxxxxx>
Date: Tue, 11 Jan 2005 09:37:22 -0500
Are there any other dissectors that invoke another dissector like what I am 
trying to do that I can use as an example?

TIA,

Jon

On Friday 07 January 2005 02:36 pm, Jon Ringle wrote:
> Hello,
>
> I am currently developing an ICE implementation
> (http://www.ietf.org/internet-drafts/draft-ietf-mmusic-ice-03.txt). ICE
> uses STUN on the same port that the RTP media is sent on. The ICE
> application demultiplexes STUN/RTP by looking at the first 2 bits of the
> UDP packet. RTP will have 0b10 (rtp.version == 2) and a STUN packet will
> have 0b00. I would like to have ethereal dissect what looks like a
> rtp.version == 0 packet as a STUN packet.
>
> I found in epan/dissectors/packet-rtp.c:dissect_rtp_heur() a check to
> validate that rtp.version == 2. I would like to modify this routine to call
> the STUN dissector, but I'm not sure how to make this call:
>
> static gboolean
> dissect_rtp_heur( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree )
> {
>         guint8      octet1, octet2;
>         unsigned int version;
>         unsigned int payload_type;
>         unsigned int offset = 0;
>
>         /* This is a heuristic dissector, which means we get all the UDP
>          * traffic not sent to a known dissector and not claimed by
>          * a heuristic dissector called before us!
>          */
>
>         if (! global_rtp_heur)
>                 return FALSE;
>
>         /* Get the fields in the first octet */
>         octet1 = tvb_get_guint8( tvb, offset );
>         version = RTP_VERSION( octet1 );
>
>         if (version == 0) {
>                 /******************************************/
>                 /* Call the STUN dissector here, but how? */
>                 /******************************************/
>                 return TRUE;
>         } else if (version != 2) {
>                 /* Unknown or unsupported version */
>                 return FALSE;
>         }
>
>         /* Get the fields in the second octet */
>         octet2 = tvb_get_guint8( tvb, offset + 1 );
>         payload_type = RTP_PAYLOAD_TYPE( octet2 );
>         /*      if (payload_type == PT_PCMU ||
>          *                   payload_type == PT_PCMA)
>          *           payload_type == PT_G729)
>          *       */
>         if (payload_type <= PT_H263) {
>                 dissect_rtp( tvb, pinfo, tree );
>                 return TRUE;
>         }
>         else {
>                 return FALSE;
>         }
> }
>
> _______________________________________________
> Ethereal-dev mailing list
> Ethereal-dev@xxxxxxxxxxxx
> http://www.ethereal.com/mailman/listinfo/ethereal-dev