1 /*
2 * Copyright (c) 2001-2003
3 * Fraunhofer Institute for Open Communication Systems (FhG Fokus).
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 *
27 * Author: Harti Brandt <harti@freebsd.org>
28 *
29 * Netgraph module to connect NATM interfaces to netgraph.
30 *
31 * $FreeBSD: releng/5.2/sys/netgraph/atm/ng_atm.h 122614 2003-11-13 13:00:56Z harti $
32 */
33 #ifndef _NETGRAPH_ATM_NG_ATM_H_
34 #define _NETGRAPH_ATM_NG_ATM_H_
35
36 #define NG_ATM_NODE_TYPE "atm"
37 #define NGM_ATM_COOKIE 960802260
38
39 /* Netgraph control messages */
40 enum {
41 NGM_ATM_GET_IFNAME = 1, /* get the interface name */
42 NGM_ATM_GET_CONFIG, /* get configuration */
43 NGM_ATM_GET_VCCS, /* get a list of all active vccs */
44 NGM_ATM_CPCS_INIT, /* start the channel */
45 NGM_ATM_CPCS_TERM, /* stop the channel */
46 NGM_ATM_GET_VCC, /* get VCC config */
47 NGM_ATM_GET_VCCID, /* get VCC by VCI/VPI */
48 NGM_ATM_GET_STATS, /* get global statistics */
49
50 /* messages from the node */
51 NGM_ATM_CARRIER_CHANGE = 1000, /* UNUSED: carrier changed */
52 NGM_ATM_VCC_CHANGE, /* permanent VCC changed */
53 NGM_ATM_ACR_CHANGE, /* ABR ACR has changed */
54 NGM_ATM_IF_CHANGE, /* interface state change */
55 };
56
57 /*
58 * Hardware interface configuration
59 */
60 struct ngm_atm_config {
61 uint32_t pcr; /* peak cell rate */
62 uint32_t vpi_bits; /* number of active VPI bits */
63 uint32_t vci_bits; /* number of active VCI bits */
64 uint32_t max_vpcs; /* maximum number of VPCs */
65 uint32_t max_vccs; /* maximum number of VCCs */
66 };
67 #define NGM_ATM_CONFIG_INFO \
68 { \
69 { "pcr", &ng_parse_uint32_type }, \
70 { "vpi_bits", &ng_parse_uint32_type }, \
71 { "vci_bits", &ng_parse_uint32_type }, \
72 { "max_vpcs", &ng_parse_uint32_type }, \
73 { "max_vccs", &ng_parse_uint32_type }, \
74 { NULL } \
75 }
76
77 /*
78 * Information about an open VCC
79 * See net/if_atm.h. Keep in sync.
80 */
81 #define NGM_ATM_TPARAM_INFO \
82 { \
83 { "pcr", &ng_parse_uint32_type }, \
84 { "scr", &ng_parse_uint32_type }, \
85 { "mbs", &ng_parse_uint32_type }, \
86 { "mcr", &ng_parse_uint32_type }, \
87 { "icr", &ng_parse_uint32_type }, \
88 { "tbe", &ng_parse_uint32_type }, \
89 { "nrm", &ng_parse_uint8_type }, \
90 { "trm", &ng_parse_uint8_type }, \
91 { "adtf", &ng_parse_uint16_type }, \
92 { "rif", &ng_parse_uint8_type }, \
93 { "rdf", &ng_parse_uint8_type }, \
94 { "cdf", &ng_parse_uint8_type }, \
95 { NULL } \
96 }
97
98 #define NGM_ATM_VCC_INFO \
99 { \
100 { "flags", &ng_parse_hint16_type }, \
101 { "vpi", &ng_parse_uint16_type }, \
102 { "vci", &ng_parse_uint16_type }, \
103 { "rmtu", &ng_parse_uint16_type }, \
104 { "tmtu", &ng_parse_uint16_type }, \
105 { "aal", &ng_parse_uint8_type }, \
106 { "traffic", &ng_parse_uint8_type }, \
107 { "tparam", &ng_atm_tparam_type }, \
108 { NULL } \
109 }
110
111 #define NGM_ATM_VCCARRAY_INFO \
112 { \
113 &ng_atm_vcc_type, \
114 ng_atm_vccarray_getlen, \
115 NULL \
116 }
117
118 #define NGM_ATM_VCCTABLE_INFO \
119 { \
120 { "count", &ng_parse_uint32_type }, \
121 { "vccs", &ng_atm_vccarray_type }, \
122 { NULL } \
123 }
124
125 /*
126 * Structure to open a VCC.
127 */
128 struct ngm_atm_cpcs_init {
129 char name[NG_HOOKLEN + 1];
130 uint32_t flags; /* flags. (if_atm.h) */
131 uint16_t vci; /* VCI to open */
132 uint16_t vpi; /* VPI to open */
133 uint16_t rmtu; /* Receive maximum CPCS size */
134 uint16_t tmtu; /* Transmit maximum CPCS size */
135 uint8_t aal; /* AAL type (if_atm.h) */
136 uint8_t traffic; /* traffic type (if_atm.h) */
137 uint32_t pcr; /* Peak cell rate */
138 uint32_t scr; /* VBR: Sustainable cell rate */
139 uint32_t mbs; /* VBR: Maximum burst rate */
140 uint32_t mcr; /* UBR+: Minimum cell rate */
141 uint32_t icr; /* ABR: Initial cell rate */
142 uint32_t tbe; /* ABR: Transmit buffer exposure */
143 uint8_t nrm; /* ABR: Nrm */
144 uint8_t trm; /* ABR: Trm */
145 uint16_t adtf; /* ABR: ADTF */
146 uint8_t rif; /* ABR: RIF */
147 uint8_t rdf; /* ABR: RDF */
148 uint8_t cdf; /* ABR: CDF */
149 };
150
151 #define NGM_ATM_CPCS_INIT_INFO \
152 { \
153 { "name", &ng_parse_hookbuf_type }, \
154 { "flags", &ng_parse_hint32_type }, \
155 { "vci", &ng_parse_uint16_type }, \
156 { "vpi", &ng_parse_uint16_type }, \
157 { "rmtu", &ng_parse_uint16_type }, \
158 { "tmtu", &ng_parse_uint16_type }, \
159 { "aal", &ng_parse_uint8_type }, \
160 { "traffic", &ng_parse_uint8_type }, \
161 { "pcr", &ng_parse_uint32_type }, \
162 { "scr", &ng_parse_uint32_type }, \
163 { "mbs", &ng_parse_uint32_type }, \
164 { "mcr", &ng_parse_uint32_type }, \
165 { "icr", &ng_parse_uint32_type }, \
166 { "tbe", &ng_parse_uint32_type }, \
167 { "nrm", &ng_parse_uint8_type }, \
168 { "trm", &ng_parse_uint8_type }, \
169 { "adtf", &ng_parse_uint16_type }, \
170 { "rif", &ng_parse_uint8_type }, \
171 { "rdf", &ng_parse_uint8_type }, \
172 { "cdf", &ng_parse_uint8_type }, \
173 { NULL } \
174 }
175
176 /*
177 * Structure to close a VCI without disconnecting the hook
178 */
179 struct ngm_atm_cpcs_term {
180 char name[NG_HOOKLEN + 1];
181 };
182 #define NGM_ATM_CPCS_TERM_INFO \
183 { \
184 { "name", &ng_parse_hookbuf_type }, \
185 { NULL } \
186 }
187
188 struct ngm_atm_stats {
189 uint64_t in_packets;
190 uint64_t in_errors;
191 uint64_t out_packets;
192 uint64_t out_errors;
193 };
194 #define NGM_ATM_STATS_INFO \
195 { \
196 { "in_packets", &ng_parse_uint64_type }, \
197 { "in_errors", &ng_parse_uint64_type }, \
198 { "out_packets", &ng_parse_uint64_type }, \
199 { "out_errors", &ng_parse_uint64_type }, \
200 { NULL } \
201 }
202
203 struct ngm_atm_if_change {
204 uint32_t node;
205 uint8_t carrier;
206 uint8_t running;
207 };
208 #define NGM_ATM_IF_CHANGE_INFO \
209 { \
210 { "node", &ng_parse_hint32_type }, \
211 { "carrier", &ng_parse_uint8_type }, \
212 { "running", &ng_parse_uint8_type }, \
213 { NULL } \
214 }
215
216 struct ngm_atm_vcc_change {
217 uint32_t node;
218 uint16_t vci;
219 uint8_t vpi;
220 uint8_t state;
221 };
222 #define NGM_ATM_VCC_CHANGE_INFO \
223 { \
224 { "node", &ng_parse_hint32_type }, \
225 { "vci", &ng_parse_uint16_type }, \
226 { "vpi", &ng_parse_uint8_type }, \
227 { "state", &ng_parse_uint8_type }, \
228 { NULL } \
229 }
230
231 struct ngm_atm_acr_change {
232 uint32_t node;
233 uint16_t vci;
234 uint8_t vpi;
235 uint32_t acr;
236 };
237 #define NGM_ATM_ACR_CHANGE_INFO \
238 { \
239 { "node", &ng_parse_hint32_type }, \
240 { "vci", &ng_parse_uint16_type }, \
241 { "vpi", &ng_parse_uint8_type }, \
242 { "acr", &ng_parse_uint32_type }, \
243 { NULL } \
244 }
245
246 #endif /* _NETGRAPH_ATM_NG_ATM_H */
Cache object: dac47340260965777c620bb3c10a1431
|