Previous section.

Technical Standard: Networking Services (XNS), Issue 5.2 Draft 2.0
Copyright © 1999 The Open Group

NAME

netinet/in.h - Internet Protocol family

SYNOPSIS


#include <netinet/in.h>


DESCRIPTION

When header file <netinet.h> is included, the following types are defined through typedef.

in_port_t
An unsigned integral type of exactly 16 bits.

in_addr_t
An unsigned integral type of exactly 32 bits.

The <netinet/in.h> header defines the in_addr structure that includes at least the following member:


in_addr_t s_addr

The <netinet/in.h> header defines the sockaddr_in structure that includes at least the following members:


sa_family_t sin_family in_port_t sin_port struct in_addr sin_addr unsigned char sin_zero[8]
The sockaddr_in structure is used to store addresses for the Internet protocol family. Values of this type must be cast to struct sockaddr for use with the socket interfaces defined in this document.

The <netinet/in.h> header defines the type sa_family_t as described in <sys/socket.h>.

The <netinet/in.h> header defines the following macros for use as values of the level argument of getsockopt() and setsockopt():

IPPROTO_IP
IP

IPPROTO_ICMP
Control message protocol

IPPROTO_TCP
TCP

IPPROTO_UDP
User datagram protocol

The <netinet/in.h> header defines the following macros for use as destination addresses for connect(), sendmsg() and sendto():

INADDR_ANY
IPv4 local host address

INADDR_BROADCAST
IPv4 broadcast address

The <netinet/in.h> header defines the following macro to help applications declare buffers of the proper size to store IPv4 addresses in string form:


INET_ADDRSTRLEN 16

ntohl(), ntohs(), htonl() and htons() as defined in the description of <arpa/inet.h> are available. Inclusion of the <netinet/in.h> header may also make visible all symbols from <arpa/inet.h>.

SEE ALSO

getsockopt(), setsockopt(). <sys/socket.h>.

CHANGE HISTORY

First released in Issue 4.

Contents Next section Index