|
|
1.1 root 1: /*
2: * Copyright (c) 1982, 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 the above copyright notice and this paragraph are
7: * duplicated in all such forms and that any documentation,
8: * advertising materials, and other materials related to such
9: * distribution and use acknowledge that the software was developed
10: * by the University of California, Berkeley. The name of the
11: * University may not be used to endorse or promote products derived
12: * from this software without specific prior written permission.
13: * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
14: * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
15: * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
16: *
17: * @(#)unpcb.h 7.3 (Berkeley) 6/27/88
18: */
19:
20: /*
21: * Protocol control block for an active
22: * instance of a UNIX internal protocol.
23: *
24: * A socket may be associated with an inode in the
25: * file system. If so, the unp_inode pointer holds
26: * a reference count to this inode, which should be irele'd
27: * when the socket goes away.
28: *
29: * A socket may be connected to another socket, in which
30: * case the control block of the socket to which it is connected
31: * is given by unp_conn.
32: *
33: * A socket may be referenced by a number of sockets (e.g. several
34: * sockets may be connected to a datagram socket.) These sockets
35: * are in a linked list starting with unp_refs, linked through
36: * unp_nextref and null-terminated. Note that a socket may be referenced
37: * by a number of other sockets and may also reference a socket (not
38: * necessarily one which is referencing it). This generates
39: * the need for unp_refs and unp_nextref to be separate fields.
40: *
41: * Stream sockets keep copies of receive sockbuf sb_cc and sb_mbcnt
42: * so that changes in the sockbuf may be computed to modify
43: * back pressure on the sender accordingly.
44: */
45: struct unpcb {
46: struct socket *unp_socket; /* pointer back to socket */
47: struct inode *unp_inode; /* if associated with file */
48: ino_t unp_ino; /* fake inode number */
49: struct unpcb *unp_conn; /* control block of connected socket */
50: struct unpcb *unp_refs; /* referencing socket linked list */
51: struct unpcb *unp_nextref; /* link in unp_refs list */
52: struct mbuf *unp_addr; /* bound address of socket */
53: int unp_cc; /* copy of rcv.sb_cc */
54: int unp_mbcnt; /* copy of rcv.sb_mbcnt */
55: };
56:
57: #define sotounpcb(so) ((struct unpcb *)((so)->so_pcb))
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.