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