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