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] tcp_dissect_pdus Does not work

From: Graham Bloice <graham.bloice@xxxxxxxxxxxxx>
Date: Thu, 23 Apr 2009 10:14:08 +0100
mirtaher@xxxxxxxxx wrote:
Hi,

I am developing a dissector for MPICH over TCP and trying to use
tcp_dissect_pdus. But unfortunately I am getting a blank screen. My code
looks like this:

void
dissect_mpich_tcp_nonepm (tvbuff_t * tvb, packet_info * pinfo, proto_tree
* tree)
{
  tcp_dissect_pdus (tvb, pinfo, tree, mpich_desegment, HEADER_LENGTH,
get_mpich_pdu_len, dissect_mpich_tcp_nonepm_pdu);
}

guint
get_mpich_pdu_len (tvbuff_t * tvb, int offset)
{

  guint32 messageSize = 0;
  guint32 messagetype = 0;

  messagetype = tvb_get_ntohs(tvb, offset);

  if (messagetype == MPIDI_CH3_PKT_EAGER_SEND)
     messageSize = tvb_get_ntohs(tvb,offset + 12);


  return messageSize;

}


I noticed my code enter get_mpich_pdu_len but never goes beyond 
messagetype = tvb_get_ntohs(tvb, offset); line.

I am not sure what I am doing wrong.

Any help is fully appreciated.



  
The function prototype for get_mpich_pdu_len is wrong, it should be as defined in packet-tcp.h

guint
get_mpich_pdu_len (packet_info *pInfo, tvbuff_t *tvb, int offset)

What is HEADER_LENGTH set to?  It should be the minimum size of your header which appears to be at least 13 as you attempt to read from offset + 12.

-- 
Regards,

Graham Bloice