Click
Loading...
Searching...
No Matches
llc.h
1/*
2 * <clicknet/llc.h> - contains the definitions for llc frames.
3 * It was originally taken from freebsd and modified for click use.
4 * John Bicket
5 */
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 * $FreeBSD: src/sys/net/if_llc.h,v 1.7 1999/08/28 00:48:18 peter Exp $
41 */
42
43#ifndef CLICKNET_LLC_H
44#define CLICKNET_LLC_H
45
46/*
47 * IEEE 802.2 Link Level Control headers, for use in conjunction with
48 * 802.{3,4,5} media access control methods.
49 *
50 * Headers here do not use bit fields due to shortcomings in many
51 * compilers.
52 */
53
54struct click_llc {
55 uint8_t llc_dsap;
56 uint8_t llc_ssap;
57 union {
58 struct {
59 uint8_t control;
60 uint8_t format_id;
61 uint8_t _class;
62 uint8_t window_x2;
63 } type_u;
64 struct {
65 uint8_t num_snd_x2;
66 uint8_t num_rcv_x2;
67 } type_i;
68 struct {
69 uint8_t control;
70 uint8_t num_rcv_x2;
71 } type_s;
72 struct {
73 uint8_t control;
74 struct frmrinfo {
75 uint8_t rej_pdu_0;
76 uint8_t rej_pdu_1;
77 uint8_t frmr_control;
78 uint8_t frmr_control_ext;
79 uint8_t frmr_cause;
80 } frmrinfo;
81 } type_frmr;
82 struct {
83 uint8_t control;
84 uint8_t org_code[3];
85 uint16_t ether_type;
86 } type_snap;
87 struct {
88 uint8_t control;
89 uint8_t control_ext;
90 } type_raw;
91 } llc_un;
92} CLICK_SIZE_PACKED_ATTRIBUTE;
93
94#define llc_control llc_un.type_u.control
95#define llc_control_ext llc_un.type_raw.control_ext
96#define llc_fid llc_un.type_u.format_id
97#define llc_class llc_un.type_u._class
98#define llc_window llc_un.type_u.window_x2
99#define llc_frmrinfo llc_un.type_frmr.frmrinfo
100#define llc_frmr_pdu0 llc_un.type_frmr.frmrinfo.rej_pdu0
101#define llc_frmr_pdu1 llc_un.type_frmr.frmrinfo.rej_pdu1
102#define llc_frmr_control llc_un.type_frmr.frmrinfo.frmr_control
103#define llc_frmr_control_ext llc_un.type_frmr.frmrinfo.frmr_control_ext
104#define llc_frmr_cause llc_un.type_frmr.frmrinfo.frmr_control_ext
105
106/*
107 * Don't use sizeof(struct llc_un) for LLC header sizes
108 */
109#define LLC_ISFRAMELEN 4
110#define LLC_UFRAMELEN 3
111#define LLC_FRMRLEN 7
112
113/*
114 * Unnumbered LLC format commands
115 */
116#define LLC_UI 0x3
117#define LLC_UI_P 0x13
118#define LLC_DISC 0x43
119#define LLC_DISC_P 0x53
120#define LLC_UA 0x63
121#define LLC_UA_P 0x73
122#define LLC_TEST 0xe3
123#define LLC_TEST_P 0xf3
124#define LLC_FRMR 0x87
125#define LLC_FRMR_P 0x97
126#define LLC_DM 0x0f
127#define LLC_DM_P 0x1f
128#define LLC_XID 0xaf
129#define LLC_XID_P 0xbf
130#define LLC_SABME 0x6f
131#define LLC_SABME_P 0x7f
132
133/*
134 * Supervisory LLC commands
135 */
136#define LLC_RR 0x01
137#define LLC_RNR 0x05
138#define LLC_REJ 0x09
139
140/*
141 * Info format - dummy only
142 */
143#define LLC_INFO 0x00
144
145/*
146 * ISO PDTR 10178 contains among others
147 */
148#define LLC_IP_LSAP 0x06
149#define LLC_X25_LSAP 0x7e
150#define LLC_SNAP_LSAP 0xaa
151#define LLC_ISO_LSAP 0xfe
152
153#endif