1: /*
   2:  * Copyright (c) 1982, 1985, 1986 Regents of the University of California.
   3:  * All rights reserved.
   4:  *
   5:  * Redistribution and use in source and binary forms are permitted
   6:  * provided that this notice is preserved and that due credit is given
   7:  * to the University of California at Berkeley. The name of the University
   8:  * may not be used to endorse or promote products derived from this
   9:  * software without specific prior written permission. This software
  10:  * is provided ``as is'' without express or implied warranty.
  11:  *
  12:  *	@(#)socket.h	7.2.2 (2.11BSD GTE) 1995/10/11
  13:  */
  14: 
  15: #ifndef _SYS_SOCKET_H_
  16: #define _SYS_SOCKET_H_
  17: 
  18: /*
  19:  * Definitions related to sockets: types, address families, options.
  20:  */
  21: 
  22: /*
  23:  * Types
  24:  */
  25: #define SOCK_STREAM 1       /* stream socket */
  26: #define SOCK_DGRAM  2       /* datagram socket */
  27: #define SOCK_RAW    3       /* raw-protocol interface */
  28: #define SOCK_RDM    4       /* reliably-delivered message */
  29: #define SOCK_SEQPACKET  5       /* sequenced packet stream */
  30: 
  31: /*
  32:  * Option flags per-socket.
  33:  */
  34: #define SO_DEBUG    0x0001      /* turn on debugging info recording */
  35: #define SO_ACCEPTCONN   0x0002      /* socket has had listen() */
  36: #define SO_REUSEADDR    0x0004      /* allow local address reuse */
  37: #define SO_KEEPALIVE    0x0008      /* keep connections alive */
  38: #define SO_DONTROUTE    0x0010      /* just use interface addresses */
  39: #define SO_BROADCAST    0x0020      /* permit sending of broadcast msgs */
  40: #define SO_USELOOPBACK  0x0040      /* bypass hardware when possible */
  41: #define SO_LINGER   0x0080      /* linger on close if data present */
  42: #define SO_OOBINLINE    0x0100      /* leave received OOB data in line */
  43: 
  44: /*
  45:  * Additional options, not kept in so_options.
  46:  */
  47: #define SO_SNDBUF   0x1001      /* send buffer size */
  48: #define SO_RCVBUF   0x1002      /* receive buffer size */
  49: #define SO_SNDLOWAT 0x1003      /* send low-water mark */
  50: #define SO_RCVLOWAT 0x1004      /* receive low-water mark */
  51: #define SO_SNDTIMEO 0x1005      /* send timeout */
  52: #define SO_RCVTIMEO 0x1006      /* receive timeout */
  53: #define SO_ERROR    0x1007      /* get error status and clear */
  54: #define SO_TYPE     0x1008      /* get socket type */
  55: 
  56: /*
  57:  * Structure used for manipulating linger option.
  58:  */
  59: struct  linger {
  60:     int l_onoff;        /* option on/off */
  61:     int l_linger;       /* linger time */
  62: };
  63: 
  64: /*
  65:  * Level number for (get/set)sockopt() to apply to socket itself.
  66:  */
  67: #define SOL_SOCKET  0xffff      /* options for socket level */
  68: 
  69: /*
  70:  * Address families.
  71:  */
  72: #define AF_UNSPEC   0       /* unspecified */
  73: #define AF_UNIX     1       /* local to host (pipes, portals) */
  74: #define AF_INET     2       /* internetwork: UDP, TCP, etc. */
  75: #define AF_IMPLINK  3       /* arpanet imp addresses */
  76: #define AF_PUP      4       /* pup protocols: e.g. BSP */
  77: #define AF_CHAOS    5       /* mit CHAOS protocols */
  78: #define AF_NS       6       /* XEROX NS protocols */
  79: #define AF_NBS      7       /* nbs protocols */
  80: #define AF_ECMA     8       /* european computer manufacturers */
  81: #define AF_DATAKIT  9       /* datakit protocols */
  82: #define AF_CCITT    10      /* CCITT protocols, X.25 etc */
  83: #define AF_SNA      11      /* IBM SNA */
  84: #define AF_DECnet   12      /* DECnet */
  85: #define AF_DLI      13      /* Direct data link interface */
  86: #define AF_LAT      14      /* LAT */
  87: #define AF_HYLINK   15      /* NSC Hyperchannel */
  88: #define AF_APPLETALK    16      /* Apple Talk */
  89: 
  90: #define AF_MAX      17
  91: 
  92: /*
  93:  * Structure used by kernel to store most
  94:  * addresses.
  95:  */
  96: struct sockaddr {
  97:     u_short sa_family;      /* address family */
  98:     char    sa_data[14];        /* up to 14 bytes of direct address */
  99: };
 100: 
 101: /*
 102:  * Structure used by kernel to pass protocol
 103:  * information in raw sockets.
 104:  */
 105: struct sockproto {
 106:     u_short sp_family;      /* address family */
 107:     u_short sp_protocol;        /* protocol */
 108: };
 109: 
 110: /*
 111:  * Protocol families, same as address families for now.
 112:  */
 113: #define PF_UNSPEC   AF_UNSPEC
 114: #define PF_UNIX     AF_UNIX
 115: #define PF_INET     AF_INET
 116: #define PF_IMPLINK  AF_IMPLINK
 117: #define PF_PUP      AF_PUP
 118: #define PF_CHAOS    AF_CHAOS
 119: #define PF_NS       AF_NS
 120: #define PF_NBS      AF_NBS
 121: #define PF_ECMA     AF_ECMA
 122: #define PF_DATAKIT  AF_DATAKIT
 123: #define PF_CCITT    AF_CCITT
 124: #define PF_SNA      AF_SNA
 125: #define PF_DECnet   AF_DECnet
 126: #define PF_DLI      AF_DLI
 127: #define PF_LAT      AF_LAT
 128: #define PF_HYLINK   AF_HYLINK
 129: #define PF_APPLETALK    AF_APPLETALK
 130: 
 131: #define PF_MAX      AF_MAX
 132: 
 133: /*
 134:  * Definitions for network related sysctl, CTL_NET.
 135:  *
 136:  * Second level is protocol family.
 137:  * Third level is protocol number.
 138:  *
 139:  * Further levels are defined by the individual families below.
 140:  */
 141: #define NET_MAXID   AF_MAX
 142: 
 143: #ifndef KERNEL
 144: #define CTL_NET_NAMES { \
 145:     { 0, 0 }, \
 146:     { "unix", CTLTYPE_NODE }, \
 147:     { "inet", CTLTYPE_NODE }, \
 148:     { "implink", CTLTYPE_NODE }, \
 149:     { "pup", CTLTYPE_NODE }, \
 150:     { "chaos", CTLTYPE_NODE }, \
 151:     { "xerox_ns", CTLTYPE_NODE }, \
 152:     { "iso", CTLTYPE_NODE }, \
 153:     { "emca", CTLTYPE_NODE }, \
 154:     { "datakit", CTLTYPE_NODE }, \
 155:     { "ccitt", CTLTYPE_NODE }, \
 156:     { "ibm_sna", CTLTYPE_NODE }, \
 157:     { "decnet", CTLTYPE_NODE }, \
 158:     { "dec_dli", CTLTYPE_NODE }, \
 159:     { "lat", CTLTYPE_NODE }, \
 160:     { "hylink", CTLTYPE_NODE }, \
 161:     { "appletalk", CTLTYPE_NODE }, \
 162: }
 163: #endif
 164: 
 165: /*
 166:  * Maximum queue length specifiable by listen.
 167:  */
 168: #define SOMAXCONN   5
 169: 
 170: /*
 171:  * Message header for recvmsg and sendmsg calls.
 172:  */
 173: struct msghdr {
 174:     caddr_t msg_name;       /* optional address */
 175:     int msg_namelen;        /* size of address */
 176:     struct  iovec *msg_iov;     /* scatter/gather array */
 177:     int msg_iovlen;     /* # elements in msg_iov */
 178:     caddr_t msg_accrights;      /* access rights sent/received */
 179:     int msg_accrightslen;
 180: };
 181: 
 182: #define MSG_OOB     0x1     /* process out-of-band data */
 183: #define MSG_PEEK    0x2     /* peek at incoming message */
 184: #define MSG_DONTROUTE   0x4     /* send without using routing tables */
 185: 
 186: #define MSG_MAXIOVLEN   16
 187: #endif	/* _SYS_SOCKET_H_ */

