No empty .Rs/.Re
[netbsd-mini2440.git] / sys / net / if_atm.h
blob46eff5c9c6c811e13e2c686d38a9c44844ca4176
1 /* $NetBSD: if_atm.h,v 1.17 2007/12/25 18:33:44 perry Exp $ */
3 /*
5 * Copyright (c) 1996 Charles D. Cranor and Washington University.
6 * All rights reserved.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. All advertising materials mentioning features or use of this software
17 * must display the following acknowledgement:
18 * This product includes software developed by Charles D. Cranor and
19 * Washington University.
20 * 4. The name of the author may not be used to endorse or promote products
21 * derived from this software without specific prior written permission.
23 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
24 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
25 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
26 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
27 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
28 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
32 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 * net/if_atm.h
39 #ifndef _NET_IF_ATM_H_
40 #define _NET_IF_ATM_H_
42 #if (defined(__FreeBSD__) || defined(__bsdi__)) && defined(KERNEL)
43 #ifndef _KERNEL
44 #define _KERNEL
45 #endif
46 #endif /* freebsd doesn't define _KERNEL */
48 #ifndef NO_ATM_PVCEXT
50 * ATM_PVCEXT enables PVC extension: VP/VC shaping
51 * and PVC shadow interfaces.
53 #define ATM_PVCEXT /* enable pvc extension */
54 #endif
56 #if defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__)
57 #define RTALLOC1(A,B) rtalloc1((A),(B))
58 #elif defined(__FreeBSD__)
59 #define RTALLOC1(A,B) rtalloc1((A),(B),0UL)
60 #endif
63 * pseudo header for packet transmission
66 struct atm_pseudohdr {
67 uint8_t atm_ph[4]; /* flags+VPI+VCI1(msb)+VCI2(lsb) */
70 #define ATM_PH_FLAGS(X) ((X)->atm_ph[0])
71 #define ATM_PH_VPI(X) ((X)->atm_ph[1])
72 #define ATM_PH_VCI(X) ((((X)->atm_ph[2]) << 8) | ((X)->atm_ph[3]))
73 #define ATM_PH_SETVCI(X,V) { \
74 (X)->atm_ph[2] = ((V) >> 8) & 0xff; \
75 (X)->atm_ph[3] = ((V) & 0xff); \
78 #define ATM_PH_AAL5 0x01 /* use AAL5? (0 == aal0) */
79 #define ATM_PH_LLCSNAP 0x02 /* use the LLC SNAP encoding (iff aal5) */
81 #ifdef ATM_PVCEXT
82 #define ATM_PH_INERNAL 0x20 /* reserve for kernel internal use */
83 #endif
84 #define ATM_PH_DRIVER7 0x40 /* reserve for driver's use */
85 #define ATM_PH_DRIVER8 0x80 /* reserve for driver's use */
87 #define ATMMTU 9180 /* ATM MTU size for IP */
88 /* XXX: could be 9188 with LLC/SNAP according
89 to comer */
91 /* user's ioctl hook for raw atm mode */
92 #define SIOCRAWATM _IOWR('a', 122, int) /* set driver's raw mode */
94 /* atm_pseudoioctl: turns on and off RX VCIs [for internal use only!] */
95 struct atm_pseudoioctl {
96 struct atm_pseudohdr aph;
97 void *rxhand;
99 #define SIOCATMENA _IOWR('a', 123, struct atm_pseudoioctl) /* enable */
100 #define SIOCATMDIS _IOWR('a', 124, struct atm_pseudoioctl) /* disable */
102 #ifdef ATM_PVCEXT
104 /* structure to control PVC transmitter */
105 struct pvctxreq {
106 /* first entry must be compatible with struct ifreq */
107 char pvc_ifname[IFNAMSIZ]; /* if name, e.g. "en0" */
108 struct atm_pseudohdr pvc_aph; /* (flags) + vpi:vci */
109 struct atm_pseudohdr pvc_joint; /* for vp shaping: another vc
110 to share the shaper */
111 int pvc_pcr; /* peak cell rate (shaper value) */
114 /* use ifioctl for now */
115 #define SIOCSPVCTX _IOWR('i', 95, struct pvctxreq)
116 #define SIOCGPVCTX _IOWR('i', 96, struct pvctxreq)
117 #define SIOCSPVCSIF _IOWR('i', 97, struct ifreq)
118 #define SIOCGPVCSIF _IOWR('i', 98, struct ifreq)
120 #endif /* ATM_PVCEXT */
123 * XXX forget all the garbage in if_llc.h and do it the easy way
126 #define ATMLLC_HDR "\252\252\3\0\0\0"
127 struct atmllc {
128 uint8_t llchdr[6]; /* aa.aa.03.00.00.00 */
129 uint8_t type[2]; /* "ethernet" type */
130 } __packed;
132 /* ATM_LLC macros: note type code in host byte order */
133 #define ATM_LLC_TYPE(X) (((X)->type[0] << 8) | ((X)->type[1]))
134 #define ATM_LLC_SETTYPE(X,V) { \
135 (X)->type[0] = ((V) >> 8) & 0xff; \
136 (X)->type[1] = ((V) & 0xff); \
139 #ifdef _KERNEL
140 void atm_ifattach(struct ifnet *);
141 void atm_input(struct ifnet *, struct atm_pseudohdr *,
142 struct mbuf *, void *);
143 int atm_output(struct ifnet *, struct mbuf *, const struct sockaddr *,
144 struct rtentry *);
145 #endif
146 #ifdef ATM_PVCEXT
147 #ifdef _KERNEL
148 #include <sys/queue.h>
150 * ATM PVC subinterface: a trick to assign a subinterface
151 * to a PVC.
152 * with a pvc subinterface, each PVC looks like an individual
153 * Point-to-Point interface.
154 * as opposed to the NBMA model, a pvc subinterface is inherently
155 * multicast capable (no LANE/MARS required).
157 struct pvcsif {
159 * The ifnet struct _must_ be at the head of this structure.
161 struct ifnet sif_if; /* ifnet structure per pvc */
162 struct atm_pseudohdr sif_aph; /* flags + vpi:vci */
163 int sif_vci; /* vci no */
164 LIST_ENTRY(pvcsif) sif_links;
166 struct ifnet *pvcsif_alloc(void);
167 #endif
168 #endif /* ATM_PVCEXT */
169 #endif /* !_NET_IF_ATM_H_ */