Seth Woolley's Man Viewer

inet(3) - inet_addr, inet_aton, inet_lnaof, inet_makeaddr, inet_netof, inet_network, inet_ntoa, inet_addr, inet_aton, inet_lnaof, inet_makeaddr, inet_netof, inet_network, inet_ntoa - Internet address manipulation routines - man 3 inet

([section] manual, -k keyword, -K [section] search, -f whatis)
man plain no title

INET(3)                    Linux Programmer's Manual                   INET(3)



NAME
       inet_aton,    inet_addr,    inet_network,   inet_ntoa,   inet_makeaddr,
       inet_lnaof, inet_netof - Internet address manipulation routines

SYNOPSIS
       #include <sys/socket.h>
       #include <netinet/in.h>
       #include <arpa/inet.h>

       int inet_aton(const char *cp, struct in_addr *inp);

       in_addr_t inet_addr(const char *cp);

       in_addr_t inet_network(const char *cp);

       char *inet_ntoa(struct in_addr in(1,8));

       struct in_addr inet_makeaddr(int net, int host(1,5));

       in_addr_t inet_lnaof(struct in_addr in(1,8));

       in_addr_t inet_netof(struct in_addr in(1,8));

DESCRIPTION
       inet_aton() converts the Internet host(1,5) address  cp  from  the  standard
       numbers-and-dots  notation into binary data and stores it in(1,8) the struc-
       ture that inp points to. inet_aton returns nonzero if(3,n)  the  address  is
       valid, zero if(3,n) not.

       The  inet_addr()  function  converts  the Internet host(1,5) address cp from
       numbers-and-dots notation into binary data in(1,8) network byte  order.   If
       the input is invalid, INADDR_NONE (usually -1) is returned.  This is an
       obsolete interface to inet_aton, described  immediately  above;  it  is
       obsolete because -1 is a valid address (255.255.255.255), and inet_aton
       provides a cleaner way to indicate error(8,n) return.

       The inet_network() function extracts the network number  in(1,8)  host(1,5)  byte
       order  from  the address cp in(1,8) numbers-and-dots notation.  If the input
       is invalid, -1 is returned.

       The inet_ntoa() function converts the Internet host(1,5) address in(1,8) given in(1,8)
       network  byte  order to a string(3,n) in(1,8) standard numbers-and-dots notation.
       The string(3,n) is returned in(1,8) a statically allocated buffer,  which  subse-
       quent calls will overwrite.

       The  inet_makeaddr() function makes an Internet host(1,5) address in(1,8) network
       byte order by combining the network number net with the  local  address
       host(1,5) in(1,8) network net, both in(1,8) local host(1,5) byte order.

       The  inet_lnaof()  function  returns the local host(1,5) address part of the
       Internet address in(1,8).  The local host(1,5) address is returned in(1,8) local  host(1,5)
       byte order.

       The inet_netof() function returns the network number part of the Inter-
       net Address in(1,8).  The network number is  returned  in(1,8)  local  host(1,5)  byte
       order.

       The   structure   in_addr  as  used  in(1,8)  inet_ntoa(),  inet_makeaddr(),
       inet_lnoaf() and inet_netof() is defined in(1,8) netinet/in.h as:

              struct in_addr {
                      unsigned long int s_addr;
              }

       Note that on the i80x86 the host(1,5) byte order is Least  Significant  Byte
       first, whereas the network byte order, as used on the Internet, is Most
       Significant Byte first.

CONFORMING TO
       BSD 4.3

SEE ALSO
       gethostbyname(3), getnetent(3), inet_ntop(3),  inet_pton(3),  hosts(5),
       networks(5)



BSD                               2001-07-25                           INET(3)

References for this manual (incoming links)