You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by David Reid <dr...@jetnet.co.uk> on 2000/11/24 01:22:21 UTC

Networking functions?

Should we have a function in apr that can take an apr_sockaddr_t and return
a formatted address string?  I mean we now need to deal with IPv4/IPv6 and
it'd be nice to abstract the need for different formatting away from the
client.

apr_status_t apr_format_address(char *string, apr_sockaddr_t *sa)

Should we have a flag that we pass in to say what we want (address only,
address:port, port only)?

Just some random thoughts again...

david


Re: Networking functions?

Posted by Jeff Trawick <tr...@bellsouth.net>.
Jeff Trawick <tr...@bellsouth.net> writes:

> "David Reid" <dr...@jetnet.co.uk> writes:
> 
> > Should we have a function in apr that can take an apr_sockaddr_t and return
> > a formatted address string?  I mean we now need to deal with IPv4/IPv6 and
> > it'd be nice to abstract the need for different formatting away from the
> > client.
> > 
> > apr_status_t apr_format_address(char *string, apr_sockaddr_t *sa)

Just FYI... While reading through the KAME patch today I noticed that
apr_*printf() supports sockaddr formatting.  They saw the need to
patch that (for logging perhaps?).

-- 
Jeff Trawick | trawick@ibm.net | PGP public key at web site:
     http://www.geocities.com/SiliconValley/Park/9289/
          Born in Roswell... married an alien...

Re: Networking functions?

Posted by Jeff Trawick <tr...@bellsouth.net>.
"David Reid" <dr...@jetnet.co.uk> writes:

> Should we have a function in apr that can take an apr_sockaddr_t and return
> a formatted address string?  I mean we now need to deal with IPv4/IPv6 and
> it'd be nice to abstract the need for different formatting away from the
> client.
> 
> apr_status_t apr_format_address(char *string, apr_sockaddr_t *sa)

That should be "char **string", right?  Would you cache the string in
the apr_sockaddr_t so that it doesn't have to be allocated more than
once?  Otherwise, you might want the caller to pass the storage
(lots of groaning heard, even from the sleepers in other time zones).

> Should we have a flag that we pass in to say what we want (address only,
> address:port, port only)?

Note that we have apr_get_ipaddr() already which formats the address
only.  If you provide this function with the style flag (+1 from me),
you can get rid of apr_get_ipaddr().

Would you use the URL-style format for IPv6 numeric address string and
port (e.g., "[fe80::1]:1080")?

-- 
Jeff Trawick | trawick@ibm.net | PGP public key at web site:
     http://www.geocities.com/SiliconValley/Park/9289/
          Born in Roswell... married an alien...

Re: Networking functions?

Posted by Greg Stein <gs...@lyra.org>.
On Fri, Nov 24, 2000 at 12:22:21AM -0000, David Reid wrote:
> Should we have a function in apr that can take an apr_sockaddr_t and return
> a formatted address string?  I mean we now need to deal with IPv4/IPv6 and
> it'd be nice to abstract the need for different formatting away from the
> client.
> 
> apr_status_t apr_format_address(char *string, apr_sockaddr_t *sa)
> 
> Should we have a flag that we pass in to say what we want (address only,
> address:port, port only)?

"Feel Free."

:-)

-- 
Greg Stein, http://www.lyra.org/