xref: /linux/include/uapi/linux/if_fddi.h (revision 8be98d2f2a0a262f8bf8a0bc1fdf522b3c7aab17)
1e2be04c7SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
2607ca46eSDavid Howells /*
3607ca46eSDavid Howells  * INET		An implementation of the TCP/IP protocol suite for the LINUX
4607ca46eSDavid Howells  *		operating system.  INET is implemented using the BSD Socket
5607ca46eSDavid Howells  *		interface as the means of communication with the user level.
6607ca46eSDavid Howells  *
7607ca46eSDavid Howells  *		Global definitions for the ANSI FDDI interface.
8607ca46eSDavid Howells  *
961414f5eSMaciej W. Rozycki  * Version:	@(#)if_fddi.h	1.0.3	Oct  6 2018
10607ca46eSDavid Howells  *
1161414f5eSMaciej W. Rozycki  * Author:	Lawrence V. Stefani, <stefani@yahoo.com>
12*e56763eeSMaciej W. Rozycki  * Maintainer:	Maciej W. Rozycki, <macro@orcam.me.uk>
13607ca46eSDavid Howells  *
14607ca46eSDavid Howells  *		if_fddi.h is based on previous if_ether.h and if_tr.h work by
15607ca46eSDavid Howells  *			Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
16607ca46eSDavid Howells  *			Donald Becker, <becker@super.org>
17607ca46eSDavid Howells  *			Alan Cox, <alan@lxorguk.ukuu.org.uk>
18607ca46eSDavid Howells  *			Steve Whitehouse, <gw7rrm@eeshack3.swan.ac.uk>
19607ca46eSDavid Howells  *			Peter De Schrijver, <stud11@cc4.kuleuven.ac.be>
20607ca46eSDavid Howells  *
21607ca46eSDavid Howells  *		This program is free software; you can redistribute it and/or
22607ca46eSDavid Howells  *		modify it under the terms of the GNU General Public License
23607ca46eSDavid Howells  *		as published by the Free Software Foundation; either version
24607ca46eSDavid Howells  *		2 of the License, or (at your option) any later version.
25607ca46eSDavid Howells  */
26607ca46eSDavid Howells #ifndef _UAPI_LINUX_IF_FDDI_H
27607ca46eSDavid Howells #define _UAPI_LINUX_IF_FDDI_H
28607ca46eSDavid Howells 
29607ca46eSDavid Howells #include <linux/types.h>
30607ca46eSDavid Howells 
31607ca46eSDavid Howells /*
32607ca46eSDavid Howells  *  Define max and min legal sizes.  The frame sizes do not include
33607ca46eSDavid Howells  *  4 byte FCS/CRC (frame check sequence).
34607ca46eSDavid Howells  */
35607ca46eSDavid Howells #define FDDI_K_ALEN		6	/* Octets in one FDDI address */
36607ca46eSDavid Howells #define FDDI_K_8022_HLEN	16	/* Total octets in 802.2 header */
37607ca46eSDavid Howells #define FDDI_K_SNAP_HLEN	21	/* Total octets in 802.2 SNAP header */
38eb11022dSMaciej W. Rozycki #define FDDI_K_8022_ZLEN	16	/* Min octets in 802.2 frame sans
39eb11022dSMaciej W. Rozycki 					   FCS */
40eb11022dSMaciej W. Rozycki #define FDDI_K_SNAP_ZLEN	21	/* Min octets in 802.2 SNAP frame sans
41eb11022dSMaciej W. Rozycki 					   FCS */
42607ca46eSDavid Howells #define FDDI_K_8022_DLEN	4475	/* Max octets in 802.2 payload */
43607ca46eSDavid Howells #define FDDI_K_SNAP_DLEN	4470	/* Max octets in 802.2 SNAP payload */
44607ca46eSDavid Howells #define FDDI_K_LLC_ZLEN		13	/* Min octets in LLC frame sans FCS */
45607ca46eSDavid Howells #define FDDI_K_LLC_LEN		4491	/* Max octets in LLC frame sans FCS */
46eb11022dSMaciej W. Rozycki #define FDDI_K_OUI_LEN		3	/* Octets in OUI in 802.2 SNAP
47eb11022dSMaciej W. Rozycki 					   header */
48607ca46eSDavid Howells 
4961414f5eSMaciej W. Rozycki /* Define FDDI Frame Control (FC) Byte masks */
5061414f5eSMaciej W. Rozycki #define FDDI_FC_K_CLASS_MASK		0x80	/* class bit */
5161414f5eSMaciej W. Rozycki #define FDDI_FC_K_CLASS_SYNC		0x80
5261414f5eSMaciej W. Rozycki #define FDDI_FC_K_CLASS_ASYNC		0x00
5361414f5eSMaciej W. Rozycki #define FDDI_FC_K_ALEN_MASK		0x40	/* address length bit */
5461414f5eSMaciej W. Rozycki #define FDDI_FC_K_ALEN_48		0x40
5561414f5eSMaciej W. Rozycki #define FDDI_FC_K_ALEN_16		0x00
5661414f5eSMaciej W. Rozycki #define FDDI_FC_K_FORMAT_MASK		0x30	/* format bits */
5761414f5eSMaciej W. Rozycki #define FDDI_FC_K_FORMAT_FUTURE		0x30
5861414f5eSMaciej W. Rozycki #define FDDI_FC_K_FORMAT_IMPLEMENTOR	0x20
5961414f5eSMaciej W. Rozycki #define FDDI_FC_K_FORMAT_LLC		0x10
6061414f5eSMaciej W. Rozycki #define FDDI_FC_K_FORMAT_MANAGEMENT	0x00
6161414f5eSMaciej W. Rozycki #define FDDI_FC_K_CONTROL_MASK		0x0f	/* control bits */
6261414f5eSMaciej W. Rozycki 
6361414f5eSMaciej W. Rozycki /* Define FDDI Frame Control (FC) Byte specific values */
64607ca46eSDavid Howells #define FDDI_FC_K_VOID			0x00
65607ca46eSDavid Howells #define FDDI_FC_K_NON_RESTRICTED_TOKEN	0x80
66607ca46eSDavid Howells #define FDDI_FC_K_RESTRICTED_TOKEN	0xC0
67607ca46eSDavid Howells #define FDDI_FC_K_SMT_MIN		0x41
68607ca46eSDavid Howells #define FDDI_FC_K_SMT_MAX		0x4F
69607ca46eSDavid Howells #define FDDI_FC_K_MAC_MIN		0xC1
70607ca46eSDavid Howells #define FDDI_FC_K_MAC_MAX		0xCF
71607ca46eSDavid Howells #define FDDI_FC_K_ASYNC_LLC_MIN		0x50
72607ca46eSDavid Howells #define FDDI_FC_K_ASYNC_LLC_DEF		0x54
73607ca46eSDavid Howells #define FDDI_FC_K_ASYNC_LLC_MAX		0x5F
74607ca46eSDavid Howells #define FDDI_FC_K_SYNC_LLC_MIN		0xD0
75607ca46eSDavid Howells #define FDDI_FC_K_SYNC_LLC_MAX		0xD7
76607ca46eSDavid Howells #define FDDI_FC_K_IMPLEMENTOR_MIN	0x60
77607ca46eSDavid Howells #define FDDI_FC_K_IMPLEMENTOR_MAX	0x6F
78607ca46eSDavid Howells #define FDDI_FC_K_RESERVED_MIN		0x70
79607ca46eSDavid Howells #define FDDI_FC_K_RESERVED_MAX		0x7F
80607ca46eSDavid Howells 
81607ca46eSDavid Howells /* Define LLC and SNAP constants */
82607ca46eSDavid Howells #define FDDI_EXTENDED_SAP		0xAA
83607ca46eSDavid Howells #define FDDI_UI_CMD			0x03
84607ca46eSDavid Howells 
85607ca46eSDavid Howells /* Define 802.2 Type 1 header */
86607ca46eSDavid Howells struct fddi_8022_1_hdr {
87607ca46eSDavid Howells 	__u8	dsap;			/* destination service access point */
88607ca46eSDavid Howells 	__u8	ssap;			/* source service access point */
89607ca46eSDavid Howells 	__u8	ctrl;			/* control byte #1 */
90607ca46eSDavid Howells } __attribute__((packed));
91607ca46eSDavid Howells 
92607ca46eSDavid Howells /* Define 802.2 Type 2 header */
93607ca46eSDavid Howells struct fddi_8022_2_hdr {
94607ca46eSDavid Howells 	__u8	dsap;			/* destination service access point */
95607ca46eSDavid Howells 	__u8	ssap;			/* source service access point */
96607ca46eSDavid Howells 	__u8	ctrl_1;			/* control byte #1 */
97607ca46eSDavid Howells 	__u8	ctrl_2;			/* control byte #2 */
98607ca46eSDavid Howells } __attribute__((packed));
99607ca46eSDavid Howells 
100607ca46eSDavid Howells /* Define 802.2 SNAP header */
101607ca46eSDavid Howells struct fddi_snap_hdr {
102607ca46eSDavid Howells 	__u8	dsap;			/* always 0xAA */
103607ca46eSDavid Howells 	__u8	ssap;			/* always 0xAA */
104607ca46eSDavid Howells 	__u8	ctrl;			/* always 0x03 */
105607ca46eSDavid Howells 	__u8	oui[FDDI_K_OUI_LEN];	/* organizational universal id */
106607ca46eSDavid Howells 	__be16	ethertype;		/* packet type ID field */
107607ca46eSDavid Howells } __attribute__((packed));
108607ca46eSDavid Howells 
109607ca46eSDavid Howells /* Define FDDI LLC frame header */
110607ca46eSDavid Howells struct fddihdr {
111607ca46eSDavid Howells 	__u8	fc;			/* frame control */
112607ca46eSDavid Howells 	__u8	daddr[FDDI_K_ALEN];	/* destination address */
113607ca46eSDavid Howells 	__u8	saddr[FDDI_K_ALEN];	/* source address */
114eb11022dSMaciej W. Rozycki 	union {
115607ca46eSDavid Howells 		struct fddi_8022_1_hdr	llc_8022_1;
116607ca46eSDavid Howells 		struct fddi_8022_2_hdr	llc_8022_2;
117607ca46eSDavid Howells 		struct fddi_snap_hdr	llc_snap;
118607ca46eSDavid Howells 	} hdr;
119607ca46eSDavid Howells } __attribute__((packed));
120607ca46eSDavid Howells 
121607ca46eSDavid Howells 
122607ca46eSDavid Howells #endif /* _UAPI_LINUX_IF_FDDI_H */
123