home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.2 (Developer) / NS_dev_3.2.iso / NextDeveloper / Headers / bsd / sys / unpcb.h < prev    next >
Text File  |  1993-10-19  |  3KB  |  83 lines

  1. /* 
  2.  * Mach Operating System
  3.  * Copyright (c) 1989 Carnegie-Mellon University
  4.  * Copyright (c) 1988 Carnegie-Mellon University
  5.  * All rights reserved.  The CMU software License Agreement specifies
  6.  * the terms and conditions for use and redistribution.
  7.  */
  8. /*
  9.  * HISTORY
  10.  * $Log:    unpcb.h,v $
  11.  * Revision 2.5  89/04/22  15:32:42  gm0w
  12.  *     Removed MACH_VFS changes.
  13.  *     [89/04/14            gm0w]
  14.  * 
  15.  * Revision 2.4  89/03/09  22:09:51  rpd
  16.  *     More cleanup.
  17.  * 
  18.  * Revision 2.3  89/02/25  17:58:00  gm0w
  19.  *     Made dependencies on MACH_VFS only be used inside
  20.  *     KERNEL. Outside of kernel old names must be used.
  21.  *     [89/02/14            mrt]
  22.  * 
  23.  * Revision 2.2  89/01/18  01:20:24  jsb
  24.  *     Vnode support: change inodes to vnodes.
  25.  *     [89/01/13            jsb]
  26.  * 
  27.  */
  28. /*
  29.  * Copyright (c) 1982, 1986 Regents of the University of California.
  30.  * All rights reserved.  The Berkeley software License Agreement
  31.  * specifies the terms and conditions for redistribution.
  32.  *
  33.  *    @(#)unpcb.h    7.1 (Berkeley) 6/4/86
  34.  */
  35.  
  36. /*
  37.  * Protocol control block for an active
  38.  * instance of a UNIX internal protocol.
  39.  *
  40.  * A socket may be associated with an vnode in the
  41.  * file system.  If so, the unp_vnode pointer holds
  42.  * a reference count to this vnode, which should be irele'd
  43.  * when the socket goes away.
  44.  *
  45.  * A socket may be connected to another socket, in which
  46.  * case the control block of the socket to which it is connected
  47.  * is given by unp_conn.
  48.  *
  49.  * A socket may be referenced by a number of sockets (e.g. several
  50.  * sockets may be connected to a datagram socket.)  These sockets
  51.  * are in a linked list starting with unp_refs, linked through
  52.  * unp_nextref and null-terminated.  Note that a socket may be referenced
  53.  * by a number of other sockets and may also reference a socket (not
  54.  * necessarily one which is referencing it).  This generates
  55.  * the need for unp_refs and unp_nextref to be separate fields.
  56.  *
  57.  * Stream sockets keep copies of receive sockbuf sb_cc and sb_mbcnt
  58.  * so that changes in the sockbuf may be computed to modify
  59.  * back pressure on the sender accordingly.
  60.  */
  61.  
  62. #ifndef    _SYS_UNPCB_H_
  63. #define _SYS_UNPCB_H_
  64.  
  65. #import <sys/types.h>
  66.  
  67. struct    unpcb {
  68.     struct    socket *unp_socket;    /* pointer back to socket */
  69.     struct    vnode *unp_vnode;    /* if associated with file */
  70.     ino_t    unp_vno;        /* fake vnode number */
  71.     struct    unpcb *unp_conn;    /* control block of connected socket */
  72.     struct    unpcb *unp_refs;    /* referencing socket linked list */
  73.     struct     unpcb *unp_nextref;    /* link in unp_refs list */
  74.     struct    mbuf *unp_addr;        /* bound address of socket */
  75.     int    unp_cc;            /* copy of rcv.sb_cc */
  76.     int    unp_mbcnt;        /* copy of rcv.sb_mbcnt */
  77. };
  78.  
  79. #define sotounpcb(so)    ((struct unpcb *)((so)->so_pcb))
  80.  
  81. #endif    _SYS_UNPCB_H_
  82.  
  83.