2 * Copyright (c) 2001-2003
3 * Fraunhofer Institute for Open Communication Systems (FhG Fokus).
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
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.
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
27 * Author: Hartmut Brandt <harti@freebsd.org>
29 * $Begemot: libunimsg/netnatm/sig/unimkmsg.h,v 1.4 2003/09/19 12:03:34 hbb Exp $
31 * Macros to make messages.
34 #define MK_MSG_ORIG(MSG,TYPE,CREF,FLAG) \
36 (MSG)->mtype = (TYPE); \
37 (MSG)->u.hdr.cref.cref = (CREF); \
38 (MSG)->u.hdr.cref.flag = (FLAG); \
39 (MSG)->u.hdr.act = UNI_MSGACT_DEFAULT; \
42 #define MK_MSG_RESP(MSG,TYPE,CREF) \
44 (MSG)->mtype = (TYPE); \
45 (MSG)->u.hdr.cref.cref = (CREF)->cref; \
46 (MSG)->u.hdr.cref.flag = !(CREF)->flag; \
47 (MSG)->u.hdr.act = UNI_MSGACT_DEFAULT; \
50 #define MK_IE_CALLSTATE(IE,CS) \
54 (IE).h.coding = UNI_CODING_ITU; \
55 (IE).h.act = UNI_IEACT_DEFAULT; \
59 #define MK_IE_EPREF(IE,EPREF,FLAG) \
63 (IE).h.coding = UNI_CODING_ITU; \
64 (IE).h.act = UNI_IEACT_DEFAULT; \
69 #define MK_IE_EPSTATE(IE,STATE) \
73 (IE).h.coding = UNI_CODING_ITU; \
74 (IE).h.act = UNI_IEACT_DEFAULT; \
78 #define MK_IE_CAUSE(IE,LOC,CAUSE) \
82 (IE).h.coding = UNI_CODING_ITU; \
83 (IE).h.act = UNI_IEACT_DEFAULT; \
88 #define ADD_CAUSE_MTYPE(IE,MTYPE) \
90 (IE).h.present |= UNI_CAUSE_MTYPE_P; \
91 (IE).u.mtype = MTYPE; \
94 #define ADD_CAUSE_CHANNID(IE,VPI,VCI) \
96 (IE).h.present |= UNI_CAUSE_VPCI_P; \
97 (IE).u.vpci.vpci = VPI; \
98 (IE).u.vpci.vci = VCI; \
101 #define ADD_CAUSE_TIMER(IE,TIMER) \
103 (IE).h.present |= UNI_CAUSE_TIMER_P; \
104 (IE).u.timer[0] = (TIMER)[0]; \
105 (IE).u.timer[1] = (TIMER)[1]; \
106 (IE).u.timer[2] = (TIMER)[2]; \
109 /************************************************************/
111 #define COPY_FROM_RELEASE_COMPL(U,DEST) \
115 for(_i = _j = 0; _i < 2; _i++) \
116 if(IE_ISGOOD((U)->u.release_compl.cause[_i])) \
117 (DEST)->cause[_j++] = \
118 (U)->u.release_compl.cause[_i]; \
119 for(_i = _j = 0; _i < UNI_NUM_IE_GIT; _i++) \
120 if(IE_ISGOOD((U)->u.release_compl.git[_i])) \
121 (DEST)->git[_j++] = \
122 (U)->u.release_compl.git[_i]; \
123 if(IE_ISGOOD((U)->u.release_compl.uu)) \
124 (DEST)->uu = (U)->u.release_compl.uu; \
125 if(IE_ISGOOD((U)->u.release_compl.crankback)) \
126 (DEST)->crankback = (U)->u.release_compl.crankback; \
129 #define COPY_FROM_DROP_ACK(U,DEST) \
133 if(IE_ISGOOD((U)->u.drop_party_ack.epref)) \
134 (DEST)->epref = (U)->u.drop_party_ack.epref; \
135 if(IE_ISGOOD((U)->u.drop_party_ack.cause)) \
136 (DEST)->cause = (U)->u.drop_party_ack.cause; \
137 if(IE_ISGOOD((U)->u.drop_party_ack.uu)) \
138 (DEST)->uu = (U)->u.drop_party_ack.uu; \
139 for(_i = _j = 0; _i < UNI_NUM_IE_GIT; _i++) \
140 if(IE_ISGOOD((U)->u.drop_party_ack.git[_i])) \
141 (DEST)->git[_j++] = \
142 (U)->u.drop_party_ack.git[_i]; \
145 #define COPY_FROM_ADD_REJ(U,DEST) \
149 if(IE_ISGOOD((U)->u.add_party_rej.epref)) \
150 (DEST)->epref = (U)->u.add_party_rej.epref; \
151 if(IE_ISGOOD((U)->u.add_party_rej.cause)) \
152 (DEST)->cause = (U)->u.add_party_rej.cause; \
153 if(IE_ISGOOD((U)->u.add_party_rej.uu)) \
154 (DEST)->uu = (U)->u.add_party_rej.uu; \
155 for(_i = _j = 0; _i < UNI_NUM_IE_GIT; _i++) \
156 if(IE_ISGOOD((U)->u.add_party_rej.git[_i])) \
157 (DEST)->git[_j++] = \
158 (U)->u.add_party_rej.git[_i]; \