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