unidef.h revision 122205
1/*
2 * Copyright (c) 1996-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: Hartmut Brandt <harti@freebsd.org>
28 *
29 * $Begemot: libunimsg/atm/sig/unidef.h,v 1.6 2003/09/19 12:03:34 hbb Exp $
30 *
31 * UNI public definitions.
32 */
33#ifndef _ATM_SIG_UNIDEF_H_
34#define _ATM_SIG_UNIDEF_H_
35
36/*
37 * Debug facilities
38 */
39#define UNI_DEBUG_FACILITIES		\
40	UNI_DEBUG_DEFINE(TIMEOUT)	\
41	UNI_DEBUG_DEFINE(RESTART)	\
42	UNI_DEBUG_DEFINE(SAAL)		\
43	UNI_DEBUG_DEFINE(PARSE)		\
44	UNI_DEBUG_DEFINE(CALL)		\
45	UNI_DEBUG_DEFINE(WARN)		\
46	UNI_DEBUG_DEFINE(COORD)		\
47	UNI_DEBUG_DEFINE(API)		\
48	UNI_DEBUG_DEFINE(MSG)		\
49	UNI_DEBUG_DEFINE(ERR)		\
50	UNI_DEBUG_DEFINE(VERIFY)	\
51
52enum uni_verb {
53#define UNI_DEBUG_DEFINE(D) UNI_FAC_##D,
54	UNI_DEBUG_FACILITIES
55#undef UNI_DEBUG_DEFINE
56
57	UNI_MAXFACILITY,
58};
59
60/*
61 * Default timer values and repeat counts
62 */
63#define UNI_T301_DEFAULT	180000
64#define UNI_T303_DEFAULT	4000
65#define UNI_T303_CNT_DEFAULT	2
66#define UNI_T308_DEFAULT	30000
67#define UNI_T308_CNT_DEFAULT	2
68#define UNI_T309_DEFAULT	10000
69#define UNI_T310U_DEFAULT	30000
70#define UNI_T310N_DEFAULT	10000
71#define UNI_T313_DEFAULT	4000
72#define UNI_T316_DEFAULT	120000
73#define UNI_T316_CNT_DEFAULT	2
74#define UNI_T317_DEFAULT	90000
75#define UNI_T322_DEFAULT	4000
76#define UNI_T322_CNT_DEFAULT	2
77#define UNI_T397_DEFAULT	UNI_T301_DEFAULT
78#define UNI_T398_DEFAULT	4000
79#define UNI_T399U_DEFAULT	(UNI_T303_DEFAULT + UNI_T310U_DEFAULT)
80#define UNI_T399N_DEFAULT	(UNI_T303_DEFAULT + UNI_T310N_DEFAULT)
81
82/*
83 * Protocol support
84 */
85enum uni_proto {
86	UNIPROTO_UNI40U,	/* UNI4.0 user side */
87	UNIPROTO_UNI40N,	/* UNI4.0 network side */
88	UNIPROTO_PNNI10,	/* PNNI1.0 */
89};
90enum uni_popt {
91	UNIPROTO_GFP	= 0x0001,	/* enable GFP */
92	UNIPROTO_SB_TB	= 0x0002,	/* Coincident Sb-Tb/Tb */
93
94	UNIPROTO_ALLMASK = 0x0003,
95};
96
97/*
98 * Other options
99 */
100enum uni_option {
101	UNIOPT_GIT_HARD		= 0x0001,	/* harder check of GIT IE */
102	UNIOPT_BEARER_HARD	= 0x0002,	/* harder check of BEARER IE */
103	UNIOPT_CAUSE_HARD	= 0x0004,	/* harder check of CAUSE IE */
104
105	UNIOPT_ALLMASK		= 0x0007,
106};
107
108/*
109 * UNI configuration
110 */
111struct uni_config {
112	u_int32_t	proto;		/* which protocol */
113	u_int32_t	popt;		/* protocol option */
114	u_int32_t	option;		/* other options */
115	u_int32_t	timer301;	/* T301 */
116	u_int32_t	timer303;	/* T303 */
117	u_int32_t	init303;	/* T303 retransmission count */
118	u_int32_t	timer308;	/* T308 */
119	u_int32_t	init308;	/* T308 retransmission count */
120	u_int32_t	timer309;	/* T309 */
121	u_int32_t	timer310;	/* T310 */
122	u_int32_t	timer313;	/* T313 */
123	u_int32_t	timer316;	/* T316 */
124	u_int32_t	init316;	/* T316 retransmission count */
125	u_int32_t	timer317;	/* T317 */
126	u_int32_t	timer322;	/* T322 */
127	u_int32_t	init322;	/* T322 retransmission count */
128	u_int32_t	timer397;	/* T397 */
129	u_int32_t	timer398;	/* T398 */
130	u_int32_t	timer399;	/* T399 */
131};
132enum uni_config_mask {
133	UNICFG_PROTO	= 0x00000001,
134	UNICFG_TIMER301	= 0x00000002,
135	UNICFG_TIMER303	= 0x00000004,
136	UNICFG_INIT303	= 0x00000008,
137	UNICFG_TIMER308	= 0x00000010,
138	UNICFG_INIT308	= 0x00000020,
139	UNICFG_TIMER309	= 0x00000040,
140	UNICFG_TIMER310	= 0x00000080,
141	UNICFG_TIMER313	= 0x00000100,
142	UNICFG_TIMER316	= 0x00000200,
143	UNICFG_INIT316	= 0x00000400,
144	UNICFG_TIMER317	= 0x00000800,
145	UNICFG_TIMER322	= 0x00001000,
146	UNICFG_INIT322	= 0x00002000,
147	UNICFG_TIMER397	= 0x00004000,
148	UNICFG_TIMER398	= 0x00008000,
149	UNICFG_TIMER399	= 0x00010000,
150
151	UNICFG_ALLMASK	= 0x0001ffff,
152};
153
154/*
155 * API signals
156 */
157enum uni_sig {
158	UNIAPI_ERROR			= 0,	/* UNI -> API */
159
160	UNIAPI_CALL_CREATED		= 1,	/* UNI -> API */
161	UNIAPI_CALL_DESTROYED		= 2,	/* UNI -> API */
162	UNIAPI_PARTY_CREATED		= 3,	/* UNI -> API */
163	UNIAPI_PARTY_DESTROYED		= 4,	/* UNI -> API */
164
165	UNIAPI_LINK_ESTABLISH_request	= 5,	/* API -> UNI */
166	UNIAPI_LINK_ESTABLISH_confirm	= 6,	/* UNI -> API */
167	UNIAPI_LINK_RELEASE_request	= 7,	/* API -> UNI */
168	UNIAPI_LINK_RELEASE_confirm	= 8,	/* UNI -> API */
169
170	UNIAPI_RESET_request		= 9,	/* API -> UNI */
171	UNIAPI_RESET_confirm		= 10,	/* UNI -> API */
172	UNIAPI_RESET_indication		= 11,	/* UNI -> API */
173	UNIAPI_RESET_ERROR_indication	= 12,	/* UNI -> API */
174	UNIAPI_RESET_response		= 13,	/* API -> UNI */
175	UNIAPI_RESET_ERROR_response	= 14,	/* API -> UNI */
176	UNIAPI_RESET_STATUS_indication	= 15,	/* UNI -> API */
177
178	UNIAPI_SETUP_request		= 16,	/* API -> UNI */
179	UNIAPI_SETUP_indication		= 17,	/* UNI -> API */
180	UNIAPI_SETUP_response		= 18,	/* API -> UNI */
181	UNIAPI_SETUP_confirm		= 19,	/* UNI -> API */
182	UNIAPI_SETUP_COMPLETE_indication= 20,	/* U-UNI -> API */
183	UNIAPI_SETUP_COMPLETE_request	= 46,	/* API -> N-UNI */
184	UNIAPI_ALERTING_request		= 21,	/* API -> UNI */
185	UNIAPI_ALERTING_indication	= 22,	/* UNI -> API */
186	UNIAPI_PROCEEDING_request	= 23,	/* API -> UNI */
187	UNIAPI_PROCEEDING_indication	= 24,	/* UNI -> API */
188	UNIAPI_RELEASE_request		= 25,	/* API -> UNI */
189	UNIAPI_RELEASE_indication	= 26,	/* UNI -> API */
190	UNIAPI_RELEASE_response		= 27,	/* API -> UNI */
191	UNIAPI_RELEASE_confirm		= 28,	/* UNI -> API */
192	UNIAPI_NOTIFY_request		= 29,	/* API -> UNI */
193	UNIAPI_NOTIFY_indication	= 30,	/* UNI -> API */
194	UNIAPI_STATUS_indication	= 31,	/* UNI -> API */
195	UNIAPI_STATUS_ENQUIRY_request	= 32,	/* API -> UNI */
196
197	UNIAPI_ADD_PARTY_request	= 33,	/* API -> UNI */
198	UNIAPI_ADD_PARTY_indication	= 34,	/* UNI -> API */
199	UNIAPI_PARTY_ALERTING_request	= 35,	/* API -> UNI */
200	UNIAPI_PARTY_ALERTING_indication= 36,	/* UNI -> API */
201	UNIAPI_ADD_PARTY_ACK_request	= 37,	/* API -> UNI */
202	UNIAPI_ADD_PARTY_ACK_indication	= 38,	/* UNI -> API */
203	UNIAPI_ADD_PARTY_REJ_request	= 39,	/* API -> UNI */
204	UNIAPI_ADD_PARTY_REJ_indication	= 40,	/* UNI -> API */
205	UNIAPI_DROP_PARTY_request	= 41,	/* API -> UNI */
206	UNIAPI_DROP_PARTY_indication	= 42,	/* UNI -> API */
207	UNIAPI_DROP_PARTY_ACK_request	= 43,	/* API -> UNI */
208	UNIAPI_DROP_PARTY_ACK_indication= 44,	/* UNI -> API */
209
210	UNIAPI_ABORT_CALL_request	= 45,	/* API -> UNI */
211
212	UNIAPI_MAXSIG = 47
213};
214
215struct uniapi_error {
216	u_int32_t	reason;
217	u_int32_t	state;
218};
219/* keep this in sync with atmapi.h:enum atmerr */
220
221#define UNIAPI_DEF_ERRORS(MACRO)					\
222	MACRO(OK, 0, "no error")					\
223	MACRO(ERROR_BAD_SIGNAL,	1, "unknown signal")			\
224	MACRO(ERROR_BADCU,	2, "signal in bad co-ordinator state")	\
225	MACRO(ERROR_BAD_CALLSTATE, 3, "signal in bad call state")	\
226	MACRO(ERROR_BAD_EPSTATE, 4, "signal in bad endpoint state")	\
227	MACRO(ERROR_BAD_ARG,	5, "bad argument")			\
228	MACRO(ERROR_BAD_CALL,	6, "unknown call reference")		\
229	MACRO(ERROR_BAD_PARTY,	7, "unknown party")			\
230	MACRO(ERROR_BAD_CTYPE,	8, "bad type of call for signal")	\
231	MACRO(ERROR_BAD_IE,	9, "bad information element")		\
232	MACRO(ERROR_EPREF_INUSE, 10, "endpoint reference already in use") \
233	MACRO(ERROR_MISSING_IE,	11, "missing information element")	\
234	MACRO(ERROR_ENCODING,	12, "error during message encoding")	\
235	MACRO(ERROR_NOMEM,	13, "out of memory")			\
236	MACRO(ERROR_BUSY,	14, "status enquiry busy")
237
238enum {
239#define DEF(NAME, VAL, STR) UNIAPI_##NAME = VAL,
240UNIAPI_DEF_ERRORS(DEF)
241#undef DEF
242};
243
244struct uniapi_call_created {
245	struct uni_cref		cref;
246};
247struct uniapi_call_destroyed {
248	struct uni_cref		cref;
249};
250struct uniapi_party_created {
251	struct uni_cref		cref;
252	struct uni_ie_epref	epref;
253};
254struct uniapi_party_destroyed {
255	struct uni_cref		cref;
256	struct uni_ie_epref	epref;
257};
258struct uniapi_abort_call_request {
259	struct uni_cref		cref;
260};
261
262struct uniapi_reset_request {
263	struct uni_ie_restart	restart;
264	struct uni_ie_connid	connid;
265};
266
267struct uniapi_reset_confirm {
268	struct uni_ie_restart	restart;
269	struct uni_ie_connid	connid;
270};
271
272struct uniapi_reset_indication {
273	struct uni_ie_restart	restart;
274	struct uni_ie_connid	connid;
275
276};
277struct uniapi_reset_error_indication {
278	u_int32_t		source;		/* 0 - start, 1 - response */
279	u_int32_t		reason;
280};
281
282#define UNIAPI_DEF_RESET_ERRORS(MACRO)				\
283	MACRO(UNIAPI_RESET_ERROR_NO_CONFIRM,		0,	\
284	    "no confirmation")					\
285	MACRO(UNIAPI_RESET_ERROR_NO_RESPONSE,		1,	\
286	    "no response")					\
287	MACRO(UNIAPI_RESET_ERROR_PEER_INCOMP_STATE,	2,	\
288	    "incompatible state")
289enum {
290#define DEF(NAME, VALUE, STR) NAME = VALUE,
291UNIAPI_DEF_RESET_ERRORS(DEF)
292#undef DEF
293};
294
295struct uniapi_reset_response {
296	struct uni_ie_restart	restart;
297	struct uni_ie_connid	connid;
298};
299
300struct uniapi_reset_error_response {
301	struct uni_ie_cause	cause;
302};
303
304struct uniapi_reset_status_indication {
305	struct uni_cref		cref;		/* STATUS message CREF */
306	struct uni_ie_callstate	callstate;
307	struct uni_ie_cause	cause;
308};
309
310struct uniapi_setup_request {
311	struct uni_setup	setup;
312};
313struct uniapi_setup_indication {
314	struct uni_setup	setup;
315};
316struct uniapi_setup_response {
317	struct uni_connect	connect;
318};
319struct uniapi_setup_confirm {
320	struct uni_connect	connect;
321};
322struct uniapi_setup_complete_indication {
323	struct uni_connect_ack	connect_ack;
324};
325struct uniapi_setup_complete_request {
326	struct uni_connect_ack	connect_ack;
327};
328
329struct uniapi_alerting_request {
330	struct uni_alerting	alerting;
331};
332
333struct uniapi_alerting_indication {
334	struct uni_alerting	alerting;
335};
336
337struct uniapi_proceeding_request {
338	struct uni_call_proc	call_proc;
339};
340
341struct uniapi_proceeding_indication {
342	struct uni_call_proc	call_proc;
343};
344
345
346struct uniapi_release_request {
347	struct uni_release	release;
348};
349struct uniapi_release_indication {
350	struct uni_release	release;
351};
352struct uniapi_release_response {
353	struct uni_release_compl release_compl;
354};
355/*
356 * A release confirm can come from a RELEASE COMPLETE or a RELEASE.
357 * Because the IEs in a RELEASE COMPLETE are a subset of a RELEASE,
358 * use the RELEASE here.
359 */
360struct uniapi_release_confirm {
361	struct uni_release	release;
362};
363
364struct uniapi_notify_request {
365	struct uni_notify	notify;
366};
367struct uniapi_notify_indication {
368	struct uni_notify	notify;
369};
370
371struct uniapi_status_indication {
372	struct uni_cref		cref;
373	enum uni_callstate	my_state;
374	enum uni_cause		my_cause;
375	struct uni_ie_callstate	his_state;
376	struct uni_ie_cause	his_cause;
377	struct uni_ie_epref	epref;
378	struct uni_ie_epstate	epstate;
379};
380struct uniapi_status_enquiry_request {
381	struct uni_cref		cref;
382	struct uni_ie_epref	epref;
383};
384
385struct uniapi_add_party_request {
386	struct uni_add_party	add;
387};
388struct uniapi_add_party_indication {
389	struct uni_add_party	add;
390};
391
392struct uniapi_party_alerting_request {
393	struct uni_party_alerting alert;
394};
395struct uniapi_party_alerting_indication {
396	struct uni_party_alerting alert;
397};
398
399struct uniapi_add_party_ack_request {
400	struct uni_add_party_ack ack;
401};
402struct uniapi_add_party_ack_indication {
403	struct uni_add_party_ack ack;
404};
405struct uniapi_add_party_rej_request {
406	struct uni_add_party_rej rej;
407};
408struct uniapi_add_party_rej_indication {
409	struct uni_add_party_rej rej;
410};
411
412struct uniapi_drop_party_request {
413	struct uni_drop_party	drop;
414};
415struct uniapi_drop_party_indication {
416	struct uni_drop_party	drop;
417	struct uni_ie_cause	my_cause;
418};
419
420struct uniapi_drop_party_ack_request {
421	struct uni_drop_party_ack ack;
422};
423struct uniapi_drop_party_ack_indication {
424	struct uni_drop_party	drop;
425	struct uni_ie_crankback	crankback;
426};
427
428union uniapi_all {
429	struct uniapi_error			error;
430	struct uniapi_call_created		call_created;
431	struct uniapi_call_destroyed		call_destroyed;
432	struct uniapi_party_created		party_created;
433	struct uniapi_party_destroyed		party_destroyed;
434	struct uniapi_abort_call_request	abort_call_request;
435	struct uniapi_reset_request		reset_request;
436	struct uniapi_reset_confirm		reset_confirm;
437	struct uniapi_reset_indication		reset_indication;
438	struct uniapi_reset_error_indication	reset_error_indication;
439	struct uniapi_reset_response		reset_response;
440	struct uniapi_reset_error_response	reset_error_response;
441	struct uniapi_reset_status_indication	reset_status_indication;
442	struct uniapi_setup_request		setup_request;
443	struct uniapi_setup_indication		setup_indication;
444	struct uniapi_setup_response		setup_response;
445	struct uniapi_setup_confirm		setup_confirm;
446	struct uniapi_setup_complete_indication	setup_complete_indication;
447	struct uniapi_setup_complete_request	setup_complete_request;
448	struct uniapi_alerting_request		alerting_request;
449	struct uniapi_alerting_indication	alerting_indication;
450	struct uniapi_proceeding_request	proceeding_request;
451	struct uniapi_proceeding_indication	proceeding_indication;
452	struct uniapi_release_request		release_request;
453	struct uniapi_release_indication	release_indication;
454	struct uniapi_release_response		release_response;
455	struct uniapi_release_confirm		release_confirm;
456	struct uniapi_notify_request		notify_request;
457	struct uniapi_notify_indication		notify_indication;
458	struct uniapi_status_indication		status_indication;
459	struct uniapi_status_enquiry_request	status_enquiry_request;
460	struct uniapi_add_party_request		add_party_request;
461	struct uniapi_add_party_indication	add_party_indication;
462	struct uniapi_party_alerting_request	party_alerting_request;
463	struct uniapi_party_alerting_indication	party_alerting_indication;
464	struct uniapi_add_party_ack_request	add_party_ack_request;
465	struct uniapi_add_party_ack_indication	add_party_ack_indication;
466	struct uniapi_add_party_rej_request	add_party_rej_request;
467	struct uniapi_add_party_rej_indication	add_party_rej_indication;
468	struct uniapi_drop_party_request	drop_party_request;
469	struct uniapi_drop_party_indication	drop_party_indication;
470	struct uniapi_drop_party_ack_request	drop_party_ack_request;
471	struct uniapi_drop_party_ack_indication	drop_party_ack_indication;
472};
473
474#endif
475