1/* 2 * Copyright (c) 1996-2003 3 * Fraunhofer Institute for Open Communication Systems (FhG Fokus). 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: 9 * 1. Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * 2. Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * 15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 16 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 * 27 * Author: Hartmut Brandt <harti@freebsd.org> 28 * 29 * $Begemot: libunimsg/netnatm/msg/uni_hdr.h,v 1.6 2004/07/08 08:22:05 brandt Exp $ 30 */ 31#ifndef _NETNATM_MSG_UNI_HDR_H_ 32#define _NETNATM_MSG_UNI_HDR_H_ 33 34#include <sys/types.h> 35#ifdef _KERNEL 36#include <sys/stdint.h> 37#else 38#include <stdint.h> 39#endif 40 41#include <netnatm/msg/uni_config.h> 42 43enum { 44 UNI_PROTO = 0x09, /* protocol discriminator */ 45 PNNI_PROTO = 0xf0, /* PNNI protocol discriminator */ 46}; 47 48/* 49 * Message types 50 */ 51enum uni_msgtype { 52 UNI_UNKNOWN = 0x100,/* unknown message */ 53 54 UNI_ALERTING = 0x01, /* alerting */ 55 UNI_CALL_PROC = 0x02, /* call proceeding */ 56 UNI_SETUP = 0x05, /* setup */ 57 UNI_CONNECT = 0x07, /* connect */ 58 UNI_CONNECT_ACK = 0x0f, /* connect ack */ 59 60 UNI_RESTART = 0x46, /* restart */ 61 UNI_RELEASE = 0x4d, /* release */ 62 UNI_RESTART_ACK = 0x4e, /* restart acknowledgement */ 63 UNI_RELEASE_COMPL = 0x5a, /* release complete */ 64 65 UNI_NOTIFY = 0x6e, /* notify user */ 66 UNI_STATUS_ENQ = 0x75, /* status enquiry */ 67 UNI_STATUS = 0x7d, /* status */ 68 69 UNI_ADD_PARTY = 0x80, /* add party */ 70 UNI_ADD_PARTY_ACK = 0x81, /* add party acknowledgement */ 71 UNI_ADD_PARTY_REJ = 0x82, /* add party reject */ 72 UNI_DROP_PARTY = 0x83, /* drop party */ 73 UNI_DROP_PARTY_ACK = 0x84, /* drop party acknowledgement */ 74 UNI_PARTY_ALERTING = 0x85, /* party alerting */ 75 76 UNI_LEAF_SETUP_FAIL = 0x90, /* leaf setup failed */ 77 UNI_LEAF_SETUP_REQ = 0x91, /* leaf setup request */ 78 79 UNI_COBISETUP = 0x15, /* Q.2932 COBI-setup */ 80 UNI_FACILITY = 0x62, /* Q.2932 facility */ 81 82 UNI_MODIFY_REQ = 0x88, /* Q.2963 Modify request */ 83 UNI_MODIFY_ACK = 0x89, /* Q.2963 Modify acknowledgement */ 84 UNI_MODIFY_REJ = 0x8a, /* Q.2963 Modify reject */ 85 UNI_CONN_AVAIL = 0x8b, /* Q.2963 Connection available */ 86}; 87 88/* 89 * Information element types 90 */ 91enum uni_ietype { 92 UNI_IE_CAUSE = 0x08, /* cause */ 93 UNI_IE_CALLSTATE = 0x14, /* call state */ 94 UNI_IE_FACILITY = 0x1C, /* Q.2932 facility IE */ 95 UNI_IE_NOTIFY = 0x27, /* UNI4.0 notify */ 96 UNI_IE_EETD = 0x42, /* UNI4.0 end-to-end transit delay */ 97 UNI_IE_CONNED = 0x4c, /* UNI4.0/Q.2951 connected address */ 98 UNI_IE_CONNEDSUB = 0x4d, /* UNI4.0/Q.2951 connected subaddress */ 99 UNI_IE_EPREF = 0x54, /* endpoint reference */ 100 UNI_IE_EPSTATE = 0x55, /* enpoint state */ 101 UNI_IE_AAL = 0x58, /* ATM adaptation layer parameters */ 102 UNI_IE_TRAFFIC = 0x59, /* ATM traffic descriptor */ 103 UNI_IE_CONNID = 0x5a, /* connection identifier */ 104 UNI_IE_QOS = 0x5c, /* quality of service parameter */ 105 UNI_IE_BHLI = 0x5d, /* broadband higher layer information */ 106 UNI_IE_BEARER = 0x5e, /* broadband bearer capability */ 107 UNI_IE_BLLI = 0x5f, /* broadband lower layer information */ 108 UNI_IE_LSHIFT = 0x60, /* broadband locking shift */ 109 UNI_IE_NLSHIFT = 0x61, /* broadband non-locking shift */ 110 UNI_IE_SCOMPL = 0x62, /* broadband sending complete */ 111 UNI_IE_REPEAT = 0x63, /* broadband repeat indicator */ 112 UNI_IE_CALLING = 0x6c, /* calling party number */ 113 UNI_IE_CALLINGSUB = 0x6d, /* calling party subaddress */ 114 UNI_IE_CALLED = 0x70, /* called party number */ 115 UNI_IE_CALLEDSUB = 0x71, /* called party subaddress */ 116 UNI_IE_TNS = 0x78, /* transit network selection */ 117 UNI_IE_RESTART = 0x79, /* restart indicator */ 118 UNI_IE_UU = 0x7e, /* UNI4.0/Q.2957 user-to-user info */ 119 UNI_IE_GIT = 0x7f, /* UNI4.0 generic identifier transport*/ 120 UNI_IE_MINTRAFFIC = 0x81, /* Q.2962 minimum traffic desc */ 121 UNI_IE_ATRAFFIC = 0x82, /* Q.2962 alternate traffic desc */ 122 UNI_IE_ABRSETUP = 0x84, /* UNI4.0 ABR setup parameters */ 123 UNI_IE_REPORT = 0x89, /* Q.2963 broadband report type */ 124 UNI_IE_CALLED_SOFT = 0xe0, /* PNNI Calling party soft PVPC */ 125 UNI_IE_CRANKBACK = 0xe1, /* PNNI Crankback */ 126 UNI_IE_DTL = 0xe2, /* PNNI designated transit list */ 127 UNI_IE_CALLING_SOFT = 0xe3, /* PNNI Called party soft PVPC */ 128 UNI_IE_ABRADD = 0xe4, /* UNI4.0 ABR additional parameters */ 129 UNI_IE_LIJ_CALLID = 0xe8, /* UNI4.0 LIF call identifier */ 130 UNI_IE_LIJ_PARAM = 0xe9, /* UNI4.0 LIF parameters */ 131 UNI_IE_LIJ_SEQNO = 0xea, /* UNI4.0 LIF sequence number */ 132 UNI_IE_CSCOPE = 0xeb, /* UNI4.0 connection scope selection */ 133 UNI_IE_EXQOS = 0xec, /* UNI4.0 extended QoS parameters */ 134 UNI_IE_MDCR = 0xf0, /* UNI4.0+ Minimum desired call rate */ 135 UNI_IE_UNREC = 0xfe, 136}; 137 138enum uni_coding { 139 UNI_CODING_ITU = 0x0, 140 UNI_CODING_NET = 0x3, 141}; 142 143enum uni_msgact { 144 UNI_MSGACT_CLEAR = 0x0, 145 UNI_MSGACT_IGNORE = 0x1, 146 UNI_MSGACT_REPORT = 0x2, 147 148 UNI_MSGACT_DEFAULT = 0x4 149}; 150 151enum uni_ieact { 152 UNI_IEACT_CLEAR = 0x00, /* clear call */ 153 UNI_IEACT_IGNORE = 0x01, /* ignore IE and proceed */ 154 UNI_IEACT_REPORT = 0x02, /* ignore IE, report and proceed */ 155 UNI_IEACT_MSG_IGNORE = 0x05, /* ignore message */ 156 UNI_IEACT_MSG_REPORT = 0x06, /* ignore message and report */ 157 158 UNI_IEACT_DEFAULT = 0x08 159}; 160 161struct uni_cref { 162 u_int flag; 163 u_int cref; 164}; 165 166/* 167 * Message header. 168 */ 169struct uni_msghdr { 170 struct uni_cref cref; 171 enum uni_msgact act; /* action indicator */ 172 u_int pass:1; /* PNNI pass along request */ 173}; 174 175enum { 176 CREF_GLOBAL = 0, 177 CREF_DUMMY = 0x7fffff, 178}; 179 180/* 181 * General information element header. 182 */ 183struct uni_iehdr { 184 enum uni_coding coding; /* coding standard */ 185 enum uni_ieact act; /* action indicator */ 186 u_int pass : 1; /* PNNI pass along request */ 187 u_int present; /* which optional elements are present */ 188#define UNI_IE_EMPTY 0x80000000 189#define UNI_IE_PRESENT 0x40000000 190#define UNI_IE_ERROR 0x20000000 191#define UNI_IE_XXX 0x10000000 192#define UNI_IE_MASK 0xf0000000 193}; 194 195#define IE_ISPRESENT(IE) \ 196 (((IE).h.present & (UNI_IE_PRESENT|UNI_IE_EMPTY)) == UNI_IE_PRESENT) 197#define IE_SETPRESENT(IE) \ 198 ((IE).h.present = ((IE).h.present & ~UNI_IE_MASK) | \ 199 UNI_IE_PRESENT) 200 201#define IE_ADDPRESENT(IE) \ 202 ((IE).h.present = ((IE).h.present & ~UNI_IE_EMPTY) | \ 203 UNI_IE_PRESENT) 204 205#define IE_ISEMPTY(IE) \ 206 (((IE).h.present & UNI_IE_MASK) == (UNI_IE_PRESENT | UNI_IE_EMPTY)) 207#define IE_SETEMPTY(IE) \ 208 ((IE).h.present = ((IE).h.present & ~UNI_IE_MASK) | \ 209 UNI_IE_EMPTY | UNI_IE_PRESENT) 210 211#define IE_ISERROR(IE) \ 212 (((IE).h.present & UNI_IE_MASK) == (UNI_IE_PRESENT | UNI_IE_ERROR)) 213#define IE_SETERROR(IE) \ 214 ((IE).h.present = ((IE).h.present & ~UNI_IE_MASK) | \ 215 UNI_IE_ERROR | UNI_IE_PRESENT) 216 217#define IE_ISGOOD(IE) \ 218 (((IE).h.present & UNI_IE_MASK) == (UNI_IE_PRESENT)) 219 220#endif 221