[prev in list] [next in list] [prev in thread] [next in thread]
List: ipng
Subject: (IPng 2424) Re: advanced sockets api for ipv6 (rcmd's)
From: rstevens () kohala ! com (W ! Richard Stevens)
Date: 1996-10-31 0:09:44
[Download RAW message or body]
[In your message of Oct 30, 4:45pm you write:]
> But with rcmd the application doesn't call gethostbyname.
I'll be more specific, after looking at the source code for rcmd().
Let it still call gethostbyname(). Define a new function
rresvport_af(int *, int)
[instead of rresvport6()] that takes an address family as the second
argument. (Given that gethostbyname() and getaddrinfo() both return
an address family to the caller, I'll always opt for a new function
that takes an address family as an argument, instead of something that
only works with IPv6.) But pass hp->h_addrtype as the second argument
to rresvport_af() and you then have an rcmd() that works with both
IPv4 and IPv6.
There are a few other places in the code that need fixing, for example
some inet_ntoa() that should be inet_ntop(), but the bottom line is that
I don't think we need an rcmd6() function. I see some other IPv4-specific
pieces of code that need to be changed: for example, the function diddles
with the port number in the socket address structure (sin_port). I've
written some simple functions, sock_getport() and sock_setport(), that
work with socket address structures and hide all the differences between
sin_port and sin6_port, and I've found these make writing portable
applicatons much easier (portable between IPv4 and IPv6, that is).
Rich Stevens
p.s. -- Much to my surprise I just did a "man rresvport" to verify that
the pointer argument is an "int *" and not something else, and
guess what, you've already defined rcmd6() and rresvport6()!
------------------------------------------------------------------------------
IETF IPng Mailing List FTP archive: ftp.parc.xerox.com/pub/ipng
IPng Home Page: http://playground.sun.com/ipng
Direct all administrative requests to majordomo@sunroof.eng.sun.com
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic