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