home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 15 / 15.iso / s / s053 / 8.ddi / usr / include / sys / sockmod.h < prev    next >
Encoding:
C/C++ Source or Header  |  1990-12-08  |  4.7 KB  |  187 lines

  1. /*    Copyright (c) 1990 UNIX System Laboratories, Inc.    */
  2. /*    Copyright (c) 1984, 1986, 1987, 1988, 1989, 1990 AT&T    */
  3. /*      All Rights Reserved      */
  4.  
  5. /*    THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF         */
  6. /*    UNIX System Laboratories, Inc.                         */
  7. /*    The copyright notice above does not evidence any       */
  8. /*    actual or intended publication of such source code.    */
  9.  
  10. #ifndef    _SYS_SOCKMOD_H
  11. #define    _SYS_SOCKMOD_H
  12.  
  13. #ident    "@(#)/usr/include/sys/sockmod.h.sl 1.1 4.0 12/08/90 43707 AT&T-USL"
  14.  
  15. /*
  16.  * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  17.  *         PROPRIETARY NOTICE (Combined)
  18.  * 
  19.  * This source code is unpublished proprietary information
  20.  * constituting, or derived under license from AT&T's UNIX(r) System V.
  21.  * In addition, portions of such source code were derived from Berkeley
  22.  * 4.3 BSD under license from the Regents of the University of
  23.  * California.
  24.  * 
  25.  * 
  26.  * 
  27.  *         Copyright Notice 
  28.  * 
  29.  * Notice of copyright on this source code product does not indicate 
  30.  * publication.
  31.  * 
  32.  *     (c) 1986,1987,1988.1989  Sun Microsystems, Inc
  33.  *     (c) 1983,1984,1985,1986,1987,1988,1989  AT&T.
  34.  *               All rights reserved.
  35.  *  
  36.  */
  37.  
  38. #include <sys/un.h>    /* for sockaddr_un */
  39.  
  40. /* internal flags - in addition to the ones in timod.h */
  41. #define        S_WINFO        0x01000    /* waiting for T_info to complete */
  42. #define     S_WRDISABLE    0x02000    /* write service queue disabled */
  43. #define     S_WUNBIND    0x04000    /* waiting on T_OK_ACK for 
  44.                      * T_UNBIND_REQ
  45.                      */
  46. #define     S_RBLOCKED    0x08000 /* read side is/was blocked */
  47. #define     S_WBLOCKED    0x10000 /* write side is/was blocked */
  48. #define        S_WCLOSE    0x20000 /* Waiting to free the so_so, but
  49.                      * have pending esballoc'ed msgs.
  50.                      */
  51.  
  52. /* socket module ioctls */
  53. #define        SIMOD         ('I'<<8)
  54.  
  55. /*
  56.  * The following are ioctl handled specially by the socket
  57.  * module which were not handled by timod.
  58.  */
  59. #define        SI_GETUDATA        (SIMOD|101)
  60. #define        SI_SHUTDOWN        (SIMOD|102)
  61. #define        SI_LISTEN        (SIMOD|103)
  62. #define        SI_SETMYNAME        (SIMOD|104)
  63. #define        SI_SETPEERNAME        (SIMOD|105)
  64. #define        SI_GETINTRANSIT        (SIMOD|106)
  65. #define        SI_TCL_LINK        (SIMOD|107)
  66. #define        SI_TCL_UNLINK        (SIMOD|108)
  67.  
  68.  
  69. struct si_udata {
  70.     int    tidusize;    /* TIDU size          */
  71.     int    addrsize;    /* address size          */
  72.     int    optsize;    /* options size          */
  73.     int    etsdusize;    /* expedited size     */
  74.     int    servtype;    /* service type       */
  75.     int    so_state;    /* socket states      */
  76.     int    so_options;    /* socket options     */
  77. };
  78.  
  79. struct _si_user {
  80.     struct    _si_user     *next;        /* next one           */
  81.     struct    _si_user     *prev;        /* previous one          */
  82.     int              fd;        /* file descripter    */
  83.     int              ctlsize;    /* ctl buffer size    */
  84.     char                *ctlbuf;    /* ctl buffer         */
  85.     int            family;        /* protocol family    */
  86.     struct    si_udata    udata;        /* socket info          */
  87.     int            flags;
  88. };
  89.  
  90. /*
  91.  * Flag bits.
  92.  */
  93. #define        S_SIGIO        0x1    /* If set, user has SIGIO enabled */
  94. #define        S_SIGURG    0x2    /* If set, user has SIGURG enabled */
  95.  
  96. /*
  97.  * Used for the tortuous UNIX domain
  98.  * naming.
  99.  */
  100. struct ux_dev {
  101.     dev_t    dev;
  102.     ino_t    ino;
  103. };
  104.  
  105. struct ux_extaddr {
  106.     size_t    size;                /* Size of following address */
  107.     union    {
  108.         struct ux_dev    tu_addr;    /* User selected address */
  109.         int        tp_addr;    /* TP selected address */
  110.     } addr;
  111. };
  112. #define        extdev        ux_extaddr.addr.tu_addr.dev
  113. #define        extino        ux_extaddr.addr.tu_addr.ino
  114. #define        extsize        ux_extaddr.size
  115. #define        extaddr        ux_extaddr.addr
  116.  
  117. struct bind_ux {
  118.     struct    sockaddr_un    name;
  119.     struct    ux_extaddr    ux_extaddr;
  120. };
  121.  
  122. /*
  123.  * Doubly linked list of so_so that
  124.  * represent a UNIX domain socket.
  125.  */
  126. struct so_ux {
  127.     struct so_so *next;
  128.     struct so_so *prev;
  129. };
  130.  
  131. struct so_so {
  132.     long             flags;
  133.     queue_t            *rdq;
  134.     mblk_t          *iocsave;
  135.     struct    t_info        tp_info;
  136.     struct    netbuf        raddr;
  137.     struct    netbuf        laddr;
  138.     struct    ux_extaddr    lux_dev;
  139.     struct    ux_extaddr    rux_dev;
  140.     int            so_error;
  141.     mblk_t          *oob;
  142.     struct    so_so        *so_conn;
  143.     mblk_t             *consave;
  144.     struct    si_udata    udata;
  145.     int            so_option;
  146.     mblk_t          *bigmsg;
  147.     struct    so_ux        so_ux;
  148.     int            hasoutofband;
  149.     mblk_t            *urg_msg;
  150.     int            sndbuf;
  151.     int            rcvbuf;
  152.     int            sndlowat;
  153.     int            rcvlowat;
  154.     int            linger;
  155.     int            sndtimeo;
  156.     int            rcvtimeo;
  157.     int            prototype;
  158.     int            esbcnt;
  159. };
  160.  
  161. extern struct _si_user     *_s_checkfd();
  162. extern struct _si_user     *_s_open();
  163. extern void          _s_aligned_copy();
  164. extern struct netconfig    *_s_match();
  165. extern int           _s_sosend();
  166. extern int         _s_soreceive();
  167. extern int          _s_getudata();
  168. extern int          _s_is_ok();
  169. extern int          _s_do_ioctl();
  170. extern int          _s_min();
  171. extern int         _s_max();
  172. extern void         _s_close();
  173. extern int         _s_getfamily();
  174. extern int         _s_uxpathlen();
  175. extern void         (*sigset())();
  176.  
  177. /*
  178.  * Socket library debugging
  179.  */
  180. extern int        _s_sockdebug;
  181. #define    SOCKDEBUG(S, A, B)    \
  182.             if ((((S) && (S)->udata.so_options & SO_DEBUG)) || \
  183.                         _s_sockdebug) { \
  184.                 (void)syslog(LOG_ERR, (A), (B)); \
  185.             }
  186. #endif /* _SYS_SOCKMOD_H */
  187.