Wireshark-dev: Re: [Wireshark-dev] Unable to add my dissector for tcp.dstport
From: "Abhik Sarkar" <sarkar.abhik@xxxxxxxxx>
Date: Sat, 12 Jan 2008 11:54:58 +0400
I guess so... but given your explanation below... would it not be
better to do something like this:
void dissect_foo(tvbuff_t* tvbuf, packet_info* pinfo, proto_tree* tree)
{
    if ( (pinfo->ptype == PT_TCP) && (pinfo->destport == 50505) )
    {
        /* Dissect Message from Client to Server */
        /* switch on the message_id and parse the messages */

    }
    else if ( (pinfo->ptype == PT_TCP) && (pinfo->srcport == 50505) )
    {
        /* Dissect Message from Client to Server */
        /* switch on the message_id and parse the messages */
    }
    else
       return;
}


On Jan 12, 2008 11:14 AM, Vikas Jain <jain_vikas@xxxxxxxxxxx> wrote:
>
>
> Appreciate all your responses.
>
> The protocol for which I am implementing my dissector has messages both that
> are sent by the client to the server port 50505 and and by the server (from
> port 50505) to the client. The messages are different in both the directions
> and each of these messages has a message_id field as the first field whose
> value is not globally unique. Therefore, it is possible for me to get a
> Message_X (message_id = 1) going to port 50505 and get a Message_Y
> (message_id = 1) coming from port 50505. So, in order to dissect/parse the
> messages correctly, I need the sense of direction.
>
> I added the following to the dissect_foo() function yesterday and I think
> this is what Abhik is probably referring to as well:
>
> void dissect_foo(tvbuff_t* tvbuf, packet_info* pinfo, proto_tree* tree)
> {
>     if ( (pinfo->ptype != PT_TCP) || (pinfo->destport != 50505) )
>        return;
>
>     /* switch on the message_id and parse the messages */
> }
>
> Please let me know if the above is correct.
>
> Thanks,
> Vikas
>