Ethereal-dev: Re: [Ethereal-dev] Dissector for MATIP Type A Host-to-Host

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

From: Jaap Keuter <jaap.keuter@xxxxxxxxx>
Date: Fri, 20 Jan 2006 12:58:15 +0100 (CET)
Hi Geoffroy,

This dissector looks pretty straightforward, so I wonder why you would see
such a problem. Could you elaborate on the construction of frames you see
this problem occur. Better yet, could you put up a sample capture on the
Wiki?

I've put some additional remarks inline.

Thanx,
Jaap

On Fri, 20 Jan 2006, Geoffroy DU_BOUAYS_DE_COUESBOUC wrote:

> Hello,
> This is a dissector for MATIP traffic (Mapping of Airline Reservation,
> Ticketing, and Messaging Traffic over IP)  (RFC 2351).
> I have a problem when the session open packet is the first of the frame. The
> data are not associated the conversation. I don?t understand why.
> Best regards,
>
> Geoffroy
>
> /* packet-matip.c
>  * Routines for MATIP (Mapping of Airline Reservation, Ticketing, and Messaging Traffic over IP)
>  * [ RFC 2351 ]
>  * The code below is only for MATIP format for Type A Host-to-Host

[snip]

>
>    case 253 :
>         dissect_matip_open_confirm(tvb, pinfo, tree);
>         break;
>
>    case 252 :
>         dissect_matip_session_close(tvb, pinfo, tree);
>         break;
>
>    case 251 :
>         dissect_matip_ss_query(tvb, pinfo, tree);
>         break;
>
>     case 250 :
>          dissect_matip_ss_response(tvb, pinfo, tree);
>          break;
>
>     case 000 :
>          dissect_matip_data_packet(tvb, pinfo, tree);
>          break;
>

The use of meaningful constants like MATIP_SESSION_CLOSE i.s.o. 252 would
make the source more readable.

[snip]

>
>    if (data_matip == NULL){
>
>       data_matip = g_mem_chunk_alloc(matip_vals);
>       data_matip->hdr_val = hdr;
>       data_matip->h1_val = h1;
>       data_matip->h2_val = h2;
>
>       conversation_add_proto_data(conv, proto_matip, data_matip);
>    }
>

g_mem_chunk_alloc is deprecated for use in new code. Your dissector may
leak memory in this way. Please refer to README.malloc for details and any
dissector in the trunk for an example. It would be something like:

        data_matip = se_alloc(sizeof(matip_entry_t));

Thanx,
Jaap