1: /*
2: * Copyright (c) 1982,1985, 1986 Regents of the University of California.
3: * All rights reserved. The Berkeley software License Agreement
4: * specifies the terms and conditions for redistribution.
5: *
6: * @(#)socket.h 7.1 (Berkeley) 6/4/86
7: */
8:
9: /*
10: * Definitions related to sockets: types, address families, options.
11: */
12:
13: /*
14: * Types
15: */
16: #define SOCK_STREAM 1 /* stream socket */
17: #define SOCK_DGRAM 2 /* datagram socket */
18: #define SOCK_RAW 3 /* raw-protocol interface */
19: #define SOCK_RDM 4 /* reliably-delivered message */
20: #define SOCK_SEQPACKET 5 /* sequenced packet stream */
21:
22: /*
23: * Option flags per-socket.
24: */
25: #define SO_DEBUG 0x0001 /* turn on debugging info recording */
26: #define SO_ACCEPTCONN 0x0002 /* socket has had listen() */
27: #define SO_REUSEADDR 0x0004 /* allow local address reuse */
28: #define SO_KEEPALIVE 0x0008 /* keep connections alive */
29: #define SO_DONTROUTE 0x0010 /* just use interface addresses */
30: #define SO_BROADCAST 0x0020 /* permit sending of broadcast msgs */
31: #define SO_USELOOPBACK 0x0040 /* bypass hardware when possible */
32: #define SO_LINGER 0x0080 /* linger on close if data present */
33: #define SO_OOBINLINE 0x0100 /* leave received OOB data in line */
34:
35: /*
36: * Additional options, not kept in so_options.
37: */
38: #define SO_SNDBUF 0x1001 /* send buffer size */
39: #define SO_RCVBUF 0x1002 /* receive buffer size */
40: #define SO_SNDLOWAT 0x1003 /* send low-water mark */
41: #define SO_RCVLOWAT 0x1004 /* receive low-water mark */
42: #define SO_SNDTIMEO 0x1005 /* send timeout */
43: #define SO_RCVTIMEO 0x1006 /* receive timeout */
44: #define SO_ERROR 0x1007 /* get error status and clear */
45: #define SO_TYPE 0x1008 /* get socket type */
46:
47: /*
48: * Structure used for manipulating linger option.
49: */
50: struct linger {
51: int l_onoff; /* option on/off */
52: int l_linger; /* linger time */
53: };
54:
55: /*
56: * Level number for (get/set)sockopt() to apply to socket itself.
57: */
58: #define SOL_SOCKET 0xffff /* options for socket level */
59:
60: /*
61: * Address families.
62: */
63: #define AF_UNSPEC 0 /* unspecified */
64: #define AF_UNIX 1 /* local to host (pipes, portals) */
65: #define AF_INET 2 /* internetwork: UDP, TCP, etc. */
66: #define AF_IMPLINK 3 /* arpanet imp addresses */
67: #define AF_PUP 4 /* pup protocols: e.g. BSP */
68: #define AF_CHAOS 5 /* mit CHAOS protocols */
69: #define AF_NS 6 /* XEROX NS protocols */
70: #define AF_NBS 7 /* nbs protocols */
71: #define AF_ECMA 8 /* european computer manufacturers */
72: #define AF_DATAKIT 9 /* datakit protocols */
73: #define AF_CCITT 10 /* CCITT protocols, X.25 etc */
74: #define AF_SNA 11 /* IBM SNA */
75: #define AF_DECnet 12 /* DECnet */
76: #define AF_DLI 13 /* Direct data link interface */
77: #define AF_LAT 14 /* LAT */
78: #define AF_HYLINK 15 /* NSC Hyperchannel */
79: #define AF_APPLETALK 16 /* Apple Talk */
80:
81: #define AF_MAX 17
82:
83: /*
84: * Structure used by kernel to store most
85: * addresses.
86: */
87: struct sockaddr {
88: u_short sa_family; /* address family */
89: char sa_data[14]; /* up to 14 bytes of direct address */
90: };
91:
92: /*
93: * Structure used by kernel to pass protocol
94: * information in raw sockets.
95: */
96: struct sockproto {
97: u_short sp_family; /* address family */
98: u_short sp_protocol; /* protocol */
99: };
100:
101: /*
102: * Protocol families, same as address families for now.
103: */
104: #define PF_UNSPEC AF_UNSPEC
105: #define PF_UNIX AF_UNIX
106: #define PF_INET AF_INET
107: #define PF_IMPLINK AF_IMPLINK
108: #define PF_PUP AF_PUP
109: #define PF_CHAOS AF_CHAOS
110: #define PF_NS AF_NS
111: #define PF_NBS AF_NBS
112: #define PF_ECMA AF_ECMA
113: #define PF_DATAKIT AF_DATAKIT
114: #define PF_CCITT AF_CCITT
115: #define PF_SNA AF_SNA
116: #define PF_DECnet AF_DECnet
117: #define PF_DLI AF_DLI
118: #define PF_LAT AF_LAT
119: #define PF_HYLINK AF_HYLINK
120: #define PF_APPLETALK AF_APPLETALK
121:
122: #define PF_MAX AF_MAX
123:
124: /*
125: * Maximum queue length specifiable by listen.
126: */
127: #define SOMAXCONN 5
128:
129: /*
130: * Message header for recvmsg and sendmsg calls.
131: */
132: struct msghdr {
133: caddr_t msg_name; /* optional address */
134: int msg_namelen; /* size of address */
135: struct iovec *msg_iov; /* scatter/gather array */
136: int msg_iovlen; /* # elements in msg_iov */
137: caddr_t msg_accrights; /* access rights sent/received */
138: int msg_accrightslen;
139: };
140:
141: #define MSG_OOB 0x1 /* process out-of-band data */
142: #define MSG_PEEK 0x2 /* peek at incoming message */
143: #define MSG_DONTROUTE 0x4 /* send without using routing tables */
144:
145: #define MSG_MAXIOVLEN 16
Defined struct's
linger
defined in line
50; used 10 times
sockaddr
defined in line
87; used 180 times
- in /usr/src/sys/net/af.c line
59(2),
68(2)
- in /usr/src/sys/net/if.c line
79(2),
104(2),
126(2)
- in /usr/src/sys/net/if_loop.c line
60(2)
- in /usr/src/sys/net/if_sl.c line
183(2)
- in /usr/src/sys/net/raw_cb.c line
102(4),
142(4)
- in /usr/src/sys/net/raw_usrreq.c line
40(2),
145(2),
294-301(8)
- in /usr/src/sys/net/route.c line
24(2),
36(2),
113(2),
326(2)
- in /usr/src/sys/netimp/if_imp.c line
445-454(8),
467(2)
- in /usr/src/sys/netimp/raw_imp.c line
90(2)
- in /usr/src/sys/netinet/if_ether.c line
93(2),
158(2),
269(2),
307(2)
- in /usr/src/sys/netinet/in.c line
263(2),
320-325(4),
352(2),
389(2)
- in /usr/src/sys/netinet/in_pcb.c line
67(2),
175(2)
- in /usr/src/sys/netinet/ip_icmp.c line
220(2),
289-301(16),
320-321(4)
- in /usr/src/sys/netinet/ip_input.c line
546(2),
641(2)
- in /usr/src/sys/netinet/ip_output.c line
155(2),
216(2)
- in /usr/src/sys/netinet/raw_ip.c line
45-46(4)
- in /usr/src/sys/netinet/tcp_subr.c line
235(2)
- in /usr/src/sys/netinet/udp_usrreq.c line
128(2),
151(2)
- in /usr/src/sys/netns/idp_usrreq.c line
68(2)
- in /usr/src/sys/netns/ns.c line
203(2),
213-217(4)
- in /usr/src/sys/netns/ns_ip.c line
216(2),
300(2),
350(2),
374(2)
- in /usr/src/sys/netns/ns_output.c line
114(2)
- in /usr/src/sys/netns/ns_pcb.c line
61(2)
- in /usr/src/sys/sys/uipc_domain.c line
99(2)
- in /usr/src/sys/sys/uipc_socket2.c line
442(2),
457(2)
- in /usr/src/sys/sys/uipc_usrreq.c line
31(2),
101(2),
150(2),
168(2)
- in /usr/src/sys/vaxif/if_de.c line
583(2)
- in /usr/src/sys/vaxif/if_dmc.c line
725(2)
- in /usr/src/sys/vaxif/if_ec.c line
547(2)
- in /usr/src/sys/vaxif/if_en.c line
483(4),
516(2)
- in /usr/src/sys/vaxif/if_ex.c line
670(2)
- in /usr/src/sys/vaxif/if_hy.c line
557(2),
1168-1169(4)
- in /usr/src/sys/vaxif/if_il.c line
533(2)
- in /usr/src/sys/vaxif/if_pcl.c line
200(2)
- in /usr/src/sys/vaxif/if_qe.c line
687(2)
- in /usr/src/sys/vaxif/if_vv.c line
807(2)
- in /usr/src/sys/vaxif/raw_hy.c line
66(2)
Defined macros
AF_INET
defined in line
65; used 38 times
- in line 106
- in /usr/src/sys/net/if_sl.c line
192,
522,
529
- in /usr/src/sys/netimp/if_imp.c line
658
- in /usr/src/sys/netinet/if_ether.c line
156,
304,
456
- in /usr/src/sys/netinet/in.c line
220,
257,
342,
371
- in /usr/src/sys/netinet/in_pcb.c line
118,
157,
236,
250
- in /usr/src/sys/netinet/in_proto.c line
90
- in /usr/src/sys/netinet/ip_icmp.c line
118-121(4)
- in /usr/src/sys/netinet/ip_input.c line
75,
681,
861
- in /usr/src/sys/netinet/ip_output.c line
82
- in /usr/src/sys/netinet/raw_ip.c line
29-30(2),
88
- in /usr/src/sys/netinet/tcp_input.c line
368,
1046
- in /usr/src/sys/netinet/tcp_subr.c line
243
- in /usr/src/sys/netinet/tcp_usrreq.c line
196
- in /usr/src/sys/netinet/udp_usrreq.c line
47,
159
- in /usr/src/sys/netns/ns_input.c line
247
- in /usr/src/sys/netns/ns_ip.c line
382
- in /usr/src/sys/vaxif/if_ddn.c line
606
- in /usr/src/sys/vaxif/if_hy.c line
1373
AF_NS
defined in line
69; used 16 times
Usage of this include