Defined struct's

msghdr defined in line 173; used 18 times
sockaddr defined in line 96; used 508 times

Defined macros

AF_APPLETALK defined in line 88; used 2 times
AF_CCITT defined in line 82; used 2 times
AF_CHAOS defined in line 77; used 2 times
AF_DATAKIT defined in line 81; used 2 times
AF_DECnet defined in line 84; used 4 times
AF_DLI defined in line 85; used 2 times
AF_ECMA defined in line 80; used 2 times
AF_HYLINK defined in line 87; used 3 times
AF_INET defined in line 74; used 281 times
AF_LAT defined in line 86; used 2 times
AF_MAX defined in line 90; used 8 times
AF_NBS defined in line 79; used 2 times
AF_PUP defined in line 76; used 4 times
AF_SNA defined in line 83; used 2 times
CTL_NET_NAMES defined in line 144; used 3 times
MSG_MAXIOVLEN defined in line 186; used 2 times
NET_MAXID defined in line 141; used 1 times
PF_APPLETALK defined in line 129; used 1 times
PF_CCITT defined in line 123; used 1 times
PF_CHAOS defined in line 118; used 1 times
PF_DATAKIT defined in line 122; used 1 times
PF_DECnet defined in line 125; used 1 times
PF_DLI defined in line 126; used 1 times
PF_ECMA defined in line 121; used 1 times
PF_HYLINK defined in line 128; used 1 times
PF_IMPLINK defined in line 116; used 2 times
PF_LAT defined in line 127; used 1 times
PF_MAX defined in line 131; never used
PF_NBS defined in line 120; used 1 times
PF_NS defined in line 119; used 1 times
PF_PUP defined in line 117; used 2 times
PF_SNA defined in line 124; used 1 times
PF_UNIX defined in line 114; used 1 times
PF_UNSPEC defined in line 113; used 2 times
SOCK_RDM defined in line 28; used 1 times
SOCK_STREAM defined in line 25; used 80 times
SOL_SOCKET defined in line 67; used 73 times
SOMAXCONN defined in line 168; used 2 times
SO_ERROR defined in line 53; used 1 times
SO_RCVLOWAT defined in line 50; never used
SO_RCVTIMEO defined in line 52; never used
SO_SNDLOWAT defined in line 49; never used
SO_SNDTIMEO defined in line 51; never used
SO_TYPE defined in line 54; never used
SO_USELOOPBACK defined in line 40; used 2 times
_SYS_SOCKET_H_ defined in line 16; used 1 times
  • in line 15

Usage of this include

socket.h used 192 times
Last modified: 1995-10-12
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 5438
Valid CSS Valid XHTML 1.0 Strict