FreeBSD/Linux Kernel Cross Reference
sys/netnatm/natm.h
1 /* $NetBSD: natm.h,v 1.5 2003/06/29 22:32:08 fvdl Exp $ */
2
3 /*
4 *
5 * Copyright (c) 1996 Charles D. Cranor and Washington University.
6 * All rights reserved.
7 *
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.
22 *
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.
33 */
34
35 #ifndef _NETNATM_NATM_H_
36 #define _NETNATM_NATM_H_
37
38 /*
39 * natm.h: native mode atm
40 */
41
42
43 /*
44 * supported protocols
45 */
46
47 #define PROTO_NATMAAL0 1
48 #define PROTO_NATMAAL5 2
49
50 /*
51 * sockaddr_natm
52 */
53
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 */
60 };
61
62
63 #if defined(__FreeBSD__) && defined(KERNEL)
64
65 #ifndef _KERNEL
66 #define _KERNEL
67 #endif
68
69 #define SPLSOFTNET() splnet()
70
71 #elif defined(__NetBSD__) || defined(__OpenBSD__)
72
73 #define SPLSOFTNET() splsoftnet()
74
75 #endif
76
77 #ifdef _KERNEL
78
79 /*
80 * natm protocol control block
81 */
82
83 struct natmpcb {
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 */
92 };
93
94 /* 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? */
100
101 /* flag arg to npcb_free */
102 #define NPCB_REMOVE 0 /* remove from global list */
103 #define NPCB_DESTROY 1 /* destroy and be free */
104
105 /*
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.
109 *
110 * XXX: socket buffering needs to be looked at.
111 */
112
113 #define NPCB_RAWCC (1024*1024) /* 1MB */
114
115 LIST_HEAD(npcblist, natmpcb);
116
117 /* global data structures */
118
119 struct npcblist natm_pcbs; /* global list of pcbs */
120 extern struct ifqueue natmintrq; /* natm packet input queue */
121 #define NATM_STAT
122 #ifdef NATM_STAT
123 extern u_int natm_sodropcnt,
124 natm_sodropbytes; /* account of droppage */
125 extern u_int natm_sookcnt,
126 natm_sookbytes; /* account of ok */
127 #endif
128
129 /* atm_rawioctl: kernel's version of SIOCRAWATM [for internal use only!] */
130 struct atm_rawioctl {
131 struct natmpcb *npcb;
132 int rawvalue;
133 };
134 #define SIOCXRAWATM _IOWR('a', 125, struct atm_rawioctl)
135
136 /* external functions */
137
138 /* natm_pcb.c */
139 struct natmpcb *npcb_alloc __P((int));
140 void npcb_free __P((struct natmpcb *, int));
141 struct natmpcb *npcb_add __P((struct natmpcb *, struct ifnet *, int, int));
142
143 /* natm.c */
144 #if defined(__NetBSD__) || defined(__OpenBSD__)
145 int natm_usrreq __P((struct socket *, int, struct mbuf *,
146 struct mbuf *, struct mbuf *, struct proc *));
147 #elif defined(__FreeBSD__)
148 int natm_usrreq __P((struct socket *, int, struct mbuf *,
149 struct mbuf *, struct mbuf *));
150 #endif
151 int natm0_sysctl __P((int *, u_int, void *, size_t *, void *, size_t));
152 int natm5_sysctl __P((int *, u_int, void *, size_t *, void *, size_t));
153 void natmintr __P((void));
154
155 #endif
156
157 #endif /* _NETNATM_NATM_H_ */
Cache object: 6300bbf36cc3c5db951f0b274691c52e
|