Ethereal-dev: Re: [Ethereal-dev] substitute for inet(3) functions in ethereal

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

From: Bill Fumerola <billf@xxxxxxxxxxx>
Date: Sat, 22 Jun 2002 13:04:26 -0700
On Sat, Jun 22, 2002 at 02:01:24AM -0700, Guy Harris wrote:
> On Sat, Jun 22, 2002 at 12:35:00AM -0700, Bill Fumerola wrote:
> > i need to convert a network number into a string. i don't see any current
> > use of inet_ntoa() (what i'm currently using) in the codebase, which i
> > assume is because of portability issues. what should i be using?
> 
> "ip_to_str()" is generally what's used.

ugh. how did i miss that...

> Note that if you put the network number into the protocol tree as an
> FT_IPv4 field, the conversion will be done for you - although we should
> probably have a separate type for network numbers, so that it doesn't
> show up as
> 
> 	Netmask: 255.255.255.0 (255.255.255.0)
> 
> (that's how IPv4 addresses are displayed if address-to-name resolution
> is turned off - the host name replaces the first address if it's turned
> on).

i'm actually getting the prefix mask bits and then applying them to the
appropriate address (in another field that is being stored as FT_IPv4).
the field itself is the prefix bits, determining what the prefix actually
is with that mask is just some text i'm providing as a bonus.

ie:
    pdu 1/14
        SrcAddr: schart1.finance.scv.yahoo.com (64.41.224.54)
        DstAddr: slt.scv.yahoo.com (64.41.225.140)
	[...]
	SrcMask: 25 (prefix: 64.41.224.0/25)
        DstMask: 27 (prefix: 64.41.225.128/27)

i just converted it to use ip_to_str(). thanks.

> > lastly, README.developer needs to be tvbufified. not a big deal, but a
> > small pain when you're trying to match up arguments.
> 
> What stuff is still un-tvbuffified?  Most if it should already be
> tvbuffified.

the function prototypes of proto_tree_add_foo(). i would have provided
a diff, but there's also text nearby that also would need to be modified
to talk about the new field so my lazyness kicked in.

thanks for your help.

-- 
- bill fumerola / fumerola@xxxxxxxxxxxxx / billf@xxxxxxxxxxx / billf@xxxxxx