On Tue, Jan 06, 2004 at 10:52:19PM -0500, Andrew Dunstan wrote:
> 
> A few points.
> 
> 1. clarification of my IRC comment: A quick examination seems to shaw 
> that we use the native getaddrinfo() where it exists, otherwise we use 
> our own, which in turn calls inet_ntoa().
> 2. ip6 has a well defined standard for abbreviation, and is quite 
> important to have since ip6 addresses would otherwise often be tediously 
> long. I haven't found a comparable standard for abbreviating IP4 
> addresses.


SUS does define it for inet_ntoa() and inet_addr():

   a.b.c.d
          When four parts are specified, each shall be interpreted as a
          byte of data and assigned, from left to right, to the four
          bytes of an Internet address.
   a.b.c
          When a three-part address is specified, the last part shall be
          interpreted as a 16-bit quantity and placed in the rightmost
          two bytes of the network address. This makes the three-part
          address format convenient for specifying Class B network
          addresses as "128.net.host" .
   a.b
          When a two-part address is supplied, the last part shall be
          interpreted as a 24-bit quantity and placed in the rightmost
          three bytes of the network address. This makes the two-part
          address format convenient for specifying Class A network
          addresses as "net.host" .
   a
          When only one part is given, the value shall be stored directly
          in the network address without any byte rearrangement.

     All numbers supplied as parts in IPv4 dotted decimal notation may
     be decimal, octal, or hexadecimal, as specified in the ISO C
     standard (that is, a leading 0x or 0X implies hexadecimal;
     otherwise, a leading '0' implies octal; otherwise, the number is
     interpreted as decimal).

For inet_pton() it says:

     If the af argument of inet_pton() is AF_INET, the src string shall
     be in the standard IPv4 dotted-decimal form:
ddd.ddd.ddd.ddd

     where "ddd" is a one to three digit decimal number between 0 and
     255 (see inet_addr() ). The inet_pton() function does not accept
     other formats (such as the octal numbers, hexadecimal numbers, and
     fewer than four numbers that inet_addr() accepts).
     ^^^^^^^^^^^^^^^^^^^^^^^


For getaddrinfo() it says:

     If the nodename argument is not null, it can be a descriptive name
     or can be an address string. If the specified address family is
     AF_INET, [IP6] [Option Start]  AF_INET6, [Option End] or AF_UNSPEC,
     valid descriptive names include host names. If the specified
     address family is AF_INET or AF_UNSPEC, address strings using
     Internet standard dot notation as specified in inet_addr() are
     valid.

     [IP6] [Option Start] If the specified address family is AF_INET6 or
     AF_UNSPEC, standard IPv6 text forms described in inet_ntop() are
     valid. [Option End]


I'm not sure what this really says, but I can read it to either
use the inet_addr() or inet_ntop() behaviour.


Kurt


---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Reply via email to