1 /*
2  * Copyright (c) 1996-2003
3  *	Fraunhofer Institute for Open Communication Systems (FhG Fokus).
4  * 	All rights reserved.
5  *
6  * Author: Hartmut Brandt <[email protected]>
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  * 1. Redistributions of source code must retain the above copyright
12  *    notice, this list of conditions and the following disclaimer.
13  * 2. Redistributions in binary form must reproduce the above copyright
14  *    notice, this list of conditions and the following disclaimer in the
15  *    documentation and/or other materials provided with the distribution.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27  * SUCH DAMAGE.
28  *
29  * $Begemot: libunimsg/netnatm/msg/unistruct.h,v 1.7 2004/07/16 18:42:22 brandt Exp $
30  *
31  * This file defines all structures that are used by
32  * API users.
33  */
34 #ifndef _NETNATM_MSG_UNISTRUCT_H_
35 #define _NETNATM_MSG_UNISTRUCT_H_
36 
37 #include <netnatm/msg/uni_config.h>
38 
39 /*
40  * define IE and MSG header
41  */
42 #include <netnatm/msg/uni_hdr.h>
43 
44 /*
45  * define all IE's
46  */
47 /*************************************************************************
48  *
49  * Free FORM IE
50  */
51 struct uni_ie_unrec {
52 	struct uni_iehdr h;
53 	uint8_t id;		/* ID of this IE */
54 	u_int len;		/* data length */
55 	u_char data[128];	/* arbitrary maximum length */
56 };
57 
58 /*************************************************************************
59  *
60  * ATM adaptation layer parameters information element
61  */
62 enum {
63 	UNI_AAL_SUB_ID		= 0x85,
64 	UNI_AAL_CBR_ID		= 0x86,
65 	UNI_AAL_MULT_ID		= 0x87,
66 	UNI_AAL_SCREC_ID	= 0x88,
67 	UNI_AAL_ECM_ID		= 0x89,
68 	UNI_AAL_BSIZE_ID	= 0x8a,
69 	UNI_AAL_PART_ID		= 0x8b,
70 	UNI_AAL_FWDCPCS_ID	= 0x8c,
71 	UNI_AAL_BWDCPCS_ID	= 0x81,
72 	UNI_AAL_MID_ID		= 0x82,
73 	UNI_AAL_SSCS_ID		= 0x84,
74 };
75 
76 enum uni_aal {
77 	UNI_AAL_0	= 0x00,	/* voice */
78 	UNI_AAL_1	= 0x01,
79 	UNI_AAL_2	= 0x02,
80 	UNI_AAL_4	= 0x03,	/* same as AAL 3 */
81 	UNI_AAL_5	= 0x05,
82 	UNI_AAL_USER	= 0x10,
83 };
84 enum uni_aal1_subtype {
85 	UNI_AAL1_SUB_NULL	= 0x00,
86 	UNI_AAL1_SUB_VOICE	= 0x01,
87 	UNI_AAL1_SUB_CIRCUIT	= 0x02,
88 	UNI_AAL1_SUB_HQAUDIO	= 0x04,
89 	UNI_AAL1_SUB_VIDEO	= 0x05,
90 };
91 enum uni_aal1_cbr {
92 	UNI_AAL1_CBR_64		= 0x01,
93 	UNI_AAL1_CBR_1544	= 0x04,
94 	UNI_AAL1_CBR_6312	= 0x05,
95 	UNI_AAL1_CBR_32064	= 0x06,
96 	UNI_AAL1_CBR_44736	= 0x07,
97 	UNI_AAL1_CBR_97728	= 0x08,
98 	UNI_AAL1_CBR_2048	= 0x10,
99 	UNI_AAL1_CBR_8448	= 0x11,
100 	UNI_AAL1_CBR_34368	= 0x12,
101 	UNI_AAL1_CBR_139264	= 0x13,
102 	UNI_AAL1_CBR_N64	= 0x40,
103 	UNI_AAL1_CBR_N8		= 0x41,
104 };
105 enum uni_aal1_screc {
106 	UNI_AAL1_SCREC_NULL	= 0x00,	/* synchr. circuit transport */
107 	UNI_AAL1_SCREC_SRTS	= 0x01,	/* synchr. residual timestamp */
108 	UNI_AAL1_SCREC_ACLK	= 0x02,	/* adaptive clock */
109 };
110 enum uni_aal1_ecm {
111 	UNI_AAL1_ECM_NULL	= 0x00,	/* no error correction */
112 	UNI_AAL1_ECM_LOSS	= 0x01,	/* for loss sensitive signals */
113 	UNI_AAL1_ECM_DELAY	= 0x02,	/* for delay sensitive signals */
114 };
115 enum uni_aal_sscs {
116 	UNI_AAL_SSCS_NULL	= 0x00,	/* Null */
117 	UNI_AAL_SSCS_SSCOPA	= 0x01,	/* assured SSCOP */
118 	UNI_AAL_SSCS_SSCOPU	= 0x02,	/* unassured SSCOP */
119 	UNI_AAL_SSCS_FRAME	= 0x04,	/* frame relay */
120 };
121 
122 struct uni_ie_aal {
123 	struct uni_iehdr h;
124 	enum uni_aal	type;		/* aal type */
125 
126 	union {
127 #define UNI_AAL1_MULT_P	0x01
128 #define UNI_AAL1_SCREC_P	0x02
129 #define UNI_AAL1_ECM_P		0x04
130 #define UNI_AAL1_BSIZE_P	0x08
131 #define UNI_AAL1_PART_P	0x10
132 	    struct {
133 		enum uni_aal1_subtype subtype;	/* AAL1 subtype */
134 		enum uni_aal1_cbr cbr_rate;	/* AAL1 CBR rate */
135 		u_int		mult;		/* AAL1 CBR mutliplier */
136 		enum uni_aal1_screc screc;	/* AAL1 source clock recovery */
137 		enum uni_aal1_ecm ecm;		/* AAL1 error correction */
138 		u_int	bsize;			/* AAL1 SDT blocksize */
139 		u_int	part;			/* AAL1 partial cell fill */
140 	    } aal1;
141 
142 #define UNI_AAL4_CPCS_P	0x01
143 #define UNI_AAL4_MID_P		0x02
144 #define UNI_AAL4_SSCS_P	0x04
145 	    struct {
146 		u_int	fwd_cpcs;	/* max fwd cpcs blocksize */
147 		u_int	bwd_cpcs;	/* max bkw cpcs blocksize */
148 		u_int	mid_low;	/* MID low range */
149 		u_int	mid_high;	/* MID high range */
150 		enum uni_aal_sscs sscs;	/* sscs type */
151 	     } aal4;
152 
153 #define UNI_AAL5_CPCS_P	0x01
154 #define UNI_AAL5_SSCS_P	0x02
155 	    struct {
156 		u_int	fwd_cpcs;	/* max fwd cpcs blocksize */
157 		u_int	bwd_cpcs;	/* max bkw cpcs blocksize */
158 		enum uni_aal_sscs sscs;	/* sscs type */
159 	     } aal5;
160 
161 	    struct {
162 		u_int	len;		/* number of bytes */
163 		u_char	user[4];	/* user data */
164 	    } aalu;
165 	} u;
166 };
167 
168 /*************************************************************************
169  *
170  * Called party number information element
171  * Called party subaddress information element
172  * Calling party number information element
173  * Calling party subaddress information element
174  * Q.2951/UNI4.0 Connected number information element
175  * Q.2951/UNI4.0 Connected subaddress information element
176  */
177 enum uni_addr_type {
178 	UNI_ADDR_UNKNOWN	= 0x0,
179 	UNI_ADDR_INTERNATIONAL	= 0x1,
180 	UNI_ADDR_NATIONAL	= 0x2,	/* not sup */
181 	UNI_ADDR_NETWORK	= 0x3,	/* not sup */
182 	UNI_ADDR_SUBSCR		= 0x4,	/* not sup */
183 	UNI_ADDR_ABBR		= 0x6,	/* not sup */
184 };
185 enum uni_addr_plan {
186 	/* UNI_ADDR_UNKNOWN	= 0x0, */	/* not sup */
187 	UNI_ADDR_E164		= 0x1,
188 	UNI_ADDR_ATME		= 0x2,
189 	UNI_ADDR_DATA		= 0x3,	/* not sup */
190 	UNI_ADDR_PRIVATE	= 0x9,	/* not sup */
191 };
192 enum uni_subaddr_type {
193 	UNI_SUBADDR_NSAP	= 0x0,
194 	UNI_SUBADDR_ATME	= 0x1,
195 	UNI_SUBADDR_USER	= 0x2,	/* not sup */
196 };
197 enum uni_addr_pres {
198 	UNI_ADDR_PRES		= 0x0,
199 	UNI_ADDR_RESTRICT	= 0x1,
200 	UNI_ADDR_NONUMBER	= 0x2,
201 };
202 enum uni_addr_screen {
203 	UNI_ADDR_SCREEN_NOT	= 0x0,
204 	UNI_ADDR_SCREEN_PASSED	= 0x1,
205 	UNI_ADDR_SCREEN_FAILED	= 0x2,
206 	UNI_ADDR_SCREEN_NET	= 0x3,
207 };
208 
209 /* don't use bitfields to get a defined structure layout */
210 struct uni_addr {
211 	uint8_t			type;
212 	uint8_t			plan;
213 	uint8_t			len;
214 	u_char			addr[UNI_ADDR_MAXLEN];
215 };
216 struct uni_subaddr {
217 	enum uni_subaddr_type	type;
218 	u_int			len;
219 	u_char			addr[UNI_SUBADDR_MAXLEN];
220 };
221 
222 struct uni_ie_called {
223 	struct uni_iehdr	h;
224 	struct uni_addr	addr;
225 };
226 
227 struct uni_ie_calledsub {
228 	struct uni_iehdr	h;
229 	struct uni_subaddr	addr;
230 };
231 
232 struct uni_ie_calling {
233 	struct uni_iehdr	h;
234 #define UNI_CALLING_SCREEN_P 0x0001
235 
236 	struct uni_addr		addr;
237 	enum uni_addr_pres	pres;
238 	enum uni_addr_screen	screen;
239 };
240 
241 struct uni_ie_callingsub {
242 	struct uni_iehdr	h;
243 	struct uni_subaddr	addr;
244 };
245 
246 struct uni_ie_conned {
247 	struct uni_iehdr	h;
248 #define UNI_CONNED_SCREEN_P 0x0001
249 
250 	struct uni_addr		addr;
251 	enum uni_addr_pres	pres;
252 	enum uni_addr_screen	screen;
253 };
254 
255 struct uni_ie_connedsub {
256 	struct uni_iehdr	h;
257 	struct uni_subaddr	addr;
258 };
259 
260 /*************************************************************************
261  *
262  * Broadband bearer capability descriptor
263  * On reception of an old bearer descriptor, it is automatically
264  * converted to a new, legal one.
265  */
266 enum uni_bearer_class {
267 	UNI_BEARER_A		= 0x01,
268 	UNI_BEARER_C		= 0x03,
269 	UNI_BEARER_X		= 0x10,
270 	UNI_BEARER_TVP		= 0x30,
271 };
272 
273 enum uni_bearer_atc {
274 	UNI_BEARER_ATC_CBR	= 0x05,
275 	UNI_BEARER_ATC_CBR1	= 0x07,
276 	UNI_BEARER_ATC_VBR	= 0x09,
277 	UNI_BEARER_ATC_VBR1	= 0x13,
278 	UNI_BEARER_ATC_NVBR	= 0x0a,
279 	UNI_BEARER_ATC_NVBR1	= 0x0b,
280 	UNI_BEARER_ATC_ABR	= 0x0c,
281 
282 	UNI_BEARER_ATCX_0	= 0x00,
283 	UNI_BEARER_ATCX_1	= 0x01,
284 	UNI_BEARER_ATCX_2	= 0x02,
285 	UNI_BEARER_ATCX_4	= 0x04,
286 	UNI_BEARER_ATCX_6	= 0x06,
287 	UNI_BEARER_ATCX_8	= 0x08,
288 };
289 
290 enum uni_bearer_clip {
291 	UNI_BEARER_NOCLIP	= 0x0,
292 	UNI_BEARER_CLIP		= 0x1,
293 };
294 
295 enum uni_bearer_cfg {
296 	UNI_BEARER_P2P		= 0x0,
297 	UNI_BEARER_MP		= 0x1,
298 };
299 
300 struct uni_ie_bearer {
301 	struct uni_iehdr	h;
302 #define UNI_BEARER_ATC_P	0x02
303 
304 	enum uni_bearer_class	bclass;		/* bearer class */
305 	enum uni_bearer_atc	atc;		/* ATM transfer capability */
306 	enum uni_bearer_clip	clip;		/* suspectibility to clipping */
307 	enum uni_bearer_cfg	cfg;		/* u-plane configuration */
308 };
309 
310 /*************************************************************************
311  *
312  * Broadband higher layer information element
313  */
314 enum uni_bhli {
315 	UNI_BHLI_ISO	= 0x00,	/* IDO defined */
316 	UNI_BHLI_USER	= 0x01,	/* user specific */
317 	UNI_BHLI_VENDOR	= 0x03,	/* vendor specific */
318 };
319 
320 struct uni_ie_bhli {
321 	struct uni_iehdr	h;
322 	enum uni_bhli		type;
323 	u_char			info[8];
324 	u_int			len;
325 };
326 
327 /*************************************************************************
328  *
329  * Boradband lower layer information element
330  */
331 enum {
332 	UNI_BLLI_L1_ID		= 0x1,
333 	UNI_BLLI_L2_ID		= 0x2,
334 	UNI_BLLI_L3_ID		= 0x3,
335 };
336 
337 enum uni_blli_l2 {
338 	UNI_BLLI_L2_BASIC	= 0x01,
339 	UNI_BLLI_L2_Q921	= 0x02,
340 	UNI_BLLI_L2_X25LL	= 0x06,
341 	UNI_BLLI_L2_X25ML	= 0x07,
342 	UNI_BLLI_L2_LABP	= 0x08,
343 	UNI_BLLI_L2_HDLC_ARM	= 0x09,
344 	UNI_BLLI_L2_HDLC_NRM	= 0x0a,
345 	UNI_BLLI_L2_HDLC_ABM	= 0x0b,
346 	UNI_BLLI_L2_LAN		= 0x0c,
347 	UNI_BLLI_L2_X75		= 0x0d,
348 	UNI_BLLI_L2_Q922	= 0x0e,
349 	UNI_BLLI_L2_USER	= 0x10,
350 	UNI_BLLI_L2_ISO7776	= 0x11,
351 };
352 
353 enum uni_blli_l2_mode {
354 	UNI_BLLI_L2NORM		= 0x1,
355 	UNI_BLLI_L2EXT		= 0x2,
356 };
357 
358 enum uni_blli_l3 {
359 	UNI_BLLI_L3_X25		= 0x06,
360 	UNI_BLLI_L3_ISO8208	= 0x07,
361 	UNI_BLLI_L3_X223	= 0x08,
362 	UNI_BLLI_L3_CLMP	= 0x09,
363 	UNI_BLLI_L3_T70		= 0x0a,
364 	UNI_BLLI_L3_TR9577	= 0x0b,
365 	UNI_BLLI_L3_H310	= 0x0c,
366 	UNI_BLLI_L3_H321	= 0x0d,
367 	UNI_BLLI_L3_USER	= 0x10,
368 };
369 
370 enum uni_blli_l3_mode {
371 	UNI_BLLI_L3NSEQ		= 0x1,	/* normal sequence numbering */
372 	UNI_BLLI_L3ESEQ		= 0x2,	/* extended sequence numbering */
373 };
374 
375 enum uni_blli_l3_psiz {
376 	UNI_BLLI_L3_16		= 0x4,	/* 16 byte packets */
377 	UNI_BLLI_L3_32		= 0x5,	/* 32 byte packets */
378 	UNI_BLLI_L3_64		= 0x6,	/* 64 byte packets */
379 	UNI_BLLI_L3_128		= 0x7,	/* 128 byte packets */
380 	UNI_BLLI_L3_256		= 0x8,	/* 256 byte packets */
381 	UNI_BLLI_L3_512		= 0x9,	/* 512 byte packets */
382 	UNI_BLLI_L3_1024	= 0xa,	/* 1024 byte packets */
383 	UNI_BLLI_L3_2048	= 0xb,	/* 2048 byte packets */
384 	UNI_BLLI_L3_4096	= 0xc,	/* 4096 byte packets */
385 };
386 
387 enum uni_blli_l3_ttype {
388 	UNI_BLLI_L3_TTYPE_RECV	= 0x1,	/* receive only */
389 	UNI_BLLI_L3_TTYPE_SEND	= 0x2,	/* send only */
390 	UNI_BLLI_L3_TTYPE_BOTH	= 0x3,	/* both */
391 };
392 
393 enum uni_blli_l3_mux {
394 	UNI_BLLI_L3_MUX_NOMUX	= 0,	/* no multiplexing */
395 	UNI_BLLI_L3_MUX_TS	= 1,	/* transport stream */
396 	UNI_BLLI_L3_MUX_TSFEC	= 2,	/* transport stream with FEC */
397 	UNI_BLLI_L3_MUX_PS	= 3,	/* program stream */
398 	UNI_BLLI_L3_MUX_PSFEC	= 4,	/* program stream with FEC */
399 	UNI_BLLI_L3_MUX_H221	= 5,	/* H.221 */
400 };
401 
402 enum uni_blli_l3_tcap {
403 	UNI_BLLI_L3_TCAP_NOIND	= 0,	/* no indication */
404 	UNI_BLLI_L3_TCAP_AAL1	= 1,	/* only AAL1 */
405 	UNI_BLLI_L3_TCAP_AAL5	= 2,	/* only AAL5 */
406 	UNI_BLLI_L3_TCAP_AAL15	= 3,	/* AAL1 and AAL5 */
407 };
408 
409 /* Value for l3_ipi: */
410 enum {
411 	UNI_BLLI_L3_SNAP	= 0x80,	/* IEEE 802.1 SNAP */
412 };
413 
414 struct uni_ie_blli {
415 	struct uni_iehdr	h;
416 #define UNI_BLLI_L1_P		0x0001
417 #define UNI_BLLI_L2_P		0x0002
418 #define UNI_BLLI_L2_Q933_P	0x0004
419 #define UNI_BLLI_L2_WSIZ_P	0x0008
420 #define UNI_BLLI_L2_USER_P	0x0010
421 #define UNI_BLLI_L3_P		0x0020
422 #define UNI_BLLI_L3_MODE_P	0x0040
423 #define UNI_BLLI_L3_PSIZ_P	0x0080
424 #define UNI_BLLI_L3_WSIZ_P	0x0100
425 #define UNI_BLLI_L3_USER_P	0x0200
426 #define UNI_BLLI_L3_IPI_P	0x0400
427 #define UNI_BLLI_L3_SNAP_P	0x0800
428 #define UNI_BLLI_L3_TTYPE_P	0x1000
429 #define UNI_BLLI_L3_MUX_P	0x2000
430 
431 	u_int			l1:5;		/* layer 1 info */
432 
433 	enum uni_blli_l2	l2;		/* layer 2 info */
434 	u_int			l2_q933:2;	/* layer 2 Q.933 use */
435 	enum uni_blli_l2_mode	l2_mode;	/* layer 2 HDLC mode */
436 	u_char			l2_user;	/* layer 2 user info */
437 	u_char			l2_wsiz;	/* layer 2 window size */
438 
439 	enum uni_blli_l3	l3;		/* layer 3 info */
440 	enum uni_blli_l3_mode	l3_mode;	/* layer 3 mode */
441 	enum uni_blli_l3_psiz	l3_psiz;	/* layer 3 default packet size */
442 	u_char			l3_wsiz;	/* layer 3 window size */
443 	u_char			l3_user;	/* layer 3 user info */
444 	u_char			l3_ipi;		/* IPI byte */
445 	u_int			oui;		/* OUI bytes */
446 	u_int			pid;		/* PID bytes */
447 	enum uni_blli_l3_ttype	l3_ttype;	/* terminal bytes */
448 	enum uni_blli_l3_tcap	l3_tcap;	/* terminal capability */
449 	enum uni_blli_l3_mux	l3_fmux;	/* forward muxing */
450 	enum uni_blli_l3_mux	l3_bmux;	/* forward muxing */
451 };
452 
453 /*************************************************************************
454  *
455  * Transit network selection IE
456  */
457 struct uni_ie_tns {
458 	struct uni_iehdr h;
459 	u_char		net[UNI_TNS_MAXLEN];
460 	u_int		len;
461 };
462 
463 /*************************************************************************
464  *
465  * Call state information element
466  */
467 enum uni_callstate {
468 	UNI_CALLSTATE_U0	= 0x00,
469 	UNI_CALLSTATE_N0	= 0x00,
470 	UNI_CALLSTATE_NN0	= 0x00,
471 
472 	UNI_CALLSTATE_U1	= 0x01,
473 	UNI_CALLSTATE_N1	= 0x01,
474 	UNI_CALLSTATE_NN1	= 0x01,
475 
476 	UNI_CALLSTATE_U3	= 0x03,
477 	UNI_CALLSTATE_N3	= 0x03,
478 	UNI_CALLSTATE_NN3	= 0x03,
479 
480 	UNI_CALLSTATE_U4	= 0x04,
481 	UNI_CALLSTATE_N4	= 0x04,
482 	UNI_CALLSTATE_NN4	= 0x04,
483 
484 	UNI_CALLSTATE_U6	= 0x06,
485 	UNI_CALLSTATE_N6	= 0x06,
486 	UNI_CALLSTATE_NN6	= 0x06,
487 
488 	UNI_CALLSTATE_U7	= 0x07,
489 	UNI_CALLSTATE_N7	= 0x07,
490 	UNI_CALLSTATE_NN7	= 0x07,
491 
492 	UNI_CALLSTATE_U8	= 0x08,
493 	UNI_CALLSTATE_N8	= 0x08,
494 
495 	UNI_CALLSTATE_U9	= 0x09,
496 	UNI_CALLSTATE_N9	= 0x09,
497 	UNI_CALLSTATE_NN9	= 0x09,
498 
499 	UNI_CALLSTATE_U10	= 0x0a,
500 	UNI_CALLSTATE_N10	= 0x0a,
501 	UNI_CALLSTATE_NN10	= 0x0a,
502 
503 	UNI_CALLSTATE_U11	= 0x0b,
504 	UNI_CALLSTATE_N11	= 0x0b,
505 	UNI_CALLSTATE_NN11	= 0x0b,
506 
507 	UNI_CALLSTATE_U12	= 0x0c,
508 	UNI_CALLSTATE_N12	= 0x0c,
509 	UNI_CALLSTATE_NN12	= 0x0c,
510 
511 	UNI_CALLSTATE_REST0	= 0x00,
512 	UNI_CALLSTATE_REST1	= 0x3d,
513 	UNI_CALLSTATE_REST2	= 0x3e,
514 
515 	UNI_CALLSTATE_U13	= 0x0d,
516 	UNI_CALLSTATE_N13	= 0x0d,
517 
518 	UNI_CALLSTATE_U14	= 0x0e,
519 	UNI_CALLSTATE_N14	= 0x0e,
520 };
521 
522 struct uni_ie_callstate {
523 	struct uni_iehdr	h;
524 	enum uni_callstate	state;
525 };
526 
527 /*************************************************************************
528  *
529  * Cause information element
530  */
531 enum uni_cause_loc {
532 	UNI_CAUSE_LOC_USER	= 0x0,
533 	UNI_CAUSE_LOC_PRIVLOC	= 0x1,
534 	UNI_CAUSE_LOC_PUBLOC	= 0x2,
535 	UNI_CAUSE_LOC_TRANSIT	= 0x3,
536 	UNI_CAUSE_LOC_PUBREM	= 0x4,
537 	UNI_CAUSE_LOC_PRIVREM	= 0x5,
538 	UNI_CAUSE_LOC_INTERNAT	= 0x6,
539 	UNI_CAUSE_LOC_BEYOND	= 0x7,
540 };
541 
542 #define UNI_DECLARE_CAUSE_VALUES \
543 D(UNALL_NUM,	0x01 /*  1*/, COND,	Q.850,	"Unallocated (unassigned) number") \
544 D(NOROUTE_NET,	0x02 /*  2*/, TNS,	Q.850,	"No route to specified transit network") \
545 D(NOROUTE,	0x03 /*  3*/, COND,	Q.850,	"No route to destination") \
546 D(SPTONE,	0x04 /*  4*/, NONE,	Q.850,	"Send special information tone") \
547 D(BADTRUNK,	0x05 /*  5*/, NONE,	Q.850,	"Misdialled trunk prefix") \
548 D(BADCHAN,	0x06 /*  6*/, NONE,	Q.850,	"Channel unacceptable") \
549 D(CALLAWARDED,	0x07 /*  7*/, NONE,	Q.850,	"Call awarded and being delivered in an established channel") \
550 D(PREEMPT,	0x08 /*  8*/, NONE,	Q.850,	"Preemption") \
551 D(PREEMPT_RES,	0x09 /*  9*/, NONE,	Q.850,	"Preemption - circuit reserved for reuse") \
552 D(CLEARING,	0x10 /* 16*/, COND,	Q.850,	"Normal call clearing") \
553 D(BUSY,		0x11 /* 17*/, CCBS,	Q.850,	"User busy") \
554 D(NO_RESPONSE,	0x12 /* 18*/, NONE,	Q.850,	"No user responding") \
555 D(NO_RESP_ALERT,0x13 /* 19*/, NONE,	Q.850,	"No answer from user (user alerted)") \
556 D(ABSENT,	0x14 /* 20*/, NONE,	Q.850,	"Subscriber absent") \
557 D(REJECTED,	0x15 /* 21*/, REJ,	Q.850,	"Call rejected") \
558 D(NUMCHG,	0x16 /* 22*/, NUMBER,	Q.850,	"Number changed") \
559 D(REDIR,	0x17 /* 23*/, NONE,	Q.850,	"Redirection to new destination") \
560 N(CLIR_REJECTED,0x17 /* 23*/, NONE,	UNI4.0,	"User rejects call with calling line identification restriction (CLIR)") \
561 D(EXCHG_ERR,	0x19 /* 25*/, NONE,	Q.850,	"Exchange routing error") \
562 D(NOSEL_CLEAR,	0x1a /* 26*/, NONE,	Q.850,	"Non-selected user clearing") \
563 D(DST_OOO,	0x1b /* 27*/, NONE,	Q.850,	"Destination out of order") \
564 D(INV_ADDR,	0x1c /* 28*/, NONE,	Q.850,	"Invalid number format (address incomplete)") \
565 D(FAC_REJ,	0x1d /* 29*/, FAC,	Q.850,	"Facility rejected") \
566 D(STATUS,	0x1e /* 30*/, NONE,	Q.850,	"Response to STATUS ENQUIRY") \
567 D(UNSPEC,	0x1f /* 31*/, NONE,	Q.850,	"Normal, unspecified") \
568 D(TMY_PARTY,	0x20 /* 32*/, NONE,	Q.2971,	"Too many pending add party requests") \
569 D(NOCHAN,	0x22 /* 34*/, CCBS,	Q.850,	"No circuit/channel available") \
570 N(SOFT_NAVL,	0x22 /* 34*/, NONE,	PNNI1.0,"Requested called party soft PVPC or PVCC not available")\
571 D(VPCI_NAVL,	0x23 /* 35*/, NONE,	Q.2610,	"Requested VPCI/VCI not available") \
572 D(VPCI_FAIL,	0x24 /* 36*/, NONE,	Q.2610,	"VPCI/VPI assignment failure") \
573 D(CRATE_NAVL,	0x25 /* 37*/, CRATE,	Q.2610,	"User cell rate not available") \
574 D(NET_OOO,	0x26 /* 38*/, NONE,	Q.850,	"Network out of order") \
575 D(FRAME_OOS,	0x27 /* 39*/, NONE,	Q.850,	"Permanent frame mode connection out of service") \
576 D(FRAME_OP,	0x28 /* 40*/, NONE,	Q.850,	"Permanent frame mode connection operational") \
577 D(TEMP,		0x29 /* 41*/, NONE,	Q.850,	"Temporary failure") \
578 D(CONG,		0x2a /* 42*/, NONE,	Q.850,	"Switching equipment congestion") \
579 D(ACC_DISC,	0x2b /* 43*/, IE,	Q.850,	"Access information discarded") \
580 D(REQNOCHAN,	0x2c /* 44*/, NONE,	Q.850,	"Requested circuit/channel not available") \
581 D(NOVPCI,	0x2d /* 45*/, NONE,	Q.2610,	"No VPCI/VCI available") \
582 D(PREC_BLOCK,	0x2e /* 46*/, NONE,	Q.850,	"Precedence call blocked") \
583 D(RESRC_NAVL,	0x2f /* 47*/, NONE,	Q.850,	"Resource unavailable, unspecified") \
584 D(QOS_NAVL,	0x31 /* 49*/, COND,	Q.850,	"Quality of service not available") \
585 D(FAC_NOTSUB,	0x32 /* 50*/, FAC,	Q.850,	"Requested facility not subscribed") \
586 D(OUT_CUG,	0x35 /* 53*/, NONE,	Q.850,	"Outgoing calls barred within CUG") \
587 N(PGL_CHG,	0x35 /* 53*/, NONE,	PNNI1.0,"Call cleared due to change in PGL") \
588 D(IN_CUG,	0x37 /* 55*/, NONE,	Q.850,	"Incoming call barred within CUG") \
589 D(BEARER_NAUTH,	0x39 /* 57*/, ATTR,	Q.850,	"Bearer capability not authorized") \
590 D(BEARER_NAVL,	0x3a /* 58*/, ATTR,	Q.850,	"Bearer capability not presently available") \
591 D(INCONS,	0x3e /* 62*/, NONE,	Q.850,	"Inconsistency in designated outgoing access information and subscriber class") \
592 D(OPT_NAVL,	0x3f /* 63*/, NONE,	Q.850,	"Service or option not available, unspecified") \
593 D(BEARER_NIMPL,	0x41 /* 65*/, ATTR,	Q.850,	"Bearer capability not implemented") \
594 D(CHANNEL_NIMPL,0x42 /* 66*/, CHANNEL,	Q.850,	"Channel type not implemented") \
595 D(FAC_NIMPL,	0x45 /* 69*/, FAC,	Q.850,	"Requested facility not implemented") \
596 D(RESTR_DIG,	0x46 /* 70*/, NONE,	Q.850,	"Only restricted digital information bearer capability is available") \
597 D(TRAFFIC_UNSUP,0x49 /* 73*/, NONE,	Q.2971,	"Unsupported combination of traffic parameters") \
598 N(AAL_UNSUP,	0x4c /* 78*/, NONE,	UNI3.1,	"AAL parameters cannot be supported") \
599 D(CREF_INV,	0x51 /* 81*/, NONE,	Q.850,	"Invalid call reference value") \
600 D(CHANNEL_NEX,	0x52 /* 82*/, CHANID,	Q.850,	"Identified channel does not exist") \
601 D(SUSPENDED,	0x53 /* 83*/, NONE,	Q.850,	"A suspended call exists, but this call identity does not") \
602 D(CID_INUSE,	0x54 /* 84*/, NONE,	Q.850,	"Call identity in use") \
603 D(NOTSUSP,	0x55 /* 85*/, NONE,	Q.850,	"No call suspended") \
604 D(CLEARED,	0x56 /* 86*/, CAUSE,	Q.850,	"Call having requested call identity has been cleared") \
605 D(NOT_MEMBER,	0x57 /* 87*/, NONE,	Q.850,	"User not member of CUG") \
606 D(INCOMP,	0x58 /* 88*/, PARAM,	Q.850,	"Incompatible destination") \
607 D(ENDP_INV,	0x59 /* 89*/, IE,	UNI3.1,	"Invalid endpoint reference") \
608 D(NEX_CUG,	0x5a /* 90*/, NONE,	Q.850,	"Non-existend CUG") \
609 D(TRANSIT_INV,	0x5b /* 91*/, NONE,	Q.850,	"Invalid transit network selection") \
610 D(AALNOTSUPP,	0x5d /* 93*/, NONE,	Q.2610,	"AAL parameters cannot be supported") \
611 D(INVMSG,	0x5f /* 95*/, NONE,	Q.850,	"Invalid message, unspecified") \
612 D(MANDAT,	0x60 /* 96*/, IE,	Q.850,	"Mandatory information element is missing") \
613 D(MTYPE_NIMPL,	0x61 /* 97*/, MTYPE,	Q.850,	"Message type non-existent or not implemented") \
614 D(MSG_NOTCOMP,	0x62 /* 98*/, MTYPE,	Q.850,	"Message not compatible with call state or message type non-existent or not implemented") \
615 D(IE_NIMPL,	0x63 /* 99*/, IE,	Q.850,	"Information element/parameter non-existent or not implemented") \
616 D(IE_INV,	0x64 /*100*/, IE,	Q.850,	"Invalid information element contents") \
617 D(MSG_INCOMP,	0x65 /*101*/, MTYPE,	Q.850,	"Message not compatible with call state") \
618 D(RECOVER,	0x66 /*102*/, TIMER,	Q.850,	"Recovery on timer expiry") \
619 D(PARAM_NEX,	0x67 /*103*/, PARAM,	Q.850,	"Parameter non-existent or not implemented, passed on") \
620 N(BAD_LENGTH,	0x68 /*104*/, NONE,	UNI3.1,	"Incorrect message length") \
621 D(PARAM_UNREC,	0x6e /*110*/, PARAM,	Q.850,	"Message with unrecognized parameter, discarded") \
622 D(PROTO,	0x6f /*111*/, NONE,	Q.850,	"Protocol error, unspecified") \
623 D(INTERWORKING,	0x7f /*127*/, NONE,	Q.850,	"Interworking, unspecified")
624 
625 #define D(NAME,VAL,DIAG,STD,STR) UNI_CAUSE_##NAME = VAL,
626 #define N(NAME,VAL,DIAG,STD,STR) UNI_CAUSE_##NAME = VAL,
627 
628 enum uni_cause {
629 UNI_DECLARE_CAUSE_VALUES
630 };
631 
632 #undef D
633 #undef N
634 
635 enum uni_cause_class {
636 	UNI_CAUSE_CLASS_NORM	= 0x0,
637 	UNI_CAUSE_CLASS_NORM1	= 0x1,
638 	UNI_CAUSE_CLASS_RES	= 0x2,
639 	UNI_CAUSE_CLASS_NAVL	= 0x3,
640 	UNI_CAUSE_CLASS_NIMPL	= 0x4,
641 	UNI_CAUSE_CLASS_INV	= 0x5,
642 	UNI_CAUSE_CLASS_PROTO	= 0x6,
643 	UNI_CAUSE_CLASS_INTER	= 0x7,
644 };
645 enum uni_cause_pu {
646 	UNI_CAUSE_PU_PROVIDER	= 0,
647 	UNI_CAUSE_PU_USER	= 1,
648 };
649 enum uni_cause_na {
650 	UNI_CAUSE_NA_NORMAL	= 0,
651 	UNI_CAUSE_NA_ABNORMAL	= 1,
652 };
653 enum uni_cause_cond {
654 	UNI_CAUSE_COND_UNKNOWN	= 0,
655 	UNI_CAUSE_COND_PERM	= 1,
656 	UNI_CAUSE_COND_TRANS	= 2,
657 };
658 enum uni_cause_reason {
659 	UNI_CAUSE_REASON_USER	= 0x00,
660 	UNI_CAUSE_REASON_IEMISS	= 0x01,
661 	UNI_CAUSE_REASON_IESUFF	= 0x02,
662 };
663 
664 enum uni_diag {
665 	UNI_DIAG_NONE,		/* no diagnostics */
666 
667 	UNI_DIAG_COND,		/* Condition */
668 	UNI_DIAG_TNS,		/* Transit Network Selector */
669 	UNI_DIAG_REJ,		/* Call Rejected */
670 	UNI_DIAG_NUMBER,	/* New Destination */
671 	UNI_DIAG_CRATE,		/* Traffic descriptor subfield */
672 	UNI_DIAG_ATTR,		/* Attribute idendity */
673 	UNI_DIAG_PARAM,		/* Parameter, same as one IE */
674 	UNI_DIAG_TIMER,		/* timer in ASCII */
675 	UNI_DIAG_MTYPE,		/* Message type */
676 	UNI_DIAG_IE,		/* Information element */
677 	UNI_DIAG_CHANID,	/* VPCI/VCI */
678 
679 	UNI_DIAG_CAUSE = UNI_DIAG_NONE,		/* Not specified */
680 	UNI_DIAG_CHANNEL = UNI_DIAG_NONE,	/* For N-ISDN */
681 	UNI_DIAG_CCBS = UNI_DIAG_NONE,		/* Not used in Q.931 */
682 	UNI_DIAG_FAC = UNI_DIAG_NONE,		/* Not specified */
683 };
684 
685 enum {
686 	UNI_CAUSE_TRAFFIC_N	= 34-6,
687 	UNI_CAUSE_IE_N		= 34-6,
688 	UNI_CAUSE_ATTR_N	= (34-6)/3,
689 };
690 
691 struct uni_ie_cause {
692 	struct uni_iehdr	h;
693 #define UNI_CAUSE_COND_P	0x0001
694 #define UNI_CAUSE_REJ_P		0x0002
695 #define UNI_CAUSE_REJ_USER_P	0x0004
696 #define UNI_CAUSE_REJ_IE_P	0x0008
697 #define UNI_CAUSE_IE_P		0x0010
698 #define UNI_CAUSE_TRAFFIC_P	0x0020
699 #define UNI_CAUSE_VPCI_P	0x0040
700 #define UNI_CAUSE_MTYPE_P	0x0080
701 #define UNI_CAUSE_TIMER_P	0x0100
702 #define UNI_CAUSE_TNS_P		0x0200
703 #define UNI_CAUSE_NUMBER_P	0x0400
704 #define UNI_CAUSE_ATTR_P	0x0800
705 #define UNI_CAUSE_PARAM_P	0x1000
706 
707 	enum uni_cause_loc	loc;
708 	enum uni_cause		cause;
709 
710 	union {
711 	    struct {
712 		enum uni_cause_pu	pu;
713 		enum uni_cause_na	na;
714 		enum uni_cause_cond	cond;
715 	    } cond;
716 	    struct {
717 		enum uni_cause_reason	reason;
718 		enum uni_cause_cond	cond;
719 		u_int			user;
720 		uint8_t			ie;
721 	    } rej;
722 	    struct {
723 		uint8_t			ie[UNI_CAUSE_IE_N];
724 		u_int			len;
725 	    } ie;
726 	    struct {
727 		uint8_t			traffic[UNI_CAUSE_TRAFFIC_N];
728 		u_int			len;
729 	    } traffic;
730 	    struct {
731 		uint16_t		vpci;
732 		uint16_t		vci;
733 	    } vpci;
734 	    uint8_t			mtype;
735 	    u_char			timer[3];
736 	    struct uni_ie_tns		tns;
737 	    struct uni_ie_called	number;		/* TNS does not fit */
738 	    uint8_t			param;
739 	    struct {
740 		u_int			nattr;
741 	        u_char			attr[UNI_CAUSE_ATTR_N][3];
742 	    }				attr;
743 	} u;
744 };
745 enum uni_diag uni_diag(enum uni_cause, enum uni_coding);
746 
747 /* return a string for the cause (NULL if the coding/cause are illegal) */
748 const char *uni_ie_cause2str(enum uni_coding, u_int);
749 
750 /*************************************************************************
751  *
752  * Connection identifier information element
753  */
754 enum uni_connid_type {
755 	UNI_CONNID_VCI		= 0,
756 	UNI_CONNID_ANYVCI	= 1,
757 	UNI_CONNID_NOVCI	= 4,
758 };
759 enum uni_connid_assoc {
760 	UNI_CONNID_ASSOC	= 0,
761 	UNI_CONNID_NONASSOC	= 1,
762 };
763 struct uni_ie_connid {
764 	struct uni_iehdr	h;
765 	enum uni_connid_assoc	assoc;
766 	enum uni_connid_type	type;
767 	u_int			vpci : 16;
768 	u_int			vci : 16;
769 };
770 
771 /*************************************************************************
772  *
773  * End point reference IE
774  */
775 struct uni_ie_epref {
776 	struct uni_iehdr	h;
777 	u_int			flag : 1;
778 	u_int			epref : 15;
779 };
780 
781 /*************************************************************************
782  *
783  * End point state IE
784  */
785 enum uni_epstate {
786 	UNI_EPSTATE_NULL	= 0x00,
787 	UNI_EPSTATE_ADD_INIT	= 0x01,
788 	UNI_EPSTATE_ALERT_DLVD	= 0x04,
789 	UNI_EPSTATE_ADD_RCVD	= 0x06,
790 	UNI_EPSTATE_ALERT_RCVD	= 0x07,
791 	UNI_EPSTATE_ACTIVE	= 0x0a,
792 	UNI_EPSTATE_DROP_INIT	= 0x0b,
793 	UNI_EPSTATE_DROP_RCVD	= 0x0c,
794 };
795 
796 struct uni_ie_epstate {
797 	struct uni_iehdr h;
798 	enum uni_epstate state;
799 };
800 
801 /*************************************************************************
802  *
803  * Q.2932 Facility IE
804  */
805 enum {
806 	UNI_FACILITY_ROSE	= 0x11,
807 
808 	UNI_FACILITY_MAXAPDU	= 128,
809 };
810 
811 struct uni_ie_facility {
812 	struct uni_iehdr h;
813 
814 	u_char		proto;
815 	u_char		apdu[UNI_FACILITY_MAXAPDU];
816 	u_int		len;
817 };
818 
819 /*************************************************************************
820  *
821  * Notification indicator
822  */
823 enum {
824 	UNI_NOTIFY_MAXLEN	= 128,	/* maximum info length */
825 };
826 struct uni_ie_notify {
827 	struct uni_iehdr h;
828 	u_int		len;
829 	u_char		notify[UNI_NOTIFY_MAXLEN];
830 };
831 
832 /*************************************************************************
833  *
834  * QoS information element
835  */
836 enum uni_qos {
837 	UNI_QOS_CLASS0	= 0x00,
838 	UNI_QOS_CLASS1	= 0x01,
839 	UNI_QOS_CLASS2	= 0x02,
840 	UNI_QOS_CLASS3	= 0x03,
841 	UNI_QOS_CLASS4	= 0x04,
842 };
843 
844 struct uni_ie_qos {
845 	struct uni_iehdr h;
846 	enum uni_qos	fwd;
847 	enum uni_qos	bwd;
848 };
849 
850 /*************************************************************************
851  *
852  * Broadband repeat indicator information element
853  */
854 enum uni_repeat_type {
855 	UNI_REPEAT_PRIDESC	= 0x02,
856 	UNI_REPEAT_STACK	= 0x0a,		/* PNNI */
857 };
858 
859 struct uni_ie_repeat {
860 	struct uni_iehdr h;
861 	enum uni_repeat_type type;
862 };
863 
864 /*************************************************************************
865  *
866  * Restart indicator information element
867  */
868 enum uni_restart_type {
869 	UNI_RESTART_CHANNEL	= 0x0,
870 	UNI_RESTART_PATH	= 0x1,
871 	UNI_RESTART_ALL		= 0x2,
872 };
873 
874 struct uni_ie_restart {
875 	struct uni_iehdr h;
876 	enum uni_restart_type rclass;
877 };
878 
879 /*************************************************************************
880  *
881  * Broadband sending complete indicator information element
882  */
883 struct uni_ie_scompl {
884 	struct uni_iehdr h;
885 };
886 
887 /*************************************************************************
888  *
889  * ATM traffic descriptor information element
890  */
891 enum {
892 	UNI_TRAFFIC_FMDCR_ID	= 0x00,
893 	UNI_TRAFFIC_BMDCR_ID	= 0x02,
894 	UNI_TRAFFIC_FPCR0_ID	= 0x82,
895 	UNI_TRAFFIC_BPCR0_ID	= 0x83,
896 	UNI_TRAFFIC_FPCR1_ID	= 0x84,
897 	UNI_TRAFFIC_BPCR1_ID	= 0x85,
898 	UNI_TRAFFIC_FSCR0_ID	= 0x88,
899 	UNI_TRAFFIC_BSCR0_ID	= 0x89,
900 	UNI_TRAFFIC_FSCR1_ID	= 0x90,
901 	UNI_TRAFFIC_BSCR1_ID	= 0x91,
902 	UNI_TRAFFIC_FABR1_ID	= 0x92,
903 	UNI_TRAFFIC_BABR1_ID	= 0x93,
904 	UNI_TRAFFIC_FMBS0_ID	= 0xa0,
905 	UNI_TRAFFIC_BMBS0_ID	= 0xa1,
906 	UNI_TRAFFIC_FMBS1_ID	= 0xb0,
907 	UNI_TRAFFIC_BMBS1_ID	= 0xb1,
908 	UNI_TRAFFIC_BEST_ID	= 0xbe,
909 	UNI_TRAFFIC_MOPT_ID	= 0xbf,
910 
911 	UNI_TRAFFIC_FTAG	= 0x01,
912 	UNI_TRAFFIC_BTAG	= 0x02,
913 	UNI_TRAFFIC_FDISC	= 0x80,
914 	UNI_TRAFFIC_BDISC	= 0x40,
915 
916 	UNI_MINTRAFFIC_FPCR0_ID	= 0x82,
917 	UNI_MINTRAFFIC_BPCR0_ID	= 0x83,
918 	UNI_MINTRAFFIC_FPCR1_ID	= 0x84,
919 	UNI_MINTRAFFIC_BPCR1_ID	= 0x85,
920 	UNI_MINTRAFFIC_FABR1_ID	= 0x92,
921 	UNI_MINTRAFFIC_BABR1_ID	= 0x93,
922 
923 	UNI_MDCR_ORIGIN_USER	= 0x00,
924 	UNI_MDCR_ORIGIN_NET	= 0x01,
925 };
926 
927 #define UNI_TRAFFIC_FPCR0_P	0x0001
928 #define UNI_TRAFFIC_BPCR0_P	0x0002
929 #define UNI_TRAFFIC_FPCR1_P	0x0004
930 #define UNI_TRAFFIC_BPCR1_P	0x0008
931 #define UNI_TRAFFIC_FSCR0_P	0x0010
932 #define UNI_TRAFFIC_BSCR0_P	0x0020
933 #define UNI_TRAFFIC_FSCR1_P	0x0040
934 #define UNI_TRAFFIC_BSCR1_P	0x0080
935 #define UNI_TRAFFIC_FMBS0_P	0x0100
936 #define UNI_TRAFFIC_BMBS0_P	0x0200
937 #define UNI_TRAFFIC_FMBS1_P	0x0400
938 #define UNI_TRAFFIC_BMBS1_P	0x0800
939 #define UNI_TRAFFIC_BEST_P	0x1000
940 #define UNI_TRAFFIC_MOPT_P	0x2000
941 #define UNI_TRAFFIC_FABR1_P	0x4000
942 #define UNI_TRAFFIC_BABR1_P	0x8000
943 struct uni_xtraffic {
944 	u_int	fpcr0, bpcr0;
945 	u_int	fpcr1, bpcr1;
946 	u_int	fscr0, bscr0;
947 	u_int	fscr1, bscr1;
948 	u_int	fmbs0, bmbs0;
949 	u_int	fmbs1, bmbs1;
950 	u_int	fabr1, babr1;
951 	u_int	ftag, btag;
952 	u_int	fdisc, bdisc;
953 };
954 
955 struct uni_ie_traffic {
956 	struct uni_iehdr h;
957 	struct uni_xtraffic t;
958 };
959 struct uni_ie_atraffic {
960 	struct uni_iehdr h;
961 	struct uni_xtraffic t;
962 };
963 
964 /*
965  * Q.2961 minimum traffic descriptor
966  */
967 struct uni_ie_mintraffic {
968 	struct uni_iehdr h;
969 #define UNI_MINTRAFFIC_FPCR0_P	0x0001
970 #define UNI_MINTRAFFIC_BPCR0_P	0x0002
971 #define UNI_MINTRAFFIC_FPCR1_P	0x0004
972 #define UNI_MINTRAFFIC_BPCR1_P	0x0008
973 #define UNI_MINTRAFFIC_FABR1_P	0x0010
974 #define UNI_MINTRAFFIC_BABR1_P	0x0020
975 
976 	u_int	fpcr0, bpcr0;
977 	u_int	fpcr1, bpcr1;
978 	u_int	fabr1, babr1;
979 };
980 
981 /*
982  * UNI4.0+ (af-cs-0147.000) Minimum Desired Cell Rate
983  */
984 struct uni_ie_mdcr {
985 	struct uni_iehdr h;
986 	u_int	origin;
987 	u_int	fmdcr, bmdcr;
988 };
989 
990 /*************************************************************************
991  *
992  * User-user information information element
993  */
994 struct uni_ie_uu {
995 	struct uni_iehdr h;
996 	u_int		len;
997 	u_char		uu[UNI_UU_MAXLEN];
998 };
999 
1000 /*************************************************************************
1001  *
1002  * Generic identifier transport
1003  */
1004 enum uni_git_std {
1005 	UNI_GIT_STD_DSMCC	= 0x01,	/* DSM-CC */
1006 	UNI_GIT_STD_H245	= 0x02,	/* H.245 */
1007 };
1008 enum uni_git_type {
1009 	UNI_GIT_TYPE_SESS	= 0x01,	/* session id */
1010 	UNI_GIT_TYPE_RES	= 0x02,	/* resource id */
1011 };
1012 
1013 enum {
1014 	UNI_GIT_MAXSESS		= 20,	/* max session value length */
1015 	UNI_GIT_MAXRES		= 4,	/* max resource value length */
1016 
1017 	UNI_GIT_MAXVAL		= 20,	/* the maximum of the above */
1018 	UNI_GIT_MAXSUB		= 2,	/* maximum number of og. 6 */
1019 };
1020 
1021 struct uni_ie_git {
1022 	struct uni_iehdr	h;
1023 
1024 	enum uni_git_std	std;	/* identifier related standard/application */
1025 	u_int			numsub;
1026 	struct {
1027 		enum uni_git_type type;
1028 		u_int		len;
1029 		u_char		val[UNI_GIT_MAXVAL];
1030 	}			sub[UNI_GIT_MAXSUB];
1031 };
1032 
1033 /*************************************************************************
1034  *
1035  * End-to-end transit delay
1036  */
1037 enum {
1038 	UNI_EETD_CTD_ID		= 0x01,	/* cumulative transit delay */
1039 	UNI_EETD_MTD_ID		= 0x03,	/* maximum transit delay */
1040 	UNI_EETD_NET_ID		= 0x0a,	/* network generated */
1041 	UNI_EETD_PMTD_ID	= 0x0b,	/* PNNI acceptable forward maximum ctd */
1042 	UNI_EETD_PCTD_ID	= 0x11,	/* PNNI cumulative forward maximum ctd */
1043 
1044 	UNI_EETD_ANYMAX		= 0xffff,
1045 	UNI_EETD_MAXVAL		= 0xffff,	/* maximum value */
1046 };
1047 
1048 struct uni_ie_eetd {
1049 	struct uni_iehdr	h;
1050 #define UNI_EETD_CUM_P		0x0001
1051 #define UNI_EETD_MAX_P		0x0002
1052 #define UNI_EETD_NET_P		0x0004	/* UNI4.0 9.1.2.1 */
1053 #define UNI_EETD_PMTD_P		0x0008	/* PNNI1.0 6.4.5.24 */
1054 #define UNI_EETD_PCTD_P		0x0010	/* PNNI1.0 6.4.5.24 */
1055 
1056 	u_int	cumulative;
1057 	u_int	maximum;
1058 	u_int	pmtd;
1059 	u_int	pctd;
1060 };
1061 
1062 /*************************************************************************
1063  *
1064  * Leaf-initiated-join call identifier
1065  */
1066 enum uni_lij_idtype {
1067 	UNI_LIJ_IDTYPE_ROOT	= 0x0,	/* root created */
1068 };
1069 
1070 struct uni_ie_lij_callid {
1071 	struct uni_iehdr	h;
1072 
1073 	enum uni_lij_idtype	type;
1074 	u_int			callid;
1075 };
1076 
1077 /*
1078  * LIJ parameters
1079  */
1080 enum uni_lij_screen {
1081 	UNI_LIJ_SCREEN_NETJOIN	= 0x0,	/* without root notification */
1082 };
1083 
1084 struct uni_ie_lij_param {
1085 	struct uni_iehdr	h;
1086 
1087 	enum uni_lij_screen	screen;
1088 };
1089 
1090 /*
1091  * LIJ sequence number
1092  */
1093 struct uni_ie_lij_seqno {
1094 	struct uni_iehdr	h;
1095 
1096 	u_int			seqno;
1097 };
1098 
1099 /*************************************************************************
1100  *
1101  * Locking/Non-locking shift not supported
1102  */
1103 struct uni_ie_lshift {
1104 	struct uni_iehdr h;
1105 	u_int		set:3;
1106 };
1107 
1108 struct uni_ie_nlshift {
1109 	struct uni_iehdr h;
1110 	u_int		set:3;
1111 };
1112 
1113 /*************************************************************************
1114  *
1115  * Externded QoS information element
1116  */
1117 enum {
1118 	UNI_EXQOS_FACC_ID	= 0x94,
1119 	UNI_EXQOS_BACC_ID	= 0x95,
1120 	UNI_EXQOS_FCUM_ID	= 0x96,
1121 	UNI_EXQOS_BCUM_ID	= 0x97,
1122 	UNI_EXQOS_FCLR_ID	= 0xa2,
1123 	UNI_EXQOS_BCLR_ID	= 0xa3,
1124 };
1125 
1126 enum uni_exqos_origin {
1127 	UNI_EXQOS_USER	= 0,
1128 	UNI_EXQOS_NET	= 1,
1129 };
1130 
1131 enum {
1132 	UNI_EXQOS_ANY_CDV	= 0xffffff,
1133 	UNI_EXQOS_ANY_CLR	= 0xff,
1134 };
1135 
1136 struct uni_ie_exqos {
1137 	struct uni_iehdr	h;
1138 #define UNI_EXQOS_FACC_P	0x0001
1139 #define UNI_EXQOS_BACC_P	0x0002
1140 #define UNI_EXQOS_FCUM_P	0x0004
1141 #define UNI_EXQOS_BCUM_P	0x0008
1142 #define UNI_EXQOS_FCLR_P	0x0010
1143 #define UNI_EXQOS_BCLR_P	0x0020
1144 
1145 	enum uni_exqos_origin	origin;
1146 	u_int			facc;
1147 	u_int			bacc;
1148 	u_int			fcum;
1149 	u_int			bcum;
1150 	u_int			fclr;
1151 	u_int			bclr;
1152 };
1153 
1154 /*************************************************************************
1155  *
1156  * Additional ABR parameters
1157  * ABR setup parameters
1158  */
1159 enum {
1160 	UNI_ABRADD_FADD_ID	= 0xc2,
1161 	UNI_ABRADD_BADD_ID	= 0xc3,
1162 	UNI_ABRSETUP_FICR_ID	= 0xc2,
1163 	UNI_ABRSETUP_BICR_ID	= 0xc3,
1164 	UNI_ABRSETUP_FTBE_ID	= 0xc4,
1165 	UNI_ABRSETUP_BTBE_ID	= 0xc5,
1166 	UNI_ABRSETUP_RMFRT_ID	= 0xc6,
1167 	UNI_ABRSETUP_FRIF_ID	= 0xc8,
1168 	UNI_ABRSETUP_BRIF_ID	= 0xc9,
1169 	UNI_ABRSETUP_FRDF_ID	= 0xca,
1170 	UNI_ABRSETUP_BRDF_ID	= 0xcb,
1171 };
1172 
1173 struct uni_abr_rec {
1174 	u_int			present;
1175 #define UNI_ABR_REC_NRM_P	0x80000000
1176 #define UNI_ABR_REC_TRM_P	0x40000000
1177 #define UNI_ABR_REC_CDF_P	0x20000000
1178 #define UNI_ABR_REC_ADTF_P	0x10000000
1179 	u_int		nrm:3;
1180 	u_int		trm:3;
1181 	u_int		cdf:3;
1182 	u_int		adtf:10;
1183 };
1184 
1185 struct uni_ie_abradd {
1186 	struct uni_iehdr	h;
1187 	struct uni_abr_rec	fwd, bwd;
1188 };
1189 
1190 struct uni_ie_abrsetup {
1191 	struct uni_iehdr	h;
1192 #define UNI_ABRSETUP_FICR_P	0x0001
1193 #define UNI_ABRSETUP_BICR_P	0x0002
1194 #define UNI_ABRSETUP_FTBE_P	0x0004
1195 #define UNI_ABRSETUP_BTBE_P	0x0008
1196 #define UNI_ABRSETUP_FRIF_P	0x0010
1197 #define UNI_ABRSETUP_BRIF_P	0x0020
1198 #define UNI_ABRSETUP_FRDF_P	0x0040
1199 #define UNI_ABRSETUP_BRDF_P	0x0080
1200 #define UNI_ABRSETUP_RMFRT_P	0x0100
1201 
1202 	u_int		ficr, bicr;
1203 	u_int		ftbe, btbe;
1204 	u_int		rmfrt;
1205 	u_int		frif, brif;
1206 	u_int		frdf, brdf;
1207 };
1208 
1209 /*************************************************************************
1210  *
1211  * Connection scope information element
1212  */
1213 enum uni_cscope {
1214 	UNI_CSCOPE_ORG	= 0x01,
1215 };
1216 
1217 enum {
1218 	UNI_CSCOPE_ORG_LOC	= 0x01,
1219 	UNI_CSCOPE_ORG_LOC_P1	= 0x02,
1220 	UNI_CSCOPE_ORG_LOC_P2	= 0x03,
1221 	UNI_CSCOPE_ORG_SITE_M1	= 0x04,
1222 	UNI_CSCOPE_ORG_SITE	= 0x05,
1223 	UNI_CSCOPE_ORG_SITE_P1	= 0x06,
1224 	UNI_CSCOPE_ORG_ORG_M1	= 0x07,
1225 	UNI_CSCOPE_ORG_ORG	= 0x08,
1226 	UNI_CSCOPE_ORG_ORG_P1	= 0x09,
1227 	UNI_CSCOPE_ORG_COMM_M1	= 0x0a,
1228 	UNI_CSCOPE_ORG_COMM	= 0x0b,
1229 	UNI_CSCOPE_ORG_COMM_P1	= 0x0c,
1230 	UNI_CSCOPE_ORG_REG	= 0x0d,
1231 	UNI_CSCOPE_ORG_INTER	= 0x0e,
1232 	UNI_CSCOPE_ORG_GLOBAL	= 0x0f,
1233 };
1234 
1235 struct uni_ie_cscope {
1236 	struct uni_iehdr	h;
1237 	enum uni_cscope		type;
1238 	u_int			scope:8;
1239 };
1240 
1241 /*************************************************************************
1242  *
1243  * Connection scope information element
1244  */
1245 enum uni_report {
1246 	UNI_REPORT_MODCONF	= 0x01,
1247 	UNI_REPORT_CLOCK	= 0x02,
1248 	UNI_REPORT_EEAVAIL	= 0x04,
1249 	UNI_REPORT_EEREQ	= 0x05,
1250 	UNI_REPORT_EECOMPL	= 0x06,
1251 };
1252 
1253 struct uni_ie_report {
1254 	struct uni_iehdr h;
1255 	enum uni_report	report;
1256 };
1257 
1258 /*************************************************************************
1259  *
1260  * PNNI Designated transit list information element
1261  */
1262 enum {
1263 	UNI_DTL_LOGNP	= 0x01,
1264 	UNI_DTL_LOGNP_SIZE = 27,
1265 };
1266 
1267 struct uni_ie_dtl {
1268 	struct uni_iehdr	h;
1269 	u_int			ptr:16;
1270 	u_int			num;
1271 	struct {
1272 	  u_char		node_level;
1273 	  u_char		node_id[21];
1274 	  u_int			port_id;
1275 	}			dtl[UNI_DTL_MAXNUM];
1276 };
1277 
1278 /*************************************************************************
1279  *
1280  * PNNI Crankback information element
1281  */
1282 enum uni_crankback {
1283 	UNI_CRANKBACK_IF	= 0x02,
1284 	UNI_CRANKBACK_NODE	= 0x03,
1285 	UNI_CRANKBACK_LINK	= 0x04,
1286 };
1287 
1288 enum {
1289 	UNI_CAUSE_NXNODE_UNREACH = 128,
1290 	UNI_CAUSE_DTL_NOT_MY_ID	= 160,
1291 };
1292 
1293 struct uni_ie_crankback {
1294 	struct uni_iehdr	h;
1295 #define UNI_CRANKBACK_TOP_P	0x0001
1296 #define UNI_CRANKBACK_TOPX_P	0x0002
1297 #define UNI_CRANKBACK_QOS_P	0x0004
1298 	u_int			level:8;
1299 	enum uni_crankback	type;
1300 	union {
1301 	  struct {
1302 	    u_char		level;
1303 	    u_char		id[21];
1304 	  }			node;
1305 	  struct {
1306 	    u_char		plevel;
1307 	    u_char		pid[21];
1308 	    u_int		port;
1309 	    u_char		slevel;
1310 	    u_char		sid[21];
1311 	  }			link;
1312 	}			id;
1313 	u_int			cause:8;
1314 	union {
1315 	  struct {
1316 	    u_int		dir:8;
1317 	    u_int		port;
1318 	    u_int		avcr;
1319 	    u_int		crm;
1320 	    u_int		vf;
1321 	  }			top;
1322 	  struct {
1323 	    u_int		ctd:1;
1324 	    u_int		cdv:1;
1325 	    u_int		clr:1;
1326 	    u_int		other:1;
1327 	  }			qos;
1328 	}			diag;
1329 };
1330 
1331 /*************************************************************************
1332  *
1333  * PNNI Call_ing/called party soft PVPC/PVCC information element
1334  */
1335 enum uni_soft_sel {
1336 	UNI_SOFT_SEL_ANY	= 0x00,
1337 	UNI_SOFT_SEL_REQ	= 0x02,
1338 	UNI_SOFT_SEL_ASS	= 0x04,
1339 };
1340 
1341 struct uni_ie_calling_soft {
1342 	struct uni_iehdr h;
1343 #define UNI_CALLING_SOFT_VCI_P	0x0001
1344 	u_int		vpi:12;
1345 	u_int		vci:16;
1346 };
1347 struct uni_ie_called_soft {
1348 	struct uni_iehdr h;
1349 #define UNI_CALLED_SOFT_VPI_P	0x0001
1350 #define UNI_CALLED_SOFT_VCI_P	0x0002
1351 	enum uni_soft_sel sel;
1352 	u_int		vpi:12;
1353 	u_int		vci:16;
1354 };
1355 
1356 /*************************************************************************/
1357 
1358 #include <netnatm/msg/uni_ie.h>
1359 #include <netnatm/msg/uni_msg.h>
1360 
1361 struct uni_all {
1362 	enum uni_msgtype	mtype;
1363 	union uni_msgall	u;
1364 };
1365 
1366 struct uni_ie {
1367 	enum uni_ietype		ietype;
1368 	union uni_ieall		u;
1369 };
1370 
1371 #endif
1372