xref: /illumos-gate/usr/src/cmd/bnu/dk.h (revision b8767451d156f585534afac0bf22721810d0dc63)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
23 /*	  All Rights Reserved  	*/
24 
25 
26 #ident	"%Z%%M%	%I%	%E% SMI"
27 
28 #ifndef _BNU_DK_H
29 #define _BNU_DK_H
30 
31 #ifdef DIAL
32 #define GLOBAL static
33 #define EXTERN static
34 #else
35 #define EXTERN extern
36 #define GLOBAL
37 #endif
38 
39 /*
40  *	DATAKIT VCS User Level definitions
41  *		@(#)dk.h	2.13+BNU DKHOST 87/06/01
42  *
43  *	CommKit(R) Software - Datakit(R) VCS Interface Release
44  */
45 
46 
47 /*
48  *	ioctl codes
49  */
50 
51 #define	DKIODIAL	(('k'<<8)|0)	/* dial out */
52 #define	DKIOCNEW	(('k'<<8)|1)	/* offer a service */
53 #define	DKIOCREQ	(('k'<<8)|2)	/* request service (SU only) */
54 #define	DKIORESET	(('k'<<8)|3)	/* reset interface */
55 #define DKKMCSET	(('k'<<8)|4)	/* associate logical interface
56 					   with physical KMC # */
57 
58 #define DKIOCSPL	(('s'<<8)|1)	/* splice two circuits together (SU only) */
59 #define	DIOCSWAIT	(('s'<<8)|2)	/* wait for splice to take place */
60 
61 
62 /*     driver control        */
63 
64 #define DIOCEXCL	(('d'<<8)|1)	/* exclusive use */
65 #define DIOCNXCL	(('d'<<8)|2)	/* reset exclusive use */
66 #define	DIOCRMODE	(('d'<<8)|3)	/* set receiver termination modes */
67 #define	DIOCQQABO	(('d'<<8)|4)	/* inquire status of last read */
68 #define	DIOCSIG		(('d'<<8)|5)	/* start short read, signal when done */
69 
70 #define	DIOCXCTL	(('d'<<8)|8)	/* send ctl envelope on next write */
71 #define DIOCFLUSH	(('d'<<8)|9)	/* flush output */
72 #define DIOCSETK	(('d'<<8)|10)	/* debug info from kmc xmit&recv */
73 #define	DIOCQSTAT	(('d'<<8)|11)	/* return 3B hw/fw log data */
74 #define	DIOCBSIZE	(('d'<<8)|12)	/* set URP block size */
75 #define	DIOCTIME	(('d'<<8)|13)	/* set stagnation timeout value */
76 #define	DIOCTRAP	(('d'<<8)|14)	/* activate trsave trace for channel */
77 
78 /*	interface memory read/write codes	 */
79 
80 #define	DIOCHWREAD	(('d'<<8)|15)	/* read interface RAM */
81 #define	DIOCHWRITE	(('d'<<8)|16)	/* write interface RAM */
82 
83 /*	diagnostic control codes	*/
84 
85 #define	DIOCDKDGN	(('d'<<8)|17)	/* execute on-line diagnostics */
86 #define	DIOCDGNSET	(('d'<<8)|18)	/* initialize diagnostic mode */
87 #define	DIOCDGNCLR	(('d'<<8)|19)	/* clear diagnostic mode */
88 
89 /*	3b2/PE codes			*/
90 #define TCDKIDLD	(('d'<<8)|20)	/* download the PE */
91 #define TCDKIFCF	(('d'<<8)|21)	/* Force call to function */
92 #define TCDKIRST	(('d'<<8)|22)	/* Reset the PE board */
93 #define	TCDKISYSG	(('d'<<8)|23)	/*sysgen the PE board */
94 
95 /* Get info from driver */
96 #define DIOCINFO	(('d'<<8)|24)	/* get chans per interface*/
97 #define	TCDKIBUG	(('d'<<8)|25)	/*turn debug on on the PE board */
98 #define	DIOOPEN 	(('d'<<8)|26)	/* inquire channel open status*/
99 /*	special codes used by dkxstdio	*/
100 
101 #define	DXIOEXIT	(('D'<<8)|'T')	/* process exit code */
102 
103 /*
104  *	structure returned from DIOCQQABO giving receive status
105  */
106 struct dkqqabo {
107 	short	rcv_resid ;		/* residual length in buffer */
108 	short	rcv_reason ;		/* set of bits giving reasons */
109 	short	rcv_ctlchar ;		/* ctl char that finished block */
110 } ;
111 
112 /*
113  *   receive mode, and completion indicators
114  *	also defined in sys/dkit.h
115  */
116 
117 #ifndef DKR_FULL
118 #define	DKR_FULL	01	/* buffer full, normal read done */
119 #define	DKR_CNTL	02	/* read terminated on control character */
120 #define	DKR_ABORT	010	/* receive aborted by higher level command */
121 #define	DKR_BLOCK	040	/* end of block */
122 #define	DKR_TIME	0100	/* end of time limit reached */
123 #endif
124 
125 
126 
127 /*
128  *	structure passed with ioctl to request a service
129  *	actually used as a general-purpose struct to pass
130  *	info from a kernel ioctl to user space.
131  */
132 struct diocreq {
133 	short	req_traffic ;		/* traffic intensity generated */
134 	short	req_1param ;		/* typ: service requested */
135 	short	req_2param ;		/* parameter to server */
136 } ;
137 
138 
139 /*
140  *	values returned from service request
141  */
142 #define	req_error	req_traffic
143 #define	req_driver	req_traffic
144 #define	req_chans	req_traffic
145 #define	req_chmin	req_1param
146 
147 
148 /*
149  *	structure received by server when new connection made
150  */
151 struct mgrmsg {
152 	short	m_chan ;		/* channel number of connection */
153 	unsigned short	m_tstamp ;	/* time stamp of request */
154 	char *	m_protocol ;		/* protocol options from user */
155 	char *	m_origtype ;		/* type of originating device */
156 	char *	m_parm ;		/* parameter string from user */
157 	char *	m_uid ;			/* param from system/user, aka UID */
158 	char *	m_dial ;		/* dial string entered */
159 	char *	m_source ;		/* originator, as known to remote node */
160 	char *	m_lname ;		/* originator, as known to local node */
161 	char *	m_service ;		/* service type requested by user */
162 	char *	m_lflag ;		/* L == call from local node,
163 					 * R == call from a remote one.   */
164 	char *	m_srcnode;		/* originating node (last segment)   */
165 	char *	m_srcmod;		/* originating mod		     */
166 	char *	m_srcchan;		/* originating channel		     */
167 	char *	m_cflag;		/* call flag: F=first, P=previous    */
168 	char *	m_errmsg ;		/* possible error msg if m_chan <= 0 */
169 } ;
170 
171 
172 
173 /*
174  *	routines declared in libdk.a
175  */
176 EXTERN char		*dknamer();
177 EXTERN char		*dtnamer();
178 EXTERN char		*dxnamer();
179 EXTERN char		*dkfcanon(), *dktcanon();
180 EXTERN char		*dkerr();
181 EXTERN char		*maphost(), *miscfield();
182 #ifndef DIAL
183 EXTERN char		mh_hostname[];
184 #endif
185 EXTERN struct mgrmsg	*dkmgr();
186 
187 EXTERN int		dk_verbose, dk_errno;
188 
189 
190 /*
191  *	structure passed with ioctl to request a splice
192  */
193 struct diocspl {
194 	short	spl_fdin;		/* the other file descriptor */
195 	short	spl_un1used;
196 	short	spl_un2used;
197 } ;
198 
199 /*
200  * Default file names
201  */
202 
203 #define SRVTAB "/etc/dksrvtab"
204 #define UIDTAB "/etc/dkuidtab"
205 #define SRVLOG "/usr/adm/dksrvlog"
206 #define HOSTAB "/etc/dkhosts"
207 #define DOTAB  "/usr/lib/dkdotab"
208 
209 /*
210  * Number of longs in the stat array returned by the firmware
211  */
212 #define	STATLEN	16
213 
214 #endif
215