1*7643Sroot /* unpcb.h 5.2 82/08/02 */ 27622Sroot 37622Sroot /* 47622Sroot * Protocol control block for an active 57622Sroot * instance of a UNIX internal protocol. 67622Sroot * 77622Sroot * A socket may be associated with an inode in the 87622Sroot * file system. If so, the unp_inode pointer holds 97622Sroot * a reference count to this inode, which should be irele'd 107622Sroot * when the socket goes away. 117622Sroot * 127622Sroot * A socket may be connected to another socket, in which 137622Sroot * case the control block of the socket to which it is connected 147622Sroot * is given by unp_conn. 157622Sroot * 167622Sroot * A socket may be referenced by a number of sockets (e.g. several 177622Sroot * sockets may be connected to a datagram socket.) These sockets 187622Sroot * are in a linked list starting with unp_refs, linked through 197622Sroot * unp_nextref and null-terminated. Note that a socket may be referenced 207622Sroot * by a number of other sockets and may also reference a socket (not 217622Sroot * necessarily one which is referencing it). This generates 227622Sroot * the need for unp_refs and unp_nextref to be separate fields. 237622Sroot */ 247622Sroot struct unpcb { 257622Sroot struct socket *unp_socket; /* pointer back to socket */ 267622Sroot struct inode *unp_inode; /* if associated with file */ 277622Sroot struct unpcb *unp_conn; /* control block of connected socket */ 287622Sroot struct unpcb *unp_refs; /* referencing socket linked list */ 297622Sroot struct unpcb *unp_nextref; /* link in unp_refs list */ 307622Sroot }; 31*7643Sroot 32*7643Sroot #define sotounpcb(so) ((struct unpcb *)((so)->so_pcb)) 33