llc.h revision 17680
1/*
2 * Copyright (c) 1993, 1994
3 *	The Regents of the University of California.  All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that: (1) source code distributions
7 * retain the above copyright notice and this paragraph in its entirety, (2)
8 * distributions including binary code include the above copyright notice and
9 * this paragraph in its entirety in the documentation or other materials
10 * provided with the distribution, and (3) all advertising materials mentioning
11 * features or use of this software display the following acknowledgement:
12 * ``This product includes software developed by the University of California,
13 * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
14 * the University nor the names of its contributors may be used to endorse
15 * or promote products derived from this software without specific prior
16 * written permission.
17 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
18 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
19 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
20 *
21 * @(#) $Header: llc.h,v 1.4 94/06/14 20:11:46 leres Exp $ (LBL)
22 */
23
24/*
25 * This stuff should come from a system header file, but there's no
26 * obviously portable way to do that and it's not really going
27 * to change from system to system.
28 */
29
30/*
31 * A somewhat abstracted view of the LLC header
32 */
33
34struct llc {
35	u_char dsap;
36	u_char ssap;
37	union {
38		u_char u_ctl;
39		u_short is_ctl;
40		struct {
41			u_char snap_ui;
42			u_char snap_pi[5];
43		} snap;
44		struct {
45			u_char snap_ui;
46			u_char snap_orgcode[3];
47			u_char snap_ethertype[2];
48		} snap_ether;
49	} ctl;
50};
51
52#define	llcui		ctl.snap.snap_ui
53#define	llcpi		ctl.snap.snap_pi
54#define	orgcode		ctl.snap_ether.snap_orgcode
55#define	ethertype	ctl.snap_ether.snap_ethertype
56#define	llcis		ctl.is_ctl
57#define	llcu		ctl.u_ctl
58
59#define	LLC_U_FMT	3
60#define	LLC_GSAP	1
61#define LLC_S_FMT	1
62
63#define	LLC_U_POLL	0x10
64#define	LLC_IS_POLL	0x0001
65#define	LLC_XID_FI	0x81
66
67#define	LLC_U_CMD(u)	((u) & 0xef)
68#define	LLC_UI		0x03
69#define	LLC_UA		0x63
70#define	LLC_DISC	0x43
71#define	LLC_DM		0x0f
72#define	LLC_SABME	0x6f
73#define	LLC_TEST	0xe3
74#define	LLC_XID		0xaf
75#define	LLC_FRMR	0x87
76
77#define	LLC_S_CMD(is)	(((is) >> 10) & 0x03)
78#define	LLC_RR		0x0100
79#define	LLC_RNR		0x0500
80#define	LLC_REJ		0x0900
81
82#define LLC_IS_NR(is)	(((is) >> 9) & 0x7f)
83#define LLC_I_NS(is)	(((is) >> 1) & 0x7f)
84
85#ifndef LLCSAP_NULL
86#define	LLCSAP_NULL		0x00
87#endif
88#ifndef LLCSAP_GLOBAL
89#define	LLCSAP_GLOBAL		0xff
90#endif
91#ifndef LLCSAP_8021B
92#define	LLCSAP_8021B_I		0x02
93#endif
94#ifndef LLCSAP_8021B
95#define	LLCSAP_8021B_G		0x03
96#endif
97#ifndef LLCSAP_IP
98#define	LLCSAP_IP		0x06
99#endif
100#ifndef LLCSAP_PROWAYNM
101#define	LLCSAP_PROWAYNM		0x0e
102#endif
103#ifndef LLCSAP_8021D
104#define	LLCSAP_8021D		0x42
105#endif
106#ifndef LLCSAP_RS511
107#define	LLCSAP_RS511		0x4e
108#endif
109#ifndef LLCSAP_ISO8208
110#define	LLCSAP_ISO8208		0x7e
111#endif
112#ifndef LLCSAP_PROWAY
113#define	LLCSAP_PROWAY		0x8e
114#endif
115#ifndef LLCSAP_SNAP
116#define	LLCSAP_SNAP		0xaa
117#endif
118#ifndef LLCSAP_ISONS
119#define	LLCSAP_ISONS		0xfe
120#endif
121