193366Smdodd/* $NetBSD: if_llc.h,v 1.12 1999/11/19 20:41:19 thorpej Exp $ */ 293366Smdodd 3139823Simp/*- 41541Srgrimes * Copyright (c) 1988, 1993 51541Srgrimes * The Regents of the University of California. All rights reserved. 61541Srgrimes * 71541Srgrimes * Redistribution and use in source and binary forms, with or without 81541Srgrimes * modification, are permitted provided that the following conditions 91541Srgrimes * are met: 101541Srgrimes * 1. Redistributions of source code must retain the above copyright 111541Srgrimes * notice, this list of conditions and the following disclaimer. 121541Srgrimes * 2. Redistributions in binary form must reproduce the above copyright 131541Srgrimes * notice, this list of conditions and the following disclaimer in the 141541Srgrimes * documentation and/or other materials provided with the distribution. 151541Srgrimes * 4. Neither the name of the University nor the names of its contributors 161541Srgrimes * may be used to endorse or promote products derived from this software 171541Srgrimes * without specific prior written permission. 181541Srgrimes * 191541Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 201541Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 211541Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 221541Srgrimes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 231541Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 241541Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 251541Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 261541Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 271541Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 281541Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 291541Srgrimes * SUCH DAMAGE. 301541Srgrimes * 3193366Smdodd * @(#)if_llc.h 8.1 (Berkeley) 6/10/93 3250477Speter * $FreeBSD$ 331541Srgrimes */ 341541Srgrimes 352168Spaul#ifndef _NET_IF_LLC_H_ 362168Spaul#define _NET_IF_LLC_H_ 372168Spaul 381541Srgrimes/* 391541Srgrimes * IEEE 802.2 Link Level Control headers, for use in conjunction with 401541Srgrimes * 802.{3,4,5} media access control methods. 411541Srgrimes * 4293366Smdodd * Headers here do not use bit fields due to shortcommings in many 431541Srgrimes * compilers. 441541Srgrimes */ 451541Srgrimes 461541Srgrimesstruct llc { 4793366Smdodd u_int8_t llc_dsap; 4893366Smdodd u_int8_t llc_ssap; 491541Srgrimes union { 501541Srgrimes struct { 5193366Smdodd u_int8_t control; 5293366Smdodd u_int8_t format_id; 5393366Smdodd u_int8_t class; 5493366Smdodd u_int8_t window_x2; 55164804Simp } __packed type_u; 561541Srgrimes struct { 5793366Smdodd u_int8_t num_snd_x2; 5893366Smdodd u_int8_t num_rcv_x2; 59164804Simp } __packed type_i; 601541Srgrimes struct { 6193366Smdodd u_int8_t control; 6293366Smdodd u_int8_t num_rcv_x2; 63164804Simp } __packed type_s; 641541Srgrimes struct { 6593366Smdodd u_int8_t control; 6693366Smdodd /* 6793366Smdodd * We cannot put the following fields in a structure because 6893366Smdodd * the structure rounding might cause padding. 6993366Smdodd */ 7093366Smdodd u_int8_t frmr_rej_pdu0; 7193366Smdodd u_int8_t frmr_rej_pdu1; 7293366Smdodd u_int8_t frmr_control; 7393366Smdodd u_int8_t frmr_control_ext; 7493366Smdodd u_int8_t frmr_cause; 75164804Simp } __packed type_frmr; 761541Srgrimes struct { 7793366Smdodd u_int8_t control; 7893366Smdodd u_int8_t org_code[3]; 7993366Smdodd u_int16_t ether_type; 80164804Simp } __packed type_snap; 811541Srgrimes struct { 8293366Smdodd u_int8_t control; 8393366Smdodd u_int8_t control_ext; 84164804Simp } __packed type_raw; 85164804Simp } __packed llc_un; 86103842Salfred} __packed; 871541Srgrimes 8893366Smdoddstruct frmrinfo { 8993366Smdodd u_int8_t frmr_rej_pdu0; 9093366Smdodd u_int8_t frmr_rej_pdu1; 9193366Smdodd u_int8_t frmr_control; 9293366Smdodd u_int8_t frmr_control_ext; 9393366Smdodd u_int8_t frmr_cause; 94103842Salfred} __packed; 9593366Smdodd 9693366Smdodd#define llc_control llc_un.type_u.control 9793366Smdodd#define llc_control_ext llc_un.type_raw.control_ext 9893366Smdodd#define llc_fid llc_un.type_u.format_id 9993366Smdodd#define llc_class llc_un.type_u.class 10093366Smdodd#define llc_window llc_un.type_u.window_x2 10193366Smdodd#define llc_frmrinfo llc_un.type_frmr.frmr_rej_pdu0 10293366Smdodd#define llc_frmr_pdu0 llc_un.type_frmr.frmr_rej_pdu0 10393366Smdodd#define llc_frmr_pdu1 llc_un.type_frmr.frmr_rej_pdu1 10493366Smdodd#define llc_frmr_control llc_un.type_frmr.frmr_control 10593366Smdodd#define llc_frmr_control_ext llc_un.type_frmr.frmr_control_ext 10693366Smdodd#define llc_frmr_cause llc_un.type_frmr.frmr_cause 10793366Smdodd#define llc_snap llc_un.type_snap 10893366Smdodd 1091541Srgrimes/* 1101541Srgrimes * Don't use sizeof(struct llc_un) for LLC header sizes 1111541Srgrimes */ 1121541Srgrimes#define LLC_ISFRAMELEN 4 1131541Srgrimes#define LLC_UFRAMELEN 3 1141541Srgrimes#define LLC_FRMRLEN 7 11593366Smdodd#define LLC_SNAPFRAMELEN 8 1161541Srgrimes 117164804Simp#ifdef CTASSERT 118164804SimpCTASSERT(sizeof (struct llc) == LLC_SNAPFRAMELEN); 119164804Simp#endif 120164804Simp 1211541Srgrimes/* 1221541Srgrimes * Unnumbered LLC format commands 1231541Srgrimes */ 1241541Srgrimes#define LLC_UI 0x3 1251541Srgrimes#define LLC_UI_P 0x13 1261541Srgrimes#define LLC_DISC 0x43 1271541Srgrimes#define LLC_DISC_P 0x53 1281541Srgrimes#define LLC_UA 0x63 1291541Srgrimes#define LLC_UA_P 0x73 1301541Srgrimes#define LLC_TEST 0xe3 1311541Srgrimes#define LLC_TEST_P 0xf3 1321541Srgrimes#define LLC_FRMR 0x87 1331541Srgrimes#define LLC_FRMR_P 0x97 1341541Srgrimes#define LLC_DM 0x0f 1351541Srgrimes#define LLC_DM_P 0x1f 1361541Srgrimes#define LLC_XID 0xaf 1371541Srgrimes#define LLC_XID_P 0xbf 1381541Srgrimes#define LLC_SABME 0x6f 1391541Srgrimes#define LLC_SABME_P 0x7f 1401541Srgrimes 1411541Srgrimes/* 1421541Srgrimes * Supervisory LLC commands 1431541Srgrimes */ 1441541Srgrimes#define LLC_RR 0x01 1451541Srgrimes#define LLC_RNR 0x05 1461541Srgrimes#define LLC_REJ 0x09 1471541Srgrimes 1481541Srgrimes/* 1491541Srgrimes * Info format - dummy only 1501541Srgrimes */ 1511541Srgrimes#define LLC_INFO 0x00 1521541Srgrimes 1531541Srgrimes/* 1541541Srgrimes * ISO PDTR 10178 contains among others 1551541Srgrimes */ 156146986Sthompsa#define LLC_8021D_LSAP 0x42 1571541Srgrimes#define LLC_X25_LSAP 0x7e 1581541Srgrimes#define LLC_SNAP_LSAP 0xaa 1591541Srgrimes#define LLC_ISO_LSAP 0xfe 1601541Srgrimes 16193366Smdodd#endif /* _NET_IF_LLC_H_ */ 162