xref: /csrg-svn/sys/sys/unpcb.h (revision 7622)
1*7622Sroot /*	unpcb.h	5.1	82/08/01	*/
2*7622Sroot 
3*7622Sroot /*
4*7622Sroot  * Protocol control block for an active
5*7622Sroot  * instance of a UNIX internal protocol.
6*7622Sroot  *
7*7622Sroot  * A socket may be associated with an inode in the
8*7622Sroot  * file system.  If so, the unp_inode pointer holds
9*7622Sroot  * a reference count to this inode, which should be irele'd
10*7622Sroot  * when the socket goes away.
11*7622Sroot  *
12*7622Sroot  * A socket may be connected to another socket, in which
13*7622Sroot  * case the control block of the socket to which it is connected
14*7622Sroot  * is given by unp_conn.
15*7622Sroot  *
16*7622Sroot  * A socket may be referenced by a number of sockets (e.g. several
17*7622Sroot  * sockets may be connected to a datagram socket.)  These sockets
18*7622Sroot  * are in a linked list starting with unp_refs, linked through
19*7622Sroot  * unp_nextref and null-terminated.  Note that a socket may be referenced
20*7622Sroot  * by a number of other sockets and may also reference a socket (not
21*7622Sroot  * necessarily one which is referencing it).  This generates
22*7622Sroot  * the need for unp_refs and unp_nextref to be separate fields.
23*7622Sroot  */
24*7622Sroot struct	unpcb {
25*7622Sroot 	struct	socket *unp_socket;	/* pointer back to socket */
26*7622Sroot 	struct	inode *unp_inode;	/* if associated with file */
27*7622Sroot 	struct	unpcb *unp_conn;	/* control block of connected socket */
28*7622Sroot 	struct	unpcb *unp_refs;	/* referencing socket linked list */
29*7622Sroot 	struct 	unpcb *unp_nextref;	/* link in unp_refs list */
30*7622Sroot };
31