1121934Sharti/*
2121934Sharti * Copyright (c) 1996-2003
3121934Sharti *	Fraunhofer Institute for Open Communication Systems (FhG Fokus).
4121934Sharti * 	All rights reserved.
5121934Sharti *
6121934Sharti * Redistribution and use in source and binary forms, with or without
7121934Sharti * modification, are permitted provided that the following conditions
8121934Sharti * are met:
9121934Sharti * 1. Redistributions of source code must retain the above copyright
10121934Sharti *    notice, this list of conditions and the following disclaimer.
11121934Sharti * 2. Redistributions in binary form must reproduce the above copyright
12121934Sharti *    notice, this list of conditions and the following disclaimer in the
13121934Sharti *    documentation and/or other materials provided with the distribution.
14121934Sharti *
15121934Sharti * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16121934Sharti * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17121934Sharti * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18121934Sharti * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19121934Sharti * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20121934Sharti * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21121934Sharti * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22121934Sharti * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23121934Sharti * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24121934Sharti * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25121934Sharti * SUCH DAMAGE.
26121934Sharti *
27121934Sharti * Author: Hartmut Brandt <harti@freebsd.org>
28121934Sharti *
29131826Sharti * $Begemot: libunimsg/netnatm/msg/uni_hdr.h,v 1.6 2004/07/08 08:22:05 brandt Exp $
30121934Sharti */
31121934Sharti#ifndef _NETNATM_MSG_UNI_HDR_H_
32121934Sharti#define _NETNATM_MSG_UNI_HDR_H_
33121934Sharti
34121934Sharti#include <sys/types.h>
35131826Sharti#ifdef _KERNEL
36131826Sharti#include <sys/stdint.h>
37131826Sharti#else
38131826Sharti#include <stdint.h>
39131826Sharti#endif
40121934Sharti
41121934Sharti#include <netnatm/msg/uni_config.h>
42121934Sharti
43121934Shartienum {
44121934Sharti	UNI_PROTO	= 0x09,		/* protocol discriminator */
45121934Sharti	PNNI_PROTO	= 0xf0,		/* PNNI protocol discriminator */
46121934Sharti};
47121934Sharti
48121934Sharti/*
49121934Sharti * Message types
50121934Sharti */
51121934Shartienum uni_msgtype {
52121934Sharti	UNI_UNKNOWN		= 0x100,/* unknown message */
53121934Sharti
54121934Sharti	UNI_ALERTING		= 0x01,	/* alerting */
55121934Sharti	UNI_CALL_PROC		= 0x02, /* call proceeding */
56121934Sharti	UNI_SETUP		= 0x05,	/* setup */
57121934Sharti	UNI_CONNECT		= 0x07,	/* connect */
58121934Sharti	UNI_CONNECT_ACK		= 0x0f,	/* connect ack */
59121934Sharti
60121934Sharti	UNI_RESTART		= 0x46,	/* restart */
61121934Sharti	UNI_RELEASE		= 0x4d,	/* release */
62121934Sharti	UNI_RESTART_ACK		= 0x4e,	/* restart acknowledgement */
63121934Sharti	UNI_RELEASE_COMPL	= 0x5a,	/* release complete */
64121934Sharti
65121934Sharti	UNI_NOTIFY		= 0x6e,	/* notify user */
66121934Sharti	UNI_STATUS_ENQ		= 0x75,	/* status enquiry */
67121934Sharti	UNI_STATUS		= 0x7d,	/* status */
68121934Sharti
69121934Sharti	UNI_ADD_PARTY		= 0x80,	/* add party */
70121934Sharti	UNI_ADD_PARTY_ACK	= 0x81,	/* add party acknowledgement */
71121934Sharti	UNI_ADD_PARTY_REJ	= 0x82,	/* add party reject */
72121934Sharti	UNI_DROP_PARTY		= 0x83,	/* drop party */
73121934Sharti	UNI_DROP_PARTY_ACK	= 0x84,	/* drop party acknowledgement */
74121934Sharti	UNI_PARTY_ALERTING	= 0x85,	/* party alerting */
75121934Sharti
76121934Sharti	UNI_LEAF_SETUP_FAIL	= 0x90,	/* leaf setup failed */
77121934Sharti	UNI_LEAF_SETUP_REQ	= 0x91,	/* leaf setup request */
78121934Sharti
79121934Sharti	UNI_COBISETUP		= 0x15,	/* Q.2932 COBI-setup */
80121934Sharti	UNI_FACILITY		= 0x62,	/* Q.2932 facility */
81121934Sharti
82121934Sharti	UNI_MODIFY_REQ		= 0x88,	/* Q.2963 Modify request */
83121934Sharti	UNI_MODIFY_ACK		= 0x89,	/* Q.2963 Modify acknowledgement */
84121934Sharti	UNI_MODIFY_REJ		= 0x8a,	/* Q.2963 Modify reject */
85121934Sharti	UNI_CONN_AVAIL		= 0x8b,	/* Q.2963 Connection available */
86121934Sharti};
87121934Sharti
88121934Sharti/*
89121934Sharti * Information element types
90121934Sharti */
91121934Shartienum uni_ietype {
92121934Sharti	UNI_IE_CAUSE		= 0x08,	/* cause */
93121934Sharti	UNI_IE_CALLSTATE	= 0x14,	/* call state */
94121934Sharti	UNI_IE_FACILITY		= 0x1C,	/* Q.2932 facility IE */
95121934Sharti	UNI_IE_NOTIFY		= 0x27,	/* UNI4.0 notify */
96121934Sharti	UNI_IE_EETD		= 0x42,	/* UNI4.0 end-to-end transit delay */
97121934Sharti	UNI_IE_CONNED		= 0x4c,	/* UNI4.0/Q.2951 connected address */
98121934Sharti	UNI_IE_CONNEDSUB	= 0x4d,	/* UNI4.0/Q.2951 connected subaddress */
99121934Sharti	UNI_IE_EPREF		= 0x54,	/* endpoint reference */
100121934Sharti	UNI_IE_EPSTATE		= 0x55,	/* enpoint state */
101121934Sharti	UNI_IE_AAL		= 0x58,	/* ATM adaptation layer parameters */
102121934Sharti	UNI_IE_TRAFFIC		= 0x59,	/* ATM traffic descriptor */
103121934Sharti	UNI_IE_CONNID		= 0x5a,	/* connection identifier */
104121934Sharti	UNI_IE_QOS		= 0x5c,	/* quality of service parameter */
105121934Sharti	UNI_IE_BHLI		= 0x5d,	/* broadband higher layer information */
106121934Sharti	UNI_IE_BEARER		= 0x5e,	/* broadband bearer capability */
107121934Sharti	UNI_IE_BLLI		= 0x5f,	/* broadband lower layer information */
108121934Sharti	UNI_IE_LSHIFT		= 0x60,	/* broadband locking shift */
109121934Sharti	UNI_IE_NLSHIFT		= 0x61,	/* broadband non-locking shift */
110121934Sharti	UNI_IE_SCOMPL		= 0x62,	/* broadband sending complete */
111121934Sharti	UNI_IE_REPEAT		= 0x63,	/* broadband repeat indicator */
112121934Sharti	UNI_IE_CALLING		= 0x6c,	/* calling party number */
113121934Sharti	UNI_IE_CALLINGSUB	= 0x6d,	/* calling party subaddress */
114121934Sharti	UNI_IE_CALLED		= 0x70,	/* called party number */
115121934Sharti	UNI_IE_CALLEDSUB	= 0x71,	/* called party subaddress */
116121934Sharti	UNI_IE_TNS		= 0x78,	/* transit network selection */
117121934Sharti	UNI_IE_RESTART		= 0x79,	/* restart indicator */
118121934Sharti	UNI_IE_UU		= 0x7e,	/* UNI4.0/Q.2957 user-to-user info */
119121934Sharti	UNI_IE_GIT		= 0x7f,	/* UNI4.0 generic identifier transport*/
120121934Sharti	UNI_IE_MINTRAFFIC	= 0x81,	/* Q.2962 minimum traffic desc */
121121934Sharti	UNI_IE_ATRAFFIC		= 0x82,	/* Q.2962 alternate traffic desc */
122121934Sharti	UNI_IE_ABRSETUP		= 0x84,	/* UNI4.0 ABR setup parameters */
123121934Sharti	UNI_IE_REPORT		= 0x89,	/* Q.2963 broadband report type */
124121934Sharti	UNI_IE_CALLED_SOFT	= 0xe0,	/* PNNI Calling party soft PVPC */
125121934Sharti	UNI_IE_CRANKBACK	= 0xe1,	/* PNNI Crankback */
126121934Sharti	UNI_IE_DTL		= 0xe2,	/* PNNI designated transit list */
127121934Sharti	UNI_IE_CALLING_SOFT	= 0xe3,	/* PNNI Called party soft PVPC */
128121934Sharti	UNI_IE_ABRADD		= 0xe4,	/* UNI4.0 ABR additional parameters */
129121934Sharti	UNI_IE_LIJ_CALLID	= 0xe8,	/* UNI4.0 LIF call identifier */
130121934Sharti	UNI_IE_LIJ_PARAM	= 0xe9,	/* UNI4.0 LIF parameters */
131121934Sharti	UNI_IE_LIJ_SEQNO	= 0xea,	/* UNI4.0 LIF sequence number */
132121934Sharti	UNI_IE_CSCOPE		= 0xeb,	/* UNI4.0 connection scope selection */
133121934Sharti	UNI_IE_EXQOS		= 0xec,	/* UNI4.0 extended QoS parameters */
134121934Sharti	UNI_IE_MDCR		= 0xf0,	/* UNI4.0+ Minimum desired call rate */
135121934Sharti	UNI_IE_UNREC		= 0xfe,
136121934Sharti};
137121934Sharti
138121934Shartienum uni_coding {
139121934Sharti	UNI_CODING_ITU = 0x0,
140121934Sharti	UNI_CODING_NET = 0x3,
141121934Sharti};
142121934Sharti
143121934Shartienum uni_msgact {
144121934Sharti	UNI_MSGACT_CLEAR	= 0x0,
145121934Sharti	UNI_MSGACT_IGNORE	= 0x1,
146121934Sharti	UNI_MSGACT_REPORT	= 0x2,
147121934Sharti
148121934Sharti	UNI_MSGACT_DEFAULT	= 0x4
149121934Sharti};
150121934Sharti
151121934Shartienum uni_ieact {
152121934Sharti	UNI_IEACT_CLEAR		= 0x00,	/* clear call */
153121934Sharti	UNI_IEACT_IGNORE	= 0x01,	/* ignore IE and proceed */
154121934Sharti	UNI_IEACT_REPORT	= 0x02,	/* ignore IE, report and proceed */
155121934Sharti	UNI_IEACT_MSG_IGNORE	= 0x05,	/* ignore message */
156121934Sharti	UNI_IEACT_MSG_REPORT	= 0x06,	/* ignore message and report */
157121934Sharti
158121934Sharti	UNI_IEACT_DEFAULT	= 0x08
159121934Sharti};
160121934Sharti
161121934Shartistruct uni_cref {
162121934Sharti	u_int	flag;
163121934Sharti	u_int	cref;
164121934Sharti};
165121934Sharti
166121934Sharti/*
167121934Sharti * Message header.
168121934Sharti */
169121934Shartistruct uni_msghdr {
170121934Sharti	struct uni_cref	cref;
171121934Sharti	enum uni_msgact	act;		/* action indicator */
172121934Sharti	u_int		pass:1;		/* PNNI pass along request */
173121934Sharti};
174121934Sharti
175121934Shartienum {
176121934Sharti	CREF_GLOBAL	= 0,
177121934Sharti	CREF_DUMMY	= 0x7fffff,
178121934Sharti};
179121934Sharti
180121934Sharti/*
181121934Sharti * General information element header.
182121934Sharti */
183121934Shartistruct uni_iehdr {
184121934Sharti	enum uni_coding	coding;		/* coding standard */
185121934Sharti	enum uni_ieact	act;		/* action indicator */
186121934Sharti	u_int		pass : 1;	/* PNNI pass along request */
187121934Sharti	u_int		present;	/* which optional elements are present */
188121934Sharti#define UNI_IE_EMPTY	0x80000000
189121934Sharti#define UNI_IE_PRESENT	0x40000000
190121934Sharti#define UNI_IE_ERROR	0x20000000
191121934Sharti#define UNI_IE_XXX	0x10000000
192121934Sharti#define UNI_IE_MASK	0xf0000000
193121934Sharti};
194121934Sharti
195121934Sharti#define IE_ISPRESENT(IE) \
196121934Sharti	(((IE).h.present & (UNI_IE_PRESENT|UNI_IE_EMPTY)) == UNI_IE_PRESENT)
197121934Sharti#define IE_SETPRESENT(IE) \
198121934Sharti	((IE).h.present = ((IE).h.present & ~UNI_IE_MASK) | \
199121934Sharti		UNI_IE_PRESENT)
200121934Sharti
201121934Sharti#define IE_ADDPRESENT(IE) \
202121934Sharti	((IE).h.present = ((IE).h.present & ~UNI_IE_EMPTY) | \
203121934Sharti		UNI_IE_PRESENT)
204121934Sharti
205121934Sharti#define IE_ISEMPTY(IE) \
206121934Sharti	(((IE).h.present & UNI_IE_MASK) == (UNI_IE_PRESENT | UNI_IE_EMPTY))
207121934Sharti#define IE_SETEMPTY(IE) \
208121934Sharti	((IE).h.present = ((IE).h.present & ~UNI_IE_MASK) | \
209121934Sharti		UNI_IE_EMPTY | UNI_IE_PRESENT)
210121934Sharti
211121934Sharti#define IE_ISERROR(IE) \
212121934Sharti	(((IE).h.present & UNI_IE_MASK) == (UNI_IE_PRESENT | UNI_IE_ERROR))
213121934Sharti#define IE_SETERROR(IE) \
214121934Sharti	((IE).h.present = ((IE).h.present & ~UNI_IE_MASK) | \
215121934Sharti		UNI_IE_ERROR | UNI_IE_PRESENT)
216121934Sharti
217121934Sharti#define IE_ISGOOD(IE) \
218121934Sharti	(((IE).h.present & UNI_IE_MASK) == (UNI_IE_PRESENT))
219121934Sharti
220121934Sharti#endif
221