Initial import from FreeBSD RELENG_4:
[dragonfly.git] / sys / netproto / atm / uni / unisig_msg.h
1 /*
2  *
3  * ===================================
4  * HARP  |  Host ATM Research Platform
5  * ===================================
6  *
7  *
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.
12  *
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.
20  *
21  * Copyright 1994-1998 Network Computing Services, Inc.
22  *
23  * Copies of this Software may be made, however, the above copyright
24  * notice must be reproduced on all copies.
25  *
26  *      @(#) $FreeBSD: src/sys/netatm/uni/unisig_msg.h,v 1.3 1999/08/28 00:49:07 peter Exp $
27  *
28  */
29
30 /*
31  * ATM Forum UNI 3.0/3.1 Signalling Manager
32  * ----------------------------------------
33  *
34  * Message formatting blocks
35  *
36  */
37
38 #ifndef _UNI_SIG_MSG_H
39 #define _UNI_SIG_MSG_H
40
41 #define UNI_MSG_DISC_Q93B       0x09
42 #define UNI_MSG_MIN_LEN         9
43
44 /*
45  * Values for Q.2931 message type.
46  */
47 #define UNI_MSG_CALP    0x02
48 #define UNI_MSG_CONN    0x07
49 #define UNI_MSG_CACK    0x0F
50 #define UNI_MSG_SETU    0x05
51 #define UNI_MSG_RLSE    0x4D
52 #define UNI_MSG_RLSC    0x5A
53 #define UNI_MSG_RSTR    0x46
54 #define UNI_MSG_RSTA    0x4E
55 #define UNI_MSG_STAT    0x7D
56 #define UNI_MSG_SENQ    0x75
57 #define UNI_MSG_ADDP    0x80
58 #define UNI_MSG_ADPA    0x81
59 #define UNI_MSG_ADPR    0x82
60 #define UNI_MSG_DRPP    0x83
61 #define UNI_MSG_DRPA    0x84
62
63
64 /*
65  * Values for information element identifier.
66  */
67 #define UNI_IE_CAUS     0x08
68 #define UNI_IE_CLST     0x14
69 #define UNI_IE_EPRF     0x54
70 #define UNI_IE_EPST     0x55
71 #define UNI_IE_AALP     0x58
72 #define UNI_IE_CLRT     0x59
73 #define UNI_IE_CNID     0x5A
74 #define UNI_IE_QOSP     0x5C
75 #define UNI_IE_BHLI     0x5D
76 #define UNI_IE_BBCP     0x5E
77 #define UNI_IE_BLLI     0x5F
78 #define UNI_IE_BLSH     0x60
79 #define UNI_IE_BNSH     0x61
80 #define UNI_IE_BSDC     0x62
81 #define UNI_IE_BRPI     0x63
82 #define UNI_IE_CGAD     0x6C
83 #define UNI_IE_CGSA     0x6D
84 #define UNI_IE_CDAD     0x70
85 #define UNI_IE_CDSA     0x71
86 #define UNI_IE_TRNT     0x78
87 #define UNI_IE_RSTI     0x79
88
89 /*
90  * Masks for information element extension in bit 8
91  */
92 #define UNI_IE_EXT_BIT  0x80
93 #define UNI_IE_EXT_MASK 0x7F
94
95
96 /*
97  * Signalling message in internal format.
98  */
99 #define UNI_MSG_IE_CNT          22
100
101 struct unisig_msg {
102         u_int                           msg_call_ref;
103         u_char                          msg_type;
104         u_char                          msg_type_flag;
105         u_char                          msg_type_action;
106         int                             msg_length;
107         struct ie_generic               *msg_ie_vec[UNI_MSG_IE_CNT];
108 };
109
110 #define UNI_MSG_CALL_REF_RMT    0x800000
111 #define UNI_MSG_CALL_REF_MASK   0x7FFFFF
112 #define UNI_MSG_CALL_REF_GLOBAL 0
113 #define UNI_MSG_CALL_REF_DUMMY  0x7FFFFF
114
115 #define EXTRACT_CREF(x)                                         \
116         ((x) & UNI_MSG_CALL_REF_RMT ? (x) & UNI_MSG_CALL_REF_MASK : (x) | UNI_MSG_CALL_REF_RMT)
117 #define GLOBAL_CREF(x)  (((x) & UNI_MSG_CALL_REF_MASK) == UNI_MSG_CALL_REF_GLOBAL)
118 #define DUMMY_CREF(x)   (((x) & UNI_MSG_CALL_REF_MASK) == UNI_MSG_CALL_REF_DUMMY)
119
120 #define UNI_MSG_TYPE_FLAG_MASK  1
121 #define UNI_MSG_TYPE_FLAG_SHIFT 4
122
123 #define UNI_MSG_TYPE_ACT_CLEAR  0
124 #define UNI_MSG_TYPE_ACT_DISC   1
125 #define UNI_MSG_TYPE_ACT_RPRT   2
126 #define UNI_MSG_TYPE_ACT_RSVD   3
127 #define UNI_MSG_TYPE_ACT_MASK   3
128
129 #define UNI_MSG_IE_AALP         0
130 #define UNI_MSG_IE_CLRT         1
131 #define UNI_MSG_IE_BBCP         2
132 #define UNI_MSG_IE_BHLI         3
133 #define UNI_MSG_IE_BLLI         4
134 #define UNI_MSG_IE_CLST         5
135 #define UNI_MSG_IE_CDAD         6
136 #define UNI_MSG_IE_CDSA         7
137 #define UNI_MSG_IE_CGAD         8
138 #define UNI_MSG_IE_CGSA         9
139 #define UNI_MSG_IE_CAUS         10
140 #define UNI_MSG_IE_CNID         11
141 #define UNI_MSG_IE_QOSP         12
142 #define UNI_MSG_IE_BRPI         13
143 #define UNI_MSG_IE_RSTI         14
144 #define UNI_MSG_IE_BLSH         15
145 #define UNI_MSG_IE_BNSH         16
146 #define UNI_MSG_IE_BSDC         17
147 #define UNI_MSG_IE_TRNT         18
148 #define UNI_MSG_IE_EPRF         19
149 #define UNI_MSG_IE_EPST         20
150 #define UNI_MSG_IE_ERR          21
151
152 #define msg_ie_aalp     msg_ie_vec[UNI_MSG_IE_AALP]
153 #define msg_ie_clrt     msg_ie_vec[UNI_MSG_IE_CLRT]
154 #define msg_ie_bbcp     msg_ie_vec[UNI_MSG_IE_BBCP]
155 #define msg_ie_bhli     msg_ie_vec[UNI_MSG_IE_BHLI]
156 #define msg_ie_blli     msg_ie_vec[UNI_MSG_IE_BLLI]
157 #define msg_ie_clst     msg_ie_vec[UNI_MSG_IE_CLST]
158 #define msg_ie_cdad     msg_ie_vec[UNI_MSG_IE_CDAD]
159 #define msg_ie_cdsa     msg_ie_vec[UNI_MSG_IE_CDSA]
160 #define msg_ie_cgad     msg_ie_vec[UNI_MSG_IE_CGAD]
161 #define msg_ie_cgsa     msg_ie_vec[UNI_MSG_IE_CGSA]
162 #define msg_ie_caus     msg_ie_vec[UNI_MSG_IE_CAUS]
163 #define msg_ie_cnid     msg_ie_vec[UNI_MSG_IE_CNID]
164 #define msg_ie_qosp     msg_ie_vec[UNI_MSG_IE_QOSP]
165 #define msg_ie_brpi     msg_ie_vec[UNI_MSG_IE_BRPI]
166 #define msg_ie_rsti     msg_ie_vec[UNI_MSG_IE_RSTI]
167 #define msg_ie_blsh     msg_ie_vec[UNI_MSG_IE_BLSH]
168 #define msg_ie_bnsh     msg_ie_vec[UNI_MSG_IE_BNSH]
169 #define msg_ie_bsdc     msg_ie_vec[UNI_MSG_IE_BSDC]
170 #define msg_ie_trnt     msg_ie_vec[UNI_MSG_IE_TRNT]
171 #define msg_ie_eprf     msg_ie_vec[UNI_MSG_IE_EPRF]
172 #define msg_ie_epst     msg_ie_vec[UNI_MSG_IE_EPST]
173 #define msg_ie_err      msg_ie_vec[UNI_MSG_IE_ERR]
174
175
176 /*
177  * Information element header.
178  */
179 struct ie_hdr {
180         u_char                  ie_hdr_ident;
181         u_char                  ie_hdr_coding;
182         u_char                  ie_hdr_flag;
183         u_char                  ie_hdr_action;
184         int                     ie_hdr_length;
185         int                     ie_hdr_err_cause;
186         struct ie_generic       *ie_hdr_next;
187 };
188
189 #define UNI_IE_HDR_LEN          4
190
191 #define UNI_IE_CODE_CCITT       0
192 #define UNI_IE_CODE_STD         3
193 #define UNI_IE_CODE_MASK        3
194 #define UNI_IE_CODE_SHIFT       5
195
196 #define UNI_IE_FLAG_MASK        1
197 #define UNI_IE_FLAG_SHIFT       4
198
199 #define UNI_IE_ACT_CLEAR        0
200 #define UNI_IE_ACT_DIS          1
201 #define UNI_IE_ACT_RPRT         2
202 #define UNI_IE_ACT_DMSGIGN      5
203 #define UNI_IE_ACT_DMSGRPRT     6
204 #define UNI_IE_ACT_MASK         7
205
206
207 /*
208  * ATM AAL parameters information element in internal format.
209  */
210 struct ie_aalp {
211         int8_t  ie_aal_type;
212         union {
213                 struct aal_type_1_parm {
214                         u_char  subtype;
215                         u_char  cbr_rate;
216                         u_short multiplier;
217                         u_char  clock_recovery;
218                         u_char  error_correction;
219                         u_char  struct_data_tran;
220                         u_char  partial_cells;
221                 } type_1;
222                 struct aal_type_4_parm {
223                         int32_t fwd_max_sdu;
224                         int32_t bkwd_max_sdu;
225                         int32_t mid_range;
226                         u_char  mode;
227                         u_char  sscs_type;
228                 } type_4;
229                 struct aal_type_5_parm {
230                         int32_t fwd_max_sdu;
231                         int32_t bkwd_max_sdu;
232                         u_char  mode;
233                         u_char  sscs_type;
234                 } type_5;
235                 struct user_aal_type {
236                         u_char  aal_info[4];
237                 } type_user;
238         } aal_u;
239 };
240
241 #define UNI_IE_AALP_AT_AAL1     1
242 #define UNI_IE_AALP_AT_AAL3     3
243 #define UNI_IE_AALP_AT_AAL5     5
244 #define UNI_IE_AALP_AT_AALU     16
245
246 #define UNI_IE_AALP_A1_ST_NULL  0
247 #define UNI_IE_AALP_A1_ST_VCE   1
248 #define UNI_IE_AALP_A1_ST_SCE   2
249 #define UNI_IE_AALP_A1_ST_ACE   3
250 #define UNI_IE_AALP_A1_ST_HQA   4
251 #define UNI_IE_AALP_A1_ST_VID   5
252
253 #define UNI_IE_AALP_A1_CB_64    1
254 #define UNI_IE_AALP_A1_CB_DS1   4
255 #define UNI_IE_AALP_A1_CB_DS2   5
256 #define UNI_IE_AALP_A1_CB_32064 6
257 #define UNI_IE_AALP_A1_CB_DS3   7
258 #define UNI_IE_AALP_A1_CB_97728 8
259 #define UNI_IE_AALP_A1_CB_E1    16
260 #define UNI_IE_AALP_A1_CB_E2    17
261 #define UNI_IE_AALP_A1_CB_E3    18
262 #define UNI_IE_AALP_A1_CB_139264        19
263 #define UNI_IE_AALP_A1_CB_N64   64
264
265 #define UNI_IE_AALP_A1_CR_NULL  0
266 #define UNI_IE_AALP_A1_CR_SRTS  1
267 #define UNI_IE_AALP_A1_CR_ACR   2
268
269 #define UNI_IE_AALP_A1_EC_NULL  0
270 #define UNI_IE_AALP_A1_EC_FEC   1
271
272 #define UNI_IE_AALP_A1_SD_NULL  0
273 #define UNI_IE_AALP_A1_SD_SDT   1
274
275 #define UNI_IE_AALP_A3_R_MASK   1023
276 #define UNI_IE_AALP_A3_R_SHIFT  16
277
278 #define UNI_IE_AALP_A5_M_MSG    1
279 #define UNI_IE_AALP_A5_M_STR    2
280
281 #define UNI_IE_AALP_A5_ST_NULL  0
282 #define UNI_IE_AALP_A5_ST_AO    1
283 #define UNI_IE_AALP_A5_ST_NAO   2
284 #define UNI_IE_AALP_A5_ST_FR    4
285
286
287 /*
288  * ATM user cell rate information element in internal format.
289  */
290 struct ie_clrt {
291         int32_t         ie_fwd_peak;
292         int32_t         ie_bkwd_peak;
293         int32_t         ie_fwd_peak_01;
294         int32_t         ie_bkwd_peak_01;
295         int32_t         ie_fwd_sust;
296         int32_t         ie_bkwd_sust;
297         int32_t         ie_fwd_sust_01;
298         int32_t         ie_bkwd_sust_01;
299         int32_t         ie_fwd_burst;
300         int32_t         ie_bkwd_burst;
301         int32_t         ie_fwd_burst_01;
302         int32_t         ie_bkwd_burst_01;
303         int8_t          ie_best_effort;
304         int8_t          ie_tm_options;
305 };
306
307 #define UNI_IE_CLRT_FWD_PEAK_ID         130
308 #define UNI_IE_CLRT_BKWD_PEAK_ID        131
309 #define UNI_IE_CLRT_FWD_PEAK_01_ID      132
310 #define UNI_IE_CLRT_BKWD_PEAK_01_ID     133
311 #define UNI_IE_CLRT_FWD_SUST_ID         136
312 #define UNI_IE_CLRT_BKWD_SUST_ID        137
313 #define UNI_IE_CLRT_FWD_SUST_01_ID      144
314 #define UNI_IE_CLRT_BKWD_SUST_01_ID     145
315 #define UNI_IE_CLRT_FWD_BURST_ID        160
316 #define UNI_IE_CLRT_BKWD_BURST_ID       161
317 #define UNI_IE_CLRT_FWD_BURST_01_ID     176
318 #define UNI_IE_CLRT_BKWD_BURST_01_ID    177
319 #define UNI_IE_CLRT_BEST_EFFORT_ID      190
320 #define UNI_IE_CLRT_TM_OPTIONS_ID       191
321
322 #define UNI_IE_CLRT_TM_FWD_TAG          0x01
323 #define UNI_IE_CLRT_TM_BKWD_TAG         0x02
324
325
326 /*
327  * Broadband bearer capability information element in internal format.
328  */
329 struct ie_bbcp {
330         int8_t          ie_bearer_class;
331         int8_t          ie_traffic_type;
332         int8_t          ie_timing_req;
333         int8_t          ie_clipping;
334         int8_t          ie_conn_config;
335 };
336
337
338 #define UNI_IE_BBCP_BC_BCOB_A   1
339 #define UNI_IE_BBCP_BC_BCOB_C   3
340 #define UNI_IE_BBCP_BC_BCOB_X   16
341 #define UNI_IE_BBCP_BC_MASK     0x1F
342
343 #define UNI_IE_BBCP_TT_NIND     0
344 #define UNI_IE_BBCP_TT_CBR      1
345 #define UNI_IE_BBCP_TT_VBR      2
346 #define UNI_IE_BBCP_TT_MASK     3
347 #define UNI_IE_BBCP_TT_SHIFT    2
348
349 #define UNI_IE_BBCP_TR_NIND     0
350 #define UNI_IE_BBCP_TR_EER      1
351 #define UNI_IE_BBCP_TR_EENR     2
352 #define UNI_IE_BBCP_TR_RSVD     3
353 #define UNI_IE_BBCP_TR_MASK     3
354
355 #define UNI_IE_BBCP_SC_NSUS     0
356 #define UNI_IE_BBCP_SC_SUS      1
357 #define UNI_IE_BBCP_SC_MASK     3
358 #define UNI_IE_BBCP_SC_SHIFT    5
359
360 #define UNI_IE_BBCP_CC_PP               0
361 #define UNI_IE_BBCP_CC_PM               1
362 #define UNI_IE_BBCP_CC_MASK     3
363
364
365 /*
366  * Broadband high layer information information element in internal
367  * format.
368  */
369 struct ie_bhli {
370         int8_t          ie_type;
371         u_char          ie_info[8];
372 };
373
374 #define UNI_IE_BHLI_TYPE_ISO    0
375 #define UNI_IE_BHLI_TYPE_USER   1
376 #define UNI_IE_BHLI_TYPE_HLP    2
377 #define UNI_IE_BHLI_TYPE_VSA    3
378
379 #define UNI_IE_BHLI_HLP_LEN     4
380 #define UNI_IE_BHLI_VSA_LEN     7
381
382
383 /*
384  * Broadband low-layer information information element in internal
385  * format.
386  */
387 struct ie_blli {
388         int8_t          ie_l1_id;
389         int8_t          ie_l2_id;
390         int8_t          ie_l2_mode;
391         int8_t          ie_l2_q933_use;
392         int8_t          ie_l2_window;
393         int8_t          ie_l2_user_proto;
394         int8_t          ie_l3_id;
395         int8_t          ie_l3_mode;
396         int8_t          ie_l3_packet_size;
397         int8_t          ie_l3_window;
398         int8_t          ie_l3_user_proto;
399         int16_t         ie_l3_ipi;
400         int8_t          ie_l3_snap_id;
401         u_char          ie_l3_oui[3];
402         u_char          ie_l3_pid[2];
403 };
404
405 #define UNI_IE_BLLI_L1_ID       1
406 #define UNI_IE_BLLI_L2_ID       2
407 #define UNI_IE_BLLI_L3_ID       3
408 #define UNI_IE_BLLI_LID_MASK    3
409 #define UNI_IE_BLLI_LID_SHIFT   5
410 #define UNI_IE_BLLI_LP_MASK     31
411
412 #define UNI_IE_BLLI_L2P_ISO1745 1
413 #define UNI_IE_BLLI_L2P_Q921    2
414 #define UNI_IE_BLLI_L2P_X25L    6
415 #define UNI_IE_BLLI_L2P_X25M    7
416 #define UNI_IE_BLLI_L2P_LAPB    8
417 #define UNI_IE_BLLI_L2P_HDLC1   9
418 #define UNI_IE_BLLI_L2P_HDLC2   10
419 #define UNI_IE_BLLI_L2P_HDLC3   11
420 #define UNI_IE_BLLI_L2P_LLC     12
421 #define UNI_IE_BLLI_L2P_X75     13
422 #define UNI_IE_BLLI_L2P_Q922    14
423 #define UNI_IE_BLLI_L2P_USER    16
424 #define UNI_IE_BLLI_L2P_ISO7776 17
425
426 #define UNI_IE_BLLI_L2MODE_NORM         1
427 #define UNI_IE_BLLI_L2MODE_EXT          2
428 #define UNI_IE_BLLI_L2MODE_SHIFT        5
429 #define UNI_IE_BLLI_L2MODE_MASK         3
430
431 #define UNI_IE_BLLI_Q933_ALT    0
432
433 #define UNI_IE_BLLI_L3P_X25     6
434 #define UNI_IE_BLLI_L3P_ISO8208 7
435 #define UNI_IE_BLLI_L3P_ISO8878 8
436 #define UNI_IE_BLLI_L3P_ISO8473 9
437 #define UNI_IE_BLLI_L3P_T70     10
438 #define UNI_IE_BLLI_L3P_ISO9577 11
439 #define UNI_IE_BLLI_L3P_USER    16
440
441 #define UNI_IE_BLLI_L3MODE_NORM         1
442 #define UNI_IE_BLLI_L3MODE_EXT          2
443 #define UNI_IE_BLLI_L3MODE_SHIFT        5
444 #define UNI_IE_BLLI_L3MODE_MASK         3
445
446 #define UNI_IE_BLLI_L3PS_16     4
447 #define UNI_IE_BLLI_L3PS_32     5
448 #define UNI_IE_BLLI_L3PS_64     6
449 #define UNI_IE_BLLI_L3PS_128    7
450 #define UNI_IE_BLLI_L3PS_256    8
451 #define UNI_IE_BLLI_L3PS_512    9
452 #define UNI_IE_BLLI_L3PS_1024   10
453 #define UNI_IE_BLLI_L3PS_2048   11
454 #define UNI_IE_BLLI_L3PS_4096   12
455 #define UNI_IE_BLLI_L3PS_MASK   15
456
457 #define UNI_IE_BLLI_L3IPI_SHIFT 6
458 #define UNI_IE_BLLI_L3IPI_SNAP  0x80
459
460
461 /*
462  * Call state information element in internal format.
463  */
464 struct ie_clst {
465         int8_t          ie_state;
466 };
467
468 #define UNI_IE_CLST_STATE_U0    0
469 #define UNI_IE_CLST_STATE_U1    1
470 #define UNI_IE_CLST_STATE_U3    3
471 #define UNI_IE_CLST_STATE_U6    6
472 #define UNI_IE_CLST_STATE_U8    8
473 #define UNI_IE_CLST_STATE_U9    9
474 #define UNI_IE_CLST_STATE_U10   10
475 #define UNI_IE_CLST_STATE_U11   11
476 #define UNI_IE_CLST_STATE_U12   12
477
478 #define UNI_IE_CLST_STATE_N0    0
479 #define UNI_IE_CLST_STATE_N1    1
480 #define UNI_IE_CLST_STATE_N3    3
481 #define UNI_IE_CLST_STATE_N6    6
482 #define UNI_IE_CLST_STATE_N8    8
483 #define UNI_IE_CLST_STATE_N9    9
484 #define UNI_IE_CLST_STATE_N10   10
485 #define UNI_IE_CLST_STATE_N11   11
486 #define UNI_IE_CLST_STATE_N12   12
487
488 #define UNI_IE_CLST_GLBL_REST0  0x00
489 #define UNI_IE_CLST_GLBL_REST1  0x3d
490 #define UNI_IE_CLST_GLBL_REST2  0x3e
491
492 #define UNI_IE_CLST_STATE_MASK  0x3f
493
494
495 /*
496  * Called party number information element in internal format.
497  */
498 struct ie_cdad {
499         int8_t          ie_type;
500         int8_t          ie_plan;
501         Atm_addr        ie_addr;
502 };
503
504 #define UNI_IE_CDAD_TYPE_UNK    0
505 #define UNI_IE_CDAD_TYPE_INTL   1
506 #define UNI_IE_CDAD_TYPE_MASK   7
507 #define UNI_IE_CDAD_TYPE_SHIFT  4
508
509 #define UNI_IE_CDAD_PLAN_E164   1
510 #define UNI_IE_CDAD_PLAN_NSAP   2
511 #define UNI_IE_CDAD_PLAN_MASK   15
512
513
514 /*
515  * Called party subaddress information element in internal format.
516  */
517 struct ie_cdsa {
518         Atm_addr        ie_addr;
519 };
520
521 #define UNI_IE_CDSA_TYPE_NSAP   0
522 #define UNI_IE_CDSA_TYPE_AESA   1
523 #define UNI_IE_CDSA_TYPE_MASK   7
524 #define UNI_IE_CDSA_TYPE_SHIFT  4
525
526
527 /*
528  * Calling party number information element in internal format.
529  */
530 struct ie_cgad {
531         int8_t          ie_type;
532         int8_t          ie_plan;
533         int8_t          ie_pres_ind;
534         int8_t          ie_screen_ind;
535         Atm_addr        ie_addr;
536 };
537
538 #define UNI_IE_CGAD_TYPE_UNK    0
539 #define UNI_IE_CGAD_TYPE_INTL   1
540 #define UNI_IE_CGAD_TYPE_MASK   7
541 #define UNI_IE_CGAD_TYPE_SHIFT  4
542
543 #define UNI_IE_CGAD_PLAN_E164   1
544 #define UNI_IE_CGAD_PLAN_NSAP   2
545 #define UNI_IE_CGAD_PLAN_MASK   15
546
547 #define UNI_IE_CGAD_PRES_ALLOW  0
548 #define UNI_IE_CGAD_PRES_RSTR   1
549 #define UNI_IE_CGAD_PRES_NNA    2
550 #define UNI_IE_CGAD_PRES_RSVD   3
551 #define UNI_IE_CGAD_PRES_MASK   3
552 #define UNI_IE_CGAD_PRES_SHIFT  5
553
554 #define UNI_IE_CGAD_SCR_UNS     0
555 #define UNI_IE_CGAD_SCR_UVP     1
556 #define UNI_IE_CGAD_SCR_UVF     2
557 #define UNI_IE_CGAD_SCR_NET     3
558 #define UNI_IE_CGAD_SCR_MASK    3
559
560
561 /*
562  * Calling party subaddress information element in internal format.
563  */
564 struct ie_cgsa {
565         Atm_addr        ie_addr;
566 };
567
568 #define UNI_IE_CGSA_TYPE_NSAP   0
569 #define UNI_IE_CGSA_TYPE_AESA   1
570 #define UNI_IE_CGSA_TYPE_MASK   7
571 #define UNI_IE_CGSA_TYPE_SHIFT  4
572
573
574 /*
575  * Cause information element in internal format.
576  */
577 #define UNI_IE_CAUS_MAX_ID      24
578 #define UNI_IE_CAUS_MAX_QOS_SUB 24
579 struct ie_caus {
580         int8_t          ie_loc;
581         int8_t          ie_cause;
582         int8_t          ie_diag_len;
583         u_int8_t        ie_diagnostic[24];
584 };
585
586 #define UNI_IE_CAUS_LOC_USER    0
587 #define UNI_IE_CAUS_LOC_PRI_LCL 1
588 #define UNI_IE_CAUS_LOC_PUB_LCL 2
589 #define UNI_IE_CAUS_LOC_TRANSIT 3
590 #define UNI_IE_CAUS_LOC_PUB_RMT 4
591 #define UNI_IE_CAUS_LOC_PRI_RMT 5
592 #define UNI_IE_CAUS_LOC_INTL    7
593 #define UNI_IE_CAUS_LOC_BEYOND  10
594 #define UNI_IE_CAUS_LOC_MASK    15
595
596 #define UNI_IE_CAUS_UN_NS_SHIFT 3
597 #define UNI_IE_CAUS_UN_NS_MASK  1
598
599 #define UNI_IE_CAUS_UN_NA_SHIFT 2
600 #define UNI_IE_CAUS_UN_NA_MASK  1
601
602 #define UNI_IE_CAUS_UN_CAU_MASK 3
603
604 #define UNI_IE_CAUS_RR_USER     0
605 #define UNI_IE_CAUS_RR_IE       1
606 #define UNI_IE_CAUS_RR_INSUFF   2
607 #define UNI_IE_CAUS_RR_SHIFT    2
608 #define UNI_IE_CAUS_RR_MASK     31
609
610 #define UNI_IE_CAUS_RC_UNK      0
611 #define UNI_IE_CAUS_RC_PERM     1
612 #define UNI_IE_CAUS_RC_TRANS    2
613 #define UNI_IE_CAUS_RC_MASK     3
614
615 /*
616  * Cause codes from UNI 3.0, section 5.4.5.15
617  */
618 #define UNI_IE_CAUS_UNO         1       /* Unallocated number */
619 #define UNI_IE_CAUS_NOTROUTE    2       /* No route to transit net */
620 #define UNI_IE_CAUS_NODROUTE    3       /* No route to destination */
621 #define UNI_IE_CAUS_BAD_VCC     10      /* VPI/VCI unacceptable */
622 #define UNI_IE_CAUS_NORM        16      /* Normal call clearing */
623 #define UNI_IE_CAUS_BUSY        17      /* User busy */
624 #define UNI_IE_CAUS_NORSP       18      /* No user responding */
625 #define UNI_IE_CAUS_REJECT      21      /* Call rejected */
626 #define UNI_IE_CAUS_CHANGED     22      /* Number changed */
627 #define UNI_IE_CAUS_CLIR        23      /* User rejects CLIR */
628 #define UNI_IE_CAUS_DORDER      27      /* Dest out of order */
629 #define UNI_IE_CAUS_INVNO       28      /* Invalid number format */
630 #define UNI_IE_CAUS_SENQ        30      /* Rsp to Status Enquiry */
631 #define UNI_IE_CAUS_NORM_UNSP   31      /* Normal, unspecified */
632 #define UNI_IE_CAUS_NA_VCC      35      /* VCC not available */
633 #define UNI_IE_CAUS_ASSIGN_VCC  36      /* VPCI/VCI assignment failure */
634 #define UNI_IE_CAUS_NORDER      38      /* Network out of order */
635 #define UNI_IE_CAUS_TEMP        41      /* Temporary failure */
636 #define UNI_IE_CAUS_DISCARD     43      /* Access info discarded */
637 #define UNI_IE_CAUS_NO_VCC      45      /* No VPI/VCI available */
638 #define UNI_IE_CAUS_UNAVAIL     47      /* Resource unavailable */
639 #define UNI_IE_CAUS_NO_QOS      49      /* QoS unavailable */
640 #define UNI_IE_CAUS_NO_CR       51      /* User cell rate not avail */
641 #define UNI_IE_CAUS_NO_BC       57      /* Bearer capability not auth */
642 #define UNI_IE_CAUS_NA_BC       58      /* Bearer capability n/a */
643 #define UNI_IE_CAUS_SERVICE     63      /* Service or opt not avail */
644 #define UNI_IE_CAUS_NI_BC       65      /* Bearer cap not implemented */
645 #define UNI_IE_CAUS_COMB        73      /* Unsupported combination */
646 #define UNI_IE_CAUS_CREF        81      /* Invalid call reference */
647 #define UNI_IE_CAUS_CEXIST      82      /* Channel does not exist */
648 #define UNI_IE_CAUS_IDEST       88      /* Incompatible destination */
649 #define UNI_IE_CAUS_ENDPT       89      /* Invalid endpoint reference */
650 #define UNI_IE_CAUS_TRNET       91      /* Invalid transit net */
651 #define UNI_IE_CAUS_APPEND      92      /* Too many pending add party */
652 #define UNI_IE_CAUS_UAAL        93      /* AAL parms can't be supp */
653 #define UNI_IE_CAUS_MISSING     96      /* Mandatory IE missing */
654 #define UNI_IE_CAUS_MTEXIST     97      /* Message type nonexistent */
655 #define UNI_IE_CAUS_IEEXIST     99      /* IE type nonexistent */
656 #define UNI_IE_CAUS_IECONTENT   100     /* IE content invalid */
657 #define UNI_IE_CAUS_STATE       101     /* Message incomp with state */
658 #define UNI_IE_CAUS_TIMER       102     /* Recovery on timer expire */
659 #define UNI_IE_CAUS_LEN         104     /* Incorrect message length */
660 #define UNI_IE_CAUS_PROTO       111     /* Protocol error */
661
662
663 /*
664  * Connection identifier information element in internal format.
665  */
666 struct ie_cnid {
667         int8_t          ie_vp_sig;
668         int8_t          ie_pref_excl;
669         u_short         ie_vpci;
670         u_short         ie_vci;
671 };
672
673 #define UNI_IE_CNID_VPSIG_MASK  3
674 #define UNI_IE_CNID_VPSIG_SHIFT 3
675 #define UNI_IE_CNID_PREX_MASK   7
676
677 #define UNI_IE_CNID_MIN_VCI     32
678
679
680 /*
681  * Quality of service parameter information element in internal format.
682  */
683 struct ie_qosp {
684         int8_t          ie_fwd_class;
685         int8_t          ie_bkwd_class;
686 };
687
688 #define UNI_IE_QOSP_FWD_CLASS_0 0
689 #define UNI_IE_QOSP_FWD_CLASS_1 1
690 #define UNI_IE_QOSP_FWD_CLASS_2 2
691 #define UNI_IE_QOSP_FWD_CLASS_3 3
692 #define UNI_IE_QOSP_FWD_CLASS_4 4
693
694 #define UNI_IE_QOSP_BKWD_CLASS_0        0
695 #define UNI_IE_QOSP_BKWD_CLASS_1        1
696 #define UNI_IE_QOSP_BKWD_CLASS_2        2
697 #define UNI_IE_QOSP_BKWD_CLASS_3        3
698 #define UNI_IE_QOSP_BKWD_CLASS_4        4
699
700
701 /*
702  * Broadband repeat indicator information element in internal format.
703  */
704 struct ie_brpi {
705         int8_t          ie_ind;
706 };
707
708 #define UNI_IE_BRPI_PRI_LIST    2
709 #define UNI_IE_BRPI_IND_MASK    15
710
711
712 /*
713  * Restart indicator information element in internal format.
714  */
715 struct ie_rsti {
716         int8_t          ie_class;
717 };
718
719 #define UNI_IE_RSTI_IND_VC      0
720 #define UNI_IE_RSTI_ALL_VC      2
721 #define UNI_IE_RSTI_CLASS_MASK  3
722
723
724 /*
725  * Broadband locking shift information element in internal format.
726  */
727 struct ie_blsh {
728         int8_t          ie_dummy;
729 };
730
731
732 /*
733  * Broadband non-locking shift information element in internal format.
734  */
735 struct ie_bnsh {
736         int8_t          ie_dummy;
737 };
738
739
740 /*
741  * Broadband sending complete information element in internal format.
742  */
743 struct ie_bsdc {
744         int8_t          ie_ind;
745 };
746
747 #define UNI_IE_BSDC_IND         0x21
748
749
750 /*
751  * Transit net selection information element in internal format.
752  */
753 struct ie_trnt {
754         int8_t          ie_id_type;
755         int8_t          ie_id_plan;
756         u_char          ie_id_len;
757         u_char          ie_id[4];
758 };
759
760 #define UNI_IE_TRNT_IDT_MASK    7
761 #define UNI_IE_TRNT_IDT_SHIFT   4
762 #define UNI_IE_TRNT_IDP_MASK    15
763
764 #define UNI_IE_TRNT_IDT_NATL    2
765 #define UNI_IE_TRNT_IDP_CIC     1
766
767
768 /*
769  * Endpoint reference information element in internal format.
770  */
771 struct ie_eprf {
772         int8_t          ie_type;
773         int16_t         ie_id;
774 };
775
776 #define UNI_IE_EPRF_LDI         0
777
778
779 /*
780  * Endpoint state information element in internal format.
781  */
782 struct ie_epst {
783         int8_t          ie_state;
784 };
785
786 #define UNI_IE_EPST_NULL        0
787 #define UNI_IE_EPST_API         1
788 #define UNI_IE_EPST_APR         6
789 #define UNI_IE_EPST_DPI         11
790 #define UNI_IE_EPST_DPR         12
791 #define UNI_IE_EPST_ACTIVE      10
792 #define UNI_IE_EPST_STATE_MASK  0x3F
793
794
795 /*
796  * Generic information element
797  */
798 struct ie_generic {
799         struct ie_hdr           ie_hdr;
800         union {
801                 struct ie_aalp          ie_aalp;
802                 struct ie_clrt          ie_clrt;
803                 struct ie_bbcp          ie_bbcp;
804                 struct ie_bhli          ie_bhli;
805                 struct ie_blli          ie_blli;
806                 struct ie_clst          ie_clst;
807                 struct ie_cdad          ie_cdad;
808                 struct ie_cdsa          ie_cdsa;
809                 struct ie_cgad          ie_cgad;
810                 struct ie_cgsa          ie_cgsa;
811                 struct ie_caus          ie_caus;
812                 struct ie_cnid          ie_cnid;
813                 struct ie_qosp          ie_qosp;
814                 struct ie_brpi          ie_brpi;
815                 struct ie_rsti          ie_rsti;
816                 struct ie_blsh          ie_blsh;
817                 struct ie_bnsh          ie_bnsh;
818                 struct ie_bsdc          ie_bsdc;
819                 struct ie_trnt          ie_trnt;
820                 struct ie_eprf          ie_eprf;
821                 struct ie_epst          ie_epst;
822         } ie_u;
823 };
824
825 #define ie_ident        ie_hdr.ie_hdr_ident
826 #define ie_coding       ie_hdr.ie_hdr_coding
827 #define ie_flag         ie_hdr.ie_hdr_flag
828 #define ie_action       ie_hdr.ie_hdr_action
829 #define ie_length       ie_hdr.ie_hdr_length
830 #define ie_err_cause    ie_hdr.ie_hdr_err_cause
831 #define ie_next         ie_hdr.ie_hdr_next
832
833 #define ie_aalp_aal_type                ie_u.ie_aalp.ie_aal_type
834 #define ie_aalp_1_subtype               ie_u.ie_aalp.aal_u.type_1.subtype
835 #define ie_aalp_1_cbr_rate              ie_u.ie_aalp.aal_u.type_1.cbr_rate
836 #define ie_aalp_1_multiplier            ie_u.ie_aalp.aal_u.type_1.multiplier
837 #define ie_aalp_1_clock_recovery        ie_u.ie_aalp.aal_u.type_1.clock_recovery
838 #define ie_aalp_1_error_correction      ie_u.ie_aalp.aal_u.type_1.error_correction
839 #define ie_aalp_1_struct_data_tran      ie_u.ie_aalp.aal_u.type_1.struct_data_tran
840 #define ie_aalp_1_partial_cells         ie_u.ie_aalp.aal_u.type_1.partial_cells
841
842 #define ie_aalp_4_fwd_max_sdu           ie_u.ie_aalp.aal_u.type_4.fwd_max_sdu
843 #define ie_aalp_4_bkwd_max_sdu          ie_u.ie_aalp.aal_u.type_4.bkwd_max_sdu
844 #define ie_aalp_4_mid_range             ie_u.ie_aalp.aal_u.type_4.mid_range
845 #define ie_aalp_4_mode                  ie_u.ie_aalp.aal_u.type_4.mode
846 #define ie_aalp_4_sscs_type             ie_u.ie_aalp.aal_u.type_4.sscs_type
847
848 #define ie_aalp_5_fwd_max_sdu           ie_u.ie_aalp.aal_u.type_5.fwd_max_sdu
849 #define ie_aalp_5_bkwd_max_sdu          ie_u.ie_aalp.aal_u.type_5.bkwd_max_sdu
850 #define ie_aalp_5_mode                  ie_u.ie_aalp.aal_u.type_5.mode
851 #define ie_aalp_5_sscs_type             ie_u.ie_aalp.aal_u.type_5.sscs_type
852 #define ie_aalp_user_info               ie_u.ie_aalp.aal_u.type_user.aal_info
853
854 #define ie_clrt_fwd_peak        ie_u.ie_clrt.ie_fwd_peak
855 #define ie_clrt_bkwd_peak       ie_u.ie_clrt.ie_bkwd_peak
856 #define ie_clrt_fwd_peak_01     ie_u.ie_clrt.ie_fwd_peak_01
857 #define ie_clrt_bkwd_peak_01    ie_u.ie_clrt.ie_bkwd_peak_01
858 #define ie_clrt_fwd_sust        ie_u.ie_clrt.ie_fwd_sust
859 #define ie_clrt_bkwd_sust       ie_u.ie_clrt.ie_bkwd_sust
860 #define ie_clrt_fwd_sust_01     ie_u.ie_clrt.ie_fwd_sust_01
861 #define ie_clrt_bkwd_sust_01    ie_u.ie_clrt.ie_bkwd_sust_01
862 #define ie_clrt_fwd_burst       ie_u.ie_clrt.ie_fwd_burst
863 #define ie_clrt_bkwd_burst      ie_u.ie_clrt.ie_bkwd_burst
864 #define ie_clrt_fwd_burst_01    ie_u.ie_clrt.ie_fwd_burst_01
865 #define ie_clrt_bkwd_burst_01   ie_u.ie_clrt.ie_bkwd_burst_01
866 #define ie_clrt_best_effort     ie_u.ie_clrt.ie_best_effort
867 #define ie_clrt_tm_options      ie_u.ie_clrt.ie_tm_options
868
869 #define ie_bbcp_bearer_class    ie_u.ie_bbcp.ie_bearer_class
870 #define ie_bbcp_traffic_type    ie_u.ie_bbcp.ie_traffic_type
871 #define ie_bbcp_timing_req      ie_u.ie_bbcp.ie_timing_req
872 #define ie_bbcp_clipping        ie_u.ie_bbcp.ie_clipping
873 #define ie_bbcp_conn_config     ie_u.ie_bbcp.ie_conn_config
874
875 #define ie_bhli_type            ie_u.ie_bhli.ie_type
876 #define ie_bhli_info            ie_u.ie_bhli.ie_info
877
878 #define ie_blli_l1_id           ie_u.ie_blli.ie_l1_id
879 #define ie_blli_l2_id           ie_u.ie_blli.ie_l2_id
880 #define ie_blli_l2_mode         ie_u.ie_blli.ie_l2_mode
881 #define ie_blli_l2_q933_use     ie_u.ie_blli.ie_l2_q933_use
882 #define ie_blli_l2_window       ie_u.ie_blli.ie_l2_window
883 #define ie_blli_l2_user_proto   ie_u.ie_blli.ie_l2_user_proto
884 #define ie_blli_l3_id           ie_u.ie_blli.ie_l3_id
885 #define ie_blli_l3_mode         ie_u.ie_blli.ie_l3_mode
886 #define ie_blli_l3_packet_size  ie_u.ie_blli.ie_l3_packet_size
887 #define ie_blli_l3_window       ie_u.ie_blli.ie_l3_window
888 #define ie_blli_l3_user_proto   ie_u.ie_blli.ie_l3_user_proto
889 #define ie_blli_l3_ipi          ie_u.ie_blli.ie_l3_ipi
890 #define ie_blli_l3_snap_id      ie_u.ie_blli.ie_l3_snap_id
891 #define ie_blli_l3_oui          ie_u.ie_blli.ie_l3_oui
892 #define ie_blli_l3_pid          ie_u.ie_blli.ie_l3_pid
893
894 #define ie_clst_state           ie_u.ie_clst.ie_state
895
896 #define ie_cdad_type            ie_u.ie_cdad.ie_type
897 #define ie_cdad_plan            ie_u.ie_cdad.ie_plan
898 #define ie_cdad_addr            ie_u.ie_cdad.ie_addr
899
900 #define ie_cdsa_addr            ie_u.ie_cdsa.ie_addr
901
902 #define ie_cgad_type            ie_u.ie_cgad.ie_type
903 #define ie_cgad_plan            ie_u.ie_cgad.ie_plan
904 #define ie_cgad_pres_ind        ie_u.ie_cgad.ie_pres_ind
905 #define ie_cgad_screen_ind      ie_u.ie_cgad.ie_screen_ind
906 #define ie_cgad_addr            ie_u.ie_cgad.ie_addr
907
908 #define ie_cgsa_addr            ie_u.ie_cgsa.ie_addr
909
910 #define ie_caus_loc             ie_u.ie_caus.ie_loc
911 #define ie_caus_cause           ie_u.ie_caus.ie_cause
912 #define ie_caus_diag_len        ie_u.ie_caus.ie_diag_len
913 #define ie_caus_diagnostic      ie_u.ie_caus.ie_diagnostic
914
915 #define ie_cnid_vp_sig          ie_u.ie_cnid.ie_vp_sig
916 #define ie_cnid_pref_excl       ie_u.ie_cnid.ie_pref_excl
917 #define ie_cnid_vpci            ie_u.ie_cnid.ie_vpci
918 #define ie_cnid_vci             ie_u.ie_cnid.ie_vci
919
920 #define ie_qosp_fwd_class       ie_u.ie_qosp.ie_fwd_class
921 #define ie_qosp_bkwd_class      ie_u.ie_qosp.ie_bkwd_class
922
923 #define ie_brpi_ind             ie_u.ie_brpi.ie_ind
924
925 #define ie_rsti_class           ie_u.ie_rsti.ie_class
926
927 #define ie_bsdc_ind             ie_u.ie_bsdc.ie_ind
928
929 #define ie_trnt_id_type         ie_u.ie_trnt.ie_id_type
930 #define ie_trnt_id_plan         ie_u.ie_trnt.ie_id_plan
931 #define ie_trnt_id_len          ie_u.ie_trnt.ie_id_len
932 #define ie_trnt_id              ie_u.ie_trnt.ie_id
933
934 #define ie_eprf_type            ie_u.ie_eprf.ie_type
935 #define ie_eprf_id              ie_u.ie_eprf.ie_id
936
937 #define ie_epst_state           ie_u.ie_epst.ie_state
938
939 /*
940  * Macro to add an IE to the end of a list of IEs
941  */
942 #define MSG_IE_ADD(m, i, ind)                                   \
943         if (m->msg_ie_vec[ind]) {                               \
944                 struct ie_generic *_iep = msg->msg_ie_vec[ind]; \
945                 while (_iep->ie_next) {                         \
946                         _iep = _iep->ie_next;                   \
947                 }                                               \
948                 _iep->ie_next = i;                              \
949         } else {                                                \
950                 m->msg_ie_vec[ind] = i;                         \
951         }
952
953 #endif  /* _UNI_SIG_MSG_H */