You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Peter Helfer <pe...@gmail.com> on 2008/11/03 06:40:53 UTC
Extending apr_sockaddr_t
Hi all
If I want to introduce a new kind of addresses in apr, what is there to take
care of ?
Assume, I would introduce a 64bit address instead of the traditional IPv4.
Besides putting it in the union, I would also have to change the salen (to
the complete length of the struct) and the ipaddr_len to the length of my
address type - correct ?
In addition to that the inet_ntop would have to be chosen correctly. Now
where I'm wondering is about the rest - how to adopt the existing code into
using a different addressing scheme.
If I can open the functionality by calling the traditional socket just with
a different family, how would I have to change the code ?
Regards, Peter
The referenced struct:
struct apr_sockaddr_t {
apr_pool_t *pool;
char *hostname;
char *servname;
apr_port_t port;
apr_int32_t family;
/** How big is the sockaddr we're using? */
apr_socklen_t salen;
/** How big is the ip address structure we're using? */
int ipaddr_len;
/** How big should the address buffer be? 16 for v4 or 46 for v6
* used in inet_ntop... */
int addr_str_len;
/** This points to the IP address structure within the appropriate
* sockaddr structure. */
void *ipaddr_ptr;
/** If multiple addresses were found by apr_sockaddr_info_get(), this
* points to a representation of the next address. */
apr_sockaddr_t *next;
/** Union of either IPv4 or IPv6 sockaddr. */
union {
/** IPv4 sockaddr structure */
struct sockaddr_in sin;
#if APR_HAVE_IPV6
/** IPv6 sockaddr structure */
struct sockaddr_in6 sin6;
#endif
#if APR_HAVE_SA_STORAGE
/** Placeholder to ensure that the size of this union is not
* dependent on whether APR_HAVE_IPV6 is defined. */
struct sockaddr_storage sas;
#endif
} sa;
};
Re: Extending apr_sockaddr_t
Posted by Peter Helfer <pe...@gmail.com>.
Yeah, I've seen the apr_int64_t, and most probably I will use this - but my
question was more for the general rest; what do I have to change in order to
make it work properly, assuming that I can access this addressing scheme
like a tradtional BSD-socket ?
2008/11/3 William A. Rowe, Jr. <wr...@rowe-clan.net>
> Peter Helfer wrote:
> > Assume, I would introduce a 64bit address instead of the traditional
> IPv4.
>
> It's still the target of *ipaddr_ptr. APR offers an apr_int64_t type to
> help you, but it's ordering is not defined.
>
Re: Extending apr_sockaddr_t
Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
Peter Helfer wrote:
> Assume, I would introduce a 64bit address instead of the traditional IPv4.
It's still the target of *ipaddr_ptr. APR offers an apr_int64_t type to
help you, but it's ordering is not defined.