1 /* socket.h 4.14 82/03/15 */ 2 3 /* 4 * Externally visible attributes of sockets. 5 */ 6 7 /* 8 * Socket types. 9 * 10 * The kernel implement these abstract (session-layer) socket 11 * services, with extra protocol on top of network services 12 * if necessary. 13 */ 14 #define SOCK_STREAM 1 /* stream socket */ 15 #define SOCK_DGRAM 2 /* datagram socket */ 16 #define SOCK_RAW 3 /* raw-protocol interface */ 17 #define SOCK_RDM 4 /* reliably-delivered message */ 18 19 /* 20 * Option flags per-socket. 21 */ 22 #define SO_DEBUG 0x01 /* turn on debugging info recording */ 23 #define SO_ACCEPTCONN 0x02 /* willing to accept connections */ 24 #define SO_DONTLINGER 0x04 /* don't linger on close */ 25 #define SO_KEEPALIVE 0x08 /* keep connections alive */ 26 27 /* 28 * Generic socket protocol format. 29 * 30 * Each process is normally operating in a protocol family, 31 * whose protocols are used unless the process specifies otherwise. 32 * Most families supply protocols to the basic socket types. When 33 * protocols are not present in the family, the higher level (roughly 34 * ISO session layer) code in the system layers on the protocols 35 * to support the socket types. 36 */ 37 struct sockproto { 38 short sp_family; /* protocol family */ 39 short sp_protocol; /* protocol within family */ 40 }; 41 42 #define PF_UNSPEC 0 /* unspecified */ 43 #define PF_UNIX 1 /* UNIX internal protocol */ 44 #define PF_INET 2 /* internetwork: UDP, TCP, etc. */ 45 #define PF_IMPLINK 3 /* imp link protocols */ 46 #define PF_PUP 4 /* pup protocols: e.g. BSP */ 47 #define PF_CHAOS 5 /* mit CHAOS protocols */ 48 #define PF_OISCP 6 /* ois communication protocols */ 49 #define PF_NBS 7 /* nbs protocols */ 50 #define PF_ECMA 8 /* european computer manufacturers */ 51 #define PF_DATAKIT 9 /* datakit protocols */ 52 #define PF_CCITT 10 /* CCITT protocols, X.25 etc */ 53 54 /* 55 * Generic socket address format. 56 * 57 * Each process is also operating in an address family, whose 58 * addresses are assigned unless otherwise requested. The address 59 * family used affects address properties: whether addresses are 60 * externalized or internalized, location dependent or independent, etc. 61 * The address can be defined directly if it fits in 14 bytes, or 62 * a pointer and length can be given to variable length data. 63 * We give these as two different structures to allow initialization. 64 */ 65 struct sockaddr { 66 short sa_family; /* address family */ 67 char sa_data[14]; /* up to 14 bytes of direct address */ 68 }; 69 70 /* 71 * The first few address families correspond to protocol 72 * families. Address families unrelated to protocol families 73 * are also possible. 74 */ 75 #define AF_UNSPEC 0 /* unspecified */ 76 #define AF_UNIX 1 /* local to host (pipes, portals) */ 77 #define AF_INET 2 /* internetwork: UDP, TCP, etc. */ 78 #define AF_IMPLINK 3 /* arpanet imp addresses */ 79 #define AF_PUP 4 /* pup protocols: e.g. BSP */ 80 #define AF_CHAOS 5 /* mit CHAOS protocols */ 81 #define AF_OISCP 6 /* ois communication protocols */ 82 #define AF_NBS 7 /* nbs protocols */ 83 #define AF_ECMA 8 /* european computer manufacturers */ 84 #define AF_DATAKIT 9 /* datakit protocols */ 85 #define AF_CCITT 10 /* CCITT protocols, X.25 etc */ 86