Wireshark-dev: Re: [Wireshark-dev] proto_tree_add_item / hf_register_info addition (Was: BCD ?)
From: "Lars Worsaae" <[email protected]>
Date: Wed, 11 Apr 2007 09:17:44 +0200
All these strange variants. ..
And all of them are just integers in some sort
It seems to me like what we need (if it's not already there, and I
just havent found it)
is to have the posibility of letting the dissector specific code, do
the transformation
from what ever strange format the protocol uses, to the general
usefull once which wireshark supports.

Wireshark needs something to use for filtering and displaying the
field items, this dont need to be anything but string and integer.
Then the dissector should provide the transformation for odd fields.

How the details should be defined I dont feel competent to contribute
with - sorry.
But something like the above what free the base wireshark code from
handling all these strange kinds of BCD

It would also solve another little nag I have. My protocol uses a
string to convey an integer. So when you will filter you need to quote
and use leading zero's in order to get a match. If the data
transformation and the filtering was split in two (for this field
item) my dissector could transform the "array of ascii" to an integer
and the user
can forget about quotes and leading zero's

Rgds Lars




On 4/10/07, Luis Ontanon <[email protected]> wrote:
That applies to ISUP as well, I've always wondered about the reason
behind this oddity.


On 4/10/07, Michael Lum <[email protected]> wrote:
> It's probably even worse than that!
>
> In both GSM and CDMA protocols packed BCD can be represented as:
>
> digit2 digit1
> digit4 digit3
>
> such that two octets:
>
> 0x01 0x23
>
> would be:
>
> 1032
>
> An example is the Called Party BCD Number element.
>
> --
> Michael Lum                   Principal Software Engineer
> 4600 Jacombs Road             +1.604.276.0055
> Richmond, B.C.
> Canada V6V 3B1
> UTStarcom Canada, Inc.
> CDMA Division
>
>
> > -----Original Message-----
> > From: [email protected]
> > [mailto:[email protected]] On Behalf Of Lars Worsaae
> > Sent: April 7, 2007 12:31 PM
> > To: Developer support list for Wireshark
> > Subject: Re: [Wireshark-dev] BCD ?
> >
> > 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
> >
> _______________________________________________
> Wireshark-dev mailing list
> [email protected]
> http://www.wireshark.org/mailman/listinfo/wireshark-dev
>


--
This information is top security. When you have read it, destroy yourself.
-- Marshall McLuhan
_______________________________________________
Wireshark-dev mailing list
[email protected]
http://www.wireshark.org/mailman/listinfo/wireshark-dev