inet(7tcp)
inet --
Internet protocol family
Synopsis
#include <sys/types.h>
#include <netinet/in.h>
#include <netinet/in6.h>
Description
The Internet protocol family is a set of protocols using
the Internet Protocols (IPv4 and IPv6) network
layer and the Internet address formats for IPv4 and IPv6.
The Internet family provides protocol support for the
SOCK_STREAM, SOCK_DGRAM,
and SOCK_RAW socket types;
the SOCK_RAW interface provides access to the
IP protocols.
IPv4 addressing
IPv4 Internet addresses are four-byte quantities, stored in
network standard format. The include file
<netinet/in.h> defines this address.
Sockets bound to the IPv4 Internet protocol family use
the following addressing structure:
struct sockaddr_in {
sa_len_t sin_len;
sa_family_t sin_family; /* AF_INET */
in_port_t sin_port;
struct in_addr sin_addr;
unsigned char sin_zero[8];
};
When using sockets, the sin_port
and
sin_addr
fields are specified in network order.
Sockets may be created with the local address
INADDR_ANY to affect ``wildcard'' matching
on incoming messages. The address in a
connect(3sock)
or sendto (see
send(3sock))
call may be given as INADDR_ANY to mean this
host. The distinguished address
INADDR_BROADCAST is allowed as a shorthand for
the broadcast address on the primary network if the first
network configured supports broadcast.
When using the Transport Layer Interface (TLI),
transport providers such as
tcp(7tcp)
support addresses whose length varies from eight to sixteen
bytes. The 8-byte form is the same as a
sockaddr_in
without the sin_zero
field. The 16-byte form is identical to
sockaddr_in
.
IPv6 addressing
IPv6 Internet addresses are eight 16-bit quantities, stored in
network standard format. The include file
<netinet/in6.h> defines this address.
Sockets bound to the IPv6 Internet protocol family use
the following addressing structure:
struct sockaddr_in6 {
sa_len_t sin6_len;
sa_family_t sin6_family; /* AF_INET6 */
u_int16m_t sin6_port;
u_int32m_t sin6_flowinfo;
struct in6_addr sin6_addr;
};
When using sockets, the sin6_port
, sin6_flowinfo
and
sin6_addr
fields are specified in network order.
NOTE:
The sin6_len
field need not be set before passing a
socket address using
bind(3sock),
connect(3sock),
sendto(3sock),
or
sendmsg(3sock).
Sockets may be created with the local address
in6addr_any to affect ``wildcard'' matching
on incoming messages. The address in a
connect(3sock)
or sendto (see
send(3sock))
call may be given as in6addr_any to mean this
host.
NOTE:
The IN6ADDR_ constants and in6addr_ externals
are defined in network byte order, unlike the INADDR_ constants
which are defined in host byte order.
Protocols
The Internet protocol family is comprised of the
Internet Protocol (IP),
Internet Control Message Protocol (ICMP),
Internet Group Management Protocol (IGMP) -
IPv4 only, Transmission Control Protocol (TCP), and
User Datagram Protocol (UDP).
TCP is used to support the SOCK_STREAM
abstraction; UDP is used to support the
SOCK_DGRAM abstraction. A raw interface to
IP is available by creating an Internet socket of
type SOCK_RAW.
The ICMP and IGMP message
protocols are accessible from a raw socket.
IPv4 network masks
The 32-bit Internet address contains both network and host
parts. It is frequency-encoded; the most-significant bit
is clear in Class A addresses, in which the high-order 8
bits are the network number. Class B addresses use the
high-order 16 bits as the network field, and Class C
addresses have a 24-bit network part. Sites with a cluster
of local networks and a connection to the
Internet may chose to use a single network number for the
cluster; this is done by using subnet addressing. The
local (host) portion of the address is further subdivided
into subnet and host parts. Within a subnet, each subnet
appears to be an individual network; externally, the entire
cluster appears to be a single, uniform network requiring
only a single routing entry. Subnet addressing is enabled
and examined using the SIOCSIFNETMASK and SIOCGIFNETMASK
ioctl(2)
commands on a datagram socket in the Internet
``communications domain'' (see the description of the
``Interface ioctls''
on the
if(7tcp)
manual page).
References
icmp(7tcp),
if(7tcp),
igmp(7tcp),
ioctl(2),
ip(7tcp),
ipv6(7tcp),
socket(3sock),
tcp(7tcp),
udp(7tcp)
Notices
The Internet protocol support is subject to change as
the Internet protocols develop. Users should not depend
on details of the current implementation, but rather
the services exported.
In UnixWare 7, the sockaddr structure has been modified
to support variable length sockets. The net result of this modification is
that the family
member is now 8 bits and a new 8-bit
member, len
, has been inserted before it.
© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 25 April 2004