home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0010 - 0019 / ibm0010-0019 / ibm0010.tar / ibm0010 / UNIX3862.ZIP / U386-06.ZIP / U386-6.TD0 / usr / include / sys / xt.h < prev    next >
Encoding:
C/C++ Source or Header  |  1988-06-26  |  4.9 KB  |  197 lines

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