if_llc.h revision 1541
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
341541Srgrimes */
351541Srgrimes
361541Srgrimes/*
371541Srgrimes * IEEE 802.2 Link Level Control headers, for use in conjunction with
381541Srgrimes * 802.{3,4,5} media access control methods.
391541Srgrimes *
401541Srgrimes * Headers here do not use bit fields due to shortcommings in many
411541Srgrimes * compilers.
421541Srgrimes */
431541Srgrimes
441541Srgrimesstruct llc {
451541Srgrimes	u_char	llc_dsap;
461541Srgrimes	u_char	llc_ssap;
471541Srgrimes	union {
481541Srgrimes	    struct {
491541Srgrimes		u_char control;
501541Srgrimes		u_char format_id;
511541Srgrimes		u_char class;
521541Srgrimes		u_char window_x2;
531541Srgrimes	    } type_u;
541541Srgrimes	    struct {
551541Srgrimes		u_char num_snd_x2;
561541Srgrimes		u_char num_rcv_x2;
571541Srgrimes	    } type_i;
581541Srgrimes	    struct {
591541Srgrimes		u_char control;
601541Srgrimes		u_char num_rcv_x2;
611541Srgrimes	    } type_s;
621541Srgrimes	    struct {
631541Srgrimes	        u_char control;
641541Srgrimes		struct frmrinfo {
651541Srgrimes			u_char rej_pdu_0;
661541Srgrimes			u_char rej_pdu_1;
671541Srgrimes			u_char frmr_control;
681541Srgrimes			u_char frmr_control_ext;
691541Srgrimes			u_char frmr_cause;
701541Srgrimes		} frmrinfo;
711541Srgrimes	    } type_frmr;
721541Srgrimes	    struct {
731541Srgrimes		u_char control;
741541Srgrimes		u_char org_code[3];
751541Srgrimes		u_short ether_type;
761541Srgrimes	    } type_snap;
771541Srgrimes	    struct {
781541Srgrimes		u_char control;
791541Srgrimes		u_char control_ext;
801541Srgrimes	    } type_raw;
811541Srgrimes	} llc_un;
821541Srgrimes};
831541Srgrimes#define llc_control            llc_un.type_u.control
841541Srgrimes#define	llc_control_ext        llc_un.type_raw.control_ext
851541Srgrimes#define llc_fid                llc_un.type_u.format_id
861541Srgrimes#define llc_class              llc_un.type_u.class
871541Srgrimes#define llc_window             llc_un.type_u.window_x2
881541Srgrimes#define llc_frmrinfo           llc_un.type_frmr.frmrinfo
891541Srgrimes#define llc_frmr_pdu0          llc_un.type_frmr.frmrinfo.rej_pdu0
901541Srgrimes#define llc_frmr_pdu1          llc_un.type_frmr.frmrinfo.rej_pdu1
911541Srgrimes#define llc_frmr_control       llc_un.type_frmr.frmrinfo.frmr_control
921541Srgrimes#define llc_frmr_control_ext   llc_un.type_frmr.frmrinfo.frmr_control_ext
931541Srgrimes#define llc_frmr_cause         llc_un.type_frmr.frmrinfo.frmr_control_ext
941541Srgrimes
951541Srgrimes/*
961541Srgrimes * Don't use sizeof(struct llc_un) for LLC header sizes
971541Srgrimes */
981541Srgrimes#define LLC_ISFRAMELEN 4
991541Srgrimes#define LLC_UFRAMELEN  3
1001541Srgrimes#define LLC_FRMRLEN    7
1011541Srgrimes
1021541Srgrimes/*
1031541Srgrimes * Unnumbered LLC format commands
1041541Srgrimes */
1051541Srgrimes#define LLC_UI		0x3
1061541Srgrimes#define LLC_UI_P	0x13
1071541Srgrimes#define LLC_DISC	0x43
1081541Srgrimes#define	LLC_DISC_P	0x53
1091541Srgrimes#define LLC_UA		0x63
1101541Srgrimes#define LLC_UA_P	0x73
1111541Srgrimes#define LLC_TEST	0xe3
1121541Srgrimes#define LLC_TEST_P	0xf3
1131541Srgrimes#define LLC_FRMR	0x87
1141541Srgrimes#define	LLC_FRMR_P	0x97
1151541Srgrimes#define LLC_DM		0x0f
1161541Srgrimes#define	LLC_DM_P	0x1f
1171541Srgrimes#define LLC_XID		0xaf
1181541Srgrimes#define LLC_XID_P	0xbf
1191541Srgrimes#define LLC_SABME	0x6f
1201541Srgrimes#define LLC_SABME_P	0x7f
1211541Srgrimes
1221541Srgrimes/*
1231541Srgrimes * Supervisory LLC commands
1241541Srgrimes */
1251541Srgrimes#define	LLC_RR		0x01
1261541Srgrimes#define	LLC_RNR		0x05
1271541Srgrimes#define	LLC_REJ		0x09
1281541Srgrimes
1291541Srgrimes/*
1301541Srgrimes * Info format - dummy only
1311541Srgrimes */
1321541Srgrimes#define	LLC_INFO	0x00
1331541Srgrimes
1341541Srgrimes/*
1351541Srgrimes * ISO PDTR 10178 contains among others
1361541Srgrimes */
1371541Srgrimes#define LLC_X25_LSAP	0x7e
1381541Srgrimes#define LLC_SNAP_LSAP	0xaa
1391541Srgrimes#define LLC_ISO_LSAP	0xfe
1401541Srgrimes
1411541Srgrimes
1421541Srgrimes
1431541Srgrimes
1441541Srgrimes
1451541Srgrimes
146