MFC:
[dragonfly.git] / sys / netproto / atm / atm_cm.h
blob3a9a2ec479f514405e4d8bc53cbc904b7cded33b
1 /*
3 * ===================================
4 * HARP | Host ATM Research Platform
5 * ===================================
8 * This Host ATM Research Platform ("HARP") file (the "Software") is
9 * made available by Network Computing Services, Inc. ("NetworkCS")
10 * "AS IS". NetworkCS does not provide maintenance, improvements or
11 * support of any kind.
13 * NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
14 * INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
15 * AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
16 * SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
17 * In no event shall NetworkCS be responsible for any damages, including
18 * but not limited to consequential damages, arising from or relating to
19 * any use of the Software or related support.
21 * Copyright 1994-1998 Network Computing Services, Inc.
23 * Copies of this Software may be made, however, the above copyright
24 * notice must be reproduced on all copies.
26 * @(#) $FreeBSD: src/sys/netatm/atm_cm.h,v 1.2 1999/08/28 00:48:35 peter Exp $
27 * @(#) $DragonFly: src/sys/netproto/atm/atm_cm.h,v 1.3 2003/08/23 10:06:21 rob Exp $
32 * Core ATM Services
33 * -----------------
35 * ATM Connection Management definitions
39 #ifndef _NETATM_ATM_CM_H
40 #define _NETATM_ATM_CM_H
43 * Forward declaration
45 struct atm_connection;
46 struct atm_attributes;
49 #ifdef ATM_KERNEL
51 * Structure used to define a kernel ATM endpoint service module and its
52 * associated entry points. An endpoint service is defined as a kernel
53 * entity which will serve as the endpoint of an ATM connection, i.e. it is
54 * responsible for issuing/receiving requests to/from the connection manager.
56 struct atm_endpoint {
57 struct atm_endpoint *ep_next; /* Next in registry list */
58 u_int ep_id; /* Endpoint ID (see below) */
60 /* Exported functions: Miscellaneous */
61 int (*ep_ioctl) /* Ioctl */
62 (int, caddr_t, caddr_t);
63 caddr_t (*ep_getname) /* Get application/owner name */
64 (void *);
66 /* Exported functions: Connection Manager Control API */
67 void (*ep_connected) /* Call connected */
68 (void *);
69 void (*ep_cleared) /* Call cleared */
70 (void *, struct t_atm_cause *);
71 int (*ep_incoming) /* Incoming call */
72 (void *, struct atm_connection *,
73 struct atm_attributes *, void **);
74 int (*ep_addparty) /* Add Party notification */
75 (void *, int, int);
76 int (*ep_dropparty) /* Drop Party notification */
77 (void *, int, int);
79 /* Exported functions: Connection Manager Data API: CPCS */
80 void (*ep_cpcs_ctl) /* Control operation */
81 (int, void *, void *);
82 void (*ep_cpcs_data) /* Received data */
83 (void *, KBuffer *);
85 /* Exported functions: Connection Manager Data API: SAAL */
86 void (*ep_saal_ctl) /* Control operation */
87 (int, void *, void *);
88 void (*ep_saal_data) /* Received data */
89 (void *, KBuffer *);
91 /* Exported functions: Connection Manager Data API: SSCOP */
92 void (*ep_sscop_ctl) /* Control operation */
93 (int, void *, void *, void *);
94 void (*ep_sscop_data) /* Received data */
95 (void *, KBuffer *, u_int);
97 typedef struct atm_endpoint Atm_endpoint;
98 #endif /* ATM_KERNEL */
101 * Endpoint IDs
103 #define ENDPT_UNKNOWN 0 /* Unknown */
104 #define ENDPT_IP 1 /* IP over ATM */
105 #define ENDPT_ATMARP 2 /* ATMARP */
106 #define ENDPT_SPANS_SIG 3 /* SPANS Signalling */
107 #define ENDPT_SPANS_CLS 4 /* SPANS CLS */
108 #define ENDPT_UNI_SIG 5 /* UNI Signalling */
109 #define ENDPT_SOCK_AAL5 6 /* Socket - AAL5 */
110 #define ENDPT_SOCK_SSCOP 7 /* Socket - SSCOP */
111 #define ENDPT_MAX 7
115 * ATM Connection Attributes
117 * Note: Attribute tag values are the same as the SVE_tag values.
118 * Unless otherwise specified, attribute field values are the same
119 * as the corresponding socket option values.
120 * The above values are all defined in netatm/atm.h.
123 /* AAL Attributes */
124 struct t_atm_aal4 {
125 int32_t forward_max_SDU_size;
126 int32_t backward_max_SDU_size;
127 int32_t SSCS_type;
128 int32_t mid_low;
129 int32_t mid_high;
132 struct attr_aal {
133 int tag; /* Attribute tag */
134 Aal_t type; /* AAL type (discriminator) */
135 union {
136 struct t_atm_aal4 aal4;
137 struct t_atm_aal5 aal5;
138 } v; /* Attribute value */
141 /* Traffic Descriptor Attributes */
142 struct attr_traffic {
143 int tag; /* Attribute tag */
144 struct t_atm_traffic v; /* Attribute value */
147 /* Broadband Bearer Attributes */
148 struct attr_bearer {
149 int tag; /* Attribute tag */
150 struct t_atm_bearer v; /* Attribute value */
153 /* Broadband High Layer Information Attributes */
154 struct attr_bhli {
155 int tag; /* Attribute tag */
156 struct t_atm_bhli v; /* Attribute value */
159 /* Broadband Low Layer Information Attributes */
160 struct attr_blli {
161 int tag_l2; /* Layer 2 attribute tag */
162 int tag_l3; /* Layer 3 attribute tag */
163 struct t_atm_blli v; /* Attribute value */
166 /* Logical Link Control Attributes (multiplexing use only, not signalled) */
167 struct attr_llc {
168 int tag; /* Attribute tag */
169 struct t_atm_llc v; /* Attribute value */
172 /* Called Party Attributes */
173 struct attr_called {
174 int tag; /* Attribute tag */
175 Atm_addr addr; /* Called party address */
176 Atm_addr subaddr; /* Called party subaddress */
179 /* Calling Party Attributes */
180 struct attr_calling {
181 int tag; /* Attribute tag */
182 Atm_addr addr; /* Calling party address */
183 Atm_addr subaddr; /* Calling party subaddress */
184 struct t_atm_caller_id cid; /* Caller ID */
187 /* Quality of Service Attributes */
188 struct attr_qos {
189 int tag; /* Attribute tag */
190 struct t_atm_qos v; /* Attribute value */
193 /* Transit Network Attributes */
194 struct attr_transit {
195 int tag; /* Attribute tag */
196 struct t_atm_transit v; /* Attribute value */
199 /* Cause Attributes */
200 struct attr_cause {
201 int tag; /* Attribute tag */
202 struct t_atm_cause v; /* Attribute value */
206 struct atm_attributes {
207 struct atm_nif *nif; /* Network interface */
208 u_int api; /* Connect Mgr Data API (see below) */
209 int api_init;/* API initialization parameter */
210 u_short headin; /* Input buffer headroom */
211 u_short headout;/* Output buffer headroom */
212 struct attr_aal aal; /* AAL attributes */
213 struct attr_traffic traffic;/* Traffic descriptor attributes */
214 struct attr_bearer bearer; /* Broadband bearer attributes */
215 struct attr_bhli bhli; /* Broadband high layer attributes */
216 struct attr_blli blli; /* Broadband low layer attributes */
217 struct attr_llc llc; /* Logical link control attributes */
218 struct attr_called called; /* Called party attributes */
219 struct attr_calling calling;/* Calling party attributes */
220 struct attr_qos qos; /* Quality of service attributes */
221 struct attr_transit transit;/* Transit network attributes */
222 struct attr_cause cause; /* Cause attributes */
224 typedef struct atm_attributes Atm_attributes;
227 * Connection Manager Data APIs
229 #define CMAPI_CPCS 0 /* AAL CPCS */
230 #define CMAPI_SAAL 1 /* Signalling AAL */
231 #define CMAPI_SSCOP 2 /* Reliable data (SSCOP) */
234 #ifdef ATM_KERNEL
236 * ATM Connection Instance
238 * There will be one connection block for each endpoint <-> Connection Manager
239 * API instance. Note that with connection multiplexors (e.g. LLC), there
240 * may be multiple connections per VCC.
242 struct atm_connection {
243 struct atm_connection *co_next; /* Multiplexor/listen queue link */
244 struct atm_connection *co_mxh; /* Connection multiplexor head */
245 u_char co_flags; /* Connection flags (see below) */
246 u_char co_state; /* User <-> CM state (see below) */
247 Encaps_t co_mpx; /* Multiplexor type */
248 void *co_toku; /* Endpoint's session token */
249 Atm_endpoint *co_endpt; /* Endpoint service */
250 struct atm_connvc *co_connvc; /* Connection VCC */
251 struct attr_llc co_llc; /* Connection LLC header */
252 Atm_attributes *co_lattr; /* Listening attributes */
254 typedef struct atm_connection Atm_connection;
257 * Connection Flags
259 #define COF_P2P 0x01 /* Point-to-point */
260 #define COF_P2MP 0x02 /* Point-to-multipoint */
263 * Endpoint <-> Connection Manager States
265 #define COS_FREE 0 /* Not allocated */
266 #define COS_OUTCONN 1 /* Outgoing connection pending */
267 #define COS_LISTEN 2 /* Listening for connection */
268 #define COS_INCONN 3 /* Incoming connection pending */
269 #define COS_INACCEPT 4 /* Incoming connection accepted */
270 #define COS_ACTIVE 5 /* Connection active */
271 #define COS_CLEAR 6 /* Connection is clearing */
275 * ATM Connection VCC Instance
277 * There will be one connection-vcc block for each VCC created by the
278 * Connection Manager. For multiplexed connections, there may be multiple
279 * connection blocks associated with each connection-vcc. This block is
280 * used to control the Connection Manager <-> VCC interface, including the
281 * interfaces to stack management and the signalling manager.
283 struct atm_connvc {
284 Qelem_t cvc_q; /* Queueing links */
285 Atm_connection *cvc_conn; /* Connection head */
286 struct vccb *cvc_vcc; /* VCC for connection */
287 struct sigmgr *cvc_sigmgr; /* VCC signalling manager */
288 u_char cvc_flags; /* Connection flags (see below) */
289 u_char cvc_state; /* CM - VCC state (see below) */
290 void *cvc_tokl; /* Stack lower layer token */
291 void (*cvc_lower) /* Stack lower layer handler */
292 (int, void *, int, int);
293 u_short cvc_upcnt; /* Up stack calls in progress */
294 u_short cvc_downcnt; /* Down stack calls in progress */
295 KBuffer *cvc_rcvq; /* Packet receive queue */
296 int cvc_rcvqlen; /* Receive queue length */
297 Atm_attributes cvc_attr; /* VCC attributes */
298 struct atm_time cvc_time; /* Timer controls */
300 typedef struct atm_connvc Atm_connvc;
303 * Connection Flags
305 #define CVCF_ABORTING 0x01 /* VCC abort is pending */
306 #define CVCF_INCOMQ 0x02 /* VCC is on incoming queue */
307 #define CVCF_CONNQ 0x04 /* VCC is on connection queue */
308 #define CVCF_CALLER 0x08 /* We are the call originator */
311 * Connection Manager <-> VCC States
313 #define CVCS_FREE 0 /* Not allocated */
314 #define CVCS_SETUP 1 /* Call setup pending */
315 #define CVCS_INIT 2 /* Stack INIT pending */
316 #define CVCS_INCOMING 3 /* Incoming call present */
317 #define CVCS_ACCEPT 4 /* Incoming call accepted */
318 #define CVCS_REJECT 5 /* Incoming call rejected */
319 #define CVCS_ACTIVE 6 /* Stack active */
320 #define CVCS_RELEASE 7 /* Connection release pending */
321 #define CVCS_CLEAR 8 /* Call has been cleared */
322 #define CVCS_TERM 9 /* Stack TERM pending */
326 * Connection VCC variables
328 #define CVC_RCVQ_MAX 3 /* Max length of receive queue */
332 * Timer macros
334 #define CVC_TIMER(s, t) atm_timeout(&(s)->cvc_time, (t), atm_cm_timeout)
335 #define CVC_CANCEL(s) atm_untimeout(&(s)->cvc_time)
339 * Connection Manager Statistics
341 struct atm_cm_stat {
342 u_long cms_llcdrop; /* Packets dropped by llc demux'ing */
343 u_long cms_llcid; /* Packets with unknown llc id */
344 u_long cms_rcvconn; /* Packets dropped, bad conn state */
345 u_long cms_rcvconnvc; /* Packets dropped, bad connvc state */
347 #endif /* ATM_KERNEL */
349 #endif /* _NETATM_ATM_CM_H */