Initial import of binutils 2.22 on the new vendor branch
[dragonfly.git] / sys / netgraph7 / atm / ng_atm.h
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
30 /*
31  * Netgraph module to connect NATM interfaces to netgraph.
32  *
33  * $FreeBSD: src/sys/netgraph/atm/ng_atm.h,v 1.5 2005/01/07 01:45:40 imp Exp $
34  * $DragonFly: src/sys/netgraph7/atm/ng_atm.h,v 1.2 2008/06/26 23:05:37 dillon Exp $
35  */
36 #ifndef _NETGRAPH_ATM_NG_ATM_H_
37 #define _NETGRAPH_ATM_NG_ATM_H_
38
39 #define NG_ATM_NODE_TYPE "atm"
40 #define NGM_ATM_COOKIE  960802260
41
42 /* Netgraph control messages */
43 enum {
44         NGM_ATM_GET_IFNAME = 1,         /* get the interface name */
45         NGM_ATM_GET_CONFIG,             /* get configuration */
46         NGM_ATM_GET_VCCS,               /* get a list of all active vccs */
47         NGM_ATM_CPCS_INIT,              /* start the channel */
48         NGM_ATM_CPCS_TERM,              /* stop the channel */
49         NGM_ATM_GET_VCC,                /* get VCC config */
50         NGM_ATM_GET_VCCID,              /* get VCC by VCI/VPI */
51         NGM_ATM_GET_STATS,              /* get global statistics */
52
53         /* messages from the node */
54         NGM_ATM_CARRIER_CHANGE = 1000,  /* UNUSED: carrier changed */
55         NGM_ATM_VCC_CHANGE,             /* permanent VCC changed */
56         NGM_ATM_ACR_CHANGE,             /* ABR ACR has changed */
57         NGM_ATM_IF_CHANGE,              /* interface state change */
58 };
59
60 /*
61  * Hardware interface configuration
62  */
63 struct ngm_atm_config {
64         uint32_t        pcr;            /* peak cell rate */
65         uint32_t        vpi_bits;       /* number of active VPI bits */
66         uint32_t        vci_bits;       /* number of active VCI bits */
67         uint32_t        max_vpcs;       /* maximum number of VPCs */
68         uint32_t        max_vccs;       /* maximum number of VCCs */
69 };
70 #define NGM_ATM_CONFIG_INFO                                     \
71         {                                                       \
72           { "pcr",      &ng_parse_uint32_type },                \
73           { "vpi_bits", &ng_parse_uint32_type },                \
74           { "vci_bits", &ng_parse_uint32_type },                \
75           { "max_vpcs", &ng_parse_uint32_type },                \
76           { "max_vccs", &ng_parse_uint32_type },                \
77           { NULL }                                              \
78         }
79
80 /*
81  * Information about an open VCC
82  * See net/if_atm.h. Keep in sync.
83  */
84 #define NGM_ATM_TPARAM_INFO                                     \
85         {                                                       \
86           { "pcr",      &ng_parse_uint32_type },                \
87           { "scr",      &ng_parse_uint32_type },                \
88           { "mbs",      &ng_parse_uint32_type },                \
89           { "mcr",      &ng_parse_uint32_type },                \
90           { "icr",      &ng_parse_uint32_type },                \
91           { "tbe",      &ng_parse_uint32_type },                \
92           { "nrm",      &ng_parse_uint8_type },                 \
93           { "trm",      &ng_parse_uint8_type },                 \
94           { "adtf",     &ng_parse_uint16_type },                \
95           { "rif",      &ng_parse_uint8_type },                 \
96           { "rdf",      &ng_parse_uint8_type },                 \
97           { "cdf",      &ng_parse_uint8_type },                 \
98           { NULL }                                              \
99         }
100
101 #define NGM_ATM_VCC_INFO                                        \
102         {                                                       \
103           { "flags",    &ng_parse_hint16_type },                \
104           { "vpi",      &ng_parse_uint16_type },                \
105           { "vci",      &ng_parse_uint16_type },                \
106           { "rmtu",     &ng_parse_uint16_type },                \
107           { "tmtu",     &ng_parse_uint16_type },                \
108           { "aal",      &ng_parse_uint8_type },                 \
109           { "traffic",  &ng_parse_uint8_type },                 \
110           { "tparam",   &ng_atm_tparam_type },                  \
111           { NULL }                                              \
112         }
113
114 #define NGM_ATM_VCCARRAY_INFO                                   \
115         {                                                       \
116           &ng_atm_vcc_type,                                     \
117           ng_atm_vccarray_getlen,                               \
118           NULL                                                  \
119         }
120
121 #define NGM_ATM_VCCTABLE_INFO                                   \
122         {                                                       \
123           { "count",    &ng_parse_uint32_type },                \
124           { "vccs",     &ng_atm_vccarray_type },                \
125           { NULL }                                              \
126         }
127
128 /*
129  * Structure to open a VCC.
130  */
131 struct ngm_atm_cpcs_init {
132         char            name[NG_HOOKSIZ];
133         uint32_t        flags;          /* flags. (if_atm.h) */
134         uint16_t        vci;            /* VCI to open */
135         uint16_t        vpi;            /* VPI to open */
136         uint16_t        rmtu;           /* Receive maximum CPCS size */
137         uint16_t        tmtu;           /* Transmit maximum CPCS size */
138         uint8_t         aal;            /* AAL type (if_atm.h) */
139         uint8_t         traffic;        /* traffic type (if_atm.h) */
140         uint32_t        pcr;            /* Peak cell rate */
141         uint32_t        scr;            /* VBR: Sustainable cell rate */
142         uint32_t        mbs;            /* VBR: Maximum burst rate */
143         uint32_t        mcr;            /* UBR+: Minimum cell rate */
144         uint32_t        icr;            /* ABR: Initial cell rate */
145         uint32_t        tbe;            /* ABR: Transmit buffer exposure */
146         uint8_t         nrm;            /* ABR: Nrm */
147         uint8_t         trm;            /* ABR: Trm */
148         uint16_t        adtf;           /* ABR: ADTF */
149         uint8_t         rif;            /* ABR: RIF */
150         uint8_t         rdf;            /* ABR: RDF */
151         uint8_t         cdf;            /* ABR: CDF */
152 };
153
154 #define NGM_ATM_CPCS_INIT_INFO                                  \
155         {                                                       \
156           { "name",     &ng_parse_hookbuf_type },               \
157           { "flags",    &ng_parse_hint32_type },                \
158           { "vci",      &ng_parse_uint16_type },                \
159           { "vpi",      &ng_parse_uint16_type },                \
160           { "rmtu",     &ng_parse_uint16_type },                \
161           { "tmtu",     &ng_parse_uint16_type },                \
162           { "aal",      &ng_parse_uint8_type },                 \
163           { "traffic",  &ng_parse_uint8_type },                 \
164           { "pcr",      &ng_parse_uint32_type },                \
165           { "scr",      &ng_parse_uint32_type },                \
166           { "mbs",      &ng_parse_uint32_type },                \
167           { "mcr",      &ng_parse_uint32_type },                \
168           { "icr",      &ng_parse_uint32_type },                \
169           { "tbe",      &ng_parse_uint32_type },                \
170           { "nrm",      &ng_parse_uint8_type },                 \
171           { "trm",      &ng_parse_uint8_type },                 \
172           { "adtf",     &ng_parse_uint16_type },                \
173           { "rif",      &ng_parse_uint8_type },                 \
174           { "rdf",      &ng_parse_uint8_type },                 \
175           { "cdf",      &ng_parse_uint8_type },                 \
176           { NULL }                                              \
177         }
178
179 /*
180  * Structure to close a VCI without disconnecting the hook
181  */
182 struct ngm_atm_cpcs_term {
183         char            name[NG_HOOKSIZ];
184 };
185 #define NGM_ATM_CPCS_TERM_INFO                                  \
186         {                                                       \
187           { "name",     &ng_parse_hookbuf_type },               \
188           { NULL }                                              \
189         }
190
191 struct ngm_atm_stats {
192         uint64_t        in_packets;
193         uint64_t        in_errors;
194         uint64_t        out_packets;
195         uint64_t        out_errors;
196 };
197 #define NGM_ATM_STATS_INFO                                      \
198         {                                                       \
199           { "in_packets",       &ng_parse_uint64_type },        \
200           { "in_errors",        &ng_parse_uint64_type },        \
201           { "out_packets",      &ng_parse_uint64_type },        \
202           { "out_errors",       &ng_parse_uint64_type },        \
203           { NULL }                                              \
204         }
205
206 struct ngm_atm_if_change {
207         uint32_t        node;
208         uint8_t         carrier;
209         uint8_t         running;
210 };
211 #define NGM_ATM_IF_CHANGE_INFO                                  \
212         {                                                       \
213           { "node",     &ng_parse_hint32_type },                \
214           { "carrier",  &ng_parse_uint8_type },                 \
215           { "running",  &ng_parse_uint8_type },                 \
216           { NULL }                                              \
217         }
218
219 struct ngm_atm_vcc_change {
220         uint32_t        node;
221         uint16_t        vci;
222         uint8_t         vpi;
223         uint8_t         state;
224 };
225 #define NGM_ATM_VCC_CHANGE_INFO                                 \
226         {                                                       \
227           { "node",     &ng_parse_hint32_type },                \
228           { "vci",      &ng_parse_uint16_type },                \
229           { "vpi",      &ng_parse_uint8_type },                 \
230           { "state",    &ng_parse_uint8_type },                 \
231           { NULL }                                              \
232         }
233
234 struct ngm_atm_acr_change {
235         uint32_t        node;
236         uint16_t        vci;
237         uint8_t         vpi;
238         uint32_t        acr;
239 };
240 #define NGM_ATM_ACR_CHANGE_INFO                                 \
241         {                                                       \
242           { "node",     &ng_parse_hint32_type },                \
243           { "vci",      &ng_parse_uint16_type },                \
244           { "vpi",      &ng_parse_uint8_type },                 \
245           { "acr",      &ng_parse_uint32_type },                \
246           { NULL }                                              \
247         }
248
249 #endif /* _NETGRAPH_ATM_NG_ATM_H */