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