iso88025.h revision 50477
144165Sjulian/* 244165Sjulian * Copyright (c) 1998, Larry Lile 344165Sjulian * All rights reserved. 444165Sjulian * 544165Sjulian * For latest sources and information on this driver, please 644165Sjulian * go to http://anarchy.stdio.com. 744165Sjulian * 844165Sjulian * Questions, comments or suggestions should be directed to 944165Sjulian * Larry Lile <lile@stdio.com>. 1044165Sjulian * 1144165Sjulian * Redistribution and use in source and binary forms, with or without 1244165Sjulian * modification, are permitted provided that the following conditions 1344165Sjulian * are met: 1444165Sjulian * 1. Redistributions of source code must retain the above copyright 1544165Sjulian * notice unmodified, this list of conditions, and the following 1644165Sjulian * disclaimer. 1744165Sjulian * 2. Redistributions in binary form must reproduce the above copyright 1844165Sjulian * notice, this list of conditions and the following disclaimer in the 1944165Sjulian * documentation and/or other materials provided with the distribution. 2044165Sjulian * 2144165Sjulian * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 2244165Sjulian * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2344165Sjulian * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2444165Sjulian * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 2544165Sjulian * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2644165Sjulian * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2744165Sjulian * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2844165Sjulian * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2944165Sjulian * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 3044165Sjulian * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3144165Sjulian * SUCH DAMAGE. 3244165Sjulian * 3350477Speter * $FreeBSD: head/sys/net/iso88025.h 50477 1999-08-28 01:08:13Z peter $ 3444165Sjulian * 3544165Sjulian * Information gathered from tokenring@freebsd, /sys/net/ethernet.h and 3644165Sjulian * the Mach token ring driver. 3744165Sjulian */ 3844165Sjulian 3944165Sjulian/* 4044165Sjulian * Fundamental constants relating to iso 802.5 4144165Sjulian */ 4244165Sjulian 4344165Sjulian#ifndef _NET_ISO88025_H_ 4444165Sjulian#define _NET_ISO88025_H_ 4544165Sjulian 4644165Sjulian/* 4744165Sjulian * The number of bytes in an iso 802.5 (MAC) address. 4844165Sjulian */ 4944165Sjulian#define ISO88025_ADDR_LEN 6 5044165Sjulian 5144165Sjulian/* 5244165Sjulian */ 5344165Sjulian#define ISO88025_HDR_LEN (ISO88025_CF_LEN + ISO88025_ADDR_LEN*2) 5444165Sjulian#define ISO88025_CF_LEN 2 5544165Sjulian#define RCF_LEN 2 5644165Sjulian#define RIF_LEN 16 5744165Sjulian 5844165Sjulian 5944165Sjulian/* 6044165Sjulian * The minimum packet length. 6144165Sjulian */ 6244165Sjulian#define ISO88025_MIN_LEN 0 /* This offends my morality */ 6344165Sjulian 6444165Sjulian/* 6544165Sjulian * The maximum packet length. 6644165Sjulian */ 6744165Sjulian#define ISO88025_MAX_LEN 17960 6844165Sjulian 6944165Sjulian/* 7044165Sjulian * A macro to validate a length with 7144165Sjulian */ 7244165Sjulian#define ISO88025_IS_VALID_LEN(foo) \ 7344165Sjulian ((foo) >= ISO88025_MIN_LEN && (foo) <= ISO88025_MAX_LEN) 7444165Sjulian 7544165Sjulian/* 7644165Sjulian * ISO 802.5 physical header 7744165Sjulian */ 7844165Sjulianstruct iso88025_header { 7944165Sjulian u_char ac; /* access control field */ 8044165Sjulian u_char fc; /* frame control field */ 8144165Sjulian u_char iso88025_dhost[ISO88025_ADDR_LEN]; /* destination address */ 8244165Sjulian u_char iso88025_shost[ISO88025_ADDR_LEN]; /* source address */ 8344165Sjulian u_short rcf; /* route control field */ 8444165Sjulian u_short rseg[RIF_LEN]; /* routing registers */ 8544165Sjulian}; 8644165Sjulian 8744627Sjulianstruct iso88025_sockaddr_data { 8844627Sjulian u_char ether_dhost[ISO88025_ADDR_LEN]; 8944627Sjulian u_char ether_shost[ISO88025_ADDR_LEN]; 9044627Sjulian u_char ac; 9144627Sjulian u_char fc; 9244627Sjulian}; 9344627Sjulian 9444165Sjulian/* 9544165Sjulian * Structure of a 48-bit iso 802.5 address. 9644165Sjulian * ( We could also add the 16 bit addresses as a union) 9744165Sjulian */ 9844165Sjulianstruct iso88025_addr { 9944165Sjulian u_char octet[ISO88025_ADDR_LEN]; 10044165Sjulian}; 10144165Sjulian 10244165Sjulian#define ISO88025MTU 18000 10344165Sjulian#define ISO88025_DEFAULT_MTU 1500 10444165Sjulian#define senderr(e) { error = (e); goto bad;} 10544165Sjulian 10644165Sjulianvoid iso88025_ifattach __P((struct ifnet *)); 10744165Sjulianint iso88025_ioctl __P((struct ifnet *, int , caddr_t )); 10844165Sjulianint iso88025_output __P((struct ifnet *, struct mbuf *, struct sockaddr *, struct rtentry *)); 10944165Sjulianvoid iso88025_input __P((struct ifnet *, struct iso88025_header *, struct mbuf *)); 11044165Sjulian 11144165Sjulian 11244165Sjulian#endif 113