if_atm.h revision 92725
139213Sgibbs/* $NetBSD: if_atm.h,v 1.7 1996/11/09 23:02:27 chuck Exp $ */ 239213Sgibbs/* $FreeBSD: head/sys/net/if_atm.h 92725 2002-03-19 21:54:18Z alfred $ */ 3111206Sken 439213Sgibbs/* 539213Sgibbs * 639213Sgibbs * Copyright (c) 1996 Charles D. Cranor and Washington University. 739213Sgibbs * All rights reserved. 839213Sgibbs * 939213Sgibbs * Redistribution and use in source and binary forms, with or without 1039213Sgibbs * modification, are permitted provided that the following conditions 1139213Sgibbs * are met: 1239213Sgibbs * 1. Redistributions of source code must retain the above copyright 1339213Sgibbs * notice, this list of conditions and the following disclaimer. 1439213Sgibbs * 2. Redistributions in binary form must reproduce the above copyright 1539213Sgibbs * notice, this list of conditions and the following disclaimer in the 1639213Sgibbs * documentation and/or other materials provided with the distribution. 1739213Sgibbs * 3. All advertising materials mentioning features or use of this software 1839213Sgibbs * must display the following acknowledgement: 1939213Sgibbs * This product includes software developed by Charles D. Cranor and 2039213Sgibbs * Washington University. 2139213Sgibbs * 4. The name of the author may not be used to endorse or promote products 2239213Sgibbs * derived from this software without specific prior written permission. 2339213Sgibbs * 2439213Sgibbs * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 2539213Sgibbs * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 2639213Sgibbs * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 27116162Sobrien * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 2839213Sgibbs * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 2939213Sgibbs * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 3039213Sgibbs * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 3139213Sgibbs * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 3239213Sgibbs * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 3339213Sgibbs * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 3439213Sgibbs */ 3539213Sgibbs 3639213Sgibbs/* 3739213Sgibbs * net/if_atm.h 3839213Sgibbs */ 3939213Sgibbs 4039213Sgibbs#if defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__) 4139213Sgibbs#define RTALLOC1(A,B) rtalloc1((A),(B)) 4239213Sgibbs#elif defined(__FreeBSD__) 4339213Sgibbs#define RTALLOC1(A,B) rtalloc1((A),(B),0UL) 4439213Sgibbs#endif 4539213Sgibbs 4639213Sgibbs/* 4739213Sgibbs * pseudo header for packet transmission 48116162Sobrien */ 49116162Sobrienstruct atm_pseudohdr { 50116162Sobrien u_int8_t atm_ph[4]; /* flags+VPI+VCI1(msb)+VCI2(lsb) */ 5140020Sken}; 5239213Sgibbs 5339213Sgibbs#define ATM_PH_FLAGS(X) ((X)->atm_ph[0]) 5439213Sgibbs#define ATM_PH_VPI(X) ((X)->atm_ph[1]) 5539213Sgibbs#define ATM_PH_VCI(X) ((((X)->atm_ph[2]) << 8) | ((X)->atm_ph[3])) 5660041Sphk#define ATM_PH_SETVCI(X,V) { \ 5751836Sphk (X)->atm_ph[2] = ((V) >> 8) & 0xff; \ 5851836Sphk (X)->atm_ph[3] = ((V) & 0xff); \ 5939213Sgibbs} 6039213Sgibbs 61105421Snjl#define ATM_PH_AAL5 0x01 /* use AAL5? (0 == aal0) */ 6260422Sken#define ATM_PH_LLCSNAP 0x02 /* use the LLC SNAP encoding (iff aal5) */ 6339213Sgibbs 6439213Sgibbs#define ATM_PH_DRIVER7 0x40 /* reserve for driver's use */ 65119708Sken#define ATM_PH_DRIVER8 0x80 /* reserve for driver's use */ 6639213Sgibbs 6739213Sgibbs#define ATMMTU 9180 /* ATM MTU size for IP */ 6839213Sgibbs /* XXX: could be 9188 with LLC/SNAP according 6939213Sgibbs to comer */ 7039213Sgibbs 7139213Sgibbs/* user's ioctl hook for raw atm mode */ 7239213Sgibbs#define SIOCRAWATM _IOWR('a', 122, int) /* set driver's raw mode */ 7339213Sgibbs 7439213Sgibbs/* atm_pseudoioctl: turns on and off RX VCIs [for internal use only!] */ 7539213Sgibbsstruct atm_pseudoioctl { 7639213Sgibbs struct atm_pseudohdr aph; 7739213Sgibbs void *rxhand; 7839213Sgibbs}; 7939213Sgibbs#define SIOCATMENA _IOWR('a', 123, struct atm_pseudoioctl) /* enable */ 8039213Sgibbs#define SIOCATMDIS _IOWR('a', 124, struct atm_pseudoioctl) /* disable */ 8139213Sgibbs 8239213Sgibbs 8339213Sgibbs/* 8439213Sgibbs * XXX forget all the garbage in if_llc.h and do it the easy way 85111206Sken */ 86111206Sken 87111206Sken#define ATMLLC_HDR "\252\252\3\0\0\0" 88111206Skenstruct atmllc { 89111206Sken u_int8_t llchdr[6]; /* aa.aa.03.00.00.00 */ 90111206Sken u_int8_t type[2]; /* "ethernet" type */ 9139213Sgibbs}; 9239213Sgibbs 9339213Sgibbs/* ATM_LLC macros: note type code in host byte order */ 9439213Sgibbs#define ATM_LLC_TYPE(X) (((X)->type[0] << 8) | ((X)->type[1])) 9539213Sgibbs#define ATM_LLC_SETTYPE(X,V) { \ 9639213Sgibbs (X)->type[1] = ((V) >> 8) & 0xff; \ 9739213Sgibbs (X)->type[0] = ((V) & 0xff); \ 9839213Sgibbs} 9939213Sgibbs 10039213Sgibbs#ifdef _KERNEL 10139213Sgibbsvoid atm_ifattach(struct ifnet *); 102111206Skenvoid atm_input(struct ifnet *, struct atm_pseudohdr *, 103111206Sken struct mbuf *, void *); 104111206Skenint atm_output(struct ifnet *, struct mbuf *, struct sockaddr *, 10539213Sgibbs struct rtentry *); 10639213Sgibbs#endif 10739213Sgibbs 10839213Sgibbs