home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 15 / 15.iso / s / s053 / 9.ddi / usr / include / sys / xt.h < prev    next >
Encoding:
C/C++ Source or Header  |  1990-12-08  |  5.0 KB  |  199 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.  
  11. #ident    "@(#)/usr/include/sys/xt.h.sl 1.1 4.0 12/08/90 59221 AT&T-USL"
  12.  
  13. /*
  14. **    Multiplexed channels driver header
  15. */
  16.  
  17. #define    XTRACE        1        /* 1 to include tracing */
  18. #define    XTSTATS        1        /* 1 to enable statistics */
  19. #define    XTDATA        1        /* 1 to enable Link table extraction */
  20.  
  21. #define    MAXLINKS    32
  22. #define    CHAN(dev)    (dev & ((1<<CHANSIZ) - 1))
  23. #define    LINK(dev)    ((dev>>CHANSIZ)&(0xff>>CHANSIZ))
  24.  
  25. #if    (MAXPCHAN*MAXLINKS) > 256
  26.     ERROR -- product cannot be greater than minor(dev)
  27. #endif
  28.  
  29. #if    XTRACE == 1
  30. #define    PKTPTSZ        8            /* Packet part to be captured for trace */
  31. #define    PKTHIST        40            /* Size of trace history */
  32.  
  33. struct Tpkt
  34. {
  35.     Pbyte        pktpart[PKTPTSZ-1];    /* Record of a packet captured */
  36.     Pbyte        flag;            /* Direction */
  37.     time_t        time;            /* Log time in ticks */
  38. };
  39.  
  40. #define    XMITLOG        0            /* Transmitted packet */
  41. #define    RECVLOG        1            /* Received packet */
  42.  
  43. struct Tbuf
  44. {
  45.     struct Tpkt    log[PKTHIST];        /* A history of transactions */
  46.     short        flags;            /* Flags */
  47.     char        index;            /* Next slot */
  48.     char        used;            /* Number of slots used */
  49. };
  50.  
  51. #define    TRACEON        1            /* Trace enabled */
  52. #define    TRACELOCK    2            /* Trace locked */
  53.  
  54. static void    logpkt();
  55. #define        Logpkt(A,B,C)    if (((B)->l.trace.flags&(TRACEON|TRACELOCK))==TRACEON)logpkt(A,B,C)
  56. #define        LOCKTRACE(A)    (A)->l.trace.flags|=TRACELOCK
  57. #else
  58. #define        Logpkt(A,B,C)
  59. #define        LOCKTRACE(A)
  60. #endif
  61.  
  62. #if    XTSTATS == 1
  63. enum stats_t
  64. {
  65.      xpkts, rpkts, crcerr, badack, badnak, outseq
  66.     ,nakretrys, rdup, rnak, xnak, rack, xack
  67.     ,badhdr, badsize, lostack, badcntl, badcdata
  68.     ,nocfree, badcount, badchan, badctype, norbuf
  69.     ,rtimo, xtimo
  70.     ,wiow, woas
  71.     ,nstats
  72. };
  73.  
  74. #define    S_XPKTS        (int)xpkts
  75. #define    S_RPKTS        (int)rpkts
  76. #define    S_CRCERR    (int)crcerr
  77. #define    S_BADACK    (int)badack
  78. #define    S_BADNAK    (int)badnak
  79. #define    S_OUTSEQ    (int)outseq
  80. #define    S_NAKRETRYS    (int)nakretrys
  81. #define    S_RDUP        (int)rdup
  82. #define    S_RNAK        (int)rnak
  83. #define    S_XNAK        (int)xnak
  84. #define    S_RACK        (int)rack
  85. #define    S_XACK        (int)xack
  86. #define    S_BADHDR    (int)badhdr
  87. #define    S_BADSIZE    (int)badsize
  88. #define    S_LOSTACK    (int)lostack
  89. #define    S_BADCNTL    (int)badcntl
  90. #define    S_BADCDATA    (int)badcdata
  91. #define    S_NOCFREE    (int)nocfree
  92. #define    S_BADCOUNT    (int)badcount
  93. #define    S_BADCHAN    (int)badchan
  94. #define    S_BADCTYPE    (int)badctype
  95. #define    S_NORBUF    (int)norbuf
  96. #define    S_RTIMO        (int)rtimo
  97. #define    S_XTIMO        (int)xtimo
  98. #define    S_WIOW        (int)wiow
  99. #define    S_WOAS        (int)woas
  100. #define    S_NSTATS    (int)nstats
  101.  
  102. typedef long        Stats_t;
  103.  
  104. #define    STATS(A,B)    (A)->l.stats[B]++
  105. #else
  106. #define    STATS(A,B)
  107. #endif
  108.  
  109. struct Channel
  110. {
  111.     struct Pchannel    chan;        /* Protocol state information for this channel */
  112.     struct tty    tty;        /* Virtual tty for this channel */
  113.     struct jwinsize    winsize;    /* Layer parameters for JWINSIZE ioctl */
  114. #ifdef VPIX
  115.     v86_t        *v86p;        /* Pointer to v86 proc in DOS mode */
  116. #endif
  117. };
  118.  
  119. typedef struct Channel *Ch_p;
  120.  
  121. /*
  122. **    JAGENT ioctl structure
  123. */
  124. struct hagent
  125. {
  126.     struct bagent desc;    /* WARNING!!this better be 12 bytes long!!!
  127.                     defined in jioctl.h */
  128.     struct cblock *retcb;        /* returning cblock from rcvpkt */
  129.     short flag;            /* flag to synchronise ioctl's */
  130. };
  131.  
  132. /* flags for hagent struct */
  133. #define    AGASLP    01
  134. #define    AGBUSY    02
  135.  
  136. struct Linkinfo
  137. {
  138.     struct tty *    line;        /* Real tty for this link */
  139.     char *        rdatap;        /* Pointer into rpkt */
  140.     struct Pktstate    rpkt;        /* Packet being received for this link */
  141.     short        lihiwat;    /* High water mark for real line */
  142.     short        xtimo;        /* Transmission timeout */
  143.     char        rtimo;        /* Receive timeout */
  144.     char        old;        /* Old line discipline for line */
  145.     char        nchans;        /* Number of channels allowed */
  146.     char        lchan;        /* Last channel started */
  147.     char        open;        /* Channel open bits */
  148.     char        xopen;        /* Exclusive open bits */
  149.     struct hagent    agent;        /* ioctl agent structure */
  150.     short        pid;        /* real channel control process */
  151.     short        hex;        /* 1 if 6-bit path, 0 if 8-bit  */
  152. #if    XTRACE == 1
  153.     struct Tbuf    trace;        /* Tracks */
  154. #endif
  155. #if    XTSTATS == 1
  156.     Stats_t        stats[S_NSTATS];/* Statistics */
  157. #endif
  158. };
  159.  
  160. struct Link
  161. {
  162.     struct Linkinfo    l;        /* Link info */
  163.     struct Channel    chans[1];    /* Array of channels for this link */
  164. };
  165.  
  166. typedef    struct Link *    Link_p;
  167.  
  168. /*
  169. **    Ioctl args
  170. */
  171.  
  172. #define    XTIOCTYPE    ('b'<<8)
  173. #define    XTIOCLINK    (XTIOCTYPE|1)
  174. #define    XTIOCSTATS    (XTIOCTYPE|2)
  175. #define    XTIOCTRACE    (XTIOCTYPE|3)
  176. #define    XTIOCNOTRACE    (XTIOCTYPE|4)
  177. #define    XTIOCDATA    (XTIOCTYPE|5)
  178. #define    HXTIOCLINK    (XTIOCTYPE|6)
  179.  
  180. /** Link set up request **/
  181.  
  182. struct xtioclm
  183. {
  184.     char        fd;        /* File descriptor for 'real' 'tty' line */
  185.     char        nchans;        /* Maximum channels that will be used */
  186. };
  187.  
  188. /** Data descriptor **/
  189.  
  190. struct xtiocdd
  191. {
  192.     int        size;        /* Sizeof buffer */
  193.     char *        addr;        /* Address of buffer */
  194. };
  195.  
  196. #define    PCHANMATCH(tp)    ((Pch_p)(tp)-1)
  197. #define    LINKMATCH(p)    linkTable[(p)->link]
  198. #define    t_link        t_dstat        /* Use dstat in real tty for linknumber */
  199.