1*6215Swnj /* socket.h 4.14 82/03/15 */ 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 */ 24*6215Swnj #define SO_DONTLINGER 0x04 /* don't linger on close */ 25*6215Swnj #define SO_KEEPALIVE 0x08 /* keep connections alive */ 264930Swnj 274930Swnj /* 284930Swnj * Generic socket protocol format. 294930Swnj * 304930Swnj * Each process is normally operating in a protocol family, 314930Swnj * whose protocols are used unless the process specifies otherwise. 324930Swnj * Most families supply protocols to the basic socket types. When 334930Swnj * protocols are not present in the family, the higher level (roughly 344930Swnj * ISO session layer) code in the system layers on the protocols 354930Swnj * to support the socket types. 364930Swnj */ 374930Swnj struct sockproto { 384930Swnj short sp_family; /* protocol family */ 395617Swnj short sp_protocol; /* protocol within family */ 404930Swnj }; 414930Swnj 424930Swnj #define PF_UNSPEC 0 /* unspecified */ 435119Swnj #define PF_UNIX 1 /* UNIX internal protocol */ 444930Swnj #define PF_INET 2 /* internetwork: UDP, TCP, etc. */ 455119Swnj #define PF_IMPLINK 3 /* imp link protocols */ 465119Swnj #define PF_PUP 4 /* pup protocols: e.g. BSP */ 475119Swnj #define PF_CHAOS 5 /* mit CHAOS protocols */ 485119Swnj #define PF_OISCP 6 /* ois communication protocols */ 495119Swnj #define PF_NBS 7 /* nbs protocols */ 505119Swnj #define PF_ECMA 8 /* european computer manufacturers */ 515119Swnj #define PF_DATAKIT 9 /* datakit protocols */ 525119Swnj #define PF_CCITT 10 /* CCITT protocols, X.25 etc */ 534930Swnj 544930Swnj /* 554930Swnj * Generic socket address format. 564930Swnj * 574930Swnj * Each process is also operating in an address family, whose 584930Swnj * addresses are assigned unless otherwise requested. The address 594930Swnj * family used affects address properties: whether addresses are 604930Swnj * externalized or internalized, location dependent or independent, etc. 614930Swnj * The address can be defined directly if it fits in 14 bytes, or 624930Swnj * a pointer and length can be given to variable length data. 634930Swnj * We give these as two different structures to allow initialization. 644930Swnj */ 654930Swnj struct sockaddr { 664930Swnj short sa_family; /* address family */ 674930Swnj char sa_data[14]; /* up to 14 bytes of direct address */ 684930Swnj }; 694930Swnj 704930Swnj /* 714930Swnj * The first few address families correspond to protocol 724930Swnj * families. Address families unrelated to protocol families 734930Swnj * are also possible. 744930Swnj */ 754930Swnj #define AF_UNSPEC 0 /* unspecified */ 765167Swnj #define AF_UNIX 1 /* local to host (pipes, portals) */ 774930Swnj #define AF_INET 2 /* internetwork: UDP, TCP, etc. */ 785119Swnj #define AF_IMPLINK 3 /* arpanet imp addresses */ 795119Swnj #define AF_PUP 4 /* pup protocols: e.g. BSP */ 805119Swnj #define AF_CHAOS 5 /* mit CHAOS protocols */ 815119Swnj #define AF_OISCP 6 /* ois communication protocols */ 825119Swnj #define AF_NBS 7 /* nbs protocols */ 835119Swnj #define AF_ECMA 8 /* european computer manufacturers */ 845119Swnj #define AF_DATAKIT 9 /* datakit protocols */ 855119Swnj #define AF_CCITT 10 /* CCITT protocols, X.25 etc */ 86