1*12508Ssam /* socket.h 4.26 83/05/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 */ 144930Swnj #define SOCK_STREAM 1 /* stream socket */ 154930Swnj #define SOCK_DGRAM 2 /* datagram socket */ 164930Swnj #define SOCK_RAW 3 /* raw-protocol interface */ 174930Swnj #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 */ 235394Swnj #define SO_ACCEPTCONN 0x02 /* willing to accept connections */ 2410597Ssam #define SO_REUSEADDR 0x04 /* allow local address reuse (gag) */ 256215Swnj #define SO_KEEPALIVE 0x08 /* keep connections alive */ 267132Swnj #define SO_DONTROUTE 0x10 /* just use interface addresses */ 277497Sroot #define SO_NEWFDONCONN 0x20 /* give new fd on connection */ 2810209Ssam #define SO_USELOOPBACK 0x40 /* bypass hardware when possible */ 2910597Ssam #define SO_LINGER 0x80 /* linger on close if data present */ 3010597Ssam #define SO_DONTLINGER (~SO_LINGER) /* ~SO_LINGER */ 314930Swnj 324930Swnj /* 334930Swnj * Generic socket protocol format. 344930Swnj * 354930Swnj * Each process is normally operating in a protocol family, 364930Swnj * whose protocols are used unless the process specifies otherwise. 374930Swnj * Most families supply protocols to the basic socket types. When 384930Swnj * protocols are not present in the family, the higher level (roughly 394930Swnj * ISO session layer) code in the system layers on the protocols 404930Swnj * to support the socket types. 414930Swnj */ 424930Swnj struct sockproto { 43*12508Ssam u_short sp_family; /* protocol family */ 44*12508Ssam u_short sp_protocol; /* protocol within family */ 454930Swnj }; 464930Swnj 474930Swnj #define PF_UNSPEC 0 /* unspecified */ 485119Swnj #define PF_UNIX 1 /* UNIX internal protocol */ 494930Swnj #define PF_INET 2 /* internetwork: UDP, TCP, etc. */ 505119Swnj #define PF_IMPLINK 3 /* imp link protocols */ 515119Swnj #define PF_PUP 4 /* pup protocols: e.g. BSP */ 525119Swnj #define PF_CHAOS 5 /* mit CHAOS protocols */ 535119Swnj #define PF_OISCP 6 /* ois communication protocols */ 545119Swnj #define PF_NBS 7 /* nbs protocols */ 555119Swnj #define PF_ECMA 8 /* european computer manufacturers */ 565119Swnj #define PF_DATAKIT 9 /* datakit protocols */ 575119Swnj #define PF_CCITT 10 /* CCITT protocols, X.25 etc */ 584930Swnj 594930Swnj /* 604930Swnj * Generic socket address format. 614930Swnj * 624930Swnj * Each process is also operating in an address family, whose 634930Swnj * addresses are assigned unless otherwise requested. The address 644930Swnj * family used affects address properties: whether addresses are 654930Swnj * externalized or internalized, location dependent or independent, etc. 664930Swnj * The address can be defined directly if it fits in 14 bytes, or 674930Swnj * a pointer and length can be given to variable length data. 684930Swnj * We give these as two different structures to allow initialization. 694930Swnj */ 704930Swnj struct sockaddr { 71*12508Ssam u_short sa_family; /* address family */ 724930Swnj char sa_data[14]; /* up to 14 bytes of direct address */ 734930Swnj }; 744930Swnj 754930Swnj /* 764930Swnj * The first few address families correspond to protocol 774930Swnj * families. Address families unrelated to protocol families 784930Swnj * are also possible. 794930Swnj */ 804930Swnj #define AF_UNSPEC 0 /* unspecified */ 815167Swnj #define AF_UNIX 1 /* local to host (pipes, portals) */ 824930Swnj #define AF_INET 2 /* internetwork: UDP, TCP, etc. */ 835119Swnj #define AF_IMPLINK 3 /* arpanet imp addresses */ 845119Swnj #define AF_PUP 4 /* pup protocols: e.g. BSP */ 855119Swnj #define AF_CHAOS 5 /* mit CHAOS protocols */ 865119Swnj #define AF_OISCP 6 /* ois communication protocols */ 875119Swnj #define AF_NBS 7 /* nbs protocols */ 885119Swnj #define AF_ECMA 8 /* european computer manufacturers */ 895119Swnj #define AF_DATAKIT 9 /* datakit protocols */ 905119Swnj #define AF_CCITT 10 /* CCITT protocols, X.25 etc */ 916620Ssam 926620Ssam #define AF_MAX 11 938274Sroot 9410209Ssam #define SOL_SOCKET 0xffff /* options for socket level */ 9510209Ssam 9610209Ssam #define SOF_OOB 0x1 /* send/recv out-of-band data */ 9710209Ssam #define SOF_PREVIEW 0x2 /* look at data, but don't read */ 9810209Ssam #define SOF_DONTROUTE 0x4 /* send without routing data */ 99