Technical data
SunOS 5.5 Protocols ip(7P)
NAME ip, IP − Internet Protocol
SYNOPSIS #include <sys/socket.h>
#include <netinet/in.h>
s = socket(AF_INET, SOCK_RAW, proto);
t = t_open ("/dev/rawip", O_RDWR);
DESCRIPTION IP is the internetworkdatagram delivery protocol that is central to the Internet protocol
family. Programs may use IP through higher-levelprotocols such as the Transmission
Control Protocol (TCP) or the User Datagram Protocol (UDP), or may interface directly to
IP. See tcp(7P) and udp(7P). Direct access may be via the socket interface (using a “raw
socket”) or the Transport Level Interface (TLI). The protocol options defined in theIP
specification may be set in outgoing datagrams.
The STREAMS driver /dev/rawip is theTLI transport provider that provides raw access to
IP.
Raw IP sockets are connectionless and are normally used with the sendto() and
recvfrom() calls, ((see send(3N) and recv(3N)) although the connect(3N) call may also be
used to fix the destinationfor future datagrams (in which case the read(2) or recv(3N)
and write(2) or send(3N) calls may be used). If proto is IPPROTO_RAW,or
IPPROTO_IGMP the application is expected to include a complete IP header when send-
ing. Otherwise, that protocol number will be set in outgoingdatagrams and used to filter
incoming datagrams and anIP header will be generated and prepended to each outgoing
datagram. In either case received datagrams are returned with theIP header and options
intact.
The socket options supported at theIP level are:
IP_OPTIONS IP options for outgoing datagrams. This socket option may
be used to set IP options to be included in each outgoing
datagram. IP options to be sent are set with setsockopt()
(see getsockopt(3N)). The getsockopt(3N) call returns the IP
options set in the last setsockopt( ) call. IP options on
received datagrams are visible to user programs only using
raw IP sockets. The format of IP options givenin set-
sockopt() matches those defined in theIP specification with
one exception: the list of addresses for the source routing
options must include the first-hop gateway at the beginning
of the list of gateways. The first-hop gateway address will be
extracted from the option list and the size adjusted accord-
ingly before use. IP options may be used with any socket
type in the Internet family.
IP_ADD_MEMBERSHIP Join a multicast group.
IP_DROP_MEMBERSHIP Leave a multicast group.
modified 3 Jul 1990 7P-145










