if_llc.h revision 50477
11541Srgrimes/*
21541Srgrimes * Copyright (c) 1988, 1993
31541Srgrimes *	The Regents of the University of California.  All rights reserved.
41541Srgrimes *
51541Srgrimes * Redistribution and use in source and binary forms, with or without
61541Srgrimes * modification, are permitted provided that the following conditions
71541Srgrimes * are met:
81541Srgrimes * 1. Redistributions of source code must retain the above copyright
91541Srgrimes *    notice, this list of conditions and the following disclaimer.
101541Srgrimes * 2. Redistributions in binary form must reproduce the above copyright
111541Srgrimes *    notice, this list of conditions and the following disclaimer in the
121541Srgrimes *    documentation and/or other materials provided with the distribution.
131541Srgrimes * 3. All advertising materials mentioning features or use of this software
141541Srgrimes *    must display the following acknowledgement:
151541Srgrimes *	This product includes software developed by the University of
161541Srgrimes *	California, Berkeley and its contributors.
171541Srgrimes * 4. Neither the name of the University nor the names of its contributors
181541Srgrimes *    may be used to endorse or promote products derived from this software
191541Srgrimes *    without specific prior written permission.
201541Srgrimes *
211541Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
221541Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
231541Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
241541Srgrimes * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
251541Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
261541Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
271541Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
281541Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
291541Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
301541Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
311541Srgrimes * SUCH DAMAGE.
321541Srgrimes *
331541Srgrimes *      @(#)if_llc.h	8.1 (Berkeley) 6/10/93
3450477Speter * $FreeBSD: head/sys/net/if_llc.h 50477 1999-08-28 01:08:13Z peter $
351541Srgrimes */
361541Srgrimes
372168Spaul#ifndef _NET_IF_LLC_H_
382168Spaul#define _NET_IF_LLC_H_
392168Spaul
401541Srgrimes/*
411541Srgrimes * IEEE 802.2 Link Level Control headers, for use in conjunction with
421541Srgrimes * 802.{3,4,5} media access control methods.
431541Srgrimes *
4413765Smpp * Headers here do not use bit fields due to shortcomings in many
451541Srgrimes * compilers.
461541Srgrimes */
471541Srgrimes
481541Srgrimesstruct llc {
491541Srgrimes	u_char	llc_dsap;
501541Srgrimes	u_char	llc_ssap;
511541Srgrimes	union {
521541Srgrimes	    struct {
531541Srgrimes		u_char control;
541541Srgrimes		u_char format_id;
551541Srgrimes		u_char class;
561541Srgrimes		u_char window_x2;
571541Srgrimes	    } type_u;
581541Srgrimes	    struct {
591541Srgrimes		u_char num_snd_x2;
601541Srgrimes		u_char num_rcv_x2;
611541Srgrimes	    } type_i;
621541Srgrimes	    struct {
631541Srgrimes		u_char control;
641541Srgrimes		u_char num_rcv_x2;
651541Srgrimes	    } type_s;
661541Srgrimes	    struct {
671541Srgrimes	        u_char control;
681541Srgrimes		struct frmrinfo {
691541Srgrimes			u_char rej_pdu_0;
701541Srgrimes			u_char rej_pdu_1;
711541Srgrimes			u_char frmr_control;
721541Srgrimes			u_char frmr_control_ext;
731541Srgrimes			u_char frmr_cause;
741541Srgrimes		} frmrinfo;
751541Srgrimes	    } type_frmr;
761541Srgrimes	    struct {
771541Srgrimes		u_char control;
781541Srgrimes		u_char org_code[3];
791541Srgrimes		u_short ether_type;
801541Srgrimes	    } type_snap;
811541Srgrimes	    struct {
821541Srgrimes		u_char control;
831541Srgrimes		u_char control_ext;
841541Srgrimes	    } type_raw;
851541Srgrimes	} llc_un;
861541Srgrimes};
871541Srgrimes#define llc_control            llc_un.type_u.control
881541Srgrimes#define	llc_control_ext        llc_un.type_raw.control_ext
891541Srgrimes#define llc_fid                llc_un.type_u.format_id
901541Srgrimes#define llc_class              llc_un.type_u.class
911541Srgrimes#define llc_window             llc_un.type_u.window_x2
921541Srgrimes#define llc_frmrinfo           llc_un.type_frmr.frmrinfo
931541Srgrimes#define llc_frmr_pdu0          llc_un.type_frmr.frmrinfo.rej_pdu0
941541Srgrimes#define llc_frmr_pdu1          llc_un.type_frmr.frmrinfo.rej_pdu1
951541Srgrimes#define llc_frmr_control       llc_un.type_frmr.frmrinfo.frmr_control
961541Srgrimes#define llc_frmr_control_ext   llc_un.type_frmr.frmrinfo.frmr_control_ext
971541Srgrimes#define llc_frmr_cause         llc_un.type_frmr.frmrinfo.frmr_control_ext
981541Srgrimes
991541Srgrimes/*
1001541Srgrimes * Don't use sizeof(struct llc_un) for LLC header sizes
1011541Srgrimes */
1021541Srgrimes#define LLC_ISFRAMELEN 4
1031541Srgrimes#define LLC_UFRAMELEN  3
1041541Srgrimes#define LLC_FRMRLEN    7
1051541Srgrimes
1061541Srgrimes/*
1071541Srgrimes * Unnumbered LLC format commands
1081541Srgrimes */
1091541Srgrimes#define LLC_UI		0x3
1101541Srgrimes#define LLC_UI_P	0x13
1111541Srgrimes#define LLC_DISC	0x43
1121541Srgrimes#define	LLC_DISC_P	0x53
1131541Srgrimes#define LLC_UA		0x63
1141541Srgrimes#define LLC_UA_P	0x73
1151541Srgrimes#define LLC_TEST	0xe3
1161541Srgrimes#define LLC_TEST_P	0xf3
1171541Srgrimes#define LLC_FRMR	0x87
1181541Srgrimes#define	LLC_FRMR_P	0x97
1191541Srgrimes#define LLC_DM		0x0f
1201541Srgrimes#define	LLC_DM_P	0x1f
1211541Srgrimes#define LLC_XID		0xaf
1221541Srgrimes#define LLC_XID_P	0xbf
1231541Srgrimes#define LLC_SABME	0x6f
1241541Srgrimes#define LLC_SABME_P	0x7f
1251541Srgrimes
1261541Srgrimes/*
1271541Srgrimes * Supervisory LLC commands
1281541Srgrimes */
1291541Srgrimes#define	LLC_RR		0x01
1301541Srgrimes#define	LLC_RNR		0x05
1311541Srgrimes#define	LLC_REJ		0x09
1321541Srgrimes
1331541Srgrimes/*
1341541Srgrimes * Info format - dummy only
1351541Srgrimes */
1361541Srgrimes#define	LLC_INFO	0x00
1371541Srgrimes
1381541Srgrimes/*
1391541Srgrimes * ISO PDTR 10178 contains among others
1401541Srgrimes */
1411541Srgrimes#define LLC_X25_LSAP	0x7e
1421541Srgrimes#define LLC_SNAP_LSAP	0xaa
1431541Srgrimes#define LLC_ISO_LSAP	0xfe
1441541Srgrimes
1452168Spaul#endif
146