1*5c2921b0SApple OSS Distributions.\" $NetBSD: inet.4,v 1.3 1994/11/30 16:22:18 jtc Exp $ 2*5c2921b0SApple OSS Distributions.\" 3*5c2921b0SApple OSS Distributions.\" Copyright (c) 1983, 1991, 1993 4*5c2921b0SApple OSS Distributions.\" The Regents of the University of California. All rights reserved. 5*5c2921b0SApple OSS Distributions.\" 6*5c2921b0SApple OSS Distributions.\" Redistribution and use in source and binary forms, with or without 7*5c2921b0SApple OSS Distributions.\" modification, are permitted provided that the following conditions 8*5c2921b0SApple OSS Distributions.\" are met: 9*5c2921b0SApple OSS Distributions.\" 1. Redistributions of source code must retain the above copyright 10*5c2921b0SApple OSS Distributions.\" notice, this list of conditions and the following disclaimer. 11*5c2921b0SApple OSS Distributions.\" 2. Redistributions in binary form must reproduce the above copyright 12*5c2921b0SApple OSS Distributions.\" notice, this list of conditions and the following disclaimer in the 13*5c2921b0SApple OSS Distributions.\" documentation and/or other materials provided with the distribution. 14*5c2921b0SApple OSS Distributions.\" 3. All advertising materials mentioning features or use of this software 15*5c2921b0SApple OSS Distributions.\" must display the following acknowledgement: 16*5c2921b0SApple OSS Distributions.\" This product includes software developed by the University of 17*5c2921b0SApple OSS Distributions.\" California, Berkeley and its contributors. 18*5c2921b0SApple OSS Distributions.\" 4. Neither the name of the University nor the names of its contributors 19*5c2921b0SApple OSS Distributions.\" may be used to endorse or promote products derived from this software 20*5c2921b0SApple OSS Distributions.\" without specific prior written permission. 21*5c2921b0SApple OSS Distributions.\" 22*5c2921b0SApple OSS Distributions.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 23*5c2921b0SApple OSS Distributions.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24*5c2921b0SApple OSS Distributions.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25*5c2921b0SApple OSS Distributions.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 26*5c2921b0SApple OSS Distributions.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27*5c2921b0SApple OSS Distributions.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28*5c2921b0SApple OSS Distributions.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29*5c2921b0SApple OSS Distributions.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30*5c2921b0SApple OSS Distributions.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31*5c2921b0SApple OSS Distributions.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32*5c2921b0SApple OSS Distributions.\" SUCH DAMAGE. 33*5c2921b0SApple OSS Distributions.\" 34*5c2921b0SApple OSS Distributions.\" @(#)inet.4 8.1 (Berkeley) 6/5/93 35*5c2921b0SApple OSS Distributions.\" 36*5c2921b0SApple OSS Distributions.Dd March 18, 2015 37*5c2921b0SApple OSS Distributions.Dt INET 4 38*5c2921b0SApple OSS Distributions.Os BSD 4.2 39*5c2921b0SApple OSS Distributions.Sh NAME 40*5c2921b0SApple OSS Distributions.Nm inet 41*5c2921b0SApple OSS Distributions.Nd Internet protocol family 42*5c2921b0SApple OSS Distributions.Sh SYNOPSIS 43*5c2921b0SApple OSS Distributions.Fd #include <sys/types.h> 44*5c2921b0SApple OSS Distributions.Fd #include <netinet/in.h> 45*5c2921b0SApple OSS Distributions.Sh DESCRIPTION 46*5c2921b0SApple OSS DistributionsThe Internet protocol family is a collection of protocols 47*5c2921b0SApple OSS Distributionslayered atop the 48*5c2921b0SApple OSS Distributions.Em Internet Protocol 49*5c2921b0SApple OSS Distributions.Pq Tn IP 50*5c2921b0SApple OSS Distributionstransport layer, and utilizing the Internet address format. 51*5c2921b0SApple OSS DistributionsThe Internet family provides protocol support for the 52*5c2921b0SApple OSS Distributions.Dv SOCK_STREAM , SOCK_DGRAM , 53*5c2921b0SApple OSS Distributionsand 54*5c2921b0SApple OSS Distributions.Dv SOCK_RAW 55*5c2921b0SApple OSS Distributionssocket types; the 56*5c2921b0SApple OSS Distributions.Dv SOCK_RAW 57*5c2921b0SApple OSS Distributionsinterface provides access to the 58*5c2921b0SApple OSS Distributions.Tn IP 59*5c2921b0SApple OSS Distributionsprotocol. 60*5c2921b0SApple OSS Distributions.Sh ADDRESSING 61*5c2921b0SApple OSS DistributionsInternet addresses are four byte quantities, stored in 62*5c2921b0SApple OSS Distributionsnetwork standard format (on the 63*5c2921b0SApple OSS Distributions.Tn VAX 64*5c2921b0SApple OSS Distributionsthese are word and byte 65*5c2921b0SApple OSS Distributionsreversed). The include file 66*5c2921b0SApple OSS Distributions.Aq Pa netinet/in.h 67*5c2921b0SApple OSS Distributionsdefines this address 68*5c2921b0SApple OSS Distributionsas a discriminated union. 69*5c2921b0SApple OSS Distributions.Pp 70*5c2921b0SApple OSS DistributionsSockets bound to the Internet protocol family utilize 71*5c2921b0SApple OSS Distributionsthe following addressing structure, 72*5c2921b0SApple OSS Distributions.Bd -literal -offset indent 73*5c2921b0SApple OSS Distributionsstruct sockaddr_in { 74*5c2921b0SApple OSS Distributions short sin_family; 75*5c2921b0SApple OSS Distributions u_short sin_port; 76*5c2921b0SApple OSS Distributions struct in_addr sin_addr; 77*5c2921b0SApple OSS Distributions char sin_zero[8]; 78*5c2921b0SApple OSS Distributions}; 79*5c2921b0SApple OSS Distributions.Ed 80*5c2921b0SApple OSS Distributions.Pp 81*5c2921b0SApple OSS DistributionsSockets may be created with the local address 82*5c2921b0SApple OSS Distributions.Dv INADDR_ANY 83*5c2921b0SApple OSS Distributionsto effect 84*5c2921b0SApple OSS Distributions.Dq wildcard 85*5c2921b0SApple OSS Distributionsmatching on incoming messages. 86*5c2921b0SApple OSS DistributionsThe address in a 87*5c2921b0SApple OSS Distributions.Xr connect 2 , 88*5c2921b0SApple OSS Distributions.Xr connectx 2 89*5c2921b0SApple OSS Distributionsor 90*5c2921b0SApple OSS Distributions.Xr sendto 2 91*5c2921b0SApple OSS Distributionscall may be given as 92*5c2921b0SApple OSS Distributions.Dv INADDR_ANY 93*5c2921b0SApple OSS Distributionsto mean 94*5c2921b0SApple OSS Distributions.Dq this host . 95*5c2921b0SApple OSS DistributionsThe distinguished address 96*5c2921b0SApple OSS Distributions.Dv INADDR_BROADCAST 97*5c2921b0SApple OSS Distributionsis allowed as a shorthand for the broadcast address on the primary 98*5c2921b0SApple OSS Distributionsnetwork if the first network configured supports broadcast. 99*5c2921b0SApple OSS Distributions.Sh PROTOCOLS 100*5c2921b0SApple OSS DistributionsThe Internet protocol family is comprised of 101*5c2921b0SApple OSS Distributionsthe 102*5c2921b0SApple OSS Distributions.Tn IP 103*5c2921b0SApple OSS Distributionstransport protocol, Internet Control 104*5c2921b0SApple OSS DistributionsMessage Protocol 105*5c2921b0SApple OSS Distributions.Pq Tn ICMP , 106*5c2921b0SApple OSS DistributionsTransmission Control 107*5c2921b0SApple OSS DistributionsProtocol 108*5c2921b0SApple OSS Distributions.Pq Tn TCP , 109*5c2921b0SApple OSS Distributionsand User Datagram Protocol 110*5c2921b0SApple OSS Distributions.Pq Tn UDP . 111*5c2921b0SApple OSS Distributions.Tn TCP 112*5c2921b0SApple OSS Distributionsis used to support the 113*5c2921b0SApple OSS Distributions.Dv SOCK_STREAM 114*5c2921b0SApple OSS Distributionsabstraction while 115*5c2921b0SApple OSS Distributions.Tn UDP 116*5c2921b0SApple OSS Distributionsis used to support the 117*5c2921b0SApple OSS Distributions.Dv SOCK_DGRAM 118*5c2921b0SApple OSS Distributionsabstraction. A raw interface to 119*5c2921b0SApple OSS Distributions.Tn IP 120*5c2921b0SApple OSS Distributionsis available 121*5c2921b0SApple OSS Distributionsby creating an Internet socket of type 122*5c2921b0SApple OSS Distributions.Dv SOCK_RAW . 123*5c2921b0SApple OSS DistributionsThe 124*5c2921b0SApple OSS Distributions.Tn ICMP 125*5c2921b0SApple OSS Distributionsmessage protocol is accessible from a raw socket. 126*5c2921b0SApple OSS Distributions.Pp 127*5c2921b0SApple OSS DistributionsThe 32-bit Internet address contains both network and host parts. 128*5c2921b0SApple OSS DistributionsIt is frequency-encoded; the most-significant bit is clear 129*5c2921b0SApple OSS Distributionsin Class A addresses, in which the high-order 8 bits are the network 130*5c2921b0SApple OSS Distributionsnumber. 131*5c2921b0SApple OSS DistributionsClass B addresses use the high-order 16 bits as the network field, 132*5c2921b0SApple OSS Distributionsand Class C addresses have a 24-bit network part. 133*5c2921b0SApple OSS DistributionsSites with a cluster of local networks and a connection to the 134*5c2921b0SApple OSS DistributionsInternet may chose to use a single network number for the cluster; 135*5c2921b0SApple OSS Distributionsthis is done by using subnet addressing. 136*5c2921b0SApple OSS DistributionsThe local (host) portion of the address is further subdivided 137*5c2921b0SApple OSS Distributionsinto subnet and host parts. 138*5c2921b0SApple OSS DistributionsWithin a subnet, each subnet appears to be an individual network; 139*5c2921b0SApple OSS Distributionsexternally, the entire cluster appears to be a single, uniform 140*5c2921b0SApple OSS Distributionsnetwork requiring only a single routing entry. 141*5c2921b0SApple OSS DistributionsSubnet addressing is enabled and examined by the following 142*5c2921b0SApple OSS Distributions.Xr ioctl 2 143*5c2921b0SApple OSS Distributionscommands on a datagram socket in the Internet domain; 144*5c2921b0SApple OSS Distributionsthey have the same form as the 145*5c2921b0SApple OSS Distributions.Dv SIOCIFADDR 146*5c2921b0SApple OSS Distributionscommand (see 147*5c2921b0SApple OSS Distributions.Xr intro 4 ) . 148*5c2921b0SApple OSS Distributions.Pp 149*5c2921b0SApple OSS Distributions.Bl -tag -width SIOCSIFNETMASK 150*5c2921b0SApple OSS Distributions.It Dv SIOCSIFNETMASK 151*5c2921b0SApple OSS DistributionsSet interface network mask. 152*5c2921b0SApple OSS DistributionsThe network mask defines the network part of the address; 153*5c2921b0SApple OSS Distributionsif it contains more of the address than the address type would indicate, 154*5c2921b0SApple OSS Distributionsthen subnets are in use. 155*5c2921b0SApple OSS Distributions.It Dv SIOCGIFNETMASK 156*5c2921b0SApple OSS DistributionsGet interface network mask. 157*5c2921b0SApple OSS Distributions.El 158*5c2921b0SApple OSS Distributions.Sh SEE ALSO 159*5c2921b0SApple OSS Distributions.Xr ioctl 2 , 160*5c2921b0SApple OSS Distributions.Xr socket 2 , 161*5c2921b0SApple OSS Distributions.Xr icmp 4 , 162*5c2921b0SApple OSS Distributions.Xr intro 4 , 163*5c2921b0SApple OSS Distributions.Xr ip 4 , 164*5c2921b0SApple OSS Distributions.Xr tcp 4 , 165*5c2921b0SApple OSS Distributions.Xr udp 4 166*5c2921b0SApple OSS Distributions.Rs 167*5c2921b0SApple OSS Distributions.%T "An Introductory 4.3 BSD Interprocess Communication Tutorial" 168*5c2921b0SApple OSS Distributions.%B PS1 169*5c2921b0SApple OSS Distributions.%N 7 170*5c2921b0SApple OSS Distributions.Re 171*5c2921b0SApple OSS Distributions.Rs 172*5c2921b0SApple OSS Distributions.%T "An Advanced 4.3 BSD Interprocess Communication Tutorial" 173*5c2921b0SApple OSS Distributions.%B PS1 174*5c2921b0SApple OSS Distributions.%N 8 175*5c2921b0SApple OSS Distributions.Re 176*5c2921b0SApple OSS Distributions.Sh CAVEAT 177*5c2921b0SApple OSS DistributionsThe Internet protocol support is subject to change as 178*5c2921b0SApple OSS Distributionsthe Internet protocols develop. Users should not depend 179*5c2921b0SApple OSS Distributionson details of the current implementation, but rather 180*5c2921b0SApple OSS Distributionsthe services exported. 181*5c2921b0SApple OSS Distributions.Sh HISTORY 182*5c2921b0SApple OSS DistributionsThe 183*5c2921b0SApple OSS Distributions.Nm 184*5c2921b0SApple OSS Distributionsprotocol interface appeared in 185*5c2921b0SApple OSS Distributions.Bx 4.2 . 186