Yes
And we might even need two different variants of PACKED BCD
The problem is how to handle odd number of digits in an integer number of bytes
I have two variants
leading 0: 0x01 0x23 = 123
and
trailing F: 0x12 0x3F = 123
/Lars
On 4/7/07, Jaap Keuter <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I've been interested in BCD presentation as well. For that I've whipped
> together some proto_tree_add_bcd() code, but couldn't really get my head
> around creating a generic FT_BCD.
> For that matter you're talking about PACKED BCD, which is different from
> BCD.
>
> PACKED BCD: 0x46 0x10 -> 4610
> BCD: 0x04 0x06 0x01 0x00 -> 4610
>
> So if we make FT_BCD we also need to make FT_PACKED_BCD.
> Anyone a decent manual for adding FTs?
>
> Thanx,
> Jaap
>
> On Fri, 6 Apr 2007, Lars Worsaae wrote:
>
> > Desr sirs
> > Are their a smart(er) way to dissect data which are BCD encoded?
> > I cant find i tvb_get_* reading BCD.
> > I had roled my own, but am i and my experimental first time dissector
> > realy the first and only dissection BCD encoded data?
> >
> > Rgds Lars
> >
> > BTW My get'er looks like:
> > static guint32
> > tvb_get_bcd(tvbuff_t *tvb, int offset, int length)
> > {
> > int i;
> > guint32 val=0;
> > for(i=0;i<length;i++){
> > guint8 b = tvb_get_guint8(tvb, offset+i);
> > val = 100*val + ((b>>4)*10 + (b&0xf));
> > }
> > return val;
> > }
> >
>
> _______________________________________________
> Wireshark-dev mailing list
> [email protected]
> http://www.wireshark.org/mailman/listinfo/wireshark-dev
>
_______________________________________________
Wireshark-dev mailing list
[email protected]
http://www.wireshark.org/mailman/listinfo/wireshark-dev