xref: /freebsd/sys/net/if_llc.h (revision 29363fb446372cb3f10bc98664e9767c53fbb457)
1e957d912SMatthew N. Dodd /*	$NetBSD: if_llc.h,v 1.12 1999/11/19 20:41:19 thorpej Exp $	*/
2e957d912SMatthew N. Dodd 
3c398230bSWarner Losh /*-
4*51369649SPedro F. Giffuni  * SPDX-License-Identifier: BSD-3-Clause
5*51369649SPedro F. Giffuni  *
6df8bae1dSRodney W. Grimes  * Copyright (c) 1988, 1993
7df8bae1dSRodney W. Grimes  *	The Regents of the University of California.  All rights reserved.
8df8bae1dSRodney W. Grimes  *
9df8bae1dSRodney W. Grimes  * Redistribution and use in source and binary forms, with or without
10df8bae1dSRodney W. Grimes  * modification, are permitted provided that the following conditions
11df8bae1dSRodney W. Grimes  * are met:
12df8bae1dSRodney W. Grimes  * 1. Redistributions of source code must retain the above copyright
13df8bae1dSRodney W. Grimes  *    notice, this list of conditions and the following disclaimer.
14df8bae1dSRodney W. Grimes  * 2. Redistributions in binary form must reproduce the above copyright
15df8bae1dSRodney W. Grimes  *    notice, this list of conditions and the following disclaimer in the
16df8bae1dSRodney W. Grimes  *    documentation and/or other materials provided with the distribution.
17fbbd9655SWarner Losh  * 3. Neither the name of the University nor the names of its contributors
18df8bae1dSRodney W. Grimes  *    may be used to endorse or promote products derived from this software
19df8bae1dSRodney W. Grimes  *    without specific prior written permission.
20df8bae1dSRodney W. Grimes  *
21df8bae1dSRodney W. Grimes  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22df8bae1dSRodney W. Grimes  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23df8bae1dSRodney W. Grimes  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24df8bae1dSRodney W. Grimes  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25df8bae1dSRodney W. Grimes  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26df8bae1dSRodney W. Grimes  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27df8bae1dSRodney W. Grimes  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28df8bae1dSRodney W. Grimes  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29df8bae1dSRodney W. Grimes  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30df8bae1dSRodney W. Grimes  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31df8bae1dSRodney W. Grimes  * SUCH DAMAGE.
32df8bae1dSRodney W. Grimes  */
33df8bae1dSRodney W. Grimes 
34cea1da3bSPaul Richards #ifndef _NET_IF_LLC_H_
35cea1da3bSPaul Richards #define _NET_IF_LLC_H_
36cea1da3bSPaul Richards 
37df8bae1dSRodney W. Grimes /*
38df8bae1dSRodney W. Grimes  * IEEE 802.2 Link Level Control headers, for use in conjunction with
39df8bae1dSRodney W. Grimes  * 802.{3,4,5} media access control methods.
40df8bae1dSRodney W. Grimes  *
41e957d912SMatthew N. Dodd  * Headers here do not use bit fields due to shortcommings in many
42df8bae1dSRodney W. Grimes  * compilers.
43df8bae1dSRodney W. Grimes  */
44df8bae1dSRodney W. Grimes 
45df8bae1dSRodney W. Grimes struct llc {
46e957d912SMatthew N. Dodd 	u_int8_t llc_dsap;
47e957d912SMatthew N. Dodd 	u_int8_t llc_ssap;
48df8bae1dSRodney W. Grimes 	union {
49df8bae1dSRodney W. Grimes 	    struct {
50e957d912SMatthew N. Dodd 		u_int8_t control;
51e957d912SMatthew N. Dodd 		u_int8_t format_id;
52e957d912SMatthew N. Dodd 		u_int8_t class;
53e957d912SMatthew N. Dodd 		u_int8_t window_x2;
54ff432341SWarner Losh 	    } __packed type_u;
55df8bae1dSRodney W. Grimes 	    struct {
56e957d912SMatthew N. Dodd 		u_int8_t num_snd_x2;
57e957d912SMatthew N. Dodd 		u_int8_t num_rcv_x2;
58ff432341SWarner Losh 	    } __packed type_i;
59df8bae1dSRodney W. Grimes 	    struct {
60e957d912SMatthew N. Dodd 		u_int8_t control;
61e957d912SMatthew N. Dodd 		u_int8_t num_rcv_x2;
62ff432341SWarner Losh 	    } __packed type_s;
63df8bae1dSRodney W. Grimes 	    struct {
64e957d912SMatthew N. Dodd 	        u_int8_t control;
65e957d912SMatthew N. Dodd 		/*
66e957d912SMatthew N. Dodd 		 * We cannot put the following fields in a structure because
67e957d912SMatthew N. Dodd 		 * the structure rounding might cause padding.
68e957d912SMatthew N. Dodd 		 */
69e957d912SMatthew N. Dodd 		u_int8_t frmr_rej_pdu0;
70e957d912SMatthew N. Dodd 		u_int8_t frmr_rej_pdu1;
71e957d912SMatthew N. Dodd 		u_int8_t frmr_control;
72e957d912SMatthew N. Dodd 		u_int8_t frmr_control_ext;
73e957d912SMatthew N. Dodd 		u_int8_t frmr_cause;
74ff432341SWarner Losh 	    } __packed type_frmr;
75e957d912SMatthew N. Dodd 	    struct {
76e957d912SMatthew N. Dodd 		u_int8_t  control;
77e957d912SMatthew N. Dodd 		u_int8_t  org_code[3];
78e957d912SMatthew N. Dodd 		u_int16_t ether_type;
79ff432341SWarner Losh 	    } __packed type_snap;
80e957d912SMatthew N. Dodd 	    struct {
81e957d912SMatthew N. Dodd 		u_int8_t control;
82e957d912SMatthew N. Dodd 		u_int8_t control_ext;
83ff432341SWarner Losh 	    } __packed type_raw;
84ff432341SWarner Losh 	} __packed llc_un;
85ebc82cbbSAlfred Perlstein } __packed;
86e957d912SMatthew N. Dodd 
87df8bae1dSRodney W. Grimes struct frmrinfo {
88e957d912SMatthew N. Dodd 	u_int8_t frmr_rej_pdu0;
89e957d912SMatthew N. Dodd 	u_int8_t frmr_rej_pdu1;
90e957d912SMatthew N. Dodd 	u_int8_t frmr_control;
91e957d912SMatthew N. Dodd 	u_int8_t frmr_control_ext;
92e957d912SMatthew N. Dodd 	u_int8_t frmr_cause;
93ebc82cbbSAlfred Perlstein } __packed;
94e957d912SMatthew N. Dodd 
95df8bae1dSRodney W. Grimes #define	llc_control		llc_un.type_u.control
96df8bae1dSRodney W. Grimes #define	llc_control_ext		llc_un.type_raw.control_ext
97df8bae1dSRodney W. Grimes #define	llc_fid			llc_un.type_u.format_id
98df8bae1dSRodney W. Grimes #define	llc_class		llc_un.type_u.class
99df8bae1dSRodney W. Grimes #define	llc_window		llc_un.type_u.window_x2
100e957d912SMatthew N. Dodd #define	llc_frmrinfo 		llc_un.type_frmr.frmr_rej_pdu0
101e957d912SMatthew N. Dodd #define	llc_frmr_pdu0		llc_un.type_frmr.frmr_rej_pdu0
102e957d912SMatthew N. Dodd #define	llc_frmr_pdu1		llc_un.type_frmr.frmr_rej_pdu1
103e957d912SMatthew N. Dodd #define	llc_frmr_control	llc_un.type_frmr.frmr_control
104e957d912SMatthew N. Dodd #define	llc_frmr_control_ext	llc_un.type_frmr.frmr_control_ext
105e957d912SMatthew N. Dodd #define	llc_frmr_cause		llc_un.type_frmr.frmr_cause
106e957d912SMatthew N. Dodd #define	llc_snap		llc_un.type_snap
107df8bae1dSRodney W. Grimes 
108df8bae1dSRodney W. Grimes /*
109df8bae1dSRodney W. Grimes  * Don't use sizeof(struct llc_un) for LLC header sizes
110df8bae1dSRodney W. Grimes  */
111df8bae1dSRodney W. Grimes #define LLC_ISFRAMELEN 4
112df8bae1dSRodney W. Grimes #define LLC_UFRAMELEN  3
113df8bae1dSRodney W. Grimes #define LLC_FRMRLEN    7
114e957d912SMatthew N. Dodd #define LLC_SNAPFRAMELEN 8
115df8bae1dSRodney W. Grimes 
116ff432341SWarner Losh #ifdef CTASSERT
117ff432341SWarner Losh CTASSERT(sizeof (struct llc) == LLC_SNAPFRAMELEN);
118ff432341SWarner Losh #endif
119ff432341SWarner Losh 
120df8bae1dSRodney W. Grimes /*
121df8bae1dSRodney W. Grimes  * Unnumbered LLC format commands
122df8bae1dSRodney W. Grimes  */
123df8bae1dSRodney W. Grimes #define LLC_UI		0x3
124df8bae1dSRodney W. Grimes #define LLC_UI_P	0x13
125df8bae1dSRodney W. Grimes #define LLC_DISC	0x43
126df8bae1dSRodney W. Grimes #define	LLC_DISC_P	0x53
127df8bae1dSRodney W. Grimes #define LLC_UA		0x63
128df8bae1dSRodney W. Grimes #define LLC_UA_P	0x73
129df8bae1dSRodney W. Grimes #define LLC_TEST	0xe3
130df8bae1dSRodney W. Grimes #define LLC_TEST_P	0xf3
131df8bae1dSRodney W. Grimes #define LLC_FRMR	0x87
132df8bae1dSRodney W. Grimes #define	LLC_FRMR_P	0x97
133df8bae1dSRodney W. Grimes #define LLC_DM		0x0f
134df8bae1dSRodney W. Grimes #define	LLC_DM_P	0x1f
135df8bae1dSRodney W. Grimes #define LLC_XID		0xaf
136df8bae1dSRodney W. Grimes #define LLC_XID_P	0xbf
137df8bae1dSRodney W. Grimes #define LLC_SABME	0x6f
138df8bae1dSRodney W. Grimes #define LLC_SABME_P	0x7f
139df8bae1dSRodney W. Grimes 
140df8bae1dSRodney W. Grimes /*
141df8bae1dSRodney W. Grimes  * Supervisory LLC commands
142df8bae1dSRodney W. Grimes  */
143df8bae1dSRodney W. Grimes #define	LLC_RR		0x01
144df8bae1dSRodney W. Grimes #define	LLC_RNR		0x05
145df8bae1dSRodney W. Grimes #define	LLC_REJ		0x09
146df8bae1dSRodney W. Grimes 
147df8bae1dSRodney W. Grimes /*
148df8bae1dSRodney W. Grimes  * Info format - dummy only
149df8bae1dSRodney W. Grimes  */
150df8bae1dSRodney W. Grimes #define	LLC_INFO	0x00
151df8bae1dSRodney W. Grimes 
152df8bae1dSRodney W. Grimes /*
153df8bae1dSRodney W. Grimes  * ISO PDTR 10178 contains among others
154df8bae1dSRodney W. Grimes  */
1558f867517SAndrew Thompson #define LLC_8021D_LSAP	0x42
156df8bae1dSRodney W. Grimes #define LLC_X25_LSAP	0x7e
157df8bae1dSRodney W. Grimes #define LLC_SNAP_LSAP	0xaa
158df8bae1dSRodney W. Grimes #define LLC_ISO_LSAP	0xfe
159df8bae1dSRodney W. Grimes 
160e957d912SMatthew N. Dodd #endif /* _NET_IF_LLC_H_ */
161