Annotation of sys/sys/unpcb.h, Revision 1.1
1.1 ! nbrk 1: /* $OpenBSD: unpcb.h,v 1.7 2006/11/17 08:33:20 claudio Exp $ */
! 2: /* $NetBSD: unpcb.h,v 1.6 1994/06/29 06:46:08 cgd Exp $ */
! 3:
! 4: /*
! 5: * Copyright (c) 1982, 1986, 1989, 1993
! 6: * The Regents of the University of California. All rights reserved.
! 7: *
! 8: * Redistribution and use in source and binary forms, with or without
! 9: * modification, are permitted provided that the following conditions
! 10: * are met:
! 11: * 1. Redistributions of source code must retain the above copyright
! 12: * notice, this list of conditions and the following disclaimer.
! 13: * 2. Redistributions in binary form must reproduce the above copyright
! 14: * notice, this list of conditions and the following disclaimer in the
! 15: * documentation and/or other materials provided with the distribution.
! 16: * 3. Neither the name of the University nor the names of its contributors
! 17: * may be used to endorse or promote products derived from this software
! 18: * without specific prior written permission.
! 19: *
! 20: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
! 21: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
! 22: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
! 23: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
! 24: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
! 25: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
! 26: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
! 27: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
! 28: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
! 29: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
! 30: * SUCH DAMAGE.
! 31: *
! 32: * @(#)unpcb.h 8.1 (Berkeley) 6/2/93
! 33: */
! 34:
! 35: /*
! 36: * Protocol control block for an active
! 37: * instance of a UNIX internal protocol.
! 38: *
! 39: * A socket may be associated with an vnode in the
! 40: * file system. If so, the unp_vnode pointer holds
! 41: * a reference count to this vnode, which should be irele'd
! 42: * when the socket goes away.
! 43: *
! 44: * A socket may be connected to another socket, in which
! 45: * case the control block of the socket to which it is connected
! 46: * is given by unp_conn.
! 47: *
! 48: * A socket may be referenced by a number of sockets (e.g. several
! 49: * sockets may be connected to a datagram socket.) These sockets
! 50: * are in a linked list starting with unp_refs, linked through
! 51: * unp_nextref and null-terminated. Note that a socket may be referenced
! 52: * by a number of other sockets and may also reference a socket (not
! 53: * necessarily one which is referencing it). This generates
! 54: * the need for unp_refs and unp_nextref to be separate fields.
! 55: *
! 56: * Stream sockets keep copies of receive sockbuf sb_cc and sb_mbcnt
! 57: * so that changes in the sockbuf may be computed to modify
! 58: * back pressure on the sender accordingly.
! 59: */
! 60: struct unpcbid {
! 61: uid_t unp_euid;
! 62: gid_t unp_egid;
! 63: };
! 64:
! 65: struct unpcb {
! 66: struct socket *unp_socket; /* pointer back to socket */
! 67: struct vnode *unp_vnode; /* if associated with file */
! 68: ino_t unp_ino; /* fake inode number */
! 69: struct unpcb *unp_conn; /* control block of connected socket */
! 70: struct unpcb *unp_refs; /* referencing socket linked list */
! 71: struct unpcb *unp_nextref; /* link in unp_refs list */
! 72: struct mbuf *unp_addr; /* bound address of socket */
! 73: int unp_flags; /* this unpcb contains peer eids */
! 74: struct unpcbid unp_connid; /* id of peer process */
! 75: int unp_cc; /* copy of rcv.sb_cc */
! 76: int unp_mbcnt; /* copy of rcv.sb_mbcnt */
! 77: struct timespec unp_ctime; /* holds creation time */
! 78: };
! 79:
! 80: /*
! 81: * flag bits in unp_flags
! 82: */
! 83: #define UNP_FEIDS 1 /* unp_connid contains information */
! 84: #define UNP_FEIDSBIND 2 /* unp_connid was set by a bind */
! 85:
! 86: #define sotounpcb(so) ((struct unpcb *)((so)->so_pcb))
CVSweb