*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->Tru64 Unix man pages -> inet_pton (3)              
Title
Content
Arch
Section
 

inet_pton(3)

Contents


NAME    [Toc]    [Back]

       inet_pton - Convert a text string to a numeric address

SYNOPSIS    [Toc]    [Back]

       #include <arpa/inet.h>

       int inet_pton(
               int af,
               const char *src,
               void *dst );

LIBRARY    [Toc]    [Back]

       Standard C Library (libc)

PARAMETERS    [Toc]    [Back]

       Specifies  the  address  family.  Valid values are AF_INET
       for an Internet Protocol  Version  4  (IPv4)  address  and
       AF_INET6  for an IPv6 address.  Points to the address text
       string to be converted.  Points to a  buffer  that  is  to
       contain the numeric address.

DESCRIPTION    [Toc]    [Back]

       The  use  of  this  routine is deprecated.  Use the getaddrinfo(3) routine instead; it  is  also  protocol-independent.


       The  inet_pton()  function  converts  a  text  string to a
       numeric value in Internet network-byte order.

       If the af parameter is AF_INET,  the  function  accepts  a
       string in the standard IPv4 dotted-decimal form:

       ddd.ddd.ddd.ddd

       In this format, ddd is a one to three digit decimal number
       between 0 and 255.

       If the af parameter is AF_INET6, the  function  accepts  a
       string in the following form:

       x:x:x:x:x:x:x:x

       In  this  format, x is hexadecimal value of a 16-bit piece
       of the address.

       IPv6 addresses can contain long strings of zero (0)  bits.
       To  make  it  easier to write these addresses, you can use
       double colon characters (::) one time  in  an  address  to
       represent 1 or more 16-bit groups of zeros.

       For  mixed  IPv4 and IPv6 environments, the following form
       is also accepted:

       x:x:x:x:x:x:ddd.ddd.ddd.ddd

       In this form, x is hexadecimal value of a 16-bit piece  of
       the  address and ddd is a one to three digit decimal value
       between 0 and 255 that represents the IPv4  address.   See
       RFC  2373 for more information on IPv6 addressing formats.

       The calling application is responsible for  ensuring  that
       the  buffer  referred  to  by  the  dst parameter is large
       enough to hold  the  numeric  address.  AF_INET  addresses
       require 4 bytes and AF_INET6 addresses require 16 bytes.

RETURN VALUES    [Toc]    [Back]

       Upon   successful  completion,  the  inet_pton()  function
       returns 1.  If the input string is not a valid  IPv4  dotted-decimal
  string  or  a  valid IPv6 address string, the
       function returns 0.  If any other error occurs, the  function
 returns -1.

ERRORS    [Toc]    [Back]

       If the inet_pton() routine call fails, errno is set to one
       of the following values: The address family  specified  in
       the af parameter is unknown.

SEE ALSO    [Toc]    [Back]

      
      
       Functions: getaddrinfo(3), inet_ntop(3).

       RFC 2373, IP Version 6 Addressing Architecture

       Network Programmer's Guide



                                                     inet_pton(3)
[ Back ]
 Similar pages
Name OS Title
inet_ntop Tru64 Convert a numeric address to a text string
digittoint FreeBSD convert a numeric character to its integer value
sdp_open FreeBSD convert numeric SDP attribute/UUID value into human readable description
SDP_PUT8 FreeBSD convert numeric SDP attribute/UUID value into human readable description
SDP_PUT16 FreeBSD convert numeric SDP attribute/UUID value into human readable description
sdp_search FreeBSD convert numeric SDP attribute/UUID value into human readable description
SDP_PUT32 FreeBSD convert numeric SDP attribute/UUID value into human readable description
SDP_PUT64 FreeBSD convert numeric SDP attribute/UUID value into human readable description
sdp_error FreeBSD convert numeric SDP attribute/UUID value into human readable description
SDP_PUT128 FreeBSD convert numeric SDP attribute/UUID value into human readable description
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service