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