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