]> CyberLeo.Net >> Repos - FreeBSD/releng/9.2.git/blob - sys/contrib/ngatm/netnatm/api/atmapi.h
- Copy stable/9 to releng/9.2 as part of the 9.2-RELEASE cycle.
[FreeBSD/releng/9.2.git] / sys / contrib / ngatm / netnatm / api / atmapi.h
1 /*
2  * Copyright (c) 2003-2004
3  *      Hartmut Brandt
4  *      All rights reserved.
5  *
6  * Copyright (c) 2001-2002
7  *      Fraunhofer Institute for Open Communication Systems (FhG Fokus).
8  *      All rights reserved.
9  *
10  * Author: Harti Brandt <harti@freebsd.org>
11  *
12  * Redistribution of this software and documentation and use in source and
13  * binary forms, with or without modification, are permitted provided that
14  * the following conditions are met:
15  *
16  * 1. Redistributions of source code or documentation must retain the above
17  *    copyright notice, this list of conditions and the following disclaimer.
18  * 2. Redistributions in binary form must reproduce the above copyright
19  *    notice, this list of conditions and the following disclaimer in the
20  *    documentation and/or other materials provided with the distribution.
21  *
22  * THIS SOFTWARE AND DOCUMENTATION IS PROVIDED BY THE AUTHORS
23  * AND ITS CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
24  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
25  * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
26  * THE AUTHORS OR ITS CONTRIBUTORS  BE LIABLE FOR ANY DIRECT, INDIRECT,
27  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
29  * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
30  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
31  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
32  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33  *
34  * $Begemot: libunimsg/netnatm/api/atmapi.h,v 1.1 2004/07/08 08:21:48 brandt Exp $
35  *
36  * ATM API as defined per af-saa-0108
37  */
38 #ifndef _NETNATM_API_ATMAPI_H_
39 #define _NETNATM_API_ATMAPI_H_
40
41 #include <sys/types.h>
42
43 /* size of an endpointlen including trailing \0 */
44 #define ATM_EPNAMSIZ    65
45
46 enum atmstate {
47         ATM_A0,         /* non existent */
48         ATM_A1,         /* initial */
49         ATM_A2,         /* outgoing call preparation */
50         ATM_A3,         /* outgoing call requested */
51         ATM_A4,         /* incoming call preparation */
52         ATM_A5,         /* wait incoming call */
53         ATM_A6,         /* incoming call present */
54         ATM_A7,         /* incoming call requested */
55         ATM_A8,         /* p2p data transfer */
56         ATM_A9,         /* p2mp root data transfer */
57         ATM_A10,        /* p2mp leaf data transfer */
58         ATM_A11,        /* terminated */
59 };
60
61 enum atmop {
62         ATMOP_RESP,                             /* 0 */
63         ATMOP_ABORT_CONNECTION,
64         ATMOP_ACCEPT_INCOMING_CALL,
65         ATMOP_ADD_PARTY,
66         ATMOP_ADD_PARTY_REJECT,
67         ATMOP_ADD_PARTY_SUCCESS,                /* 5 */
68         ATMOP_ARRIVAL_OF_INCOMING_CALL,
69         ATMOP_CALL_RELEASE,
70         ATMOP_CONNECT_OUTGOING_CALL,
71         ATMOP_DROP_PARTY,
72         ATMOP_GET_LOCAL_PORT_INFO,              /* 10 */
73         ATMOP_P2MP_CALL_ACTIVE,
74         ATMOP_P2P_CALL_ACTIVE,
75         ATMOP_PREPARE_INCOMING_CALL,
76         ATMOP_PREPARE_OUTGOING_CALL,
77         ATMOP_QUERY_CONNECTION_ATTRIBUTES,      /* 15 */
78         ATMOP_REJECT_INCOMING_CALL,
79         ATMOP_SET_CONNECTION_ATTRIBUTES,
80         ATMOP_WAIT_ON_INCOMING_CALL,
81         ATMOP_SET_CONNECTION_ATTRIBUTES_X,
82         ATMOP_QUERY_CONNECTION_ATTRIBUTES_X,    /* 20 */
83         ATMOP_QUERY_STATE,
84 };
85
86 #define ATM_DEFINE_ERRORS                                               \
87    DEF(ATMERR_OK,                0, "OK")                               \
88    DEF(ATMERR_SYS,              -1, "syscall error")                    \
89    DEF(ATMERR_BAD_OP,           -2, "bad operation")                    \
90    DEF(ATMERR_BAD_ARGS,         -3, "bad arguments for operation")      \
91    DEF(ATMERR_BAD_STATE,        -4, "operation in bad state")           \
92    DEF(ATMERR_BAD_ATTR,         -5, "unknown attribute")                \
93    DEF(ATMERR_BAD_VALUE,        -6, "bad attribute value")              \
94    DEF(ATMERR_BUSY,             -7, "busy")                             \
95    DEF(ATMERR_RDONLY,           -8, "read-only attribute")              \
96    DEF(ATMERR_BAD_SAP,          -9, "bad SAP")                          \
97    DEF(ATMERR_OVERLAP,          -10,"overlaping SAP")                   \
98    DEF(ATMERR_BAD_ENDPOINT,     -11,"bad ATM endpoint")                 \
99    DEF(ATMERR_PREVIOUSLY_ABORTED,-12,"previously aborted")              \
100    DEF(ATMERR_NO_CALL,          -13,"no incoming call")                 \
101    DEF(ATMERR_BAD_LEAF_IDENT,   -14,"bad leaf identifier")              \
102    DEF(ATMERR_BAD_PORT,         -15,"unknown port")                     \
103    DEF(ATMERR_BAD_SIGNAL,       -29-UNIAPI_ERROR_BAD_SIGNAL, "bad signal")\
104    DEF(ATMERR_BADCU,            -29-UNIAPI_ERROR_BADCU, "bad coordinator state")\
105    DEF(ATMERR_BAD_CALLSTATE,    -29-UNIAPI_ERROR_BAD_CALLSTATE, "bad call state")\
106    DEF(ATMERR_BAD_EPSTATE,      -29-UNIAPI_ERROR_BAD_EPSTATE, "bad party state")\
107    DEF(ATMERR_BAD_UNIARG,       -29-UNIAPI_ERROR_BAD_ARG, "bad uni argument")\
108    DEF(ATMERR_BAD_CALL,         -29-UNIAPI_ERROR_BAD_CALL, "unknown call")\
109    DEF(ATMERR_BAD_PARTY,        -29-UNIAPI_ERROR_BAD_PARTY, "unknown party")\
110    DEF(ATMERR_BAD_CTYPE,        -29-UNIAPI_ERROR_BAD_CTYPE, "wrong call type")\
111    DEF(ATMERR_BAD_IE,           -29-UNIAPI_ERROR_BAD_IE, "bad information element")\
112    DEF(ATMERR_EPREF_INUSE,      -29-UNIAPI_ERROR_EPREF_INUSE, "endpoint reference in use")\
113    DEF(ATMERR_MISSING_IE,       -29-UNIAPI_ERROR_MISSING_IE, "missing information element")\
114    DEF(ATMERR_ENCODING,         -29-UNIAPI_ERROR_ENCODING, "encoding error")\
115    DEF(ATMERR_NOMEM,            -29-UNIAPI_ERROR_NOMEM, "no memory")\
116    DEF(ATMERR_UNIBUSY,          -29-UNIAPI_ERROR_BUSY, "uni process busy")
117
118 #define ATM_MKUNIERR(E) (-29 - (E))
119
120 enum atm_error {
121 #define DEF(NAME,VAL,STR)       NAME = (VAL),
122 ATM_DEFINE_ERRORS
123 #undef DEF
124 };
125
126 enum atm_attribute {
127         ATM_ATTR_NONE = 0,
128         ATM_ATTR_BLLI_SELECTOR,
129         ATM_ATTR_BLLI,
130         ATM_ATTR_BEARER,
131         ATM_ATTR_TRAFFIC,
132         ATM_ATTR_QOS,
133         ATM_ATTR_EXQOS,
134         ATM_ATTR_CALLED,
135         ATM_ATTR_CALLEDSUB,
136         ATM_ATTR_CALLING,
137         ATM_ATTR_CALLINGSUB,
138         ATM_ATTR_AAL,
139         ATM_ATTR_EPREF,
140         ATM_ATTR_CONNED,
141         ATM_ATTR_CONNEDSUB,
142         ATM_ATTR_EETD,
143         ATM_ATTR_ABRSETUP,
144         ATM_ATTR_ABRADD,
145         ATM_ATTR_CONNID,
146         ATM_ATTR_MDCR,
147 };
148
149 struct atm_resp {
150         int32_t         resp;
151         uint32_t        data;           /* type of attached data */
152 };
153 enum {
154         ATMRESP_NONE,                   /* no data */
155         ATMRESP_ATTRS,                  /* attribute(s) */
156         ATMRESP_PORTS,                  /* port info */
157         ATMRESP_STATE,                  /* endpoint state */
158         ATMRESP_EXSTAT,                 /* extended status */
159 };
160
161 struct atm_abort_connection {
162         struct uni_ie_cause cause;
163 };
164
165 struct atm_query_connection_attributes {
166         uint32_t        attr;
167 };
168 struct atm_set_connection_attributes {
169         uint32_t        attr;
170 };
171 struct atm_query_connection_attributes_x {
172         uint32_t        count;
173 #if defined(__GNUC__) && __GNUC__ < 3
174         uint32_t        attr[0];
175 #else
176         uint32_t        attr[];
177 #endif
178 };
179 struct atm_set_connection_attributes_x {
180         uint32_t        count;
181 #if defined(__GNUC__) && __GNUC__ < 3
182         uint32_t        attr[0];
183 #else
184         uint32_t        attr[];
185 #endif
186 };
187 struct atm_prepare_incoming_call {
188         struct uni_sap  sap;
189         uint32_t        queue_size;
190 };
191 struct atm_connect_outgoing_call {
192         struct uni_ie_called    called;
193 };
194 struct atm_call_release {
195         struct uni_ie_cause     cause[2];
196 };
197 struct atm_p2p_call_active {
198         struct uni_ie_connid    connid;
199 };
200 struct atm_p2mp_call_active {
201         struct uni_ie_connid    connid;
202 };
203 struct atm_accept_incoming_call {
204         char    newep[ATM_EPNAMSIZ];
205 };
206 struct atm_reject_incoming_call {
207         struct uni_ie_cause     cause;
208 };
209 struct atm_add_party {
210         uint16_t                leaf_ident;
211         struct uni_ie_called    called;
212 };
213 struct atm_add_party_success {
214         uint16_t                leaf_ident;
215 };
216 struct atm_add_party_reject {
217         uint16_t                leaf_ident;
218         struct uni_ie_cause     cause;
219 };
220 struct atm_drop_party {
221         uint16_t                leaf_ident;
222         struct uni_ie_cause     cause;
223 };
224
225 /*
226  * Get local port info. If port is 0, information on all ports is returned,
227  * otherwise only on the named port.
228  * The response consists of a header with two counters, a list of ports
229  * (struct atm_port_info) and a list of addresses (struct uni_addr).
230  * The port to which an address belongs is implicit in the num_addrs field
231  * of the port.
232  */
233 struct atm_get_local_port_info {
234         uint32_t        port;
235 };
236
237 struct atm_port_list {
238         uint32_t        num_ports;      /* number of ports */
239         uint32_t        num_addrs;      /* total number of addresses */
240 };
241
242 struct atm_port_info {
243         uint32_t        port;
244         uint32_t        pcr;
245         uint32_t        max_vpi_bits;
246         uint32_t        max_vci_bits;
247         uint32_t        max_svpc_vpi;
248         uint32_t        max_svcc_vpi;
249         uint32_t        min_svcc_vci;
250         u_char          esi[6];
251         uint32_t        num_addrs;      /* number of addresses on this port */
252 };
253
254 /*
255  * Endpoint state info
256  */
257 struct atm_epstate {
258         char    name[ATM_EPNAMSIZ];
259         uint8_t state;
260 };
261
262 /*
263  * Extended status information.
264  */
265 struct atm_exstatus {
266         uint32_t        neps;           /* endpoints */
267         uint32_t        nports;         /* ports */
268         uint32_t        nconns;         /* connections */
269         uint32_t        nparties;       /* number of parties */
270 };
271 struct atm_exstatus_ep {
272         char            name[ATM_EPNAMSIZ];
273         uint8_t         state;          /* Ux */
274 };
275 struct atm_exstatus_port {
276         uint32_t        portno;
277         uint8_t         state;
278 };
279 struct atm_exstatus_conn {
280         uint32_t        id;
281         uint32_t        cref;           /* (flag << 23) | cref */
282         uint32_t        port;
283         char            ep[ATM_EPNAMSIZ];       /* \0 - none */
284         uint8_t         state;          /* Cx */
285 };
286 struct atm_exstatus_party {
287         uint32_t        connid;
288         uint16_t        epref;
289         uint8_t         state;          /* Px */
290 };
291 #endif