1*23453Smckusick /* 2*23453Smckusick * Copyright (c) 1982 Regents of the University of California. 3*23453Smckusick * All rights reserved. The Berkeley software License Agreement 4*23453Smckusick * specifies the terms and conditions for redistribution. 5*23453Smckusick * 6*23453Smckusick * @(#)unpcb.h 6.2 (Berkeley) 06/08/85 7*23453Smckusick */ 87622Sroot 97622Sroot /* 107622Sroot * Protocol control block for an active 117622Sroot * instance of a UNIX internal protocol. 127622Sroot * 137622Sroot * A socket may be associated with an inode in the 147622Sroot * file system. If so, the unp_inode pointer holds 157622Sroot * a reference count to this inode, which should be irele'd 167622Sroot * when the socket goes away. 177622Sroot * 187622Sroot * A socket may be connected to another socket, in which 197622Sroot * case the control block of the socket to which it is connected 207622Sroot * is given by unp_conn. 217622Sroot * 227622Sroot * A socket may be referenced by a number of sockets (e.g. several 237622Sroot * sockets may be connected to a datagram socket.) These sockets 247622Sroot * are in a linked list starting with unp_refs, linked through 257622Sroot * unp_nextref and null-terminated. Note that a socket may be referenced 267622Sroot * by a number of other sockets and may also reference a socket (not 277622Sroot * necessarily one which is referencing it). This generates 287622Sroot * the need for unp_refs and unp_nextref to be separate fields. 297622Sroot */ 307622Sroot struct unpcb { 317622Sroot struct socket *unp_socket; /* pointer back to socket */ 327622Sroot struct inode *unp_inode; /* if associated with file */ 337622Sroot struct unpcb *unp_conn; /* control block of connected socket */ 347622Sroot struct unpcb *unp_refs; /* referencing socket linked list */ 357622Sroot struct unpcb *unp_nextref; /* link in unp_refs list */ 369182Ssam struct mbuf *unp_remaddr; /* address of connected socket */ 377622Sroot }; 387643Sroot 397643Sroot #define sotounpcb(so) ((struct unpcb *)((so)->so_pcb)) 40