Subversion Repositories SvarDOS

Rev

Rev 616 | Details | Compare with Previous | Last modification | View Log | RSS feed

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