xref: /onnv-gate/usr/src/uts/common/io/ppp/spppasyn/spppasyn.h (revision 0:68f95e015346)
1*0Sstevel@tonic-gate /*
2*0Sstevel@tonic-gate  * spppasyn.h - Solaris STREAMS PPP asynchronous HDLC module definitions
3*0Sstevel@tonic-gate  *
4*0Sstevel@tonic-gate  * Copyright 2000-2002 Sun Microsystems, Inc.  All rights reserved.
5*0Sstevel@tonic-gate  * Use is subject to license terms.
6*0Sstevel@tonic-gate  *
7*0Sstevel@tonic-gate  * Permission to use, copy, modify, and distribute this software and its
8*0Sstevel@tonic-gate  * documentation is hereby granted, provided that the above copyright
9*0Sstevel@tonic-gate  * notice appears in all copies.
10*0Sstevel@tonic-gate  *
11*0Sstevel@tonic-gate  * SUN MAKES NO REPRESENTATION OR WARRANTIES ABOUT THE SUITABILITY OF
12*0Sstevel@tonic-gate  * THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
13*0Sstevel@tonic-gate  * TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
14*0Sstevel@tonic-gate  * PARTICULAR PURPOSE, OR NON-INFRINGEMENT.  SUN SHALL NOT BE LIABLE FOR
15*0Sstevel@tonic-gate  * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
16*0Sstevel@tonic-gate  * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES
17*0Sstevel@tonic-gate  *
18*0Sstevel@tonic-gate  * Copyright (c) 1994 The Australian National University.
19*0Sstevel@tonic-gate  * All rights reserved.
20*0Sstevel@tonic-gate  *
21*0Sstevel@tonic-gate  * Permission to use, copy, modify, and distribute this software and its
22*0Sstevel@tonic-gate  * documentation is hereby granted, provided that the above copyright
23*0Sstevel@tonic-gate  * notice appears in all copies.  This software is provided without any
24*0Sstevel@tonic-gate  * warranty, express or implied. The Australian National University
25*0Sstevel@tonic-gate  * makes no representations about the suitability of this software for
26*0Sstevel@tonic-gate  * any purpose.
27*0Sstevel@tonic-gate  *
28*0Sstevel@tonic-gate  * IN NO EVENT SHALL THE AUSTRALIAN NATIONAL UNIVERSITY BE LIABLE TO ANY
29*0Sstevel@tonic-gate  * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
30*0Sstevel@tonic-gate  * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
31*0Sstevel@tonic-gate  * THE AUSTRALIAN NATIONAL UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY
32*0Sstevel@tonic-gate  * OF SUCH DAMAGE.
33*0Sstevel@tonic-gate  *
34*0Sstevel@tonic-gate  * THE AUSTRALIAN NATIONAL UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
35*0Sstevel@tonic-gate  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
36*0Sstevel@tonic-gate  * AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
37*0Sstevel@tonic-gate  * ON AN "AS IS" BASIS, AND THE AUSTRALIAN NATIONAL UNIVERSITY HAS NO
38*0Sstevel@tonic-gate  * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS,
39*0Sstevel@tonic-gate  * OR MODIFICATIONS.
40*0Sstevel@tonic-gate  *
41*0Sstevel@tonic-gate  * This driver is derived from the original SVR4 STREAMS PPP driver
42*0Sstevel@tonic-gate  * originally written by Paul Mackerras <paul.mackerras@cs.anu.edu.au>.
43*0Sstevel@tonic-gate  *
44*0Sstevel@tonic-gate  * Adi Masputra <adi.masputra@sun.com> rewrote and restructured the code
45*0Sstevel@tonic-gate  * for improved performance and scalability.
46*0Sstevel@tonic-gate  */
47*0Sstevel@tonic-gate 
48*0Sstevel@tonic-gate #ifndef __SPPPASYN_H
49*0Sstevel@tonic-gate #define	__SPPPASYN_H
50*0Sstevel@tonic-gate 
51*0Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
52*0Sstevel@tonic-gate 
53*0Sstevel@tonic-gate #ifdef	__cplusplus
54*0Sstevel@tonic-gate extern "C" {
55*0Sstevel@tonic-gate #endif
56*0Sstevel@tonic-gate 
57*0Sstevel@tonic-gate typedef struct spppasyn_kstats	{
58*0Sstevel@tonic-gate 	kstat_named_t	pks_ioctls;		/* total ioctl count */
59*0Sstevel@tonic-gate 	kstat_named_t	pks_ioctlsfwd;		/* forwarded down */
60*0Sstevel@tonic-gate 	kstat_named_t	pks_ioctlserr;		/* returned in error */
61*0Sstevel@tonic-gate 	kstat_named_t	pks_ctls;		/* total ctl count */
62*0Sstevel@tonic-gate 	kstat_named_t	pks_ctlsfwd;		/* forwarded down */
63*0Sstevel@tonic-gate 	kstat_named_t	pks_ctlserr;		/* discarded due to error */
64*0Sstevel@tonic-gate 	kstat_named_t	pks_inbadchars;		/* chars in recv accm */
65*0Sstevel@tonic-gate 	kstat_named_t	pks_inbadcharmask;	/* add to recv accm */
66*0Sstevel@tonic-gate 	kstat_named_t	pks_inaborts;		/* aborted (7D 7E) frames */
67*0Sstevel@tonic-gate 	kstat_named_t	pks_inrunts;		/* too short (<4) frames */
68*0Sstevel@tonic-gate 	kstat_named_t	pks_inallocfails;	/* out of STREAMS buffers */
69*0Sstevel@tonic-gate 	kstat_named_t	pks_intoolongs;		/* too long (>MRU) frames */
70*0Sstevel@tonic-gate 	kstat_named_t	pks_outrunts;		/* bugs in upper modules */
71*0Sstevel@tonic-gate 	kstat_named_t	pks_outallocfails;	/* out of STREAMS buffers */
72*0Sstevel@tonic-gate 	kstat_named_t	pks_incrcerrs;		/* bad input frames */
73*0Sstevel@tonic-gate 	kstat_named_t	pks_unknownwrs;		/* forwarded wput messages */
74*0Sstevel@tonic-gate 	kstat_named_t	pks_unknownrds;		/* forwarded rput messages */
75*0Sstevel@tonic-gate 	kstat_named_t	pks_hangups;		/* hang-up messages */
76*0Sstevel@tonic-gate 	kstat_named_t	pks_datain;		/* received from serial */
77*0Sstevel@tonic-gate 	kstat_named_t	pks_dataout;		/* sent to serial */
78*0Sstevel@tonic-gate 	kstat_named_t	pks_extrabufs;		/* extra buffers needed */
79*0Sstevel@tonic-gate 	kstat_named_t	pks_sentmux;		/* sent mux count */
80*0Sstevel@tonic-gate 	kstat_named_t	pks_recvmux;		/* received mux count */
81*0Sstevel@tonic-gate 	kstat_named_t	pks_inmuxerrs;		/* bad input mux frames */
82*0Sstevel@tonic-gate #ifdef REPORT_CRC_TYPE
83*0Sstevel@tonic-gate 	kstat_named_t	pks_incrctype;		/* configured input CRC bits */
84*0Sstevel@tonic-gate 	kstat_named_t	pks_outcrctype;		/* configured output CRC */
85*0Sstevel@tonic-gate #endif
86*0Sstevel@tonic-gate } spppasyn_kstats_t;
87*0Sstevel@tonic-gate 
88*0Sstevel@tonic-gate /*
89*0Sstevel@tonic-gate  * Per-stream state structure
90*0Sstevel@tonic-gate  */
91*0Sstevel@tonic-gate typedef struct sppp_ahdlc {
92*0Sstevel@tonic-gate 	uint32_t	sa_flags;		/* link flags */
93*0Sstevel@tonic-gate 	mblk_t		*sa_rx_buf;	/* ptr to receive buffer */
94*0Sstevel@tonic-gate 	ushort_t	sa_infcs16;	/* calculated rx HDLC FCS */
95*0Sstevel@tonic-gate 	ushort_t	sa_proto;	/* the last protocol in frame */
96*0Sstevel@tonic-gate 	uint32_t	sa_infcs32;	/* calculated rx HDLC FCS-32 */
97*0Sstevel@tonic-gate 	uint32_t	sa_xaccm[8];	/* 256-bit xmit ACCM */
98*0Sstevel@tonic-gate 	uint32_t	sa_raccm;	/* 32-bit rcv ACCM */
99*0Sstevel@tonic-gate 	int		sa_mru;		/* link MRU */
100*0Sstevel@tonic-gate 	int		sa_unit;	/* current PPP unit number */
101*0Sstevel@tonic-gate 	struct pppstat64 sa_stats;	/* statistic structure */
102*0Sstevel@tonic-gate 	hrtime_t	sa_hrtime;	/* last updated hrtime */
103*0Sstevel@tonic-gate 	mblk_t		*sa_mqhead;	/* pointer to the first message */
104*0Sstevel@tonic-gate 	mblk_t		*sa_mqtail;	/* pointer to the last message */
105*0Sstevel@tonic-gate 	size_t		sa_mqlen;	/* length of the frame so far */
106*0Sstevel@tonic-gate 	timeout_id_t	sa_timeout_id;	/* timeout id */
107*0Sstevel@tonic-gate 	uint32_t	sa_timeout_usec; /* value of the mux timer */
108*0Sstevel@tonic-gate 	kstat_t		*sa_ksp;	/* kernel statistics structure */
109*0Sstevel@tonic-gate 	spppasyn_kstats_t sa_kstats;	/* current statistics */
110*0Sstevel@tonic-gate } sppp_ahdlc_t;
111*0Sstevel@tonic-gate 
112*0Sstevel@tonic-gate /*
113*0Sstevel@tonic-gate  * Values for flags.  Note that bits 0-7 (0xFF) are used by RCV_* flags
114*0Sstevel@tonic-gate  * and [XR]_MUXMASK in pppio.h.
115*0Sstevel@tonic-gate  */
116*0Sstevel@tonic-gate #define	SAF_ESCAPED	 0x00000100	/* last saw escape char on input */
117*0Sstevel@tonic-gate #define	SAF_IFLUSH	 0x00000200	/* discarding due to hangup or error */
118*0Sstevel@tonic-gate #define	SAF_XMITCRC32	 0x00000400	/* transmit 32 bit CRC */
119*0Sstevel@tonic-gate #define	SAF_XMITCRCNONE	 0x00000800	/* transmit no CRC */
120*0Sstevel@tonic-gate #define	SAF_RECVCRC32	 0x00001000	/* receive 32 bit CRC */
121*0Sstevel@tonic-gate #define	SAF_RECVCRCNONE	 0x00002000	/* receive no CRC */
122*0Sstevel@tonic-gate #define	SAF_XMITDUMP	 0x00004000	/* dump raw transmitted data */
123*0Sstevel@tonic-gate #define	SAF_RECVDUMP	 0x00008000	/* dump raw received data */
124*0Sstevel@tonic-gate #define	SAF_LASTMOD	 0x00010000	/* last PPP-aware module in stream */
125*0Sstevel@tonic-gate #define	SAF_XCOMP_AC	 0x00100000	/* compress address/control */
126*0Sstevel@tonic-gate #define	SAF_RDECOMP_AC	 0x00200000	/* decompress address/control */
127*0Sstevel@tonic-gate #define	SAF_XCOMP_PROT	 0x00400000	/* compress PPP protocol */
128*0Sstevel@tonic-gate #define	SAF_RDECOMP_PROT 0x00800000	/* decompress PPP protocol */
129*0Sstevel@tonic-gate 
130*0Sstevel@tonic-gate #ifdef	__cplusplus
131*0Sstevel@tonic-gate }
132*0Sstevel@tonic-gate #endif
133*0Sstevel@tonic-gate 
134*0Sstevel@tonic-gate #endif /* __SPPPASYN_H */
135