1 /* $NetBSD: natm.h,v 1.9 2005/12/11 12:25:16 christos Exp $ */
5 * Copyright (c) 1996 Charles D. Cranor and Washington University.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
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.
35 #ifndef _NETNATM_NATM_H_
36 #define _NETNATM_NATM_H_
39 * natm.h: native mode atm
47 #define PROTO_NATMAAL0 1
48 #define PROTO_NATMAAL5 2
54 struct sockaddr_natm
{
55 u_int8_t snatm_len
; /* length */
56 u_int8_t snatm_family
; /* AF_NATM */
57 char snatm_if
[IFNAMSIZ
]; /* interface name */
58 u_int16_t snatm_vci
; /* vci */
59 u_int8_t snatm_vpi
; /* vpi */
63 #if defined(__FreeBSD__) && defined(KERNEL)
69 #define SPLSOFTNET() splnet()
71 #elif defined(__NetBSD__) || defined(__OpenBSD__)
73 #define SPLSOFTNET() splsoftnet()
80 * natm protocol control block
84 LIST_ENTRY(natmpcb
) pcblist
; /* list pointers */
85 u_int npcb_inq
; /* # of our pkts in proto q */
86 struct socket
*npcb_socket
; /* backpointer to socket */
87 struct ifnet
*npcb_ifp
; /* pointer to hardware */
88 struct in_addr ipaddr
; /* remote IP address, if NPCB_IP */
89 u_int16_t npcb_vci
; /* VCI */
90 u_int8_t npcb_vpi
; /* VPI */
91 u_int8_t npcb_flags
; /* flags */
95 #define NPCB_FREE 0x01 /* free (not on any list) */
96 #define NPCB_CONNECTED 0x02 /* connected */
97 #define NPCB_IP 0x04 /* used by IP */
98 #define NPCB_DRAIN 0x08 /* destory as soon as inq == 0 */
99 #define NPCB_RAW 0x10 /* in 'raw' mode? */
101 /* flag arg to npcb_free */
102 #define NPCB_REMOVE 0 /* remove from global list */
103 #define NPCB_DESTROY 1 /* destroy and be free */
106 * NPCB_RAWCC is a hack which applies to connections in 'raw' mode. it
107 * is used to override the sbspace() macro when you *really* don't want
108 * to drop rcv data. the recv socket buffer size is raised to this value.
110 * XXX: socket buffering needs to be looked at.
113 #define NPCB_RAWCC (1024*1024) /* 1MB */
115 LIST_HEAD(npcblist
, natmpcb
);
117 /* global data structures */
119 extern struct npcblist natm_pcbs
; /* global list of pcbs */
120 extern struct ifqueue natmintrq
; /* natm packet input queue */
123 extern u_int natm_sodropcnt
,
124 natm_sodropbytes
; /* account of droppage */
125 extern u_int natm_sookcnt
,
126 natm_sookbytes
; /* account of ok */
129 /* atm_rawioctl: kernel's version of SIOCRAWATM [for internal use only!] */
130 struct atm_rawioctl
{
131 struct natmpcb
*npcb
;
134 #define SIOCXRAWATM _IOWR('a', 125, struct atm_rawioctl)
136 /* external functions */
139 struct natmpcb
*npcb_alloc(int);
140 void npcb_free(struct natmpcb
*, int);
141 struct natmpcb
*npcb_add(struct natmpcb
*, struct ifnet
*, int, int);
144 #if defined(__NetBSD__) || defined(__OpenBSD__)
145 int natm_usrreq(struct socket
*, int, struct mbuf
*,
146 struct mbuf
*, struct mbuf
*, struct lwp
*);
147 #elif defined(__FreeBSD__)
148 int natm_usrreq(struct socket
*, int, struct mbuf
*,
149 struct mbuf
*, struct mbuf
*);
151 int natm0_sysctl(int *, u_int
, void *, size_t *, void *, size_t);
152 int natm5_sysctl(int *, u_int
, void *, size_t *, void *, size_t);
157 #endif /* !_NETNATM_NATM_H_ */