Wireshark-dev: [Wireshark-dev] Problems while displaying the digits in the packet

Date: Fri, 19 Jan 2007 13:08:07 +0530

Hi ,

 

We have a parameter IMSI in our protocol . It has the following format :

 

7

6

5

4

3

2

1

0

octet

Number of digits

3

IMSI digit 2

IMSI digit 1

4

IMSI digit 4

IMSI digit 3

5

IMSI digit 2n

IMSI digit 2n-1

n+3

 

typedef struct dgt_set_t

{

    unsigned char out[15];

}

dgt_set_t;

 

static dgt_set_t Dgt1_9_bcd = {

    {

     '0','1','2','3','4','5','6','7','8','9','?','?','?','?','?'

    }

};

 

char *digit_str;

 

digit_str = unpack_digits(tvb, offset, &Dgt1_9_bcd);

 

proto_tree_add_string(tree, hf_xyz_imsi, tvb, (imsi_len/2 + 1), (imsi_len/2 + 1), digit_str);

 

return offset + imsi_len/2 + 1;

 

static char*

unpack_digits(tvbuff_t *tvb, int offset, dgt_set_t *dgt){

 

        int length;

        guint8 octet;

        int i=0;

        char *digit_str;

 

        length = tvb_length(tvb);

        if (length < offset)

                return "";

        digit_str = ep_alloc((length - offset)*2+1);

 

        while ( offset < length ){

 

                octet = tvb_get_guint8(tvb,offset);

 

                digit_str[i] = dgt->out[octet & 0x0f];

                i++;

 

                /* unpack second value in byte */

                octet = octet >> 4;

 

                if (octet == 0x0f)      /* odd number bytes - hit filler */

                        break;

 

                digit_str[i] = dgt->out[octet & 0x0f];

                i++;

                offset++;

 

        }

        digit_str[i]= '\0';

        return digit_str;

}

 

When the above code snippet is executed, we are getting the following error:

 

Warn Dissector bug, protocol MACIC, in packet 1: proto.c:1859: failed assertion "hfinfo->type == FT_STRING || hfinfo->type == FT_STRINGZ"

 

Your help is appreciated .

 

//Tarani

 

 


The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments.

WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.

www.wipro.com