llc.h revision 98524
117680Spst/*
239297Sfenner * Copyright (c) 1993, 1994, 1997
317680Spst *	The Regents of the University of California.  All rights reserved.
417680Spst *
517680Spst * Redistribution and use in source and binary forms, with or without
617680Spst * modification, are permitted provided that: (1) source code distributions
717680Spst * retain the above copyright notice and this paragraph in its entirety, (2)
817680Spst * distributions including binary code include the above copyright notice and
917680Spst * this paragraph in its entirety in the documentation or other materials
1017680Spst * provided with the distribution, and (3) all advertising materials mentioning
1117680Spst * features or use of this software display the following acknowledgement:
1217680Spst * ``This product includes software developed by the University of California,
1317680Spst * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
1417680Spst * the University nor the names of its contributors may be used to endorse
1517680Spst * or promote products derived from this software without specific prior
1617680Spst * written permission.
1717680Spst * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
1817680Spst * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
1917680Spst * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
2017680Spst *
2198524Sfenner * @(#) $Header: /tcpdump/master/tcpdump/llc.h,v 1.13 2001/06/04 05:47:13 guy Exp $ (LBL)
2217680Spst */
2317680Spst
2417680Spst/*
2517680Spst * This stuff should come from a system header file, but there's no
2617680Spst * obviously portable way to do that and it's not really going
2717680Spst * to change from system to system.
2817680Spst */
2917680Spst
3017680Spst/*
3117680Spst * A somewhat abstracted view of the LLC header
3217680Spst */
3317680Spst
3417680Spststruct llc {
3575115Sfenner	u_int8_t dsap;
3675115Sfenner	u_int8_t ssap;
3717680Spst	union {
3875115Sfenner		u_int8_t u_ctl;
3975115Sfenner		u_int16_t is_ctl;
4017680Spst		struct {
4175115Sfenner			u_int8_t snap_ui;
4275115Sfenner			u_int8_t snap_pi[5];
4317680Spst		} snap;
4417680Spst		struct {
4575115Sfenner			u_int8_t snap_ui;
4675115Sfenner			u_int8_t snap_orgcode[3];
4775115Sfenner			u_int8_t snap_ethertype[2];
4817680Spst		} snap_ether;
4917680Spst	} ctl;
5017680Spst};
5117680Spst
5217680Spst#define	llcui		ctl.snap.snap_ui
5317680Spst#define	llcpi		ctl.snap.snap_pi
5498524Sfenner#define	llc_orgcode	ctl.snap_ether.snap_orgcode
5598524Sfenner#define	llc_ethertype	ctl.snap_ether.snap_ethertype
5617680Spst#define	llcis		ctl.is_ctl
5717680Spst#define	llcu		ctl.u_ctl
5817680Spst
5917680Spst#define	LLC_U_FMT	3
6017680Spst#define	LLC_GSAP	1
6117680Spst#define LLC_S_FMT	1
6217680Spst
6317680Spst#define	LLC_U_POLL	0x10
6475115Sfenner#define	LLC_IS_POLL	0x0100
6517680Spst#define	LLC_XID_FI	0x81
6617680Spst
6717680Spst#define	LLC_U_CMD(u)	((u) & 0xef)
6817680Spst#define	LLC_UI		0x03
6917680Spst#define	LLC_UA		0x63
7017680Spst#define	LLC_DISC	0x43
7117680Spst#define	LLC_DM		0x0f
7217680Spst#define	LLC_SABME	0x6f
7317680Spst#define	LLC_TEST	0xe3
7417680Spst#define	LLC_XID		0xaf
7517680Spst#define	LLC_FRMR	0x87
7617680Spst
7775115Sfenner#define	LLC_S_CMD(is)	(((is) >> 1) & 0x03)
7875115Sfenner#define	LLC_RR		0x0001
7975115Sfenner#define	LLC_RNR		0x0005
8075115Sfenner#define	LLC_REJ		0x0009
8117680Spst
8275115Sfenner#define LLC_IS_NR(is)	(((is) >> 9) & 0x7f)
8375115Sfenner#define LLC_I_NS(is)	(((is) >> 1) & 0x7f)
8417680Spst
8517680Spst#ifndef LLCSAP_NULL
8617680Spst#define	LLCSAP_NULL		0x00
8717680Spst#endif
8817680Spst#ifndef LLCSAP_GLOBAL
8917680Spst#define	LLCSAP_GLOBAL		0xff
9017680Spst#endif
9198524Sfenner#ifndef LLCSAP_8021B_I
9217680Spst#define	LLCSAP_8021B_I		0x02
9317680Spst#endif
9498524Sfenner#ifndef LLCSAP_8021B_G
9517680Spst#define	LLCSAP_8021B_G		0x03
9617680Spst#endif
9717680Spst#ifndef LLCSAP_IP
9817680Spst#define	LLCSAP_IP		0x06
9917680Spst#endif
10017680Spst#ifndef LLCSAP_PROWAYNM
10117680Spst#define	LLCSAP_PROWAYNM		0x0e
10217680Spst#endif
10317680Spst#ifndef LLCSAP_8021D
10417680Spst#define	LLCSAP_8021D		0x42
10517680Spst#endif
10617680Spst#ifndef LLCSAP_RS511
10717680Spst#define	LLCSAP_RS511		0x4e
10817680Spst#endif
10917680Spst#ifndef LLCSAP_ISO8208
11017680Spst#define	LLCSAP_ISO8208		0x7e
11117680Spst#endif
11217680Spst#ifndef LLCSAP_PROWAY
11317680Spst#define	LLCSAP_PROWAY		0x8e
11417680Spst#endif
11517680Spst#ifndef LLCSAP_SNAP
11617680Spst#define	LLCSAP_SNAP		0xaa
11717680Spst#endif
11898524Sfenner#ifndef LLCSAP_IPX
11998524Sfenner#define LLCSAP_IPX		0xe0
12098524Sfenner#endif
12198524Sfenner#ifndef LLCSAP_NETBEUI
12298524Sfenner#define LLCSAP_NETBEUI		0xf0
12398524Sfenner#endif
12417680Spst#ifndef LLCSAP_ISONS
12517680Spst#define	LLCSAP_ISONS		0xfe
12617680Spst#endif
12798524Sfenner
12898524Sfenner#define	OUI_ENCAP_ETHER	0x000000	/* encapsulated Ethernet */
12998524Sfenner#define	OUI_CISCO	0x00000c	/* Cisco protocols */
13098524Sfenner#define	ETHERTYPE_CISCO_CDP	0x2000	/* Cisco Discovery Protocol */
13198524Sfenner#define	OUI_CISCO_90	0x0000f8	/* Cisco bridging */
13298524Sfenner#define	OUI_APPLETALK	0x080007	/* Appletalk */
133