1*4930Swnj /* socket.h 4.6 81/11/18 */ 24658Swnj 34658Swnj /* 44892Swnj * Externally visible attributes of sockets. 54658Swnj */ 64892Swnj 74892Swnj /* 84892Swnj * Socket types. 94892Swnj * 104892Swnj * The kernel implement these abstract (session-layer) socket 114892Swnj * services, with extra protocol on top of network services 124892Swnj * if necessary. 134892Swnj */ 14*4930Swnj #define SOCK_STREAM 1 /* stream socket */ 15*4930Swnj #define SOCK_DGRAM 2 /* datagram socket */ 16*4930Swnj #define SOCK_RAW 3 /* raw-protocol interface */ 17*4930Swnj #define SOCK_RDM 4 /* reliably-delivered message */ 184658Swnj 194812Swnj /* 204812Swnj * Option flags per-socket. 214812Swnj */ 224812Swnj #define SO_DEBUG 0x01 /* turn on debugging info recording */ 234892Swnj #define SO_ACCEPTCONN 0x02 /* willing to accept connection */ 244812Swnj #define SO_NBIO 0x04 /* don't block on this socket */ 254892Swnj #define SO_INTNOTIFY 0x08 /* interrupt when data available */ 26*4930Swnj 27*4930Swnj /* 28*4930Swnj * Generic socket protocol format. 29*4930Swnj * 30*4930Swnj * Each process is normally operating in a protocol family, 31*4930Swnj * whose protocols are used unless the process specifies otherwise. 32*4930Swnj * Most families supply protocols to the basic socket types. When 33*4930Swnj * protocols are not present in the family, the higher level (roughly 34*4930Swnj * ISO session layer) code in the system layers on the protocols 35*4930Swnj * to support the socket types. 36*4930Swnj */ 37*4930Swnj struct sockproto { 38*4930Swnj short sp_family; /* protocol family */ 39*4930Swnj short sp_protocol; /* protocol within family */ 40*4930Swnj }; 41*4930Swnj 42*4930Swnj #define PF_UNSPEC 0 /* unspecified */ 43*4930Swnj #define PF_LOCAL 1 /* local to host (pipes, portals) */ 44*4930Swnj #define PF_INET 2 /* internetwork: UDP, TCP, etc. */ 45*4930Swnj #define PF_PUP 3 /* pup protocols: e.g. BSP */ 46*4930Swnj #define PF_CHAOS 4 /* mit CHAOS protocols */ 47*4930Swnj #define PF_OISCP 5 /* ois communication protocols */ 48*4930Swnj #define PF_NBS 6 /* nbs protocols */ 49*4930Swnj #define PF_ECMA 7 /* european computer manufacturers */ 50*4930Swnj #define PF_DATAKIT 8 /* datakit protocols */ 51*4930Swnj #define PF_CCITT 9 /* CCITT protocols, X.25 etc */ 52*4930Swnj 53*4930Swnj /* 54*4930Swnj * Generic socket address format. 55*4930Swnj * 56*4930Swnj * Each process is also operating in an address family, whose 57*4930Swnj * addresses are assigned unless otherwise requested. The address 58*4930Swnj * family used affects address properties: whether addresses are 59*4930Swnj * externalized or internalized, location dependent or independent, etc. 60*4930Swnj * The address can be defined directly if it fits in 14 bytes, or 61*4930Swnj * a pointer and length can be given to variable length data. 62*4930Swnj * We give these as two different structures to allow initialization. 63*4930Swnj */ 64*4930Swnj struct sockaddr { 65*4930Swnj short sa_family; /* address family */ 66*4930Swnj char sa_data[14]; /* up to 14 bytes of direct address */ 67*4930Swnj }; 68*4930Swnj struct sockaddri { 69*4930Swnj short sai_family; 70*4930Swnj short sai_length; 71*4930Swnj caddr_t sai_addr; 72*4930Swnj char sai_ddata[8]; 73*4930Swnj }; 74*4930Swnj 75*4930Swnj /* 76*4930Swnj * The first few address families correspond to protocol 77*4930Swnj * families. Address families unrelated to protocol families 78*4930Swnj * are also possible. 79*4930Swnj */ 80*4930Swnj #define AF_UNSPEC 0 /* unspecified */ 81*4930Swnj #define AF_LOCAL 1 /* local to host (pipes, portals) */ 82*4930Swnj #define AF_INET 2 /* internetwork: UDP, TCP, etc. */ 83*4930Swnj #define AF_PUP 3 /* pup protocols: e.g. BSP */ 84*4930Swnj #define AF_CHAOS 4 /* mit CHAOS protocols */ 85*4930Swnj #define AF_OISCP 5 /* ois communication protocols */ 86*4930Swnj #define AF_NBS 6 /* nbs protocols */ 87*4930Swnj #define AF_ECMA 7 /* european computer manufacturers */ 88*4930Swnj #define AF_DATAKIT 8 /* datakit protocols */ 89*4930Swnj #define AF_CCITT 9 /* CCITT protocols, X.25 etc */ 90