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 * @(#)if_llc.h 8.1 (Berkeley) 6/10/93 34c3aac50fSPeter Wemm * $FreeBSD$ 35df8bae1dSRodney W. Grimes */ 36df8bae1dSRodney W. Grimes 37cea1da3bSPaul Richards #ifndef _NET_IF_LLC_H_ 38cea1da3bSPaul Richards #define _NET_IF_LLC_H_ 39cea1da3bSPaul Richards 40df8bae1dSRodney W. Grimes /* 41df8bae1dSRodney W. Grimes * IEEE 802.2 Link Level Control headers, for use in conjunction with 42df8bae1dSRodney W. Grimes * 802.{3,4,5} media access control methods. 43df8bae1dSRodney W. Grimes * 44e957d912SMatthew N. Dodd * Headers here do not use bit fields due to shortcommings in many 45df8bae1dSRodney W. Grimes * compilers. 46df8bae1dSRodney W. Grimes */ 47df8bae1dSRodney W. Grimes 48df8bae1dSRodney W. Grimes struct llc { 49e957d912SMatthew N. Dodd u_int8_t llc_dsap; 50e957d912SMatthew N. Dodd u_int8_t llc_ssap; 51df8bae1dSRodney W. Grimes union { 52df8bae1dSRodney W. Grimes struct { 53e957d912SMatthew N. Dodd u_int8_t control; 54e957d912SMatthew N. Dodd u_int8_t format_id; 55e957d912SMatthew N. Dodd u_int8_t class; 56e957d912SMatthew N. Dodd u_int8_t window_x2; 57ff432341SWarner Losh } __packed type_u; 58df8bae1dSRodney W. Grimes struct { 59e957d912SMatthew N. Dodd u_int8_t num_snd_x2; 60e957d912SMatthew N. Dodd u_int8_t num_rcv_x2; 61ff432341SWarner Losh } __packed type_i; 62df8bae1dSRodney W. Grimes struct { 63e957d912SMatthew N. Dodd u_int8_t control; 64e957d912SMatthew N. Dodd u_int8_t num_rcv_x2; 65ff432341SWarner Losh } __packed type_s; 66df8bae1dSRodney W. Grimes struct { 67e957d912SMatthew N. Dodd u_int8_t control; 68e957d912SMatthew N. Dodd /* 69e957d912SMatthew N. Dodd * We cannot put the following fields in a structure because 70e957d912SMatthew N. Dodd * the structure rounding might cause padding. 71e957d912SMatthew N. Dodd */ 72e957d912SMatthew N. Dodd u_int8_t frmr_rej_pdu0; 73e957d912SMatthew N. Dodd u_int8_t frmr_rej_pdu1; 74e957d912SMatthew N. Dodd u_int8_t frmr_control; 75e957d912SMatthew N. Dodd u_int8_t frmr_control_ext; 76e957d912SMatthew N. Dodd u_int8_t frmr_cause; 77ff432341SWarner Losh } __packed type_frmr; 78e957d912SMatthew N. Dodd struct { 79e957d912SMatthew N. Dodd u_int8_t control; 80e957d912SMatthew N. Dodd u_int8_t org_code[3]; 81e957d912SMatthew N. Dodd u_int16_t ether_type; 82ff432341SWarner Losh } __packed type_snap; 83e957d912SMatthew N. Dodd struct { 84e957d912SMatthew N. Dodd u_int8_t control; 85e957d912SMatthew N. Dodd u_int8_t control_ext; 86ff432341SWarner Losh } __packed type_raw; 87ff432341SWarner Losh } __packed llc_un; 88ebc82cbbSAlfred Perlstein } __packed; 89e957d912SMatthew N. Dodd 90df8bae1dSRodney W. Grimes struct frmrinfo { 91e957d912SMatthew N. Dodd u_int8_t frmr_rej_pdu0; 92e957d912SMatthew N. Dodd u_int8_t frmr_rej_pdu1; 93e957d912SMatthew N. Dodd u_int8_t frmr_control; 94e957d912SMatthew N. Dodd u_int8_t frmr_control_ext; 95e957d912SMatthew N. Dodd u_int8_t frmr_cause; 96ebc82cbbSAlfred Perlstein } __packed; 97e957d912SMatthew N. Dodd 98df8bae1dSRodney W. Grimes #define llc_control llc_un.type_u.control 99df8bae1dSRodney W. Grimes #define llc_control_ext llc_un.type_raw.control_ext 100df8bae1dSRodney W. Grimes #define llc_fid llc_un.type_u.format_id 101df8bae1dSRodney W. Grimes #define llc_class llc_un.type_u.class 102df8bae1dSRodney W. Grimes #define llc_window llc_un.type_u.window_x2 103e957d912SMatthew N. Dodd #define llc_frmrinfo llc_un.type_frmr.frmr_rej_pdu0 104e957d912SMatthew N. Dodd #define llc_frmr_pdu0 llc_un.type_frmr.frmr_rej_pdu0 105e957d912SMatthew N. Dodd #define llc_frmr_pdu1 llc_un.type_frmr.frmr_rej_pdu1 106e957d912SMatthew N. Dodd #define llc_frmr_control llc_un.type_frmr.frmr_control 107e957d912SMatthew N. Dodd #define llc_frmr_control_ext llc_un.type_frmr.frmr_control_ext 108e957d912SMatthew N. Dodd #define llc_frmr_cause llc_un.type_frmr.frmr_cause 109e957d912SMatthew N. Dodd #define llc_snap llc_un.type_snap 110df8bae1dSRodney W. Grimes 111df8bae1dSRodney W. Grimes /* 112df8bae1dSRodney W. Grimes * Don't use sizeof(struct llc_un) for LLC header sizes 113df8bae1dSRodney W. Grimes */ 114df8bae1dSRodney W. Grimes #define LLC_ISFRAMELEN 4 115df8bae1dSRodney W. Grimes #define LLC_UFRAMELEN 3 116df8bae1dSRodney W. Grimes #define LLC_FRMRLEN 7 117e957d912SMatthew N. Dodd #define LLC_SNAPFRAMELEN 8 118df8bae1dSRodney W. Grimes 119ff432341SWarner Losh #ifdef CTASSERT 120ff432341SWarner Losh CTASSERT(sizeof (struct llc) == LLC_SNAPFRAMELEN); 121ff432341SWarner Losh #endif 122ff432341SWarner Losh 123df8bae1dSRodney W. Grimes /* 124df8bae1dSRodney W. Grimes * Unnumbered LLC format commands 125df8bae1dSRodney W. Grimes */ 126df8bae1dSRodney W. Grimes #define LLC_UI 0x3 127df8bae1dSRodney W. Grimes #define LLC_UI_P 0x13 128df8bae1dSRodney W. Grimes #define LLC_DISC 0x43 129df8bae1dSRodney W. Grimes #define LLC_DISC_P 0x53 130df8bae1dSRodney W. Grimes #define LLC_UA 0x63 131df8bae1dSRodney W. Grimes #define LLC_UA_P 0x73 132df8bae1dSRodney W. Grimes #define LLC_TEST 0xe3 133df8bae1dSRodney W. Grimes #define LLC_TEST_P 0xf3 134df8bae1dSRodney W. Grimes #define LLC_FRMR 0x87 135df8bae1dSRodney W. Grimes #define LLC_FRMR_P 0x97 136df8bae1dSRodney W. Grimes #define LLC_DM 0x0f 137df8bae1dSRodney W. Grimes #define LLC_DM_P 0x1f 138df8bae1dSRodney W. Grimes #define LLC_XID 0xaf 139df8bae1dSRodney W. Grimes #define LLC_XID_P 0xbf 140df8bae1dSRodney W. Grimes #define LLC_SABME 0x6f 141df8bae1dSRodney W. Grimes #define LLC_SABME_P 0x7f 142df8bae1dSRodney W. Grimes 143df8bae1dSRodney W. Grimes /* 144df8bae1dSRodney W. Grimes * Supervisory LLC commands 145df8bae1dSRodney W. Grimes */ 146df8bae1dSRodney W. Grimes #define LLC_RR 0x01 147df8bae1dSRodney W. Grimes #define LLC_RNR 0x05 148df8bae1dSRodney W. Grimes #define LLC_REJ 0x09 149df8bae1dSRodney W. Grimes 150df8bae1dSRodney W. Grimes /* 151df8bae1dSRodney W. Grimes * Info format - dummy only 152df8bae1dSRodney W. Grimes */ 153df8bae1dSRodney W. Grimes #define LLC_INFO 0x00 154df8bae1dSRodney W. Grimes 155df8bae1dSRodney W. Grimes /* 156df8bae1dSRodney W. Grimes * ISO PDTR 10178 contains among others 157df8bae1dSRodney W. Grimes */ 1588f867517SAndrew Thompson #define LLC_8021D_LSAP 0x42 159df8bae1dSRodney W. Grimes #define LLC_X25_LSAP 0x7e 160df8bae1dSRodney W. Grimes #define LLC_SNAP_LSAP 0xaa 161df8bae1dSRodney W. Grimes #define LLC_ISO_LSAP 0xfe 162df8bae1dSRodney W. Grimes 163e957d912SMatthew N. Dodd #endif /* _NET_IF_LLC_H_ */ 164