FreeBSD/Linux Kernel Cross Reference
sys/netnatm/natm.h
1 /* $NetBSD: natm.h,v 1.1 1996/07/04 03:20:12 chuck Exp $ */
2 /* $FreeBSD: releng/5.0/sys/netnatm/natm.h 92745 2002-03-20 02:39:27Z alfred $ */
3
4 /*
5 *
6 * Copyright (c) 1996 Charles D. Cranor and Washington University.
7 * All rights reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
11 * are met:
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
17 * 3. All advertising materials mentioning features or use of this software
18 * must display the following acknowledgement:
19 * This product includes software developed by Charles D. Cranor and
20 * Washington University.
21 * 4. The name of the author may not be used to endorse or promote products
22 * derived from this software without specific prior written permission.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
25 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
26 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
27 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
28 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
29 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
33 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 */
35
36 /*
37 * natm.h: native mode atm
38 */
39
40
41 /*
42 * supported protocols
43 */
44
45 #define PROTO_NATMAAL0 1
46 #define PROTO_NATMAAL5 2
47
48 /*
49 * sockaddr_natm
50 */
51
52 struct sockaddr_natm {
53 u_int8_t snatm_len; /* length */
54 u_int8_t snatm_family; /* AF_NATM */
55 char snatm_if[IFNAMSIZ]; /* interface name */
56 u_int16_t snatm_vci; /* vci */
57 u_int8_t snatm_vpi; /* vpi */
58 };
59
60
61 #if defined(__FreeBSD__) && defined(_KERNEL)
62
63 #define SPLSOFTNET() splnet()
64
65 #elif defined(__NetBSD__) || defined(__OpenBSD__)
66
67 #define SPLSOFTNET() splsoftnet()
68
69 #endif
70
71 #ifdef _KERNEL
72
73 /*
74 * natm protocol control block
75 */
76
77 struct natmpcb {
78 LIST_ENTRY(natmpcb) pcblist; /* list pointers */
79 u_int npcb_inq; /* # of our pkts in proto q */
80 struct socket *npcb_socket; /* backpointer to socket */
81 struct ifnet *npcb_ifp; /* pointer to hardware */
82 struct in_addr ipaddr; /* remote IP address, if APCB_IP */
83 u_int16_t npcb_vci; /* VCI */
84 u_int8_t npcb_vpi; /* VPI */
85 u_int8_t npcb_flags; /* flags */
86 };
87
88 /* flags */
89 #define NPCB_FREE 0x01 /* free (not on any list) */
90 #define NPCB_CONNECTED 0x02 /* connected */
91 #define NPCB_IP 0x04 /* used by IP */
92 #define NPCB_DRAIN 0x08 /* destory as soon as inq == 0 */
93 #define NPCB_RAW 0x10 /* in 'raw' mode? */
94
95 /* flag arg to npcb_free */
96 #define NPCB_REMOVE 0 /* remove from global list */
97 #define NPCB_DESTROY 1 /* destroy and be free */
98
99 /*
100 * NPCB_RAWCC is a hack which applies to connections in 'raw' mode. it
101 * is used to override the sbspace() macro when you *really* don't want
102 * to drop rcv data. the recv socket buffer size is raised to this value.
103 *
104 * XXX: socket buffering needs to be looked at.
105 */
106
107 #define NPCB_RAWCC (1024*1024) /* 1MB */
108
109 LIST_HEAD(npcblist, natmpcb);
110
111 /* global data structures */
112
113 extern struct npcblist natm_pcbs; /* global list of pcbs */
114 extern struct ifqueue natmintrq; /* natm packet input queue */
115 #define NATM_STAT
116 #ifdef NATM_STAT
117 extern u_int natm_sodropcnt,
118 natm_sodropbytes; /* account of droppage */
119 extern u_int natm_sookcnt,
120 natm_sookbytes; /* account of ok */
121 #endif
122
123 /* atm_rawioctl: kernel's version of SIOCRAWATM [for internal use only!] */
124 struct atm_rawioctl {
125 struct natmpcb *npcb;
126 int rawvalue;
127 };
128 #define SIOCXRAWATM _IOWR('a', 125, struct atm_rawioctl)
129
130 /* external functions */
131
132 /* natm_pcb.c */
133 struct natmpcb *npcb_alloc(int);
134 void npcb_free(struct natmpcb *, int);
135 struct natmpcb *npcb_add(struct natmpcb *, struct ifnet *, int, int);
136
137 /* natm.c */
138 #if defined(__NetBSD__) || defined(__OpenBSD__)
139 int natm_usrreq(struct socket *, int, struct mbuf *,
140 struct mbuf *, struct mbuf *, struct proc *);
141 #elif defined(__FreeBSD__)
142 #if __FreeBSD__ > 2
143 /*
144 * FreeBSD new usrreqs style appeared since 2.2. compatibility to old style
145 * has gone since 3.0.
146 */
147 #define FREEBSD_USRREQS
148 extern struct pr_usrreqs natm_usrreqs;
149 #else /* !( __FreeBSD__ > 2) */
150 int natm_usrreq(struct socket *, int, struct mbuf *,
151 struct mbuf *, struct mbuf *);
152 #endif /* !( __FreeBSD__ > 2) */
153 #endif
154 int natm0_sysctl(int *, u_int, void *, size_t *, void *, size_t);
155 int natm5_sysctl(int *, u_int, void *, size_t *, void *, size_t);
156 void natmintr(void);
157
158 #endif
Cache object: 4359aeec51bacfbf52c341aa738e7785
|