Don't do fcn calls in arg of g_?to??(); Macro may very well eval args multiple times.
[obnox/wireshark/wip.git] / epan / dissectors / packet-isup.c
1 /* packet-isup.c
2  * Routines for ISUP dissection
3  * Copyright 2001, Martina Obermeier <martina.obermeier@icn.siemens.de>
4  *
5  * Copyright 2004-2005, Anders Broman <anders.broman@ericsson.com>
6  * Modified 2003-09-10 by Anders Broman
7  *          <anders.broman@ericsson.com>
8  * Inserted routines for BICC dissection according to Q.765.5 Q.1902 Q.1970 Q.1990,
9  * calling SDP dissector for RFC2327 decoding.
10  * Modified 2004-01-10 by Anders Broman to add abillity to dissect
11  * Content type application/ISUP RFC 3204 used in SIP-T
12  *
13  * $Id$
14  *
15  * Wireshark - Network traffic analyzer
16  * By Gerald Combs <gerald@wireshark.org>
17  * Copyright 1998 Gerald Combs
18  *
19  * Copied from README.developer
20  *
21  * This program is free software; you can redistribute it and/or
22  * modify it under the terms of the GNU General Public License
23  * as published by the Free Software Foundation; either version 2
24  * of the License, or (at your option) any later version.
25  *
26  * This program is distributed in the hope that it will be useful,
27  * but WITHOUT ANY WARRANTY; without even the implied warranty of
28  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
29  * GNU General Public License for more details.
30  *
31  * You should have received a copy of the GNU General Public License
32  * along with this program; if not, write to the Free Software
33  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
34  * References:
35  * ISUP:
36  * http://www.itu.int/rec/recommendation.asp?type=products&lang=e&parent=T-REC-Q
37  * Q.763-199912, Q.763-200212Amd2
38  * ITU-T Q.763/Amd.1 (03/2001)
39  */
40
41 #ifdef HAVE_CONFIG_H
42 # include "config.h"
43 #endif
44
45 #include <epan/packet.h>
46 #include <epan/stats_tree.h>
47 #include <epan/asn1.h>
48 #include <prefs.h>
49 #include "packet-q931.h"
50 #include "packet-isup.h"
51 #include "packet-e164.h"
52 #include "packet-charging_ase.h"
53 #include <epan/sctpppids.h>
54 #include <epan/emem.h>
55 #include <epan/circuit.h>
56 #include <epan/reassemble.h>
57 #include <packet-mtp3.h>
58
59 static gint isup_standard = ITU_STANDARD;
60
61 #define MTP3_ISUP_SERVICE_INDICATOR     5
62 #define MTP3_BICC_SERVICE_INDICATOR     13
63 #define ASCII_NUMBER_DELTA              0x30
64 #define ASCII_LETTER_DELTA              0x37
65
66 /* Definition of protocol field values und lengths */
67
68 /* Definition of Message Types */
69 #define MESSAGE_TYPE_INITIAL_ADDR        1
70 #define MESSAGE_TYPE_SUBSEQ_ADDR         2
71 #define MESSAGE_TYPE_INFO_REQ            3
72 #define MESSAGE_TYPE_INFO                4
73 #define MESSAGE_TYPE_CONTINUITY          5
74 #define MESSAGE_TYPE_ADDR_CMPL           6
75 #define MESSAGE_TYPE_CONNECT             7
76 #define MESSAGE_TYPE_FORW_TRANS          8
77 #define MESSAGE_TYPE_ANSWER              9
78 #define MESSAGE_TYPE_RELEASE            12
79 #define MESSAGE_TYPE_SUSPEND            13
80 #define MESSAGE_TYPE_RESUME             14
81 #define MESSAGE_TYPE_REL_CMPL           16
82 #define MESSAGE_TYPE_CONT_CHECK_REQ     17
83 #define MESSAGE_TYPE_RESET_CIRCUIT      18
84 #define MESSAGE_TYPE_BLOCKING           19
85 #define MESSAGE_TYPE_UNBLOCKING         20
86 #define MESSAGE_TYPE_BLOCK_ACK          21
87 #define MESSAGE_TYPE_UNBLOCK_ACK        22
88 #define MESSAGE_TYPE_CIRC_GRP_RST       23
89 #define MESSAGE_TYPE_CIRC_GRP_BLCK      24
90 #define MESSAGE_TYPE_CIRC_GRP_UNBL      25
91 #define MESSAGE_TYPE_CIRC_GRP_BL_ACK    26
92 #define MESSAGE_TYPE_CIRC_GRP_UNBL_ACK  27
93 #define MESSAGE_TYPE_FACILITY_REQ       31
94 #define MESSAGE_TYPE_FACILITY_ACC       32
95 #define MESSAGE_TYPE_FACILITY_REJ       33
96 #define MESSAGE_TYPE_LOOP_BACK_ACK      36
97 #define MESSAGE_TYPE_PASS_ALONG         40
98 #define MESSAGE_TYPE_CIRC_GRP_RST_ACK   41
99 #define MESSAGE_TYPE_CIRC_GRP_QRY       42
100 #define MESSAGE_TYPE_CIRC_GRP_QRY_RSP   43
101 #define MESSAGE_TYPE_CALL_PROGRSS       44
102 #define MESSAGE_TYPE_USER2USER_INFO     45
103 #define MESSAGE_TYPE_UNEQUIPPED_CIC     46
104 #define MESSAGE_TYPE_CONFUSION          47
105 #define MESSAGE_TYPE_OVERLOAD           48
106 #define MESSAGE_TYPE_CHARGE_INFO        49
107 #define MESSAGE_TYPE_NETW_RESRC_MGMT    50
108 #define MESSAGE_TYPE_FACILITY           51
109 #define MESSAGE_TYPE_USER_PART_TEST     52
110 #define MESSAGE_TYPE_USER_PART_AVAIL    53
111 #define MESSAGE_TYPE_IDENT_REQ          54
112 #define MESSAGE_TYPE_IDENT_RSP          55
113 #define MESSAGE_TYPE_SEGMENTATION       56
114 #define MESSAGE_TYPE_LOOP_PREVENTION    64
115 #define MESSAGE_TYPE_APPLICATION_TRANS  65
116 #define MESSAGE_TYPE_PRE_RELEASE_INFO   66
117 #define MESSAGE_TYPE_SUBSEQUENT_DIR_NUM 67
118
119 #define ANSI_ISUP_MESSAGE_TYPE_CIRCUIT_RES_ACK  0xE9
120 #define ANSI_ISUP_MESSAGE_TYPE_CIRCUIT_RES      0xEA
121 #define ANSI_ISUP_MESSAGE_TYPE_CCT_VAL_TEST_RSP 0xEB
122 #define ANSI_ISUP_MESSAGE_TYPE_CCT_VAL_TEST     0xEC
123 #define ANSI_ISUP_MESSAGE_TYPE_EXIT             0xED
124
125 static const value_string isup_message_type_value[] = {
126   { MESSAGE_TYPE_INITIAL_ADDR,                "Initial address"},
127   { MESSAGE_TYPE_SUBSEQ_ADDR,                 "Subsequent address"},
128   { MESSAGE_TYPE_INFO_REQ,                    "Information request (national use)"},
129   { MESSAGE_TYPE_INFO,                        "Information (national use)"},
130   { MESSAGE_TYPE_CONTINUITY,                  "Continuity"},
131   { MESSAGE_TYPE_ADDR_CMPL,                   "Address complete"},
132   { MESSAGE_TYPE_CONNECT,                     "Connect"},
133   { MESSAGE_TYPE_FORW_TRANS,                  "Forward transfer"},
134   { MESSAGE_TYPE_ANSWER,                      "Answer"},
135
136   { 0x0a,                                     "Reserved (used in 1984 version)"},
137   { 0x0b,                                     "Reserved (used in 1984 version)"},
138
139   { MESSAGE_TYPE_RELEASE,                     "Release"},
140   { MESSAGE_TYPE_SUSPEND,                     "Suspend"},
141   { MESSAGE_TYPE_RESUME,                      "Resume"},
142   { MESSAGE_TYPE_REL_CMPL,                    "Release complete"},
143   { MESSAGE_TYPE_CONT_CHECK_REQ,              "Continuity check request"},
144   { MESSAGE_TYPE_RESET_CIRCUIT,               "Reset Circuit"},
145   { MESSAGE_TYPE_BLOCKING,                    "Blocking"},
146   { MESSAGE_TYPE_UNBLOCKING,                  "Unblocking"},
147   { MESSAGE_TYPE_BLOCK_ACK,                   "Blocking acknowledgement"},
148   { MESSAGE_TYPE_UNBLOCK_ACK,                 "Unblocking acknowledgment"},
149   { MESSAGE_TYPE_CIRC_GRP_RST,                "Circuit group reset"},
150   { MESSAGE_TYPE_CIRC_GRP_BLCK,               "Circuit group blocking"},
151   { MESSAGE_TYPE_CIRC_GRP_UNBL,               "Circuit group unblocking"},
152   { MESSAGE_TYPE_CIRC_GRP_BL_ACK,             "Circuit group blocking acknowledgement"},
153   { MESSAGE_TYPE_CIRC_GRP_UNBL_ACK,           "Circuit group unblocking acknowledgement"},
154
155   { 28,                                      "Reserved (used in 1988 version)"},
156   { 29,                                      "Reserved (used in 1988 version)"},
157   { 30,                                      "Reserved (used in 1988 version)"},
158
159   { MESSAGE_TYPE_FACILITY_REQ,                "Facility request"},
160   { MESSAGE_TYPE_FACILITY_ACC,                "Facility accepted"},
161   { MESSAGE_TYPE_FACILITY_REJ,                "Facility reject"},
162
163   { 34,                                      "Reserved (used in 1984 version)"},
164   { 35,                                      "Reserved (used in 1984 version)"},
165
166   { MESSAGE_TYPE_LOOP_BACK_ACK,               "Loop back acknowledgement (national use)"},
167
168   { 37,                                      "Reserved (used in 1984 version)"},
169   { 38,                                      "Reserved (used in 1984 version)"},
170   { 39,                                      "Reserved (used in 1984 version)"},
171
172   { MESSAGE_TYPE_PASS_ALONG,                  "Pass-along (national use)"},
173   { MESSAGE_TYPE_CIRC_GRP_RST_ACK,            "Circuit group reset acknowledgement"},
174   { MESSAGE_TYPE_CIRC_GRP_QRY,                "Circuit group query (national use)"},
175   { MESSAGE_TYPE_CIRC_GRP_QRY_RSP,            "Circuit group query response (national use)"},
176   { MESSAGE_TYPE_CALL_PROGRSS,                "Call progress"},
177   { MESSAGE_TYPE_USER2USER_INFO,              "User-to-user information"},
178   { MESSAGE_TYPE_UNEQUIPPED_CIC,              "Unequipped CIC (national use)"},
179   { MESSAGE_TYPE_CONFUSION,                   "Confusion"},
180   { MESSAGE_TYPE_OVERLOAD,                    "Overload (national use)"},
181   { MESSAGE_TYPE_CHARGE_INFO,                 "Charge information (national use)"},
182   { MESSAGE_TYPE_NETW_RESRC_MGMT,             "Network resource management"},
183   { MESSAGE_TYPE_FACILITY,                    "Facility"},
184   { MESSAGE_TYPE_USER_PART_TEST,              "User part test"},
185   { MESSAGE_TYPE_USER_PART_AVAIL,             "User part available"},
186   { MESSAGE_TYPE_IDENT_REQ,                   "Identification request"},
187   { MESSAGE_TYPE_IDENT_RSP,                   "Identification response"},
188   { MESSAGE_TYPE_SEGMENTATION,                "Segmentation"},
189
190   { 57,                                       "Reserved (used in B-ISUP)"},
191   { 58,                                       "Reserved (used in B-ISUP)"},
192   { 59,                                       "Reserved (used in B-ISUP)"},
193   { 60,                                       "Reserved (used in B-ISUP)"},
194   { 61,                                       "Reserved (used in B-ISUP)"},
195
196   { 63,                                       "Unknown"},
197   { 63,                                       "Unknown"},
198
199   { MESSAGE_TYPE_LOOP_PREVENTION,             "Loop prevention"},
200   { MESSAGE_TYPE_APPLICATION_TRANS,           "Application transport"},
201   { MESSAGE_TYPE_PRE_RELEASE_INFO,            "Pre-release information"},
202   { MESSAGE_TYPE_SUBSEQUENT_DIR_NUM,          "Subsequent Directory Number (national use)"},
203   { 0,                                  NULL}};
204 static value_string_ext isup_message_type_value_ext = VALUE_STRING_EXT_INIT(isup_message_type_value);
205
206 static const value_string ansi_isup_message_type_value[] = {
207   { MESSAGE_TYPE_INITIAL_ADDR,                "Initial address"},
208   { MESSAGE_TYPE_SUBSEQ_ADDR,                 "Subsequent address"},
209   { MESSAGE_TYPE_INFO_REQ,                    "Information request (national use)"},
210   { MESSAGE_TYPE_INFO,                        "Information (national use)"},
211   { MESSAGE_TYPE_CONTINUITY,                  "Continuity"},
212   { MESSAGE_TYPE_ADDR_CMPL,                   "Address complete"},
213   { MESSAGE_TYPE_CONNECT,                     "Connect"},
214   { MESSAGE_TYPE_FORW_TRANS,                  "Forward transfer"},
215   { MESSAGE_TYPE_ANSWER,                      "Answer"},
216   { MESSAGE_TYPE_RELEASE,                     "Release"},
217   { MESSAGE_TYPE_SUSPEND,                     "Suspend"},
218   { MESSAGE_TYPE_RESUME,                      "Resume"},
219   { MESSAGE_TYPE_REL_CMPL,                    "Release complete"},
220   { MESSAGE_TYPE_CONT_CHECK_REQ,              "Continuity check request"},
221   { MESSAGE_TYPE_RESET_CIRCUIT,               "Reset Circuit"},
222   { MESSAGE_TYPE_BLOCKING,                    "Blocking"},
223   { MESSAGE_TYPE_UNBLOCKING,                  "Unblocking"},
224   { MESSAGE_TYPE_BLOCK_ACK,                   "Blocking acknowledgement"},
225   { MESSAGE_TYPE_UNBLOCK_ACK,                 "Unblocking acknowledgment"},
226   { MESSAGE_TYPE_CIRC_GRP_RST,                "Circuit group reset"},
227   { MESSAGE_TYPE_CIRC_GRP_BLCK,               "Circuit group blocking"},
228   { MESSAGE_TYPE_CIRC_GRP_UNBL,               "Circuit group unblocking"},
229   { MESSAGE_TYPE_CIRC_GRP_BL_ACK,             "Circuit group blocking acknowledgement"},
230   { MESSAGE_TYPE_CIRC_GRP_UNBL_ACK,           "Circuit group unblocking acknowledgement"},
231   { MESSAGE_TYPE_FACILITY_REQ,                "Facility request"},
232   { MESSAGE_TYPE_FACILITY_ACC,                "Facility accepted"},
233   { MESSAGE_TYPE_FACILITY_REJ,                "Facility reject"},
234   { MESSAGE_TYPE_LOOP_BACK_ACK,               "Loop back acknowledgement (national use)"},
235   { MESSAGE_TYPE_PASS_ALONG,                  "Pass-along (national use)"},
236   { MESSAGE_TYPE_CIRC_GRP_RST_ACK,            "Circuit group reset acknowledgement"},
237   { MESSAGE_TYPE_CIRC_GRP_QRY,                "Circuit group query (national use)"},
238   { MESSAGE_TYPE_CIRC_GRP_QRY_RSP,            "Circuit group query response (national use)"},
239   { MESSAGE_TYPE_CALL_PROGRSS,                "Call progress"},
240   { MESSAGE_TYPE_USER2USER_INFO,              "User-to-user information"},
241   { MESSAGE_TYPE_UNEQUIPPED_CIC,              "Unequipped CIC (national use)"},
242   { MESSAGE_TYPE_CONFUSION,                   "Confusion"},
243   { MESSAGE_TYPE_OVERLOAD,                    "Overload (national use)"},
244   { MESSAGE_TYPE_CHARGE_INFO,                 "Charge information (national use)"},
245   { MESSAGE_TYPE_NETW_RESRC_MGMT,             "Network resource management"},
246   { MESSAGE_TYPE_FACILITY,                    "Facility"},
247   { MESSAGE_TYPE_USER_PART_TEST,              "User part test"},
248   { MESSAGE_TYPE_USER_PART_AVAIL,             "User part available"},
249   { MESSAGE_TYPE_IDENT_REQ,                   "Identification request"},
250   { MESSAGE_TYPE_IDENT_RSP,                   "Identification response"},
251   { MESSAGE_TYPE_SEGMENTATION,                "Segmentation"},
252   { MESSAGE_TYPE_LOOP_PREVENTION,             "Loop prevention"},
253   { MESSAGE_TYPE_APPLICATION_TRANS,           "Application transport"},
254   { MESSAGE_TYPE_PRE_RELEASE_INFO,            "Pre-release information"},
255   { MESSAGE_TYPE_SUBSEQUENT_DIR_NUM,          "Subsequent Directory Number (national use)"},
256   { ANSI_ISUP_MESSAGE_TYPE_CIRCUIT_RES_ACK,   "Circuit Reservation Acknowledge"},
257   { ANSI_ISUP_MESSAGE_TYPE_CIRCUIT_RES,       "Circuit Reservation"},
258   { ANSI_ISUP_MESSAGE_TYPE_CCT_VAL_TEST_RSP,  "Circuit Validation Test Response"},
259   { ANSI_ISUP_MESSAGE_TYPE_CCT_VAL_TEST,      "Circuit Validation Test"},
260   { ANSI_ISUP_MESSAGE_TYPE_EXIT,              "Exit"},
261   { 0,                                  NULL}};
262 static value_string_ext ansi_isup_message_type_value_ext = VALUE_STRING_EXT_INIT(ansi_isup_message_type_value);
263
264 /* Same as above but in acronym form (for the Info column) */
265 static const value_string isup_message_type_value_acro[] = {
266   { MESSAGE_TYPE_INITIAL_ADDR,                "IAM"},
267   { MESSAGE_TYPE_SUBSEQ_ADDR,                 "SAM"},
268   { MESSAGE_TYPE_INFO_REQ,                    "INR"},
269   { MESSAGE_TYPE_INFO,                        "INF"},
270   { MESSAGE_TYPE_CONTINUITY,                  "COT"},
271   { MESSAGE_TYPE_ADDR_CMPL,                   "ACM"},
272   { MESSAGE_TYPE_CONNECT,                     "CON"},
273   { MESSAGE_TYPE_FORW_TRANS,                  "FOT"},
274   { MESSAGE_TYPE_ANSWER,                      "ANM"},
275
276   { 0x0a,                                     "Reserved"},
277   { 0x0b,                                     "Reserved"},
278
279   { MESSAGE_TYPE_RELEASE,                     "REL"},
280   { MESSAGE_TYPE_SUSPEND,                     "SUS"},
281   { MESSAGE_TYPE_RESUME,                      "RES"},
282   { MESSAGE_TYPE_REL_CMPL,                    "RLC"},
283   { MESSAGE_TYPE_CONT_CHECK_REQ,              "CCR"},
284   { MESSAGE_TYPE_RESET_CIRCUIT,               "RSC"},
285   { MESSAGE_TYPE_BLOCKING,                    "BLO"},
286   { MESSAGE_TYPE_UNBLOCKING,                  "UBL"},
287   { MESSAGE_TYPE_BLOCK_ACK,                   "BLA"},
288   { MESSAGE_TYPE_UNBLOCK_ACK,                 "UBLA"},
289   { MESSAGE_TYPE_CIRC_GRP_RST,                "GRS"},
290   { MESSAGE_TYPE_CIRC_GRP_BLCK,               "CGB"},
291   { MESSAGE_TYPE_CIRC_GRP_UNBL,               "CGU"},
292   { MESSAGE_TYPE_CIRC_GRP_BL_ACK,             "CGBA"},
293   { MESSAGE_TYPE_CIRC_GRP_UNBL_ACK,           "CGUA"},
294
295   { 28,                                      "Reserved"},
296   { 29,                                      "Reserved"},
297   { 30,                                      "Reserved"},
298
299   { MESSAGE_TYPE_FACILITY_REQ,                "FAR"},
300   { MESSAGE_TYPE_FACILITY_ACC,                "FAA"},
301   { MESSAGE_TYPE_FACILITY_REJ,                "FRJ"},
302
303   { 34,                                      "Reserved"},
304   { 35,                                      "Reserved"},
305
306   { MESSAGE_TYPE_LOOP_BACK_ACK,               "LPA"},
307
308   { 37,                                      "Reserved"},
309   { 38,                                      "Reserved"},
310   { 39,                                      "Reserved"},
311
312   { MESSAGE_TYPE_PASS_ALONG,                  "PAM"},
313   { MESSAGE_TYPE_CIRC_GRP_RST_ACK,            "GRA"},
314   { MESSAGE_TYPE_CIRC_GRP_QRY,                "CQM"},
315   { MESSAGE_TYPE_CIRC_GRP_QRY_RSP,            "CQR"},
316   { MESSAGE_TYPE_CALL_PROGRSS,                "CPG"},
317   { MESSAGE_TYPE_USER2USER_INFO,              "UUI"},
318   { MESSAGE_TYPE_UNEQUIPPED_CIC,              "UCIC"},
319   { MESSAGE_TYPE_CONFUSION,                   "CFN"},
320   { MESSAGE_TYPE_OVERLOAD,                    "OLM"},
321   { MESSAGE_TYPE_CHARGE_INFO,                 "CRG"},
322   { MESSAGE_TYPE_NETW_RESRC_MGMT,             "NRM"},
323   { MESSAGE_TYPE_FACILITY,                    "FAC"},
324   { MESSAGE_TYPE_USER_PART_TEST,              "UPT"},
325   { MESSAGE_TYPE_USER_PART_AVAIL,             "UPA"},
326   { MESSAGE_TYPE_IDENT_REQ,                   "IDR"},
327   { MESSAGE_TYPE_IDENT_RSP,                   "IDS"},
328   { MESSAGE_TYPE_SEGMENTATION,                "SGM"},
329
330   { 57,                                       "Reserved"},
331   { 58,                                       "Reserved"},
332   { 59,                                       "Reserved"},
333   { 60,                                       "Reserved"},
334   { 61,                                       "Reserved"},
335
336   { 63,                                       "Unknown"},
337   { 63,                                       "Unknown"},
338
339   { MESSAGE_TYPE_LOOP_PREVENTION,             "LOP"},
340   { MESSAGE_TYPE_APPLICATION_TRANS,           "APM"},
341   { MESSAGE_TYPE_PRE_RELEASE_INFO,            "PRI"},
342   { MESSAGE_TYPE_SUBSEQUENT_DIR_NUM,          "SDN"},
343   { 0,                                  NULL}};
344 value_string_ext isup_message_type_value_acro_ext = VALUE_STRING_EXT_INIT(isup_message_type_value_acro);
345
346   /* Same as above but in acronym form (for the Info column) */
347 static const value_string ansi_isup_message_type_value_acro[] = {
348   { MESSAGE_TYPE_INITIAL_ADDR,                "IAM"},
349   { MESSAGE_TYPE_SUBSEQ_ADDR,                 "SAM"},
350   { MESSAGE_TYPE_INFO_REQ,                    "INR"},
351   { MESSAGE_TYPE_INFO,                        "INF"},
352   { MESSAGE_TYPE_CONTINUITY,                  "COT"},
353   { MESSAGE_TYPE_ADDR_CMPL,                   "ACM"},
354   { MESSAGE_TYPE_CONNECT,                     "CON"},
355   { MESSAGE_TYPE_FORW_TRANS,                  "FOT"},
356   { MESSAGE_TYPE_ANSWER,                      "ANM"},
357   { MESSAGE_TYPE_RELEASE,                     "REL"},
358   { MESSAGE_TYPE_SUSPEND,                     "SUS"},
359   { MESSAGE_TYPE_RESUME,                      "RES"},
360   { MESSAGE_TYPE_REL_CMPL,                    "RLC"},
361   { MESSAGE_TYPE_CONT_CHECK_REQ,              "CCR"},
362   { MESSAGE_TYPE_RESET_CIRCUIT,               "RSC"},
363   { MESSAGE_TYPE_BLOCKING,                    "BLO"},
364   { MESSAGE_TYPE_UNBLOCKING,                  "UBL"},
365   { MESSAGE_TYPE_BLOCK_ACK,                   "BLA"},
366   { MESSAGE_TYPE_UNBLOCK_ACK,                 "UBLA"},
367   { MESSAGE_TYPE_CIRC_GRP_RST,                "GRS"},
368   { MESSAGE_TYPE_CIRC_GRP_BLCK,               "CGB"},
369   { MESSAGE_TYPE_CIRC_GRP_UNBL,               "CGU"},
370   { MESSAGE_TYPE_CIRC_GRP_BL_ACK,             "CGBA"},
371   { MESSAGE_TYPE_CIRC_GRP_UNBL_ACK,           "CGUA"},
372   { MESSAGE_TYPE_FACILITY_REQ,                "FAR"},
373   { MESSAGE_TYPE_FACILITY_ACC,                "FAA"},
374   { MESSAGE_TYPE_FACILITY_REJ,                "FRJ"},
375   { MESSAGE_TYPE_LOOP_BACK_ACK,               "LPA"},
376   { MESSAGE_TYPE_PASS_ALONG,                  "PAM"},
377   { MESSAGE_TYPE_CIRC_GRP_RST_ACK,            "GRA"},
378   { MESSAGE_TYPE_CIRC_GRP_QRY,                "CQM"},
379   { MESSAGE_TYPE_CIRC_GRP_QRY_RSP,            "CQR"},
380   { MESSAGE_TYPE_CALL_PROGRSS,                "CPG"},
381   { MESSAGE_TYPE_USER2USER_INFO,              "UUI"},
382   { MESSAGE_TYPE_UNEQUIPPED_CIC,              "UCIC"},
383   { MESSAGE_TYPE_CONFUSION,                   "CFN"},
384   { MESSAGE_TYPE_OVERLOAD,                    "OLM"},
385   { MESSAGE_TYPE_CHARGE_INFO,                 "CRG"},
386   { MESSAGE_TYPE_NETW_RESRC_MGMT,             "NRM"},
387   { MESSAGE_TYPE_FACILITY,                    "FAC"},
388   { MESSAGE_TYPE_USER_PART_TEST,              "UPT"},
389   { MESSAGE_TYPE_USER_PART_AVAIL,             "UPA"},
390   { MESSAGE_TYPE_IDENT_REQ,                   "IDR"},
391   { MESSAGE_TYPE_IDENT_RSP,                   "IDS"},
392   { MESSAGE_TYPE_SEGMENTATION,                "SGM"},
393   { MESSAGE_TYPE_LOOP_PREVENTION,             "LOP"},
394   { MESSAGE_TYPE_APPLICATION_TRANS,           "APM"},
395   { MESSAGE_TYPE_PRE_RELEASE_INFO,            "PRI"},
396   { MESSAGE_TYPE_SUBSEQUENT_DIR_NUM,          "SDN"},
397   { ANSI_ISUP_MESSAGE_TYPE_CIRCUIT_RES_ACK,   "CRA"},
398   { ANSI_ISUP_MESSAGE_TYPE_CIRCUIT_RES,       "CRM"},
399   { ANSI_ISUP_MESSAGE_TYPE_CCT_VAL_TEST_RSP,  "CVR"},
400   { ANSI_ISUP_MESSAGE_TYPE_CCT_VAL_TEST,      "CVT"},
401   { ANSI_ISUP_MESSAGE_TYPE_EXIT,              "EXIT"},
402   { 0,                                  NULL}};
403 static value_string_ext ansi_isup_message_type_value_acro_ext = VALUE_STRING_EXT_INIT(ansi_isup_message_type_value_acro);
404
405 const value_string isup_parameter_type_value[] = {
406   { PARAM_TYPE_END_OF_OPT_PARAMS,         "End of optional parameters"},
407   { PARAM_TYPE_CALL_REF,                  "Call Reference (national use)"},
408   { PARAM_TYPE_TRANSM_MEDIUM_REQU,        "Transmission medium requirement"},
409   { PARAM_TYPE_ACC_TRANSP,                "Access transport"},
410   { PARAM_TYPE_CALLED_PARTY_NR,           "Called party number"},
411   { PARAM_TYPE_SUBSQT_NR,                 "Subsequent number"},
412   { PARAM_TYPE_NATURE_OF_CONN_IND,        "Nature of connection indicators"},
413   { PARAM_TYPE_FORW_CALL_IND,             "Forward call indicators"},
414   { PARAM_TYPE_OPT_FORW_CALL_IND,         "Optional forward call indicators"},
415   { PARAM_TYPE_CALLING_PRTY_CATEG,        "Calling party's category"},
416   { PARAM_TYPE_CALLING_PARTY_NR,          "Calling party number"},
417   { PARAM_TYPE_REDIRECTING_NR,            "Redirecting number"},
418   { PARAM_TYPE_REDIRECTION_NR,            "Redirection number"},
419   { PARAM_TYPE_CONNECTION_REQ,            "Connection request"},
420   { PARAM_TYPE_INFO_REQ_IND,              "Information request indicators (national use)"},
421   { PARAM_TYPE_INFO_IND,                  "Information indicators (national use)"},
422   { PARAM_TYPE_CONTINUITY_IND,            "Continuity request"},
423   { PARAM_TYPE_BACKW_CALL_IND,            "Backward call indicators"},
424   { PARAM_TYPE_CAUSE_INDICATORS,          "Cause indicators"},
425   { PARAM_TYPE_REDIRECTION_INFO,          "Redirection information"},
426   { PARAM_TYPE_CIRC_GRP_SV_MSG_TYPE,      "Circuit group supervision message type"},
427   { PARAM_TYPE_RANGE_AND_STATUS,          "Range and Status"},
428   { PARAM_TYPE_FACILITY_IND,              "Facility indicator"},
429   { PARAM_TYPE_CLSD_USR_GRP_ILOCK_CD,     "Closed user group interlock code"},
430   { PARAM_TYPE_USER_SERVICE_INFO,         "User service information"},
431   { PARAM_TYPE_SIGNALLING_POINT_CODE,     "Signalling point code (national use)"},
432   { PARAM_TYPE_USER_TO_USER_INFO,         "User-to-user information"},
433   { PARAM_TYPE_CONNECTED_NR,              "Connected number"},
434   { PARAM_TYPE_SUSP_RESUME_IND,           "Suspend/Resume indicators"},
435   { PARAM_TYPE_TRANSIT_NETW_SELECT,       "Transit network selection (national use)"},
436   { PARAM_TYPE_EVENT_INFO,                "Event information"},
437   { PARAM_TYPE_CIRC_ASSIGN_MAP,           "Circuit assignment map"},
438   { PARAM_TYPE_CIRC_STATE_IND,            "Circuit state indicator (national use)"},
439   { PARAM_TYPE_AUTO_CONG_LEVEL,           "Automatic congestion level"},
440   { PARAM_TYPE_ORIG_CALLED_NR,            "Original called number"},
441   { PARAM_TYPE_OPT_BACKW_CALL_IND,        "Backward call indicators"},
442   { PARAM_TYPE_USER_TO_USER_IND,          "User-to-user indicators"},
443   { PARAM_TYPE_ORIG_ISC_POINT_CODE,       "Origination ISC point code"},
444   { PARAM_TYPE_GENERIC_NOTIF_IND,         "Generic notification indicator"},
445   { PARAM_TYPE_CALL_HIST_INFO,            "Call history information"},
446   { PARAM_TYPE_ACC_DELIV_INFO,            "Access delivery information"},
447   { PARAM_TYPE_NETW_SPECIFIC_FACLTY,      "Network specific facility (national use)"},
448   { PARAM_TYPE_USER_SERVICE_INFO_PR,      "User service information prime"},
449   { PARAM_TYPE_PROPAG_DELAY_COUNTER,      "Propagation delay counter"},
450   { PARAM_TYPE_REMOTE_OPERATIONS,         "Remote operations (national use)"},
451   { PARAM_TYPE_SERVICE_ACTIVATION,        "Service activation"},
452   { PARAM_TYPE_USER_TELESERV_INFO,        "User teleservice information"},
453   { PARAM_TYPE_TRANSM_MEDIUM_USED,        "Transmission medium used"},
454   { PARAM_TYPE_CALL_DIV_INFO,             "Call diversion information"},
455   { PARAM_TYPE_ECHO_CTRL_INFO,            "Echo control information"},
456   { PARAM_TYPE_MSG_COMPAT_INFO,           "Message compatibility information"},
457   { PARAM_TYPE_PARAM_COMPAT_INFO,         "Parameter compatibility information"},
458   { PARAM_TYPE_MLPP_PRECEDENCE,           "MLPP precedence"},
459   { PARAM_TYPE_MCID_REQ_IND,              "MCID request indicators"},
460   { PARAM_TYPE_MCID_RSP_IND,              "MCID response indicators"},
461   { PARAM_TYPE_HOP_COUNTER,               "Hop counter"},
462   { PARAM_TYPE_TRANSM_MEDIUM_RQUR_PR,     "Transmission medium requirement prime"},
463   { PARAM_TYPE_LOCATION_NR,               "Location number"},
464   { PARAM_TYPE_REDIR_NR_RSTRCT,           "Redirection number restriction"},
465   { PARAM_TYPE_CALL_TRANS_REF,            "Call transfer reference"},
466   { PARAM_TYPE_LOOP_PREV_IND,             "Loop prevention indicators"},
467   { PARAM_TYPE_CALL_TRANS_NR,             "Call transfer number"},
468   { PARAM_TYPE_CCSS,                      "CCSS"},
469   { PARAM_TYPE_FORW_GVNS,                 "Forward GVNS"},
470   { PARAM_TYPE_BACKW_GVNS,                "Backward GVNS"},
471   { PARAM_TYPE_REDIRECT_CAPAB,            "Redirect capability (reserved for national use)"},
472   { PARAM_TYPE_NETW_MGMT_CTRL,            "Network management controls"},
473   { PARAM_TYPE_CORRELATION_ID,            "Correlation id"},
474   { PARAM_TYPE_SCF_ID,                    "SCF id"},
475   { PARAM_TYPE_CALL_DIV_TREAT_IND,        "Call diversion treatment indicators"},
476   { PARAM_TYPE_CALLED_IN_NR,              "Called IN number"},
477   { PARAM_TYPE_CALL_OFF_TREAT_IND,        "Call offering treatment indicators"},
478   { PARAM_TYPE_CHARGED_PARTY_IDENT,       "Charged party identification (national use)"},
479   { PARAM_TYPE_CONF_TREAT_IND,            "Conference treatment indicators"},
480   { PARAM_TYPE_DISPLAY_INFO,              "Display information"},
481   { PARAM_TYPE_UID_ACTION_IND,            "UID action indicators"},
482   { PARAM_TYPE_UID_CAPAB_IND,             "UID capability indicators"},
483   { PARAM_TYPE_REDIRECT_COUNTER,          "Redirect counter (reserved for national use)"},
484   { PARAM_TYPE_APPLICATON_TRANS,          "Application transport"},
485   { PARAM_TYPE_COLLECT_CALL_REQ,          "Collect call request"},
486   { PARAM_TYPE_GENERIC_NR,                "Generic number"},
487   { PARAM_TYPE_GENERIC_DIGITS,            "Generic digits (national use)"},
488   { 0,                                 NULL}};
489 static value_string_ext isup_parameter_type_value_ext = VALUE_STRING_EXT_INIT(isup_parameter_type_value);
490
491 static const value_string ansi_isup_parameter_type_value[] = {
492   { PARAM_TYPE_END_OF_OPT_PARAMS,         "End of optional parameters"},
493   { PARAM_TYPE_CALL_REF,                  "Call Reference (national use)"},
494   { PARAM_TYPE_TRANSM_MEDIUM_REQU,        "Transmission medium requirement"},
495   { PARAM_TYPE_ACC_TRANSP,                "Access transport"},
496   { PARAM_TYPE_CALLED_PARTY_NR,           "Called party number"},
497   { PARAM_TYPE_SUBSQT_NR,                 "Subsequent number"},
498   { PARAM_TYPE_NATURE_OF_CONN_IND,        "Nature of connection indicators"},
499   { PARAM_TYPE_FORW_CALL_IND,             "Forward call indicators"},
500   { PARAM_TYPE_OPT_FORW_CALL_IND,         "Optional forward call indicators"},
501   { PARAM_TYPE_CALLING_PRTY_CATEG,        "Calling party's category"},
502   { PARAM_TYPE_CALLING_PARTY_NR,          "Calling party number"},
503   { PARAM_TYPE_REDIRECTING_NR,            "Redirecting number"},
504   { PARAM_TYPE_REDIRECTION_NR,            "Redirection number"},
505   { PARAM_TYPE_CONNECTION_REQ,            "Connection request"},
506   { PARAM_TYPE_INFO_REQ_IND,              "Information request indicators (national use)"},
507   { PARAM_TYPE_INFO_IND,                  "Information indicators (national use)"},
508   { PARAM_TYPE_CONTINUITY_IND,            "Continuity request"},
509   { PARAM_TYPE_BACKW_CALL_IND,            "Backward call indicators"},
510   { PARAM_TYPE_CAUSE_INDICATORS,          "Cause indicators"},
511   { PARAM_TYPE_REDIRECTION_INFO,          "Redirection information"},
512   { PARAM_TYPE_CIRC_GRP_SV_MSG_TYPE,      "Circuit group supervision message type"},
513   { PARAM_TYPE_RANGE_AND_STATUS,          "Range and Status"},
514   { PARAM_TYPE_FACILITY_IND,              "Facility indicator"},
515   { PARAM_TYPE_CLSD_USR_GRP_ILOCK_CD,     "Closed user group interlock code"},
516   { PARAM_TYPE_USER_SERVICE_INFO,         "User service information"},
517   { PARAM_TYPE_SIGNALLING_POINT_CODE,     "Signalling point code (national use)"},
518   { PARAM_TYPE_USER_TO_USER_INFO,         "User-to-user information"},
519   { PARAM_TYPE_CONNECTED_NR,              "Connected number"},
520   { PARAM_TYPE_SUSP_RESUME_IND,           "Suspend/Resume indicators"},
521   { PARAM_TYPE_TRANSIT_NETW_SELECT,       "Transit network selection (national use)"},
522   { PARAM_TYPE_EVENT_INFO,                "Event information"},
523   { PARAM_TYPE_CIRC_ASSIGN_MAP,           "Circuit assignment map"},
524   { PARAM_TYPE_CIRC_STATE_IND,            "Circuit state indicator (national use)"},
525   { PARAM_TYPE_AUTO_CONG_LEVEL,           "Automatic congestion level"},
526   { PARAM_TYPE_ORIG_CALLED_NR,            "Original called number"},
527   { PARAM_TYPE_OPT_BACKW_CALL_IND,        "Backward call indicators"},
528   { PARAM_TYPE_USER_TO_USER_IND,          "User-to-user indicators"},
529   { PARAM_TYPE_ORIG_ISC_POINT_CODE,       "Origination ISC point code"},
530   { PARAM_TYPE_GENERIC_NOTIF_IND,         "Generic notification indicator"},
531   { PARAM_TYPE_CALL_HIST_INFO,            "Call history information"},
532   { PARAM_TYPE_ACC_DELIV_INFO,            "Access delivery information"},
533   { PARAM_TYPE_NETW_SPECIFIC_FACLTY,      "Network specific facility (national use)"},
534   { PARAM_TYPE_USER_SERVICE_INFO_PR,      "User service information prime"},
535   { PARAM_TYPE_PROPAG_DELAY_COUNTER,      "Propagation delay counter"},
536   { PARAM_TYPE_REMOTE_OPERATIONS,         "Remote operations (national use)"},
537   { PARAM_TYPE_SERVICE_ACTIVATION,        "Service activation"},
538   { PARAM_TYPE_USER_TELESERV_INFO,        "User teleservice information"},
539   { PARAM_TYPE_TRANSM_MEDIUM_USED,        "Transmission medium used"},
540   { PARAM_TYPE_CALL_DIV_INFO,             "Call diversion information"},
541   { PARAM_TYPE_ECHO_CTRL_INFO,            "Echo control information"},
542   { PARAM_TYPE_MSG_COMPAT_INFO,           "Message compatibility information"},
543   { PARAM_TYPE_PARAM_COMPAT_INFO,         "Parameter compatibility information"},
544   { PARAM_TYPE_MLPP_PRECEDENCE,           "MLPP precedence"},
545   { PARAM_TYPE_MCID_REQ_IND,              "MCID request indicators"},
546   { PARAM_TYPE_MCID_RSP_IND,              "MCID response indicators"},
547   { PARAM_TYPE_HOP_COUNTER,               "Hop counter"},
548   { PARAM_TYPE_TRANSM_MEDIUM_RQUR_PR,     "Transmission medium requirement prime"},
549   { PARAM_TYPE_LOCATION_NR,               "Location number"},
550   { PARAM_TYPE_REDIR_NR_RSTRCT,           "Redirection number restriction"},
551   { PARAM_TYPE_CALL_TRANS_REF,            "Call transfer reference"},
552   { PARAM_TYPE_LOOP_PREV_IND,             "Loop prevention indicators"},
553   { PARAM_TYPE_CALL_TRANS_NR,             "Call transfer number"},
554   { PARAM_TYPE_CCSS,                      "CCSS"},
555   { PARAM_TYPE_FORW_GVNS,                 "Forward GVNS"},
556   { PARAM_TYPE_BACKW_GVNS,                "Backward GVNS"},
557   { PARAM_TYPE_REDIRECT_CAPAB,            "Redirect capability (reserved for national use)"},
558   { PARAM_TYPE_NETW_MGMT_CTRL,            "Network management controls"},
559   { PARAM_TYPE_CORRELATION_ID,            "Correlation id"},
560   { PARAM_TYPE_SCF_ID,                    "SCF id"},
561   { PARAM_TYPE_CALL_DIV_TREAT_IND,        "Call diversion treatment indicators"},
562   { PARAM_TYPE_CALLED_IN_NR,              "Called IN number"},
563   { PARAM_TYPE_CALL_OFF_TREAT_IND,        "Call offering treatment indicators"},
564   { PARAM_TYPE_CHARGED_PARTY_IDENT,       "Charged party identification (national use)"},
565   { PARAM_TYPE_CONF_TREAT_IND,            "Conference treatment indicators"},
566   { PARAM_TYPE_DISPLAY_INFO,              "Display information"},
567   { PARAM_TYPE_UID_ACTION_IND,            "UID action indicators"},
568   { PARAM_TYPE_UID_CAPAB_IND,             "UID capability indicators"},
569   { PARAM_TYPE_REDIRECT_COUNTER,          "Redirect counter (reserved for national use)"},
570   { PARAM_TYPE_APPLICATON_TRANS,          "Application transport"},
571   { PARAM_TYPE_COLLECT_CALL_REQ,          "Collect call request"},
572   { PARAM_TYPE_CALLING_GEODETIC_LOCATION, "Calling geodetic location"},
573   { PARAM_TYPE_GENERIC_NR,                "Generic number"},
574   { PARAM_TYPE_GENERIC_DIGITS,            "Generic digits (national use)"},
575 #if 0 /* XXX: Dups of below */
576   { PARAM_TYPE_JURISDICTION,              "Jurisdiction"},
577   { PARAM_TYPE_GENERIC_NAME,              "Generic name"},
578   { PARAM_TYPE_ORIG_LINE_INFO,            "Originating line info"},
579 #endif
580   { ANSI_ISUP_PARAM_TYPE_OPER_SERV_INF,   "Operator Services information"},
581   { ANSI_ISUP_PARAM_TYPE_EGRESS,          "Egress"},
582   { ANSI_ISUP_PARAM_TYPE_JURISDICTION,    "Jurisdiction"},
583   { ANSI_ISUP_PARAM_TYPE_CARRIER_ID,      "Carrier identification"},
584   { ANSI_ISUP_PARAM_TYPE_BUSINESS_GRP,    "Business group"},
585   { ANSI_ISUP_PARAM_TYPE_GENERIC_NAME,    "Generic name"},
586   { ANSI_ISUP_PARAM_TYPE_NOTIF_IND,       "Notification indicator"},
587   { ANSI_ISUP_PARAM_TYPE_CG_CHAR_IND,     "Circuit group characteristic indicator"},
588   { ANSI_ISUP_PARAM_TYPE_CVR_RESP_IND,    "Circuit validation response indicator"},
589   { ANSI_ISUP_PARAM_TYPE_OUT_TRK_GRP_NM,  "Outgoing trunk group number"},
590   { ANSI_ISUP_PARAM_TYPE_CI_NAME_IND,     "Circuit identification name"},
591   { ANSI_ISUP_PARAM_CLLI_CODE,            "COMMON LANGUAGE location identification (CLLI) code"},
592   { ANSI_ISUP_PARAM_ORIG_LINE_INF,        "Originating line information"},
593   { ANSI_ISUP_PARAM_CHRG_NO,              "Charge number"},
594   { ANSI_ISUP_PARAM_SERV_CODE_IND,        "Service code indicator"},
595   { ANSI_ISUP_PARAM_SPEC_PROC_REQ,        "Special processing request"},
596   { ANSI_ISUP_PARAM_CARRIER_SEL_INF,      "Carrier selection information"},
597   { ANSI_ISUP_PARAM_NET_TRANS,            "Network transport"},
598   { 0,                                 NULL}};
599 static value_string_ext ansi_isup_parameter_type_value_ext = VALUE_STRING_EXT_INIT(ansi_isup_parameter_type_value);
600
601 #define CIC_LENGTH                             2
602 #define BICC_CIC_LENGTH                        4
603 #define MESSAGE_TYPE_LENGTH                    1
604 #define COMMON_HEADER_LENGTH                   (CIC_LENGTH + MESSAGE_TYPE_LENGTH)
605 #define BICC_COMMON_HEADER_LENGTH              (BICC_CIC_LENGTH + MESSAGE_TYPE_LENGTH)
606
607 #define MAXDIGITS                              32 /* Max number of address digits */
608 #define MAXGNAME                               15 /* Max number of characters in generic name */
609
610 #define PARAMETER_TYPE_LENGTH                  1
611 #define PARAMETER_POINTER_LENGTH               1
612 #define PARAMETER_LENGTH_IND_LENGTH            1
613
614 /* All following parameter length definitions are WITHOUT the parameter type byte and length indicator for optional parameters*/
615 #define PARAMETER_NAME_LENGTH                  1
616 #define PARAMETER_LENGTH_IND_LENGTH            1
617 #define ACCESS_DELIVERY_INFO_LENGTH            1
618 #define AUTO_CONGEST_LEVEL_LENGTH              1
619 #define BACKWARD_CALL_IND_LENGTH               2
620 #define BACKWARD_GVNS_LENGTH                   1
621 #define CALL_DIV_INFO_LENGTH                   1
622 #define CALL_DIV_TREATMENT_IND_LENGTH          1
623 #define CALL_HISTORY_INFO_LENGTH               2
624 #define CALL_OFFERING_TREATMENT_IND_LENGTH     1
625 #define CALL_REFERENCE_LENGTH                  5
626 #define CALL_TRANSFER_REF_LENGTH               1
627 #define CALLING_PRTYS_CATEGORY_LENGTH          1
628 #define CCSS_LENGTH                            1
629 #define CIRCUIT_ASSIGNMENT_MAP_LENGTH          5
630 #define CIRC_GRP_SV_MSG_TYPE_LENGTH            1
631 #define CLOSED_USR_GRP_INTERLOCK_CODE_LENGTH   4
632 #define COLLECT_CALL_REQUEST_LENGTH            1
633 #define CONFERENCE_TREATMENT_IND_LENGTH        1
634 #define CONNECTION_REQUEST_LENGTH              7
635 #define CONTINUITY_IND_LENGTH                  1
636 #define ECHO_CONTROL_INFO_LENGTH               1
637 #define END_OF_OPT_PART_LENGTH                 1
638 #define EVENT_INFO_LENGTH                      1
639 #define FACILITY_IND_LENGTH                    1
640 #define FORWARD_CALL_IND_LENGTH                2
641 #define GENERIC_NOTIFICATION_IND_LENGTH        1
642 #define HOP_COUNTER_LENGTH                     1
643 #define ORIG_LINE_INFO_LENGTH                  1
644 #define INFO_IND_LENGTH                        2
645 #define INFO_REQUEST_IND_LENGTH                2
646 #define LOOP_PREVENTION_IND_LENGTH             1
647 #define MCID_REQUEST_IND_LENGTH                1
648 #define MCID_RESPONSE_IND_LENGTH               1
649 #define MLPP_PRECEDENCE_LENGTH                 1
650 #define NATURE_OF_CONNECTION_IND_LENGTH        1
651 #define NETWORK_MANAGEMENT_CONTROLS_LENGTH     1
652 #define OPTIONAL_BACKWARD_CALL_IND_LENGTH      1
653 #define OPTIONAL_FORWARD_CALL_IND_LENGTH       1
654 #define ORIGINAL_ISC_POINT_CODE_LENGTH         2
655 #define PROPAGATION_DELAY_COUNT_LENGTH         2
656 #define REDIRECTION_NUMBER_LENGTH              2
657 #define REDIRECTION_INFO_LENGTH                2
658 #define REDIRECTION_NUMBER_RESTRICTION_LENGTH  1
659 #define SIGNALLING_POINT_CODE_LENGTH           2
660 #define SUSPEND_RESUME_IND_LENGTH              1
661 #define TRANSMISSION_MEDIUM_REQUIREMENT_LENGTH 1
662 #define TRANSMISSION_MEDIUM_RQMT_PRIME_LENGTH  1
663 #define TRANSMISSION_MEDIUM_USED_LENGTH        1
664 #define UID_ACTION_IND_LENGTH                  1
665 #define UID_CAPABILITY_IND_LENGTH              1
666 #define USER_TELESERVICE_INFO_LENGTH           2
667 #define USER_TO_USER_IND_LENGTH                1
668 #define RANGE_LENGTH                           1
669
670 #define CVR_RESP_IND_LENGTH                    1
671 #define CG_CHAR_IND_LENGTH                     1
672 #define CI_NAME_IND                           28
673 #define CLLI_CODE_LENGTH                      13
674
675 #define CALL_ID_LENGTH        3 /* for parameter Call Reference */
676 #define SPC_LENGTH            2 /* for parameter Call Reference, Connection request */
677 #define LOCAL_REF_LENGTH      3 /* for parameter Connection request */
678 #define PROTOCOL_CLASS_LENGTH 1 /* for parameter Connection request */
679 #define CREDIT_LENGTH         1 /* for parameter Connection request */
680
681 #define CIC_OFFSET            0
682 #define BICC_CIC_OFFSET       0
683
684 #define NO_SATELLITE_CIRCUIT_IN_CONNECTION   0
685 #define ONE_SATELLITE_CIRCUIT_IN_CONNECTION  1
686 #define TWO_SATELLITE_CIRCUIT_IN_CONNECTION  2
687 static const value_string isup_satellite_ind_value[] = {
688   { NO_SATELLITE_CIRCUIT_IN_CONNECTION,          "No Satellite circuit in connection"},
689   { ONE_SATELLITE_CIRCUIT_IN_CONNECTION,         "One Satellite circuit in connection"},
690   { TWO_SATELLITE_CIRCUIT_IN_CONNECTION,         "Two Satellite circuits in connection"},
691   { 0,                                 NULL}};
692
693 #define CONTINUITY_CHECK_NOT_REQUIRED           0
694 #define CONTINUITY_CHECK_REQUIRED               1
695 #define CONTINUITY_CHECK_ON_A_PREVIOUS_CIRCUIT  2
696 static const value_string isup_continuity_check_ind_value[] = {
697   { CONTINUITY_CHECK_NOT_REQUIRED,               "Continuity check not required"},
698   { CONTINUITY_CHECK_REQUIRED,                   "Continuity check required on this circuit"},
699   { CONTINUITY_CHECK_ON_A_PREVIOUS_CIRCUIT ,     "Continuity check performed on a previous circuit"},
700   { 0,                                 NULL}};
701
702 static const true_false_string isup_echo_control_device_ind_value = {
703   "Echo control device included",
704   "Echo control device not included"
705 };
706
707 static const true_false_string isup_natnl_inatnl_call_ind_value = {
708   "Call to be treated as international call",
709   "Call to be treated as national call"
710 };
711
712 #define NO_END_TO_END_METHOD_AVAILABLE       0
713 #define PASS_ALONG_METHOD_AVAILABLE          1
714 #define SCCP_METHOD_AVAILABLE                2
715 #define PASS_ALONG_AND_SCCP_METHOD_AVAILABLE 3
716 static const value_string isup_end_to_end_method_ind_value[] = {
717   { NO_END_TO_END_METHOD_AVAILABLE,          "No End-to-end method available (only link-by-link method available)"},
718   { PASS_ALONG_METHOD_AVAILABLE,             "Pass-along method available (national use)"},
719   { SCCP_METHOD_AVAILABLE,                   "SCCP method available"},
720   { PASS_ALONG_AND_SCCP_METHOD_AVAILABLE,    "pass-along and SCCP method available (national use)"},
721   { 0,                                 NULL}};
722
723 static const true_false_string isup_interworking_ind_value = {
724   "interworking encountered",
725   "no interworking encountered (No.7 signalling all the way)"
726 };
727
728 static const true_false_string isup_end_to_end_info_ind_value = {
729   "end-to-end information available",
730   "no end-to-end information available"
731 };
732
733 static const true_false_string isup_ISDN_user_part_ind_value = {
734   "ISDN user part used all the way",
735   "ISDN user part not used all the way"
736 };
737
738 #define ISUP_PREFERRED_ALL_THE_WAY              0
739 #define ISUP_NOT_REQUIRED_ALL_THE_WAY           1
740 #define ISUP_REQUIRED_ALL_WAY                   2
741 #define ISUP_ISDN_USER_PART_IND_SPARE           3
742 static const value_string isup_preferences_ind_value[] = {
743   { ISUP_PREFERRED_ALL_THE_WAY,                  "ISDN user part preferred all the way"},
744   { ISUP_NOT_REQUIRED_ALL_THE_WAY,               "ISDN user part not required all the way"},
745   { ISUP_REQUIRED_ALL_WAY,                       "ISDN user part required all the way"},
746   { ISUP_ISDN_USER_PART_IND_SPARE,               "spare"},
747   { 0,                                 NULL}};
748
749 static const true_false_string isup_ISDN_originating_access_ind_value = {
750   "originating access ISDN",
751   "originating access non-ISDN"
752 };
753
754 static const true_false_string isup_ISDN_ported_num_trans_ind_value = {
755   "number translated",
756   "number not translated"
757 };
758
759 static const true_false_string isup_ISDN_qor_attempt_ind_value = {
760   "QoR routing attempt in progress",
761   "no QoR routing attempt in progress"
762 };
763
764 #define NO_INDICATION                                0
765 #define CONNECTIONLESS_METHOD_AVAILABLE              1
766 #define CONNECITON_ORIENTED_METHOD_AVAILABLE         2
767 #define CONNECTIONLESS_AND_ORIENTED_METHOD_AVAILABLE 3
768 static const value_string isup_SCCP_method_ind_value[] = {
769   { NO_INDICATION,                                  "No indication"},
770   { CONNECTIONLESS_METHOD_AVAILABLE,                "Connectionless method available (national use)"},
771   { CONNECITON_ORIENTED_METHOD_AVAILABLE,           "Connection oriented method available"},
772   { CONNECTIONLESS_AND_ORIENTED_METHOD_AVAILABLE,   "Connectionless and -oriented method available (national use)"},
773   { 0,                                 NULL}};
774
775 #define UNKNOWN_AT_THIS_TIME                 0
776 #define OPERATOR_FRENCH                      1
777 #define OPERATOR_ENGLISH                     2
778 #define OPERATOR_GERMAN                      3
779 #define OPERATOR_RUSSIAN                     4
780 #define OPERATOR_SPANISH                     5
781 #define ORDINARY_CALLING_SUBSCRIBER         10
782 #define CALLING_SUBSCRIBER_WITH_PRIORITY    11
783 #define DATA_CALL                           12
784 #define TEST_CALL                           13
785 #define PAYPHONE                            15
786 static const value_string isup_calling_partys_category_value[] = {
787   { UNKNOWN_AT_THIS_TIME,               "Category unknown at this time (national use)"},
788   { OPERATOR_FRENCH,                    "operator, language French"},
789   { OPERATOR_ENGLISH,                   "operator, language English"},
790   { OPERATOR_GERMAN,                    "operator, language German"},
791   { OPERATOR_RUSSIAN,                   "operator, language Russian"},
792   { OPERATOR_SPANISH,                   "operator, language Spanish"},
793
794   { 6,                                  "available to Administrations"},
795   { 7,                                  "available to Administrations"},
796   { 8,                                  "available to Administrations"},
797   { 9,                                  "reserved (national use)"},
798
799   { ORDINARY_CALLING_SUBSCRIBER,        "ordinary calling subscriber"},
800   { CALLING_SUBSCRIBER_WITH_PRIORITY,   "calling subscriber with priority"},
801   { DATA_CALL,                          "data call (voice band data)"},
802   { TEST_CALL,                          "test call"},
803   /* q.763-200212Amd2 */
804   { 14,                                 "IEPS call marking for preferential call set up"},
805   { PAYPHONE,                           "payphone"},
806   { 0,                                 NULL}};
807 value_string_ext isup_calling_partys_category_value_ext = VALUE_STRING_EXT_INIT(isup_calling_partys_category_value);
808
809 #define CVR_RSP_IND_FAILURE     0
810 #define CVR_RSP_IND_SUCCESS     1
811
812 static const value_string isup_cvr_rsp_ind_value[ ] = {
813   { CVR_RSP_IND_FAILURE, "CVR Response Fail" },
814   { CVR_RSP_IND_SUCCESS, "CVR Response Success" },
815   { 0,                  NULL }
816 };
817
818 #define CVR_CG_IND_DOUBLE_SEIZE_NONE 0
819 #define CVR_CG_IND_DOUBLE_SEIZE_ODD  1
820 #define CVR_CG_IND_DOUBLE_SEIZE_EVEN 2
821 #define CVR_CG_IND_DOUBLE_SEIZE_ALL  3
822
823 static const value_string isup_cvr_cg_double_seize_value[ ] = {
824   { CVR_CG_IND_DOUBLE_SEIZE_NONE, "Double Seize control NONE" },
825   { CVR_CG_IND_DOUBLE_SEIZE_ODD,  "Double Seize control odd circuits"},
826   { CVR_CG_IND_DOUBLE_SEIZE_EVEN, "Double Seize control even circuits"},
827   { CVR_CG_IND_DOUBLE_SEIZE_ALL,  "Double Seize control all circuits"},
828   {0, NULL }
829 };
830
831 #define CVR_CG_IND_CAR_IND_UNKNOWN      0
832 #define CVR_CG_IND_CAR_IND_ANALOG       1
833 #define CVR_CG_IND_CAR_IND_DIGITAL      2
834 #define CVR_CG_IND_CAR_IND_ANALOG_DIG   3
835
836 static const value_string isup_cvr_cg_car_ind_value[ ] = {
837 { CVR_CG_IND_CAR_IND_UNKNOWN   , "Carrier Type Unknown" },
838 { CVR_CG_IND_CAR_IND_ANALOG    , "Carrier Type Analog" },
839 { CVR_CG_IND_CAR_IND_DIGITAL   , "Carrier Type Digital"},
840 { CVR_CG_IND_CAR_IND_ANALOG_DIG, "Carrier Type Digital And Analog"},
841 { 0, NULL }
842 };
843
844 #define CVR_CG_IND_ALARM_CAR_IND_UNKNOWN  0
845 #define CVR_CG_IND_ALARM_CAR_IND_SOFTWARE 1
846 #define CVR_CG_IND_ALARM_CAR_IND_HARDWARE 2
847 #define CVR_CG_IND_ALARM_CAR_IND_SPARE    3
848
849 static const value_string isup_cvr_alarm_car_ind_value[ ] = {
850   { CVR_CG_IND_ALARM_CAR_IND_UNKNOWN    , "Alarm Carrier Ind Default"},
851   { CVR_CG_IND_ALARM_CAR_IND_SOFTWARE   , "Alarm Carrier Ind Software"},
852   { CVR_CG_IND_ALARM_CAR_IND_HARDWARE   , "Alarm Carrier Ind Hardware"},
853   { CVR_CG_IND_ALARM_CAR_IND_SPARE      , "Alarm Carrier Ind Spare"},
854   { 0, NULL }
855 };
856
857 #define CVR_CG_IND_CONT_CHK_UNKNOWN  0
858 #define CVR_CG_IND_CONT_CHK_NONE     1
859 #define CVR_CG_IND_CONT_CHK_STAT     2
860 #define CVR_CG_IND_CONT_CHK_PER_CALL 3
861
862 static const value_string isup_cvr_cont_chk_ind_value[ ] = {
863
864   { CVR_CG_IND_CONT_CHK_UNKNOWN  , "Continuity Check Unknown"},
865   { CVR_CG_IND_CONT_CHK_NONE     , "Continuity Check NONE"},
866   { CVR_CG_IND_CONT_CHK_STAT     , "Continuity Check Statistical"},
867   { CVR_CG_IND_CONT_CHK_PER_CALL , "Continuity Check Per Call"},
868   { 0, NULL }
869 };
870
871 #define MEDIUM_SPEECH                        0
872 #define MEDIUM_64KBS                         2
873 #define MEDIUM_3_1_KHZ_AUDIO                 3
874 #define MEDIUM_RESERVED_SERVICE2_1           4
875 #define MEDIUM_RESERVED_SERVICE1_2           5
876 #define MEDIUM_64KBS_PREFERRED               6
877 #define MEDIUM_2_64KBS                       7
878 #define MEDIUM_384KBS                        8
879 #define MEDIUM_1536KBS                       9
880 #define MEDIUM_1920KBS                      10
881
882 #define MEDIUM_3_64KBS                      16
883 #define MEDIUM_4_64KBS                      17
884 #define MEDIUM_5_64KBS                      18
885
886 #define MEDIUM_7_64KBS                      20
887 #define MEDIUM_8_64KBS                      21
888 #define MEDIUM_9_64KBS                      22
889 #define MEDIUM_10_64KBS                     23
890 #define MEDIUM_11_64KBS                     24
891 #define MEDIUM_12_64KBS                     25
892 #define MEDIUM_13_64KBS                     26
893 #define MEDIUM_14_64KBS                     27
894 #define MEDIUM_15_64KBS                     28
895 #define MEDIUM_16_64KBS                     29
896 #define MEDIUM_17_64KBS                     30
897 #define MEDIUM_18_64KBS                     31
898 #define MEDIUM_19_64KBS                     32
899 #define MEDIUM_20_64KBS                     33
900 #define MEDIUM_21_64KBS                     34
901 #define MEDIUM_22_64KBS                     35
902 #define MEDIUM_23_64KBS                     36
903
904 #define MEDIUM_25_64KBS                     38
905 #define MEDIUM_26_64KBS                     39
906 #define MEDIUM_27_64KBS                     40
907 #define MEDIUM_28_64KBS                     41
908 #define MEDIUM_29_64KBS                     42
909
910 static const value_string isup_transmission_medium_requirement_value[] = {
911   { MEDIUM_SPEECH,                       "speech"},
912   { 1,                                   "spare"},
913   { MEDIUM_64KBS,                        "64 kbit/s unrestricted"},
914   { MEDIUM_3_1_KHZ_AUDIO,                "3.1 kHz audio"},
915   { MEDIUM_RESERVED_SERVICE2_1,          "reserved for alternate speech (service 2)/64 kbit/s unrestricted (service 1)"},
916   { MEDIUM_RESERVED_SERVICE1_2,          "reserved for alternate 64 kbit/s unrestricted (service 1)/speech (service 2)"},
917   { MEDIUM_64KBS_PREFERRED,              "64 kbit/s preferred"},
918   { MEDIUM_2_64KBS,                      "2x64 kbit/s unrestricted"},
919   { MEDIUM_384KBS,                       "384 kbit/s unrestricted"},
920   { MEDIUM_1536KBS,                      "1536 kbit/s unrestricted"},
921   { MEDIUM_1920KBS,                      "1920 kbit/s unrestricted"},
922
923   { 11,                                  "spare"},
924   { 12,                                  "spare"},
925   { 13,                                  "spare"},
926   { 14,                                  "spare"},
927   { 15,                                  "spare"},
928
929   { MEDIUM_3_64KBS,                      "3x64 kbit/s unrestricted"},
930   { MEDIUM_4_64KBS,                      "4x64 kbit/s unrestricted"},
931   { MEDIUM_5_64KBS,                      "5x64 kbit/s unrestricted"},
932
933   { 19,                                  "spare"},
934
935   { MEDIUM_7_64KBS,                      "7x64 kbit/s unrestricted"},
936   { MEDIUM_8_64KBS,                      "8x64 kbit/s unrestricted"},
937   { MEDIUM_9_64KBS,                      "9x64 kbit/s unrestricted"},
938   { MEDIUM_10_64KBS,                     "10x64 kbit/s unrestricted"},
939   { MEDIUM_11_64KBS,                     "11x64 kbit/s unrestricted"},
940   { MEDIUM_12_64KBS,                     "12x64 kbit/s unrestricted"},
941   { MEDIUM_13_64KBS,                     "13x64 kbit/s unrestricted"},
942   { MEDIUM_14_64KBS,                     "14x64 kbit/s unrestricted"},
943   { MEDIUM_15_64KBS,                     "15x64 kbit/s unrestricted"},
944   { MEDIUM_16_64KBS,                     "16x64 kbit/s unrestricted"},
945   { MEDIUM_17_64KBS,                     "17x64 kbit/s unrestricted"},
946   { MEDIUM_18_64KBS,                     "18x64 kbit/s unrestricted"},
947   { MEDIUM_19_64KBS,                     "19x64 kbit/s unrestricted"},
948   { MEDIUM_20_64KBS,                     "20x64 kbit/s unrestricted"},
949   { MEDIUM_21_64KBS,                     "21x64 kbit/s unrestricted"},
950   { MEDIUM_22_64KBS,                     "22x64 kbit/s unrestricted"},
951   { MEDIUM_23_64KBS,                     "23x64 kbit/s unrestricted"},
952
953   { 37,                                  "spare"},
954
955   { MEDIUM_25_64KBS,                     "25x64 kbit/s unrestricted"},
956   { MEDIUM_26_64KBS,                     "26x64 kbit/s unrestricted"},
957   { MEDIUM_27_64KBS,                     "27x64 kbit/s unrestricted"},
958   { MEDIUM_28_64KBS,                     "28x64 kbit/s unrestricted"},
959   { MEDIUM_29_64KBS,                     "29x64 kbit/s unrestricted"},
960   { 0,                                 NULL}};
961 value_string_ext isup_transmission_medium_requirement_value_ext = VALUE_STRING_EXT_INIT(isup_transmission_medium_requirement_value);
962
963 static const value_string isup_transmission_medium_requirement_prime_value[] = {
964   { MEDIUM_SPEECH,                       "speech"},
965   { 1,                                   "spare"},
966   { MEDIUM_64KBS,                        "reserved for 64 kbit/s unrestricted"},
967   { MEDIUM_3_1_KHZ_AUDIO,                "3.1 kHz audio"},
968   { MEDIUM_RESERVED_SERVICE2_1,          "reserved for alternate speech (service 2)/64 kbit/s unrestricted (service 1)"},
969   { MEDIUM_RESERVED_SERVICE1_2,          "reserved for alternate 64 kbit/s unrestricted (service 1)/speech (service 2)"},
970   { MEDIUM_64KBS_PREFERRED,              "reserved for 64 kbit/s preferred"},
971   { MEDIUM_2_64KBS,                      "reserved for 2x64 kbit/s unrestricted"},
972   { MEDIUM_384KBS,                       "reserved for 384 kbit/s unrestricted"},
973   { MEDIUM_1536KBS,                      "reserved for 1536 kbit/s unrestricted"},
974   { MEDIUM_1920KBS,                      "reserved for 1920 kbit/s unrestricted"},
975   { 0,                                 NULL}};
976 static value_string_ext isup_transmission_medium_requirement_prime_value_ext = VALUE_STRING_EXT_INIT(isup_transmission_medium_requirement_prime_value);
977
978
979 /* Definitions for Called and Calling Party number */
980 #define ISUP_ODD_EVEN_MASK                       0x80
981 #define ISUP_NATURE_OF_ADDRESS_IND_MASK          0x7F
982 #define ISUP_INN_MASK                            0x80
983 #define ISUP_NI_MASK                             0x80
984 #define ISUP_NUMBERING_PLAN_IND_MASK             0x70
985 #define ISUP_ADDRESS_PRESENTATION_RESTR_IND_MASK 0x0C
986 #define ISUP_SCREENING_IND_MASK                  0x03
987 #define ISUP_ODD_ADDRESS_SIGNAL_DIGIT_MASK       0x0F
988 #define ISUP_EVEN_ADDRESS_SIGNAL_DIGIT_MASK      0xF0
989
990 static const true_false_string isup_odd_even_ind_value = {
991   "odd number of address signals",
992   "even number of address signals"
993 };
994
995 #define ISUP_CALLED_PARTY_NATURE_SUBSCRIBER_NR  1
996 #define ISUP_CALLED_PARTY_NATURE_UNKNOWN        2
997 #define ISUP_CALLED_PARTY_NATURE_NATIONAL_NR    3
998 #define ISUP_CALLED_PARTY_NATURE_INTERNATNL_NR  4
999 #define ISUP_CALLED_PARTY_NATURE_NETW_SPEC_NR   5
1000
1001 #define ISUP_CHARGE_NATURE_ANI_CGPA_SUB_NR      1
1002 #define ISUP_CHARGE_NATURE_ANI_NA               2
1003 #define ISUP_CHARGE_NATURE_ANI_CGPA_NAT_NR      3
1004 #define ISUP_CHARGE_NATURE_ANI_CDPA_SUB_NR      5
1005 #define ISUP_CHARGE_NATURE_ANI_CDPA_NO_NR       6
1006 #define ISUP_CHARGE_NATURE_ANI_CDPA_NAT_NR      7
1007
1008 static const value_string isup_called_party_nature_of_address_ind_value[] = {
1009   { ISUP_CALLED_PARTY_NATURE_SUBSCRIBER_NR,     "subscriber number (national use)"},
1010   { ISUP_CALLED_PARTY_NATURE_UNKNOWN,           "unknown (national use)"},
1011   { ISUP_CALLED_PARTY_NATURE_NATIONAL_NR,       "national (significant) number"},
1012   { ISUP_CALLED_PARTY_NATURE_INTERNATNL_NR,     "international number"},
1013   { ISUP_CALLED_PARTY_NATURE_NETW_SPEC_NR,      "network-specific number (national use)"},
1014   { 0,                                 NULL}};
1015
1016 static const value_string isup_calling_party_nature_of_address_ind_value[] = {
1017   { ISUP_CALLED_PARTY_NATURE_SUBSCRIBER_NR,     "subscriber number (national use)"},
1018   { ISUP_CALLED_PARTY_NATURE_UNKNOWN,           "unknown (national use)"},
1019   { ISUP_CALLED_PARTY_NATURE_NATIONAL_NR,       "national (significant) number"},
1020   { ISUP_CALLED_PARTY_NATURE_INTERNATNL_NR,     "international number"},
1021   { 0,                                 NULL}};
1022
1023 static const value_string isup_charge_number_nature_of_address_ind_value[] = {
1024   { ISUP_CHARGE_NATURE_ANI_CGPA_SUB_NR,  "ANI of the calling party; subscriber number"},
1025   { ISUP_CHARGE_NATURE_ANI_NA,           "ANI not available or not provided"},
1026   { ISUP_CHARGE_NATURE_ANI_CGPA_NAT_NR,  "ANI of the calling party; national number"},
1027   { ISUP_CHARGE_NATURE_ANI_CDPA_SUB_NR,  "ANI of the called party; subscriber number"},
1028   { ISUP_CHARGE_NATURE_ANI_CDPA_NO_NR,   "ANI of the called party; no number present"},
1029   { ISUP_CHARGE_NATURE_ANI_CDPA_NAT_NR,  "ANI of the called party; national number"},
1030   { 0,                                 NULL}};
1031
1032 #define ISUP_GENERIC_NAME_PRESENTATION_ALLOWED          0
1033 #define ISUP_GENERIC_NAME_PRESENTATION_RESTRICT         1
1034 #define ISUP_GENERIC_NAME_PRESENTATION_BLOCK_TOGGLE     2
1035 #define ISUP_GENERIC_NAME_PRESENTATION_NO_INDIC         3
1036 #define ISUP_GENERIC_NAME_TYPE_SPARE                    0
1037 #define ISUP_GENERIC_NAME_TYPE_CALLING                  1
1038 #define ISUP_GENERIC_NAME_TYPE_ORIG_CALLED              2
1039 #define ISUP_GENERIC_NAME_TYPE_REDIRECTING              3
1040 #define ISUP_GENERIC_NAME_TYPE_CONNECTED                4
1041
1042 static const value_string isup_generic_name_presentation_value[] = {
1043   { ISUP_GENERIC_NAME_PRESENTATION_ALLOWED,             "presentation allowed"},
1044   { ISUP_GENERIC_NAME_PRESENTATION_RESTRICT,            "presentation restricted"},
1045   { ISUP_GENERIC_NAME_PRESENTATION_BLOCK_TOGGLE,        "blocking toggle"},
1046   { ISUP_GENERIC_NAME_PRESENTATION_NO_INDIC,            "no indication"},
1047   { 0,                                 NULL}};
1048
1049 static const true_false_string isup_generic_name_availability_value = {
1050   "name not available",
1051   "name available/unknown"
1052 };
1053
1054 static const value_string isup_generic_name_type_value[] = {
1055   { ISUP_GENERIC_NAME_TYPE_SPARE,               "spare"},
1056   { ISUP_GENERIC_NAME_TYPE_CALLING,             "calling name"},
1057   { ISUP_GENERIC_NAME_TYPE_ORIG_CALLED,         "original called name"},
1058   { ISUP_GENERIC_NAME_TYPE_REDIRECTING,         "redirecting name"},
1059   { ISUP_GENERIC_NAME_TYPE_CONNECTED,           "connected name"},
1060   { 5,                                          "spare"},
1061   { 6,                                          "spare"},
1062   { 7,                                          "spare"},
1063   { 0,                                 NULL}};
1064
1065 static const true_false_string isup_INN_ind_value = {
1066   "routing to internal network number not allowed",
1067   "routing to internal network number allowed "
1068 };
1069 static const true_false_string isup_NI_ind_value = {
1070   "incomplete",
1071   "complete"
1072 };
1073
1074 static const value_string isup_location_presentation_restricted_ind_value[] = {
1075   { 0,                                 "presentation allowed"},
1076   { 1,                                 "presentation restricted"},
1077   { 2,                                 "location not available"},
1078   { 3,                                 "spare"},
1079   { 0,                                 NULL}};
1080
1081 static const value_string isup_location_type_of_shape_value[] = {
1082   { 0,          "ellipsoid point"},
1083   { 1,          "ellipsoid point with uncertainty"},
1084   { 2,          "point with altitude and uncertainty"},
1085   { 3,          "ellipse on the ellipsoid"},
1086   { 4,          "ellipsoid circle sector"},
1087   { 5,          "polygon"},
1088   { 0,          NULL}};
1089
1090 #define ISDN_NUMBERING_PLAN                     1
1091 #define DATA_NUMBERING_PLAN                     3
1092 #define TELEX_NUMBERING_PLAN                    4
1093 static const value_string isup_numbering_plan_ind_value[] = {
1094   { ISDN_NUMBERING_PLAN,     "ISDN (Telephony) numbering plan"},
1095   { DATA_NUMBERING_PLAN,     "Data numbering plan (national use)"},
1096   { TELEX_NUMBERING_PLAN,    "Telex numbering plan (national use)"},
1097   { 5,                       "Reserved for national use"},
1098   { 6,                       "Reserved for national use"},
1099   { 0,                                 NULL}};
1100
1101 #define ADDRESS_PRESETATION_ALLOWED      0
1102 #define ADDRESS_PRESETATION_RESTRICTED   1
1103 #define ADDRESS_NOT_AVAILABLE            2
1104 static const value_string isup_address_presentation_restricted_ind_value[] = {
1105   { ADDRESS_PRESETATION_ALLOWED,     "presentation allowed"},
1106   { ADDRESS_PRESETATION_RESTRICTED,  "presentation restricted"},
1107   { ADDRESS_NOT_AVAILABLE,           "address not available (national use)"},
1108   { 3,                                 "spare"},
1109   { 0,                                 NULL}};
1110
1111 static const value_string isup_screening_ind_value[] = {
1112   { 0,     "reserved"},
1113   { 1,     "user provided, verified and passed"},
1114   { 2,     "reserved"},
1115   { 3,     "network provided"},
1116   { 0,     NULL}};
1117
1118 static const value_string isup_screening_ind_enhanced_value[] = {
1119   { 0,     "user provided, not verified"},
1120   { 1,     "user provided, verified and passed"},
1121   { 2,     "user provided, verified and failed"},
1122   { 3,     "network provided"},
1123   { 0,     NULL}};
1124
1125 static const value_string isup_called_party_address_digit_value[] = {
1126   { 0,  "0"},
1127   { 1,  "1"},
1128   { 2,  "2"},
1129   { 3,  "3"},
1130   { 4,  "4"},
1131   { 5,  "5"},
1132   { 6,  "6"},
1133   { 7,  "7"},
1134   { 8,  "8"},
1135   { 9,  "9"},
1136   { 10, "spare"},
1137   { 11, "code 11 "},
1138   { 12, "code 12"},
1139   { 15, "Stop sending"},
1140   { 0,  NULL}};
1141
1142 static const value_string isup_calling_party_address_digit_value[] = {
1143   { 0,  "0"},
1144   { 1,  "1"},
1145   { 2,  "2"},
1146   { 3,  "3"},
1147   { 4,  "4"},
1148   { 5,  "5"},
1149   { 6,  "6"},
1150   { 7,  "7"},
1151   { 8,  "8"},
1152   { 9,  "9"},
1153   { 10, "spare"},
1154   { 11, "code 11 "},
1155   { 12, "code 12"},
1156   { 15, "spare"},
1157   { 0,  NULL}};
1158
1159 /*End of Called/Calling party address definitions */
1160
1161
1162 static const true_false_string isup_calling_party_address_request_ind_value = {
1163   "calling party address requested",
1164   "calling party address not requested"
1165 };
1166 static const true_false_string isup_holding_ind_value = {
1167   "holding requested",
1168   "holding not requested"
1169 };
1170 static const true_false_string isup_calling_partys_category_request_ind_value = {
1171   "Calling Party's category requested",
1172   "Calling Party's category not requested",
1173 };
1174 static const true_false_string isup_charge_information_request_ind_value = {
1175   "Charge Information requested",
1176   "Charge Information not requested"
1177 };
1178 static const true_false_string isup_malicious_call_identification_request_ind_value = {
1179   "Malicious call identification requested",
1180   "Malicious call identification not requested"
1181 };
1182
1183 #define CALLING_PARTY_ADDRESS_NOT_INCLUDED             0
1184 #define CALLING_PARTY_ADDRESS_NOT_AVAILABLE            1
1185 #define CALLING_PARTY_ADDRESS_INCLUDED                 3
1186 static const value_string isup_calling_party_address_response_ind_value[] = {
1187   { CALLING_PARTY_ADDRESS_NOT_INCLUDED, "Calling party address not included"},
1188   { CALLING_PARTY_ADDRESS_NOT_AVAILABLE,"Calling party address not available"},
1189   { 4,                                  "spare"},
1190   { CALLING_PARTY_ADDRESS_INCLUDED,     "Calling party address included"},
1191   { 0,                                 NULL}};
1192
1193 static const true_false_string isup_hold_provided_ind_value = {
1194   "hold provided",
1195   "hold not provided"
1196 };
1197 static const true_false_string isup_calling_partys_category_response_ind_value = {
1198   "Calling Party's category included",
1199   "Calling Party's category not included",
1200 };
1201 static const true_false_string isup_charge_information_response_ind_value = {
1202   "Charge Information included",
1203   "Charge Information not included"
1204 };
1205 static const true_false_string isup_solicited_information_ind_value = {
1206   "unsolicited",
1207   "solicited"
1208 };
1209
1210 static const true_false_string isup_continuity_ind_value = {
1211   "Continuity check successful",
1212   "Continuity ckec failed"
1213 };
1214
1215 #define CHARGE_NO_IND       0
1216 #define CHARGE_NO_CHARGE    1
1217 #define CHARGE_CHARGE       2
1218 static const value_string isup_charge_ind_value[] = {
1219   { CHARGE_NO_IND,    "No indication"},
1220   { CHARGE_NO_CHARGE, "No charge"},
1221   { CHARGE_CHARGE,    "Charge"},
1222   { 3,                "spare"},
1223   { 0,                NULL}};
1224
1225 #define CALLED_PARTYS_STATUS_NO_IND            0
1226 #define CALLED_PARTYS_STATUS_SUBSCR_FREE       1
1227 #define CALLED_PARTYS_STATUS_CONNECT_WHEN_FREE 2
1228 static const value_string isup_called_partys_status_ind_value[] = {
1229   { CALLED_PARTYS_STATUS_NO_IND,            "No indication"},
1230   { CALLED_PARTYS_STATUS_SUBSCR_FREE,       "Subscriber free"},
1231   { CALLED_PARTYS_STATUS_CONNECT_WHEN_FREE, "Connect when free (national use)"},
1232   { 3,                                      "spare"},
1233   { 0,                NULL}};
1234
1235 #define CALLED_PARTYS_CATEGORY_NO_IND            0
1236 #define CALLED_PARTYS_CATEGORY_ORDINARY_SUBSCR   1
1237 #define CALLED_PARTYS_CATEGORY_PAYPHONE          2
1238 static const value_string isup_called_partys_category_ind_value[] = {
1239   { CALLED_PARTYS_CATEGORY_NO_IND,             "No indication"},
1240   { CALLED_PARTYS_CATEGORY_ORDINARY_SUBSCR,    "Ordinary subscriber"},
1241   { CALLED_PARTYS_CATEGORY_PAYPHONE,           "Payphone"},
1242   { 3,                                         "spare"},
1243   { 0,                NULL}};
1244
1245 static const true_false_string isup_ISDN_terminating_access_ind_value = {
1246   "terminating access ISDN",
1247   "terminating access non-ISDN"
1248 };
1249
1250 static const true_false_string isup_suspend_resume_ind_value = {
1251   "network initiated",
1252   "ISDN subscriber initiated"
1253 };
1254 #define MAINTENANCE            0
1255 #define HARDWARE_FAILURE       1
1256 #define RES_FOR_NATNL_USE      2
1257 static const value_string isup_cgs_message_type_value[] = {
1258   { MAINTENANCE,            "maintenance oriented"},
1259   { HARDWARE_FAILURE,       "hardware failure oriented"},
1260   { RES_FOR_NATNL_USE,      "reserved for national use (ISUP'84)"},
1261   { 3,                      "spare"},
1262   { 0,                NULL}};
1263
1264 #define USER_TO_USER_SERVICE      2
1265 static const value_string isup_facility_ind_value[] = {
1266   { USER_TO_USER_SERVICE,     "user-to-user service"},
1267   { 0,                NULL}};
1268
1269 #define MTC_BLCK_STATE_TRANSIENT  0
1270 #define MTC_BLCK_STATE_UNEQUIPPED 3
1271 static const value_string isup_mtc_blocking_state_DC00_value[] = {
1272   {  MTC_BLCK_STATE_TRANSIENT,  "transient"},
1273   { 1,                          "spare"},
1274   { 2,                          "spare"},
1275   {  MTC_BLCK_STATE_UNEQUIPPED, "unequipped"},
1276   { 0,                NULL}};
1277
1278 #define MTC_BLCK_NO_BLOCKING      0
1279 #define MTC_LOCALLY_BLOCKED       1
1280 #define MTC_REMOTELY_BLOCKED      2
1281 #define MTC_LOCAL_REMOTE_BLOCKED  3
1282 static const value_string isup_mtc_blocking_state_DCnot00_value[] = {
1283   {  MTC_BLCK_NO_BLOCKING,     "no blocking (active)"},
1284   {  MTC_LOCALLY_BLOCKED,      "locally blocked"},
1285   {  MTC_REMOTELY_BLOCKED,     "remotely blocked"},
1286   {  MTC_LOCAL_REMOTE_BLOCKED, "locally and remotely blocked"},
1287   {  0,                NULL}};
1288
1289 #define CALL_PROC_INCOMING_BUSY 1
1290 #define CALL_PROC_OUTGOING_BUSY 2
1291 #define CALL_PROC_IDLE          3
1292 static const value_string isup_call_processing_state_value[] = {
1293   {  CALL_PROC_INCOMING_BUSY,     "circuit incoming busy"},
1294   {  CALL_PROC_OUTGOING_BUSY,     "circuit outgoing busy"},
1295   {  CALL_PROC_IDLE,              "idle"},
1296   {  0,                NULL}};
1297
1298 #define HW_BLCK_NO_BLOCKING          0
1299 #define HW_LOCALLY_BLOCKED           1
1300 #define HW_REMOTELY_BLOCKED          2
1301 #define HW_LOCAL_REMOTE_BLOCKED      3
1302 static const value_string isup_HW_blocking_state_value[] = {
1303   {  HW_BLCK_NO_BLOCKING,     "no blocking (active)"},
1304   {  HW_LOCALLY_BLOCKED,      "locally blocked"},
1305   {  HW_REMOTELY_BLOCKED,     "remotely blocked"},
1306   {  HW_LOCAL_REMOTE_BLOCKED, "locally and remotely blocked"},
1307   {  0,                NULL}};
1308
1309 #define EVENT_ALERTING      1
1310 #define EVENT_PROGRESS      2
1311 #define EVENT_INBAND_INFO   3
1312 #define EVENT_ON_BUSY       4
1313 #define EVENT_ON_NO_REPLY   5
1314 #define EVENT_UNCONDITIONAL 6
1315 static const value_string isup_event_ind_value[] = {
1316   /* according 3.21/Q.763 */
1317   {  EVENT_ALERTING,     "ALERTING"},
1318   {  EVENT_PROGRESS,     "PROGRESS"},
1319   {  EVENT_INBAND_INFO,  "in-band information or an appropriate pattern is now available"},
1320   {  EVENT_ON_BUSY,      "call forwarded on busy (national use)"},
1321   {  EVENT_ON_NO_REPLY,  "call forwarded on no reply (national use)"},
1322   {  EVENT_UNCONDITIONAL,"call forwarded unconditional (national use)"},
1323   {  0,                NULL}};
1324
1325 static const true_false_string isup_event_presentation_restricted_ind_value = {
1326   /* according 3.21/Q.763 */
1327   "presentation restricted",
1328   "no indication"
1329 };
1330 #define CUG_NON_CUG_CALL                      0
1331 #define CUG_CALL_OUTGOING_ACCESS_ALLOWED      2
1332 #define CUG_CALL_OUTGOING_ACCESS_NOT_ALLOWED  3
1333 static const value_string isup_CUG_call_ind_value[] = {
1334   /* according 3.38/Q.763 */
1335   {  CUG_NON_CUG_CALL,                     "non-CUG call"},
1336   {  1,                                    "spare"},
1337   {  CUG_CALL_OUTGOING_ACCESS_ALLOWED,     "closed user group call, outgoing access allowed"},
1338   {  CUG_CALL_OUTGOING_ACCESS_NOT_ALLOWED, "closed user group call, outgoing access not allowed"},
1339   {  0,                NULL}};
1340
1341
1342 static const true_false_string isup_simple_segmentation_ind_value = {
1343   /* according 3.38/Q.763 */
1344   "additional information will be sent in a segmentation message",
1345   "no additional information will be sent"
1346 };
1347
1348 static const true_false_string isup_connected_line_identity_request_ind_value = {
1349   /* according 3.38/Q.763 */
1350   "requested",
1351   "not requested"
1352 };
1353
1354 static const value_string isup_redirecting_ind_value[] = {
1355   /* according 3.45/Q.763 */
1356   {  0,  "no redirection (national use)"},
1357   {  1,  "call rerouted (national use)"},
1358   {  2,  "call rerouted, all redirection information presentation restricted (national use)"},
1359   {  3,  "call diverted"},
1360   {  4,  "call diverted, all redirection information presentation restricted"},
1361   {  5,  "call rerouted, redirection number presentation restricted (national use)"},
1362   {  6,  "call diversion, redirection number presentation restricted (national use)"},
1363   {  7,  "spare"},
1364   {  0,  NULL}};
1365
1366 static const value_string isup_original_redirection_reason_value[] = {
1367   /* according 3.45/Q.763 */
1368   {  0,  "unknown/not available"},
1369   {  1,  "user busy (national use)"},
1370   {  2,  "no reply (national use)"},
1371   {  3,  "unconditional (national use)"},
1372   {  0,  NULL}};
1373
1374 static const value_string isup_redirection_reason_value[] = {
1375   /* according 3.45/Q.763 */
1376   {  0,  "unknown/not available"},
1377   {  1,  "user busy (national use)"},
1378   {  2,  "no reply (national use)"},
1379   {  3,  "unconditional (national use)"},
1380   {  4,  "deflection during alerting"},
1381   {  5,  "deflection immediate response"},
1382   {  6,  "mobile subscriber not reachable"},
1383   {  0,  NULL}};
1384
1385 static const value_string isup_type_of_network_identification_value[] = {
1386   /* according 3.53/Q.763 */
1387   {  0,  "CCITT/ITU-T-standardized identification"},
1388   {  2,  "national network identification"},
1389   {  0,  NULL}};
1390
1391 static const value_string isup_network_identification_plan_value[] = {
1392   /* according 3.53/Q.763 */
1393   {  0,  "if CCITT/ITU-T id - unknown"},
1394   {  3,  "if CCITT/ITU-T id - public data network id code (X.121)"},
1395   {  6,  "if CCITT/ITU-T id - public land Mobile Network id code (E.211)"},
1396   {  0,  NULL}};
1397
1398 static const value_string isup_map_type_value[] = {
1399   /* according 3.69/Q.763 */
1400   {  1,  "1544 kbit/s digital path map format (64 kbit/s base rate"},
1401   {  2,  "2048 kbit/s digital path map format (64 kbit/s base rate"},
1402   {  0,  NULL}};
1403
1404 static const value_string isup_auto_congestion_level_value[] = {
1405   /* according 3.4/Q.763 */
1406   {  1,  "Congestion level 1 exceeded"},
1407   {  2,  "Congestion level 2 exceeded"},
1408   {  0,  NULL}};
1409
1410 static const true_false_string isup_inband_information_ind_value = {
1411   /* according 3.37/Q.763 */
1412   "in-band information or an appropriate pattern is now available",
1413   "no indication"
1414 };
1415 static const true_false_string isup_call_diversion_may_occur_ind_value = {
1416   /* according 3.37/Q.763 */
1417   "call diversion may occur",
1418   "no indication"
1419 };
1420 static const true_false_string isup_MLPP_user_ind_value = {
1421   /* according 3.37/Q.763 */
1422   "MLPP user",
1423   "no indication"
1424 };
1425
1426 static const true_false_string isup_access_delivery_ind_value = {
1427   /* according 3.2/Q.763 */
1428   "No set-up message generated",
1429   "Set-up message generated"
1430 };
1431
1432 static const value_string isup_loop_prevention_response_ind_value[] = {
1433   /* according 3.67/Q.763 */
1434   {  0,  "insufficient information"},
1435   {  1,  "no loop exists"},
1436   {  2,  "simultaneous transfer"},
1437   {  0,  NULL}};
1438
1439 static const true_false_string isup_temporary_alternative_routing_ind_value = {
1440   /* according 3.68/Q.763 */
1441   "TAR controlled call",
1442   "no indication"
1443 };
1444 static const true_false_string isup_extension_ind_value = {
1445   /* according 3.68/Q.763 */
1446   "last octet",
1447   "information continues through the next octet"
1448 };
1449
1450
1451
1452 static const value_string isup_call_to_be_diverted_ind_value[] = {
1453   /* according 3.72/Q.763 */
1454   {  0,  "no indication"},
1455   {  1,  "call diversion allowed"},
1456   {  2,  "call diversion not allowed"},
1457   {  3,  "spare"},
1458   {  0,  NULL}};
1459
1460 static const value_string isup_call_to_be_offered_ind_value[] = {
1461   /* according 3.72/Q.763 */
1462   {  0,  "no indication"},
1463   {  1,  "call offering not allowed"},
1464   {  2,  "call offering allowed"},
1465   {  3,  "spare"},
1466   {  0,  NULL}};
1467
1468 static const value_string isup_conference_acceptance_ind_value[] = {
1469   /* according 3.76/Q.763 */
1470   {  0,  "no indication"},
1471   {  1,  "accept conference request"},
1472   {  2,  "reject conference request"},
1473   {  3,  "spare"},
1474   {  0,  NULL}};
1475
1476 static const value_string isup_application_transport_parameter_value[] = {
1477   /* according 3.82/Q.763 */
1478   {  0,  "Unidentified Context and Error Handling (UCEH) ASE"},
1479   {  1,  "PSS1 ASE (VPN)"},
1480   {  2,  "spare"},
1481   {  3,  "Charging ASE"},
1482   {  4,  "GAT"},
1483   {  5,  "BAT ASE"},
1484   {  6,  "Enhanced Unidentified Context and Error Handling ASE (EUCEH ASE)"},
1485   {  0,  NULL}};
1486
1487 static const true_false_string isup_Release_call_indicator_value = {
1488   "release call",
1489   "do not release call"
1490 };
1491
1492 static const true_false_string isup_Send_notification_ind_value = {
1493   "send notification",
1494   "do not send notification"
1495 };
1496 static const value_string isup_APM_segmentation_ind_value[] = {
1497
1498   {  0x00,  "final segment"},
1499   {  0x01,  "number of following segments"},
1500   {  0x02,  "number of following segments"},
1501   {  0x03,  "number of following segments"},
1502   {  0x04,  "number of following segments"},
1503   {  0x05,  "number of following segments"},
1504   {  0x06,  "number of following segments"},
1505   {  0x07,  "number of following segments"},
1506   {  0x08,  "number of following segments"},
1507   {  0x09,  "number of following segments"},
1508   {  0,     NULL}};
1509
1510 static const true_false_string isup_Sequence_ind_value = {
1511   "new sequence",
1512   "subsequent segment to first segment"
1513 };
1514
1515
1516 /* Generalized bit masks for 8 and 16 bits fields */
1517 #define A_8BIT_MASK  0x01
1518 #define B_8BIT_MASK  0x02
1519 #define C_8BIT_MASK  0x04
1520 #define D_8BIT_MASK  0x08
1521 #define E_8BIT_MASK  0x10
1522 #define F_8BIT_MASK  0x20
1523 #define G_8BIT_MASK  0x40
1524 #define H_8BIT_MASK  0x80
1525
1526 #define BA_8BIT_MASK 0x03
1527 #define CB_8BIT_MASK 0x06
1528 #define DC_8BIT_MASK 0x0C
1529 #define ED_8BIT_MASK 0x18
1530 #define FE_8BIT_MASK 0x30
1531 #define GF_8BIT_MASK 0x60
1532 #define HG_8BIT_MASK 0xC0
1533 #define GFE_8BIT_MASK 0x70
1534 #define HGF_8BIT_MASK 0xE0
1535 #define DCBA_8BIT_MASK 0x0F
1536 #define EDCBA_8BIT_MASK 0x1F
1537 #define HGFE_8BIT_MASK 0xF0
1538 #define GFEDCBA_8BIT_MASK 0x7F
1539 #define FEDCBA_8BIT_MASK 0x3F
1540
1541 #define A_16BIT_MASK  0x0100
1542 #define B_16BIT_MASK  0x0200
1543 #define C_16BIT_MASK  0x0400
1544 #define D_16BIT_MASK  0x0800
1545 #define E_16BIT_MASK  0x1000
1546 #define F_16BIT_MASK  0x2000
1547 #define G_16BIT_MASK  0x4000
1548 #define H_16BIT_MASK  0x8000
1549 #define I_16BIT_MASK  0x0001
1550 #define J_16BIT_MASK  0x0002
1551 #define K_16BIT_MASK  0x0004
1552 #define L_16BIT_MASK  0x0008
1553 #define M_16BIT_MASK  0x0010
1554 #define N_16BIT_MASK  0x0020
1555 #define O_16BIT_MASK  0x0040
1556 #define P_16BIT_MASK  0x0080
1557
1558 #define BA_16BIT_MASK 0x0300
1559 #define CB_16BIT_MASK 0x0600
1560 #define DC_16BIT_MASK 0x0C00
1561 #define FE_16BIT_MASK 0x3000
1562 #define HG_16BIT_MASK 0xC000
1563 #define KJ_16BIT_MASK 0x0006
1564 #define PO_16BIT_MASK 0x00C0
1565
1566 #define CBA_16BIT_MASK 0x0700
1567 #define KJI_16BIT_MASK 0x0007
1568 #define HGFE_16BIT_MASK 0xF000
1569 #define PONM_16BIT_MASK 0x00F0
1570
1571 /* Initialize the protocol and registered fields */
1572 static int proto_isup = -1;
1573 static int proto_bicc = -1;
1574 static module_t *isup_module;
1575
1576 static gboolean isup_show_cic_in_info = TRUE;
1577
1578 static int hf_isup_called = -1;
1579 static int hf_isup_calling = -1;
1580 static int hf_isup_redirecting = -1;
1581
1582 static int hf_isup_cic = -1;
1583 static int hf_bicc_cic = -1;
1584
1585 static int isup_tap = -1;
1586
1587 static int hf_isup_message_type = -1;
1588 static int hf_isup_parameter_type = -1;
1589 static int hf_isup_parameter_length = -1;
1590 static int hf_isup_mandatory_variable_parameter_pointer = -1;
1591 static int hf_isup_pointer_to_start_of_optional_part = -1;
1592
1593 static int hf_isup_cvr_rsp_ind = -1;
1594 static int hf_isup_cvr_cg_car_ind = -1;
1595 static int hf_isup_cvr_cg_double_seize = -1;
1596 static int hf_isup_cvr_cg_alarm_car_ind = -1;
1597 static int hf_isup_cvr_cont_chk_ind = -1;
1598
1599 static int hf_isup_satellite_indicator = -1;
1600 static int hf_isup_continuity_check_indicator = -1;
1601 static int hf_isup_echo_control_device_indicator = -1;
1602
1603 static int hf_isup_forw_call_natnl_inatnl_call_indicator = -1;
1604 static int hf_isup_forw_call_end_to_end_method_indicator = -1;
1605 static int hf_isup_forw_call_interworking_indicator = -1;
1606 static int hf_isup_forw_call_end_to_end_info_indicator = -1;
1607 static int hf_isup_forw_call_isdn_user_part_indicator = -1;
1608 static int hf_isup_forw_call_preferences_indicator = -1;
1609 static int hf_isup_forw_call_isdn_access_indicator = -1;
1610 static int hf_isup_forw_call_ported_num_trans_indicator = -1;
1611 static int hf_isup_forw_call_qor_attempt_indicator = -1;
1612 static int hf_isup_forw_call_sccp_method_indicator = -1;
1613
1614 static int hf_isup_calling_partys_category = -1;
1615
1616 static int hf_isup_transmission_medium_requirement = -1;
1617
1618 static int hf_isup_odd_even_indicator = -1;
1619 static int hf_isup_called_party_nature_of_address_indicator = -1;
1620 static int hf_isup_calling_party_nature_of_address_indicator = -1;
1621 static int hf_isup_inn_indicator = -1;
1622 static int hf_isup_ni_indicator = -1;
1623 static int hf_isup_numbering_plan_indicator = -1;
1624 static int hf_isup_address_presentation_restricted_indicator = -1;
1625 static int hf_isup_screening_indicator = -1;
1626 static int hf_isup_screening_indicator_enhanced = -1;
1627 static int hf_isup_called_party_odd_address_signal_digit = -1;
1628 static int hf_isup_calling_party_odd_address_signal_digit = -1;
1629 static int hf_isup_called_party_even_address_signal_digit = -1;
1630 static int hf_isup_calling_party_even_address_signal_digit = -1;
1631
1632 static int hf_isup_generic_name_presentation  = -1;
1633 static int hf_isup_generic_name_availability  = -1;
1634 static int hf_isup_generic_name_type          = -1;
1635 static int hf_isup_generic_name_ia5           = -1;
1636
1637 static int hf_isup_OECD_inf_ind = -1;
1638 static int hf_isup_IECD_inf_ind = -1;
1639 static int hf_isup_OECD_req_ind = -1;
1640 static int hf_isup_IECD_req_ind = -1;
1641
1642 static int hf_isup_calling_party_address_request_indicator = -1;
1643 static int hf_isup_info_req_holding_indicator = -1;
1644 static int hf_isup_calling_partys_category_request_indicator = -1;
1645 static int hf_isup_charge_information_request_indicator = -1;
1646 static int hf_isup_charge_number_nature_of_address_indicator = -1;
1647 static int hf_isup_malicious_call_identification_request_indicator = -1;
1648
1649 static int hf_isup_calling_party_address_response_indicator = -1;
1650 static int hf_isup_hold_provided_indicator = -1;
1651 static int hf_isup_calling_partys_category_response_indicator = -1;
1652 static int hf_isup_charge_information_response_indicator = -1;
1653 static int hf_isup_solicited_indicator = -1;
1654
1655 static int hf_isup_continuity_indicator = -1;
1656
1657 static int hf_isup_backw_call_charge_ind = -1 ;
1658 static int hf_isup_backw_call_called_partys_status_ind = -1;
1659 static int hf_isup_backw_call_called_partys_category_ind = -1;
1660 static int hf_isup_backw_call_end_to_end_method_ind = -1;
1661 static int hf_isup_backw_call_interworking_ind = -1;
1662 static int hf_isup_backw_call_end_to_end_info_ind = -1;
1663 static int hf_isup_backw_call_isdn_user_part_ind = -1;
1664 static int hf_isup_backw_call_holding_ind = -1;
1665 static int hf_isup_backw_call_isdn_access_ind = -1;
1666 static int hf_isup_backw_call_echo_control_device_ind = -1;
1667 static int hf_isup_backw_call_sccp_method_ind = -1;
1668
1669 static int hf_isup_cause_indicator = -1;
1670 static int hf_ansi_isup_cause_indicator = -1;
1671
1672 static int hf_isup_suspend_resume_indicator = -1;
1673
1674 static int hf_isup_range_indicator = -1;
1675 static int hf_isup_cgs_message_type = -1;
1676
1677 static int hf_isup_mtc_blocking_state1 = -1;
1678 static int hf_isup_mtc_blocking_state2 = -1;
1679 static int hf_isup_call_proc_state = -1;
1680 static int hf_isup_hw_blocking_state = -1;
1681
1682 static int hf_isup_event_ind = -1;
1683 static int hf_isup_event_presentation_restricted_ind = -1;
1684
1685 static int hf_isup_cug_call_ind = -1;
1686 static int hf_isup_simple_segmentation_ind = -1;
1687 static int hf_isup_connected_line_identity_request_ind = -1;
1688
1689 static int hf_isup_redirecting_ind = -1;
1690 static int hf_isup_original_redirection_reason = -1;
1691 static int hf_isup_redirection_counter = -1;
1692 static int hf_isup_redirection_reason = -1;
1693
1694 static int hf_isup_type_of_network_identification = -1;
1695 static int hf_isup_network_identification_plan = -1;
1696
1697 static int hf_isup_map_type = -1;
1698
1699 static int hf_isup_automatic_congestion_level               = -1;
1700
1701 static int hf_isup_inband_information_ind                   = -1;
1702 static int hf_isup_call_diversion_may_occur_ind             = -1;
1703 static int hf_isup_mlpp_user_ind                            = -1;
1704
1705 static int hf_isup_UUI_type                                 = -1;
1706 static int hf_isup_UUI_req_service1                         = -1;
1707 static int hf_isup_UUI_req_service2                         = -1;
1708 static int hf_isup_UUI_req_service3                         = -1;
1709 static int hf_isup_UUI_res_service1                         = -1;
1710 static int hf_isup_UUI_res_service2                         = -1;
1711 static int hf_isup_UUI_res_service3                         = -1;
1712 static int hf_isup_UUI_network_discard_ind                  = -1;
1713 static int hf_isup_access_delivery_ind                      = -1;
1714
1715 static int hf_isup_transmission_medium_requirement_prime    = -1;
1716
1717 static int hf_isup_loop_prevention_response_ind             = -1;
1718
1719 static int hf_isup_temporary_alternative_routing_ind        = -1;
1720 static int hf_isup_extension_ind                            = -1;
1721
1722 static int hf_isup_call_to_be_diverted_ind                  = -1;
1723
1724 static int hf_isup_call_to_be_offered_ind                   = -1;
1725
1726 static int hf_isup_conference_acceptance_ind                = -1;
1727
1728 static int hf_isup_transit_at_intermediate_exchange_ind     = -1;
1729 static int hf_isup_Release_call_ind                         = -1;
1730 static int hf_isup_Send_notification_ind                    = -1;
1731 static int hf_isup_Discard_message_ind_value                = -1;
1732 static int hf_isup_Discard_parameter_ind                    = -1;
1733 static int hf_isup_Pass_on_not_possible_indicator           = -1;
1734 static int hf_isup_pass_on_not_possible_indicator2          = -1;
1735 static int hf_isup_Broadband_narrowband_interworking_ind    = -1;
1736 static int hf_isup_Broadband_narrowband_interworking_ind2   = -1;
1737
1738 static int hf_isup_app_cont_ident                   = -1;
1739 static int hf_isup_app_Send_notification_ind        = -1;
1740 static int hf_isup_apm_segmentation_ind             = -1;
1741 static int hf_isup_apm_si_ind                       = -1;
1742 static int hf_isup_apm_slr                          = -1;
1743 static int hf_isup_orig_addr_len                    = -1;
1744 static int hf_isup_dest_addr_len                    = -1;
1745 static int hf_isup_app_Release_call_ind             = -1;
1746 static int hf_isup_cause_location                   = -1;
1747
1748 static int hf_ansi_isup_coding_standard             = -1;
1749
1750 static int hf_length_indicator                      = -1;
1751 static int hf_afi                                   = -1;
1752 static int hf_bicc_nsap_dsp                         = -1;
1753 static int hf_bat_ase_identifier                    = -1;
1754
1755 static int hf_Action_Indicator                      = -1;
1756
1757 static int hf_Instruction_ind_for_general_action       = -1;
1758
1759 static int hf_Send_notification_ind_for_general_action = -1;
1760
1761 static int hf_Instruction_ind_for_pass_on_not_possible = -1;
1762
1763 static int hf_Send_notification_ind_for_pass_on_not_possible = -1;
1764 static int hf_BCTP_Version_Indicator        = -1;
1765 static int hf_Tunnelled_Protocol_Indicator  = -1;
1766 static int hf_TPEI                          = -1;
1767 static int hf_BVEI                          = -1;
1768 static int hf_bncid                         = -1;
1769 static int hf_bat_ase_biwfa                 = -1;
1770 static int hf_characteristics               = -1;
1771
1772 static int hf_Organization_Identifier       = -1;
1773 static int hf_codec_type                    = -1;
1774 static int hf_etsi_codec_type               = -1;
1775 static int hf_active_code_set  = -1;
1776 static int hf_active_code_set_12_2  = -1;
1777 static int hf_active_code_set_10_2  = -1;
1778 static int hf_active_code_set_7_95  = -1;
1779 static int hf_active_code_set_7_40  = -1;
1780 static int hf_active_code_set_6_70  = -1;
1781 static int hf_active_code_set_5_90  = -1;
1782 static int hf_active_code_set_5_15  = -1;
1783 static int hf_active_code_set_4_75  = -1;
1784 static int hf_supported_code_set  = -1;
1785 static int hf_supported_code_set_12_2  = -1;
1786 static int hf_supported_code_set_10_2  = -1;
1787 static int hf_supported_code_set_7_95  = -1;
1788 static int hf_supported_code_set_7_40  = -1;
1789 static int hf_supported_code_set_6_70  = -1;
1790 static int hf_supported_code_set_5_90  = -1;
1791 static int hf_supported_code_set_5_15  = -1;
1792 static int hf_supported_code_set_4_75  = -1;
1793 static int hf_optimisation_mode  = -1;
1794 static int hf_max_codec_modes  = -1;
1795 static int hf_bearer_control_tunneling          = -1;
1796 static int hf_Local_BCU_ID                      = -1;
1797 static int hf_late_cut_trough_cap_ind           = -1;
1798 static int hf_bat_ase_signal                    = -1;
1799 static int hf_bat_ase_duration                  = -1;
1800 static int hf_bat_ase_bearer_redir_ind          = -1;
1801 static int hf_BAT_ASE_Comp_Report_Reason        = -1;
1802 static int hf_BAT_ASE_Comp_Report_ident         = -1;
1803 static int hf_BAT_ASE_Comp_Report_diagnostic    = -1;
1804 static int hf_nsap_ipv4_addr                    = -1;
1805 static int hf_nsap_ipv6_addr                    = -1;
1806 static int hf_iana_icp                          = -1;
1807
1808 static int hf_isup_geo_loc_presentation_restricted_ind  = -1;
1809 static int hf_isup_geo_loc_screening_ind        = -1;
1810
1811 static int hf_isup_apm_msg_fragments = -1;
1812 static int hf_isup_apm_msg_fragment = -1;
1813 static int hf_isup_apm_msg_fragment_overlap = -1;
1814 static int hf_isup_apm_msg_fragment_overlap_conflicts = -1;
1815 static int hf_isup_apm_msg_fragment_multiple_tails = -1;
1816 static int hf_isup_apm_msg_fragment_too_long_fragment = -1;
1817 static int hf_isup_apm_msg_fragment_error = -1;
1818 static int hf_isup_apm_msg_fragment_count = -1;
1819 static int hf_isup_apm_msg_reassembled_in = -1;
1820 static int hf_isup_apm_msg_reassembled_length = -1;
1821
1822 /* Initialize the subtree pointers */
1823 static gint ett_isup                            = -1;
1824 static gint ett_isup_parameter                  = -1;
1825 static gint ett_isup_address_digits             = -1;
1826 static gint ett_isup_pass_along_message         = -1;
1827 static gint ett_isup_circuit_state_ind          = -1;
1828 static gint ett_bat_ase                         = -1;
1829 static gint ett_bicc                            = -1;
1830 static gint ett_bat_ase_element                 = -1;
1831 static gint ett_bat_ase_iwfa                    = -1;
1832 static gint ett_acs                             = -1;
1833 static gint ett_scs                             = -1;
1834
1835 static gint ett_isup_apm_msg_fragment = -1;
1836 static gint ett_isup_apm_msg_fragments = -1;
1837
1838
1839 static dissector_handle_t sdp_handle = NULL;
1840 static dissector_handle_t q931_ie_handle = NULL;
1841
1842 /* Declarations to desegment APM Messages */
1843 static gboolean isup_apm_desegment = TRUE;
1844
1845 static const fragment_items isup_apm_msg_frag_items = {
1846   /* Fragment subtrees */
1847   &ett_isup_apm_msg_fragment,
1848   &ett_isup_apm_msg_fragments,
1849   /* Fragment fields */
1850   &hf_isup_apm_msg_fragments,
1851   &hf_isup_apm_msg_fragment,
1852   &hf_isup_apm_msg_fragment_overlap,
1853   &hf_isup_apm_msg_fragment_overlap_conflicts,
1854   &hf_isup_apm_msg_fragment_multiple_tails,
1855   &hf_isup_apm_msg_fragment_too_long_fragment,
1856   &hf_isup_apm_msg_fragment_error,
1857   &hf_isup_apm_msg_fragment_count,
1858   /* Reassembled in field */
1859   &hf_isup_apm_msg_reassembled_in,
1860   /* Reassembled length field */
1861   &hf_isup_apm_msg_reassembled_length,
1862   /* Tag */
1863   "ISUP APM Message fragments"
1864 };
1865
1866 static GHashTable *isup_apm_msg_fragment_table = NULL;
1867 static GHashTable *isup_apm_msg_reassembled_table = NULL;
1868
1869
1870 static void
1871 isup_apm_defragment_init(void)
1872 {
1873   fragment_table_init (&isup_apm_msg_fragment_table);
1874   reassembled_table_init(&isup_apm_msg_reassembled_table);
1875 }
1876
1877 /* Info for the tap that must be passed between procedures */
1878 static gchar *tap_called_number = NULL;
1879 static gchar *tap_calling_number = NULL;
1880 static guint8 tap_cause_value = 0;
1881
1882 /* ------------------------------------------------------------------
1883   Mapping number to ASCII-character
1884  ------------------------------------------------------------------ */
1885 static char number_to_char(int number)
1886 {
1887   if (number < 10)
1888     return ((char) number + ASCII_NUMBER_DELTA);
1889   else
1890     return ((char) number + ASCII_LETTER_DELTA);
1891 }
1892
1893 /* ------------------------------------------------------------------ */
1894 /* Dissectors for all used parameter types                            */
1895 /* ------------------------------------------------------------------ */
1896 /* argument tvbuff_t contains only parameter-specific length          */
1897 /* length indicator is already dissected in dissect_isup_message() or */
1898 /* dissect_isup_optional_parameter()                                  */
1899 /* ------------------------------------------------------------------ */
1900 /* ------------------------------------------------------------------
1901  Dissector Parameter circuit validation response indicator
1902  */
1903
1904 static void
1905 dissect_isup_cvr_response_ind_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
1906 {
1907   guint8 cvr_response_ind;
1908
1909   cvr_response_ind = tvb_get_guint8(parameter_tvb, 0);
1910   proto_tree_add_uint(parameter_tree, hf_isup_cvr_rsp_ind, parameter_tvb, 0, CVR_RESP_IND_LENGTH, cvr_response_ind );
1911   proto_item_set_text(parameter_item, "Circuit Validation Test Response Indicator: 0x%x", cvr_response_ind );
1912
1913 }
1914
1915 /* ------------------------------------------------------------------
1916    Dissector Parameter circuit validation response - circuit group
1917    characters
1918 */
1919 static void
1920 dissect_isup_circuit_group_char_ind_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
1921 {
1922   guint8 cvr_cg_char_ind;
1923
1924   cvr_cg_char_ind = tvb_get_guint8(parameter_tvb, 0);
1925   proto_tree_add_uint(parameter_tree, hf_isup_cvr_cg_car_ind, parameter_tvb, 0, CG_CHAR_IND_LENGTH, cvr_cg_char_ind );
1926   proto_tree_add_uint(parameter_tree, hf_isup_cvr_cg_double_seize, parameter_tvb, 0, CG_CHAR_IND_LENGTH, cvr_cg_char_ind );
1927   proto_tree_add_uint(parameter_tree, hf_isup_cvr_cg_alarm_car_ind, parameter_tvb, 0, CG_CHAR_IND_LENGTH, cvr_cg_char_ind );
1928   proto_tree_add_uint(parameter_tree, hf_isup_cvr_cont_chk_ind, parameter_tvb, 0, CG_CHAR_IND_LENGTH, cvr_cg_char_ind );
1929
1930   proto_item_set_text(parameter_item, "Circuit Validation Test Response Circuit Group Characteristics: 0x%x", cvr_cg_char_ind );
1931 }
1932
1933 /* ------------------------------------------------------------------
1934  Dissector Parameter nature of connection flags
1935  */
1936 static void
1937 dissect_isup_nature_of_connection_indicators_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
1938 {
1939   guint8 nature_of_connection_ind;
1940
1941   nature_of_connection_ind = tvb_get_guint8(parameter_tvb, 0);
1942   proto_tree_add_uint(parameter_tree, hf_isup_satellite_indicator, parameter_tvb, 0,NATURE_OF_CONNECTION_IND_LENGTH, nature_of_connection_ind);
1943   proto_tree_add_uint(parameter_tree, hf_isup_continuity_check_indicator, parameter_tvb, 0,NATURE_OF_CONNECTION_IND_LENGTH, nature_of_connection_ind);
1944   proto_tree_add_boolean(parameter_tree, hf_isup_echo_control_device_indicator, parameter_tvb, 0,  NATURE_OF_CONNECTION_IND_LENGTH, nature_of_connection_ind);
1945
1946   proto_item_set_text(parameter_item, "Nature of Connection Indicators: 0x%x", nature_of_connection_ind);
1947 }
1948
1949 /* ------------------------------------------------------------------
1950  Dissector Parameter Forward Call Indicators
1951  */
1952 static void
1953 dissect_isup_forward_call_indicators_parameter(tvbuff_t *parameter_tvb,proto_tree *parameter_tree, proto_item *parameter_item)
1954 {
1955   guint16 forward_call_ind;
1956
1957   forward_call_ind = tvb_get_ntohs(parameter_tvb, 0);
1958   proto_tree_add_boolean(parameter_tree, hf_isup_forw_call_natnl_inatnl_call_indicator, parameter_tvb, 0, FORWARD_CALL_IND_LENGTH, forward_call_ind);
1959   proto_tree_add_uint(parameter_tree, hf_isup_forw_call_end_to_end_method_indicator, parameter_tvb, 0, FORWARD_CALL_IND_LENGTH, forward_call_ind);
1960   proto_tree_add_boolean(parameter_tree, hf_isup_forw_call_interworking_indicator, parameter_tvb, 0, FORWARD_CALL_IND_LENGTH, forward_call_ind);
1961   proto_tree_add_boolean(parameter_tree, hf_isup_forw_call_end_to_end_info_indicator, parameter_tvb, 0, FORWARD_CALL_IND_LENGTH, forward_call_ind);
1962   proto_tree_add_boolean(parameter_tree, hf_isup_forw_call_isdn_user_part_indicator, parameter_tvb, 0, FORWARD_CALL_IND_LENGTH, forward_call_ind);
1963   proto_tree_add_uint(parameter_tree, hf_isup_forw_call_preferences_indicator, parameter_tvb, 0, FORWARD_CALL_IND_LENGTH, forward_call_ind);
1964   proto_tree_add_boolean(parameter_tree, hf_isup_forw_call_isdn_access_indicator, parameter_tvb, 0, FORWARD_CALL_IND_LENGTH, forward_call_ind);
1965   proto_tree_add_uint(parameter_tree, hf_isup_forw_call_sccp_method_indicator, parameter_tvb, 0, FORWARD_CALL_IND_LENGTH, forward_call_ind);
1966   proto_tree_add_boolean(parameter_tree, hf_isup_forw_call_ported_num_trans_indicator, parameter_tvb, 0, FORWARD_CALL_IND_LENGTH, forward_call_ind);
1967   proto_tree_add_boolean(parameter_tree, hf_isup_forw_call_qor_attempt_indicator, parameter_tvb, 0, FORWARD_CALL_IND_LENGTH, forward_call_ind);
1968
1969   proto_item_set_text(parameter_item, "Forward Call Indicators: 0x%x", forward_call_ind );
1970 }
1971
1972 /* ------------------------------------------------------------------
1973  Dissector Parameter Calling Party's Category
1974  */
1975 static void
1976 dissect_isup_calling_partys_category_parameter(tvbuff_t *parameter_tvb,proto_tree *parameter_tree, proto_item *parameter_item)
1977 {
1978   guint8 calling_partys_category;
1979
1980   calling_partys_category = tvb_get_guint8(parameter_tvb, 0);
1981   proto_tree_add_uint(parameter_tree, hf_isup_calling_partys_category, parameter_tvb, 0, CALLING_PRTYS_CATEGORY_LENGTH, calling_partys_category);
1982
1983   proto_item_set_text(parameter_item, "Calling Party's category: 0x%x (%s)", calling_partys_category, val_to_str_ext_const(calling_partys_category, &isup_calling_partys_category_value_ext, "reserved/spare"));
1984 }
1985
1986
1987 /* ------------------------------------------------------------------
1988   Dissector Parameter Transmission medium requirement
1989  */
1990 static void
1991 dissect_isup_transmission_medium_requirement_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
1992 {
1993   guint8 transmission_medium_requirement;
1994
1995   transmission_medium_requirement = tvb_get_guint8(parameter_tvb, 0);
1996   proto_tree_add_uint(parameter_tree, hf_isup_transmission_medium_requirement, parameter_tvb, 0, TRANSMISSION_MEDIUM_REQUIREMENT_LENGTH,transmission_medium_requirement);
1997
1998   proto_item_set_text(parameter_item, "Transmission medium requirement: %u (%s)",  transmission_medium_requirement, val_to_str_ext_const(transmission_medium_requirement, &isup_transmission_medium_requirement_value_ext, "spare"));
1999 }
2000 /* ------------------------------------------------------------------
2001   Dissector Parameter Called party number
2002  */
2003 void
2004 dissect_isup_called_party_number_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
2005 {
2006   proto_item *address_digits_item;
2007   proto_tree *address_digits_tree;
2008   proto_item *hidden_item;
2009   guint8 indicators1, indicators2;
2010   guint8 address_digit_pair=0;
2011   gint offset=0;
2012   gint i=0;
2013   gint length;
2014   char called_number[MAXDIGITS + 1]="";
2015   e164_info_t e164_info;
2016   gint number_plan;
2017
2018   indicators1 = tvb_get_guint8(parameter_tvb, 0);
2019   proto_tree_add_boolean(parameter_tree, hf_isup_odd_even_indicator, parameter_tvb, 0, 1, indicators1);
2020   proto_tree_add_uint(parameter_tree, hf_isup_called_party_nature_of_address_indicator, parameter_tvb, 0, 1, indicators1);
2021   indicators2 = tvb_get_guint8(parameter_tvb, 1);
2022   number_plan = (indicators2 & 0x70)>> 4;
2023   proto_tree_add_boolean(parameter_tree, hf_isup_inn_indicator, parameter_tvb, 1, 1, indicators2);
2024   proto_tree_add_uint(parameter_tree, hf_isup_numbering_plan_indicator, parameter_tvb, 1, 1, indicators2);
2025   offset = 2;
2026
2027   if (tvb_reported_length_remaining(parameter_tvb, offset) == 0) {
2028     proto_tree_add_text(parameter_tree, parameter_tvb, offset, 0, "Called Number (empty)");
2029     proto_item_set_text(parameter_item, "Called Number: (empty)");
2030     return;
2031   }
2032
2033   address_digits_item = proto_tree_add_text(parameter_tree, parameter_tvb,
2034                                             offset, -1, "Called Party Number");
2035   address_digits_tree = proto_item_add_subtree(address_digits_item, ett_isup_address_digits);
2036
2037   while((length = tvb_reported_length_remaining(parameter_tvb, offset)) > 0) {
2038     address_digit_pair = tvb_get_guint8(parameter_tvb, offset);
2039     proto_tree_add_uint(address_digits_tree, hf_isup_called_party_odd_address_signal_digit, parameter_tvb, offset, 1, address_digit_pair);
2040     called_number[i++] = number_to_char(address_digit_pair & ISUP_ODD_ADDRESS_SIGNAL_DIGIT_MASK);
2041     if (i > MAXDIGITS)
2042       THROW(ReportedBoundsError);
2043     if ((length - 1) > 0 ){
2044       proto_tree_add_uint(address_digits_tree, hf_isup_called_party_even_address_signal_digit, parameter_tvb, offset, 1, address_digit_pair);
2045       called_number[i++] = number_to_char((address_digit_pair & ISUP_EVEN_ADDRESS_SIGNAL_DIGIT_MASK) / 0x10);
2046       if (i > MAXDIGITS)
2047         THROW(ReportedBoundsError);
2048     }
2049     offset++;
2050   }
2051   if  (((indicators1 & 0x80) == 0) && (tvb_length(parameter_tvb) > 0)) { /* Even Indicator set -> last even digit is valid */
2052     proto_tree_add_uint(address_digits_tree, hf_isup_called_party_even_address_signal_digit, parameter_tvb, offset - 1, 1, address_digit_pair);
2053     called_number[i++] = number_to_char((address_digit_pair & ISUP_EVEN_ADDRESS_SIGNAL_DIGIT_MASK) / 0x10);
2054     if (i > MAXDIGITS)
2055       THROW(ReportedBoundsError);
2056   }
2057
2058   called_number[i++] = '\0';
2059   proto_item_set_text(address_digits_item, "Called Party Number: %s", called_number);
2060   proto_item_set_text(parameter_item, "Called Party Number: %s", called_number);
2061   if ( number_plan == 1 ) {
2062     e164_info.e164_number_type = CALLED_PARTY_NUMBER;
2063     e164_info.nature_of_address = indicators1 & 0x7f;
2064     e164_info.E164_number_str = called_number;
2065     e164_info.E164_number_length = i - 1;
2066     dissect_e164_number(parameter_tvb, address_digits_tree, 2, (offset - 2), e164_info);
2067     hidden_item = proto_tree_add_string(address_digits_tree, hf_isup_called, parameter_tvb,
2068                                         offset - length, length, called_number);
2069     PROTO_ITEM_SET_HIDDEN(hidden_item);
2070   } else {
2071     proto_tree_add_string(address_digits_tree, hf_isup_called, parameter_tvb,
2072                           offset - length, length, called_number);
2073   }
2074   tap_called_number = ep_strdup(called_number);
2075 }
2076 /* ------------------------------------------------------------------
2077   Dissector Parameter  Subsequent number
2078  */
2079 static void
2080 dissect_isup_subsequent_number_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
2081 {
2082   proto_item *address_digits_item;
2083   proto_tree *address_digits_tree;
2084   guint8 indicators1;
2085   guint8 address_digit_pair=0;
2086   gint offset=0;
2087   gint i=0;
2088   gint length;
2089   char called_number[MAXDIGITS + 1]="";
2090
2091   indicators1 = tvb_get_guint8(parameter_tvb, 0);
2092   proto_tree_add_boolean(parameter_tree, hf_isup_odd_even_indicator, parameter_tvb, 0, 1, indicators1);
2093   offset = 1;
2094
2095   address_digits_item = proto_tree_add_text(parameter_tree, parameter_tvb,
2096                                             offset, -1,
2097                                             "Subsequent Number");
2098   address_digits_tree = proto_item_add_subtree(address_digits_item, ett_isup_address_digits);
2099
2100   while((length = tvb_reported_length_remaining(parameter_tvb, offset)) > 0){
2101     address_digit_pair = tvb_get_guint8(parameter_tvb, offset);
2102     proto_tree_add_uint(address_digits_tree, hf_isup_called_party_odd_address_signal_digit, parameter_tvb, offset, 1, address_digit_pair);
2103     called_number[i++] = number_to_char(address_digit_pair & ISUP_ODD_ADDRESS_SIGNAL_DIGIT_MASK);
2104     if (i > MAXDIGITS)
2105       THROW(ReportedBoundsError);
2106     if ((length - 1) > 0 ){
2107       proto_tree_add_uint(address_digits_tree, hf_isup_called_party_even_address_signal_digit, parameter_tvb, offset, 1, address_digit_pair);
2108       called_number[i++] = number_to_char((address_digit_pair & ISUP_EVEN_ADDRESS_SIGNAL_DIGIT_MASK) / 0x10);
2109       if (i > MAXDIGITS)
2110         THROW(ReportedBoundsError);
2111     }
2112     offset++;
2113   }
2114
2115   if (((indicators1 & 0x80) == 0) && (tvb_length(parameter_tvb) > 0)){ /* Even Indicator set -> last even digit is valid & has be displayed */
2116       proto_tree_add_uint(address_digits_tree, hf_isup_called_party_even_address_signal_digit, parameter_tvb, offset - 1, 1, address_digit_pair);
2117       called_number[i++] = number_to_char((address_digit_pair & ISUP_EVEN_ADDRESS_SIGNAL_DIGIT_MASK) / 0x10);
2118       if (i > MAXDIGITS)
2119         THROW(ReportedBoundsError);
2120   }
2121   called_number[i++] = '\0';
2122
2123   proto_item_set_text(address_digits_item, "Subsequent Number: %s", called_number);
2124   proto_item_set_text(parameter_item, "Subsequent Number: %s", called_number);
2125
2126 }
2127 /* ------------------------------------------------------------------
2128   Dissector Parameter Information Request Indicators
2129  */
2130 static void
2131 dissect_isup_information_request_indicators_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
2132 {
2133   guint16 information_request_indicators;
2134
2135   information_request_indicators = tvb_get_ntohs(parameter_tvb, 0);
2136   proto_tree_add_boolean(parameter_tree, hf_isup_calling_party_address_request_indicator, parameter_tvb, 0, INFO_REQUEST_IND_LENGTH,  information_request_indicators);
2137   proto_tree_add_boolean(parameter_tree, hf_isup_info_req_holding_indicator, parameter_tvb, 0, INFO_REQUEST_IND_LENGTH,  information_request_indicators);
2138   proto_tree_add_boolean(parameter_tree, hf_isup_calling_partys_category_request_indicator, parameter_tvb, 0, INFO_REQUEST_IND_LENGTH,  information_request_indicators);
2139   proto_tree_add_boolean(parameter_tree, hf_isup_charge_information_request_indicator, parameter_tvb, 0, INFO_REQUEST_IND_LENGTH,  information_request_indicators);
2140   proto_tree_add_boolean(parameter_tree, hf_isup_malicious_call_identification_request_indicator, parameter_tvb, 0, INFO_REQUEST_IND_LENGTH,  information_request_indicators);
2141
2142
2143   proto_item_set_text(parameter_item, "Information request indicators: 0x%x", information_request_indicators);
2144 }
2145 /* ------------------------------------------------------------------
2146   Dissector Parameter Information Indicators
2147  */
2148 static void
2149 dissect_isup_information_indicators_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
2150 {
2151   guint16 information_indicators;
2152
2153   information_indicators = tvb_get_ntohs(parameter_tvb, 0);
2154   proto_tree_add_uint(parameter_tree, hf_isup_calling_party_address_response_indicator, parameter_tvb, 0, INFO_IND_LENGTH,  information_indicators);
2155   proto_tree_add_boolean(parameter_tree, hf_isup_hold_provided_indicator, parameter_tvb, 0, INFO_IND_LENGTH,  information_indicators);
2156   proto_tree_add_boolean(parameter_tree, hf_isup_calling_partys_category_response_indicator, parameter_tvb, 0, INFO_IND_LENGTH,  information_indicators);
2157   proto_tree_add_boolean(parameter_tree, hf_isup_charge_information_response_indicator, parameter_tvb, 0, INFO_IND_LENGTH,  information_indicators);
2158   proto_tree_add_boolean(parameter_tree, hf_isup_solicited_indicator, parameter_tvb, 0, INFO_IND_LENGTH,  information_indicators);
2159
2160
2161   proto_item_set_text(parameter_item, "Information indicators: 0x%x", information_indicators);
2162 }
2163 /* ------------------------------------------------------------------
2164   Dissector Parameter Continuity Indicators
2165  */
2166 static void
2167 dissect_isup_continuity_indicators_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
2168 {
2169   guint8 continuity_indicators;
2170
2171   continuity_indicators = tvb_get_guint8(parameter_tvb, 0);
2172   proto_tree_add_boolean(parameter_tree, hf_isup_continuity_indicator, parameter_tvb, 0, CONTINUITY_IND_LENGTH,  continuity_indicators);
2173
2174   proto_item_set_text(parameter_item, "Continuity indicators: 0x%x", continuity_indicators);
2175 }
2176 /* ------------------------------------------------------------------
2177  Dissector Parameter Backward Call Indicators
2178  */
2179 static void
2180 dissect_isup_backward_call_indicators_parameter(tvbuff_t *parameter_tvb,proto_tree *parameter_tree, proto_item *parameter_item)
2181 {
2182   guint16 backward_call_ind;
2183
2184   backward_call_ind = tvb_get_ntohs(parameter_tvb, 0);
2185
2186
2187   proto_tree_add_uint(parameter_tree, hf_isup_backw_call_charge_ind, parameter_tvb, 0, BACKWARD_CALL_IND_LENGTH, backward_call_ind);
2188   proto_tree_add_uint(parameter_tree, hf_isup_backw_call_called_partys_status_ind, parameter_tvb, 0, BACKWARD_CALL_IND_LENGTH, backward_call_ind);
2189   proto_tree_add_uint(parameter_tree, hf_isup_backw_call_called_partys_category_ind, parameter_tvb, 0, BACKWARD_CALL_IND_LENGTH, backward_call_ind);
2190   proto_tree_add_uint(parameter_tree, hf_isup_backw_call_end_to_end_method_ind, parameter_tvb, 0, BACKWARD_CALL_IND_LENGTH, backward_call_ind);
2191   proto_tree_add_boolean(parameter_tree, hf_isup_backw_call_interworking_ind, parameter_tvb, 0, BACKWARD_CALL_IND_LENGTH, backward_call_ind);
2192   proto_tree_add_boolean(parameter_tree, hf_isup_backw_call_end_to_end_info_ind, parameter_tvb, 0, BACKWARD_CALL_IND_LENGTH, backward_call_ind);
2193   proto_tree_add_boolean(parameter_tree, hf_isup_backw_call_isdn_user_part_ind, parameter_tvb, 0, BACKWARD_CALL_IND_LENGTH, backward_call_ind);
2194   proto_tree_add_boolean(parameter_tree, hf_isup_backw_call_holding_ind, parameter_tvb, 0, BACKWARD_CALL_IND_LENGTH,  backward_call_ind);
2195   proto_tree_add_boolean(parameter_tree, hf_isup_backw_call_isdn_access_ind, parameter_tvb, 0, BACKWARD_CALL_IND_LENGTH, backward_call_ind);
2196   proto_tree_add_boolean(parameter_tree, hf_isup_backw_call_echo_control_device_ind, parameter_tvb, 0, BACKWARD_CALL_IND_LENGTH, backward_call_ind);
2197   proto_tree_add_uint(parameter_tree, hf_isup_backw_call_sccp_method_ind, parameter_tvb, 0, BACKWARD_CALL_IND_LENGTH, backward_call_ind);
2198
2199   proto_item_set_text(parameter_item, "Backward Call Indicators: 0x%x", backward_call_ind);
2200 }
2201 /* ------------------------------------------------------------------
2202   Dissector Parameter Cause Indicators - no detailed dissection since defined in Rec. Q.850
2203  */
2204
2205 /*
2206  * Cause codes for Cause.
2207  * The decoding of cause indicators parameter field are defined in ITU-T
2208  * Recommendation Q.850; those are different from the ones in the Q.931
2209  * dissector, as that has some values not specified by the standard but
2210  * that appear to be used for purposes other than the ones in Q.850.
2211  */
2212   /* The table is "filled" with "unassigned" to make full use of value_string_ext */
2213 static const value_string q850_cause_code_vals[] = {
2214   { 0x00,  "Valid cause code not yet received" },
2215   { 0x01,  "Unallocated (unassigned) number" },
2216   { 0x02,  "No route to specified transit network" },
2217   { 0x03,  "No route to destination" },
2218   { 0x04,  "Send special information tone" },
2219   { 0x05,  "Misdialled trunk prefix" },
2220   { 0x06,  "Channel unacceptable" },
2221   { 0x07,  "Call awarded and being delivered in an established channel" },
2222   { 0x08,  "Preemption" },
2223   { 0x09,  "Preemption - circuit reserved for reuse" },
2224   { 0x0A,  "Unassigned" },
2225   { 0x0B,  "Unassigned" },
2226   { 0x0C,  "Unassigned" },
2227   { 0x0D,  "Unassigned" },
2228   { 0x0E,  "QoR: ported number" },
2229   { 0x0F,  "Unassigned" },
2230   { 0x10,  "Normal call clearing" },
2231   { 0x11,  "User busy" },
2232   { 0x12,  "No user responding" },
2233   { 0x13,  "No answer from user (user alerted)" },
2234   { 0x14,  "Subscriber absent" },
2235   { 0x15,  "Call rejected" },
2236   { 0x16,  "Number changed" },
2237   { 0x17,  "Redirection to new destination" },
2238   { 0x18,  "Call rejected due to feature at the destination" },
2239   { 0x19,  "Exchange routing error" },
2240   { 0x1A,  "Non-selected user clearing" },
2241   { 0x1B,  "Destination out of order" },
2242   { 0x1C,  "Invalid number format (address incomplete)" },
2243   { 0x1D,  "Facility rejected" },
2244   { 0x1E,  "Response to STATUS ENQUIRY" },
2245   { 0x1F,  "Normal unspecified" },
2246   { 0x20,  "Unassigned" },
2247   { 0x21,  "Circuit out of order" },
2248   { 0x22,  "No circuit/channel available" },
2249   { 0x23,  "Unassigned" },
2250   { 0x24,  "Unassigned" },
2251   { 0x25,  "Unassigned" },
2252   { 0x26,  "Network out of order" },
2253   { 0x27,  "Permanent frame mode connection out of service" },
2254   { 0x28,  "Permanent frame mode connection operational" },
2255   { 0x29,  "Temporary failure" },
2256   { 0x2A,  "Switching equipment congestion" },
2257   { 0x2B,  "Access information discarded" },
2258   { 0x2C,  "Requested circuit/channel not available" },
2259   { 0x2D,  "Unassigned" },
2260   { 0x2E,  "Precedence call blocked" },
2261   { 0x2F,  "Resources unavailable, unspecified" },
2262   { 0x30,  "Unassigned" },
2263   { 0x31,  "Quality of service unavailable" },
2264   { 0x32,  "Requested facility not subscribed" },
2265   { 0x33,  "Unassigned" },
2266   { 0x34,  "Unassigned" },
2267   { 0x35,  "Outgoing calls barred within CUG" },
2268   { 0x36,  "Unassigned" },
2269   { 0x37,  "Incoming calls barred within CUG" },
2270   { 0x38,  "Call waiting not subscribed" },
2271   { 0x39,  "Bearer capability not authorized" },
2272   { 0x3A,  "Bearer capability not presently available" },
2273   { 0x3B,  "Unassigned" },
2274   { 0x3C,  "Unassigned" },
2275   { 0x3D,  "Unassigned" },
2276   { 0x3E,  "Inconsistency in designated outgoing access information and subscriber class" },
2277   { 0x3F,  "Service or option not available, unspecified" },
2278   { 0x40,  "Unassigned" },
2279   { 0x41,  "Bearer capability not implemented" },
2280   { 0x42,  "Channel type not implemented" },
2281   { 0x43,  "Unassigned" },
2282   { 0x44,  "Unassigned" },
2283   { 0x45,  "Requested facility not implemented" },
2284   { 0x46,  "Only restricted digital information bearer capability is available" },
2285   { 0x47,  "Unassigned" },
2286   { 0x48,  "Unassigned" },
2287   { 0x49,  "Unassigned" },
2288   { 0x4A,  "Unassigned" },
2289   { 0x4B,  "Unassigned" },
2290   { 0x4C,  "Unassigned" },
2291   { 0x4D,  "Unassigned" },
2292   { 0x4E,  "Unassigned" },
2293   { 0x4F,  "Service or option not implemented, unspecified" },
2294   { 0x50,  "Unassigned" },
2295   { 0x51,  "Invalid call reference value" },
2296   { 0x52,  "Identified channel does not exist" },
2297   { 0x53,  "Call identity does not exist for suspended call" },
2298   { 0x54,  "Call identity in use" },
2299   { 0x55,  "No call suspended" },
2300   { 0x56,  "Call having the requested call identity has been cleared" },
2301   { 0x57,  "Called user not member of CUG" },
2302   { 0x58,  "Incompatible destination" },
2303   { 0x59,  "Unassigned" },
2304   { 0x5A,  "Non-existing CUG" },
2305   { 0x5B,  "Invalid transit network selection (national use)" },
2306   { 0x5C,  "Unassigned" },
2307   { 0x5D,  "Unassigned" },
2308   { 0x5E,  "Unassigned" },
2309   { 0x5F,  "Invalid message, unspecified" },
2310   { 0x60,  "Mandatory information element is missing" },
2311   { 0x61,  "Message type non-existent or not implemented" },
2312   { 0x62,  "Message not compatible with call state or message type non-existent or not implemented" },
2313   { 0x63,  "Information element nonexistent or not implemented" },
2314   { 0x64,  "Invalid information element contents" },
2315   { 0x65,  "Message not compatible with call state" },
2316   { 0x66,  "Recovery on timer expiry" },
2317   { 0x67,  "Parameter non-existent or not implemented - passed on" },
2318   { 0x68,  "Unassigned" },
2319   { 0x69,  "Unassigned" },
2320   { 0x6A,  "Unassigned" },
2321   { 0x6B,  "Unassigned" },
2322   { 0x6C,  "Unassigned" },
2323   { 0x6D,  "Unassigned" },
2324   { 0x6E,  "Message with unrecognized parameter discarded" },
2325   { 0x6F,  "Protocol error, unspecified" },
2326   { 0x70,  "Unassigned" },
2327   { 0x71,  "Unassigned" },
2328   { 0x72,  "Unassigned" },
2329   { 0x73,  "Unassigned" },
2330   { 0x74,  "Unassigned" },
2331   { 0x75,  "Unassigned" },
2332   { 0x76,  "Unassigned" },
2333   { 0x77,  "Unassigned" },
2334   { 0x78,  "Unassigned" },
2335   { 0x79,  "Unassigned" },
2336   { 0x7A,  "Unassigned" },
2337   { 0x7B,  "Unassigned" },
2338   { 0x7C,  "Unassigned" },
2339   { 0x7D,  "Unassigned" },
2340   { 0x7E,  "Unassigned" },
2341   { 0x7F,  "Internetworking, unspecified" },
2342   { 0,  NULL }
2343 };
2344 value_string_ext q850_cause_code_vals_ext = VALUE_STRING_EXT_INIT(q850_cause_code_vals);
2345
2346 static const value_string ansi_isup_cause_code_vals[] = {
2347   { 0x00,  "Valid cause code not yet received" },
2348   { 0x01,  "Unallocated (unassigned) number" },
2349   { 0x02,  "No route to specified transit network" },
2350   { 0x03,  "No route to destination" },
2351   { 0x04,  "Send special information tone" },
2352   { 0x05,  "Misdialled trunk prefix" },
2353   { 0x06,  "Channel unacceptable" },
2354   { 0x07,  "Call awarded and being delivered in an established channel" },
2355   { 0x08,  "Preemption" },
2356   { 0x09,  "Preemption - circuit reserved for reuse" },
2357   { 0x0A,  "Unassigned" },
2358   { 0x0B,  "Unassigned" },
2359   { 0x0C,  "Unassigned" },
2360   { 0x0D,  "Unassigned" },
2361   { 0x0E,  "QoR: ported number" },
2362   { 0x0F,  "Unassigned" },
2363   { 0x10,  "Normal call clearing" },
2364   { 0x11,  "User busy" },
2365   { 0x12,  "No user responding" },
2366   { 0x13,  "No answer from user (user alerted)" },
2367   { 0x14,  "Subscriber absent" },
2368   { 0x15,  "Call rejected" },
2369   { 0x16,  "Number changed" },
2370   { 0x17,  "Unallocated destination number" },
2371   { 0X18,  "Undefined business group" },
2372   { 0x19,  "Exchange routing error" },
2373   { 0x1A,  "Non-selected user clearing" },
2374   { 0x1B,  "Destination out of order" },
2375   { 0x1C,  "Invalid number format (address incomplete)" },
2376   { 0x1D,  "Facility rejected" },
2377   { 0x1E,  "Response to STATUS ENQUIRY" },
2378   { 0x1F,  "Normal unspecified" },
2379   { 0x20,  "Unassigned" },
2380   { 0x21,  "Circuit out of order" },
2381   { 0x22,  "No circuit/channel available" },
2382   { 0x23,  "Unassigned" },
2383   { 0x24,  "Unassigned" },
2384   { 0x25,  "Unassigned" },
2385   { 0x26,  "Network out of order" },
2386   { 0x27,  "Permanent frame mode connection out of service" },
2387   { 0x28,  "Permanent frame mode connection operational" },
2388   { 0x29,  "Temporary failure" },
2389   { 0x2A,  "Switching equipment congestion" },
2390   { 0x2B,  "Access information discarded" },
2391   { 0x2C,  "Requested circuit/channel not available" },
2392   { 0x2D,  "Preemption" },
2393   { 0x2E,  "Precedence call blocked" },
2394   { 0x2F,  "Resources unavailable, unspecified" },
2395   { 0x30,  "Unassigned" },
2396   { 0x31,  "Quality of service unavailable" },
2397   { 0x32,  "Requested facility not subscribed" },
2398   { 0x33,  "Call type incompatible with service request" },
2399   { 0x34,  "Unassigned" },
2400   { 0x35,  "Outgoing calls barred within CUG" },
2401   { 0x36,  "Call blocked due to group restriction" },
2402   { 0x37,  "Incoming calls barred within CUG" },
2403   { 0x38,  "Call waiting not subscribed" },
2404   { 0x39,  "Bearer capability not authorized" },
2405   { 0x3A,  "Bearer capability not presently available" },
2406   { 0x3B,  "Unassigned" },
2407   { 0x3C,  "Unassigned" },
2408   { 0x3D,  "Unassigned" },
2409   { 0x3E,  "Inconsistency in designated outgoing access information and subscriber class" },
2410   { 0x3F,  "Service or option not available, unspecified" },
2411   { 0x40,  "Unassigned" },
2412   { 0x41,  "Bearer capability not implemented" },
2413   { 0x42,  "Channel type not implemented" },
2414   { 0x43,  "Unassigned" },
2415   { 0x44,  "Unassigned" },
2416   { 0x45,  "Requested facility not implemented" },
2417   { 0x46,  "Only restricted digital information bearer capability is available" },
2418   { 0x47,  "Unassigned" },
2419   { 0x48,  "Unassigned" },
2420   { 0x49,  "Unassigned" },
2421   { 0x4A,  "Unassigned" },
2422   { 0x4B,  "Unassigned" },
2423   { 0x4C,  "Unassigned" },
2424   { 0x4D,  "Unassigned" },
2425   { 0x4E,  "Unassigned" },
2426   { 0x4F,  "Service or option not implemented, unspecified" },
2427   { 0x50,  "Unassigned" },
2428   { 0x51,  "Invalid call reference value" },
2429   { 0x52,  "Identified channel does not exist" },
2430   { 0x53,  "Call identity does not exist for suspended call" },
2431   { 0x54,  "Call identity in use" },
2432   { 0x55,  "No call suspended" },
2433   { 0x56,  "Call having the requested call identity has been cleared" },
2434   { 0x57,  "Called user not member of CUG" },
2435   { 0x58,  "Incompatible destination" },
2436   { 0x59,  "Unassigned" },
2437   { 0x5A,  "Non-existing CUG" },
2438   { 0x5B,  "Invalid transit network selection (national use)" },
2439   { 0x5C,  "Unassigned" },
2440   { 0x5D,  "Unassigned" },
2441   { 0x5E,  "Unassigned" },
2442   { 0x5F,  "Invalid message, unspecified" },
2443   { 0x60,  "Mandatory information element is missing" },
2444   { 0x61,  "Message type non-existent or not implemented" },
2445   { 0x62,  "Message not compatible with call state or message type non-existent or not implemented" },
2446   { 0x63,  "Information element nonexistent or not implemented" },
2447   { 0x64,  "Invalid information element contents" },
2448   { 0x65,  "Message not compatible with call state" },
2449   { 0x66,  "Recovery on timer expiry" },
2450   { 0x67,  "Parameter non-existent or not implemented - passed on" },
2451   { 0x68,  "Unassigned" },
2452   { 0x69,  "Unassigned" },
2453   { 0x6A,  "Unassigned" },
2454   { 0x6B,  "Unassigned" },
2455   { 0x6C,  "Unassigned" },
2456   { 0x6D,  "Unassigned" },
2457   { 0x6E,  "Message with unrecognized parameter discarded" },
2458   { 0x6F,  "Protocol error, unspecified" },
2459   { 0x70,  "Unassigned" },
2460   { 0x71,  "Unassigned" },
2461   { 0x72,  "Unassigned" },
2462   { 0x73,  "Unassigned" },
2463   { 0x74,  "Unassigned" },
2464   { 0x75,  "Unassigned" },
2465   { 0x76,  "Unassigned" },
2466   { 0x77,  "Unassigned" },
2467   { 0x78,  "Unassigned" },
2468   { 0x79,  "Unassigned" },
2469   { 0x7A,  "Unassigned" },
2470   { 0x7B,  "Unassigned" },
2471   { 0x7C,  "Unassigned" },
2472   { 0x7D,  "Unassigned" },
2473   { 0x7E,  "Unassigned" },
2474   { 0x7F,  "Internetworking, unspecified" },
2475   { 0,  NULL }
2476 };
2477 static value_string_ext ansi_isup_cause_code_vals_ext = VALUE_STRING_EXT_INIT(ansi_isup_cause_code_vals);
2478
2479 static const value_string ansi_isup_coding_standard_vals[] = {
2480   { 0, "CCITT Standard" },
2481   { 1, "Reserved for other international standards" },
2482   { 2, "ANSI Standard" },
2483   { 3, "Reserved" },
2484   { 0,  NULL }
2485 };
2486 void
2487 dissect_isup_cause_indicators_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
2488 { guint length = tvb_reported_length(parameter_tvb);
2489   proto_tree_add_text(parameter_tree, parameter_tvb,0, -1, "Cause indicators (-> Q.850)");
2490   dissect_q931_cause_ie(parameter_tvb,0,length,
2491                         parameter_tree,
2492                         hf_isup_cause_indicator, &tap_cause_value, isup_parameter_type_value);
2493   proto_item_set_text(parameter_item, "Cause indicators, see Q.850 (%u byte%s length)", length , plurality(length, "", "s"));
2494 }
2495
2496 static void
2497 dissect_ansi_isup_cause_indicators_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
2498 {
2499   guint8 coding_standard;
2500   guint8 cause_value;
2501   int offset = 0;
2502   guint length = tvb_reported_length(parameter_tvb);
2503
2504   coding_standard = (tvb_get_guint8(parameter_tvb, offset)&0x60)>>5;
2505
2506   switch (coding_standard) {
2507     case 0:
2508       /*CCITT*/
2509       proto_tree_add_item(parameter_tree, hf_isup_cause_location, parameter_tvb, offset, 1, ENC_BIG_ENDIAN);
2510       proto_tree_add_item(parameter_tree, hf_ansi_isup_coding_standard, parameter_tvb, offset, 1, ENC_BIG_ENDIAN);
2511       proto_tree_add_item(parameter_tree, hf_isup_extension_ind, parameter_tvb, offset, 1, ENC_BIG_ENDIAN);
2512       offset ++;
2513       length--;
2514       if (length == 0)
2515         return;
2516       proto_tree_add_item(parameter_tree, hf_isup_cause_indicator, parameter_tvb, offset, 1, ENC_BIG_ENDIAN);
2517       cause_value=tvb_get_guint8(parameter_tvb, offset)&0x7f;
2518       offset ++;
2519       length--;
2520       proto_item_set_text(parameter_item, "Cause indicators: %s (%u)", val_to_str_ext_const(cause_value, &q850_cause_code_vals_ext, "spare"),cause_value );
2521       if (length == 0) {
2522         return;
2523       }
2524       proto_tree_add_text(parameter_tree, parameter_tvb, offset,
2525                           length, "Diagnostic: %s",
2526                           tvb_bytes_to_str(parameter_tvb, offset, length));
2527       return;
2528     case 2:
2529       /*ANSI*/
2530       proto_tree_add_item(parameter_tree, hf_isup_cause_location, parameter_tvb, offset, 1, ENC_BIG_ENDIAN);
2531       proto_tree_add_item(parameter_tree, hf_ansi_isup_coding_standard, parameter_tvb, offset, 1, ENC_BIG_ENDIAN);
2532       proto_tree_add_item(parameter_tree, hf_isup_extension_ind, parameter_tvb, offset, 1, ENC_BIG_ENDIAN);
2533       offset ++;
2534       length--;
2535       if (length == 0)
2536         return;
2537       proto_tree_add_item(parameter_tree, hf_ansi_isup_cause_indicator, parameter_tvb, offset, 1, ENC_BIG_ENDIAN);
2538       cause_value=tvb_get_guint8(parameter_tvb, offset)&0x7f;
2539       proto_item_set_text(parameter_item, "Cause indicators: %s (%u)",
2540                           val_to_str_ext_const(cause_value, &ansi_isup_cause_code_vals_ext, "spare"),
2541                           cause_value );
2542       offset ++;
2543       length--;
2544       if (length == 0) {
2545         return;
2546       }
2547       proto_tree_add_text(parameter_tree, parameter_tvb, offset,
2548                           length, "Diagnostic: %s",
2549                           tvb_bytes_to_str(parameter_tvb, offset, length));
2550       return;
2551     default:
2552       proto_tree_add_item(parameter_tree, hf_ansi_isup_coding_standard, parameter_tvb, offset, 1, ENC_BIG_ENDIAN);
2553       proto_tree_add_item(parameter_tree, hf_isup_extension_ind, parameter_tvb, offset, 1, ENC_BIG_ENDIAN);
2554       break;
2555   }
2556   proto_item_set_text(parameter_item, "Cause indicators(%u byte%s length)", length , plurality(length, "", "s"));
2557 }
2558
2559 /* ------------------------------------------------------------------
2560   Dissector Parameter Suspend/Resume Indicators
2561  */
2562 static void
2563 dissect_isup_suspend_resume_indicators_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
2564 {
2565   guint8 indicators;
2566
2567   indicators = tvb_get_guint8(parameter_tvb, 0);
2568   proto_tree_add_boolean(parameter_tree, hf_isup_suspend_resume_indicator, parameter_tvb, 0, SUSPEND_RESUME_IND_LENGTH,  indicators);
2569
2570   proto_item_set_text(parameter_item, "Suspend/Resume indicator: 0x%x", indicators);
2571 }
2572 /* ------------------------------------------------------------------
2573   Dissector Parameter Range and Status Indicators
2574  */
2575 static void
2576 dissect_isup_range_and_status_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
2577 {
2578   guint8 range, actual_status_length;
2579
2580   range = tvb_get_guint8(parameter_tvb, 0);
2581   proto_tree_add_uint_format(parameter_tree, hf_isup_range_indicator, parameter_tvb, 0, RANGE_LENGTH, range, "Range: %u", range);
2582   actual_status_length = tvb_reported_length_remaining(parameter_tvb, RANGE_LENGTH);
2583   if (actual_status_length > 0)
2584     proto_tree_add_text(parameter_tree, parameter_tvb , RANGE_LENGTH, -1, "Status subfield");
2585   else
2586     proto_tree_add_text(parameter_tree, parameter_tvb , 0, 0, "Status subfield is not present with this message type");
2587
2588
2589   proto_item_set_text(parameter_item, "Range (%u) and status", range);
2590 }
2591 /* ------------------------------------------------------------------
2592   Dissector Parameter Circuit group supervision message type
2593  */
2594 static void
2595 dissect_isup_circuit_group_supervision_message_type_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
2596 {
2597   guint8 cgs_message_type;
2598
2599   cgs_message_type = tvb_get_guint8(parameter_tvb, 0);
2600   proto_tree_add_uint(parameter_tree, hf_isup_cgs_message_type, parameter_tvb, 0, CIRC_GRP_SV_MSG_TYPE_LENGTH, cgs_message_type);
2601
2602   proto_item_set_text(parameter_item, "Circuit group supervision message type: %s (%u)"  ,val_to_str(cgs_message_type, isup_cgs_message_type_value,"unknown"), cgs_message_type);
2603 }
2604 /* ------------------------------------------------------------------
2605   Dissector Parameter Facility indicator parameter
2606  */
2607 static void
2608 dissect_isup_facility_ind_parameter(tvbuff_t *parameter_tvb, proto_item *parameter_item)
2609 {
2610   guint8 indicator;
2611
2612   indicator = tvb_get_guint8(parameter_tvb, 0);
2613
2614   proto_item_set_text(parameter_item, "Facility indicator: %s (%u)"  ,val_to_str(indicator, isup_facility_ind_value,"spare"), indicator);
2615 }
2616 /* ------------------------------------------------------------------
2617   Dissector Parameter Circuit state indicator
2618  */
2619 static void
2620 dissect_isup_circuit_state_ind_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
2621 {
2622   proto_item *circuit_state_item;
2623   proto_tree *circuit_state_tree;
2624   guint8 circuit_state;
2625   gint offset=0;
2626   gint i=0;
2627
2628   while(tvb_reported_length_remaining(parameter_tvb, offset) > 0){
2629     circuit_state_item = proto_tree_add_text(parameter_tree, parameter_tvb,
2630                                              offset, -1,
2631                                              "Circuit# CIC+%u state", i);
2632     circuit_state_tree = proto_item_add_subtree(circuit_state_item, ett_isup_circuit_state_ind);
2633     circuit_state = tvb_get_guint8(parameter_tvb, offset);
2634     if ((circuit_state & DC_8BIT_MASK) == 0){
2635       proto_tree_add_uint(circuit_state_tree, hf_isup_mtc_blocking_state1, parameter_tvb, offset, 1, circuit_state);
2636       proto_item_set_text(circuit_state_item, "Circuit# CIC+%u state: %s", i++, val_to_str(circuit_state&BA_8BIT_MASK, isup_mtc_blocking_state_DC00_value, "unknown"));
2637     }
2638     else {
2639       proto_tree_add_uint(circuit_state_tree, hf_isup_mtc_blocking_state2, parameter_tvb, offset, 1, circuit_state);
2640       proto_tree_add_uint(circuit_state_tree, hf_isup_call_proc_state, parameter_tvb, offset, 1, circuit_state);
2641       proto_tree_add_uint(circuit_state_tree, hf_isup_hw_blocking_state, parameter_tvb, offset, 1, circuit_state);
2642       proto_item_set_text(circuit_state_item, "Circuit# CIC+%u state: %s", i++, val_to_str(circuit_state&BA_8BIT_MASK, isup_mtc_blocking_state_DCnot00_value, "unknown"));
2643     }
2644     offset++;
2645   }
2646   proto_item_set_text(parameter_item, "Circuit state indicator (national use)");
2647 }
2648 /* ------------------------------------------------------------------
2649   Dissector Parameter Event information
2650  */
2651 static void
2652 dissect_isup_event_information_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
2653 {
2654   guint8 indicators;
2655
2656   indicators = tvb_get_guint8(parameter_tvb, 0);
2657   proto_tree_add_uint_format(parameter_tree, hf_isup_event_ind, parameter_tvb, 0, EVENT_INFO_LENGTH, indicators, "Event indicator: %s (%u)", val_to_str(indicators & GFEDCBA_8BIT_MASK, isup_event_ind_value, "spare"), indicators & GFEDCBA_8BIT_MASK);
2658   proto_tree_add_boolean(parameter_tree, hf_isup_event_presentation_restricted_ind, parameter_tvb, 0, EVENT_INFO_LENGTH, indicators);
2659
2660   proto_item_set_text(parameter_item,"Event information: %s (%u)", val_to_str(indicators & GFEDCBA_8BIT_MASK, isup_event_ind_value, "spare"),indicators );
2661 }
2662 /* ------------------------------------------------------------------
2663   Dissector Parameter User-to-user information- no detailed dissection since defined in Rec. Q.931
2664  */
2665 static void
2666 dissect_isup_user_to_user_information_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *parameter_tree, proto_item *parameter_item)
2667 { guint length = tvb_reported_length(parameter_tvb);
2668   proto_tree_add_text(parameter_tree, parameter_tvb, 0, -1,
2669                       "User-to-user info (-> Q.931)");
2670   dissect_q931_user_user_ie(parameter_tvb, pinfo, 0, length,
2671     parameter_tree );
2672   proto_item_set_text(parameter_item, "User-to-user information,(%u byte%s length)",
2673                       length , plurality(length, "", "s"));
2674 }
2675 /* ------------------------------------------------------------------
2676   Dissector Parameter Call Reference
2677  */
2678 static void
2679 dissect_isup_call_reference_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
2680 {
2681   guint32 call_id;
2682   guint16 spc;
2683
2684   call_id = tvb_get_ntoh24(parameter_tvb, 0);
2685   spc = tvb_get_letohs(parameter_tvb, CALL_ID_LENGTH) & 0x3FFF; /*since 1st 2 bits spare */
2686   proto_tree_add_text(parameter_tree, parameter_tvb, 0, CALL_ID_LENGTH, "Call identity: %u", call_id);
2687   proto_tree_add_text(parameter_tree, parameter_tvb, CALL_ID_LENGTH, SPC_LENGTH, "Signalling Point Code: %u", spc);
2688
2689   proto_item_set_text(parameter_item, "Call Reference: Call ID = %u, SPC = %u", call_id, spc);
2690 }
2691 /* ------------------------------------------------------------------
2692   Dissector Parameter Access Transport - no detailed dissection since defined in Rec. Q.931
2693  */
2694 static void
2695 dissect_isup_access_transport_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree,
2696                                         proto_item *parameter_item, packet_info *pinfo)
2697 { guint length = tvb_reported_length(parameter_tvb);
2698
2699   proto_tree_add_text(parameter_tree, parameter_tvb, 0, -1,
2700                       "Access transport parameter field (-> Q.931)");
2701
2702   if (q931_ie_handle)
2703     call_dissector(q931_ie_handle, parameter_tvb, pinfo, parameter_tree);
2704
2705   proto_item_set_text(parameter_item, "Access transport (%u byte%s length)",
2706                       length , plurality(length, "", "s"));
2707 }
2708
2709 /* dissect x.213 NSAP coded Address */
2710
2711 static const value_string x213_afi_value[] = {
2712   { 0x34, "IANA ICP"},
2713   { 0x35, "IANA ICP"},
2714   { 0x36, "X.121"},
2715   { 0x37, "X.121"},
2716   { 0x38, "ISO DCC"},
2717   { 0x39, "ISO DCC"},
2718   { 0x40, "F.69"},
2719   { 0x41, "F.69"},
2720   { 0x42, "E.163"},
2721   { 0x43, "E.163"},
2722   { 0x44, "E.164"},
2723   { 0x45, "E.164"},
2724   { 0x46, "ISO 6523-ICD"},
2725   { 0x47, "ISO 6523-ICD"},
2726   { 0x48, "Local"},
2727   { 0x49, "Local"},
2728   { 0x50, "Local ISO/IEC 646 character "},
2729   { 0x51, "Local ( National character )"},
2730   { 0x52, "X.121"},
2731   { 0x53, "X.121"},
2732   { 0x54, "F.69"},
2733   { 0x55, "F.69"},
2734   { 0x56, "E.163"},
2735   { 0x57, "E.163"},
2736   { 0x58, "E.164"},
2737   { 0x59, "E.164"},
2738
2739   { 0x76, "ITU-T IND"},
2740   { 0x77, "ITU-T IND"},
2741
2742   { 0xb8, "IANA ICP Group no"},
2743   { 0xb9, "IANA ICP Group no"},
2744   { 0xba, "X.121 Group no"},
2745   { 0xbb, "X.121 Group no"},
2746   { 0xbc, "ISO DCC Group no"},
2747   { 0xbd, "ISO DCC Group no"},
2748   { 0xbe, "F.69 Group no"},
2749   { 0xbf, "F.69 Group no"},
2750   { 0xc0, "E.163 Group no"},
2751   { 0xc1, "E.163 Group no"},
2752   { 0xc2, "E.164 Group no"},
2753   { 0xc3, "E.164 Group no"},
2754   { 0xc4, "ISO 6523-ICD Group no"},
2755   { 0xc5, "ISO 6523-ICD Group no"},
2756   { 0xc6, "Local Group no"},
2757   { 0xc7, "Local Group no"},
2758   { 0xc8, "Local ISO/IEC 646 character Group no"},
2759   { 0xc9, "Local ( National character ) Group no"},
2760   { 0xca, "X.121 Group no"},
2761   { 0xcb, "X.121 Group no"},
2762   { 0xcd, "F.69 Group no"},
2763   { 0xce, "F.69 Group no"},
2764   { 0xcf, "E.163 Group no"},
2765   { 0xd0, "E.164 Group no"},
2766   { 0xd1, "E.164 Group no"},
2767   { 0xde, "E.163 Group no"},
2768
2769   { 0xe2, "ITU-T IND Group no"},
2770   { 0xe3, "ITU-T IND Group no"},
2771   { 0,  NULL }
2772 };
2773 value_string_ext x213_afi_value_ext = VALUE_STRING_EXT_INIT(x213_afi_value);
2774
2775
2776 /* Up-to-date information on the allocated ICP values can be found in   */
2777 /*draft-gray-rfc1888bis-01 at                                           */
2778 /*http://www.ietf.org/internet-drafts/draft-gray-rfc1888bis-01.txt      */
2779 static const value_string iana_icp_values[] = {
2780   {   0x0, "IP Version 6 Address"},
2781   {   0x1, "IP Version 4 Address"},
2782   { 0,  NULL }
2783 };
2784
2785 /*
2786  * XXX - shouldn't there be a centralized routine for dissecting NSAPs?
2787  * See also "dissect_atm_nsap()" in epan/dissectors/packet-arp.c and
2788  * "print_nsap_net_buf()" and "print_nsap_net()" in epan/osi_utils.c.
2789  */
2790 void
2791 dissect_nsap(tvbuff_t *parameter_tvb,gint offset,gint len, proto_tree *parameter_tree)
2792 {
2793   guint8 afi;
2794   guint8 length = 0;
2795   guint icp, cc_offset;
2796
2797   afi = tvb_get_guint8(parameter_tvb, offset);
2798
2799   switch ( afi ) {
2800     case 0x35:  /* IANA ICP Binary fortmat*/
2801       proto_tree_add_text(parameter_tree, parameter_tvb, offset, 3,
2802                           "IDP = %s", tvb_bytes_to_str(parameter_tvb, offset, 3));
2803
2804       proto_tree_add_uint(parameter_tree, hf_afi, parameter_tvb, offset, 1, afi );
2805       offset = offset + 1;
2806       icp = tvb_get_ntohs(parameter_tvb, offset);
2807       proto_tree_add_uint(parameter_tree, hf_iana_icp, parameter_tvb, offset, 1, icp );
2808       if ( icp == 0 ){ /* IPv6 addr */
2809         proto_tree_add_text(parameter_tree, parameter_tvb, offset + 2 , 17,
2810                             "DSP = %s", tvb_bytes_to_str(parameter_tvb, offset + 2, 17));
2811         proto_tree_add_item(parameter_tree, hf_nsap_ipv6_addr, parameter_tvb, offset + 2,
2812                             16, ENC_NA);
2813
2814       }
2815       else { /* IPv4 addr */
2816         /* XXX - this is really only for ICP 1 */
2817         proto_tree_add_text(parameter_tree, parameter_tvb, offset + 2, 17,
2818                             "DSP = %s", tvb_bytes_to_str(parameter_tvb, offset + 2, 17));
2819         proto_tree_add_item(parameter_tree, hf_nsap_ipv4_addr, parameter_tvb, offset + 2, 4, ENC_BIG_ENDIAN);
2820       }
2821
2822       break;
2823     case 0x45:  /* E.164 ATM format */
2824     case 0xC3:  /* E.164 ATM group format */
2825       proto_tree_add_text(parameter_tree, parameter_tvb, offset, 9,
2826                           "IDP = %s", tvb_bytes_to_str(parameter_tvb, offset, 9));
2827
2828       proto_tree_add_uint(parameter_tree, hf_afi, parameter_tvb, offset, 1, afi );
2829
2830       proto_tree_add_text(parameter_tree, parameter_tvb, offset + 1, 8,
2831                           "IDI = %s", tvb_bytes_to_str(parameter_tvb, offset + 1, 8));
2832       offset = offset +1;
2833       /* Dissect country code */
2834       cc_offset = offset;
2835       dissect_e164_cc(parameter_tvb, parameter_tree, 3, TRUE);
2836
2837       proto_tree_add_text(parameter_tree,parameter_tvb, cc_offset, length,"DSP length %u(len %u -9 )",(len-9),len );
2838
2839       proto_tree_add_item(parameter_tree, hf_bicc_nsap_dsp, parameter_tvb, offset + 8, (len - 9),ENC_NA);
2840
2841       break;
2842     default:
2843       proto_tree_add_uint(parameter_tree, hf_afi, parameter_tvb, offset, len, afi );
2844   }/* end switch afi */
2845
2846 }
2847
2848
2849 #define  ACTION_INDICATOR                               0x01
2850 #define  BACKBONE_NETWORK_CONNECTION_IDENTIFIER         0x02
2851 #define  INTERWORKING_FUNCTION_ADDRESS                  0x03
2852 #define  CODEC_LIST                                     0x04
2853 #define  CODEC                                          0x05
2854 #define  BAT_COMPATIBILITY_REPORT                       0x06
2855 #define  BEARER_NETWORK_CONNECTION_CHARACTERISTICS      0x07
2856 #define  BEARER_CONTROL_INFORMATION                     0x08
2857 #define  BEARER_CONTROL_TUNNELLING                      0x09
2858 #define  BEARER_CONTROL_UNIT_IDENTIFIER                 0x0A
2859 #define  SIGNAL                                         0x0B
2860 #define  BEARER_REDIRECTION_CAPABILITY                  0x0C
2861 #define  BEARER_REDIRECTION_INDICATORS                  0x0D
2862 #define  SIGNAL_TYPE                                    0x0E
2863 #define  DURATION                                       0x0F
2864
2865
2866 static const value_string bat_ase_list_of_Identifiers_vals[] = {
2867
2868   { 0x00                                        ,   "spare" },
2869   { ACTION_INDICATOR                            ,   "Action Indicator" },
2870   { BACKBONE_NETWORK_CONNECTION_IDENTIFIER      ,   "Backbone Network Connection Identifier" },
2871   { INTERWORKING_FUNCTION_ADDRESS               ,   "Interworking Function Address" },
2872   { CODEC_LIST                                  ,   "Codec List" },
2873   { CODEC                                       ,   "Codec" },
2874   { BAT_COMPATIBILITY_REPORT                    ,   "BAT Compatibility Report" },
2875   { BEARER_NETWORK_CONNECTION_CHARACTERISTICS   ,   "Bearer Network Connection Characteristics" },
2876   { BEARER_CONTROL_INFORMATION                  ,   "Bearer Control Information"},
2877   { BEARER_CONTROL_TUNNELLING                   ,   "Bearer Control Tunnelling"},
2878   { BEARER_CONTROL_UNIT_IDENTIFIER              ,   "Bearer Control Unit Identifier" },
2879   { SIGNAL                                      ,   "Signal"},
2880   { BEARER_REDIRECTION_CAPABILITY               ,   "Bearer Redirection Capability"},
2881   { BEARER_REDIRECTION_INDICATORS               ,   "Bearer Redirection Indicators"},
2882   { SIGNAL_TYPE                                 ,   "Signal Type"},
2883   { DURATION                                    ,   "Duration" },
2884   { 0,  NULL }
2885 };
2886 static value_string_ext bat_ase_list_of_Identifiers_vals_ext = VALUE_STRING_EXT_INIT(bat_ase_list_of_Identifiers_vals);
2887
2888 /*ITU-T Q.765.5 (06/2000) 13*/
2889 static const value_string Instruction_indicator_for_general_action_vals[] =
2890 {
2891   { 0,  "Pass on information element"},
2892   { 1,  "Discard information element"},
2893   { 2,  "Discard BICC data"},
2894   { 3,  "Release call"},
2895   { 0,  NULL}};
2896
2897 static const value_string Instruction_indicator_for_pass_on_not_possible_vals[] = {
2898   { 0,  "Release call"},
2899   { 1,  "Discard information element"},
2900   { 2,  "Discard BICC data"},
2901   { 3,  "reserved (interpreted as 00)"},
2902   { 0,  NULL}};
2903
2904 static const value_string bat_ase_action_indicator_field_vals[] = {
2905
2906   { 0x00,  "no indication"},
2907   { 0x01,  "connect backward"},
2908   { 0x02,  "connect forward"},
2909   { 0x03,  "connect forward, no notification"},
2910   { 0x04,  "connect forward, plus notification"},
2911   { 0x05,  "connect forward, no notification + selected codec"},
2912   { 0x06,  "connect forward, plus notification + selected codec"},
2913   { 0x07,  "use idle"},
2914   { 0x08,  "connected"},
2915   { 0x09,  "switched"},
2916   { 0x0a,  "selected codec"},
2917   { 0x0b,  "modify codec"},
2918   { 0x0c,  "successful codec modification"},
2919   { 0x0d,  "codec modification failure"},
2920   { 0x0e,  "mid-call codec negotiation"},
2921   { 0x0f,  "modify to selected codec information"},
2922   { 0x10,  "mid-call codec negotiation failure"},
2923   { 0x11,  "start signal, notify"},
2924   { 0x12,  "start signal, no notify"},
2925   { 0x13,  "stop signal, notify"},
2926   { 0x14,  "stop signal, no notify"},
2927   { 0x15,  "start signal acknowledge"},
2928   { 0x16,  "start signal reject"},
2929   { 0x17,  "stop signal acknowledge"},
2930   { 0x18,  "bearer redirect"},
2931   { 0,     NULL }
2932 };
2933 static value_string_ext bat_ase_action_indicator_field_vals_ext = VALUE_STRING_EXT_INIT(bat_ase_action_indicator_field_vals);
2934
2935 static const true_false_string BCTP_BVEI_value  = {
2936   "Version Error Indication, BCTP version not supported",
2937   "No indication"
2938 };
2939
2940 static const value_string BCTP_Tunnelled_Protocol_Indicator_vals[] = {
2941
2942   { 0x20,  "IPBCP (text encoded)"},
2943   { 0x21,  "spare (text encoded protocol)"},
2944   { 0x22,  "not used"},
2945   { 0,  NULL }
2946 };
2947
2948 static const true_false_string BCTP_TPEI_value  = {
2949   "Protocol Error Indication, Bearer Control Protocol not supported",
2950   "No indication"
2951 };
2952
2953
2954 #define  ITU_T  0x01
2955 #define  ETSI   0x02
2956
2957 static const value_string bat_ase_organization_identifier_subfield_vals[] = {
2958
2959   { 0x00,   "no indication"},
2960   { 0x01,   "ITU-T"},
2961   { 0x02,   "ETSI (refer to TS 26.103)"},
2962   { 0,  NULL }
2963 };
2964
2965 #define G_711_64_A            0x01
2966 #define G_711_64_U            0x02
2967 #define G_711_56_A            0x03
2968 #define G_711_56_U            0x04
2969 #define G_722_SB_ADPCM        0x05
2970 #define G_723_1               0x06
2971 #define G_723_1_Annex_A       0x07
2972 #define G_726_ADPCM           0x08
2973 #define G_727_Embedded_ADPCM  0x09
2974 #define G_728                 0x0a
2975 #define G_729_CS_ACELP        0x0b
2976 #define G_729_Annex_B         0x0c
2977
2978 static const value_string ITU_T_codec_type_subfield_vals[] = {
2979
2980   { 0x00,                  "no indication"},
2981   { G_711_64_A,            "G.711 64 kbit/s A-law"},
2982   { G_711_64_U,            "G.711 64 kbit/s -law"},
2983   { G_711_56_A,            "G.711 56 kbit/s A-law"},
2984   { G_711_56_U,            "G.711 56 kbit/s -law"},
2985   { G_722_SB_ADPCM,        "G.722 (SB-ADPCM)"},
2986   { G_723_1,               "G.723.1"},
2987   { G_723_1_Annex_A,       "G.723.1 Annex A (silence suppression)"},
2988   { G_726_ADPCM,           "G.726 (ADPCM)"},
2989   { G_727_Embedded_ADPCM,  "G.727 (Embedded ADPCM)"},
2990   { G_728,                 "G.728"},
2991   { G_729_CS_ACELP,        "G.729 (CS-ACELP)"},
2992   { G_729_Annex_B,         "G.729 Annex B (silence suppression)"},
2993   { 0,  NULL }
2994 };
2995 static value_string_ext ITU_T_codec_type_subfield_vals_ext = VALUE_STRING_EXT_INIT(ITU_T_codec_type_subfield_vals);
2996
2997 static const value_string ETSI_codec_type_subfield_vals[] = {
2998
2999   { 0x00, "GSM Full Rate (13.0 kBit/s)( GSM FR )"},
3000   { 0x01, "GSM Half Rate (5.6 kBit/s) ( GSM HR )"},
3001   { 0x02, "GSM Enhanced Full Rate (12.2 kBit/s)( GSM EFR )"},
3002   { 0x03, "Full Rate Adaptive Multi-Rate ( FR AMR )"},
3003   { 0x04, "Half Rate Adaptive Multi-Rate ( HR AMR )"},
3004   { 0x05, "UMTS Adaptive Multi-Rate ( UMTS AMR )"},
3005   { 0x06, "UMTS Adaptive Multi-Rate 2 ( UMTS AMR 2 )"},
3006   { 0x07, "TDMA Enhanced Full Rate (7.4 kBit/s) ( TDMA EFR )"},
3007   { 0x08, "PDC Enhanced Full Rate (6.7 kBit/s) ( PDC EFR )"},
3008   { 0x09, "Full Rate Adaptive Multi-Rate WideBand ( FR AMR-WB )"},
3009   { 0x0a, "UMTS Adaptive Multi-Rate WideBand ( UMTS AMR-WB )"},
3010   { 0x0b, "8PSK Half Rate Adaptive Multi-Rate ( OHR AMR )"},
3011   { 0x0c, "8PSK Full Rate Adaptive Multi-Rate WideBand  ( OFR AMR-WB )"},
3012   { 0x0d, "8PSK Half Rate Adaptive Multi-Rate WideBand ( OHR AMR-WB )"},
3013   { 0xfe, "Reserved for future use."},
3014   { 0xff, "Reserved for MuMe dummy Codec Type ( MuMe )"},
3015   { 0,  NULL }
3016 };
3017 static value_string_ext ETSI_codec_type_subfield_vals_ext = VALUE_STRING_EXT_INIT(ETSI_codec_type_subfield_vals);
3018
3019 static const value_string bat_initial_codec_mode_vals[] = {
3020   {0x7, "12.2 kbps"},
3021   {0x6, "10.2 kbps"},
3022   {0x5, "7.95 kbps"},
3023   {0x4, "7.40 kbps"},
3024   {0x3, "6.70 kbps"},
3025   {0x2, "5.90 kbps"},
3026   {0x1, "5.15 kbps"},
3027   {0x0, "4.75 kbps"},
3028   {0, NULL}
3029 };
3030
3031 static const value_string optimisation_mode_vals[] = {
3032   { 0,  "Optimisation of the ACS not supported,"},
3033   { 1,  "Optimisation of the ACS supported,"},
3034   { 0,  NULL }
3035 };
3036
3037 static const value_string bearer_network_connection_characteristics_vals[] = {
3038
3039   { 0x00,   "no indication"},
3040   { 0x01,   "AAL type 1"},
3041   { 0x02,   "AAL type 2"},
3042   { 0x03,   "Structured AAL type 1"},
3043   { 0x04,   "IP/RTP"},
3044   { 0x05,   "TDM (reserved for use by ITU-T Rec. Q.1950)"},
3045   { 0,  NULL }
3046 };
3047 value_string_ext bearer_network_connection_characteristics_vals_ext = VALUE_STRING_EXT_INIT(bearer_network_connection_characteristics_vals);
3048
3049 static const true_false_string Bearer_Control_Tunnelling_ind_value  = {
3050   "Tunnelling to be used",
3051   "No indication"
3052 };
3053
3054 static const true_false_string late_cut_trough_cap_ind_value  = {
3055   "Late Cut-through supported",
3056   "Late Cut-through not supported"
3057 };
3058 /*  ITU-T Rec. Q.765.5/Amd.1 (07/2001) */
3059 static const value_string Bearer_Redirection_Indicator_vals[] = {
3060   { 0x00,  " no indication"},
3061   { 0x01,  "late cut-through request"},
3062   { 0x02,  "redirect temporary reject"},
3063   { 0x03,  "redirect backwards request"},
3064   { 0x04,  "redirect forwards request"},
3065   { 0x05,  "redirect bearer release request"},
3066   { 0x06,  "redirect bearer release proceed"},
3067   { 0x07,  "redirect bearer release complete"},
3068   { 0x08,  "redirect cut-through request"},
3069   { 0x09,  "redirect bearer connected indication"},
3070   { 0x0a,  "redirect failure"},
3071   { 0x0b,  "new connection identifier"},
3072   { 0,  NULL }
3073 };
3074 static value_string_ext Bearer_Redirection_Indicator_vals_ext = VALUE_STRING_EXT_INIT(Bearer_Redirection_Indicator_vals);
3075
3076 /*26/Q.765.5 - Signal Type */
3077 static const value_string BAT_ASE_Signal_Type_vals[] = {
3078   { 0x00,  "DTMF 0"},
3079   { 0x01,  "DTMF 1"},
3080   { 0x02,  "DTMF 2"},
3081   { 0x03,  "DTMF 3"},
3082   { 0x04,  "DTMF 4"},
3083   { 0x05,  "DTMF 5"},
3084   { 0x06,  "DTMF 6"},
3085   { 0x07,  "DTMF 7"},
3086   { 0x08,  "DTMF 8"},
3087   { 0x09,  "DTMF 9"},
3088   { 0x0a,  "DTMF *"},
3089   { 0x0b,  "DTMF #"},
3090   { 0x0c,  "DTMF A"},
3091   { 0x0d,  "DTMF B"},
3092   { 0x0e,  "DTMF C"},
3093   { 0x0f,  "DTMF D"},
3094   /* 0001 0000
3095    * to
3096    * 0011 1111
3097    * Spare
3098    */
3099   { 0x10,  "Spare"},
3100   { 0x11,  "Spare"},
3101   { 0x12,  "Spare"},
3102   { 0x13,  "Spare"},
3103   { 0x14,  "Spare"},
3104   { 0x15,  "Spare"},
3105   { 0x16,  "Spare"},
3106   { 0x17,  "Spare"},
3107   { 0x18,  "Spare"},
3108   { 0x19,  "Spare"},
3109   { 0x1a,  "Spare"},
3110   { 0x1b,  "Spare"},
3111   { 0x1c,  "Spare"},
3112   { 0x1d,  "Spare"},
3113   { 0x1e,  "Spare"},
3114   { 0x1f,  "Spare"},
3115   { 0x20,  "Spare"},
3116   { 0x21,  "Spare"},
3117   { 0x22,  "Spare"},
3118   { 0x23,  "Spare"},
3119   { 0x24,  "Spare"},
3120   { 0x25,  "Spare"},
3121   { 0x26,  "Spare"},
3122   { 0x27,  "Spare"},
3123   { 0x28,  "Spare"},
3124   { 0x29,  "Spare"},
3125   { 0x2a,  "Spare"},
3126   { 0x2b,  "Spare"},
3127   { 0x2c,  "Spare"},
3128   { 0x2d,  "Spare"},
3129   { 0x2e,  "Spare"},
3130   { 0x2f,  "Spare"},
3131   { 0x30,  "Spare"},
3132   { 0x31,  "Spare"},
3133   { 0x32,  "Spare"},
3134   { 0x33,  "Spare"},
3135   { 0x34,  "Spare"},
3136   { 0x35,  "Spare"},
3137   { 0x36,  "Spare"},
3138   { 0x37,  "Spare"},
3139   { 0x38,  "Spare"},
3140   { 0x39,  "Spare"},
3141   { 0x3a,  "Spare"},
3142   { 0x3b,  "Spare"},
3143   { 0x3c,  "Spare"},
3144   { 0x3d,  "Spare"},
3145   { 0x3e,  "Spare"},
3146   { 0x3f,  "Spare"},
3147
3148   { 0x40,  "dial tone"},
3149   { 0x41,  "PABX internal dial tone"},
3150   { 0x42,  "special dial tone"},
3151   { 0x43,  "second dial tone"},
3152   { 0x44,  "ringing tone"},
3153   { 0x45,  "special ringing tone"},
3154   { 0x46,  "busy tone"},
3155   { 0x47,  "congestion tone"},
3156   { 0x48,  "special information tone"},
3157   { 0x49,  "warning tone"},
3158   { 0x4a,  "intrusion tone"},
3159   { 0x4b,  "call waiting tone"},
3160   { 0x4c,  "pay tone"},
3161   { 0x4d,  "payphone recognition tone"},
3162   { 0x4e,  "comfort tone"},
3163   { 0x4f,  "tone on hold"},
3164   { 0x50,  "record tone"},
3165   { 0x51,  "Caller waiting tone"},
3166   { 0x52,  "positive indication tone"},
3167   { 0x53,  "negative indication tone"},
3168   { 0,  NULL }
3169 };
3170 static value_string_ext BAT_ASE_Signal_Type_vals_ext = VALUE_STRING_EXT_INIT(BAT_ASE_Signal_Type_vals);
3171
3172 static const value_string BAT_ASE_Report_Reason_vals[] = {
3173
3174   { 0x00,   "no indication"},
3175   { 0x01,   "information element non-existent or not implemented"},
3176   { 0x02,   "BICC data with unrecognized information element, discarded"},
3177   { 0,  NULL }
3178 };
3179 /* This routine should bve called with offset at Organization_Identifier not the lengh indicator
3180  * because of use from other disectors.
3181  */
3182 extern int dissect_codec_mode(proto_tree *tree, tvbuff_t *tvb, int offset, int len) {
3183   guint8 tempdata;
3184   proto_tree *scs_item, *acs_item;
3185   proto_tree *scs_tree, *acs_tree;
3186
3187
3188   tempdata = tvb_get_guint8(tvb, offset);
3189   proto_tree_add_uint(tree, hf_Organization_Identifier , tvb, offset, 1, tempdata );
3190   switch ( tempdata ){
3191     case ITU_T :
3192       offset = offset + 1;
3193       tempdata = tvb_get_guint8(tvb, offset);
3194       proto_tree_add_uint(tree, hf_codec_type , tvb, offset, 1, tempdata );
3195       offset = offset + 1;
3196       switch ( tempdata ) {
3197         case G_711_64_A :
3198         case G_711_64_U :
3199         case G_711_56_A :
3200         case G_711_56_U :
3201         case G_722_SB_ADPCM :
3202         case G_723_1 :
3203         case G_723_1_Annex_A :
3204           /* These codecs have no configuration data */
3205           break;
3206         case G_726_ADPCM :
3207         case G_727_Embedded_ADPCM :
3208           /* four bit config data, TODO decode config */
3209           if ( len > 2 ) {
3210             tempdata = tvb_get_guint8(tvb, offset);
3211             proto_tree_add_text(tree, tvb, offset, 1, "Configuration data : 0x%x", tempdata);
3212             offset = offset + 1;
3213           }
3214           break;
3215         case G_728 :
3216         case G_729_CS_ACELP :
3217         case G_729_Annex_B :
3218           /* three bit config data, TODO decode config */
3219           if ( len > 2 ) {
3220             tempdata = tvb_get_guint8(tvb, offset);
3221             proto_tree_add_text(tree, tvb, offset, 1 , "Configuration data : 0x%x", tempdata);
3222             offset = offset + 1;
3223           }
3224           break;
3225         default:
3226           break;
3227
3228       }
3229       break;
3230     case ETSI:
3231       offset = offset + 1;
3232       tempdata = tvb_get_guint8(tvb, offset);
3233       proto_tree_add_uint(tree, hf_etsi_codec_type , tvb, offset, 1, tempdata );
3234       if ( len > 2 ) {
3235         offset = offset + 1;
3236         tempdata = tvb_get_guint8(tvb, offset);
3237
3238         acs_item = proto_tree_add_item(tree, hf_active_code_set, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3239         acs_tree = proto_item_add_subtree(acs_item,ett_acs);
3240         proto_tree_add_item(acs_tree, hf_active_code_set_12_2, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3241         proto_tree_add_item(acs_tree, hf_active_code_set_10_2, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3242         proto_tree_add_item(acs_tree, hf_active_code_set_7_95, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3243         proto_tree_add_item(acs_tree, hf_active_code_set_7_40, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3244         proto_tree_add_item(acs_tree, hf_active_code_set_6_70, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3245         proto_tree_add_item(acs_tree, hf_active_code_set_5_90, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3246         proto_tree_add_item(acs_tree, hf_active_code_set_5_15, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3247         proto_tree_add_item(acs_tree, hf_active_code_set_4_75, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3248
3249       }
3250       if ( len > 3 ) {
3251         offset = offset + 1;
3252         tempdata = tvb_get_guint8(tvb, offset);
3253
3254         scs_item = proto_tree_add_item(tree, hf_supported_code_set, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3255         scs_tree = proto_item_add_subtree(scs_item,ett_scs);
3256         proto_tree_add_item(scs_tree, hf_supported_code_set_12_2, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3257         proto_tree_add_item(scs_tree, hf_supported_code_set_10_2, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3258         proto_tree_add_item(scs_tree, hf_supported_code_set_7_95, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3259         proto_tree_add_item(scs_tree, hf_supported_code_set_7_40, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3260         proto_tree_add_item(scs_tree, hf_supported_code_set_6_70, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3261         proto_tree_add_item(scs_tree, hf_supported_code_set_5_90, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3262         proto_tree_add_item(scs_tree, hf_supported_code_set_5_15, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3263         proto_tree_add_item(scs_tree, hf_supported_code_set_4_75, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3264       }
3265       if ( len > 4 ) {
3266         offset = offset + 1;
3267         proto_tree_add_item(tree, hf_optimisation_mode, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3268         proto_tree_add_item(tree, hf_max_codec_modes, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3269       }
3270       offset = offset + 1;
3271       break;
3272     default:
3273       offset = offset + 1;
3274       tempdata = tvb_get_guint8(tvb, offset);
3275       proto_tree_add_text(tree, tvb, offset, len ,
3276                           "Unknown organisation Identifier ( Non ITU-T/ETSI codec ) %u", tempdata);
3277       offset = offset + len - 1;
3278       break;
3279   }
3280   /* switch OID */
3281
3282   return offset;
3283 }
3284
3285 static int
3286 dissect_codec(tvbuff_t *parameter_tvb, proto_tree *bat_ase_element_tree, gint length_indicator, gint offset,gint identifier)
3287 {
3288 /* offset is at length indicator e.g 1 step past identifier */
3289   guint8 compatibility_info;
3290
3291   proto_tree_add_uint(bat_ase_element_tree , hf_bat_ase_identifier , parameter_tvb, offset - 1, 1, identifier );
3292   proto_tree_add_uint(bat_ase_element_tree , hf_length_indicator  , parameter_tvb, offset, 1, length_indicator );
3293   offset = offset + 1;
3294   compatibility_info = tvb_get_guint8(parameter_tvb, offset);
3295   proto_tree_add_uint(bat_ase_element_tree, hf_Instruction_ind_for_general_action , parameter_tvb, offset, 1, compatibility_info );
3296   proto_tree_add_boolean(bat_ase_element_tree, hf_Send_notification_ind_for_general_action , parameter_tvb, offset, 1, compatibility_info );
3297   proto_tree_add_uint(bat_ase_element_tree, hf_Instruction_ind_for_pass_on_not_possible , parameter_tvb, offset, 1, compatibility_info );
3298   proto_tree_add_boolean(bat_ase_element_tree, hf_Send_notification_ind_for_pass_on_not_possible , parameter_tvb, offset, 1, compatibility_info );
3299   proto_tree_add_boolean(bat_ase_element_tree, hf_isup_extension_ind , parameter_tvb, offset, 1, compatibility_info );
3300
3301   offset = dissect_codec_mode(bat_ase_element_tree, parameter_tvb, offset+1,length_indicator-1);
3302   return offset;
3303 }
3304
3305 /* Dissect BAT ASE message according to Q.765.5 200006 and Amendment 1 200107
3306  * Layout of message        Length          Octet
3307  *  Element name
3308  *  Identifier                  1           1
3309  *  Length indicator            1           2
3310  *  Compatibility information   1           3
3311  *  Contents                    1           4
3312  *  Identifier                  n           m
3313  *  Length indicator            n
3314  *  Compatibility information   n
3315  *  Contents                    n           p
3316  */
3317
3318 static void
3319 dissect_bat_ase_Encapsulated_Application_Information(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *parameter_tree, gint offset)
3320 {
3321   gint        length = tvb_reported_length_remaining(parameter_tvb, offset), list_end;
3322   tvbuff_t   *next_tvb;
3323   proto_tree *bat_ase_tree, *bat_ase_element_tree, *bat_ase_iwfa_tree;
3324   proto_item *bat_ase_item, *bat_ase_element_item, *bat_ase_iwfa_item;
3325   guint8      identifier,content, BCTP_Indicator_field_1, BCTP_Indicator_field_2;
3326   guint8      tempdata, element_no, number_of_indicators;
3327   guint16     sdp_length;
3328   guint8      diagnostic_len;
3329   guint8      length_ind_len;
3330   guint       tempdata16;
3331   guint       content_len, length_indicator;
3332   guint       duration;
3333   guint       diagnostic;
3334   guint32      bncid, Local_BCU_ID;
3335
3336   element_no = 0;
3337
3338   bat_ase_item = proto_tree_add_text(parameter_tree,parameter_tvb, offset, -1,
3339                                      "Bearer Association Transport (BAT) Application Service Element (ASE) Encapsulated Application Information:");
3340   bat_ase_tree = proto_item_add_subtree(bat_ase_item , ett_bat_ase);
3341
3342   proto_tree_add_text(bat_ase_tree, parameter_tvb, offset, -1,
3343                       "BAT ASE Encapsulated Application Information, (%u byte%s length)", length, plurality(length, "", "s"));
3344   while(tvb_reported_length_remaining(parameter_tvb, offset) > 0){
3345     element_no = element_no + 1;
3346     identifier = tvb_get_guint8(parameter_tvb, offset);
3347
3348     /* length indicator may be 11 bits long */
3349     offset = offset + 1;
3350     proto_tree_add_item( bat_ase_tree, hf_isup_extension_ind, parameter_tvb, offset, 1, ENC_BIG_ENDIAN );
3351     tempdata = tvb_get_guint8(parameter_tvb, offset);
3352     if ( tempdata & 0x80 ) {
3353       length_indicator = tempdata & 0x7f;
3354       length_ind_len = 1;
3355     }
3356     else {
3357       offset = offset + 1;
3358       tempdata16 = ( tempdata & 0x7f );
3359       length_indicator = tvb_get_guint8(parameter_tvb, offset)& 0x0f;
3360       length_indicator = length_indicator << 7;
3361       length_indicator = length_indicator + tempdata16;
3362       length_ind_len = 2;
3363     }
3364
3365     bat_ase_element_item = proto_tree_add_text(bat_ase_tree,parameter_tvb,
3366                                                ( offset - length_ind_len),(length_indicator + 2),"BAT ASE Element %u, Identifier: %s",element_no,
3367                                                val_to_str_ext(identifier,&bat_ase_list_of_Identifiers_vals_ext,"unknown (%u)"));
3368     bat_ase_element_tree = proto_item_add_subtree(bat_ase_element_item ,
3369                                                   ett_bat_ase_element);
3370     if ( identifier != CODEC ) {
3371       /* identifier, length indicator and compabillity info must be printed inside CODEC */
3372       /* dissection in order to use dissect_codec routine for codec list */
3373       proto_tree_add_uint(bat_ase_element_tree , hf_bat_ase_identifier , parameter_tvb,
3374                           offset - length_ind_len, 1, identifier );
3375       proto_tree_add_uint(bat_ase_element_tree , hf_length_indicator  , parameter_tvb,
3376                           offset - length_ind_len + 1, length_ind_len, length_indicator );
3377
3378       offset = offset + 1;
3379       proto_tree_add_item( bat_ase_element_tree, hf_isup_extension_ind, parameter_tvb, offset, 1, ENC_BIG_ENDIAN );
3380       proto_tree_add_item( bat_ase_element_tree, hf_Send_notification_ind_for_pass_on_not_possible, parameter_tvb, offset, 1, ENC_BIG_ENDIAN );
3381       proto_tree_add_item( bat_ase_element_tree, hf_Instruction_ind_for_pass_on_not_possible, parameter_tvb, offset, 1, ENC_BIG_ENDIAN );
3382       proto_tree_add_item( bat_ase_element_tree, hf_Send_notification_ind_for_general_action, parameter_tvb, offset, 1, ENC_BIG_ENDIAN );
3383       proto_tree_add_item( bat_ase_element_tree, hf_Instruction_ind_for_general_action, parameter_tvb, offset, 1, ENC_BIG_ENDIAN );
3384       offset = offset + 1;
3385     }
3386     content_len = length_indicator - 1 ; /* exclude the treated Compatibility information */
3387
3388     /* content will be different depending on identifier */
3389     switch ( identifier ){
3390
3391       case ACTION_INDICATOR :
3392
3393         content = tvb_get_guint8(parameter_tvb, offset);
3394         proto_tree_add_uint(bat_ase_element_tree, hf_Action_Indicator , parameter_tvb, offset, 1, content );
3395         proto_item_append_text(bat_ase_element_item, " - %s",
3396                                val_to_str_ext(content,&bat_ase_action_indicator_field_vals_ext, "unknown (%u)"));
3397         offset = offset + 1;
3398         break;
3399       case BACKBONE_NETWORK_CONNECTION_IDENTIFIER :
3400
3401         bncid = tvb_get_ntohl(parameter_tvb, offset);
3402         switch ( content_len ){
3403           case 1:
3404             bncid = bncid & 0x000000ff;
3405             break;
3406           case 2:
3407             bncid = bncid & 0x0000ffff;
3408             break;
3409           case 3:
3410             bncid = bncid & 0x00ffffff;
3411             break;
3412           case 4:;
3413           default:;
3414         }
3415         proto_tree_add_uint_format(bat_ase_element_tree, hf_bncid, parameter_tvb, offset, content_len, bncid, "BNCId: 0x%08x", bncid);
3416         proto_item_append_text(bat_ase_element_item, " - 0x%08x",bncid);
3417         offset = offset + content_len;
3418
3419         break;
3420       case INTERWORKING_FUNCTION_ADDRESS :
3421         bat_ase_iwfa_item = proto_tree_add_item(bat_ase_element_tree, hf_bat_ase_biwfa, parameter_tvb, offset, content_len,
3422                                                 ENC_NA);
3423         bat_ase_iwfa_tree = proto_item_add_subtree(bat_ase_iwfa_item , ett_bat_ase_iwfa);
3424         dissect_nsap(parameter_tvb, offset, content_len, bat_ase_iwfa_tree);
3425
3426         offset = offset + content_len;
3427         break;
3428       case CODEC_LIST :
3429         list_end = offset + content_len;
3430         while ( offset < ( list_end - 1 )) {
3431           identifier = tvb_get_guint8(parameter_tvb, offset);
3432           offset = offset + 1;
3433           tempdata = tvb_get_guint8(parameter_tvb, offset);
3434           if ( tempdata & 0x80 ) {
3435             length_indicator = tempdata & 0x7f;
3436           }
3437           else {
3438             offset = offset +1;
3439             length_indicator = tvb_get_guint8(parameter_tvb, offset);
3440             length_indicator = length_indicator << 7;
3441             length_indicator = length_indicator & ( tempdata & 0x7f );
3442           }
3443           offset = dissect_codec(parameter_tvb, bat_ase_element_tree, length_indicator , offset, identifier);
3444         }
3445         break;
3446       case CODEC :
3447         /* offset is at length indicator in this case */
3448         offset = dissect_codec(parameter_tvb, bat_ase_element_tree, length_indicator , offset, identifier);
3449         break;/* case codec */
3450       case BAT_COMPATIBILITY_REPORT :
3451         tempdata = tvb_get_guint8(parameter_tvb, offset);
3452         proto_tree_add_uint(bat_ase_element_tree, hf_BAT_ASE_Comp_Report_Reason, parameter_tvb, offset, 1, tempdata );
3453         offset = offset + 1;
3454
3455         diagnostic_len = content_len - 1;
3456         while ( diagnostic_len > 0 ) {
3457           tempdata = tvb_get_guint8(parameter_tvb, offset);
3458           proto_tree_add_uint(bat_ase_element_tree, hf_BAT_ASE_Comp_Report_ident, parameter_tvb, offset, 1, tempdata );
3459           offset = offset + 1;
3460           diagnostic = tvb_get_letohs(parameter_tvb, offset);
3461           proto_tree_add_uint(bat_ase_element_tree, hf_BAT_ASE_Comp_Report_diagnostic, parameter_tvb, offset, 2, diagnostic);
3462           offset = offset + 2;
3463           diagnostic_len = diagnostic_len - 3;
3464         }
3465         break;
3466       case BEARER_NETWORK_CONNECTION_CHARACTERISTICS :
3467         tempdata = tvb_get_guint8(parameter_tvb, offset);
3468         proto_tree_add_uint(bat_ase_element_tree, hf_characteristics , parameter_tvb,
3469                             offset, 1, tempdata );
3470         proto_item_append_text(bat_ase_element_item, " - %s",
3471                                val_to_str_ext(tempdata,&bearer_network_connection_characteristics_vals_ext, "unknown (%u)"));
3472
3473         offset = offset + content_len;
3474         break;
3475 /* The Bearer Control Information information element contains the bearer control tunnelling protocol */
3476 /* ITU-T Q.1990 (2001), BICC bearer control tunnelling protocol. */
3477
3478       case BEARER_CONTROL_INFORMATION :
3479         BCTP_Indicator_field_1 = tvb_get_guint8(parameter_tvb, offset);
3480         proto_tree_add_uint(bat_ase_element_tree, hf_BCTP_Version_Indicator,
3481                             parameter_tvb, offset, 1, BCTP_Indicator_field_1 );
3482
3483         proto_tree_add_boolean(bat_ase_element_tree, hf_BVEI,
3484                                parameter_tvb, offset, 1, BCTP_Indicator_field_1 );
3485         offset = offset + 1;
3486
3487         BCTP_Indicator_field_2 = tvb_get_guint8(parameter_tvb, offset);
3488
3489         proto_tree_add_uint(bat_ase_element_tree, hf_Tunnelled_Protocol_Indicator ,
3490                             parameter_tvb, offset, 1, BCTP_Indicator_field_2 );
3491
3492         proto_tree_add_boolean(bat_ase_element_tree, hf_TPEI,
3493                                parameter_tvb, offset, 1, BCTP_Indicator_field_2 );
3494         offset = offset + 1;
3495
3496         sdp_length = ( length_indicator ) - 3;
3497
3498         if(sdp_length > tvb_length_remaining(parameter_tvb,offset)){
3499           /* If this is a segmented message we may not have all the data */
3500           next_tvb = tvb_new_subset_remaining(parameter_tvb, offset);
3501         }else{
3502           next_tvb = tvb_new_subset(parameter_tvb, offset, sdp_length, sdp_length);
3503         }
3504         call_dissector(sdp_handle, next_tvb, pinfo, bat_ase_element_tree);
3505         offset = offset + sdp_length;
3506
3507
3508         break;
3509       case BEARER_CONTROL_TUNNELLING :
3510
3511         tempdata = tvb_get_guint8(parameter_tvb, offset);
3512         proto_tree_add_boolean(bat_ase_element_tree, hf_bearer_control_tunneling , parameter_tvb, offset, 1, ( tempdata & 0x01 ) );
3513         if ( tempdata & 0x01 )
3514           proto_item_append_text(bat_ase_element_item, " - Tunnelling to be used ");
3515
3516         offset = offset + content_len;
3517         break;
3518       case BEARER_CONTROL_UNIT_IDENTIFIER :
3519         tempdata = tvb_get_guint8(parameter_tvb, offset);
3520         proto_tree_add_text(bat_ase_element_tree, parameter_tvb, offset, 1, "Network ID Length indicator = %u",tempdata);
3521         offset = offset + 1;
3522         if ( tempdata > 0 ) {
3523
3524 /* Q.765.5 amd 1
3525    Network ID
3526    The coding of the Network ID field is identical to the coding of the Network ID field in the
3527    Global Call Reference parameter as specified in clause 6/Q.1902.3 (see [3]).
3528    NOTE .When used inside a network domain, the Network ID may be omitted by setting the
3529    Network ID Length indicator to the value "0".
3530    Q.1902.3
3531    The following codes are used in the subfields of the global call reference parameter field:
3532    a) Network ID
3533    The Network ID contains the value field (coded according to ASN.1 BER) of an object
3534    identifier identifying the network. This means that the tag and length fields are omitted.
3535    An example of such an object identifier can be the following:
3536    .{itu-t (0) administration (2) national regulatory authority (x) network (y)}
3537    The value for x is the value of the national regulatory authority (one of the Data Country
3538    Codes associated to the country as specified in ITU-T X.121 shall be used for "national
3539    regulatory authority"), the value for y is under the control of the national regulatory
3540    authority concerned.
3541    b) Node ID
3542    A binary number that uniquely identifies within the network the node which generates the
3543    call reference.
3544    c) Call Reference ID
3545    A binary number used for the call reference of the call. This is generated by the node for
3546    each call.
3547
3548 */
3549           proto_tree_add_text(bat_ase_element_tree, parameter_tvb, offset, tempdata , "Network ID: %s",
3550                               tvb_bytes_to_str(parameter_tvb, offset, tempdata));
3551           offset = offset + tempdata;
3552         } /* end if */
3553
3554         Local_BCU_ID = tvb_get_letohl(parameter_tvb, offset);
3555         proto_tree_add_uint_format(bat_ase_element_tree, hf_Local_BCU_ID , parameter_tvb, offset, 4, Local_BCU_ID , "Local BCU ID : 0x%08x", Local_BCU_ID );
3556         offset = offset + 4;
3557         break;
3558       case SIGNAL :
3559         /* As type is Constructor new elements follow, return to main loop */
3560         break;
3561       case BEARER_REDIRECTION_CAPABILITY :
3562         tempdata = tvb_get_guint8(parameter_tvb, offset);
3563         proto_tree_add_boolean(bat_ase_element_tree, hf_late_cut_trough_cap_ind , parameter_tvb, offset, 1, tempdata );
3564         offset = offset + content_len;
3565         break;
3566       case BEARER_REDIRECTION_INDICATORS :
3567         number_of_indicators = 0;
3568         while ( number_of_indicators < content_len ) {
3569           tempdata = tvb_get_guint8(parameter_tvb, offset);
3570           proto_tree_add_uint(bat_ase_element_tree, hf_bat_ase_bearer_redir_ind , parameter_tvb, offset, 1, tempdata );
3571           offset = offset + 1;
3572           number_of_indicators = number_of_indicators + 1;
3573         }
3574         break;
3575       case SIGNAL_TYPE :
3576         tempdata = tvb_get_guint8(parameter_tvb, offset);
3577         proto_tree_add_uint(bat_ase_element_tree, hf_bat_ase_signal , parameter_tvb, offset, 1, tempdata );
3578         offset = offset + content_len;
3579         break;
3580       case DURATION :
3581         duration = tvb_get_letohs(parameter_tvb, offset);
3582         proto_tree_add_uint(bat_ase_element_tree, hf_bat_ase_duration , parameter_tvb, offset, 2, duration );
3583         offset = offset + content_len;
3584         break;
3585       default :
3586         proto_tree_add_text(bat_ase_element_tree, parameter_tvb, offset,content_len , "Default ?, (%u byte%s length)", (content_len), plurality(content_len, "", "s"));
3587         offset = offset + content_len;
3588     }
3589   }
3590
3591 }
3592
3593
3594
3595 /*
3596 Octet
3597     -------------------------------------------
3598 1   | ext. Application context identifier lsb
3599     -------------------------------------------
3600 1a  | ext. msb
3601     -------------------------------------------
3602 2   | ext. spare                        SNI RCI
3603     -------------------------------------------
3604 3   | ext. SI APM segmentation indicator
3605     -------------------------------------------
3606 3a  | ext. Segmentation local reference
3607     -------------------------------------------
3608 4a  |
3609 :   |   APM-user information
3610 4n  |
3611     +-------------------------------------------
3612
3613         Figure 77/Q.763 . Application transport parameter field
3614 */
3615 static void
3616 dissect_isup_application_transport_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *parameter_tree, proto_item *parameter_item)
3617 {
3618
3619   guint8 si_and_apm_seg_ind;
3620   guint8 apm_Segmentation_local_ref = 0;
3621   guint16 aci16;
3622   gint offset = 0;
3623   guint8 octet;
3624   guint length = tvb_reported_length(parameter_tvb);
3625
3626   gboolean more_frag;
3627   gboolean   save_fragmented;
3628   tvbuff_t* new_tvb = NULL;
3629   tvbuff_t* next_tvb = NULL;
3630   fragment_data *frag_msg = NULL;
3631
3632   proto_tree_add_text(parameter_tree, parameter_tvb, offset, -1, "Application transport parameter fields:");
3633   proto_item_set_text(parameter_item, "Application transport, (%u byte%s length)", length , plurality(length, "", "s"));
3634   aci16 = tvb_get_guint8(parameter_tvb, offset);
3635
3636   if ( (aci16 & H_8BIT_MASK) == 0x80) {
3637     /* Octet 1 */
3638     aci16 = aci16 & 0x7f;
3639     proto_tree_add_item( parameter_tree, hf_isup_extension_ind, parameter_tvb, offset, 1, ENC_BIG_ENDIAN );
3640     proto_tree_add_uint(parameter_tree, hf_isup_app_cont_ident , parameter_tvb, offset, 1, aci16);
3641     offset = offset + 1;
3642   }
3643   /* Octet 1a */
3644   else {
3645     aci16 = (aci16<<8) | (tvb_get_guint8(parameter_tvb, offset) & 0x7f);
3646     proto_tree_add_uint(parameter_tree, hf_isup_app_cont_ident , parameter_tvb, offset, 2, aci16);
3647     offset = offset + 2;
3648   }
3649
3650   /* Octet 2 */
3651   proto_tree_add_text(parameter_tree, parameter_tvb, offset, -1, "Application transport instruction indicators: ");
3652   proto_tree_add_item( parameter_tree, hf_isup_extension_ind, parameter_tvb, offset, 1, ENC_BIG_ENDIAN );
3653   proto_tree_add_item( parameter_tree, hf_isup_app_Send_notification_ind, parameter_tvb, offset, 1, ENC_BIG_ENDIAN );
3654   proto_tree_add_item( parameter_tree, hf_isup_app_Release_call_ind, parameter_tvb, offset, 1, ENC_BIG_ENDIAN );
3655   offset = offset + 1;
3656
3657   /* Octet 3*/
3658   proto_tree_add_text(parameter_tree, parameter_tvb, offset, 1, "APM segmentation indicator:");
3659   si_and_apm_seg_ind  = tvb_get_guint8(parameter_tvb, offset);
3660   proto_tree_add_item( parameter_tree, hf_isup_extension_ind, parameter_tvb, offset, 1, ENC_BIG_ENDIAN );
3661   proto_tree_add_item( parameter_tree, hf_isup_apm_si_ind, parameter_tvb, offset, 1, ENC_BIG_ENDIAN );
3662   proto_tree_add_item( parameter_tree, hf_isup_apm_segmentation_ind, parameter_tvb, offset, 1, ENC_BIG_ENDIAN );
3663   offset = offset + 1;
3664
3665   /* Octet 3a */
3666   if ( (si_and_apm_seg_ind & H_8BIT_MASK) == 0x00) {
3667     apm_Segmentation_local_ref  = tvb_get_guint8(parameter_tvb, offset);
3668     proto_tree_add_item( parameter_tree, hf_isup_extension_ind, parameter_tvb, offset, 1, ENC_BIG_ENDIAN );
3669     proto_tree_add_item( parameter_tree, hf_isup_apm_slr, parameter_tvb, offset, 1, ENC_BIG_ENDIAN );
3670     offset = offset + 1;
3671   }
3672   /* For APM'98'-user applications. ( aci 0 - 3 ), APM-user information field starts at octet 4 */
3673   if (aci16 > 3) {
3674     /* Octet 4 Originating Address length */
3675     octet = tvb_get_guint8(parameter_tvb,offset);
3676     proto_tree_add_item( parameter_tree, hf_isup_orig_addr_len, parameter_tvb, offset, 1, ENC_BIG_ENDIAN );
3677     offset++;
3678     if ( octet != 0){
3679       /* 4b */
3680       proto_tree_add_item( parameter_tree, hf_isup_odd_even_indicator, parameter_tvb, offset, 1, ENC_BIG_ENDIAN );
3681       /* nature of address indicator */
3682       offset++;
3683       proto_tree_add_item( parameter_tree, hf_isup_inn_indicator, parameter_tvb, offset, 1, ENC_BIG_ENDIAN );
3684       proto_tree_add_item( parameter_tree, hf_isup_numbering_plan_indicator, parameter_tvb, offset, 1, ENC_BIG_ENDIAN );
3685       offset++;
3686       /* Address digits */
3687       proto_tree_add_text(parameter_tree, parameter_tvb, offset, octet - 2, "Address digits");
3688       offset = offset + octet - 2;
3689     }
3690     /* Octet 5 Destination Address length */
3691     octet = tvb_get_guint8(parameter_tvb,offset);
3692     proto_tree_add_item( parameter_tree, hf_isup_dest_addr_len, parameter_tvb, offset, 1, ENC_BIG_ENDIAN );
3693     offset++;
3694     if ( octet != 0){
3695       /* 4b */
3696       proto_tree_add_item( parameter_tree, hf_isup_odd_even_indicator, parameter_tvb, offset, 1, ENC_BIG_ENDIAN );
3697       /* nature of address indicator */
3698       offset++;
3699       proto_tree_add_item( parameter_tree, hf_isup_inn_indicator, parameter_tvb, offset, 1, ENC_BIG_ENDIAN );
3700       proto_tree_add_item( parameter_tree, hf_isup_numbering_plan_indicator, parameter_tvb, offset, 1, ENC_BIG_ENDIAN );
3701       offset++;
3702       /* Address digits */
3703       proto_tree_add_text(parameter_tree, parameter_tvb, offset, octet - 2, "Address digits");
3704       offset = offset + octet - 2;
3705     }
3706   }
3707   /*
3708    * Defragment ?
3709    *
3710    */
3711   if (isup_apm_desegment){
3712     if ((si_and_apm_seg_ind != 0xc0) && ((si_and_apm_seg_ind & H_8BIT_MASK)!=0x80)){
3713       /* debug g_warning("got here Frame %u",pinfo->fd->num); */
3714       /* Segmented message */
3715       save_fragmented = pinfo->fragmented;
3716       pinfo->fragmented = TRUE;
3717       more_frag = TRUE;
3718       if (si_and_apm_seg_ind == 0)
3719         more_frag = FALSE;
3720
3721       frag_msg = fragment_add_seq_next(parameter_tvb, offset, pinfo,
3722                                        (apm_Segmentation_local_ref & 0x7f),         /* ID for fragments belonging together */
3723                                        isup_apm_msg_fragment_table,                 /* list of message fragments */
3724                                        isup_apm_msg_reassembled_table,              /* list of reassembled messages */
3725                                        tvb_length_remaining(parameter_tvb, offset), /* fragment length - to the end */
3726                                        more_frag);                                  /* More fragments? */
3727
3728       if ((si_and_apm_seg_ind & 0x3f) !=0 && (si_and_apm_seg_ind &0x40) !=0){
3729         /* First fragment set number of fragments */
3730         fragment_set_tot_len(pinfo, apm_Segmentation_local_ref & 0x7f, isup_apm_msg_fragment_table, (si_and_apm_seg_ind & 0x3f));
3731       }
3732
3733       new_tvb = process_reassembled_data(parameter_tvb, offset, pinfo,
3734                                          "Reassembled ISUP", frag_msg, &isup_apm_msg_frag_items,
3735                                          NULL, parameter_tree);
3736
3737       if (frag_msg) { /* Reassembled */
3738         col_append_str(pinfo->cinfo, COL_INFO,
3739                        " (Message Reassembled)");
3740       } else { /* Not last packet of reassembled Short Message */
3741         col_append_str(pinfo->cinfo, COL_INFO,
3742                        " (Message fragment )");
3743       }
3744
3745       pinfo->fragmented = save_fragmented;
3746     }
3747   }/*isup_apm_desegment*/
3748
3749   if ( offset == (gint)length){
3750     /* No data */
3751     proto_tree_add_text(parameter_tree, parameter_tvb, offset, 0, "Empty APM-user information field"  );
3752     return;
3753   }
3754   if (new_tvb) { /* take it all */
3755     next_tvb = new_tvb;
3756   } else { /* make a new subset */
3757     next_tvb = tvb_new_subset_remaining(parameter_tvb, offset);
3758   }
3759
3760   proto_tree_add_text(parameter_tree, parameter_tvb, offset, -1,
3761                       "APM-user information field (%u Bytes)",tvb_length_remaining(parameter_tvb, offset));
3762
3763   switch(aci16 & 0x7fff){
3764     case 3:
3765       /* Charging ASE */
3766       dissect_charging_ase_ChargingMessageType_PDU(next_tvb, pinfo, parameter_tree);
3767       break;
3768     case 5:
3769       /* dissect BAT ASE element, without transparent data ( Q.765.5-200006) */
3770       dissect_bat_ase_Encapsulated_Application_Information(next_tvb, pinfo, parameter_tree, 0);
3771       break;
3772     default:
3773       proto_tree_add_text(parameter_tree, parameter_tvb, offset, -1, "No further dissection of APM-user information field");
3774       break;
3775   }
3776 }
3777
3778
3779
3780 /* ------------------------------------------------------------------
3781   Dissector Parameter Optional Forward Call indicators
3782  */
3783 static void
3784 dissect_isup_optional_forward_call_indicators_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
3785 {
3786   guint8 indicators;
3787
3788   indicators = tvb_get_guint8(parameter_tvb, 0);
3789   proto_tree_add_uint(parameter_tree, hf_isup_cug_call_ind, parameter_tvb, 0, OPTIONAL_FORWARD_CALL_IND_LENGTH, indicators);
3790   proto_tree_add_boolean(parameter_tree, hf_isup_simple_segmentation_ind, parameter_tvb, 0, OPTIONAL_FORWARD_CALL_IND_LENGTH, indicators);
3791   proto_tree_add_boolean(parameter_tree, hf_isup_connected_line_identity_request_ind, parameter_tvb, 0, OPTIONAL_FORWARD_CALL_IND_LENGTH, indicators);
3792
3793
3794   proto_item_set_text(parameter_item,"Optional forward call indicators: %s (%u)", val_to_str(indicators & BA_8BIT_MASK, isup_CUG_call_ind_value, "spare"),indicators );
3795 }
3796 /* ------------------------------------------------------------------
3797   Dissector Parameter calling party number
3798  */
3799 void
3800 dissect_isup_calling_party_number_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
3801 {
3802   proto_item *address_digits_item;
3803   proto_tree *address_digits_tree;
3804   proto_item *hidden_item;
3805   guint8 indicators1, indicators2;
3806   guint8 address_digit_pair=0;
3807   gint offset=0;
3808   gint i=0;
3809   gint length;
3810   char calling_number[MAXDIGITS + 1]="";
3811   e164_info_t e164_info;
3812   gint number_plan;
3813
3814   indicators1 = tvb_get_guint8(parameter_tvb, 0);
3815   proto_tree_add_boolean(parameter_tree, hf_isup_odd_even_indicator, parameter_tvb, 0, 1, indicators1);
3816   proto_tree_add_uint(parameter_tree, hf_isup_calling_party_nature_of_address_indicator, parameter_tvb, 0, 1, indicators1);
3817   indicators2 = tvb_get_guint8(parameter_tvb, 1);
3818   number_plan = (indicators2 & 0x70)>> 4;
3819   proto_tree_add_boolean(parameter_tree, hf_isup_ni_indicator, parameter_tvb, 1, 1, indicators2);
3820   proto_tree_add_uint(parameter_tree, hf_isup_numbering_plan_indicator, parameter_tvb, 1, 1, indicators2);
3821   proto_tree_add_uint(parameter_tree, hf_isup_address_presentation_restricted_indicator, parameter_tvb, 1, 1, indicators2);
3822   proto_tree_add_uint(parameter_tree, hf_isup_screening_indicator, parameter_tvb, 1, 1, indicators2);
3823   offset = 2;
3824
3825   length = tvb_length_remaining(parameter_tvb, offset);
3826   if (length == 0) {
3827     proto_tree_add_text(parameter_tree, parameter_tvb, offset, 0, "Calling Number (empty)");
3828     proto_item_set_text(parameter_item, "Calling Number: (empty)");
3829     return;
3830   }
3831
3832   address_digits_item = proto_tree_add_text(parameter_tree, parameter_tvb,
3833                                             offset, -1,
3834                                             "Calling Party Number");
3835   address_digits_tree = proto_item_add_subtree(address_digits_item, ett_isup_address_digits);
3836
3837   while(length > 0){
3838     address_digit_pair = tvb_get_guint8(parameter_tvb, offset);
3839     proto_tree_add_uint(address_digits_tree, hf_isup_calling_party_odd_address_signal_digit, parameter_tvb, offset, 1, address_digit_pair);
3840     calling_number[i++] = number_to_char(address_digit_pair & ISUP_ODD_ADDRESS_SIGNAL_DIGIT_MASK);
3841     if (i > MAXDIGITS)
3842       THROW(ReportedBoundsError);
3843     if ((length - 1) > 0 ){
3844       proto_tree_add_uint(address_digits_tree, hf_isup_calling_party_even_address_signal_digit, parameter_tvb, offset, 1, address_digit_pair);
3845       calling_number[i++] = number_to_char((address_digit_pair & ISUP_EVEN_ADDRESS_SIGNAL_DIGIT_MASK) / 0x10);
3846       if (i > MAXDIGITS)
3847         THROW(ReportedBoundsError);
3848     }
3849     offset++;
3850     length = tvb_length_remaining(parameter_tvb, offset);
3851   }
3852
3853   if  (((indicators1 & 0x80) == 0) && (tvb_length(parameter_tvb) > 0)){ /* Even Indicator set -> last even digit is valid & has be displayed */
3854     proto_tree_add_uint(address_digits_tree, hf_isup_calling_party_even_address_signal_digit, parameter_tvb, offset - 1, 1, address_digit_pair);
3855     calling_number[i++] = number_to_char((address_digit_pair & ISUP_EVEN_ADDRESS_SIGNAL_DIGIT_MASK) / 0x10);
3856     if (i > MAXDIGITS)
3857       THROW(ReportedBoundsError);
3858   }
3859   proto_item_set_text(address_digits_item, "Calling Party Number: %s", calling_number);
3860   calling_number[i++] = '\0';
3861   if ( number_plan == 1 ) {
3862     e164_info.e164_number_type = CALLING_PARTY_NUMBER;
3863     e164_info.nature_of_address = indicators1 & 0x7f;
3864     e164_info.E164_number_str = calling_number;
3865     e164_info.E164_number_length = i - 1;
3866     dissect_e164_number(parameter_tvb, address_digits_tree, 2, (offset - 2), e164_info);
3867     hidden_item = proto_tree_add_string(address_digits_tree, hf_isup_calling, parameter_tvb,
3868                                         offset - length, length, calling_number);
3869     PROTO_ITEM_SET_HIDDEN(hidden_item);
3870   } else {
3871     proto_tree_add_string(address_digits_tree, hf_isup_calling, parameter_tvb,
3872                           offset - length, length, calling_number);
3873   }
3874
3875   proto_item_set_text(parameter_item, "Calling Party Number: %s", calling_number);
3876   tap_calling_number = ep_strdup(calling_number);
3877 }
3878 /* ------------------------------------------------------------------
3879   Dissector Parameter Original called  number
3880  */
3881 void
3882 dissect_isup_original_called_number_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
3883 {
3884   proto_item *address_digits_item;
3885   proto_tree *address_digits_tree;
3886   guint8 indicators1, indicators2;
3887   guint8 address_digit_pair=0;
3888   gint offset=0;
3889   gint i=0;
3890   gint length;
3891   char calling_number[MAXDIGITS + 1]="";
3892
3893   indicators1 = tvb_get_guint8(parameter_tvb, 0);
3894   proto_tree_add_boolean(parameter_tree, hf_isup_odd_even_indicator, parameter_tvb, 0, 1, indicators1);
3895   proto_tree_add_uint(parameter_tree, hf_isup_calling_party_nature_of_address_indicator, parameter_tvb, 0, 1, indicators1);
3896   indicators2 = tvb_get_guint8(parameter_tvb, 1);
3897   proto_tree_add_uint(parameter_tree, hf_isup_numbering_plan_indicator, parameter_tvb, 1, 1, indicators2);
3898   proto_tree_add_uint(parameter_tree, hf_isup_address_presentation_restricted_indicator, parameter_tvb, 1, 1, indicators2);
3899   offset = 2;
3900
3901   length = tvb_length_remaining(parameter_tvb, offset);
3902
3903   if (length == 0) {
3904     proto_tree_add_text(parameter_tree, parameter_tvb, offset, 0, "Original Called Number (empty)");
3905     proto_item_set_text(parameter_item, "Original Called Number: (empty)");
3906     return;
3907   }
3908
3909   address_digits_item = proto_tree_add_text(parameter_tree, parameter_tvb,
3910                                             offset, -1,
3911                                             "Original Called Number");
3912   address_digits_tree = proto_item_add_subtree(address_digits_item, ett_isup_address_digits);
3913
3914   length = tvb_length_remaining(parameter_tvb, offset);
3915   while(length > 0){
3916     address_digit_pair = tvb_get_guint8(parameter_tvb, offset);
3917     proto_tree_add_uint(address_digits_tree, hf_isup_calling_party_odd_address_signal_digit, parameter_tvb, offset, 1, address_digit_pair);
3918     calling_number[i++] = number_to_char(address_digit_pair & ISUP_ODD_ADDRESS_SIGNAL_DIGIT_MASK);
3919     if (i > MAXDIGITS)
3920       THROW(ReportedBoundsError);
3921     if ((length - 1) > 0 ){
3922       proto_tree_add_uint(address_digits_tree, hf_isup_calling_party_even_address_signal_digit, parameter_tvb, offset, 1, address_digit_pair);
3923       calling_number[i++] = number_to_char((address_digit_pair & ISUP_EVEN_ADDRESS_SIGNAL_DIGIT_MASK) / 0x10);
3924       if (i > MAXDIGITS)
3925         THROW(ReportedBoundsError);
3926     }
3927     offset++;
3928     length = tvb_length_remaining(parameter_tvb, offset);
3929   }
3930
3931   if  (((indicators1 & 0x80) == 0) && (tvb_length(parameter_tvb) > 0)){ /* Even Indicator set -> last even digit is valid & has be displayed */
3932       proto_tree_add_uint(address_digits_tree, hf_isup_calling_party_even_address_signal_digit, parameter_tvb, offset - 1, 1, address_digit_pair);
3933       calling_number[i++] = number_to_char((address_digit_pair & ISUP_EVEN_ADDRESS_SIGNAL_DIGIT_MASK) / 0x10);
3934       if (i > MAXDIGITS)
3935         THROW(ReportedBoundsError);
3936   }
3937   calling_number[i++] = '\0';
3938
3939   proto_item_set_text(address_digits_item, "Original Called Number: %s", calling_number);
3940   proto_item_set_text(parameter_item, "Original Called Number: %s", calling_number);
3941
3942 }
3943 /* ------------------------------------------------------------------
3944   Dissector Parameter Redirecting number
3945  */
3946 void
3947 dissect_isup_redirecting_number_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
3948 {
3949   proto_item *address_digits_item;
3950   proto_tree *address_digits_tree;
3951   guint8 indicators1, indicators2;
3952   guint8 address_digit_pair=0;
3953   gint offset=0;
3954   gint i=0;
3955   gint length;
3956   char calling_number[MAXDIGITS + 1]="";
3957
3958   indicators1 = tvb_get_guint8(parameter_tvb, 0);
3959   proto_tree_add_boolean(parameter_tree, hf_isup_odd_even_indicator, parameter_tvb, 0, 1, indicators1);
3960   proto_tree_add_uint(parameter_tree, hf_isup_calling_party_nature_of_address_indicator, parameter_tvb, 0, 1, indicators1);
3961   indicators2 = tvb_get_guint8(parameter_tvb, 1);
3962   proto_tree_add_uint(parameter_tree, hf_isup_numbering_plan_indicator, parameter_tvb, 1, 1, indicators2);
3963   proto_tree_add_uint(parameter_tree, hf_isup_address_presentation_restricted_indicator, parameter_tvb, 1, 1, indicators2);
3964   offset = 2;
3965
3966   length = tvb_length_remaining(parameter_tvb, offset);
3967
3968   if (length == 0) {
3969     proto_tree_add_text(parameter_tree, parameter_tvb, offset, 0, "Redirecting Number (empty)");
3970     proto_item_set_text(parameter_item, "Redirecting Number: (empty)");
3971     return;
3972   }
3973
3974   address_digits_item = proto_tree_add_text(parameter_tree, parameter_tvb,
3975                                             offset, -1,
3976                                             "Redirecting Number");
3977   address_digits_tree = proto_item_add_subtree(address_digits_item, ett_isup_address_digits);
3978
3979   length = tvb_length_remaining(parameter_tvb, offset);
3980   while(length > 0){
3981     address_digit_pair = tvb_get_guint8(parameter_tvb, offset);
3982     proto_tree_add_uint(address_digits_tree, hf_isup_calling_party_odd_address_signal_digit, parameter_tvb, offset, 1, address_digit_pair);
3983     calling_number[i++] = number_to_char(address_digit_pair & ISUP_ODD_ADDRESS_SIGNAL_DIGIT_MASK);
3984     if (i > MAXDIGITS)
3985       THROW(ReportedBoundsError);
3986     if ((length - 1) > 0 ){
3987       proto_tree_add_uint(address_digits_tree, hf_isup_calling_party_even_address_signal_digit, parameter_tvb, offset, 1, address_digit_pair);
3988       calling_number[i++] = number_to_char((address_digit_pair & ISUP_EVEN_ADDRESS_SIGNAL_DIGIT_MASK) / 0x10);
3989       if (i > MAXDIGITS)
3990         THROW(ReportedBoundsError);
3991     }
3992     offset++;
3993     length = tvb_length_remaining(parameter_tvb, offset);
3994   }
3995
3996   if  (((indicators1 & 0x80) == 0) && (tvb_length(parameter_tvb) > 0)){ /* Even Indicator set -> last even digit is valid & has be displayed */
3997       proto_tree_add_uint(address_digits_tree, hf_isup_calling_party_even_address_signal_digit, parameter_tvb, offset - 1, 1, address_digit_pair);
3998       calling_number[i++] = number_to_char((address_digit_pair & ISUP_EVEN_ADDRESS_SIGNAL_DIGIT_MASK) / 0x10);
3999       if (i > MAXDIGITS)
4000         THROW(ReportedBoundsError);
4001   }
4002   calling_number[i++] = '\0';
4003
4004   proto_item_set_text(address_digits_item, "Redirecting Number: %s", calling_number);
4005   proto_tree_add_string(address_digits_tree, hf_isup_redirecting, parameter_tvb, offset - length, length, calling_number);
4006   proto_item_set_text(parameter_item, "Redirecting Number: %s", calling_number);
4007 }
4008 /* ------------------------------------------------------------------
4009   Dissector Parameter Redirection number
4010  */
4011 static void
4012 dissect_isup_redirection_number_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4013 {
4014   proto_item *address_digits_item;
4015   proto_tree *address_digits_tree;
4016   guint8 indicators1, indicators2;
4017   guint8 address_digit_pair=0;
4018   gint offset=0;
4019   gint i=0;
4020   gint length;
4021   char called_number[MAXDIGITS + 1]="";
4022
4023   indicators1 = tvb_get_guint8(parameter_tvb, 0);
4024   proto_tree_add_boolean(parameter_tree, hf_isup_odd_even_indicator, parameter_tvb, 0, 1, indicators1);
4025   proto_tree_add_uint(parameter_tree, hf_isup_called_party_nature_of_address_indicator, parameter_tvb, 0, 1, indicators1);
4026   indicators2 = tvb_get_guint8(parameter_tvb, 1);
4027   proto_tree_add_boolean(parameter_tree, hf_isup_inn_indicator, parameter_tvb, 1, 1, indicators2);
4028   proto_tree_add_uint(parameter_tree, hf_isup_numbering_plan_indicator, parameter_tvb, 1, 1, indicators2);
4029   offset = 2;
4030
4031   address_digits_item = proto_tree_add_text(parameter_tree, parameter_tvb,
4032                                             offset, -1,
4033                                             "Redirection Number");
4034   address_digits_tree = proto_item_add_subtree(address_digits_item, ett_isup_address_digits);
4035
4036   length = tvb_length_remaining(parameter_tvb, offset);
4037   while(length > 0){
4038     address_digit_pair = tvb_get_guint8(parameter_tvb, offset);
4039     proto_tree_add_uint(address_digits_tree, hf_isup_called_party_odd_address_signal_digit, parameter_tvb, offset, 1, address_digit_pair);
4040     called_number[i++] = number_to_char(address_digit_pair & ISUP_ODD_ADDRESS_SIGNAL_DIGIT_MASK);
4041     if (i > MAXDIGITS)
4042       THROW(ReportedBoundsError);
4043     if ((length - 1) > 0 ){
4044       proto_tree_add_uint(address_digits_tree, hf_isup_called_party_even_address_signal_digit, parameter_tvb, offset, 1, address_digit_pair);
4045       called_number[i++] = number_to_char((address_digit_pair & ISUP_EVEN_ADDRESS_SIGNAL_DIGIT_MASK) / 0x10);
4046       if (i > MAXDIGITS)
4047         THROW(ReportedBoundsError);
4048     }
4049     offset++;
4050     length = tvb_length_remaining(parameter_tvb, offset);
4051   }
4052
4053   if  (((indicators1 & 0x80) == 0) && (tvb_length(parameter_tvb) > 0)){ /* Even Indicator set -> last even digit is valid & has be displayed */
4054       proto_tree_add_uint(address_digits_tree, hf_isup_called_party_even_address_signal_digit, parameter_tvb, offset - 1, 1, address_digit_pair);
4055       called_number[i++] = number_to_char((address_digit_pair & ISUP_EVEN_ADDRESS_SIGNAL_DIGIT_MASK) / 0x10);
4056       if (i > MAXDIGITS)
4057         THROW(ReportedBoundsError);
4058   }
4059   called_number[i++] = '\0';
4060
4061   proto_item_set_text(address_digits_item, "Redirection Number: %s", called_number);
4062   proto_item_set_text(parameter_item, "Redirection Number: %s", called_number);
4063 }
4064 /* ------------------------------------------------------------------
4065   Dissector Parameter Connection request
4066  */
4067 static void
4068 dissect_isup_connection_request_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4069 {
4070   guint32 local_ref;
4071   guint16 spc;
4072   guint8 protocol_class, credit, offset=0;
4073
4074   local_ref = tvb_get_ntoh24(parameter_tvb, 0);
4075   proto_tree_add_text(parameter_tree, parameter_tvb, offset, LOCAL_REF_LENGTH, "Local Reference: %u", local_ref);
4076   offset = LOCAL_REF_LENGTH;
4077   spc = tvb_get_letohs(parameter_tvb,offset) & 0x3FFF; /*since 1st 2 bits spare */
4078   proto_tree_add_text(parameter_tree, parameter_tvb, offset, SPC_LENGTH, "Signalling Point Code: %u", spc);
4079   offset += SPC_LENGTH;
4080   protocol_class = tvb_get_guint8(parameter_tvb, offset);
4081   proto_tree_add_text(parameter_tree, parameter_tvb, offset, PROTOCOL_CLASS_LENGTH, "Protocol Class: %u", protocol_class);
4082   offset += PROTOCOL_CLASS_LENGTH;
4083   credit = tvb_get_guint8(parameter_tvb, offset);
4084   proto_tree_add_text(parameter_tree, parameter_tvb, offset, CREDIT_LENGTH, "Credit: %u", credit);
4085   offset += CREDIT_LENGTH;
4086
4087   proto_item_set_text(parameter_item, "Connection request: Local Reference = %u, SPC = %u, Protocol Class = %u, Credit = %u", local_ref, spc, protocol_class, credit);
4088 }
4089 /* ------------------------------------------------------------------
4090   Dissector Parameter Redirection information
4091  */
4092 void
4093 dissect_isup_redirection_information_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4094 {
4095   if (tvb_length(parameter_tvb) == 2){
4096     guint16 indicators;
4097     indicators = tvb_get_ntohs(parameter_tvb, 0);
4098     proto_tree_add_uint(parameter_tree, hf_isup_redirecting_ind, parameter_tvb,0 , REDIRECTION_INFO_LENGTH, indicators);
4099     proto_tree_add_uint(parameter_tree, hf_isup_original_redirection_reason, parameter_tvb,0 , REDIRECTION_INFO_LENGTH, indicators);
4100     proto_tree_add_uint(parameter_tree, hf_isup_redirection_counter, parameter_tvb,0 , REDIRECTION_INFO_LENGTH, indicators);
4101     proto_tree_add_uint(parameter_tree, hf_isup_redirection_reason, parameter_tvb,0 , REDIRECTION_INFO_LENGTH, indicators);
4102     proto_item_set_text(parameter_item, "Redirection Information");
4103   }
4104   else { /* ISUP'88 (blue book) */
4105     guint16 indicators;
4106     indicators = tvb_get_guint8(parameter_tvb, 0) * 0x100; /*since 2nd octet isn't present*/
4107     proto_tree_add_uint(parameter_tree, hf_isup_redirecting_ind, parameter_tvb, 0, 1, indicators);
4108     proto_tree_add_uint(parameter_tree, hf_isup_original_redirection_reason, parameter_tvb,0 , 1, indicators);
4109     proto_item_set_text(parameter_item, "Redirection Information (2nd octet not present since ISUP '88)");
4110   }
4111 }
4112 /* ------------------------------------------------------------------
4113   Dissector Parameter Closed user group interlock code
4114  */
4115 static void
4116 dissect_isup_closed_user_group_interlock_code_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4117 {
4118   char NI_digits[5]="";
4119   guint8 digit_pair;
4120   guint16 bin_code;
4121
4122   digit_pair = tvb_get_guint8(parameter_tvb, 0);
4123   NI_digits[0] = number_to_char((digit_pair & HGFE_8BIT_MASK) / 0x10);
4124   NI_digits[1] = number_to_char(digit_pair & DCBA_8BIT_MASK);
4125   digit_pair = tvb_get_guint8(parameter_tvb, 1);
4126   NI_digits[2] = number_to_char((digit_pair & HGFE_8BIT_MASK) / 0x10);
4127   NI_digits[3] = number_to_char(digit_pair & DCBA_8BIT_MASK);
4128   NI_digits[4] = '\0';
4129   proto_tree_add_text(parameter_tree, parameter_tvb, 0, 2, "Network Identity: %s", NI_digits);
4130   bin_code = tvb_get_ntohs(parameter_tvb, 2);
4131   proto_tree_add_text(parameter_tree, parameter_tvb, 3, 2, "Binary Code: 0x%x", bin_code);
4132   proto_item_set_text(parameter_item, "Closed user group interlock code: NI = %s, Binary code = 0x%x", NI_digits, bin_code);
4133 }
4134 /* ------------------------------------------------------------------
4135   Dissector Parameter User service information- no detailed dissection since defined in Rec. Q.931
4136  */
4137 static void
4138 dissect_isup_user_service_information_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4139 { guint length = tvb_length(parameter_tvb);
4140   proto_tree_add_text(parameter_tree, parameter_tvb, 0, length,
4141                       "User service information (-> Q.931 Bearer_capability)");
4142   proto_item_set_text(parameter_item, "User service information, (%u byte%s length)",
4143                       length , plurality(length, "", "s"));
4144   dissect_q931_bearer_capability_ie(parameter_tvb,
4145                                     0, length,
4146                                     parameter_tree);
4147 }
4148 /* ------------------------------------------------------------------
4149   Dissector Parameter Signalling point code
4150  */
4151 static void
4152 dissect_isup_signalling_point_code_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4153 {
4154   guint16 spc;
4155
4156   spc = tvb_get_letohs(parameter_tvb, 0) & 0x3FFF; /*since 1st 2 bits spare */
4157   proto_tree_add_text(parameter_tree, parameter_tvb, 0, SIGNALLING_POINT_CODE_LENGTH, "Signalling Point Code: %u", spc);
4158
4159   proto_item_set_text(parameter_item, "Signalling point code: %u", spc);
4160 }
4161 /* ------------------------------------------------------------------
4162   Dissector Parameter Connected number
4163  */
4164 static void
4165 dissect_isup_connected_number_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4166 {
4167   proto_item *address_digits_item;
4168   proto_tree *address_digits_tree;
4169   guint8 indicators1, indicators2;
4170   guint8 address_digit_pair=0;
4171   gint offset=0;
4172   gint i=0;
4173   gint length;
4174   char calling_number[MAXDIGITS + 1]="";
4175
4176   indicators1 = tvb_get_guint8(parameter_tvb, 0);
4177   proto_tree_add_boolean(parameter_tree, hf_isup_odd_even_indicator, parameter_tvb, 0, 1, indicators1);
4178   proto_tree_add_uint(parameter_tree, hf_isup_calling_party_nature_of_address_indicator, parameter_tvb, 0, 1, indicators1);
4179   indicators2 = tvb_get_guint8(parameter_tvb, 1);
4180   proto_tree_add_uint(parameter_tree, hf_isup_numbering_plan_indicator, parameter_tvb, 1, 1, indicators2);
4181   proto_tree_add_uint(parameter_tree, hf_isup_address_presentation_restricted_indicator, parameter_tvb, 1, 1, indicators2);
4182   proto_tree_add_uint(parameter_tree, hf_isup_screening_indicator, parameter_tvb, 1, 1, indicators2);
4183   offset = 2;
4184
4185   length = tvb_length_remaining(parameter_tvb, offset);
4186   if (length == 0)
4187     return; /* empty connected number */
4188   address_digits_item = proto_tree_add_text(parameter_tree, parameter_tvb,
4189                                             offset, -1,
4190                                             "Connected Number");
4191   address_digits_tree = proto_item_add_subtree(address_digits_item, ett_isup_address_digits);
4192
4193   while(length > 0){
4194     address_digit_pair = tvb_get_guint8(parameter_tvb, offset);
4195     proto_tree_add_uint(address_digits_tree, hf_isup_calling_party_odd_address_signal_digit, parameter_tvb, offset, 1, address_digit_pair);
4196     calling_number[i++] = number_to_char(address_digit_pair & ISUP_ODD_ADDRESS_SIGNAL_DIGIT_MASK);
4197     if (i > MAXDIGITS)
4198       THROW(ReportedBoundsError);
4199     if ((length - 1) > 0 ){
4200       proto_tree_add_uint(address_digits_tree, hf_isup_calling_party_even_address_signal_digit, parameter_tvb, offset, 1, address_digit_pair);
4201       calling_number[i++] = number_to_char((address_digit_pair & ISUP_EVEN_ADDRESS_SIGNAL_DIGIT_MASK) / 0x10);
4202       if (i > MAXDIGITS)
4203         THROW(ReportedBoundsError);
4204     }
4205     offset++;
4206     length = tvb_length_remaining(parameter_tvb, offset);
4207   }
4208
4209   if  (((indicators1 & 0x80) == 0) && (tvb_length(parameter_tvb) > 0)){ /* Even Indicator set -> last even digit is valid & has be displayed */
4210       proto_tree_add_uint(address_digits_tree, hf_isup_calling_party_even_address_signal_digit, parameter_tvb, offset - 1, 1, address_digit_pair);
4211       calling_number[i++] = number_to_char((address_digit_pair & ISUP_EVEN_ADDRESS_SIGNAL_DIGIT_MASK) / 0x10);
4212       if (i > MAXDIGITS)
4213         THROW(ReportedBoundsError);
4214   }
4215   calling_number[i++] = '\0';
4216
4217   proto_item_set_text(address_digits_item, "Connected Number: %s", calling_number);
4218   proto_item_set_text(parameter_item, "Connected Number: %s", calling_number);
4219
4220 }
4221 /* ------------------------------------------------------------------
4222   Dissector Transit network selection
4223  */
4224 static void
4225 dissect_isup_transit_network_selection_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4226 {
4227   proto_item *address_digits_item;
4228   proto_tree *address_digits_tree;
4229   guint8 indicators;
4230   guint8 address_digit_pair=0;
4231   gint offset=0;
4232   gint i=0;
4233   gint length;
4234   char network_id[MAXDIGITS + 1]="";
4235
4236   indicators = tvb_get_guint8(parameter_tvb, 0);
4237   proto_tree_add_boolean(parameter_tree, hf_isup_odd_even_indicator, parameter_tvb, 0, 1, indicators);
4238   proto_tree_add_uint(parameter_tree, hf_isup_type_of_network_identification, parameter_tvb, 0, 1, indicators);
4239   proto_tree_add_uint(parameter_tree, hf_isup_network_identification_plan, parameter_tvb, 0, 1, indicators);
4240   offset = 1;
4241
4242   address_digits_item = proto_tree_add_text(parameter_tree, parameter_tvb,
4243                                             offset, -1,
4244                                             "Network identification");
4245   address_digits_tree = proto_item_add_subtree(address_digits_item, ett_isup_address_digits);
4246
4247   length = tvb_length_remaining(parameter_tvb, offset);
4248   while(length > 0){
4249     address_digit_pair = tvb_get_guint8(parameter_tvb, offset);
4250     proto_tree_add_uint(address_digits_tree, hf_isup_calling_party_odd_address_signal_digit, parameter_tvb, offset, 1, address_digit_pair);
4251     network_id[i++] = number_to_char(address_digit_pair & ISUP_ODD_ADDRESS_SIGNAL_DIGIT_MASK);
4252     if (i > MAXDIGITS)
4253       THROW(ReportedBoundsError);
4254     if ((length - 1) > 0 ){
4255       proto_tree_add_uint(address_digits_tree, hf_isup_calling_party_even_address_signal_digit, parameter_tvb, offset, 1, address_digit_pair);
4256       network_id[i++] = number_to_char((address_digit_pair & ISUP_EVEN_ADDRESS_SIGNAL_DIGIT_MASK) / 0x10);
4257       if (i > MAXDIGITS)
4258         THROW(ReportedBoundsError);
4259     }
4260     offset++;
4261     length = tvb_length_remaining(parameter_tvb, offset);
4262   }
4263
4264   if  (((indicators & 0x80) == 0) && (tvb_length(parameter_tvb) > 0)){ /* Even Indicator set -> last even digit is valid & has be displayed */
4265       proto_tree_add_uint(address_digits_tree, hf_isup_calling_party_even_address_signal_digit, parameter_tvb, offset - 1, 1, address_digit_pair);
4266       network_id[i++] = number_to_char((address_digit_pair & ISUP_EVEN_ADDRESS_SIGNAL_DIGIT_MASK) / 0x10);
4267       if (i > MAXDIGITS)
4268         THROW(ReportedBoundsError);
4269   }
4270   network_id[i++] = '\0';
4271
4272   proto_item_set_text(address_digits_item, "Network identification: %s", network_id);
4273   proto_item_set_text(parameter_item, "Transit network selection: %s", network_id);
4274
4275 }
4276 /* ------------------------------------------------------------------
4277   Dissector Parameter Circuit assignment map
4278  */
4279 static void
4280 dissect_isup_circuit_assignment_map_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4281 { guint8 map_type;
4282
4283   map_type = tvb_get_guint8(parameter_tvb, 0);
4284   proto_tree_add_uint(parameter_tree, hf_isup_map_type, parameter_tvb, 0, 1, map_type);
4285   proto_tree_add_text(parameter_tree, parameter_tvb, 1, 5, "Circuit assignment map (bit position indicates usage of corresponding circuit->3.69/Q.763)");
4286   proto_item_set_text(parameter_item, "Circuit assignment map");
4287 }
4288 /* ------------------------------------------------------------------
4289   Dissector Parameter Automatic congestion level
4290  */
4291 static void
4292 dissect_isup_automatic_congestion_level_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4293 { guint8 congestion_level;
4294
4295   congestion_level = tvb_get_guint8(parameter_tvb, 0);
4296   proto_tree_add_uint(parameter_tree, hf_isup_automatic_congestion_level, parameter_tvb, 0, AUTO_CONGEST_LEVEL_LENGTH, congestion_level);
4297   proto_item_set_text(parameter_item, "Automatic congestion level: %s (%u)", val_to_str(congestion_level, isup_auto_congestion_level_value, "spare"), congestion_level);
4298 }
4299 /* ------------------------------------------------------------------
4300   Dissector Parameter Optional backward Call indicators
4301  */
4302 static void
4303 dissect_isup_optional_backward_call_indicators_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4304 {
4305   guint8 indicators;
4306
4307   indicators = tvb_get_guint8(parameter_tvb, 0);
4308   proto_tree_add_boolean(parameter_tree, hf_isup_inband_information_ind, parameter_tvb, 0, OPTIONAL_BACKWARD_CALL_IND_LENGTH, indicators);
4309   proto_tree_add_boolean(parameter_tree, hf_isup_call_diversion_may_occur_ind, parameter_tvb, 0, OPTIONAL_BACKWARD_CALL_IND_LENGTH, indicators);
4310   proto_tree_add_boolean(parameter_tree, hf_isup_simple_segmentation_ind, parameter_tvb, 0, OPTIONAL_BACKWARD_CALL_IND_LENGTH, indicators);
4311   proto_tree_add_boolean(parameter_tree, hf_isup_mlpp_user_ind, parameter_tvb, 0, OPTIONAL_BACKWARD_CALL_IND_LENGTH, indicators);
4312
4313
4314   proto_item_set_text(parameter_item,"Optional backward call indicators: 0x%x", indicators );
4315 }
4316 /* ------------------------------------------------------------------
4317   Dissector Parameter User-to-user indicators
4318  */
4319 static const true_false_string isup_UUI_type_value = {
4320   "Response",
4321   "Request"
4322 };
4323 static const value_string isup_UUI_request_service_values[] = {
4324   { 0,  "No information"},
4325   { 1,  "Spare"},
4326   { 2,  "Request, not essential"},
4327   { 3,  "Request,essential"},
4328   { 0,  NULL}
4329 };
4330
4331 static const value_string isup_UUI_response_service_values[] = {
4332   { 0,  "No information"},
4333   { 1,  "Not provided"},
4334   { 2,  "Provided"},
4335   { 3,  "Spare"},
4336   { 0,  NULL}
4337 };
4338 static const true_false_string isup_UUI_network_discard_ind_value= {
4339   "User-to-user information discarded by the network",
4340   "No information"
4341 };
4342
4343 static void
4344 dissect_isup_user_to_user_indicators_parameter(tvbuff_t *parameter_tvb,
4345                                                proto_tree *parameter_tree,
4346                                                proto_item *parameter_item)
4347 {
4348   guint8 indicators;
4349
4350   indicators = tvb_get_guint8(parameter_tvb, 0);
4351   proto_tree_add_boolean(parameter_tree, hf_isup_UUI_type, parameter_tvb, 0, 1, indicators);
4352   if ( (indicators & 0x01) == 0 ){
4353     /* Request */
4354     proto_tree_add_uint(parameter_tree, hf_isup_UUI_req_service1, parameter_tvb, 0, 1, indicators);
4355     proto_tree_add_uint(parameter_tree, hf_isup_UUI_req_service2, parameter_tvb, 0, 1, indicators);
4356     proto_tree_add_uint(parameter_tree, hf_isup_UUI_req_service3, parameter_tvb, 0, 1, indicators);
4357   }
4358   else {
4359     /* Response */
4360     proto_tree_add_uint(parameter_tree, hf_isup_UUI_res_service1, parameter_tvb, 0, 1, indicators);
4361     proto_tree_add_uint(parameter_tree, hf_isup_UUI_res_service2, parameter_tvb, 0, 1, indicators);
4362     proto_tree_add_uint(parameter_tree, hf_isup_UUI_res_service3, parameter_tvb, 0, 1, indicators);
4363     proto_tree_add_boolean(parameter_tree, hf_isup_UUI_network_discard_ind, parameter_tvb, 0, 1, indicators);
4364
4365   }
4366   proto_item_set_text(parameter_item,"User-to-user indicators: 0x%x", indicators );
4367 }
4368 /* ------------------------------------------------------------------
4369   Dissector Parameter Original ISC point code
4370  */
4371 static void
4372 dissect_isup_original_isc_point_code_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4373 {
4374   guint16 spc;
4375
4376   spc = tvb_get_letohs(parameter_tvb, 0) & 0x3FFF; /*since 1st 2 bits spare */
4377   proto_tree_add_text(parameter_tree, parameter_tvb, 0, ORIGINAL_ISC_POINT_CODE_LENGTH, "Origination ISC Point Code: %u", spc);
4378
4379   proto_item_set_text(parameter_item, "Origination ISC point code: %u", spc);
4380 }
4381 /* ------------------------------------------------------------------
4382   Dissector Parameter Generic notification indicator
4383  */
4384 static void
4385 dissect_isup_generic_notification_indicator_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4386 {
4387   guint8 indicators;
4388
4389   indicators = tvb_get_guint8(parameter_tvb, 0);
4390   proto_tree_add_text(parameter_tree, parameter_tvb, 0, GENERIC_NOTIFICATION_IND_LENGTH, "Generic notification indicator: 0x%x (refer to 3.25/Q.763 for detailed decoding)", indicators );
4391   proto_item_set_text(parameter_item,"Generic notification indicator: 0x%x", indicators );
4392 }
4393 /* ------------------------------------------------------------------
4394   Dissector Parameter Call history information
4395  */
4396 static void
4397 dissect_isup_call_history_information_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4398 {
4399   guint16 info;
4400
4401   info = tvb_get_ntohs(parameter_tvb, 0);
4402   proto_tree_add_text(parameter_tree, parameter_tvb, 0, CALL_HISTORY_INFO_LENGTH, "Call history info: propagation delay = %u ms", info);
4403   proto_item_set_text(parameter_item,"Call history info: propagation delay = %u ms", info);
4404 }
4405 /* ------------------------------------------------------------------
4406   Dissector Parameter Access delivery information
4407  */
4408 static void
4409 dissect_isup_access_delivery_information_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4410 { guint8 indicator;
4411
4412   indicator = tvb_get_guint8(parameter_tvb, 0);
4413   proto_tree_add_boolean(parameter_tree, hf_isup_access_delivery_ind, parameter_tvb, 0, ACCESS_DELIVERY_INFO_LENGTH, indicator);
4414   proto_item_set_text(parameter_item, "Access delivery information: 0x%x", indicator);
4415 }
4416 /* ------------------------------------------------------------------
4417   Dissector Parameter Network specific facility
4418  */
4419 static void
4420 dissect_isup_network_specific_facility_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4421 { guint length = tvb_length(parameter_tvb);
4422   proto_tree_add_text(parameter_tree, parameter_tvb, 0, length, "Network specific facility (refer to 3.36/Q.763 for detailed decoding)");
4423   proto_item_set_text(parameter_item, "Network specific facility (%u byte%s length)", length , plurality(length, "", "s"));
4424 }
4425 /* ------------------------------------------------------------------
4426   Dissector Parameter User service information prime
4427  */
4428 static void
4429 dissect_isup_user_service_information_prime_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4430 { guint length = tvb_length(parameter_tvb);
4431   proto_tree_add_text(parameter_tree, parameter_tvb, 0, length,
4432                       "User service information prime (-> Q.931 Bearer capability information IE)");
4433   dissect_q931_bearer_capability_ie(parameter_tvb,
4434                                     0, length,
4435                                     parameter_tree);
4436
4437   proto_item_set_text(parameter_item, "User service information prime, (%u byte%s length)",
4438                       length , plurality(length, "", "s"));
4439 }
4440 /* ------------------------------------------------------------------
4441   Dissector Parameter Propagation delay counter
4442  */
4443 static void
4444 dissect_isup_propagation_delay_counter_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4445 {
4446   guint16 info;
4447
4448   info = tvb_get_ntohs(parameter_tvb, 0);
4449   proto_tree_add_text(parameter_tree, parameter_tvb, 0, PROPAGATION_DELAY_COUNT_LENGTH, "Propagation delay counter = %u ms", info);
4450   proto_item_set_text(parameter_item,"Propagation delay counter = %u ms", info);
4451 }
4452 /* ------------------------------------------------------------------
4453   Dissector Parameter Remote operations
4454  */
4455 static void
4456 dissect_isup_remote_operations_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4457 { guint length = tvb_length(parameter_tvb);
4458   proto_tree_add_text(parameter_tree, parameter_tvb, 0, length, "Remote operations");
4459   proto_item_set_text(parameter_item, "Remote operations (%u byte%s length)", length , plurality(length, "", "s"));
4460 }
4461 /* ------------------------------------------------------------------
4462   Dissector Parameter Service activation
4463  */
4464 static void
4465 dissect_isup_service_activation_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4466 {
4467   guint i;
4468   guint8 feature_code;
4469   guint length = tvb_length(parameter_tvb);
4470   for (i=0; i< length; i++){
4471     feature_code = tvb_get_guint8(parameter_tvb, i);
4472     proto_tree_add_text(parameter_tree, parameter_tvb, i, 1, "Feature Code %u: %u", i+1, feature_code);
4473   }
4474   proto_item_set_text(parameter_item, "Service Activation (%u byte%s length)", length , plurality(length, "", "s"));
4475 }
4476 /* ------------------------------------------------------------------
4477   Dissector Parameter User service information prime - no detailed dissection since defined in Rec. Q.931
4478  */
4479 static void
4480 dissect_isup_user_teleservice_information_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4481 {
4482   guint length = tvb_length(parameter_tvb);
4483   proto_tree_add_text(parameter_tree, parameter_tvb, 0, length,
4484                       "User teleservice information (-> Q.931 High Layer Compatibility IE)");
4485
4486   dissect_q931_high_layer_compat_ie(parameter_tvb, 0, length, parameter_tree);
4487
4488   proto_item_set_text(parameter_item,
4489                       "User teleservice information");
4490 }
4491 /* ------------------------------------------------------------------
4492   Dissector Parameter Transmission medium requirement used
4493  */
4494 static void
4495 dissect_isup_transmission_medium_used_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4496 {
4497   guint8 transmission_medium_requirement;
4498
4499   transmission_medium_requirement = tvb_get_guint8(parameter_tvb, 0);
4500   proto_tree_add_uint(parameter_tree, hf_isup_transmission_medium_requirement_prime, parameter_tvb, 0, TRANSMISSION_MEDIUM_RQMT_PRIME_LENGTH,transmission_medium_requirement);
4501
4502   proto_item_set_text(parameter_item, "Transmission medium used: %u (%s)",  transmission_medium_requirement, val_to_str_ext_const(transmission_medium_requirement, &isup_transmission_medium_requirement_prime_value_ext, "spare/reserved"));
4503 }
4504 /* ------------------------------------------------------------------
4505   Dissector Parameter Call diversion information
4506  */
4507 static void
4508 dissect_isup_call_diversion_information_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4509 { guint8 indicator;
4510
4511   indicator = tvb_get_guint8(parameter_tvb, 0);
4512   proto_tree_add_text(parameter_tree, parameter_tvb, 0, CALL_DIV_INFO_LENGTH, "Call diversion information: 0x%x (refer to 3.6/Q.763 for detailed decoding)", indicator);
4513   proto_item_set_text(parameter_item, "Call diversion information: 0x%x", indicator);
4514 }
4515 /* ------------------------------------------------------------------
4516   Dissector Parameter Echo control  information
4517  */
4518 static const value_string OECD_inf_ind_vals[] = {
4519   {0x00, "no information"},
4520   {0x01, "outgoing echo control device not included and not available"},
4521   {0x02, "outgoing echo control device included"},
4522   {0x03, "outgoing echo control device not included but available"},
4523   { 0,  NULL }
4524 };
4525 static const value_string IECD_inf_ind_vals[] = {
4526   {0x00, "no information"},
4527   {0x01, "incoming echo control device not included and not available"},
4528   {0x02, "incoming echo control device included"},
4529   {0x03, "incoming echo control device not included but available"},
4530   { 0,  NULL }
4531 };
4532
4533 static const value_string OECD_req_ind_vals[] = {
4534   {0x00, "no information"},
4535   {0x01, "outgoing echo control device activation request"},
4536   {0x02, "outgoing echo control device deactivation request"},
4537   {0x03, "spare"},
4538   { 0,  NULL }
4539 };
4540
4541 static const value_string IECD_req_ind_vals[] = {
4542   {0x00, "no information"},
4543   {0x01, "incoming echo control device activation request"},
4544   {0x02, "incoming echo control device deactivation request"},
4545   {0x03, "spare"},
4546   { 0,  NULL }
4547 };
4548
4549 static void
4550 dissect_isup_echo_control_information_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4551 { guint8 indicator;
4552   gint offset = 0;
4553   indicator = tvb_get_guint8(parameter_tvb, 0);
4554   proto_tree_add_text(parameter_tree, parameter_tvb, 0, ECHO_CONTROL_INFO_LENGTH,
4555                       "Echo control information: 0x%x", indicator);
4556
4557   proto_tree_add_uint(parameter_tree, hf_isup_OECD_inf_ind,
4558                       parameter_tvb, offset, 1, indicator );
4559
4560   proto_tree_add_uint(parameter_tree, hf_isup_IECD_inf_ind,
4561                       parameter_tvb, offset, 1, indicator );
4562
4563   proto_tree_add_uint(parameter_tree, hf_isup_OECD_req_ind,
4564                       parameter_tvb, offset, 1, indicator );
4565
4566   proto_tree_add_uint(parameter_tree, hf_isup_IECD_req_ind,
4567                 parameter_tvb, offset, 1, indicator );
4568
4569   proto_item_set_text(parameter_item, "Echo control information: 0x%x", indicator);
4570 }
4571 /* ------------------------------------------------------------------
4572   Dissector Parameter Message compatibility information
4573  */
4574
4575 static const true_false_string isup_pass_on_not_possible_indicator_value = {
4576   "discard information",
4577   "release call",
4578 };
4579
4580 static void
4581 dissect_isup_message_compatibility_information_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4582 {
4583   guint length = tvb_length(parameter_tvb);
4584   guint instruction_indicators;
4585   gint offset = 0;
4586   instruction_indicators = tvb_get_guint8(parameter_tvb, offset);
4587
4588   proto_tree_add_text(parameter_tree, parameter_tvb, 0, length,
4589                       "Message compatibility information");
4590
4591   proto_tree_add_boolean(parameter_tree, hf_isup_transit_at_intermediate_exchange_ind,
4592                          parameter_tvb, offset, 1, instruction_indicators );
4593
4594   proto_tree_add_boolean(parameter_tree, hf_isup_Release_call_ind,
4595                          parameter_tvb, offset, 1, instruction_indicators );
4596
4597   proto_tree_add_boolean(parameter_tree, hf_isup_Send_notification_ind,
4598                          parameter_tvb, offset, 1, instruction_indicators );
4599
4600   proto_tree_add_boolean(parameter_tree, hf_isup_Discard_message_ind_value,
4601                          parameter_tvb, offset, 1, instruction_indicators );
4602
4603   proto_tree_add_boolean(parameter_tree, hf_isup_pass_on_not_possible_indicator2,
4604                          parameter_tvb, offset, 1,instruction_indicators);
4605
4606   proto_tree_add_uint(parameter_tree, hf_isup_Broadband_narrowband_interworking_ind2,
4607                       parameter_tvb, offset, 1,instruction_indicators);
4608
4609   proto_tree_add_boolean(parameter_tree, hf_isup_extension_ind ,
4610                          parameter_tvb, offset, 1, instruction_indicators );
4611
4612   proto_item_set_text(parameter_item, "Message compatibility information (%u byte%s length)",
4613                       length , plurality(length, "", "s"));
4614 }
4615 /* ------------------------------------------------------------------
4616   Dissector Parameter compatibility information
4617  */
4618 static const true_false_string isup_transit_at_intermediate_exchange_ind_value  = {
4619   "End node interpretation",
4620   "Transit interpretation"
4621 };
4622
4623
4624 static const true_false_string isup_Discard_message_ind_value = {
4625   "Discard message",
4626   "Do not discard message (pass on)",
4627 };
4628
4629 static const true_false_string isup_Discard_parameter_ind_value = {
4630   "Discard parameter",
4631   "Do not discard parameter (pass on)",
4632 };
4633
4634 static const value_string isup_Pass_on_not_possible_indicator_vals[] = {
4635   { 0x00, "Release call" },
4636   { 0x01, "Discard message" },
4637   { 0x02, "Discard parameter" },
4638   { 0x03, "Reserved (interpreted as 00)" },
4639   { 0, NULL },
4640 };
4641 static const value_string ISUP_Broadband_narrowband_interworking_indicator_vals[] = {
4642   { 0x00, "Pass on" },
4643   { 0x01, "Discard message" },
4644   { 0x02, "Release call" },
4645   { 0x03, "Discard parameter" },
4646   { 0, NULL },
4647 };
4648
4649 static void
4650 dissect_isup_parameter_compatibility_information_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4651 {
4652   guint  length = tvb_length(parameter_tvb);
4653   guint  len = length;
4654   guint8 upgraded_parameter, upgraded_parameter_no;
4655   guint8 offset;
4656   guint8 instruction_indicators;
4657   offset = 0;
4658   upgraded_parameter_no = 0;
4659
4660   proto_item_set_text(parameter_item, "Parameter compatibility information (%u byte%s length)", length , plurality(length, "", "s"));
4661 /* etxrab Decoded as per Q.763 section 3.41 */
4662
4663   while ( len > 0 ) {
4664   upgraded_parameter_no = upgraded_parameter_no + 1;
4665   upgraded_parameter = tvb_get_guint8(parameter_tvb, offset);
4666
4667   proto_tree_add_text(parameter_tree, parameter_tvb, offset, 1,
4668                       "Upgraded parameter no: %u = %s", upgraded_parameter_no,
4669                       val_to_str_ext(upgraded_parameter, &isup_parameter_type_value_ext, "unknown (%u)"));
4670   offset += 1;
4671   len -= 1;
4672   instruction_indicators = tvb_get_guint8(parameter_tvb, offset);
4673
4674   proto_tree_add_text(parameter_tree, parameter_tvb, offset, 1,
4675                       "Instruction indicators: 0x%x ",
4676                       instruction_indicators);
4677
4678  proto_tree_add_boolean(parameter_tree, hf_isup_transit_at_intermediate_exchange_ind,
4679                 parameter_tvb, offset, 1, instruction_indicators );
4680
4681  proto_tree_add_boolean(parameter_tree, hf_isup_Release_call_ind, parameter_tvb, offset, 1, instruction_indicators );
4682
4683  proto_tree_add_boolean(parameter_tree, hf_isup_Send_notification_ind, parameter_tvb, offset, 1, instruction_indicators );
4684
4685  proto_tree_add_boolean(parameter_tree, hf_isup_Discard_message_ind_value, parameter_tvb, offset, 1, instruction_indicators );
4686
4687  proto_tree_add_boolean(parameter_tree, hf_isup_Discard_parameter_ind, parameter_tvb, offset, 1, instruction_indicators );
4688
4689  proto_tree_add_uint(parameter_tree, hf_isup_Pass_on_not_possible_indicator, parameter_tvb, offset, 1,instruction_indicators);
4690
4691  proto_tree_add_boolean(parameter_tree, hf_isup_extension_ind , parameter_tvb, offset, 1, instruction_indicators );
4692
4693   offset += 1;
4694   len -= 1;
4695   if (!(instruction_indicators & H_8BIT_MASK)) {
4696     if (len == 0)
4697       return;
4698     instruction_indicators = tvb_get_guint8(parameter_tvb, offset);
4699     proto_tree_add_uint(parameter_tree, hf_isup_Broadband_narrowband_interworking_ind, parameter_tvb, offset, 1,instruction_indicators);
4700     offset += 1;
4701     len -= 1;
4702   }
4703    if (len == 0)
4704    return;
4705   ;
4706  }
4707 /* etxrab */
4708
4709 }
4710 /* ------------------------------------------------------------------
4711   Dissector Parameter MLPP precedence
4712  */
4713 static void
4714 dissect_isup_mlpp_precedence_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4715 {
4716   char NI_digits[5]="";
4717   const char *temp_text = "";
4718   guint8 indicators, digit_pair;
4719   guint32 bin_code;
4720
4721   indicators = tvb_get_guint8(parameter_tvb, 0);
4722   switch ((indicators & 0x60) >> 5) {
4723     case 0x0:
4724       temp_text = "Allowed";
4725       break;
4726     case 0x1:
4727       temp_text = "Not Allowed";
4728       break;
4729     case 0x2:
4730       temp_text = "Path reserved";
4731       break;
4732     case 0x3:
4733       temp_text = "Spare";
4734       break;
4735   }
4736   proto_tree_add_text(parameter_tree, parameter_tvb, 0, 1, "Look forward busy: %s", temp_text);
4737   switch (indicators & 0xf) {
4738     case 0x0:
4739       temp_text = "Flash Override";
4740       break;
4741     case 0x1:
4742       temp_text = "Flash";
4743       break;
4744     case 0x2:
4745       temp_text = "Immediate";
4746       break;
4747     case 0x3:
4748       temp_text = "Priority";
4749       break;
4750     case 0x4:
4751       temp_text = "Routine";
4752       break;
4753     default:
4754       temp_text = "Spare";
4755       break;
4756   }
4757
4758
4759   proto_tree_add_text(parameter_tree, parameter_tvb, 0, 1, "Precedence Level: %s",temp_text);
4760   digit_pair = tvb_get_guint8(parameter_tvb, 1);
4761   NI_digits[0] = number_to_char((digit_pair & HGFE_8BIT_MASK) / 0x10);
4762   NI_digits[1] = number_to_char(digit_pair & DCBA_8BIT_MASK);
4763   digit_pair = tvb_get_guint8(parameter_tvb, 2);
4764   NI_digits[2] = number_to_char((digit_pair & HGFE_8BIT_MASK) / 0x10);
4765   NI_digits[3] = number_to_char(digit_pair & DCBA_8BIT_MASK);
4766   NI_digits[4] = '\0';
4767   proto_tree_add_text(parameter_tree, parameter_tvb, 1, 2, "Network Identity: %s", NI_digits);
4768   bin_code = tvb_get_ntoh24(parameter_tvb, 3);
4769   proto_tree_add_text(parameter_tree, parameter_tvb, 3, 3, "MLPP service domain: 0x%x", bin_code);
4770   proto_item_set_text(parameter_item, "MLPP precedence: Prec = %s, NI = %s, MLPP service domain = 0x%x", temp_text, NI_digits, bin_code);
4771 }
4772 /* ------------------------------------------------------------------
4773   Dissector Parameter MCID request indicators
4774  */
4775 static void
4776 dissect_isup_mcid_request_indicators_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4777 { guint8 indicator;
4778
4779   indicator = tvb_get_guint8(parameter_tvb, 0);
4780   proto_tree_add_text(parameter_tree, parameter_tvb, 0,MCID_REQUEST_IND_LENGTH, "MCID request indicators: 0x%x (MCID requested by Bit1=1, Holding requested by Bit2=1 see 3.31/Q.763)", indicator);
4781   proto_item_set_text(parameter_item, "MCID request indicators: 0x%x", indicator);
4782 }
4783 /* ------------------------------------------------------------------
4784   Dissector Parameter MCID response indicators
4785  */
4786 static void
4787 dissect_isup_mcid_response_indicators_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4788 { guint8 indicator;
4789
4790   indicator = tvb_get_guint8(parameter_tvb, 0);
4791   proto_tree_add_text(parameter_tree, parameter_tvb, 0,MCID_RESPONSE_IND_LENGTH, "MCID response indicators: 0x%x (MCID included if Bit1=1, Holding provided if Bit2=1 see 3.32/Q.763)", indicator);
4792   proto_item_set_text(parameter_item, "MCID response indicators: 0x%x", indicator);
4793 }
4794 /* ------------------------------------------------------------------
4795   Dissector Parameter Hop counter
4796  */
4797 static void
4798 dissect_isup_hop_counter_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4799 { guint8 counter;
4800
4801   counter = tvb_get_guint8(parameter_tvb, 0) & EDCBA_8BIT_MASK; /* since bits H,G and F are spare */
4802   proto_tree_add_text(parameter_tree, parameter_tvb, 0, HOP_COUNTER_LENGTH, "Hop counter: %u", counter);
4803   proto_item_set_text(parameter_item,  "Hop counter: %u", counter);
4804 }
4805 /* ------------------------------------------------------------------
4806   Dissector Parameter Originating line information
4807  */
4808 static void
4809 dissect_isup_orig_line_info_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4810 { guint8 info;
4811
4812   info = tvb_get_guint8(parameter_tvb, 0);
4813   proto_tree_add_text(parameter_tree, parameter_tvb, 0, ORIG_LINE_INFO_LENGTH, "Originating line info: %u", info);
4814   proto_item_set_text(parameter_item,  "Originating line info: %u (ANI II if < 51, reserved otherwise)", info);
4815 }
4816 /* ------------------------------------------------------------------
4817   Dissector Parameter Transmission medium requirement prime
4818  */
4819 static void
4820 dissect_isup_transmission_medium_requirement_prime_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4821 {
4822   guint8 transmission_medium_requirement;
4823
4824   transmission_medium_requirement = tvb_get_guint8(parameter_tvb, 0);
4825   proto_tree_add_uint(parameter_tree, hf_isup_transmission_medium_requirement_prime, parameter_tvb, 0, TRANSMISSION_MEDIUM_RQMT_PRIME_LENGTH,transmission_medium_requirement);
4826
4827   proto_item_set_text(parameter_item, "Transmission medium requirement prime: %u (%s)",  transmission_medium_requirement, val_to_str_ext_const(transmission_medium_requirement, &isup_transmission_medium_requirement_prime_value_ext, "spare/reserved"));
4828 }
4829
4830 /* ------------------------------------------------------------------
4831   Dissector Parameter location number
4832  */
4833 void
4834 dissect_isup_location_number_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4835 {
4836   proto_item *address_digits_item;
4837   proto_tree *address_digits_tree;
4838   guint8 indicators1, indicators2;
4839   guint8 address_digit_pair=0;
4840   gint offset=0;
4841   gint i=0;
4842   gint length;
4843   char calling_number[MAXDIGITS + 1]="";
4844
4845   indicators1 = tvb_get_guint8(parameter_tvb, 0);
4846   proto_tree_add_boolean(parameter_tree, hf_isup_odd_even_indicator, parameter_tvb, 0, 1, indicators1);
4847   proto_tree_add_uint(parameter_tree, hf_isup_calling_party_nature_of_address_indicator, parameter_tvb, 0, 1, indicators1);
4848   indicators2 = tvb_get_guint8(parameter_tvb, 1);
4849   proto_tree_add_boolean(parameter_tree, hf_isup_inn_indicator, parameter_tvb, 1, 1, indicators2);
4850   proto_tree_add_uint(parameter_tree, hf_isup_numbering_plan_indicator, parameter_tvb, 1, 1, indicators2);
4851   if ((indicators2 & GFE_8BIT_MASK) == 0x50)
4852     proto_tree_add_text(parameter_tree, parameter_tvb, 1, 1, "Different meaning for Location Number: Numbering plan indicator = private numbering plan");
4853   proto_tree_add_uint(parameter_tree, hf_isup_address_presentation_restricted_indicator, parameter_tvb, 1, 1, indicators2);
4854   proto_tree_add_uint(parameter_tree, hf_isup_screening_indicator, parameter_tvb, 1, 1, indicators2);
4855
4856    /* NOTE  When the address presentation restricted indicator indicates address not available, the
4857     * subfields in items a), b), c) and d) are coded with 0's, and the screening indicator is set to 11
4858     * (network provided).
4859     * BUG 938 - Just check if there is someting more to dissect.
4860     */
4861   if (tvb_length_remaining(parameter_tvb, offset) < 3){
4862     proto_tree_add_text(parameter_tree, parameter_tvb, 1, -1, "Location number: address not available");
4863     proto_item_set_text(parameter_item, "Location number: address not available");
4864     return;
4865   }
4866
4867   offset = 2;
4868
4869   address_digits_item = proto_tree_add_text(parameter_tree, parameter_tvb,
4870                                             offset, -1,
4871                                             "Location number");
4872   address_digits_tree = proto_item_add_subtree(address_digits_item, ett_isup_address_digits);
4873
4874   length = tvb_length_remaining(parameter_tvb, offset);
4875   while(length > 0){
4876     address_digit_pair = tvb_get_guint8(parameter_tvb, offset);
4877     proto_tree_add_uint(address_digits_tree, hf_isup_calling_party_odd_address_signal_digit, parameter_tvb, offset, 1, address_digit_pair);
4878     calling_number[i++] = number_to_char(address_digit_pair & ISUP_ODD_ADDRESS_SIGNAL_DIGIT_MASK);
4879     if (i > MAXDIGITS)
4880       THROW(ReportedBoundsError);
4881     if ((length - 1) > 0 ){
4882       proto_tree_add_uint(address_digits_tree, hf_isup_calling_party_even_address_signal_digit, parameter_tvb, offset, 1, address_digit_pair);
4883       calling_number[i++] = number_to_char((address_digit_pair & ISUP_EVEN_ADDRESS_SIGNAL_DIGIT_MASK) / 0x10);
4884       if (i > MAXDIGITS)
4885         THROW(ReportedBoundsError);
4886     }
4887     offset++;
4888     length = tvb_length_remaining(parameter_tvb, offset);
4889   }
4890
4891   if  (((indicators1 & 0x80) == 0) && (tvb_length(parameter_tvb) > 0)){ /* Even Indicator set -> last even digit is valid & has be displayed */
4892       proto_tree_add_uint(address_digits_tree, hf_isup_calling_party_even_address_signal_digit, parameter_tvb, offset - 1, 1, address_digit_pair);
4893       calling_number[i++] = number_to_char((address_digit_pair & ISUP_EVEN_ADDRESS_SIGNAL_DIGIT_MASK) / 0x10);
4894       if (i > MAXDIGITS)
4895         THROW(ReportedBoundsError);
4896   }
4897   calling_number[i++] = '\0';
4898
4899   proto_item_set_text(address_digits_item, "Location number: %s", calling_number);
4900   proto_item_set_text(parameter_item, "Location number: %s", calling_number);
4901
4902 }
4903 /* ------------------------------------------------------------------
4904   Dissector Parameter Redirection number restiriction
4905  */
4906 static void
4907 dissect_isup_redirection_number_restriction_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4908 {
4909   guint8 indicator;
4910
4911   indicator = tvb_get_guint8(parameter_tvb, 0);
4912   switch (indicator & BA_8BIT_MASK) {
4913     case 0:
4914       proto_tree_add_text(parameter_tree, parameter_tvb, 0, REDIRECTION_NUMBER_RESTRICTION_LENGTH, "Presentation indicator: Presentation allowed");
4915       break;
4916     case 1:
4917       proto_tree_add_text(parameter_tree, parameter_tvb, 0, REDIRECTION_NUMBER_RESTRICTION_LENGTH, "Presentation indicator: Presentation restricted");
4918       break;
4919     default:
4920       proto_tree_add_text(parameter_tree, parameter_tvb, 0, REDIRECTION_NUMBER_RESTRICTION_LENGTH, "Presentation indicator: spare");
4921       break;
4922   }
4923   proto_item_set_text(parameter_item, "Redirection number restriction: 0x%x ", indicator);
4924 }
4925 /* ------------------------------------------------------------------
4926   Dissector Parameter Call transfer identity
4927  */
4928 static void
4929 dissect_isup_call_transfer_reference_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4930 { guint8 id;
4931
4932   id = tvb_get_guint8(parameter_tvb, 0);
4933   proto_tree_add_text(parameter_tree, parameter_tvb, 0, CALL_TRANSFER_REF_LENGTH, "Call transfer identity: %u", id);
4934   proto_item_set_text(parameter_item,  "Call transfer reference: %u", id);
4935 }
4936 /* ------------------------------------------------------------------
4937   Dissector Parameter Loop prevention
4938  */
4939 static void
4940 dissect_isup_loop_prevention_indicators_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4941 {
4942   guint8 indicator;
4943
4944   indicator = tvb_get_guint8(parameter_tvb, 0);
4945   if ((indicator & A_8BIT_MASK)==0) {
4946     proto_tree_add_text(parameter_tree, parameter_tvb, 0, LOOP_PREVENTION_IND_LENGTH, "Type: Request");
4947     proto_item_set_text(parameter_item, "Loop prevention indicators: Request (%u)", indicator);
4948   }
4949   else {
4950     proto_tree_add_text(parameter_tree, parameter_tvb, 0, LOOP_PREVENTION_IND_LENGTH, "Type: Response");
4951     proto_tree_add_uint(parameter_tree, hf_isup_loop_prevention_response_ind, parameter_tvb, 0, LOOP_PREVENTION_IND_LENGTH, indicator);
4952     proto_item_set_text(parameter_item, "Loop prevention indicators: Response (%u)", indicator);
4953   }
4954 }
4955 /* ------------------------------------------------------------------
4956   Dissector Parameter Call transfer number
4957  */
4958 static void
4959 dissect_isup_call_transfer_number_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4960 {
4961   proto_item *address_digits_item;
4962   proto_tree *address_digits_tree;
4963   guint8 indicators1, indicators2;
4964   guint8 address_digit_pair=0;
4965   gint offset=0;
4966   gint i=0;
4967   gint length;
4968   char calling_number[MAXDIGITS + 1]="";
4969
4970   indicators1 = tvb_get_guint8(parameter_tvb, 0);
4971   proto_tree_add_boolean(parameter_tree, hf_isup_odd_even_indicator, parameter_tvb, 0, 1, indicators1);
4972   proto_tree_add_uint(parameter_tree, hf_isup_calling_party_nature_of_address_indicator, parameter_tvb, 0, 1, indicators1);
4973   indicators2 = tvb_get_guint8(parameter_tvb, 1);
4974   proto_tree_add_uint(parameter_tree, hf_isup_numbering_plan_indicator, parameter_tvb, 1, 1, indicators2);
4975   if ((indicators2 & GFE_8BIT_MASK) == 0x50)
4976     proto_tree_add_text(parameter_tree, parameter_tvb, 1, 1, "Different meaning for Call Transfer Number: Numbering plan indicator = private numbering plan");
4977   proto_tree_add_uint(parameter_tree, hf_isup_address_presentation_restricted_indicator, parameter_tvb, 1, 1, indicators2);
4978   proto_tree_add_uint(parameter_tree, hf_isup_screening_indicator_enhanced, parameter_tvb, 1, 1, indicators2);
4979   offset = 2;
4980
4981   address_digits_item = proto_tree_add_text(parameter_tree, parameter_tvb,
4982                                             offset, -1,
4983                                             "Call transfer number");
4984   address_digits_tree = proto_item_add_subtree(address_digits_item, ett_isup_address_digits);
4985
4986   length = tvb_length_remaining(parameter_tvb, offset);
4987   while(length > 0){
4988     address_digit_pair = tvb_get_guint8(parameter_tvb, offset);
4989     proto_tree_add_uint(address_digits_tree, hf_isup_calling_party_odd_address_signal_digit, parameter_tvb, offset, 1, address_digit_pair);
4990     calling_number[i++] = number_to_char(address_digit_pair & ISUP_ODD_ADDRESS_SIGNAL_DIGIT_MASK);
4991     if (i > MAXDIGITS)
4992       THROW(ReportedBoundsError);
4993     if ((length - 1) > 0 ){
4994       proto_tree_add_uint(address_digits_tree, hf_isup_calling_party_even_address_signal_digit, parameter_tvb, offset, 1, address_digit_pair);
4995       calling_number[i++] = number_to_char((address_digit_pair & ISUP_EVEN_ADDRESS_SIGNAL_DIGIT_MASK) / 0x10);
4996       if (i > MAXDIGITS)
4997         THROW(ReportedBoundsError);
4998     }
4999     offset++;
5000     length = tvb_length_remaining(parameter_tvb, offset);
5001   }
5002
5003   if  (((indicators1 & 0x80) == 0) && (tvb_length(parameter_tvb) > 0)){ /* Even Indicator set -> last even digit is valid & has be displayed */
5004       proto_tree_add_uint(address_digits_tree, hf_isup_calling_party_even_address_signal_digit, parameter_tvb, offset - 1, 1, address_digit_pair);
5005       calling_number[i++] = number_to_char((address_digit_pair & ISUP_EVEN_ADDRESS_SIGNAL_DIGIT_MASK) / 0x10);
5006       if (i > MAXDIGITS)
5007         THROW(ReportedBoundsError);
5008   }
5009   calling_number[i++] = '\0';
5010
5011   proto_item_set_text(address_digits_item, "Call transfer number: %s", calling_number);
5012   proto_item_set_text(parameter_item, "Call transfer number: %s", calling_number);
5013
5014 }
5015 /* ------------------------------------------------------------------
5016   Dissector Parameter CCSS
5017  */
5018 static void
5019 dissect_isup_ccss_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
5020 {
5021   guint8 indicator;
5022
5023   indicator = tvb_get_guint8(parameter_tvb, 0);
5024   if ((indicator & A_8BIT_MASK)==0) {
5025     proto_tree_add_text(parameter_tree, parameter_tvb, 0, LOOP_PREVENTION_IND_LENGTH, "CCSS call indicator: no indication");
5026     proto_item_set_text(parameter_item, "CCSS call indicator: no indication (%u)", indicator);
5027   }
5028   else {
5029     proto_tree_add_text(parameter_tree, parameter_tvb, 0, LOOP_PREVENTION_IND_LENGTH, "CCSS call indicator: CCSS call");
5030     proto_item_set_text(parameter_item, "CCSS call indicator: CCSS call (%u)", indicator);
5031   }
5032 }
5033 /* ------------------------------------------------------------------
5034  Parameter Forward GVNS
5035  */
5036 static void
5037 dissect_isup_forward_gvns_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
5038 { guint length = tvb_length(parameter_tvb);
5039   proto_tree_add_text(parameter_tree, parameter_tvb, 0, length, "Forward GVNS (refer to 3.66/Q.763 for detailed decoding)");
5040   proto_item_set_text(parameter_item, "Forward GVNS (%u Byte%s)", length , plurality(length, "", "s"));
5041 }
5042 /* ------------------------------------------------------------------
5043  Parameter Redirect capability
5044  */
5045 static void
5046 dissect_isup_redirect_capability_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
5047 { guint length = tvb_length(parameter_tvb);
5048   proto_tree_add_text(parameter_tree, parameter_tvb, 0, length, "Redirect capability (format is a national matter)");
5049   proto_item_set_text(parameter_item, "Redirect Capability (%u Byte%s)", length , plurality(length, "", "s"));
5050 }
5051 /* ------------------------------------------------------------------
5052   Dissector Parameter Backward GVNS
5053  */
5054 static void
5055 dissect_isup_backward_gvns_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
5056 { guint8 indicator;
5057
5058   indicator = tvb_get_guint8(parameter_tvb, 0);
5059   proto_tree_add_text(parameter_tree, parameter_tvb, 0, BACKWARD_GVNS_LENGTH, "Backward GVNS: 0x%x (refer to 3.62/Q.763 for detailed decoding)", indicator);
5060   proto_item_set_text(parameter_item, "Backward GVNS: 0x%x", indicator);
5061 }
5062 /* ------------------------------------------------------------------
5063   Dissector Parameter Network management controls
5064  */
5065 static void
5066 dissect_isup_network_management_controls_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
5067 { guint8 indicator;
5068
5069   indicator = tvb_get_guint8(parameter_tvb, 0);
5070   proto_tree_add_boolean(parameter_tree, hf_isup_temporary_alternative_routing_ind, parameter_tvb, 0,NETWORK_MANAGEMENT_CONTROLS_LENGTH, indicator);
5071   proto_tree_add_boolean(parameter_tree, hf_isup_extension_ind, parameter_tvb, 0,NETWORK_MANAGEMENT_CONTROLS_LENGTH, indicator);
5072   proto_item_set_text(parameter_item, "Network management controls: 0x%x", indicator);
5073 }
5074 /* ------------------------------------------------------------------
5075   Dissector Parameter Correlation id - no detailed dissection since defined in Rec. Q.1281
5076  */
5077 static void
5078 dissect_isup_correlation_id_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
5079 { guint length = tvb_length(parameter_tvb);
5080   proto_tree_add_text(parameter_tree, parameter_tvb, 0, length, "Correlation ID (-> Q.1281)");
5081   proto_item_set_text(parameter_item, "Correlation ID, see Q.1281 (%u Byte%s)", length , plurality(length, "", "s"));
5082 }
5083 /* ------------------------------------------------------------------
5084   Dissector Parameter SCF id - no detailed dissection since defined in Rec. Q.1281
5085  */
5086 static void
5087 dissect_isup_scf_id_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
5088 { guint length = tvb_length(parameter_tvb);
5089   proto_tree_add_text(parameter_tree, parameter_tvb, 0, length, "SCF ID (-> Q.1281)");
5090   proto_item_set_text(parameter_item, "SCF ID, see Q.1281 (%u Byte%s)", length , plurality(length, "", "s"));
5091 }
5092 /* ------------------------------------------------------------------
5093   Dissector Parameter Call diversion treatment indicators
5094  */
5095 static void
5096 dissect_isup_call_diversion_treatment_indicators_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
5097 { guint8 indicator;
5098
5099   indicator = tvb_get_guint8(parameter_tvb, 0);
5100   proto_tree_add_uint(parameter_tree, hf_isup_call_to_be_diverted_ind, parameter_tvb, 0,CALL_DIV_TREATMENT_IND_LENGTH, indicator);
5101   proto_tree_add_boolean(parameter_tree, hf_isup_extension_ind, parameter_tvb, 0, CALL_DIV_TREATMENT_IND_LENGTH, indicator);
5102   proto_item_set_text(parameter_item, "Call diversion treatment indicators: 0x%x", indicator);
5103 }
5104 /* ------------------------------------------------------------------
5105   Dissector Parameter called IN  number
5106  */
5107 static void
5108 dissect_isup_called_in_number_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
5109 {
5110   proto_item *address_digits_item;
5111   proto_tree *address_digits_tree;
5112   guint8 indicators1, indicators2;
5113   guint8 address_digit_pair=0;
5114   gint offset=0;
5115   gint i=0;
5116   gint length;
5117   char calling_number[MAXDIGITS + 1]="";
5118
5119   indicators1 = tvb_get_guint8(parameter_tvb, 0);
5120   proto_tree_add_boolean(parameter_tree, hf_isup_odd_even_indicator, parameter_tvb, 0, 1, indicators1);
5121   proto_tree_add_uint(parameter_tree, hf_isup_calling_party_nature_of_address_indicator, parameter_tvb, 0, 1, indicators1);
5122   indicators2 = tvb_get_guint8(parameter_tvb, 1);
5123   proto_tree_add_uint(parameter_tree, hf_isup_numbering_plan_indicator, parameter_tvb, 1, 1, indicators2);
5124   proto_tree_add_uint(parameter_tree, hf_isup_address_presentation_restricted_indicator, parameter_tvb, 1, 1, indicators2);
5125   offset = 2;
5126
5127   address_digits_item = proto_tree_add_text(parameter_tree, parameter_tvb,
5128                                             offset, -1,
5129                                             "Called IN Number");
5130   address_digits_tree = proto_item_add_subtree(address_digits_item, ett_isup_address_digits);
5131
5132   length = tvb_length_remaining(parameter_tvb, offset);
5133   while(length > 0){
5134     address_digit_pair = tvb_get_guint8(parameter_tvb, offset);
5135     proto_tree_add_uint(address_digits_tree, hf_isup_calling_party_odd_address_signal_digit, parameter_tvb, offset, 1, address_digit_pair);
5136     calling_number[i++] = number_to_char(address_digit_pair & ISUP_ODD_ADDRESS_SIGNAL_DIGIT_MASK);
5137     if (i > MAXDIGITS)
5138       THROW(ReportedBoundsError);
5139     if ((length - 1) > 0 ){
5140       proto_tree_add_uint(address_digits_tree, hf_isup_calling_party_even_address_signal_digit, parameter_tvb, offset, 1, address_digit_pair);
5141       calling_number[i++] = number_to_char((address_digit_pair & ISUP_EVEN_ADDRESS_SIGNAL_DIGIT_MASK) / 0x10);
5142       if (i > MAXDIGITS)
5143         THROW(ReportedBoundsError);
5144     }
5145     offset++;
5146     length = tvb_length_remaining(parameter_tvb, offset);
5147   }
5148
5149   if  (((indicators1 & 0x80) == 0) && (tvb_length(parameter_tvb) > 0)){ /* Even Indicator set -> last even digit is valid & has be displayed */
5150       proto_tree_add_uint(address_digits_tree, hf_isup_calling_party_even_address_signal_digit, parameter_tvb, offset - 1, 1, address_digit_pair);
5151       calling_number[i++] = number_to_char((address_digit_pair & ISUP_EVEN_ADDRESS_SIGNAL_DIGIT_MASK) / 0x10);
5152       if (i > MAXDIGITS)
5153         THROW(ReportedBoundsError);
5154   }
5155   calling_number[i++] = '\0';
5156
5157   proto_item_set_text(address_digits_item, "Called IN Number: %s", calling_number);
5158   proto_item_set_text(parameter_item, "Called IN Number: %s", calling_number);
5159
5160 }
5161 /* ------------------------------------------------------------------
5162   Dissector Parameter Call offering treatment indicators
5163  */
5164 static void
5165 dissect_isup_call_offering_treatment_indicators_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
5166 { guint8 indicator;
5167
5168   indicator = tvb_get_guint8(parameter_tvb, 0);
5169   proto_tree_add_uint(parameter_tree, hf_isup_call_to_be_offered_ind, parameter_tvb, 0,CALL_OFFERING_TREATMENT_IND_LENGTH, indicator);
5170   proto_tree_add_boolean(parameter_tree, hf_isup_extension_ind, parameter_tvb, 0, CALL_OFFERING_TREATMENT_IND_LENGTH, indicator);
5171   proto_item_set_text(parameter_item, "Call offering treatment indicators: 0x%x", indicator);
5172 }
5173 /* ------------------------------------------------------------------
5174  Parameter Charged party identification
5175  */
5176 static void
5177 dissect_isup_charged_party_identification_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
5178 { guint length = tvb_length(parameter_tvb);
5179   proto_tree_add_text(parameter_tree, parameter_tvb, 0, length, "Charged party identification (format is national network specific)");
5180   proto_item_set_text(parameter_item, "Charged party identification (%u Byte%s)", length , plurality(length, "", "s"));
5181 }
5182 /* ------------------------------------------------------------------
5183   Dissector Parameter Conference treatment indicators
5184  */
5185 static void
5186 dissect_isup_conference_treatment_indicators_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
5187 { guint8 indicator;
5188
5189   indicator = tvb_get_guint8(parameter_tvb, 0);
5190   proto_tree_add_uint(parameter_tree, hf_isup_conference_acceptance_ind, parameter_tvb, 0,CONFERENCE_TREATMENT_IND_LENGTH, indicator);
5191   proto_tree_add_boolean(parameter_tree, hf_isup_extension_ind, parameter_tvb, 0, CONFERENCE_TREATMENT_IND_LENGTH, indicator);
5192   proto_item_set_text(parameter_item, "Conference treatment indicators: 0x%x", indicator);
5193 }
5194 /* ------------------------------------------------------------------
5195   Dissector Parameter Display information
5196  * TODO Output Display info :
5197  * Quote from Q.931:
5198  * 4.5.16 Display
5199  * The purpose of the Display information element is to supply display information
5200  * that may be displayed by the user. The information contained in this element is coded
5201  * in IA5 characters.
5202  * 8 7 6 5 4 3 2 1   Octet
5203  * 0 0 1 0 1 0 0 0   1      Display information element identifier
5204  *                   2      Length of display contents
5205  * 0                 3      Display information (IA5 characters)
5206  * etc.
5207  * - end - quote -
5208  * Assuming octet 2 and onwards is pased here - just output text ?
5209  */
5210 static void
5211 dissect_isup_display_information_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
5212 { guint length = tvb_length(parameter_tvb);
5213   proto_tree_add_text(parameter_tree, parameter_tvb, 0, length,
5214                       "Display information (-> Q.931)");
5215   proto_item_set_text(parameter_item, "Display information (%u Byte%s)",
5216                       length , plurality(length, "", "s"));
5217 }
5218 /* ------------------------------------------------------------------
5219  Parameter UID action indicators
5220  */
5221 static void
5222 dissect_isup_uid_action_indicators_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
5223 { guint8 indicator;
5224
5225   indicator = tvb_get_guint8(parameter_tvb, 0);
5226   proto_tree_add_text(parameter_tree, parameter_tvb, 0,UID_ACTION_IND_LENGTH, "UID action indicators: 0x%x (refer to 3.78/Q.763 for detailed decoding)", indicator);
5227   proto_item_set_text(parameter_item, "UID action indicators: 0x%x", indicator);
5228 }
5229 /* ------------------------------------------------------------------
5230  Parameter UID capability indicators
5231  */
5232 static void
5233 dissect_isup_uid_capability_indicators_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
5234 { guint8 indicator;
5235
5236   indicator = tvb_get_guint8(parameter_tvb, 0);
5237   proto_tree_add_text(parameter_tree, parameter_tvb, 0,UID_CAPABILITY_IND_LENGTH, "UID capability indicators: 0x%x (refer to 3.79/Q.763 for detailed decoding)", indicator);
5238   proto_item_set_text(parameter_item, "UID capability indicators: 0x%x", indicator);
5239 }
5240 /* ------------------------------------------------------------------
5241  Parameter Redirect counter
5242  */
5243 static void
5244 dissect_isup_redirect_counter_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
5245 { guint length = tvb_length(parameter_tvb);
5246   proto_tree_add_text(parameter_tree, parameter_tvb, 0, length, "Redirect counter (format is a national matter)");
5247   proto_item_set_text(parameter_item, "Redirect counter (%u Byte%s)", length , plurality(length, "", "s"));
5248 }
5249 /* ------------------------------------------------------------------
5250   Dissector Parameter Collect call request
5251  */
5252 static void
5253 dissect_isup_collect_call_request_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
5254 { guint8 indicator;
5255
5256   indicator = tvb_get_guint8(parameter_tvb, 0);
5257   if ((indicator & A_8BIT_MASK) == 0) {
5258     proto_tree_add_text(parameter_tree, parameter_tvb, 0, COLLECT_CALL_REQUEST_LENGTH, "Collect call request indicator: no indication");
5259     proto_item_set_text(parameter_item, "Collect call request: no indication (0x%x)", indicator);
5260   }
5261   else {
5262     proto_tree_add_text(parameter_tree, parameter_tvb, 0, COLLECT_CALL_REQUEST_LENGTH, "Collect call request indicator: collect call requested");
5263     proto_item_set_text(parameter_item, "Collect call request: collect call requested (0x%x)", indicator);
5264   }
5265 }
5266 /* ------------------------------------------------------------------
5267   Dissector Parameter Calling geodetic location
5268  */
5269 static void
5270 dissect_isup_calling_geodetic_location_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
5271 {
5272   guint         length = tvb_length(parameter_tvb);
5273   guint8        oct, lpri;
5274
5275   oct = tvb_get_guint8(parameter_tvb, 0);
5276   lpri = (oct & 0xc0) >> 2;
5277
5278   proto_tree_add_uint(parameter_tree, hf_isup_geo_loc_presentation_restricted_ind, parameter_tvb, 0, 1, oct);
5279   proto_tree_add_uint(parameter_tree, hf_isup_geo_loc_screening_ind, parameter_tvb, 0, 1, oct);
5280
5281   oct = tvb_get_guint8(parameter_tvb, 1);
5282
5283   proto_tree_add_boolean(parameter_tree, hf_isup_extension_ind, parameter_tvb, 1, 1, oct);
5284   proto_tree_add_text(parameter_tree, parameter_tvb, 1, 1,
5285     "Calling geodetic location type of shape: %s (%u)",
5286     val_to_str(oct & GFEDCBA_8BIT_MASK, isup_location_type_of_shape_value, "spare/reserved"), oct);
5287
5288   if (length > 2)
5289   {
5290     if (lpri < 0x2)
5291     {
5292       proto_tree_add_text(parameter_tree, parameter_tvb, 2, length - 2,
5293         "Shape description");
5294     }
5295     else
5296     {
5297       /* not supposed to have any data if 'lpri' was 'location not available' */
5298
5299       proto_tree_add_text(parameter_tree, parameter_tvb, 2, length - 2,
5300         "Unknown (?), should not have data if LPRI is 'location not available'");
5301     }
5302   }
5303
5304   proto_item_set_text(parameter_item, "Calling geodetic location");
5305 }
5306 /* ------------------------------------------------------------------
5307   Dissector Parameter Generic number
5308  */
5309 void
5310 dissect_isup_generic_number_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
5311 {
5312   proto_item *address_digits_item;
5313   proto_tree *address_digits_tree;
5314   guint8 indicators1, indicators2, nr_qualifier_ind;
5315   guint8 address_digit_pair=0;
5316   gint offset=0;
5317   gint i=0;
5318   gint length;
5319   char calling_number[MAXDIGITS + 1]="";
5320
5321   nr_qualifier_ind = tvb_get_guint8(parameter_tvb, 0);
5322   proto_tree_add_text(parameter_tree, parameter_tvb, 0, 1, "Number qualifier indicator: 0x%x (refer to 3.26/Q.763 for detailed decoding)", nr_qualifier_ind);
5323   indicators1 = tvb_get_guint8(parameter_tvb, 1);
5324   proto_tree_add_boolean(parameter_tree, hf_isup_odd_even_indicator, parameter_tvb, 1, 1, indicators1);
5325   proto_tree_add_uint(parameter_tree, hf_isup_calling_party_nature_of_address_indicator, parameter_tvb, 0, 1, indicators1);
5326   indicators2 = tvb_get_guint8(parameter_tvb, 2);
5327   proto_tree_add_boolean(parameter_tree, hf_isup_ni_indicator, parameter_tvb, 2, 1, indicators2);
5328   proto_tree_add_uint(parameter_tree, hf_isup_numbering_plan_indicator, parameter_tvb, 2, 1, indicators2);
5329   if ((indicators2 & GFE_8BIT_MASK) == 0x50)
5330     proto_tree_add_text(parameter_tree, parameter_tvb, 2, 1, "Different meaning for Generic Number: Numbering plan indicator = private numbering plan");
5331   proto_tree_add_uint(parameter_tree, hf_isup_address_presentation_restricted_indicator, parameter_tvb, 2, 1, indicators2);
5332   proto_tree_add_uint(parameter_tree, hf_isup_screening_indicator_enhanced, parameter_tvb, 2, 1, indicators2);
5333   offset = 3;
5334
5335   address_digits_item = proto_tree_add_text(parameter_tree, parameter_tvb,
5336                                             offset, -1,
5337                                             "Generic number");
5338   address_digits_tree = proto_item_add_subtree(address_digits_item, ett_isup_address_digits);
5339
5340   length = tvb_length_remaining(parameter_tvb, offset);
5341   while(length > 0){
5342     address_digit_pair = tvb_get_guint8(parameter_tvb, offset);
5343     proto_tree_add_uint(address_digits_tree, hf_isup_calling_party_odd_address_signal_digit, parameter_tvb, offset, 1, address_digit_pair);
5344     calling_number[i++] = number_to_char(address_digit_pair & ISUP_ODD_ADDRESS_SIGNAL_DIGIT_MASK);
5345     if (i > MAXDIGITS)
5346       THROW(ReportedBoundsError);
5347     if ((length - 1) > 0 ){
5348       proto_tree_add_uint(address_digits_tree, hf_isup_calling_party_even_address_signal_digit, parameter_tvb, offset, 1, address_digit_pair);
5349       calling_number[i++] = number_to_char((address_digit_pair & ISUP_EVEN_ADDRESS_SIGNAL_DIGIT_MASK) / 0x10);
5350       if (i > MAXDIGITS)
5351         THROW(ReportedBoundsError);
5352     }
5353     offset++;
5354     length = tvb_length_remaining(parameter_tvb, offset);
5355   }
5356
5357   if  (((indicators1 & 0x80) == 0) && (tvb_length(parameter_tvb) > 0)){ /* Even Indicator set -> last even digit is valid & has be displayed */
5358       proto_tree_add_uint(address_digits_tree, hf_isup_calling_party_even_address_signal_digit, parameter_tvb, offset - 1, 1, address_digit_pair);
5359       calling_number[i++] = number_to_char((address_digit_pair & ISUP_EVEN_ADDRESS_SIGNAL_DIGIT_MASK) / 0x10);
5360       if (i > MAXDIGITS)
5361         THROW(ReportedBoundsError);
5362   }
5363   calling_number[i++] = '\0';
5364
5365   /*
5366    * Indicators1 = Nature of address
5367    * Indicators2 = Number plan indicator
5368    */
5369   indicators1 = indicators1 & 0x7f;
5370   indicators2 = (indicators2 & 0x70)>>4;
5371   if ((indicators1 == ISUP_CALLED_PARTY_NATURE_INTERNATNL_NR)&&(indicators2==ISDN_NUMBERING_PLAN))
5372     dissect_e164_cc(parameter_tvb, address_digits_tree, 3, TRUE);
5373
5374   proto_item_set_text(address_digits_item, "Generic number: %s", calling_number);
5375   proto_item_set_text(parameter_item, "Generic number: %s", calling_number);
5376
5377 }
5378 /* ------------------------------------------------------------------
5379   Dissector Parameter  Jurisdiction parameter
5380  */
5381 static void
5382 dissect_isup_jurisdiction_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
5383 {
5384   proto_item *address_digits_item;
5385   proto_tree *address_digits_tree;
5386   guint8 address_digit_pair=0;
5387   gint offset=0;
5388   gint i=0;
5389   gint length;
5390   char called_number[MAXDIGITS + 1]="";
5391
5392   offset = 0;
5393
5394   address_digits_item = proto_tree_add_text(parameter_tree, parameter_tvb,
5395                                             offset, -1,
5396                                             "Jurisdiction");
5397   address_digits_tree = proto_item_add_subtree(address_digits_item, ett_isup_address_digits);
5398
5399   while((length = tvb_reported_length_remaining(parameter_tvb, offset)) > 0){
5400     address_digit_pair = tvb_get_guint8(parameter_tvb, offset);
5401     proto_tree_add_uint(address_digits_tree, hf_isup_called_party_odd_address_signal_digit, parameter_tvb, offset, 1, address_digit_pair);
5402     called_number[i++] = number_to_char(address_digit_pair & ISUP_ODD_ADDRESS_SIGNAL_DIGIT_MASK);
5403     if (i > MAXDIGITS)
5404       THROW(ReportedBoundsError);
5405     if ((length - 1) > 0 ){
5406       proto_tree_add_uint(address_digits_tree, hf_isup_called_party_even_address_signal_digit, parameter_tvb, offset, 1, address_digit_pair);
5407       called_number[i++] = number_to_char((address_digit_pair & ISUP_EVEN_ADDRESS_SIGNAL_DIGIT_MASK) / 0x10);
5408       if (i > MAXDIGITS)
5409         THROW(ReportedBoundsError);
5410     }
5411     offset++;
5412   }
5413
5414   if (tvb_length(parameter_tvb) > 0){
5415       proto_tree_add_uint(address_digits_tree, hf_isup_called_party_even_address_signal_digit, parameter_tvb, offset - 1, 1, address_digit_pair);
5416       called_number[i++] = number_to_char((address_digit_pair & ISUP_EVEN_ADDRESS_SIGNAL_DIGIT_MASK) / 0x10);
5417       if (i > MAXDIGITS)
5418         THROW(ReportedBoundsError);
5419   }
5420   called_number[i++] = '\0';
5421
5422   proto_item_set_text(address_digits_item, "Jurisdiction: %s", called_number);
5423   proto_item_set_text(parameter_item, "Jurisdiction: %s", called_number);
5424
5425 }/* ------------------------------------------------------------------
5426   Dissector Parameter Generic name
5427  */
5428 static void
5429 dissect_isup_generic_name_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
5430 {
5431   guint8 indicator;
5432   gint gen_name_length;
5433   char *gen_name=NULL;
5434
5435   gen_name=ep_alloc(MAXGNAME + 1);
5436   gen_name[0] = '\0';
5437   gen_name_length = tvb_length(parameter_tvb) - 1;
5438   indicator = tvb_get_guint8(parameter_tvb, 0);
5439   proto_tree_add_uint(parameter_tree, hf_isup_generic_name_presentation, parameter_tvb, 1, 1, indicator);
5440   proto_tree_add_boolean(parameter_tree, hf_isup_generic_name_availability, parameter_tvb, 1, 1, indicator);
5441   proto_tree_add_uint(parameter_tree, hf_isup_generic_name_type, parameter_tvb, 1, 1, indicator);
5442   gen_name = tvb_get_ephemeral_string(parameter_tvb,1,gen_name_length);
5443   gen_name[gen_name_length] = '\0';
5444   proto_tree_add_string(parameter_tree, hf_isup_generic_name_ia5, parameter_tvb, 2, gen_name_length, gen_name);
5445   proto_item_set_text(parameter_item, "Generic name: %s", gen_name);
5446
5447   }
5448
5449 /* ------------------------------------------------------------------
5450  Dissector Parameter Generic digits
5451  */
5452 static void
5453 dissect_isup_generic_digits_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
5454 { guint length = tvb_length(parameter_tvb);
5455   proto_tree_add_text(parameter_tree, parameter_tvb, 0, length, "Generic digits (refer to 3.24/Q.673 for detailed decoding)");
5456   proto_item_set_text(parameter_item, "Generic digits (%u Byte%s)", length , plurality(length, "", "s"));
5457 }
5458
5459 /* ------------------------------------------------------------------
5460   Dissector Parameter Charge number
5461  */
5462 static void
5463 dissect_isup_charge_number_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
5464 {
5465   proto_item *address_digits_item;
5466   proto_tree *address_digits_tree;
5467   guint8 indicators1, indicators2;
5468   guint8 address_digit_pair=0;
5469   gint offset=0;
5470   gint i=0;
5471   gint length;
5472   char calling_number[MAXDIGITS + 1]="";
5473
5474   indicators1 = tvb_get_guint8(parameter_tvb, 0);
5475   proto_tree_add_boolean(parameter_tree, hf_isup_odd_even_indicator, parameter_tvb, 0, 1, indicators1);
5476   proto_tree_add_uint(parameter_tree, hf_isup_charge_number_nature_of_address_indicator, parameter_tvb, 0, 1, indicators1);
5477   indicators2 = tvb_get_guint8(parameter_tvb, 1);
5478   proto_tree_add_uint(parameter_tree, hf_isup_numbering_plan_indicator, parameter_tvb, 1, 1, indicators2);
5479   offset = 2;
5480
5481   address_digits_item = proto_tree_add_text(parameter_tree, parameter_tvb,
5482                                             offset, -1,
5483                                             "Charge Number");
5484   address_digits_tree = proto_item_add_subtree(address_digits_item, ett_isup_address_digits);
5485
5486   length = tvb_length_remaining(parameter_tvb, offset);
5487   while(length > 0){
5488     address_digit_pair = tvb_get_guint8(parameter_tvb, offset);
5489     proto_tree_add_uint(address_digits_tree, hf_isup_calling_party_odd_address_signal_digit, parameter_tvb, offset, 1, address_digit_pair);
5490     calling_number[i++] = number_to_char(address_digit_pair & ISUP_ODD_ADDRESS_SIGNAL_DIGIT_MASK);
5491     if (i > MAXDIGITS)
5492       THROW(ReportedBoundsError);
5493     if ((length - 1) > 0 ){
5494       proto_tree_add_uint(address_digits_tree, hf_isup_calling_party_even_address_signal_digit, parameter_tvb, offset, 1, address_digit_pair);
5495       calling_number[i++] = number_to_char((address_digit_pair & ISUP_EVEN_ADDRESS_SIGNAL_DIGIT_MASK) / 0x10);
5496       if (i > MAXDIGITS)
5497         THROW(ReportedBoundsError);
5498     }
5499     offset++;
5500     length = tvb_length_remaining(parameter_tvb, offset);
5501   }
5502
5503   if  (((indicators1 & 0x80) == 0) && (tvb_length(parameter_tvb) > 0)){ /* Even Indicator set -> last even digit is valid & has be displayed */
5504       proto_tree_add_uint(address_digits_tree, hf_isup_calling_party_even_address_signal_digit, parameter_tvb, offset - 1, 1, address_digit_pair);
5505       calling_number[i++] = number_to_char((address_digit_pair & ISUP_EVEN_ADDRESS_SIGNAL_DIGIT_MASK) / 0x10);
5506       if (i > MAXDIGITS)
5507         THROW(ReportedBoundsError);
5508   }
5509   calling_number[i++] = '\0';
5510
5511   proto_item_set_text(address_digits_item, "Charge Number: %s", calling_number);
5512   proto_item_set_text(parameter_item, "Charge Number: %s", calling_number);
5513
5514 }
5515 /* ------------------------------------------------------------------ */
5516 static void
5517 dissect_isup_unknown_parameter(tvbuff_t *parameter_tvb, proto_item *parameter_item)
5518 { guint length = tvb_length(parameter_tvb);
5519   proto_item_set_text(parameter_item, "Parameter Type unknown/reserved (%u Byte%s)", length , plurality(length, "", "s"));
5520 }
5521 /* ------------------------------------------------------------------ */
5522
5523 /* ------------------------------------------------------------------
5524   Dissector all optional parameters
5525 */
5526 static void
5527 dissect_isup_optional_parameter(tvbuff_t *optional_parameters_tvb,packet_info *pinfo, proto_tree *isup_tree)
5528 { proto_item* parameter_item;
5529   proto_tree* parameter_tree;
5530   gint offset = 0;
5531   guint parameter_type, parameter_length, actual_length;
5532   tvbuff_t *parameter_tvb;
5533   guint8 octet;
5534
5535   /* Dissect all optional parameters while end of message isn't reached */
5536   parameter_type = 0xFF; /* Start-initializiation since parameter_type is used for while-condition */
5537
5538   while ((tvb_length_remaining(optional_parameters_tvb, offset)  >= 1) && (parameter_type != PARAM_TYPE_END_OF_OPT_PARAMS)){
5539     parameter_type = tvb_get_guint8(optional_parameters_tvb, offset);
5540
5541     if (parameter_type != PARAM_TYPE_END_OF_OPT_PARAMS){
5542       parameter_length = tvb_get_guint8(optional_parameters_tvb, offset + PARAMETER_TYPE_LENGTH);
5543
5544       parameter_item = proto_tree_add_text(isup_tree, optional_parameters_tvb,
5545                                            offset,
5546                                            parameter_length  + PARAMETER_TYPE_LENGTH + PARAMETER_LENGTH_IND_LENGTH,
5547                                            "Parameter: type %u",
5548                                            parameter_type);
5549       parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
5550       proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, optional_parameters_tvb, offset, PARAMETER_TYPE_LENGTH,
5551                                  parameter_type,
5552                                  "Optional Parameter: %u (%s)",
5553                                  parameter_type,
5554                                  val_to_str_ext_const(parameter_type, &isup_parameter_type_value_ext,"unknown"));
5555       offset += PARAMETER_TYPE_LENGTH;
5556
5557       octet = tvb_get_guint8(optional_parameters_tvb,offset);
5558
5559       proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_length, optional_parameters_tvb, offset, PARAMETER_LENGTH_IND_LENGTH, parameter_length, "Parameter length: %u", parameter_length);
5560       offset += PARAMETER_LENGTH_IND_LENGTH;
5561       if ( octet == 0 )
5562         continue;
5563
5564       actual_length = tvb_length_remaining(optional_parameters_tvb, offset);
5565       if (actual_length > 0){
5566         parameter_tvb = tvb_new_subset(optional_parameters_tvb, offset, MIN(parameter_length, actual_length), parameter_length);
5567         switch (parameter_type) {
5568           case PARAM_TYPE_CALL_REF:
5569             dissect_isup_call_reference_parameter(parameter_tvb, parameter_tree, parameter_item);
5570             break;
5571           case PARAM_TYPE_TRANSM_MEDIUM_REQU:
5572             dissect_isup_transmission_medium_requirement_parameter(parameter_tvb, parameter_tree, parameter_item);
5573             break;
5574           case PARAM_TYPE_ACC_TRANSP:
5575             dissect_isup_access_transport_parameter(parameter_tvb, parameter_tree, parameter_item, pinfo);
5576             break;
5577           case PARAM_TYPE_CALLED_PARTY_NR:
5578             dissect_isup_called_party_number_parameter(parameter_tvb, parameter_tree, parameter_item);
5579             break;
5580           case PARAM_TYPE_SUBSQT_NR:
5581             dissect_isup_subsequent_number_parameter(parameter_tvb, parameter_tree, parameter_item);
5582             break;
5583           case PARAM_TYPE_NATURE_OF_CONN_IND:
5584             dissect_isup_nature_of_connection_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
5585             break;
5586           case PARAM_TYPE_FORW_CALL_IND:
5587             dissect_isup_forward_call_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
5588             break;
5589           case PARAM_TYPE_OPT_FORW_CALL_IND:
5590             dissect_isup_optional_forward_call_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
5591             break;
5592           case PARAM_TYPE_CALLING_PRTY_CATEG:
5593             dissect_isup_calling_partys_category_parameter(parameter_tvb, parameter_tree, parameter_item);
5594             break;
5595           case PARAM_TYPE_CALLING_PARTY_NR:
5596             dissect_isup_calling_party_number_parameter(parameter_tvb, parameter_tree, parameter_item);
5597             break;
5598           case PARAM_TYPE_REDIRECTING_NR:
5599             dissect_isup_redirecting_number_parameter(parameter_tvb, parameter_tree, parameter_item);
5600             break;
5601           case PARAM_TYPE_REDIRECTION_NR:
5602             dissect_isup_redirection_number_parameter(parameter_tvb, parameter_tree, parameter_item);
5603             break;
5604           case PARAM_TYPE_CONNECTION_REQ:
5605             dissect_isup_connection_request_parameter(parameter_tvb, parameter_tree, parameter_item);
5606             break;
5607           case PARAM_TYPE_INFO_REQ_IND:
5608             dissect_isup_information_request_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
5609             break;
5610           case PARAM_TYPE_INFO_IND:
5611             dissect_isup_information_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
5612             break;
5613           case PARAM_TYPE_CONTINUITY_IND:
5614             dissect_isup_continuity_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
5615             break;
5616           case PARAM_TYPE_BACKW_CALL_IND:
5617             dissect_isup_backward_call_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
5618             break;
5619           case PARAM_TYPE_CAUSE_INDICATORS:
5620             dissect_isup_cause_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
5621             break;
5622           case PARAM_TYPE_REDIRECTION_INFO:
5623             dissect_isup_redirection_information_parameter(parameter_tvb, parameter_tree, parameter_item);
5624             break;
5625           case PARAM_TYPE_CIRC_GRP_SV_MSG_TYPE:
5626             dissect_isup_circuit_group_supervision_message_type_parameter(parameter_tvb, parameter_tree, parameter_item);
5627             break;
5628           case PARAM_TYPE_RANGE_AND_STATUS:
5629             dissect_isup_range_and_status_parameter(parameter_tvb, parameter_tree, parameter_item);
5630             break;
5631           case PARAM_TYPE_FACILITY_IND:
5632             dissect_isup_facility_ind_parameter(parameter_tvb, parameter_item);
5633             break;
5634           case PARAM_TYPE_CLSD_USR_GRP_ILOCK_CD:
5635             dissect_isup_closed_user_group_interlock_code_parameter(parameter_tvb, parameter_tree, parameter_item);
5636             break;
5637           case PARAM_TYPE_USER_SERVICE_INFO:
5638             dissect_isup_user_service_information_parameter(parameter_tvb, parameter_tree, parameter_item);
5639             break;
5640           case PARAM_TYPE_SIGNALLING_POINT_CODE:
5641             dissect_isup_signalling_point_code_parameter(parameter_tvb, parameter_tree, parameter_item);
5642             break;
5643           case PARAM_TYPE_USER_TO_USER_INFO:
5644             dissect_isup_user_to_user_information_parameter(parameter_tvb, pinfo, parameter_tree, parameter_item);
5645             break;
5646           case PARAM_TYPE_CONNECTED_NR:
5647             dissect_isup_connected_number_parameter(parameter_tvb, parameter_tree, parameter_item);
5648             break;
5649           case PARAM_TYPE_SUSP_RESUME_IND:
5650             dissect_isup_suspend_resume_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
5651             break;
5652           case PARAM_TYPE_TRANSIT_NETW_SELECT:
5653             dissect_isup_transit_network_selection_parameter(parameter_tvb, parameter_tree, parameter_item);
5654             break;
5655           case PARAM_TYPE_EVENT_INFO:
5656             dissect_isup_event_information_parameter(parameter_tvb, parameter_tree, parameter_item);
5657             break;
5658           case PARAM_TYPE_CIRC_ASSIGN_MAP:
5659             dissect_isup_circuit_assignment_map_parameter(parameter_tvb, parameter_tree, parameter_item);
5660             break;
5661           case PARAM_TYPE_CIRC_STATE_IND:
5662             dissect_isup_circuit_state_ind_parameter(parameter_tvb, parameter_tree, parameter_item);
5663             break;
5664           case PARAM_TYPE_AUTO_CONG_LEVEL:
5665             dissect_isup_automatic_congestion_level_parameter(parameter_tvb, parameter_tree, parameter_item);
5666             break;
5667           case PARAM_TYPE_ORIG_CALLED_NR:
5668             dissect_isup_original_called_number_parameter(parameter_tvb, parameter_tree, parameter_item);
5669             break;
5670           case PARAM_TYPE_OPT_BACKW_CALL_IND:
5671             dissect_isup_optional_backward_call_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
5672             break;
5673           case PARAM_TYPE_USER_TO_USER_IND:
5674             dissect_isup_user_to_user_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
5675             break;
5676           case PARAM_TYPE_ORIG_ISC_POINT_CODE:
5677             dissect_isup_original_isc_point_code_parameter(parameter_tvb, parameter_tree, parameter_item);
5678             break;
5679           case PARAM_TYPE_GENERIC_NOTIF_IND:
5680             dissect_isup_generic_notification_indicator_parameter(parameter_tvb, parameter_tree, parameter_item);
5681             break;
5682           case PARAM_TYPE_CALL_HIST_INFO :
5683             dissect_isup_call_history_information_parameter(parameter_tvb, parameter_tree, parameter_item);
5684             break;
5685           case PARAM_TYPE_ACC_DELIV_INFO:
5686             dissect_isup_access_delivery_information_parameter(parameter_tvb, parameter_tree, parameter_item);
5687             break;
5688           case PARAM_TYPE_NETW_SPECIFIC_FACLTY:
5689             dissect_isup_network_specific_facility_parameter(parameter_tvb, parameter_tree, parameter_item);
5690             break;
5691           case PARAM_TYPE_USER_SERVICE_INFO_PR:
5692             dissect_isup_user_service_information_prime_parameter(parameter_tvb, parameter_tree, parameter_item);
5693             break;
5694           case PARAM_TYPE_PROPAG_DELAY_COUNTER:
5695             dissect_isup_propagation_delay_counter_parameter(parameter_tvb, parameter_tree, parameter_item);
5696             break;
5697           case PARAM_TYPE_REMOTE_OPERATIONS:
5698             dissect_isup_remote_operations_parameter(parameter_tvb, parameter_tree, parameter_item);
5699             break;
5700           case PARAM_TYPE_SERVICE_ACTIVATION:
5701             dissect_isup_service_activation_parameter(parameter_tvb, parameter_tree, parameter_item);
5702             break;
5703           case PARAM_TYPE_USER_TELESERV_INFO:
5704             dissect_isup_user_teleservice_information_parameter(parameter_tvb, parameter_tree, parameter_item);
5705             break;
5706           case PARAM_TYPE_TRANSM_MEDIUM_USED:
5707             dissect_isup_transmission_medium_used_parameter(parameter_tvb, parameter_tree, parameter_item);
5708             break;
5709           case PARAM_TYPE_CALL_DIV_INFO:
5710             dissect_isup_call_diversion_information_parameter(parameter_tvb, parameter_tree, parameter_item);
5711             break;
5712           case PARAM_TYPE_ECHO_CTRL_INFO:
5713             dissect_isup_echo_control_information_parameter(parameter_tvb, parameter_tree, parameter_item);
5714             break;
5715           case PARAM_TYPE_MSG_COMPAT_INFO:
5716             dissect_isup_message_compatibility_information_parameter(parameter_tvb, parameter_tree, parameter_item);
5717             break;
5718           case PARAM_TYPE_PARAM_COMPAT_INFO:
5719             dissect_isup_parameter_compatibility_information_parameter(parameter_tvb, parameter_tree, parameter_item);
5720             break;
5721           case PARAM_TYPE_MLPP_PRECEDENCE:
5722             dissect_isup_mlpp_precedence_parameter(parameter_tvb, parameter_tree, parameter_item);
5723             break;
5724           case PARAM_TYPE_MCID_REQ_IND:
5725             dissect_isup_mcid_request_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
5726             break;
5727           case PARAM_TYPE_MCID_RSP_IND:
5728             dissect_isup_mcid_response_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
5729             break;
5730           case PARAM_TYPE_HOP_COUNTER:
5731             dissect_isup_hop_counter_parameter(parameter_tvb, parameter_tree, parameter_item);
5732             break;
5733           case PARAM_TYPE_TRANSM_MEDIUM_RQUR_PR:
5734             dissect_isup_transmission_medium_requirement_prime_parameter(parameter_tvb, parameter_tree, parameter_item);
5735             break;
5736           case PARAM_TYPE_LOCATION_NR:
5737             dissect_isup_location_number_parameter(parameter_tvb, parameter_tree, parameter_item);
5738             break;
5739           case PARAM_TYPE_REDIR_NR_RSTRCT:
5740             dissect_isup_redirection_number_restriction_parameter(parameter_tvb, parameter_tree, parameter_item);
5741             break;
5742           case PARAM_TYPE_CALL_TRANS_REF:
5743             dissect_isup_call_transfer_reference_parameter(parameter_tvb, parameter_tree, parameter_item);
5744             break;
5745           case PARAM_TYPE_LOOP_PREV_IND:
5746             dissect_isup_loop_prevention_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
5747             break;
5748           case PARAM_TYPE_CALL_TRANS_NR:
5749             dissect_isup_call_transfer_number_parameter(parameter_tvb, parameter_tree, parameter_item);
5750             break;
5751           case PARAM_TYPE_CCSS:
5752             dissect_isup_ccss_parameter(parameter_tvb, parameter_tree, parameter_item);
5753             break;
5754           case PARAM_TYPE_FORW_GVNS:
5755             dissect_isup_forward_gvns_parameter(parameter_tvb, parameter_tree, parameter_item);
5756             break;
5757           case PARAM_TYPE_BACKW_GVNS:
5758             dissect_isup_backward_gvns_parameter(parameter_tvb, parameter_tree, parameter_item);
5759             break;
5760           case PARAM_TYPE_REDIRECT_CAPAB:
5761             dissect_isup_redirect_capability_parameter(parameter_tvb, parameter_tree, parameter_item);
5762             break;
5763           case PARAM_TYPE_NETW_MGMT_CTRL:
5764             dissect_isup_network_management_controls_parameter(parameter_tvb, parameter_tree, parameter_item);
5765             break;
5766           case PARAM_TYPE_CORRELATION_ID:
5767             dissect_isup_correlation_id_parameter(parameter_tvb, parameter_tree, parameter_item);
5768             break;
5769           case PARAM_TYPE_SCF_ID:
5770             dissect_isup_scf_id_parameter(parameter_tvb, parameter_tree, parameter_item);
5771             break;
5772           case PARAM_TYPE_CALL_DIV_TREAT_IND:
5773             dissect_isup_call_diversion_treatment_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
5774             break;
5775           case PARAM_TYPE_CALLED_IN_NR:
5776             dissect_isup_called_in_number_parameter(parameter_tvb, parameter_tree, parameter_item);
5777             break;
5778           case PARAM_TYPE_CALL_OFF_TREAT_IND:
5779             dissect_isup_call_offering_treatment_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
5780             break;
5781           case PARAM_TYPE_CHARGED_PARTY_IDENT:
5782             dissect_isup_charged_party_identification_parameter(parameter_tvb, parameter_tree, parameter_item);
5783             break;
5784           case PARAM_TYPE_CONF_TREAT_IND:
5785             dissect_isup_conference_treatment_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
5786             break;
5787           case PARAM_TYPE_DISPLAY_INFO:
5788             dissect_isup_display_information_parameter(parameter_tvb, parameter_tree, parameter_item);
5789             break;
5790           case PARAM_TYPE_UID_ACTION_IND:
5791             dissect_isup_uid_action_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
5792             break;
5793           case PARAM_TYPE_UID_CAPAB_IND:
5794             dissect_isup_uid_capability_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
5795             break;
5796           case PARAM_TYPE_REDIRECT_COUNTER:
5797             dissect_isup_redirect_counter_parameter(parameter_tvb, parameter_tree, parameter_item);
5798             break;
5799           case PARAM_TYPE_COLLECT_CALL_REQ:
5800             dissect_isup_collect_call_request_parameter(parameter_tvb, parameter_tree, parameter_item);
5801             break;
5802           case PARAM_TYPE_GENERIC_NR:
5803             dissect_isup_generic_number_parameter(parameter_tvb, parameter_tree, parameter_item);
5804             break;
5805           case PARAM_TYPE_GENERIC_DIGITS:
5806             dissect_isup_generic_digits_parameter(parameter_tvb, parameter_tree, parameter_item);
5807             break;
5808           case PARAM_TYPE_APPLICATON_TRANS:
5809             dissect_isup_application_transport_parameter(parameter_tvb, pinfo, parameter_tree, parameter_item);
5810             break;
5811
5812           default:
5813             dissect_isup_unknown_parameter(parameter_tvb, parameter_item);
5814             break;
5815         }
5816
5817
5818         offset += MIN(parameter_length, actual_length);
5819       }
5820
5821     }
5822     else {
5823       /* End of optional parameters is reached */
5824       proto_tree_add_uint_format(isup_tree, hf_isup_parameter_type, optional_parameters_tvb , offset, PARAMETER_TYPE_LENGTH,
5825                                  parameter_type, "End of optional parameters (%u)", parameter_type);
5826     }
5827   }
5828 }
5829
5830 /* ------------------------------------------------------------------
5831   Dissector all ANSI optional parameters
5832   TODO: Actullay make this dissect ANSI :) - It's still plain old ITU for now
5833 */
5834 static void
5835 dissect_ansi_isup_optional_parameter(tvbuff_t *optional_parameters_tvb,packet_info *pinfo, proto_tree *isup_tree)
5836 { proto_item* parameter_item;
5837   proto_tree* parameter_tree;
5838   gint offset = 0;
5839   guint parameter_type, parameter_length, actual_length;
5840   tvbuff_t *parameter_tvb;
5841   guint8 octet;
5842
5843   /* Dissect all optional parameters while end of message isn't reached */
5844   parameter_type = 0xFF; /* Start-initializiation since parameter_type is used for while-condition */
5845
5846   while ((tvb_length_remaining(optional_parameters_tvb, offset)  >= 1) && (parameter_type != PARAM_TYPE_END_OF_OPT_PARAMS)){
5847     parameter_type = tvb_get_guint8(optional_parameters_tvb, offset);
5848
5849     if (parameter_type != PARAM_TYPE_END_OF_OPT_PARAMS){
5850       parameter_length = tvb_get_guint8(optional_parameters_tvb, offset + PARAMETER_TYPE_LENGTH);
5851
5852       parameter_item = proto_tree_add_text(isup_tree, optional_parameters_tvb,
5853                                            offset,
5854                                            parameter_length  + PARAMETER_TYPE_LENGTH + PARAMETER_LENGTH_IND_LENGTH,
5855                                            "Parameter: type %u",
5856                                            parameter_type);
5857       parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
5858       proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, optional_parameters_tvb, offset, PARAMETER_TYPE_LENGTH, parameter_type,
5859                                  "Optional Parameter: %u (%s)", parameter_type,
5860                                  val_to_str_ext_const(parameter_type, &ansi_isup_parameter_type_value_ext,"unknown"));
5861       offset += PARAMETER_TYPE_LENGTH;
5862
5863       octet = tvb_get_guint8(optional_parameters_tvb,offset);
5864
5865       proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_length, optional_parameters_tvb, offset, PARAMETER_LENGTH_IND_LENGTH, parameter_length,
5866                                  "Parameter length: %u", parameter_length);
5867       offset += PARAMETER_LENGTH_IND_LENGTH;
5868       if ( octet == 0 )
5869         continue;
5870
5871       actual_length = tvb_length_remaining(optional_parameters_tvb, offset);
5872       if (actual_length > 0){
5873         parameter_tvb = tvb_new_subset(optional_parameters_tvb, offset, MIN(parameter_length, actual_length), parameter_length);
5874         switch (parameter_type) {
5875           case PARAM_TYPE_CALL_REF:
5876             dissect_isup_call_reference_parameter(parameter_tvb, parameter_tree, parameter_item);
5877             break;
5878           case PARAM_TYPE_TRANSM_MEDIUM_REQU:
5879             dissect_isup_transmission_medium_requirement_parameter(parameter_tvb, parameter_tree, parameter_item);
5880             break;
5881           case PARAM_TYPE_ACC_TRANSP:
5882             dissect_isup_access_transport_parameter(parameter_tvb, parameter_tree, parameter_item, pinfo);
5883             break;
5884           case PARAM_TYPE_CALLED_PARTY_NR:
5885             dissect_isup_called_party_number_parameter(parameter_tvb, parameter_tree, parameter_item);
5886             break;
5887           case PARAM_TYPE_SUBSQT_NR:
5888             dissect_isup_subsequent_number_parameter(parameter_tvb, parameter_tree, parameter_item);
5889             break;
5890           case PARAM_TYPE_NATURE_OF_CONN_IND:
5891             dissect_isup_nature_of_connection_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
5892             break;
5893           case PARAM_TYPE_FORW_CALL_IND:
5894             dissect_isup_forward_call_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
5895             break;
5896           case PARAM_TYPE_OPT_FORW_CALL_IND:
5897             dissect_isup_optional_forward_call_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
5898             break;
5899           case PARAM_TYPE_CALLING_PRTY_CATEG:
5900             dissect_isup_calling_partys_category_parameter(parameter_tvb, parameter_tree, parameter_item);
5901             break;
5902           case PARAM_TYPE_CALLING_PARTY_NR:
5903             dissect_isup_calling_party_number_parameter(parameter_tvb, parameter_tree, parameter_item);
5904             break;
5905           case PARAM_TYPE_REDIRECTING_NR:
5906             dissect_isup_redirecting_number_parameter(parameter_tvb, parameter_tree, parameter_item);
5907             break;
5908           case PARAM_TYPE_REDIRECTION_NR:
5909             dissect_isup_redirection_number_parameter(parameter_tvb, parameter_tree, parameter_item);
5910             break;
5911           case PARAM_TYPE_CONNECTION_REQ:
5912             dissect_isup_connection_request_parameter(parameter_tvb, parameter_tree, parameter_item);
5913             break;
5914           case PARAM_TYPE_INFO_REQ_IND:
5915             dissect_isup_information_request_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
5916             break;
5917           case PARAM_TYPE_INFO_IND:
5918             dissect_isup_information_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
5919             break;
5920           case PARAM_TYPE_CONTINUITY_IND:
5921             dissect_isup_continuity_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
5922             break;
5923           case PARAM_TYPE_BACKW_CALL_IND:
5924             dissect_isup_backward_call_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
5925             break;
5926           case PARAM_TYPE_CAUSE_INDICATORS:
5927             dissect_ansi_isup_cause_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
5928             break;
5929           case PARAM_TYPE_REDIRECTION_INFO:
5930             dissect_isup_redirection_information_parameter(parameter_tvb, parameter_tree, parameter_item);
5931             break;
5932           case PARAM_TYPE_CIRC_GRP_SV_MSG_TYPE:
5933             dissect_isup_circuit_group_supervision_message_type_parameter(parameter_tvb, parameter_tree, parameter_item);
5934             break;
5935           case PARAM_TYPE_RANGE_AND_STATUS:
5936             dissect_isup_range_and_status_parameter(parameter_tvb, parameter_tree, parameter_item);
5937             break;
5938           case PARAM_TYPE_FACILITY_IND:
5939             dissect_isup_facility_ind_parameter(parameter_tvb, parameter_item);
5940             break;
5941           case PARAM_TYPE_CLSD_USR_GRP_ILOCK_CD:
5942             dissect_isup_closed_user_group_interlock_code_parameter(parameter_tvb, parameter_tree, parameter_item);
5943             break;
5944           case PARAM_TYPE_USER_SERVICE_INFO:
5945             dissect_isup_user_service_information_parameter(parameter_tvb, parameter_tree, parameter_item);
5946             break;
5947           case PARAM_TYPE_SIGNALLING_POINT_CODE:
5948             dissect_isup_signalling_point_code_parameter(parameter_tvb, parameter_tree, parameter_item);
5949             break;
5950           case PARAM_TYPE_USER_TO_USER_INFO:
5951             dissect_isup_user_to_user_information_parameter(parameter_tvb, pinfo, parameter_tree, parameter_item);
5952             break;
5953           case PARAM_TYPE_CONNECTED_NR:
5954             dissect_isup_connected_number_parameter(parameter_tvb, parameter_tree, parameter_item);
5955             break;
5956           case PARAM_TYPE_SUSP_RESUME_IND:
5957             dissect_isup_suspend_resume_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
5958             break;
5959           case PARAM_TYPE_TRANSIT_NETW_SELECT:
5960             dissect_isup_transit_network_selection_parameter(parameter_tvb, parameter_tree, parameter_item);
5961             break;
5962           case PARAM_TYPE_EVENT_INFO:
5963             dissect_isup_event_information_parameter(parameter_tvb, parameter_tree, parameter_item);
5964             break;
5965           case PARAM_TYPE_CIRC_ASSIGN_MAP:
5966             dissect_isup_circuit_assignment_map_parameter(parameter_tvb, parameter_tree, parameter_item);
5967             break;
5968           case PARAM_TYPE_CIRC_STATE_IND:
5969             dissect_isup_circuit_state_ind_parameter(parameter_tvb, parameter_tree, parameter_item);
5970             break;
5971           case PARAM_TYPE_AUTO_CONG_LEVEL:
5972             dissect_isup_automatic_congestion_level_parameter(parameter_tvb, parameter_tree, parameter_item);
5973             break;
5974           case PARAM_TYPE_ORIG_CALLED_NR:
5975             dissect_isup_original_called_number_parameter(parameter_tvb, parameter_tree, parameter_item);
5976             break;
5977           case PARAM_TYPE_OPT_BACKW_CALL_IND:
5978             dissect_isup_optional_backward_call_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
5979             break;
5980           case PARAM_TYPE_USER_TO_USER_IND:
5981             dissect_isup_user_to_user_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
5982             break;
5983           case PARAM_TYPE_ORIG_ISC_POINT_CODE:
5984             dissect_isup_original_isc_point_code_parameter(parameter_tvb, parameter_tree, parameter_item);
5985             break;
5986           case PARAM_TYPE_GENERIC_NOTIF_IND:
5987             dissect_isup_generic_notification_indicator_parameter(parameter_tvb, parameter_tree, parameter_item);
5988             break;
5989           case PARAM_TYPE_CALL_HIST_INFO :
5990             dissect_isup_call_history_information_parameter(parameter_tvb, parameter_tree, parameter_item);
5991             break;
5992           case PARAM_TYPE_ACC_DELIV_INFO:
5993             dissect_isup_access_delivery_information_parameter(parameter_tvb, parameter_tree, parameter_item);
5994             break;
5995           case PARAM_TYPE_NETW_SPECIFIC_FACLTY:
5996             dissect_isup_network_specific_facility_parameter(parameter_tvb, parameter_tree, parameter_item);
5997             break;
5998           case PARAM_TYPE_USER_SERVICE_INFO_PR:
5999             dissect_isup_user_service_information_prime_parameter(parameter_tvb, parameter_tree, parameter_item);
6000             break;
6001           case PARAM_TYPE_PROPAG_DELAY_COUNTER:
6002             dissect_isup_propagation_delay_counter_parameter(parameter_tvb, parameter_tree, parameter_item);
6003             break;
6004           case PARAM_TYPE_REMOTE_OPERATIONS:
6005             dissect_isup_remote_operations_parameter(parameter_tvb, parameter_tree, parameter_item);
6006             break;
6007           case PARAM_TYPE_SERVICE_ACTIVATION:
6008             dissect_isup_service_activation_parameter(parameter_tvb, parameter_tree, parameter_item);
6009             break;
6010           case PARAM_TYPE_USER_TELESERV_INFO:
6011             dissect_isup_user_teleservice_information_parameter(parameter_tvb, parameter_tree, parameter_item);
6012             break;
6013           case PARAM_TYPE_TRANSM_MEDIUM_USED:
6014             dissect_isup_transmission_medium_used_parameter(parameter_tvb, parameter_tree, parameter_item);
6015             break;
6016           case PARAM_TYPE_CALL_DIV_INFO:
6017             dissect_isup_call_diversion_information_parameter(parameter_tvb, parameter_tree, parameter_item);
6018             break;
6019           case PARAM_TYPE_ECHO_CTRL_INFO:
6020             dissect_isup_echo_control_information_parameter(parameter_tvb, parameter_tree, parameter_item);
6021             break;
6022           case PARAM_TYPE_MSG_COMPAT_INFO:
6023             dissect_isup_message_compatibility_information_parameter(parameter_tvb, parameter_tree, parameter_item);
6024             break;
6025           case PARAM_TYPE_PARAM_COMPAT_INFO:
6026             dissect_isup_parameter_compatibility_information_parameter(parameter_tvb, parameter_tree, parameter_item);
6027             break;
6028           case PARAM_TYPE_MLPP_PRECEDENCE:
6029             dissect_isup_mlpp_precedence_parameter(parameter_tvb, parameter_tree, parameter_item);
6030             break;
6031           case PARAM_TYPE_MCID_REQ_IND:
6032             dissect_isup_mcid_request_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
6033             break;
6034           case PARAM_TYPE_MCID_RSP_IND:
6035             dissect_isup_mcid_response_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
6036             break;
6037           case PARAM_TYPE_HOP_COUNTER:
6038             dissect_isup_hop_counter_parameter(parameter_tvb, parameter_tree, parameter_item);
6039             break;
6040           case PARAM_TYPE_ORIG_LINE_INFO:
6041             dissect_isup_orig_line_info_parameter(parameter_tvb, parameter_tree, parameter_item);
6042             break;
6043           case PARAM_TYPE_TRANSM_MEDIUM_RQUR_PR:
6044             dissect_isup_transmission_medium_requirement_prime_parameter(parameter_tvb, parameter_tree, parameter_item);
6045             break;
6046           case PARAM_TYPE_LOCATION_NR:
6047             dissect_isup_location_number_parameter(parameter_tvb, parameter_tree, parameter_item);
6048             break;
6049           case PARAM_TYPE_REDIR_NR_RSTRCT:
6050             dissect_isup_redirection_number_restriction_parameter(parameter_tvb, parameter_tree, parameter_item);
6051             break;
6052           case PARAM_TYPE_CALL_TRANS_REF:
6053             dissect_isup_call_transfer_reference_parameter(parameter_tvb, parameter_tree, parameter_item);
6054             break;
6055           case PARAM_TYPE_LOOP_PREV_IND:
6056             dissect_isup_loop_prevention_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
6057             break;
6058           case PARAM_TYPE_CALL_TRANS_NR:
6059             dissect_isup_call_transfer_number_parameter(parameter_tvb, parameter_tree, parameter_item);
6060             break;
6061           case PARAM_TYPE_CCSS:
6062             dissect_isup_ccss_parameter(parameter_tvb, parameter_tree, parameter_item);
6063             break;
6064           case PARAM_TYPE_FORW_GVNS:
6065             dissect_isup_forward_gvns_parameter(parameter_tvb, parameter_tree, parameter_item);
6066             break;
6067           case PARAM_TYPE_BACKW_GVNS:
6068             dissect_isup_backward_gvns_parameter(parameter_tvb, parameter_tree, parameter_item);
6069             break;
6070           case PARAM_TYPE_REDIRECT_CAPAB:
6071             dissect_isup_redirect_capability_parameter(parameter_tvb, parameter_tree, parameter_item);
6072             break;
6073           case PARAM_TYPE_NETW_MGMT_CTRL:
6074             dissect_isup_network_management_controls_parameter(parameter_tvb, parameter_tree, parameter_item);
6075             break;
6076           case PARAM_TYPE_CORRELATION_ID:
6077             dissect_isup_correlation_id_parameter(parameter_tvb, parameter_tree, parameter_item);
6078             break;
6079           case PARAM_TYPE_SCF_ID:
6080             dissect_isup_scf_id_parameter(parameter_tvb, parameter_tree, parameter_item);
6081             break;
6082           case PARAM_TYPE_CALL_DIV_TREAT_IND:
6083             dissect_isup_call_diversion_treatment_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
6084             break;
6085           case PARAM_TYPE_CALLED_IN_NR:
6086             dissect_isup_called_in_number_parameter(parameter_tvb, parameter_tree, parameter_item);
6087             break;
6088           case PARAM_TYPE_CALL_OFF_TREAT_IND:
6089             dissect_isup_call_offering_treatment_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
6090             break;
6091           case PARAM_TYPE_CHARGED_PARTY_IDENT:
6092             dissect_isup_charged_party_identification_parameter(parameter_tvb, parameter_tree, parameter_item);
6093             break;
6094           case PARAM_TYPE_CONF_TREAT_IND:
6095             dissect_isup_conference_treatment_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
6096             break;
6097           case PARAM_TYPE_DISPLAY_INFO:
6098             dissect_isup_display_information_parameter(parameter_tvb, parameter_tree, parameter_item);
6099             break;
6100           case PARAM_TYPE_UID_ACTION_IND:
6101             dissect_isup_uid_action_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
6102             break;
6103           case PARAM_TYPE_UID_CAPAB_IND:
6104             dissect_isup_uid_capability_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
6105             break;
6106           case PARAM_TYPE_REDIRECT_COUNTER:
6107             dissect_isup_redirect_counter_parameter(parameter_tvb, parameter_tree, parameter_item);
6108             break;
6109           case PARAM_TYPE_COLLECT_CALL_REQ:
6110             dissect_isup_collect_call_request_parameter(parameter_tvb, parameter_tree, parameter_item);
6111             break;
6112           case PARAM_TYPE_CALLING_GEODETIC_LOCATION:
6113             dissect_isup_calling_geodetic_location_parameter(parameter_tvb, parameter_tree, parameter_item);
6114             break;
6115           case PARAM_TYPE_GENERIC_NR:
6116             dissect_isup_generic_number_parameter(parameter_tvb, parameter_tree, parameter_item);
6117             break;
6118           case PARAM_TYPE_JURISDICTION:
6119             dissect_isup_jurisdiction_parameter(parameter_tvb, parameter_tree, parameter_item);
6120             break;
6121           case PARAM_TYPE_GENERIC_NAME:
6122             dissect_isup_generic_name_parameter(parameter_tvb, parameter_tree, parameter_item);
6123             break;
6124           case PARAM_TYPE_GENERIC_DIGITS:
6125             dissect_isup_generic_digits_parameter(parameter_tvb, parameter_tree, parameter_item);
6126             break;
6127           case PARAM_TYPE_CHARGE_NR:
6128             dissect_isup_charge_number_parameter(parameter_tvb, parameter_tree, parameter_item);
6129             break;
6130           case PARAM_TYPE_APPLICATON_TRANS:
6131             dissect_isup_application_transport_parameter(parameter_tvb, pinfo, parameter_tree, parameter_item);
6132             break;
6133
6134           default:
6135             dissect_isup_unknown_parameter(parameter_tvb, parameter_item);
6136             break;
6137         }
6138
6139
6140         offset += MIN(parameter_length, actual_length);
6141       }
6142
6143     }
6144     else {
6145       /* End of optional parameters is reached */
6146       proto_tree_add_uint_format(isup_tree, hf_isup_parameter_type, optional_parameters_tvb , offset, PARAMETER_TYPE_LENGTH, parameter_type, "End of optional parameters (%u)", parameter_type);
6147     }
6148   }
6149 }
6150 /* ------------------------------------------------------------------ */
6151 /* Dissectors for all used message types                              */
6152 /* Called by dissect_isup_message(),                                  */
6153 /* call parameter dissectors in order of mandatory parameters         */
6154 /* (since not labeled)                                                */
6155 /* ------------------------------------------------------------------
6156   Dissector Message Type Circuit Validation Test Response
6157  */
6158 static gint
6159 dissect_ansi_isup_circuit_validation_test_resp_message(tvbuff_t *message_tvb, proto_tree *isup_tree)
6160 {
6161   proto_item* parameter_item;
6162   proto_tree* parameter_tree;
6163   tvbuff_t *parameter_tvb;
6164   gint offset = 0;
6165   gint parameter_type,actual_length;
6166
6167   /* Do stuff for first mandatory fixed parameter: CVR Repsonse Indicator */
6168   parameter_type = ANSI_ISUP_PARAM_TYPE_CVR_RESP_IND;
6169   parameter_item = proto_tree_add_text(isup_tree, message_tvb, offset, CVR_RESP_IND_LENGTH, "CVR Response Indicator");
6170
6171   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
6172   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type,
6173                              "Mandatory Parameter: %u (%s)",
6174                              parameter_type,
6175                              val_to_str_ext_const(parameter_type, &isup_parameter_type_value_ext,"CVR Response Indicator"));
6176
6177   actual_length = tvb_ensure_length_remaining(message_tvb, offset);
6178
6179   parameter_tvb = tvb_new_subset(message_tvb, offset, MIN(CVR_RESP_IND_LENGTH, actual_length), CVR_RESP_IND_LENGTH);
6180   dissect_isup_cvr_response_ind_parameter(parameter_tvb, parameter_tree, parameter_item);
6181   offset += CVR_RESP_IND_LENGTH;
6182
6183   /* Do stuff for second mandatory fixed parameter: CG Characteristics Indicator */
6184   parameter_type = ANSI_ISUP_PARAM_TYPE_CG_CHAR_IND;
6185   parameter_item = proto_tree_add_text(isup_tree, message_tvb, offset,
6186                                        CG_CHAR_IND_LENGTH,
6187                                        "Circuit Group Characteristics Indicators");
6188   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
6189   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type,
6190                              "Mandatory Parameter: %u (%s)",
6191                              parameter_type,
6192                              val_to_str_ext_const(parameter_type, &isup_parameter_type_value_ext, "Circuit Group Characters"));
6193   actual_length = tvb_ensure_length_remaining(message_tvb, offset);
6194   parameter_tvb = tvb_new_subset(message_tvb, offset, MIN(CG_CHAR_IND_LENGTH, actual_length), CG_CHAR_IND_LENGTH);
6195   dissect_isup_circuit_group_char_ind_parameter(parameter_tvb, parameter_tree, parameter_item);
6196   offset += CG_CHAR_IND_LENGTH;
6197
6198   return offset;
6199 }
6200 /* ------------------------------------------------------------------
6201   Dissector Message Type Circuit Reservation
6202  */
6203 static gint
6204 dissect_ansi_isup_circuit_reservation_message(tvbuff_t *message_tvb, proto_tree *isup_tree)
6205 { proto_item* parameter_item;
6206   proto_tree* parameter_tree;
6207   tvbuff_t *parameter_tvb;
6208   gint offset = 0;
6209   gint parameter_type, actual_length;
6210
6211   /* Do stuff for mandatory fixed parameter: Nature of Connection Indicators */
6212   parameter_type = PARAM_TYPE_NATURE_OF_CONN_IND;
6213   parameter_item = proto_tree_add_text(isup_tree, message_tvb, offset,
6214                                        NATURE_OF_CONNECTION_IND_LENGTH,
6215                                        "Nature of Connection Indicators");
6216   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
6217   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type,
6218                              "Mandatory Parameter: %u (%s)",
6219                              parameter_type,
6220                              val_to_str_ext_const(parameter_type, &isup_parameter_type_value_ext,"unknown"));
6221   actual_length = tvb_ensure_length_remaining(message_tvb, offset);
6222   parameter_tvb = tvb_new_subset(message_tvb, offset, MIN(NATURE_OF_CONNECTION_IND_LENGTH, actual_length), NATURE_OF_CONNECTION_IND_LENGTH);
6223   dissect_isup_nature_of_connection_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
6224   offset += NATURE_OF_CONNECTION_IND_LENGTH;
6225
6226   return offset;
6227 }
6228 /* ------------------------------------------------------------------
6229   Dissector Message Type Initial address message
6230  */
6231 static gint
6232 dissect_isup_initial_address_message(tvbuff_t *message_tvb, proto_tree *isup_tree)
6233 { proto_item* parameter_item;
6234   proto_tree* parameter_tree;
6235   tvbuff_t *parameter_tvb;
6236   gint offset = 0;
6237   gint parameter_type, parameter_pointer, parameter_length, actual_length;
6238
6239   /* Do stuff for first mandatory fixed parameter: Nature of Connection Indicators */
6240   parameter_type = PARAM_TYPE_NATURE_OF_CONN_IND;
6241   parameter_item = proto_tree_add_text(isup_tree, message_tvb, offset,
6242                                        NATURE_OF_CONNECTION_IND_LENGTH,
6243                                        "Nature of Connection Indicators");
6244   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
6245   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type,
6246                              "Mandatory Parameter: %u (%s)",
6247                              parameter_type,
6248                              val_to_str_ext_const(parameter_type, &isup_parameter_type_value_ext, "unknown"));
6249   actual_length = tvb_ensure_length_remaining(message_tvb, offset);
6250   parameter_tvb = tvb_new_subset(message_tvb, offset, MIN(NATURE_OF_CONNECTION_IND_LENGTH, actual_length), NATURE_OF_CONNECTION_IND_LENGTH);
6251   dissect_isup_nature_of_connection_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
6252   offset += NATURE_OF_CONNECTION_IND_LENGTH;
6253
6254   /* Do stuff for 2nd mandatory fixed parameter: Forward Call Indicators */
6255   parameter_type =  PARAM_TYPE_FORW_CALL_IND;
6256   parameter_item = proto_tree_add_text(isup_tree, message_tvb, offset,
6257                                        FORWARD_CALL_IND_LENGTH,
6258                                        "Forward Call Indicators");
6259   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
6260   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type,
6261                              "Mandatory Parameter: %u (%s)",
6262                              parameter_type,
6263                              val_to_str_ext_const(parameter_type, &isup_parameter_type_value_ext, "unknown"));
6264   actual_length = tvb_ensure_length_remaining(message_tvb, offset);
6265   parameter_tvb = tvb_new_subset(message_tvb, offset, MIN(FORWARD_CALL_IND_LENGTH, actual_length), FORWARD_CALL_IND_LENGTH );
6266   dissect_isup_forward_call_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
6267   offset +=  FORWARD_CALL_IND_LENGTH;
6268
6269   /* Do stuff for 3nd mandatory fixed parameter: Calling party's category */
6270   parameter_type = PARAM_TYPE_CALLING_PRTY_CATEG;
6271   parameter_item = proto_tree_add_text(isup_tree, message_tvb, offset,
6272                                        CALLING_PRTYS_CATEGORY_LENGTH,
6273                                        "Calling Party's category");
6274   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
6275   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type,
6276                              "Mandatory Parameter: %u (%s)",
6277                              parameter_type,
6278                              val_to_str_ext_const(parameter_type, &isup_parameter_type_value_ext, "unknown"));
6279   actual_length = tvb_ensure_length_remaining(message_tvb, offset);
6280   parameter_tvb = tvb_new_subset(message_tvb, offset, MIN(CALLING_PRTYS_CATEGORY_LENGTH, actual_length),CALLING_PRTYS_CATEGORY_LENGTH );
6281   dissect_isup_calling_partys_category_parameter(parameter_tvb, parameter_tree, parameter_item);
6282   offset += CALLING_PRTYS_CATEGORY_LENGTH;
6283
6284   switch (isup_standard){
6285     case ITU_STANDARD:
6286       /* If ITU, do stuff for 4th mandatory fixed parameter: Transmission medium requirement */
6287       parameter_type = PARAM_TYPE_TRANSM_MEDIUM_REQU;
6288       parameter_item = proto_tree_add_text(isup_tree, message_tvb, offset,
6289                                            TRANSMISSION_MEDIUM_REQUIREMENT_LENGTH,
6290                                            "Transmission medium requirement");
6291       parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
6292       proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type,
6293                                  "Mandatory Parameter: %u (%s)",
6294                                  parameter_type,
6295                                  val_to_str_ext_const(parameter_type, &isup_parameter_type_value_ext, "unknown"));
6296       actual_length = tvb_ensure_length_remaining(message_tvb, offset);
6297       parameter_tvb = tvb_new_subset(message_tvb, offset, MIN(TRANSMISSION_MEDIUM_REQUIREMENT_LENGTH, actual_length), TRANSMISSION_MEDIUM_REQUIREMENT_LENGTH);
6298       dissect_isup_transmission_medium_requirement_parameter(parameter_tvb, parameter_tree, parameter_item);
6299       offset += TRANSMISSION_MEDIUM_REQUIREMENT_LENGTH;
6300       break;
6301     case ANSI_STANDARD:
6302       /* If ANSI, do stuff for the first mandatory variable parameter, USER_SERVICE_INFORMATION */
6303       parameter_type = PARAM_TYPE_USER_SERVICE_INFO;
6304       parameter_pointer = tvb_get_guint8(message_tvb, offset);
6305       parameter_length = tvb_get_guint8(message_tvb, offset + parameter_pointer);
6306       parameter_item = proto_tree_add_text(isup_tree, message_tvb,
6307                                            offset +  parameter_pointer,
6308                                            parameter_length + PARAMETER_LENGTH_IND_LENGTH,
6309                                            "User Service Information");
6310       parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
6311       proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type,
6312                                  "Mandatory Parameter: %u (%s)",
6313                                  parameter_type,
6314                                  val_to_str_ext_const(parameter_type, &isup_parameter_type_value_ext, "unknown"));
6315       proto_tree_add_uint_format(parameter_tree, hf_isup_mandatory_variable_parameter_pointer, message_tvb, offset, PARAMETER_POINTER_LENGTH, parameter_pointer, "Pointer to Parameter: %u", parameter_pointer);
6316       proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_length, message_tvb, offset + parameter_pointer, PARAMETER_LENGTH_IND_LENGTH, parameter_length, "Parameter length: %u", parameter_length);
6317       actual_length = tvb_ensure_length_remaining(message_tvb, offset);
6318       parameter_tvb = tvb_new_subset(message_tvb, offset + parameter_pointer + PARAMETER_LENGTH_IND_LENGTH, MIN(parameter_length, actual_length), parameter_length );
6319       dissect_isup_user_service_information_parameter(parameter_tvb, parameter_tree, parameter_item);
6320       offset += PARAMETER_POINTER_LENGTH;
6321       break;
6322   }
6323
6324   /* Do stuff for mandatory variable parameter Called party number */
6325   parameter_type = PARAM_TYPE_CALLED_PARTY_NR;
6326   parameter_pointer = tvb_get_guint8(message_tvb, offset);
6327   parameter_length = tvb_get_guint8(message_tvb, offset + parameter_pointer);
6328
6329   parameter_item = proto_tree_add_text(isup_tree, message_tvb,
6330                                        offset +  parameter_pointer,
6331                                        parameter_length + PARAMETER_LENGTH_IND_LENGTH,
6332                                        "Called Party Number");
6333   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
6334   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type,
6335                              "Mandatory Parameter: %u (%s)",
6336                              parameter_type,
6337                              val_to_str_ext_const(parameter_type, &isup_parameter_type_value_ext, "unknown"));
6338   proto_tree_add_uint_format(parameter_tree, hf_isup_mandatory_variable_parameter_pointer, message_tvb, offset, PARAMETER_POINTER_LENGTH, parameter_pointer, "Pointer to Parameter: %u", parameter_pointer);
6339   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_length, message_tvb, offset + parameter_pointer, PARAMETER_LENGTH_IND_LENGTH, parameter_length, "Parameter length: %u", parameter_length);
6340   actual_length = tvb_ensure_length_remaining(message_tvb, offset);
6341   parameter_tvb = tvb_new_subset(message_tvb, offset + parameter_pointer + PARAMETER_LENGTH_IND_LENGTH, MIN(parameter_length, actual_length), parameter_length );
6342   dissect_isup_called_party_number_parameter(parameter_tvb, parameter_tree, parameter_item);
6343   offset += PARAMETER_POINTER_LENGTH;
6344
6345   return offset;
6346 }
6347 /* ------------------------------------------------------------------
6348   Dissector Message Type subsequent address message
6349  */
6350 static gint dissect_isup_subsequent_address_message(tvbuff_t *message_tvb, proto_tree *isup_tree)
6351 { proto_item* parameter_item;
6352   proto_tree* parameter_tree;
6353   tvbuff_t *parameter_tvb;
6354   gint offset = 0;
6355   gint parameter_type, parameter_pointer, parameter_length, actual_length;
6356
6357   /* Do stuff for mandatory variable parameter Subsequent number */
6358   parameter_type = PARAM_TYPE_SUBSQT_NR;
6359
6360   parameter_pointer = tvb_get_guint8(message_tvb, offset);
6361   parameter_length = tvb_get_guint8(message_tvb, offset + parameter_pointer);
6362
6363   parameter_item = proto_tree_add_text(isup_tree, message_tvb,
6364                                        offset +  parameter_pointer,
6365                                        parameter_length + PARAMETER_LENGTH_IND_LENGTH,
6366                                        "Subsequent Number");
6367   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
6368   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type,
6369                              "Mandatory Parameter: %u (%s)",
6370                              parameter_type,
6371                              val_to_str_ext_const(parameter_type, &isup_parameter_type_value_ext, "unknown"));
6372   proto_tree_add_uint_format(parameter_tree, hf_isup_mandatory_variable_parameter_pointer, message_tvb, offset, PARAMETER_POINTER_LENGTH, parameter_pointer, "Pointer to Parameter: %u", parameter_pointer);
6373   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_length, message_tvb, offset + parameter_pointer, PARAMETER_LENGTH_IND_LENGTH, parameter_length, "Parameter length: %u", parameter_length);
6374   actual_length = tvb_ensure_length_remaining(message_tvb, offset);
6375   parameter_tvb = tvb_new_subset(message_tvb, offset + parameter_pointer + PARAMETER_LENGTH_IND_LENGTH, MIN(parameter_length, actual_length), parameter_length );
6376   dissect_isup_subsequent_number_parameter(parameter_tvb, parameter_tree, parameter_item);
6377   offset += PARAMETER_POINTER_LENGTH;
6378
6379   return offset;
6380 }
6381
6382 /* ------------------------------------------------------------------
6383   Dissector Message Type Information request message
6384  */
6385 static gint
6386 dissect_isup_information_request_message(tvbuff_t *message_tvb, proto_tree *isup_tree)
6387 { proto_item* parameter_item;
6388   proto_tree* parameter_tree;
6389   tvbuff_t *parameter_tvb;
6390   gint offset = 0;
6391   gint parameter_type, actual_length;
6392
6393   /* Do stuff for first mandatory fixed parameter: Information request indicators*/
6394   parameter_type = PARAM_TYPE_INFO_REQ_IND;
6395   parameter_item = proto_tree_add_text(isup_tree, message_tvb, offset,
6396                                        INFO_REQUEST_IND_LENGTH,
6397                                        "Information request indicators");
6398   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
6399   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type,
6400                              "Mandatory Parameter: %u (%s)",
6401                              parameter_type,
6402                              val_to_str_ext_const(parameter_type, &isup_parameter_type_value_ext, "unknown"));
6403   actual_length = tvb_ensure_length_remaining(message_tvb, offset);
6404   parameter_tvb = tvb_new_subset(message_tvb, offset, MIN(INFO_REQUEST_IND_LENGTH, actual_length), INFO_REQUEST_IND_LENGTH);
6405   dissect_isup_information_request_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
6406   offset += INFO_REQUEST_IND_LENGTH;
6407   return offset;
6408 }
6409 /* ------------------------------------------------------------------
6410   Dissector Message Type Information
6411  */
6412 static gint
6413 dissect_isup_information_message(tvbuff_t *message_tvb, proto_tree *isup_tree)
6414 { proto_item* parameter_item;
6415   proto_tree* parameter_tree;
6416   tvbuff_t *parameter_tvb;
6417   gint offset = 0;
6418   gint parameter_type, actual_length;
6419
6420   /* Do stuff for first mandatory fixed parameter: Information  indicators*/
6421   parameter_type = PARAM_TYPE_INFO_IND;
6422   parameter_item = proto_tree_add_text(isup_tree, message_tvb, offset,
6423                                        INFO_IND_LENGTH,
6424                                        "Information indicators");
6425   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
6426   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type,
6427                              "Mandatory Parameter: %u (%s)",
6428                              parameter_type,
6429                              val_to_str_ext_const(parameter_type, &isup_parameter_type_value_ext, "unknown"));
6430   actual_length = tvb_ensure_length_remaining(message_tvb, offset);
6431   parameter_tvb = tvb_new_subset(message_tvb, offset, MIN(INFO_IND_LENGTH, actual_length), INFO_IND_LENGTH);
6432   dissect_isup_information_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
6433   offset += INFO_IND_LENGTH;
6434   return offset;
6435 }
6436 /* ------------------------------------------------------------------
6437   Dissector Message Type Continuity
6438  */
6439 static gint
6440 dissect_isup_continuity_message(tvbuff_t *message_tvb, proto_tree *isup_tree)
6441 { proto_item* parameter_item;
6442   proto_tree* parameter_tree;
6443   tvbuff_t *parameter_tvb;
6444   gint offset = 0;
6445   gint parameter_type, actual_length;
6446
6447   /* Do stuff for first mandatory fixed parameter: Continuity indicators*/
6448   parameter_type = PARAM_TYPE_CONTINUITY_IND;
6449   parameter_item = proto_tree_add_text(isup_tree, message_tvb, offset,
6450                                        CONTINUITY_IND_LENGTH,
6451                                        "Continuity indicators");
6452   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
6453   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type,
6454                              "Mandatory Parameter: %u (%s)",
6455                              parameter_type,
6456                              val_to_str_ext_const(parameter_type, &isup_parameter_type_value_ext, "unknown"));
6457   actual_length = tvb_ensure_length_remaining(message_tvb, offset);
6458   parameter_tvb = tvb_new_subset(message_tvb, offset, MIN(CONTINUITY_IND_LENGTH, actual_length), CONTINUITY_IND_LENGTH);
6459   dissect_isup_continuity_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
6460   offset += CONTINUITY_IND_LENGTH;
6461   return offset;
6462 }
6463 /* ------------------------------------------------------------------
6464   Dissector Message Type Address complete
6465  */
6466 static gint
6467 dissect_isup_address_complete_message(tvbuff_t *message_tvb, proto_tree *isup_tree)
6468 { proto_item* parameter_item;
6469   proto_tree* parameter_tree;
6470   tvbuff_t *parameter_tvb;
6471   gint offset = 0;
6472   gint parameter_type, actual_length;
6473
6474   /* Do stuff for first mandatory fixed parameter: backward call indicators*/
6475   parameter_type = PARAM_TYPE_BACKW_CALL_IND;
6476   parameter_item = proto_tree_add_text(isup_tree, message_tvb, offset,
6477                                        BACKWARD_CALL_IND_LENGTH,
6478                                        "Backward Call Indicators");
6479   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
6480   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type,
6481                              "Mandatory Parameter: %u (%s)",
6482                              parameter_type,
6483                              val_to_str_ext_const(parameter_type, &isup_parameter_type_value_ext, "unknown"));
6484   actual_length = tvb_ensure_length_remaining(message_tvb, offset);
6485   parameter_tvb = tvb_new_subset(message_tvb, offset, MIN(BACKWARD_CALL_IND_LENGTH, actual_length), BACKWARD_CALL_IND_LENGTH);
6486   dissect_isup_backward_call_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
6487   offset += BACKWARD_CALL_IND_LENGTH;
6488   return offset;
6489 }
6490 /* ------------------------------------------------------------------
6491   Dissector Message Type Connect
6492  */
6493 static gint
6494 dissect_isup_connect_message(tvbuff_t *message_tvb, proto_tree *isup_tree)
6495 { proto_item* parameter_item;
6496   proto_tree* parameter_tree;
6497   tvbuff_t *parameter_tvb;
6498   gint offset = 0;
6499   gint parameter_type, actual_length;
6500
6501   /* Do stuff for first mandatory fixed parameter: backward call indicators*/
6502   parameter_type = PARAM_TYPE_BACKW_CALL_IND;
6503   parameter_item = proto_tree_add_text(isup_tree, message_tvb, offset,
6504                                        BACKWARD_CALL_IND_LENGTH,
6505                                        "Backward Call Indicators");
6506   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
6507   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type,
6508                              "Mandatory Parameter: %u (%s)",
6509                              parameter_type,
6510                              val_to_str_ext_const(parameter_type, &isup_parameter_type_value_ext, "unknown"));
6511   actual_length = tvb_ensure_length_remaining(message_tvb, offset);
6512   parameter_tvb = tvb_new_subset(message_tvb, offset, MIN(BACKWARD_CALL_IND_LENGTH, actual_length), BACKWARD_CALL_IND_LENGTH);
6513   dissect_isup_backward_call_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
6514   offset += BACKWARD_CALL_IND_LENGTH;
6515   return offset;
6516 }
6517 /* ------------------------------------------------------------------
6518   Dissector Message Type release message
6519  */
6520 static gint
6521 dissect_isup_release_message(tvbuff_t *message_tvb, proto_tree *isup_tree)
6522 { proto_item* parameter_item;
6523   proto_tree* parameter_tree;
6524   tvbuff_t *parameter_tvb;
6525   gint offset = 0;
6526   gint parameter_type, parameter_pointer, parameter_length, actual_length;
6527
6528   /* Do stuff for mandatory variable parameter Cause indicators */
6529   parameter_type =  PARAM_TYPE_CAUSE_INDICATORS;
6530
6531   parameter_pointer = tvb_get_guint8(message_tvb, offset);
6532   parameter_length = tvb_get_guint8(message_tvb, offset + parameter_pointer);
6533
6534   parameter_item = proto_tree_add_text(isup_tree, message_tvb,
6535                                        offset +  parameter_pointer,
6536                                        parameter_length + PARAMETER_LENGTH_IND_LENGTH,
6537                                        "Cause indicators");
6538   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
6539   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type,
6540                              "Mandatory Parameter: %u (%s)",
6541                              parameter_type,
6542                              val_to_str_ext_const(parameter_type, &isup_parameter_type_value_ext, "unknown"));
6543   proto_tree_add_uint_format(parameter_tree, hf_isup_mandatory_variable_parameter_pointer, message_tvb, offset, PARAMETER_POINTER_LENGTH, parameter_pointer, "Pointer to Parameter: %u", parameter_pointer);
6544   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_length, message_tvb, offset + parameter_pointer, PARAMETER_LENGTH_IND_LENGTH, parameter_length, "Parameter length: %u", parameter_length);
6545   actual_length = tvb_ensure_length_remaining(message_tvb, offset);
6546   parameter_tvb = tvb_new_subset(message_tvb, offset + parameter_pointer + PARAMETER_LENGTH_IND_LENGTH, MIN(parameter_length, actual_length), parameter_length );
6547   switch (isup_standard){
6548     case ITU_STANDARD:
6549       dissect_isup_cause_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
6550       break;
6551     case ANSI_STANDARD:
6552       dissect_ansi_isup_cause_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
6553       break;
6554   }
6555   offset += PARAMETER_POINTER_LENGTH;
6556
6557   return offset;
6558 }
6559 /* ------------------------------------------------------------------
6560   Dissector Message Type Resume/Suspend
6561  */
6562 static gint
6563 dissect_isup_suspend_resume_message(tvbuff_t *message_tvb, proto_tree *isup_tree)
6564 { proto_item* parameter_item;
6565   proto_tree* parameter_tree;
6566   tvbuff_t *parameter_tvb;
6567   gint offset = 0;
6568   gint parameter_type, actual_length;
6569
6570   /* Do stuff for first mandatory fixed parameter: backward call indicators*/
6571   parameter_type = PARAM_TYPE_SUSP_RESUME_IND;
6572   parameter_item = proto_tree_add_text(isup_tree, message_tvb, offset,
6573                                        SUSPEND_RESUME_IND_LENGTH,
6574                                        "Suspend/Resume indicator");
6575   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
6576   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type,
6577                              "Mandatory Parameter: %u (%s)",
6578                              parameter_type,
6579                              val_to_str_ext_const(parameter_type, &isup_parameter_type_value_ext, "unknown"));
6580   actual_length = tvb_ensure_length_remaining(message_tvb, offset);
6581   parameter_tvb = tvb_new_subset(message_tvb, offset, MIN(SUSPEND_RESUME_IND_LENGTH, actual_length), SUSPEND_RESUME_IND_LENGTH);
6582   dissect_isup_suspend_resume_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
6583   offset += SUSPEND_RESUME_IND_LENGTH;
6584   return offset;
6585 }
6586 /* ------------------------------------------------------------------
6587   Dissector Message Type Circuit group reset/query message
6588  */
6589 static gint
6590 dissect_isup_circuit_group_reset_query_message(tvbuff_t *message_tvb, proto_tree *isup_tree)
6591 { proto_item* parameter_item;
6592   proto_tree* parameter_tree;
6593   tvbuff_t *parameter_tvb;
6594   gint offset = 0;
6595   gint parameter_type, parameter_pointer, parameter_length, actual_length;
6596
6597   /* Do stuff for mandatory variable parameter range and status*/
6598   parameter_type =  PARAM_TYPE_RANGE_AND_STATUS;
6599
6600   parameter_pointer = tvb_get_guint8(message_tvb, offset);
6601   parameter_length = tvb_get_guint8(message_tvb, offset + parameter_pointer);
6602
6603   parameter_item = proto_tree_add_text(isup_tree, message_tvb,
6604                                        offset +  parameter_pointer,
6605                                        parameter_length + PARAMETER_LENGTH_IND_LENGTH,
6606                                        "Range and status");
6607   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
6608   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type,
6609                              "Mandatory Parameter: %u (%s)",
6610                              parameter_type,
6611                              val_to_str_ext_const(parameter_type, &isup_parameter_type_value_ext, "unknown"));
6612   proto_tree_add_uint_format(parameter_tree, hf_isup_mandatory_variable_parameter_pointer, message_tvb, offset, PARAMETER_POINTER_LENGTH, parameter_pointer, "Pointer to Parameter: %u", parameter_pointer);
6613   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_length, message_tvb, offset + parameter_pointer, PARAMETER_LENGTH_IND_LENGTH, parameter_length, "Parameter length: %u", parameter_length);
6614   actual_length = tvb_ensure_length_remaining(message_tvb, offset);
6615   parameter_tvb = tvb_new_subset(message_tvb, offset + parameter_pointer + PARAMETER_LENGTH_IND_LENGTH, MIN(parameter_length, actual_length), parameter_length );
6616   dissect_isup_range_and_status_parameter(parameter_tvb, parameter_tree, parameter_item);
6617   offset += PARAMETER_POINTER_LENGTH;
6618
6619   return offset;
6620 }
6621 /* ------------------------------------------------------------------
6622   Dissector Message Type Circuit group blocking/blocking ack/unblocking/unblocking ack messages
6623  */
6624 static gint
6625 dissect_isup_circuit_group_blocking_messages(tvbuff_t *message_tvb, proto_tree *isup_tree)
6626 { proto_item* parameter_item;
6627   proto_tree* parameter_tree;
6628   tvbuff_t *parameter_tvb;
6629   gint offset = 0;
6630   gint parameter_type, parameter_pointer, parameter_length, actual_length;
6631
6632    /* Do stuff for first mandatory fixed parameter: circuit group supervision message type*/
6633   parameter_type = PARAM_TYPE_CIRC_GRP_SV_MSG_TYPE;
6634   parameter_item = proto_tree_add_text(isup_tree, message_tvb, offset,
6635                                        CIRC_GRP_SV_MSG_TYPE_LENGTH,
6636                                        "Circuit group supervision message type");
6637   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
6638   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type,
6639                              "Mandatory Parameter: %u (%s)",
6640                              parameter_type,
6641                              val_to_str_ext_const(parameter_type, &isup_parameter_type_value_ext, "unknown"));
6642   actual_length = tvb_ensure_length_remaining(message_tvb, offset);
6643   parameter_tvb = tvb_new_subset(message_tvb, offset, MIN(CIRC_GRP_SV_MSG_TYPE_LENGTH, actual_length), CIRC_GRP_SV_MSG_TYPE_LENGTH);
6644   dissect_isup_circuit_group_supervision_message_type_parameter(parameter_tvb, parameter_tree, parameter_item);
6645   offset += CIRC_GRP_SV_MSG_TYPE_LENGTH;
6646
6647   /* Do stuff for mandatory variable parameter range and status*/
6648   parameter_type =  PARAM_TYPE_RANGE_AND_STATUS;
6649
6650   parameter_pointer = tvb_get_guint8(message_tvb, offset);
6651   parameter_length = tvb_get_guint8(message_tvb, offset + parameter_pointer);
6652
6653   parameter_item = proto_tree_add_text(isup_tree, message_tvb,
6654                                        offset +  parameter_pointer,
6655                                        parameter_length + PARAMETER_LENGTH_IND_LENGTH,
6656                                        "Range and status");
6657   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
6658   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type,
6659                              "Mandatory Parameter: %u (%s)",
6660                              parameter_type,
6661                              val_to_str_ext_const(parameter_type, &isup_parameter_type_value_ext, "unknown"));
6662   proto_tree_add_uint_format(parameter_tree, hf_isup_mandatory_variable_parameter_pointer, message_tvb, offset, PARAMETER_POINTER_LENGTH, parameter_pointer, "Pointer to Parameter: %u", parameter_pointer);
6663   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_length, message_tvb, offset + parameter_pointer, PARAMETER_LENGTH_IND_LENGTH, parameter_length, "Parameter length: %u", parameter_length);
6664   actual_length = tvb_ensure_length_remaining(message_tvb, offset);
6665   parameter_tvb = tvb_new_subset(message_tvb, offset + parameter_pointer + PARAMETER_LENGTH_IND_LENGTH, MIN(parameter_length, actual_length), parameter_length );
6666   dissect_isup_range_and_status_parameter(parameter_tvb, parameter_tree, parameter_item);
6667   offset += PARAMETER_POINTER_LENGTH;
6668
6669   return offset;
6670 }
6671
6672 /* ------------------------------------------------------------------
6673   Dissector Message Type Facility request/accepted
6674  */
6675 static gint
6676 dissect_isup_facility_request_accepted_message(tvbuff_t *message_tvb, proto_tree *isup_tree)
6677 { proto_item* parameter_item;
6678   proto_tree* parameter_tree;
6679   tvbuff_t *parameter_tvb;
6680   gint offset = 0;
6681   gint parameter_type, actual_length;
6682
6683   /* Do stuff for first mandatory fixed parameter: facility indicators*/
6684   parameter_type = PARAM_TYPE_FACILITY_IND;
6685   parameter_item = proto_tree_add_text(isup_tree, message_tvb, offset,
6686                                        FACILITY_IND_LENGTH,
6687                                        "Facility indicator");
6688   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
6689   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type,
6690                              "Mandatory Parameter: %u (%s)",
6691                              parameter_type,
6692                              val_to_str_ext_const(parameter_type, &isup_parameter_type_value_ext, "unknown"));
6693   actual_length = tvb_ensure_length_remaining(message_tvb, offset);
6694   parameter_tvb = tvb_new_subset(message_tvb, offset, MIN(FACILITY_IND_LENGTH, actual_length), FACILITY_IND_LENGTH);
6695   dissect_isup_facility_ind_parameter(parameter_tvb, parameter_item);
6696   offset += FACILITY_IND_LENGTH;
6697   return offset;
6698 }
6699 /* ------------------------------------------------------------------
6700   Dissector Message Type Facility reject
6701  */
6702 static gint
6703 dissect_isup_facility_reject_message(tvbuff_t *message_tvb, proto_tree *isup_tree)
6704 { proto_item* parameter_item;
6705   proto_tree* parameter_tree;
6706   tvbuff_t *parameter_tvb;
6707   gint offset = 0;
6708   gint parameter_type, parameter_pointer, parameter_length, actual_length;
6709
6710   /* Do stuff for first mandatory fixed parameter: facility indicators*/
6711   parameter_type = PARAM_TYPE_FACILITY_IND;
6712   parameter_item = proto_tree_add_text(isup_tree, message_tvb, offset,
6713                                        FACILITY_IND_LENGTH,
6714                                        "Facility indicator");
6715   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
6716   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type,
6717                              "Mandatory Parameter: %u (%s)",
6718                              parameter_type,
6719                              val_to_str_ext_const(parameter_type, &isup_parameter_type_value_ext, "unknown"));
6720   actual_length = tvb_ensure_length_remaining(message_tvb, offset);
6721   parameter_tvb = tvb_new_subset(message_tvb, offset, MIN(FACILITY_IND_LENGTH, actual_length), FACILITY_IND_LENGTH);
6722   dissect_isup_facility_ind_parameter(parameter_tvb, parameter_item);
6723   offset += FACILITY_IND_LENGTH;
6724
6725   /* Do stuff for mandatory variable parameter Cause indicators */
6726   parameter_type =  PARAM_TYPE_CAUSE_INDICATORS;
6727
6728   parameter_pointer = tvb_get_guint8(message_tvb, offset);
6729   parameter_length = tvb_get_guint8(message_tvb, offset + parameter_pointer);
6730
6731   parameter_item = proto_tree_add_text(isup_tree, message_tvb,
6732                                        offset +  parameter_pointer,
6733                                        parameter_length + PARAMETER_LENGTH_IND_LENGTH,
6734                                        "Cause indicators, see Q.850");
6735   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
6736   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type,
6737                              "Mandatory Parameter: %u (%s)",
6738                              parameter_type,
6739                              val_to_str_ext_const(parameter_type, &isup_parameter_type_value_ext, "unknown"));
6740   proto_tree_add_uint_format(parameter_tree, hf_isup_mandatory_variable_parameter_pointer, message_tvb, offset, PARAMETER_POINTER_LENGTH, parameter_pointer, "Pointer to Parameter: %u", parameter_pointer);
6741   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_length, message_tvb, offset + parameter_pointer, PARAMETER_LENGTH_IND_LENGTH, parameter_length, "Parameter length: %u", parameter_length);
6742   actual_length = tvb_ensure_length_remaining(message_tvb, offset);
6743   parameter_tvb = tvb_new_subset(message_tvb, offset + parameter_pointer + PARAMETER_LENGTH_IND_LENGTH, MIN(parameter_length, actual_length), parameter_length );
6744   switch (isup_standard){
6745     case ITU_STANDARD:
6746       dissect_isup_cause_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
6747       break;
6748     case ANSI_STANDARD:
6749       dissect_ansi_isup_cause_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
6750       break;
6751   }
6752   offset += PARAMETER_POINTER_LENGTH;
6753
6754   return offset;
6755 }
6756 /* ------------------------------------------------------------------
6757   Dissector Message Type Circuit group reset acknowledgement message
6758  */
6759 static gint
6760 dissect_isup_circuit_group_reset_acknowledgement_message(tvbuff_t *message_tvb, proto_tree *isup_tree)
6761 { proto_item* parameter_item;
6762   proto_tree* parameter_tree;
6763   tvbuff_t *parameter_tvb;
6764   gint offset = 0;
6765   gint parameter_type, parameter_pointer, parameter_length, actual_length;
6766
6767   /* Do stuff for mandatory variable parameter range and status*/
6768   parameter_type =  PARAM_TYPE_RANGE_AND_STATUS;
6769
6770   parameter_pointer = tvb_get_guint8(message_tvb, offset);
6771   parameter_length = tvb_get_guint8(message_tvb, offset + parameter_pointer);
6772
6773   parameter_item = proto_tree_add_text(isup_tree, message_tvb,
6774                                        offset +  parameter_pointer,
6775                                        parameter_length + PARAMETER_LENGTH_IND_LENGTH,
6776                                        "Range and status");
6777   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
6778   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type,
6779                              "Mandatory Parameter: %u (%s)",
6780                              parameter_type,
6781                              val_to_str_ext_const(parameter_type, &isup_parameter_type_value_ext, "unknown"));
6782   proto_tree_add_uint_format(parameter_tree, hf_isup_mandatory_variable_parameter_pointer, message_tvb, offset, PARAMETER_POINTER_LENGTH, parameter_pointer, "Pointer to Parameter: %u", parameter_pointer);
6783   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_length, message_tvb, offset + parameter_pointer, PARAMETER_LENGTH_IND_LENGTH, parameter_length, "Parameter length: %u", parameter_length);
6784   actual_length = tvb_ensure_length_remaining(message_tvb, offset);
6785   parameter_tvb = tvb_new_subset(message_tvb, offset + parameter_pointer + PARAMETER_LENGTH_IND_LENGTH, MIN(parameter_length, actual_length), parameter_length );
6786   dissect_isup_range_and_status_parameter(parameter_tvb, parameter_tree, parameter_item);
6787   offset += PARAMETER_POINTER_LENGTH;
6788
6789   return offset;
6790 }
6791 /* ------------------------------------------------------------------
6792   Dissector Message Type Circuit group query response message
6793  */
6794 static gint
6795 dissect_isup_circuit_group_query_response_message(tvbuff_t *message_tvb, proto_tree *isup_tree)
6796 { proto_item* parameter_item;
6797   proto_tree* parameter_tree;
6798   tvbuff_t *parameter_tvb;
6799   gint offset = 0;
6800   gint parameter_type, parameter_pointer, parameter_length, actual_length;
6801
6802   /* Do stuff for 1. mandatory variable parameter range and status*/
6803   parameter_type =  PARAM_TYPE_RANGE_AND_STATUS;
6804
6805   parameter_pointer = tvb_get_guint8(message_tvb, offset);
6806   parameter_length = tvb_get_guint8(message_tvb, offset + parameter_pointer);
6807
6808   parameter_item = proto_tree_add_text(isup_tree, message_tvb,
6809                                        offset +  parameter_pointer,
6810                                        parameter_length + PARAMETER_LENGTH_IND_LENGTH,
6811                                        "Range and status");
6812   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
6813   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type,
6814                              "Mandatory Parameter: %u (%s)",
6815                              parameter_type,
6816                              val_to_str_ext_const(parameter_type, &isup_parameter_type_value_ext, "unknown"));
6817   proto_tree_add_uint_format(parameter_tree, hf_isup_mandatory_variable_parameter_pointer, message_tvb, offset, PARAMETER_POINTER_LENGTH, parameter_pointer, "Pointer to Parameter: %u", parameter_pointer);
6818   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_length, message_tvb, offset + parameter_pointer, PARAMETER_LENGTH_IND_LENGTH, parameter_length, "Parameter length: %u", parameter_length);
6819   actual_length = tvb_ensure_length_remaining(message_tvb, offset);
6820   parameter_tvb = tvb_new_subset(message_tvb, offset + parameter_pointer + PARAMETER_LENGTH_IND_LENGTH, MIN(parameter_length, actual_length), parameter_length );
6821   dissect_isup_range_and_status_parameter(parameter_tvb, parameter_tree, parameter_item);
6822   offset += PARAMETER_POINTER_LENGTH;
6823
6824   /* Do stuff for 2. mandatory variable parameter Circuit state indicator*/
6825   parameter_type = PARAM_TYPE_CIRC_STATE_IND;
6826
6827   parameter_pointer = tvb_get_guint8(message_tvb, offset);
6828   parameter_length = tvb_get_guint8(message_tvb, offset + parameter_pointer);
6829
6830   parameter_item = proto_tree_add_text(isup_tree, message_tvb,
6831                                        offset +  parameter_pointer,
6832                                        parameter_length + PARAMETER_LENGTH_IND_LENGTH,
6833                                        "Circuit state indicator (national use)");
6834   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
6835   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type,
6836                              "Mandatory Parameter: %u (%s)",
6837                              parameter_type,
6838                              val_to_str_ext_const(parameter_type, &isup_parameter_type_value_ext, "unknown"));
6839   proto_tree_add_uint_format(parameter_tree, hf_isup_mandatory_variable_parameter_pointer, message_tvb, offset, PARAMETER_POINTER_LENGTH, parameter_pointer, "Pointer to Parameter: %u", parameter_pointer);
6840   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_length, message_tvb, offset + parameter_pointer, PARAMETER_LENGTH_IND_LENGTH, parameter_length, "Parameter length: %u", parameter_length);
6841   actual_length = tvb_ensure_length_remaining(message_tvb, offset);
6842   parameter_tvb = tvb_new_subset(message_tvb, offset + parameter_pointer + PARAMETER_LENGTH_IND_LENGTH, MIN(parameter_length, actual_length), parameter_length );
6843   dissect_isup_circuit_state_ind_parameter(parameter_tvb, parameter_tree, parameter_item);
6844   offset += PARAMETER_POINTER_LENGTH;
6845
6846   return offset;
6847 }
6848 /* ------------------------------------------------------------------
6849   Dissector Message Type Call Progress
6850 */
6851 static gint
6852 dissect_isup_call_progress_message(tvbuff_t *message_tvb, proto_tree *isup_tree)
6853 { proto_item* parameter_item;
6854   proto_tree* parameter_tree;
6855   tvbuff_t *parameter_tvb;
6856   gint offset = 0;
6857   gint parameter_type, actual_length;
6858
6859   /* Do stuff for first mandatory fixed parameter: Event information*/
6860   parameter_type = PARAM_TYPE_EVENT_INFO;
6861   parameter_item = proto_tree_add_text(isup_tree, message_tvb, offset,
6862                                        EVENT_INFO_LENGTH,
6863                                        "Event information");
6864   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
6865   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type,
6866                              "Mandatory Parameter: %u (%s)",
6867                              parameter_type,
6868                              val_to_str_ext_const(parameter_type, &isup_parameter_type_value_ext, "unknown"));
6869   actual_length = tvb_ensure_length_remaining(message_tvb, offset);
6870   parameter_tvb = tvb_new_subset(message_tvb, offset, MIN(EVENT_INFO_LENGTH, actual_length), EVENT_INFO_LENGTH);
6871   dissect_isup_event_information_parameter(parameter_tvb, parameter_tree, parameter_item);
6872   offset += EVENT_INFO_LENGTH;
6873   return offset;
6874 }
6875 /* ------------------------------------------------------------------
6876   Dissector Message Type User-to-User information
6877  */
6878 static gint
6879 dissect_isup_user_to_user_information_message(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree *isup_tree)
6880 { proto_item* parameter_item;
6881   proto_tree* parameter_tree;
6882   tvbuff_t *parameter_tvb;
6883   gint offset = 0;
6884   gint parameter_type, parameter_pointer, parameter_length, actual_length;
6885
6886   /* Do stuff for mandatory variable parameter User-to-user information*/
6887   parameter_type =  PARAM_TYPE_USER_TO_USER_INFO;
6888
6889   parameter_pointer = tvb_get_guint8(message_tvb, offset);
6890   parameter_length = tvb_get_guint8(message_tvb, offset + parameter_pointer);
6891
6892   parameter_item = proto_tree_add_text(isup_tree, message_tvb,
6893                                        offset +  parameter_pointer,
6894                                        parameter_length + PARAMETER_LENGTH_IND_LENGTH,
6895                                        "User-to-user information, see Q.931");
6896   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
6897   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type,
6898                              "Mandatory Parameter: %u (%s)",
6899                              parameter_type,
6900                              val_to_str_ext_const(parameter_type, &isup_parameter_type_value_ext, "unknown"));
6901   proto_tree_add_uint_format(parameter_tree, hf_isup_mandatory_variable_parameter_pointer, message_tvb, offset, PARAMETER_POINTER_LENGTH, parameter_pointer, "Pointer to Parameter: %u", parameter_pointer);
6902   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_length, message_tvb, offset + parameter_pointer, PARAMETER_LENGTH_IND_LENGTH, parameter_length, "Parameter length: %u", parameter_length);
6903   actual_length = tvb_ensure_length_remaining(message_tvb, offset);
6904   parameter_tvb = tvb_new_subset(message_tvb, offset + parameter_pointer + PARAMETER_LENGTH_IND_LENGTH, MIN(parameter_length, actual_length), parameter_length );
6905   dissect_isup_user_to_user_information_parameter(parameter_tvb, pinfo, parameter_tree, parameter_item);
6906   offset += PARAMETER_POINTER_LENGTH;
6907
6908   return offset;
6909 }
6910 /* ------------------------------------------------------------------
6911   Dissector Message Type Confusion
6912  */
6913 static gint
6914 dissect_isup_confusion_message(tvbuff_t *message_tvb, proto_tree *isup_tree)
6915 { proto_item* parameter_item;
6916   proto_tree* parameter_tree;
6917   tvbuff_t *parameter_tvb;
6918   gint offset = 0;
6919   gint parameter_type, parameter_pointer, parameter_length, actual_length;
6920
6921   /* Do stuff for mandatory variable parameter Cause indicators */
6922   parameter_type =  PARAM_TYPE_CAUSE_INDICATORS;
6923
6924   parameter_pointer = tvb_get_guint8(message_tvb, offset);
6925   parameter_length = tvb_get_guint8(message_tvb, offset + parameter_pointer);
6926
6927   parameter_item = proto_tree_add_text(isup_tree, message_tvb,
6928                                        offset +  parameter_pointer,
6929                                        parameter_length + PARAMETER_LENGTH_IND_LENGTH,
6930                                        "Cause indicators, see Q.850");
6931   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
6932   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type,
6933                              "Mandatory Parameter: %u (%s)",
6934                              parameter_type,
6935                              val_to_str_ext_const(parameter_type, &isup_parameter_type_value_ext, "unknown"));
6936   proto_tree_add_uint_format(parameter_tree, hf_isup_mandatory_variable_parameter_pointer, message_tvb, offset, PARAMETER_POINTER_LENGTH, parameter_pointer, "Pointer to Parameter: %u", parameter_pointer);
6937   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_length, message_tvb, offset + parameter_pointer, PARAMETER_LENGTH_IND_LENGTH, parameter_length, "Parameter length: %u", parameter_length);
6938   actual_length = tvb_ensure_length_remaining(message_tvb, offset);
6939   parameter_tvb = tvb_new_subset(message_tvb, offset + parameter_pointer + PARAMETER_LENGTH_IND_LENGTH, MIN(parameter_length, actual_length), parameter_length );
6940
6941   switch (isup_standard){
6942     case ITU_STANDARD:
6943       dissect_isup_cause_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
6944       break;
6945     case ANSI_STANDARD:
6946       dissect_ansi_isup_cause_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
6947       break;
6948   }
6949   offset += PARAMETER_POINTER_LENGTH;
6950
6951   return offset;
6952 }
6953 /* ------------------------------------------------------------------ */
6954 static void
6955 dissect_isup_message(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree *isup_tree)
6956 {
6957   isup_tap_rec_t *tap_rec;
6958
6959   tvbuff_t *parameter_tvb;
6960   tvbuff_t *optional_parameter_tvb;
6961   proto_item* pass_along_item;
6962   proto_tree* pass_along_tree;
6963   gint offset, bufferlength;
6964   guint8 message_type, opt_parameter_pointer;
6965   gint opt_part_possible = FALSE; /* default setting - for message types allowing optional
6966                                      params explicitely set to TRUE in case statement */
6967   tap_calling_number = NULL;
6968   offset = 0;
6969
6970   /* Extract message type field */
6971   message_type = tvb_get_guint8(message_tvb,0);
6972
6973   switch (isup_standard){
6974     case ITU_STANDARD:
6975       proto_tree_add_uint_format(isup_tree, hf_isup_message_type, message_tvb, 0, MESSAGE_TYPE_LENGTH, message_type,
6976                                  "Message type: %s (%u)",
6977                                  val_to_str_ext_const(message_type, &isup_message_type_value_ext, "reserved"),
6978                                  message_type);
6979       break;
6980     case ANSI_STANDARD:
6981       proto_tree_add_uint_format(isup_tree, hf_isup_message_type, message_tvb, 0, MESSAGE_TYPE_LENGTH, message_type, "Message type: %s (%u)",
6982                                  val_to_str_ext_const(message_type, &ansi_isup_message_type_value_ext, "reserved"), message_type);
6983       break;
6984   }
6985    offset +=  MESSAGE_TYPE_LENGTH;
6986
6987    tap_rec = (isup_tap_rec_t *)ep_alloc(sizeof(isup_tap_rec_t));
6988    tap_rec->message_type = message_type;
6989    tap_rec->calling_number = NULL;
6990    tap_rec->called_number = NULL;
6991
6992    parameter_tvb = tvb_new_subset_remaining(message_tvb, offset);
6993
6994    /* distinguish between message types:*/
6995    switch (isup_standard){
6996      case ITU_STANDARD:
6997        switch (message_type) {
6998          case MESSAGE_TYPE_INITIAL_ADDR:
6999            offset += dissect_isup_initial_address_message(parameter_tvb, isup_tree);
7000            opt_part_possible = TRUE;
7001            break;
7002          case MESSAGE_TYPE_SUBSEQ_ADDR:
7003            offset += dissect_isup_subsequent_address_message(parameter_tvb, isup_tree);
7004            opt_part_possible = TRUE;
7005            break;
7006          case MESSAGE_TYPE_INFO_REQ:
7007            offset += dissect_isup_information_request_message(parameter_tvb, isup_tree);
7008            opt_part_possible = TRUE;
7009            break;
7010          case MESSAGE_TYPE_INFO:
7011            offset += dissect_isup_information_message(parameter_tvb, isup_tree);
7012            opt_part_possible = TRUE;
7013            break;
7014          case MESSAGE_TYPE_CONTINUITY:
7015            offset += dissect_isup_continuity_message(parameter_tvb, isup_tree);
7016            break;
7017          case MESSAGE_TYPE_ADDR_CMPL:
7018            offset += dissect_isup_address_complete_message(parameter_tvb, isup_tree);
7019            opt_part_possible = TRUE;
7020            break;
7021          case MESSAGE_TYPE_CONNECT:
7022            offset += dissect_isup_connect_message(parameter_tvb, isup_tree);
7023            opt_part_possible = TRUE;
7024            break;
7025          case MESSAGE_TYPE_FORW_TRANS:
7026            /* no dissector necessary since no mandatory parameters included */
7027            opt_part_possible = TRUE;
7028            break;
7029          case MESSAGE_TYPE_ANSWER:
7030            /* no dissector necessary since no mandatory parameters included */
7031            opt_part_possible = TRUE;
7032            break;
7033          case MESSAGE_TYPE_RELEASE:
7034            offset += dissect_isup_release_message(parameter_tvb, isup_tree);
7035            opt_part_possible = TRUE;
7036            break;
7037          case MESSAGE_TYPE_SUSPEND:
7038            offset += dissect_isup_suspend_resume_message(parameter_tvb, isup_tree);
7039            opt_part_possible = TRUE;
7040            break;
7041          case MESSAGE_TYPE_RESUME:
7042            offset += dissect_isup_suspend_resume_message(parameter_tvb, isup_tree);
7043            opt_part_possible = TRUE;
7044            break;
7045          case MESSAGE_TYPE_REL_CMPL:
7046            /* no dissector necessary since no mandatory parameters included */
7047            opt_part_possible = TRUE;
7048            break;
7049          case MESSAGE_TYPE_CONT_CHECK_REQ:
7050            /* no dissector necessary since no mandatory parameters included */
7051            break;
7052          case MESSAGE_TYPE_RESET_CIRCUIT:
7053            /* no dissector necessary since no mandatory parameters included */
7054            break;
7055          case MESSAGE_TYPE_BLOCKING:
7056            /* no dissector necessary since no mandatory parameters included */
7057            break;
7058          case MESSAGE_TYPE_UNBLOCKING:
7059            /* no dissector necessary since no mandatory parameters included */
7060            break;
7061          case MESSAGE_TYPE_BLOCK_ACK:
7062            /* no dissector necessary since no mandatory parameters included */
7063            break;
7064          case MESSAGE_TYPE_UNBLOCK_ACK:
7065            /* no dissector necessary since no mandatory parameters included */
7066            break;
7067          case MESSAGE_TYPE_CIRC_GRP_RST:
7068            offset += dissect_isup_circuit_group_reset_query_message(parameter_tvb, isup_tree);
7069            break;
7070          case MESSAGE_TYPE_CIRC_GRP_BLCK:
7071            offset += dissect_isup_circuit_group_blocking_messages(parameter_tvb, isup_tree);
7072            break;
7073          case MESSAGE_TYPE_CIRC_GRP_UNBL:
7074            offset += dissect_isup_circuit_group_blocking_messages(parameter_tvb, isup_tree);
7075            break;
7076          case MESSAGE_TYPE_CIRC_GRP_BL_ACK:
7077            offset += dissect_isup_circuit_group_blocking_messages(parameter_tvb, isup_tree);
7078            break;
7079          case MESSAGE_TYPE_CIRC_GRP_UNBL_ACK:
7080            offset += dissect_isup_circuit_group_blocking_messages(parameter_tvb, isup_tree);
7081            break;
7082          case MESSAGE_TYPE_FACILITY_REQ:
7083            offset += dissect_isup_facility_request_accepted_message(parameter_tvb, isup_tree);
7084            opt_part_possible = TRUE;
7085            break;
7086          case MESSAGE_TYPE_FACILITY_ACC:
7087            offset += dissect_isup_facility_request_accepted_message(parameter_tvb, isup_tree);
7088            opt_part_possible = TRUE;
7089            break;
7090          case MESSAGE_TYPE_FACILITY_REJ:
7091            offset += dissect_isup_facility_reject_message(parameter_tvb, isup_tree);
7092            opt_part_possible = TRUE;
7093            break;
7094          case MESSAGE_TYPE_LOOP_BACK_ACK:
7095            /* no dissector necessary since no mandatory parameters included */
7096            break;
7097          case MESSAGE_TYPE_PASS_ALONG:
7098            /* call dissect_isup_message recursively */
7099          {
7100            guint8 pa_message_type;
7101            pa_message_type = tvb_get_guint8(parameter_tvb, 0);
7102            pass_along_item = proto_tree_add_text(isup_tree, parameter_tvb, offset, -1,
7103                                                  "Pass-along: %s Message (%u)",
7104                                                  val_to_str_ext_const(pa_message_type, &isup_message_type_value_acro_ext, "reserved"),
7105                                                  pa_message_type);
7106            pass_along_tree = proto_item_add_subtree(pass_along_item, ett_isup_pass_along_message);
7107            dissect_isup_message(parameter_tvb, pinfo, pass_along_tree);
7108            break;
7109          }
7110          case MESSAGE_TYPE_CIRC_GRP_RST_ACK:
7111            offset += dissect_isup_circuit_group_reset_acknowledgement_message(parameter_tvb, isup_tree);
7112            break;
7113          case MESSAGE_TYPE_CIRC_GRP_QRY:
7114            offset += dissect_isup_circuit_group_reset_query_message(parameter_tvb, isup_tree);
7115            break;
7116          case MESSAGE_TYPE_CIRC_GRP_QRY_RSP:
7117            offset += dissect_isup_circuit_group_query_response_message(parameter_tvb, isup_tree);
7118            break;
7119          case MESSAGE_TYPE_CALL_PROGRSS:
7120            offset += dissect_isup_call_progress_message(parameter_tvb, isup_tree);
7121            opt_part_possible = TRUE;
7122            break;
7123          case MESSAGE_TYPE_USER2USER_INFO:
7124            offset += dissect_isup_user_to_user_information_message(parameter_tvb, pinfo, isup_tree);
7125            opt_part_possible = TRUE;
7126            break;
7127          case MESSAGE_TYPE_UNEQUIPPED_CIC:
7128            /* no dissector necessary since no mandatory parameters included */
7129            break;
7130          case MESSAGE_TYPE_CONFUSION:
7131            offset += dissect_isup_confusion_message(parameter_tvb, isup_tree);
7132            opt_part_possible = TRUE;
7133            break;
7134          case MESSAGE_TYPE_OVERLOAD:
7135            /* no dissector necessary since no mandatory parameters included */
7136            break;
7137          case MESSAGE_TYPE_CHARGE_INFO:
7138            /* do nothing since format is a national matter */
7139            bufferlength = tvb_length_remaining(message_tvb, offset);
7140            if (bufferlength != 0)
7141              proto_tree_add_text(isup_tree, parameter_tvb, 0, bufferlength, "Format is a national matter");
7142            break;
7143          case MESSAGE_TYPE_NETW_RESRC_MGMT:
7144            /* no dissector necessary since no mandatory parameters included */
7145            opt_part_possible = TRUE;
7146            break;
7147          case MESSAGE_TYPE_FACILITY:
7148            /* no dissector necessary since no mandatory parameters included */
7149            opt_part_possible = TRUE;
7150            break;
7151          case MESSAGE_TYPE_USER_PART_TEST:
7152            /* no dissector necessary since no mandatory parameters included */
7153            opt_part_possible = TRUE;
7154            break;
7155          case MESSAGE_TYPE_USER_PART_AVAIL:
7156            /* no dissector necessary since no mandatory parameters included */
7157            opt_part_possible = TRUE;
7158            break;
7159          case MESSAGE_TYPE_IDENT_REQ:
7160            /* no dissector necessary since no mandatory parameters included */
7161            opt_part_possible = TRUE;
7162            break;
7163          case MESSAGE_TYPE_IDENT_RSP:
7164            /* no dissector necessary since no mandatory parameters included */
7165            opt_part_possible = TRUE;
7166            break;
7167          case MESSAGE_TYPE_SEGMENTATION:
7168            /* no dissector necessary since no mandatory parameters included */
7169            opt_part_possible = TRUE;
7170            break;
7171          case MESSAGE_TYPE_LOOP_PREVENTION:
7172            /* no dissector necessary since no mandatory parameters included */
7173            opt_part_possible = TRUE;
7174            break;
7175          case MESSAGE_TYPE_APPLICATION_TRANS:
7176            /* no dissector necessary since no mandatory parameters included */
7177            opt_part_possible = TRUE;
7178            break;
7179          case MESSAGE_TYPE_PRE_RELEASE_INFO:
7180            /* no dissector necessary since no mandatory parameters included */
7181            opt_part_possible = TRUE;
7182            break;
7183          case MESSAGE_TYPE_SUBSEQUENT_DIR_NUM:
7184            /* do nothing since format is a national matter */
7185            bufferlength = tvb_length_remaining(message_tvb, offset);
7186            if (bufferlength != 0)
7187              proto_tree_add_text(isup_tree, parameter_tvb, 0, bufferlength, "Format is a national matter");
7188            break;
7189          default:
7190            bufferlength = tvb_length_remaining(message_tvb, offset);
7191            if (bufferlength != 0)
7192              proto_tree_add_text(isup_tree, parameter_tvb, 0, bufferlength, "Unknown Message type (possibly reserved/used in former ISUP version)");
7193            break;
7194        }
7195        break;
7196      case ANSI_STANDARD:
7197        /* TODO if neccessary make new "dissect_ansi_isup_xxx() routines or add branches in the current ones.
7198         */
7199        switch (message_type) {
7200          case MESSAGE_TYPE_INITIAL_ADDR:
7201            offset += dissect_isup_initial_address_message(parameter_tvb, isup_tree);
7202            opt_part_possible = TRUE;
7203            break;
7204          case MESSAGE_TYPE_SUBSEQ_ADDR:
7205            offset += dissect_isup_subsequent_address_message(parameter_tvb, isup_tree);
7206            opt_part_possible = TRUE;
7207            break;
7208          case MESSAGE_TYPE_INFO_REQ:
7209            offset += dissect_isup_information_request_message(parameter_tvb, isup_tree);
7210            opt_part_possible = TRUE;
7211            break;
7212          case MESSAGE_TYPE_INFO:
7213            offset += dissect_isup_information_message(parameter_tvb, isup_tree);
7214            opt_part_possible = TRUE;
7215            break;
7216          case MESSAGE_TYPE_CONTINUITY:
7217            offset += dissect_isup_continuity_message(parameter_tvb, isup_tree);
7218            break;
7219          case MESSAGE_TYPE_ADDR_CMPL:
7220            offset += dissect_isup_address_complete_message(parameter_tvb, isup_tree);
7221            opt_part_possible = TRUE;
7222            break;
7223          case MESSAGE_TYPE_CONNECT:
7224            offset += dissect_isup_connect_message(parameter_tvb, isup_tree);
7225            opt_part_possible = TRUE;
7226            break;
7227          case MESSAGE_TYPE_FORW_TRANS:
7228            /* no dissector necessary since no mandatory parameters included */
7229            opt_part_possible = TRUE;
7230            break;
7231          case MESSAGE_TYPE_ANSWER:
7232            /* no dissector necessary since no mandatory parameters included */
7233            opt_part_possible = TRUE;
7234            break;
7235          case MESSAGE_TYPE_RELEASE:
7236            offset += dissect_isup_release_message(parameter_tvb, isup_tree);
7237            opt_part_possible = TRUE;
7238            break;
7239          case MESSAGE_TYPE_SUSPEND:
7240            offset += dissect_isup_suspend_resume_message(parameter_tvb, isup_tree);
7241            opt_part_possible = TRUE;
7242            break;
7243          case MESSAGE_TYPE_RESUME:
7244            offset += dissect_isup_suspend_resume_message(parameter_tvb, isup_tree);
7245            opt_part_possible = TRUE;
7246            break;
7247          case MESSAGE_TYPE_REL_CMPL:
7248            /* no dissector necessary since no mandatory parameters included */
7249            break;
7250          case MESSAGE_TYPE_CONT_CHECK_REQ:
7251            /* no dissector necessary since no mandatory parameters included */
7252            break;
7253          case MESSAGE_TYPE_RESET_CIRCUIT:
7254            /* no dissector necessary since no mandatory parameters included */
7255            break;
7256          case MESSAGE_TYPE_BLOCKING:
7257            /* no dissector necessary since no mandatory parameters included */
7258            break;
7259          case MESSAGE_TYPE_UNBLOCKING:
7260            /* no dissector necessary since no mandatory parameters included */
7261            break;
7262          case MESSAGE_TYPE_BLOCK_ACK:
7263            /* no dissector necessary since no mandatory parameters included */
7264            break;
7265          case MESSAGE_TYPE_UNBLOCK_ACK:
7266            /* no dissector necessary since no mandatory parameters included */
7267            break;
7268          case MESSAGE_TYPE_CIRC_GRP_RST:
7269            offset += dissect_isup_circuit_group_reset_query_message(parameter_tvb, isup_tree);
7270            break;
7271          case MESSAGE_TYPE_CIRC_GRP_BLCK:
7272            offset += dissect_isup_circuit_group_blocking_messages(parameter_tvb, isup_tree);
7273            break;
7274          case MESSAGE_TYPE_CIRC_GRP_UNBL:
7275            offset += dissect_isup_circuit_group_blocking_messages(parameter_tvb, isup_tree);
7276            break;
7277          case MESSAGE_TYPE_CIRC_GRP_BL_ACK:
7278            offset += dissect_isup_circuit_group_blocking_messages(parameter_tvb, isup_tree);
7279            break;
7280          case MESSAGE_TYPE_CIRC_GRP_UNBL_ACK:
7281            offset += dissect_isup_circuit_group_blocking_messages(parameter_tvb, isup_tree);
7282            break;
7283          case MESSAGE_TYPE_FACILITY_REQ:
7284            offset += dissect_isup_facility_request_accepted_message(parameter_tvb, isup_tree);
7285            opt_part_possible = TRUE;
7286            break;
7287          case MESSAGE_TYPE_FACILITY_ACC:
7288            offset += dissect_isup_facility_request_accepted_message(parameter_tvb, isup_tree);
7289            opt_part_possible = TRUE;
7290            break;
7291          case MESSAGE_TYPE_FACILITY_REJ:
7292            offset += dissect_isup_facility_reject_message(parameter_tvb, isup_tree);
7293            opt_part_possible = TRUE;
7294            break;
7295          case MESSAGE_TYPE_LOOP_BACK_ACK:
7296            /* no dissector necessary since no mandatory parameters included */
7297            break;
7298          case MESSAGE_TYPE_PASS_ALONG:
7299            /* call dissect_isup_message recursively */
7300          {
7301            guint8 pa_message_type;
7302            pa_message_type = tvb_get_guint8(parameter_tvb, 0);
7303            pass_along_item = proto_tree_add_text(isup_tree, parameter_tvb, offset, -1,
7304                                                  "Pass-along: %s Message (%u)",
7305                                                  val_to_str_ext_const(pa_message_type, &isup_message_type_value_acro_ext, "reserved"),
7306                                                  pa_message_type);
7307            pass_along_tree = proto_item_add_subtree(pass_along_item, ett_isup_pass_along_message);
7308            dissect_isup_message(parameter_tvb, pinfo, pass_along_tree);
7309            break;
7310          }
7311          case MESSAGE_TYPE_CIRC_GRP_RST_ACK:
7312            offset += dissect_isup_circuit_group_reset_acknowledgement_message(parameter_tvb, isup_tree);
7313            break;
7314          case MESSAGE_TYPE_CIRC_GRP_QRY:
7315            offset += dissect_isup_circuit_group_reset_query_message(parameter_tvb, isup_tree);
7316            break;
7317          case MESSAGE_TYPE_CIRC_GRP_QRY_RSP:
7318            offset += dissect_isup_circuit_group_query_response_message(parameter_tvb, isup_tree);
7319            break;
7320          case MESSAGE_TYPE_CALL_PROGRSS:
7321            offset += dissect_isup_call_progress_message(parameter_tvb, isup_tree);
7322            opt_part_possible = TRUE;
7323            break;
7324          case MESSAGE_TYPE_USER2USER_INFO:
7325            offset += dissect_isup_user_to_user_information_message(parameter_tvb, pinfo, isup_tree);
7326            opt_part_possible = TRUE;
7327            break;
7328          case MESSAGE_TYPE_UNEQUIPPED_CIC:
7329            /* no dissector necessary since no mandatory parameters included */
7330            break;
7331          case MESSAGE_TYPE_CONFUSION:
7332            offset += dissect_isup_confusion_message(parameter_tvb, isup_tree);
7333            opt_part_possible = TRUE;
7334            break;
7335          case MESSAGE_TYPE_OVERLOAD:
7336            /* no dissector necessary since no mandatory parameters included */
7337            break;
7338          case MESSAGE_TYPE_CHARGE_INFO:
7339            /* do nothing since format is a national matter */
7340            bufferlength = tvb_length_remaining(message_tvb, offset);
7341            if (bufferlength != 0)
7342              proto_tree_add_text(isup_tree, parameter_tvb, 0, bufferlength, "Format is a national matter");
7343            break;
7344          case MESSAGE_TYPE_NETW_RESRC_MGMT:
7345            /* no dissector necessary since no mandatory parameters included */
7346            opt_part_possible = TRUE;
7347            break;
7348          case MESSAGE_TYPE_FACILITY:
7349            /* no dissector necessary since no mandatory parameters included */
7350            opt_part_possible = TRUE;
7351            break;
7352          case MESSAGE_TYPE_USER_PART_TEST:
7353            /* no dissector necessary since no mandatory parameters included */
7354            opt_part_possible = TRUE;
7355            break;
7356          case MESSAGE_TYPE_USER_PART_AVAIL:
7357            /* no dissector necessary since no mandatory parameters included */
7358            opt_part_possible = TRUE;
7359            break;
7360          case MESSAGE_TYPE_IDENT_REQ:
7361            /* no dissector necessary since no mandatory parameters included */
7362            opt_part_possible = TRUE;
7363            break;
7364          case MESSAGE_TYPE_IDENT_RSP:
7365            /* no dissector necessary since no mandatory parameters included */
7366            opt_part_possible = TRUE;
7367            break;
7368          case MESSAGE_TYPE_SEGMENTATION:
7369            /* no dissector necessary since no mandatory parameters included */
7370            opt_part_possible = TRUE;
7371            break;
7372          case MESSAGE_TYPE_LOOP_PREVENTION:
7373            /* no dissector necessary since no mandatory parameters included */
7374            opt_part_possible = TRUE;
7375            break;
7376          case MESSAGE_TYPE_APPLICATION_TRANS:
7377            /* no dissector necessary since no mandatory parameters included */
7378            opt_part_possible = TRUE;
7379            break;
7380          case MESSAGE_TYPE_PRE_RELEASE_INFO:
7381            /* no dissector necessary since no mandatory parameters included */
7382            opt_part_possible = TRUE;
7383            break;
7384          case MESSAGE_TYPE_SUBSEQUENT_DIR_NUM:
7385            /* do nothing since format is a national matter */
7386            bufferlength = tvb_length_remaining(message_tvb, offset);
7387            if (bufferlength != 0)
7388              proto_tree_add_text(isup_tree, parameter_tvb, 0, bufferlength, "Format is a national matter");
7389            break;
7390          case ANSI_ISUP_MESSAGE_TYPE_CIRCUIT_RES_ACK:
7391            /* no dissector necessary since no mandatory parameters included */
7392            break;
7393          case ANSI_ISUP_MESSAGE_TYPE_CIRCUIT_RES:
7394            offset += dissect_ansi_isup_circuit_reservation_message( parameter_tvb, isup_tree );
7395            break;
7396          case ANSI_ISUP_MESSAGE_TYPE_CCT_VAL_TEST_RSP:
7397            opt_part_possible = TRUE;
7398            offset += dissect_ansi_isup_circuit_validation_test_resp_message( parameter_tvb, isup_tree );
7399            break;
7400          case ANSI_ISUP_MESSAGE_TYPE_CCT_VAL_TEST:
7401            /* no dissector necessary since no mandatory parameters included */
7402            break;
7403          default:
7404            bufferlength = tvb_length_remaining(message_tvb, offset);
7405            if (bufferlength != 0)
7406              proto_tree_add_text(isup_tree, parameter_tvb, 0, bufferlength, "Unknown Message type (possibly reserved/used in former ISUP version)");
7407            break;
7408        }
7409        break;
7410    }
7411
7412    /* extract pointer to start of optional part (if any) */
7413    if (opt_part_possible == TRUE){
7414      opt_parameter_pointer = tvb_get_guint8(message_tvb, offset);
7415      if (opt_parameter_pointer > 0){
7416        proto_tree_add_uint_format(isup_tree, hf_isup_pointer_to_start_of_optional_part, message_tvb, offset, PARAMETER_POINTER_LENGTH, opt_parameter_pointer, "Pointer to start of optional part: %u", opt_parameter_pointer);
7417        offset += opt_parameter_pointer;
7418        optional_parameter_tvb = tvb_new_subset_remaining(message_tvb, offset);
7419        switch(isup_standard){
7420          case ITU_STANDARD:
7421            dissect_isup_optional_parameter(optional_parameter_tvb, pinfo, isup_tree);
7422            break;
7423          case ANSI_STANDARD:
7424            dissect_ansi_isup_optional_parameter(optional_parameter_tvb, pinfo, isup_tree);
7425            break;
7426        }
7427      }
7428      else
7429        proto_tree_add_uint_format(isup_tree, hf_isup_pointer_to_start_of_optional_part, message_tvb, offset, PARAMETER_POINTER_LENGTH, opt_parameter_pointer, "No optional parameter present (Pointer: %u)", opt_parameter_pointer);
7430    }
7431    else if (message_type !=MESSAGE_TYPE_CHARGE_INFO)
7432      proto_tree_add_text(isup_tree, message_tvb, 0, 0, "No optional parameters are possible with this message type");
7433    /* if there are calling/called number, we'll get them for the tap */
7434
7435    tap_rec->calling_number=tap_calling_number?tap_calling_number:ep_strdup("");
7436    tap_rec->called_number=tap_called_number;
7437    tap_rec->cause_value=tap_cause_value;
7438    tap_queue_packet(isup_tap, pinfo, tap_rec);
7439 }
7440
7441 /* ------------------------------------------------------------------ */
7442 static void
7443 dissect_isup(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
7444 {
7445
7446 /* Set up structures needed to add the protocol subtree and manage it */
7447   proto_item *ti;
7448   proto_tree *isup_tree = NULL;
7449   tvbuff_t *message_tvb;
7450   guint16 cic;
7451   guint8 message_type;
7452
7453   switch(mtp3_standard){
7454     case ANSI_STANDARD:
7455       isup_standard = ANSI_STANDARD;
7456       break;
7457     default:
7458       isup_standard = ITU_STANDARD;
7459   }
7460
7461 /* Make entries in Protocol column and Info column on summary display */
7462   switch (isup_standard){
7463     case ITU_STANDARD:
7464       col_set_str(pinfo->cinfo, COL_PROTOCOL, "ISUP(ITU)");
7465       break;
7466     case ANSI_STANDARD:
7467       col_set_str(pinfo->cinfo, COL_PROTOCOL, "ISUP(ANSI)");
7468       break;
7469   }
7470
7471 /* Extract message type field */
7472   message_type = tvb_get_guint8(tvb, CIC_OFFSET + CIC_LENGTH);
7473   /* dissect CIC in main dissector since pass-along message type carrying complete IUSP message w/o CIC needs
7474      recursive message dissector call */
7475   if (mtp3_standard == ANSI_STANDARD)
7476     cic = tvb_get_letohs(tvb, CIC_OFFSET) & 0x3FFF; /*since upper 2 bits spare */
7477   else /* ITU, China, and Japan; yes, J7's CICs are a different size */
7478     cic = tvb_get_letohs(tvb, CIC_OFFSET) & 0x0FFF; /*since upper 4 bits spare */
7479
7480   pinfo->ctype = CT_ISUP;
7481   pinfo->circuit_id = cic;
7482
7483   if (isup_show_cic_in_info){
7484     switch (isup_standard){
7485       case ITU_STANDARD:
7486         col_add_fstr(pinfo->cinfo, COL_INFO,
7487                      "%s (CIC %u) ",
7488                      val_to_str_ext_const(message_type, &isup_message_type_value_acro_ext, "reserved"),
7489                      cic);
7490         break;
7491       case ANSI_STANDARD:
7492         col_add_fstr(pinfo->cinfo, COL_INFO,
7493                      "%s (CIC %u) ",
7494                      val_to_str_ext_const(message_type, &ansi_isup_message_type_value_acro_ext, "reserved"),
7495                      cic);
7496         break;
7497     }
7498   }else{
7499     switch (isup_standard){
7500       case ITU_STANDARD:
7501         col_add_fstr(pinfo->cinfo, COL_INFO, "%s ", val_to_str_ext_const(message_type, &isup_message_type_value_acro_ext, "reserved"));
7502         break;
7503       case ANSI_STANDARD:
7504         col_add_fstr(pinfo->cinfo, COL_INFO, "%s ", val_to_str_ext_const(message_type, &ansi_isup_message_type_value_acro_ext, "reserved"));
7505         break;
7506     }
7507   }
7508
7509   /* In the interest of speed, if "tree" is NULL, don't do any work not
7510    * necessary to generate protocol tree items.
7511    */
7512   if (tree) {
7513     ti = proto_tree_add_item(tree, proto_isup, tvb, 0, -1, ENC_NA);
7514     isup_tree = proto_item_add_subtree(ti, ett_isup);
7515
7516
7517     proto_tree_add_uint_format(isup_tree, hf_isup_cic, tvb, CIC_OFFSET, CIC_LENGTH, cic, "CIC: %u", cic);
7518   }
7519
7520   message_tvb = tvb_new_subset_remaining(tvb, CIC_LENGTH);
7521   dissect_isup_message(message_tvb, pinfo, isup_tree);
7522 }
7523
7524 /* ------------------------------------------------------------------ */
7525 static void
7526 dissect_bicc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
7527 {
7528
7529 /* Set up structures needed to add the protocol subtree and manage it */
7530   proto_item *ti;
7531   proto_tree *bicc_tree = NULL;
7532   tvbuff_t *message_tvb;
7533   guint32 bicc_cic;
7534   guint8 message_type;
7535
7536   /*circuit_t *circuit;*/
7537
7538 /* Make entries in Protocol column and Info column on summary display */
7539   col_set_str(pinfo->cinfo, COL_PROTOCOL, "BICC");
7540
7541 /* Extract message type field */
7542   message_type = tvb_get_guint8(tvb, BICC_CIC_OFFSET + BICC_CIC_LENGTH);
7543
7544   bicc_cic = tvb_get_letohl(tvb, BICC_CIC_OFFSET);
7545
7546   pinfo->ctype = CT_BICC;
7547   pinfo->circuit_id = bicc_cic;
7548
7549   col_clear(pinfo->cinfo, COL_INFO);
7550   if (isup_show_cic_in_info) {
7551     col_append_sep_fstr(pinfo->cinfo, COL_INFO, ", ",
7552                  "%s (CIC %u)",
7553                  val_to_str_ext_const(message_type, &isup_message_type_value_acro_ext, "reserved"),
7554                  bicc_cic);
7555   } else {
7556     col_append_sep_fstr(pinfo->cinfo, COL_INFO, ", ",
7557                  "%s",
7558                  val_to_str_ext_const(message_type, &isup_message_type_value_acro_ext, "reserved"));
7559   }
7560   /* dissect CIC in main dissector since pass-along message type carrying complete BICC/ISUP message w/o CIC needs
7561    * recursive message dissector call
7562    */
7563   /* In the interest of speed, if "tree" is NULL, don't do any work not
7564    * necessary to generate protocol tree items.
7565    */
7566   if (tree) {
7567     ti = proto_tree_add_item(tree, proto_bicc, tvb, 0, -1, ENC_NA);
7568     bicc_tree = proto_item_add_subtree(ti, ett_bicc);
7569
7570
7571     proto_tree_add_uint_format(bicc_tree, hf_bicc_cic, tvb, BICC_CIC_OFFSET, BICC_CIC_LENGTH, bicc_cic, "CIC: %u", bicc_cic);
7572   }
7573
7574   message_tvb = tvb_new_subset_remaining(tvb, BICC_CIC_LENGTH);
7575   dissect_isup_message(message_tvb, pinfo, bicc_tree);
7576   col_set_fence(pinfo->cinfo, COL_INFO);
7577 }
7578
7579 static void
7580 dissect_application_isup(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
7581 {
7582 /* Set up structures needed to add the protocol subtree and manage it */
7583   proto_item *ti;
7584   proto_tree *isup_tree = NULL;
7585   tvbuff_t *message_tvb;
7586   guint8 message_type;
7587
7588 /* Make entries in Protocol column and Info column on summary display */
7589   col_append_str(pinfo->cinfo, COL_PROTOCOL, "/ISUP(ITU)");
7590
7591 /* Extract message type field */
7592   message_type = tvb_get_guint8(tvb, 0);
7593   /* application/ISUP has no  CIC  */
7594   col_append_sep_fstr(pinfo->cinfo, COL_INFO, ", ",
7595                       "ISUP:%s",
7596                       val_to_str_ext_const(message_type, &isup_message_type_value_acro_ext, "reserved"));
7597
7598 /* In the interest of speed, if "tree" is NULL, don't do any work not
7599    necessary to generate protocol tree items. */
7600   if (tree) {
7601     ti = proto_tree_add_item(tree, proto_isup, tvb, 0, -1, ENC_NA);
7602     isup_tree = proto_item_add_subtree(ti, ett_isup);
7603   }
7604
7605   message_tvb = tvb_new_subset_remaining(tvb, 0);
7606   dissect_isup_message(message_tvb, pinfo, isup_tree);
7607 }
7608 /* ---------------------------------------------------- stats tree
7609 */
7610 static int st_node_msg = -1;
7611 static int st_node_dir = -1;
7612
7613 static void
7614 msg_stats_tree_init(stats_tree* st)
7615 {
7616   st_node_msg = stats_tree_create_node(st, "Messages by Type", 0, TRUE);
7617   st_node_dir = stats_tree_create_node(st, "Messages by Direction", 0, TRUE);
7618 }
7619
7620 static int
7621 msg_stats_tree_packet(stats_tree *st, packet_info *pinfo, epan_dissect_t *edt _U_, const void *p )
7622 {
7623   const gchar *msg = match_strval_ext(((const isup_tap_rec_t*)p)->message_type, &isup_message_type_value_acro_ext);
7624   gchar *dir;
7625   int msg_node;
7626   int dir_node;
7627
7628   dir = ep_strdup_printf("%s->%s", ep_address_to_str(&pinfo->src), ep_address_to_str(&pinfo->dst));
7629
7630   msg_node = tick_stat_node(st, msg, st_node_msg, TRUE);
7631   tick_stat_node(st, dir, msg_node, FALSE);
7632
7633   dir_node = tick_stat_node(st, dir, st_node_dir, TRUE);
7634   tick_stat_node(st, msg, dir_node, FALSE);
7635
7636   return 1;
7637 }
7638
7639 /*---------------------------------------------------------------------*/
7640 /* Register the protocol with Wireshark */
7641 void
7642 proto_register_isup(void)
7643 {
7644 /* Setup list of header fields  See Section 1.6.1 for details*/
7645   static hf_register_info hf[] = {
7646     { &hf_isup_cic,
7647       { "CIC",           "isup.cic",
7648         FT_UINT16, BASE_HEX, NULL, 0x0,
7649         NULL, HFILL }},
7650
7651     { &hf_isup_message_type,
7652       { "Message Type",  "isup.message_type",
7653         FT_UINT8, BASE_DEC, NULL, 0x0,
7654         NULL, HFILL }},
7655
7656     { &hf_isup_parameter_type,
7657       { "Parameter Type",  "isup.parameter_type",
7658         FT_UINT8, BASE_DEC, NULL, 0x0,
7659         NULL, HFILL }},
7660
7661     { &hf_isup_parameter_length,
7662       { "Parameter Length",  "isup.parameter_length",
7663         FT_UINT8, BASE_DEC, NULL, 0x0,
7664         NULL, HFILL }},
7665
7666     { &hf_isup_mandatory_variable_parameter_pointer,
7667       { "Pointer to Parameter",  "isup.mandatory_variable_parameter_pointer",
7668         FT_UINT8, BASE_DEC, NULL, 0x0,
7669         NULL, HFILL }},
7670
7671     { &hf_isup_pointer_to_start_of_optional_part,
7672       { "Pointer to optional parameter part",  "isup.optional_parameter_part_pointer",
7673         FT_UINT8, BASE_DEC, NULL, 0x0,
7674         NULL, HFILL }},
7675
7676     { &hf_isup_satellite_indicator,
7677       { "Satellite Indicator",  "isup.satellite_indicator",
7678         FT_UINT8, BASE_HEX, VALS(isup_satellite_ind_value), BA_8BIT_MASK,
7679         NULL, HFILL }},
7680
7681     { &hf_isup_continuity_check_indicator,
7682       { "Continuity Check Indicator",  "isup.continuity_check_indicator",
7683         FT_UINT8, BASE_HEX, VALS(isup_continuity_check_ind_value), DC_8BIT_MASK,
7684         NULL, HFILL }},
7685
7686     { &hf_isup_echo_control_device_indicator,
7687       { "Echo Control Device Indicator",  "isup.echo_control_device_indicator",
7688         FT_BOOLEAN, 8, TFS(&isup_echo_control_device_ind_value),E_8BIT_MASK,
7689         NULL, HFILL }},
7690
7691     { &hf_isup_forw_call_natnl_inatnl_call_indicator,
7692       { "National/international call indicator",  "isup.forw_call_natnl_inatnl_call_indicator",
7693         FT_BOOLEAN, 16, TFS(&isup_natnl_inatnl_call_ind_value),A_16BIT_MASK,
7694         NULL, HFILL }},
7695
7696     { &hf_isup_forw_call_end_to_end_method_indicator,
7697       { "End-to-end method indicator",  "isup.forw_call_end_to_end_method_indicator",
7698         FT_UINT16, BASE_HEX, VALS(isup_end_to_end_method_ind_value), CB_16BIT_MASK,
7699         NULL, HFILL }},
7700
7701     { &hf_isup_forw_call_interworking_indicator,
7702       { "Interworking indicator",  "isup.forw_call_interworking_indicator",
7703         FT_BOOLEAN, 16, TFS(&isup_interworking_ind_value), D_16BIT_MASK,
7704         NULL, HFILL }},
7705
7706     { &hf_isup_forw_call_end_to_end_info_indicator,
7707       { "End-to-end information indicator",  "isup.forw_call_end_to_end_information_indicator",
7708         FT_BOOLEAN, 16, TFS(&isup_end_to_end_info_ind_value), E_16BIT_MASK,
7709         NULL, HFILL }},
7710
7711     { &hf_isup_forw_call_isdn_user_part_indicator,
7712       { "ISDN user part indicator",  "isup.forw_call_isdn_user_part_indicator",
7713         FT_BOOLEAN, 16, TFS(&isup_ISDN_user_part_ind_value), F_16BIT_MASK,
7714         NULL, HFILL }},
7715
7716     { &hf_isup_forw_call_preferences_indicator,
7717       { "ISDN user part preference indicator",  "isup.forw_call_preferences_indicator",
7718         FT_UINT16, BASE_HEX, VALS(isup_preferences_ind_value), HG_16BIT_MASK,
7719         NULL, HFILL }},
7720
7721     { &hf_isup_forw_call_isdn_access_indicator,
7722       { "ISDN access indicator",  "isup.forw_call_isdn_access_indicator",
7723         FT_BOOLEAN, 16, TFS(&isup_ISDN_originating_access_ind_value), I_16BIT_MASK,
7724         NULL, HFILL }},
7725
7726     { &hf_isup_forw_call_sccp_method_indicator,
7727       { "SCCP method indicator",  "isup.forw_call_sccp_method_indicator",
7728         FT_UINT16, BASE_HEX, VALS(isup_SCCP_method_ind_value), KJ_16BIT_MASK,
7729         NULL, HFILL }},
7730
7731     { &hf_isup_forw_call_ported_num_trans_indicator,
7732       { "Ported number translation indicator",  "isup.forw_call_ported_num_trans_indicator",
7733         FT_BOOLEAN, 16, TFS(&isup_ISDN_ported_num_trans_ind_value), M_16BIT_MASK,
7734         NULL, HFILL }},
7735
7736     { &hf_isup_forw_call_qor_attempt_indicator,
7737       { "Query on Release attempt indicator",  "isup.forw_call_isdn_access_indicator",
7738         FT_BOOLEAN, 16, TFS(&isup_ISDN_qor_attempt_ind_value), N_16BIT_MASK,
7739         NULL, HFILL }},
7740
7741     { &hf_isup_calling_partys_category,
7742       { "Calling Party's category",  "isup.calling_partys_category",
7743         FT_UINT8, BASE_HEX|BASE_EXT_STRING, &isup_calling_partys_category_value_ext, 0x0,
7744         NULL, HFILL }},
7745
7746     { &hf_isup_transmission_medium_requirement,
7747       { "Transmission medium requirement",  "isup.transmission_medium_requirement",
7748         FT_UINT8, BASE_DEC|BASE_EXT_STRING, &isup_transmission_medium_requirement_value_ext, 0x0,
7749         NULL, HFILL }},
7750
7751     { &hf_isup_odd_even_indicator,
7752       { "Odd/even indicator",  "isup.isdn_odd_even_indicator",
7753         FT_BOOLEAN, 8, TFS(&isup_odd_even_ind_value), ISUP_ODD_EVEN_MASK,
7754         NULL, HFILL }},
7755
7756     { &hf_isup_generic_name_presentation,
7757       { "Presentation indicator",  "isup.isdn_generic_name_presentation",
7758         FT_UINT8, BASE_DEC, VALS(isup_generic_name_presentation_value), BA_8BIT_MASK,
7759         NULL, HFILL }},
7760
7761     { &hf_isup_generic_name_availability,
7762       { "Availability indicator",  "isup.isdn_generic_name_availability",
7763         FT_BOOLEAN, 8, TFS(&isup_generic_name_availability_value), E_8BIT_MASK,
7764         NULL, HFILL }},
7765
7766     { &hf_isup_generic_name_type,
7767       { "Type indicator",  "isup.isdn_generic_name_type",
7768         FT_UINT8, BASE_DEC, VALS(isup_generic_name_type_value), HGF_8BIT_MASK,
7769         NULL, HFILL }},
7770
7771     { &hf_isup_generic_name_ia5,
7772       { "Generic Name",  "isup.isdn_generic_name_ia5",
7773         FT_STRING, BASE_NONE, NULL, 0x0,
7774         NULL, HFILL }},
7775
7776     { &hf_isup_called_party_nature_of_address_indicator,
7777       { "Nature of address indicator",  "isup.called_party_nature_of_address_indicator",
7778         FT_UINT8, BASE_DEC, VALS(isup_called_party_nature_of_address_ind_value), ISUP_NATURE_OF_ADDRESS_IND_MASK,
7779         NULL, HFILL }},
7780
7781     { &hf_isup_calling_party_nature_of_address_indicator,
7782       { "Nature of address indicator",  "isup.calling_party_nature_of_address_indicator",
7783         FT_UINT8, BASE_DEC, VALS(isup_calling_party_nature_of_address_ind_value), ISUP_NATURE_OF_ADDRESS_IND_MASK,
7784         NULL, HFILL }},
7785
7786     { &hf_isup_charge_number_nature_of_address_indicator,
7787       { "Nature of address indicator",  "isup.charge_number_nature_of_address_indicator",
7788         FT_UINT8, BASE_DEC, VALS(isup_charge_number_nature_of_address_ind_value), ISUP_NATURE_OF_ADDRESS_IND_MASK,
7789         NULL, HFILL }},
7790
7791     { &hf_isup_inn_indicator,
7792       { "INN indicator",  "isup.inn_indicator",
7793         FT_BOOLEAN, 8, TFS(&isup_INN_ind_value), ISUP_INN_MASK,
7794         NULL, HFILL }},
7795
7796     { &hf_isup_ni_indicator,
7797       { "NI indicator",  "isup.ni_indicator",
7798         FT_BOOLEAN, 8, TFS(&isup_NI_ind_value), ISUP_NI_MASK,
7799         NULL, HFILL }},
7800
7801     { &hf_isup_numbering_plan_indicator,
7802       { "Numbering plan indicator",  "isup.numbering_plan_indicator",
7803         FT_UINT8, BASE_DEC, VALS(isup_numbering_plan_ind_value), ISUP_NUMBERING_PLAN_IND_MASK,
7804         NULL, HFILL }},
7805
7806     { &hf_isup_address_presentation_restricted_indicator,
7807       { "Address presentation restricted indicator",  "isup.address_presentation_restricted_indicator",
7808         FT_UINT8, BASE_DEC, VALS(isup_address_presentation_restricted_ind_value), ISUP_ADDRESS_PRESENTATION_RESTR_IND_MASK,
7809         NULL, HFILL }},
7810
7811     { &hf_isup_screening_indicator,
7812       { "Screening indicator",  "isup.screening_indicator",
7813         FT_UINT8, BASE_DEC, VALS(isup_screening_ind_value), ISUP_SCREENING_IND_MASK,
7814         NULL, HFILL }},
7815
7816     { &hf_isup_screening_indicator_enhanced,
7817       { "Screening indicator",  "isup.screening_indicator_enhanced",
7818         FT_UINT8, BASE_DEC, VALS(isup_screening_ind_enhanced_value), ISUP_SCREENING_IND_MASK,
7819         NULL, HFILL }},
7820
7821     { &hf_isup_called_party_odd_address_signal_digit,
7822       { "Address signal digit",  "isup.called_party_odd_address_signal_digit",
7823         FT_UINT8, BASE_DEC, VALS(isup_called_party_address_digit_value), ISUP_ODD_ADDRESS_SIGNAL_DIGIT_MASK,
7824         NULL, HFILL }},
7825
7826     { &hf_isup_calling_party_odd_address_signal_digit,
7827       { "Address signal digit",  "isup.calling_party_odd_address_signal_digit",
7828         FT_UINT8, BASE_DEC, VALS(isup_calling_party_address_digit_value), ISUP_ODD_ADDRESS_SIGNAL_DIGIT_MASK,
7829         NULL, HFILL }},
7830
7831     { &hf_isup_called_party_even_address_signal_digit,
7832       { "Address signal digit",  "isup.called_party_even_address_signal_digit",
7833         FT_UINT8, BASE_DEC, VALS(isup_called_party_address_digit_value), ISUP_EVEN_ADDRESS_SIGNAL_DIGIT_MASK,
7834         NULL, HFILL }},
7835
7836     { &hf_isup_calling_party_even_address_signal_digit,
7837       { "Address signal digit",  "isup.calling_party_even_address_signal_digit",
7838         FT_UINT8, BASE_DEC, VALS(isup_calling_party_address_digit_value), ISUP_EVEN_ADDRESS_SIGNAL_DIGIT_MASK,
7839         NULL, HFILL }},
7840
7841     { &hf_isup_calling_party_address_request_indicator,
7842       { "Calling party address request indicator",  "isup.calling_party_address_request_indicator",
7843         FT_BOOLEAN, 16, TFS(&isup_calling_party_address_request_ind_value), A_16BIT_MASK,
7844         NULL, HFILL }},
7845
7846     { &hf_isup_info_req_holding_indicator,
7847       { "Holding indicator",  "isup.info_req_holding_indicator",
7848         FT_BOOLEAN, 16, TFS(&isup_holding_ind_value), B_16BIT_MASK,
7849         NULL, HFILL }},
7850
7851     { &hf_isup_calling_partys_category_request_indicator,
7852       { "Calling party's category request indicator",  "isup.calling_partys_category_request_indicator",
7853         FT_BOOLEAN, 16, TFS(&isup_calling_partys_category_request_ind_value), D_16BIT_MASK,
7854         NULL, HFILL }},
7855
7856     { &hf_isup_charge_information_request_indicator,
7857       { "Charge information request indicator",  "isup.charge_information_request_indicator",
7858         FT_BOOLEAN, 16, TFS(&isup_charge_information_request_ind_value), E_16BIT_MASK,
7859         NULL, HFILL }},
7860
7861     { &hf_isup_malicious_call_identification_request_indicator,
7862       { "Malicious call identification request indicator (ISUP'88)",  "isup.malicious_call_ident_request_indicator",
7863         FT_BOOLEAN, 16, TFS(&isup_malicious_call_identification_request_ind_value), H_16BIT_MASK,
7864         NULL, HFILL }},
7865
7866     { &hf_isup_calling_party_address_response_indicator,
7867       { "Calling party address response indicator",  "isup.calling_party_address_response_indicator",
7868         FT_UINT16, BASE_HEX, VALS(isup_calling_party_address_response_ind_value), BA_16BIT_MASK,
7869         NULL, HFILL }},
7870
7871     { &hf_isup_OECD_inf_ind,
7872       { "OECD information indicator",  "isup.OECD_inf_ind_vals",
7873         FT_UINT8, BASE_HEX, VALS(OECD_inf_ind_vals), BA_8BIT_MASK,
7874         NULL, HFILL }},
7875
7876     { &hf_isup_IECD_inf_ind,
7877       { "IECD information indicator",  "isup.IECD_inf_ind_vals",
7878         FT_UINT8, BASE_HEX, VALS(IECD_inf_ind_vals), DC_8BIT_MASK,
7879         NULL, HFILL }},
7880
7881     { &hf_isup_OECD_req_ind,
7882       { "OECD request indicator",  "isup.OECD_req_ind_vals",
7883         FT_UINT8, BASE_HEX, VALS(OECD_req_ind_vals), FE_8BIT_MASK,
7884         NULL, HFILL }},
7885
7886     { &hf_isup_IECD_req_ind,
7887       { "IECD request indicator",  "isup.IECD_req_ind_vals",
7888         FT_UINT8, BASE_HEX, VALS(IECD_req_ind_vals), HG_8BIT_MASK,
7889         NULL, HFILL }},
7890
7891     { &hf_isup_hold_provided_indicator,
7892       { "Hold provided indicator",  "isup.hold_provided_indicator",
7893         FT_BOOLEAN, 16, TFS(&isup_hold_provided_ind_value), C_16BIT_MASK,
7894         NULL, HFILL }},
7895
7896     { &hf_isup_calling_partys_category_response_indicator,
7897       { "Calling party's category response indicator",  "isup.calling_partys_category_response_indicator",
7898         FT_BOOLEAN, 16, TFS(&isup_calling_partys_category_response_ind_value), F_16BIT_MASK,
7899         NULL, HFILL }},
7900
7901     { &hf_isup_charge_information_response_indicator,
7902       { "Charge information response indicator",  "isup.charge_information_response_indicator",
7903         FT_BOOLEAN, 16, TFS(&isup_charge_information_response_ind_value), G_16BIT_MASK,
7904         NULL, HFILL }},
7905
7906     { &hf_isup_solicited_indicator,
7907       { "Solicited indicator",  "isup.solicided_indicator",
7908         FT_BOOLEAN, 16, TFS(&isup_solicited_information_ind_value), H_16BIT_MASK,
7909         NULL, HFILL }},
7910
7911     { &hf_isup_continuity_indicator,
7912       { "Continuity indicator",  "isup.continuity_indicator",
7913         FT_BOOLEAN, 8, TFS(&isup_continuity_ind_value), A_8BIT_MASK,
7914         NULL, HFILL }},
7915
7916     { &hf_isup_backw_call_charge_ind,
7917       { "Charge indicator",  "isup.charge_indicator",
7918         FT_UINT16, BASE_HEX, VALS(isup_charge_ind_value), BA_16BIT_MASK,
7919         NULL, HFILL }},
7920
7921     { &hf_isup_backw_call_called_partys_status_ind,
7922       { "Called party's status indicator",  "isup.called_partys_status_indicator",
7923         FT_UINT16, BASE_HEX, VALS(isup_called_partys_status_ind_value), DC_16BIT_MASK,
7924         NULL, HFILL }},
7925
7926     { &hf_isup_backw_call_called_partys_category_ind,
7927       { "Called party's category indicator",  "isup.called_partys_category_indicator",
7928         FT_UINT16, BASE_HEX, VALS(isup_called_partys_category_ind_value), FE_16BIT_MASK,
7929         NULL, HFILL }},
7930
7931     { &hf_isup_backw_call_end_to_end_method_ind,
7932       { "End-to-end method indicator",  "isup.backw_call_end_to_end_method_indicator",
7933         FT_UINT16, BASE_HEX, VALS(isup_end_to_end_method_ind_value), HG_16BIT_MASK,
7934         NULL, HFILL }},
7935
7936     { &hf_isup_backw_call_interworking_ind,
7937       { "Interworking indicator",  "isup.backw_call_interworking_indicator",
7938         FT_BOOLEAN, 16, TFS(&isup_interworking_ind_value), I_16BIT_MASK,
7939         NULL, HFILL }},
7940
7941     { &hf_isup_backw_call_end_to_end_info_ind,
7942       { "End-to-end information indicator",  "isup.backw_call_end_to_end_information_indicator",
7943         FT_BOOLEAN, 16, TFS(&isup_end_to_end_info_ind_value), J_16BIT_MASK,
7944         NULL, HFILL }},
7945
7946     { &hf_isup_backw_call_isdn_user_part_ind,
7947       { "ISDN user part indicator",  "isup.backw_call_isdn_user_part_indicator",
7948         FT_BOOLEAN, 16, TFS(&isup_ISDN_user_part_ind_value), K_16BIT_MASK,
7949         NULL, HFILL }},
7950
7951     { &hf_isup_backw_call_holding_ind,
7952       { "Holding indicator",  "isup.backw_call_holding_indicator",
7953         FT_BOOLEAN, 16, TFS(&isup_holding_ind_value), L_16BIT_MASK,
7954         NULL, HFILL }},
7955
7956     { &hf_isup_backw_call_isdn_access_ind,
7957       { "ISDN access indicator",  "isup.backw_call_isdn_access_indicator",
7958         FT_BOOLEAN, 16, TFS(&isup_ISDN_terminating_access_ind_value), M_16BIT_MASK,
7959         NULL, HFILL }},
7960
7961     { &hf_isup_backw_call_echo_control_device_ind,
7962       { "Echo Control Device Indicator",  "isup.backw_call_echo_control_device_indicator",
7963         FT_BOOLEAN, 16, TFS(&isup_echo_control_device_ind_value), N_16BIT_MASK,
7964         NULL, HFILL }},
7965
7966     { &hf_isup_backw_call_sccp_method_ind,
7967       { "SCCP method indicator",  "isup.backw_call_sccp_method_indicator",
7968         FT_UINT16, BASE_HEX, VALS(isup_SCCP_method_ind_value), PO_16BIT_MASK,
7969         NULL, HFILL }},
7970
7971     { &hf_isup_cause_indicator,
7972       { "Cause indicator",  "isup.cause_indicator",
7973         FT_UINT8, BASE_DEC|BASE_EXT_STRING, &q850_cause_code_vals_ext, 0x7f,
7974         NULL, HFILL }},
7975
7976     { &hf_ansi_isup_cause_indicator,
7977       { "Cause indicator",  "ansi_isup.cause_indicator",
7978         FT_UINT8, BASE_DEC|BASE_EXT_STRING, &ansi_isup_cause_code_vals_ext, 0x7f,
7979         NULL, HFILL }},
7980
7981     { &hf_isup_suspend_resume_indicator,
7982       { "Suspend/Resume indicator",  "isup.suspend_resume_indicator",
7983         FT_BOOLEAN, 8, TFS(&isup_suspend_resume_ind_value), A_8BIT_MASK,
7984         NULL, HFILL }},
7985
7986     { &hf_isup_range_indicator,
7987       { "Range indicator",  "isup.range_indicator",
7988         FT_UINT8, BASE_DEC, NULL , 0x0,
7989         NULL, HFILL }},
7990
7991     { &hf_isup_cgs_message_type,
7992       { "Circuit group supervision message type",  "isup.cgs_message_type",
7993         FT_UINT8, BASE_DEC, VALS(isup_cgs_message_type_value), BA_8BIT_MASK,
7994         NULL, HFILL }},
7995
7996     { &hf_isup_mtc_blocking_state1,
7997       { "Maintenance blocking state",  "isup.mtc_blocking_state",
7998         FT_UINT8, BASE_DEC, VALS(isup_mtc_blocking_state_DC00_value), BA_8BIT_MASK,
7999         NULL, HFILL }},
8000
8001     { &hf_isup_mtc_blocking_state2,
8002       { "Maintenance blocking state",  "isup.mtc_blocking_state",
8003         FT_UINT8, BASE_DEC, VALS(isup_mtc_blocking_state_DCnot00_value), BA_8BIT_MASK,
8004         NULL, HFILL }},
8005
8006     { &hf_isup_call_proc_state,
8007       { "Call processing state",  "isup.call_processing_state",
8008         FT_UINT8, BASE_DEC, VALS(isup_call_processing_state_value), DC_8BIT_MASK,
8009         NULL, HFILL }},
8010
8011     { &hf_isup_hw_blocking_state,
8012       { "HW blocking state",  "isup.hw_blocking_state",
8013         FT_UINT8, BASE_DEC, VALS(isup_HW_blocking_state_value), FE_8BIT_MASK,
8014         NULL, HFILL }},
8015
8016     { &hf_isup_event_ind,
8017       { "Event indicator",  "isup.event_ind",
8018         FT_UINT8, BASE_DEC, VALS(isup_event_ind_value), GFEDCBA_8BIT_MASK,
8019         NULL, HFILL }},
8020
8021     { &hf_isup_event_presentation_restricted_ind,
8022       { "Event presentation restricted indicator",  "isup.event_presentatiation_restr_ind",
8023         FT_BOOLEAN, 8, TFS(&isup_event_presentation_restricted_ind_value), H_8BIT_MASK,
8024         NULL, HFILL }},
8025
8026     { &hf_isup_cug_call_ind,
8027       { "Closed user group call indicator",  "isup.clg_call_ind",
8028         FT_UINT8, BASE_DEC, VALS(isup_CUG_call_ind_value), BA_8BIT_MASK,
8029         NULL, HFILL }},
8030
8031     { &hf_isup_simple_segmentation_ind,
8032       { "Simple segmentation indicator",  "isup.simple_segmentation_ind",
8033         FT_BOOLEAN, 8, TFS(&isup_simple_segmentation_ind_value), C_8BIT_MASK,
8034         NULL, HFILL }},
8035
8036     { &hf_isup_connected_line_identity_request_ind,
8037       { "Connected line identity request indicator",  "isup.connected_line_identity_request_ind",
8038         FT_BOOLEAN, 8, TFS(&isup_connected_line_identity_request_ind_value), H_8BIT_MASK,
8039         NULL, HFILL }},
8040
8041     { &hf_isup_redirecting_ind,
8042       { "Redirection indicator",  "isup.redirecting_ind",
8043         FT_UINT16, BASE_DEC, VALS(isup_redirecting_ind_value), CBA_16BIT_MASK,
8044         NULL, HFILL }},
8045
8046     { &hf_isup_original_redirection_reason,
8047       { "Original redirection reason",  "isup.original_redirection_reason",
8048         FT_UINT16, BASE_DEC, VALS(isup_original_redirection_reason_value), HGFE_16BIT_MASK,
8049         NULL, HFILL }},
8050
8051     { &hf_isup_redirection_counter,
8052       { "Redirection counter",  "isup.redirection_counter",
8053         FT_UINT16, BASE_DEC, NULL, KJI_16BIT_MASK,
8054         NULL, HFILL }},
8055
8056     { &hf_isup_redirection_reason,
8057       { "Redirection reason",  "isup.redirection_reason",
8058         FT_UINT16, BASE_DEC, VALS(isup_redirection_reason_value), PONM_16BIT_MASK,
8059         NULL, HFILL }},
8060
8061     { &hf_isup_type_of_network_identification,
8062       { "Type of network identification",  "isup.type_of_network_identification",
8063         FT_UINT8, BASE_DEC, VALS(isup_type_of_network_identification_value), GFE_8BIT_MASK,
8064         NULL, HFILL }},
8065
8066     { &hf_isup_network_identification_plan,
8067       { "Network identification plan",  "isup.network_identification_plan",
8068         FT_UINT8, BASE_DEC, VALS(isup_network_identification_plan_value), DCBA_8BIT_MASK,
8069         NULL, HFILL }},
8070
8071     { &hf_isup_map_type,
8072       { "Map Type",  "isup.map_type",
8073         FT_UINT8, BASE_DEC, VALS(isup_map_type_value), FEDCBA_8BIT_MASK,
8074         NULL, HFILL }},
8075
8076     { &hf_isup_automatic_congestion_level,
8077       { "Automatic congestion level",  "isup.automatic_congestion_level",
8078         FT_UINT8, BASE_DEC, VALS(isup_auto_congestion_level_value), 0x0,
8079         NULL, HFILL }},
8080
8081     { &hf_isup_inband_information_ind,
8082       { "In-band information indicator",  "isup.inband_information_ind",
8083         FT_BOOLEAN, 8, TFS(&isup_inband_information_ind_value), A_8BIT_MASK,
8084         NULL, HFILL }},
8085
8086     { &hf_isup_call_diversion_may_occur_ind,
8087       { "Call diversion may occur indicator",  "isup.call_diversion_may_occur_ind",
8088         FT_BOOLEAN, 8, TFS(&isup_call_diversion_may_occur_ind_value), B_8BIT_MASK,
8089         NULL, HFILL }},
8090
8091     { &hf_isup_mlpp_user_ind,
8092       { "MLPP user indicator",  "isup.mlpp_user",
8093         FT_BOOLEAN, 8, TFS(&isup_MLPP_user_ind_value), D_8BIT_MASK,
8094         NULL, HFILL }},
8095
8096     { &hf_isup_UUI_type,
8097       { "User-to-User indicator type",  "isup.UUI_type",
8098         FT_BOOLEAN, 8, TFS(&isup_UUI_type_value), A_8BIT_MASK,
8099         NULL, HFILL }},
8100
8101     { &hf_isup_UUI_req_service1,
8102       { "User-to-User indicator request service 1",  "isup.UUI_req_service1",
8103         FT_UINT8, BASE_DEC, VALS(isup_UUI_request_service_values), CB_8BIT_MASK,
8104         NULL, HFILL }},
8105
8106     { &hf_isup_UUI_req_service2,
8107       { "User-to-User indicator request service 2",  "isup.UUI_req_service2",
8108         FT_UINT8, BASE_DEC, VALS(isup_UUI_request_service_values), ED_8BIT_MASK,
8109         NULL, HFILL }},
8110
8111     { &hf_isup_UUI_req_service3,
8112       { "User-to-User indicator request service 3",  "isup.UUI_req_service3",
8113         FT_UINT8, BASE_DEC, VALS(isup_UUI_request_service_values), GF_8BIT_MASK,
8114         NULL, HFILL }},
8115
8116     { &hf_isup_UUI_res_service1,
8117       { "User-to-User indicator response service 1",  "isup.UUI_res_service1",
8118         FT_UINT8, BASE_DEC, VALS(isup_UUI_response_service_values), CB_8BIT_MASK,
8119         NULL, HFILL }},
8120
8121     { &hf_isup_UUI_res_service2,
8122       { "User-to-User indicator response service 2",  "isup.UUI_res_service2",
8123         FT_UINT8, BASE_DEC, VALS(isup_UUI_response_service_values), ED_8BIT_MASK,
8124         NULL, HFILL }},
8125
8126     { &hf_isup_UUI_res_service3,
8127       { "User-to-User response service 3",  "isup.UUI_res_service3",
8128         FT_UINT8, BASE_DEC, VALS(isup_UUI_response_service_values), GF_8BIT_MASK,
8129         NULL, HFILL }},
8130
8131     { &hf_isup_UUI_network_discard_ind,
8132       { "User-to-User indicator network discard indicator",  "isup.UUI_network_discard_ind",
8133         FT_BOOLEAN, 8, TFS(&isup_UUI_network_discard_ind_value), H_8BIT_MASK,
8134         NULL, HFILL }},
8135
8136     { &hf_isup_access_delivery_ind,
8137       { "Access delivery indicator",  "isup.access_delivery_ind",
8138         FT_BOOLEAN, 8, TFS(&isup_access_delivery_ind_value), A_8BIT_MASK,
8139         NULL, HFILL }},
8140
8141     { &hf_isup_transmission_medium_requirement_prime,
8142       { "Transmission medium requirement prime",  "isup.transmission_medium_requirement_prime",
8143         FT_UINT8, BASE_DEC|BASE_EXT_STRING, &isup_transmission_medium_requirement_prime_value_ext, 0x0,
8144         NULL, HFILL }},
8145
8146     { &hf_isup_loop_prevention_response_ind,
8147       { "Response indicator",  "isup.loop_prevention_response_ind",
8148         FT_UINT8, BASE_DEC, VALS(isup_loop_prevention_response_ind_value), CB_8BIT_MASK,
8149         NULL, HFILL }},
8150
8151     { &hf_isup_temporary_alternative_routing_ind,
8152       { "Temporary alternative routing indicator",  "isup.temporary_alternative_routing_ind",
8153         FT_BOOLEAN, 8, TFS(&isup_temporary_alternative_routing_ind_value), A_8BIT_MASK,
8154         NULL, HFILL }},
8155
8156     { &hf_isup_extension_ind,
8157       { "Extension indicator",  "isup.extension_ind",
8158         FT_BOOLEAN, 8, TFS(&isup_extension_ind_value), H_8BIT_MASK,
8159         NULL, HFILL }},
8160
8161     { &hf_isup_call_to_be_diverted_ind,
8162       { "Call to be diverted indicator",  "isup.call_to_be_diverted_ind",
8163         FT_UINT8, BASE_DEC, VALS(isup_call_to_be_diverted_ind_value), BA_8BIT_MASK,
8164         NULL, HFILL }},
8165
8166     { &hf_isup_call_to_be_offered_ind,
8167       { "Call to be offered indicator",  "isup.call_to_be_offered_ind",
8168         FT_UINT8, BASE_DEC, VALS(isup_call_to_be_offered_ind_value), BA_8BIT_MASK,
8169         NULL, HFILL }},
8170
8171     { &hf_isup_conference_acceptance_ind,
8172       { "Conference acceptance indicator",  "isup.conference_acceptance_ind",
8173         FT_UINT8, BASE_DEC, VALS(isup_conference_acceptance_ind_value), BA_8BIT_MASK,
8174         NULL, HFILL }},
8175
8176     { &hf_isup_transit_at_intermediate_exchange_ind,
8177       { "Transit at intermediate exchange indicator", "isup.transit_at_intermediate_exchange_ind",
8178         FT_BOOLEAN, 8, TFS(&isup_transit_at_intermediate_exchange_ind_value), A_8BIT_MASK,
8179         NULL, HFILL }},
8180
8181     { &hf_isup_Release_call_ind,
8182       { "Release call indicator", "isup.Release_call_ind",
8183         FT_BOOLEAN, 8, TFS(&isup_Release_call_indicator_value), B_8BIT_MASK,
8184         NULL, HFILL }},
8185
8186     { &hf_isup_Send_notification_ind,
8187       { "Send notification indicator", "isup.Send_notification_ind",
8188         FT_BOOLEAN, 8, TFS(&isup_Send_notification_ind_value),C_8BIT_MASK,
8189         NULL, HFILL }},
8190
8191     { &hf_isup_Discard_message_ind_value,
8192       { "Discard message indicator","isup.Discard_message_ind_value",
8193         FT_BOOLEAN, 8, TFS(&isup_Discard_message_ind_value), D_8BIT_MASK,
8194         NULL, HFILL }},
8195
8196     { &hf_isup_Discard_parameter_ind,
8197       { "Discard parameter indicator","isup.Discard_parameter_ind",
8198         FT_BOOLEAN, 8, TFS(&isup_Discard_parameter_ind_value), E_8BIT_MASK,
8199         NULL, HFILL }},
8200
8201     { &hf_isup_Pass_on_not_possible_indicator,
8202       { "Pass on not possible indicator",  "isup_Pass_on_not_possible_ind",
8203         FT_UINT8, BASE_HEX, VALS(isup_Pass_on_not_possible_indicator_vals),GF_8BIT_MASK,
8204         NULL, HFILL }},
8205
8206     { &hf_isup_pass_on_not_possible_indicator2,
8207       { "Pass on not possible indicator",  "isup_Pass_on_not_possible_val",
8208         FT_BOOLEAN, 8, TFS(&isup_pass_on_not_possible_indicator_value),E_8BIT_MASK,
8209         NULL, HFILL }},
8210
8211     { &hf_isup_Broadband_narrowband_interworking_ind,
8212       { "Broadband narrowband interworking indicator Bits JF",  "isup_broadband-narrowband_interworking_ind",
8213         FT_UINT8, BASE_HEX, VALS(ISUP_Broadband_narrowband_interworking_indicator_vals),BA_8BIT_MASK,
8214         NULL, HFILL }},
8215
8216     { &hf_isup_Broadband_narrowband_interworking_ind2,
8217       { "Broadband narrowband interworking indicator Bits GF",  "isup_broadband-narrowband_interworking_ind2",
8218         FT_UINT8, BASE_HEX, VALS(ISUP_Broadband_narrowband_interworking_indicator_vals),GF_8BIT_MASK,
8219         NULL, HFILL }},
8220
8221     { &hf_isup_app_cont_ident,
8222       { "Application context identifier",  "isup.app_context_identifier",
8223         FT_UINT16, BASE_DEC, VALS(isup_application_transport_parameter_value),GFEDCBA_8BIT_MASK,
8224         NULL, HFILL }},
8225
8226     { &hf_isup_app_Release_call_ind,
8227       { "Release call indicator (RCI)",  "isup.app_Release_call_indicator",
8228         FT_BOOLEAN, 8, TFS(&isup_Release_call_indicator_value), A_8BIT_MASK,
8229         NULL, HFILL }},
8230
8231     { &hf_isup_app_Send_notification_ind,
8232       { "Send notification indicator (SNI)",  "isup.app_Send_notification_ind",
8233         FT_BOOLEAN, 8, TFS(&isup_Send_notification_ind_value), B_8BIT_MASK,
8234         NULL, HFILL }},
8235
8236     { &hf_isup_apm_segmentation_ind,
8237       { "APM segmentation indicator",  "isup.apm_segmentation_ind",
8238         FT_UINT8, BASE_DEC, VALS(isup_APM_segmentation_ind_value), FEDCBA_8BIT_MASK,
8239         NULL, HFILL }},
8240
8241     { &hf_isup_apm_si_ind,
8242       { "Sequence indicator (SI)",  "isup.APM_Sequence_ind",
8243         FT_BOOLEAN, 8, TFS(&isup_Sequence_ind_value), G_8BIT_MASK,
8244         NULL, HFILL }},
8245
8246     { &hf_isup_orig_addr_len,
8247       { "Originating Address length",  "isup.orig_addr_len",
8248         FT_UINT8, BASE_DEC, NULL, 0x0,
8249         NULL, HFILL }},
8250
8251     { &hf_isup_dest_addr_len,
8252       { "Destination Address length",  "isup.orig_addr_len",
8253         FT_UINT8, BASE_DEC, NULL, 0x0,
8254         NULL, HFILL }},
8255
8256     { &hf_isup_apm_slr,
8257       { "Segmentation local reference (SLR)",  "isup.APM_slr",
8258         FT_UINT8, BASE_DEC, NULL,GFEDCBA_8BIT_MASK,
8259         NULL, HFILL }},
8260     { &hf_isup_cause_location,
8261       { "Cause location", "isup.cause_location",
8262         FT_UINT8, BASE_DEC|BASE_EXT_STRING, &q931_cause_location_vals_ext, 0x0f,
8263         NULL, HFILL }},
8264
8265     { &hf_ansi_isup_coding_standard,
8266       { "Coding standard", "ansi_isup.coding_standard", FT_UINT8, BASE_HEX,
8267         VALS(ansi_isup_coding_standard_vals), 0x60,NULL, HFILL }},
8268
8269     { &hf_bat_ase_identifier,
8270       { "BAT ASE Identifiers",  "bicc.bat_ase_identifier",
8271         FT_UINT8, BASE_HEX|BASE_EXT_STRING, &bat_ase_list_of_Identifiers_vals_ext,0x0,
8272         NULL, HFILL }},
8273
8274     { &hf_length_indicator,
8275       { "BAT ASE Element length indicator",  "bicc.bat_ase_length_indicator",
8276         FT_UINT16, BASE_DEC, NULL,0x0,
8277         NULL, HFILL }},
8278
8279     { &hf_Action_Indicator,
8280       { "BAT ASE action indicator field",  "bicc.bat_ase_bat_ase_action_indicator_field",
8281         FT_UINT8, BASE_HEX|BASE_EXT_STRING, &bat_ase_action_indicator_field_vals_ext,0x00,
8282         NULL, HFILL }},
8283
8284     { &hf_Instruction_ind_for_general_action,
8285       { "BAT ASE Instruction indicator for general action",  "bicc.bat_ase_Instruction_ind_for_general_action",
8286         FT_UINT8, BASE_HEX, VALS(Instruction_indicator_for_general_action_vals),0x03,
8287         NULL, HFILL }},
8288
8289     { &hf_Send_notification_ind_for_general_action,
8290       { "Send notification indicator for general action",  "bicc.bat_ase_Send_notification_ind_for_general_action",
8291         FT_BOOLEAN, 8, TFS(&isup_Send_notification_ind_value), 0x04,
8292         NULL, HFILL }},
8293
8294     { &hf_Instruction_ind_for_pass_on_not_possible,
8295       { "Instruction ind for pass-on not possible",  "bicc.bat_ase_Instruction_ind_for_pass_on_not_possible",
8296         FT_UINT8, BASE_HEX, VALS(Instruction_indicator_for_pass_on_not_possible_vals),0x30,
8297         NULL, HFILL }},
8298
8299     { &hf_Send_notification_ind_for_pass_on_not_possible,
8300       { "Send notification indication for pass-on not possible",  "bicc.bat_ase_Send_notification_ind_for_pass_on_not_possible",
8301         FT_BOOLEAN, 8, TFS(&isup_Send_notification_ind_value), 0x40,
8302         NULL, HFILL }},
8303
8304     { &hf_BCTP_Version_Indicator,
8305       { "BCTP Version Indicator",  "bicc.bat_ase_BCTP_Version_Indicator",
8306         FT_UINT8, BASE_DEC, NULL,0x1f,
8307         NULL, HFILL }},
8308
8309     { &hf_BVEI,
8310       { "BVEI",  "bicc.bat_ase_BCTP_BVEI",
8311         FT_BOOLEAN, 8, TFS(&BCTP_BVEI_value), 0x40,
8312         NULL, HFILL }},
8313
8314     { &hf_Tunnelled_Protocol_Indicator,
8315       { "Tunnelled Protocol Indicator",  "bicc.bat_ase_BCTP_Tunnelled_Protocol_Indicator",
8316         FT_UINT8, BASE_DEC, VALS(BCTP_Tunnelled_Protocol_Indicator_vals),0x3f,
8317         NULL, HFILL }},
8318
8319     { &hf_TPEI,
8320       { "TPEI",  "bicc.bat_ase_BCTP_tpei",
8321         FT_BOOLEAN, 8, TFS(&BCTP_TPEI_value), 0x40,
8322         NULL, HFILL }},
8323
8324     { &hf_bncid,
8325       { "Backbone Network Connection Identifier (BNCId)", "bat_ase.bncid",
8326         FT_UINT32, BASE_HEX, NULL, 0x0,
8327         NULL, HFILL }},
8328
8329     { &hf_bat_ase_biwfa,
8330       { "Interworking Function Address( X.213 NSAP encoded)", "bat_ase_biwfa",
8331         FT_BYTES, BASE_NONE, NULL, 0x0,
8332         NULL, HFILL }},
8333
8334     { &hf_afi,
8335       { "X.213 Address Format Information ( AFI )",  "x213.afi",
8336         FT_UINT8, BASE_HEX|BASE_EXT_STRING, &x213_afi_value_ext,0x0,
8337         NULL, HFILL }},
8338
8339     { &hf_bicc_nsap_dsp,
8340       { "X.213 Address Format Information ( DSP )",  "x213.dsp",
8341         FT_BYTES, BASE_NONE, NULL,0x0,
8342         NULL, HFILL }},
8343     { &hf_characteristics,
8344       { "Backbone network connection characteristics", "bat_ase.char",
8345         FT_UINT8, BASE_HEX|BASE_EXT_STRING, &bearer_network_connection_characteristics_vals_ext,0x0,
8346         NULL, HFILL }},
8347
8348     { &hf_Organization_Identifier,
8349       { "Organization identifier subfield",  "bat_ase.organization_identifier_subfield",
8350         FT_UINT8, BASE_DEC, VALS(bat_ase_organization_identifier_subfield_vals),0x0,
8351         NULL, HFILL }},
8352
8353     { &hf_codec_type,
8354       { "ITU-T codec type subfield",  "bat_ase.ITU_T_codec_type_subfield",
8355         FT_UINT8, BASE_HEX|BASE_EXT_STRING, &ITU_T_codec_type_subfield_vals_ext,0x0,
8356         NULL, HFILL }},
8357
8358     { &hf_etsi_codec_type,
8359       { "ETSI codec type subfield",  "bat_ase.ETSI_codec_type_subfield",
8360         FT_UINT8, BASE_HEX|BASE_EXT_STRING, &ETSI_codec_type_subfield_vals_ext,0x0,
8361         NULL, HFILL }},
8362
8363     { &hf_active_code_set,
8364       { "Active Code Set",  "bat_ase.acs",
8365         FT_UINT8, BASE_HEX, NULL,0x0,
8366         NULL, HFILL }},
8367
8368     { &hf_active_code_set_12_2,
8369       { "12.2 kbps rate",  "bat_ase.acs.12_2",
8370         FT_UINT8, BASE_HEX, NULL,0x80,
8371         NULL, HFILL }},
8372
8373     { &hf_active_code_set_10_2,
8374       { "10.2 kbps rate",  "bat_ase.acs.10_2",
8375         FT_UINT8, BASE_HEX, NULL,0x40,
8376         NULL, HFILL }},
8377
8378     { &hf_active_code_set_7_95,
8379       { "7.95 kbps rate",  "bat_ase.acs.7_95",
8380         FT_UINT8, BASE_HEX, NULL,0x20,
8381         NULL, HFILL }},
8382
8383     { &hf_active_code_set_7_40,
8384       { "7.40 kbps rate",  "bat_ase.acs.7_40",
8385         FT_UINT8, BASE_HEX, NULL,0x10,
8386         NULL, HFILL }},
8387
8388     { &hf_active_code_set_6_70,
8389       { "6.70 kbps rate",  "bat_ase.acs.6_70",
8390         FT_UINT8, BASE_HEX, NULL,0x08,
8391         NULL, HFILL }},
8392
8393     { &hf_active_code_set_5_90,
8394       { "5.90 kbps rate",  "bat_ase.acs.5_90",
8395         FT_UINT8, BASE_HEX, NULL,0x04,
8396         NULL, HFILL }},
8397
8398     { &hf_active_code_set_5_15,
8399       { "5.15 kbps rate",  "bat_ase.acs.5_15",
8400         FT_UINT8, BASE_HEX, NULL,0x02,
8401         NULL, HFILL }},
8402
8403     { &hf_active_code_set_4_75,
8404       { "4.75 kbps rate",  "bat_ase.acs.4_75",
8405         FT_UINT8, BASE_HEX, NULL,0x01,
8406         NULL, HFILL }},
8407
8408     { &hf_supported_code_set,
8409       { "Supported Code Set",  "bat_ase.scs",
8410         FT_UINT8, BASE_HEX, NULL,0x0,
8411         NULL, HFILL }},
8412
8413     { &hf_supported_code_set_12_2,
8414       { "12.2 kbps rate",  "bat_ase.scs.12_2",
8415         FT_UINT8, BASE_HEX, NULL,0x80,
8416         NULL, HFILL }},
8417
8418     { &hf_supported_code_set_10_2,
8419       { "10.2 kbps rate",  "bat_ase.scs.10_2",
8420         FT_UINT8, BASE_HEX, NULL,0x40,
8421         NULL, HFILL }},
8422
8423     { &hf_supported_code_set_7_95,
8424       { "7.95 kbps rate",  "bat_ase.scs.7_95",
8425         FT_UINT8, BASE_HEX, NULL,0x20,
8426         NULL, HFILL }},
8427
8428     { &hf_supported_code_set_7_40,
8429       { "7.40 kbps rate",  "bat_ase.scs.7_40",
8430         FT_UINT8, BASE_HEX, NULL,0x10,
8431         NULL, HFILL }},
8432
8433     { &hf_supported_code_set_6_70,
8434       { "6.70 kbps rate",  "bat_ase.scs.6_70",
8435         FT_UINT8, BASE_HEX, NULL,0x08,
8436         NULL, HFILL }},
8437
8438     { &hf_supported_code_set_5_90,
8439       { "5.90 kbps rate",  "bat_ase.scs.5_90",
8440         FT_UINT8, BASE_HEX, NULL,0x04,
8441         NULL, HFILL }},
8442
8443     { &hf_supported_code_set_5_15,
8444       { "5.15 kbps rate",  "bat_ase.scs.5_15",
8445         FT_UINT8, BASE_HEX, NULL,0x02,
8446         NULL, HFILL }},
8447
8448     { &hf_supported_code_set_4_75,
8449       { "4.75 kbps rate",  "bat_ase.scs.4_75",
8450         FT_UINT8, BASE_HEX, NULL,0x01,
8451         NULL, HFILL }},
8452
8453     { &hf_optimisation_mode,
8454       { "Optimisation Mode for ACS , OM",  "bat_ase.optimisation_mode",
8455         FT_UINT8, BASE_HEX, VALS(optimisation_mode_vals),0x8,
8456         NULL, HFILL }},
8457
8458     { &hf_max_codec_modes,
8459       { "Maximal number of Codec Modes, MACS",  "bat_ase.macs",
8460         FT_UINT8, BASE_DEC, NULL,0x07,
8461         NULL, HFILL }},
8462
8463
8464     { &hf_bearer_control_tunneling,
8465       { "Bearer control tunneling",  "bat_ase.bearer_control_tunneling",
8466         FT_BOOLEAN, 8, TFS(&Bearer_Control_Tunnelling_ind_value),0x01,
8467         NULL, HFILL }},
8468
8469     { &hf_BAT_ASE_Comp_Report_Reason,
8470       { "Compatibility report reason",  "bat_ase.Comp_Report_Reason",
8471         FT_UINT8, BASE_HEX, VALS(BAT_ASE_Report_Reason_vals),0x0,
8472         NULL, HFILL }},
8473
8474
8475     { &hf_BAT_ASE_Comp_Report_ident,
8476       { "Bearer control tunneling",  "bat_ase.bearer_control_tunneling",
8477         FT_UINT8, BASE_HEX|BASE_EXT_STRING, &bat_ase_list_of_Identifiers_vals_ext,0x0,
8478         NULL, HFILL }},
8479
8480     { &hf_BAT_ASE_Comp_Report_diagnostic,
8481       { "Diagnostics",  "bat_ase.Comp_Report_diagnostic",
8482         FT_UINT16, BASE_HEX, NULL,0x0,
8483         NULL, HFILL }},
8484
8485     { &hf_Local_BCU_ID,
8486       { "Local BCU ID",  "bat_ase.Local_BCU_ID",
8487         FT_UINT32, BASE_HEX, NULL, 0x0,
8488         NULL, HFILL }},
8489
8490     { &hf_late_cut_trough_cap_ind,
8491       { "Late Cut-through capability indicator",  "bat_ase.late_cut_trough_cap_ind",
8492         FT_BOOLEAN, 8, TFS(&late_cut_trough_cap_ind_value),0x01,
8493         NULL, HFILL }},
8494
8495     { &hf_bat_ase_signal,
8496       { "Q.765.5 - Signal Type",  "bat_ase.signal_type",
8497         FT_UINT8, BASE_HEX|BASE_EXT_STRING, &BAT_ASE_Signal_Type_vals_ext,0x0,
8498         NULL, HFILL }},
8499
8500     { &hf_bat_ase_duration,
8501       { "Duration in ms",  "bat_ase.signal_type",
8502         FT_UINT16, BASE_DEC, NULL,0x0,
8503         NULL, HFILL }},
8504
8505     { &hf_bat_ase_bearer_redir_ind,
8506       { "Redirection Indicator",  "bat_ase.bearer_redir_ind",
8507         FT_UINT8, BASE_HEX|BASE_EXT_STRING, &Bearer_Redirection_Indicator_vals_ext,0x0,
8508         NULL, HFILL }},
8509
8510     { &hf_nsap_ipv4_addr,
8511       { "IWFA IPv4 Address", "nsap.ipv4_addr",
8512         FT_IPv4, BASE_NONE, NULL, 0x0,
8513         "IPv4 address", HFILL }},
8514
8515     { &hf_nsap_ipv6_addr,
8516       { "IWFA IPv6 Address", "nsap.ipv6_addr",
8517         FT_IPv6, BASE_NONE, NULL, 0x0,
8518         "IPv6 address", HFILL}},
8519
8520     { &hf_iana_icp,
8521       { "IANA ICP",  "nsap.iana_icp",
8522         FT_UINT16, BASE_HEX, VALS(iana_icp_values),0x0,
8523         NULL, HFILL }},
8524
8525     { &hf_isup_called,
8526       { "ISUP Called Number",  "isup.called",
8527         FT_STRING, BASE_NONE, NULL,0x0,
8528         NULL, HFILL }},
8529
8530     { &hf_isup_calling,
8531       { "ISUP Calling Number",  "isup.calling",
8532         FT_STRING, BASE_NONE, NULL,0x0,
8533         NULL, HFILL }},
8534
8535     { &hf_isup_redirecting,
8536       { "ISUP Redirecting Number",  "isup.redirecting",
8537         FT_STRING, BASE_NONE, NULL,0x0,
8538         NULL, HFILL }},
8539     {&hf_isup_apm_msg_fragments,
8540      {"Message fragments", "isup_apm.msg.fragments",
8541       FT_NONE, BASE_NONE, NULL, 0x00, NULL, HFILL }
8542     },
8543     {&hf_isup_apm_msg_fragment,
8544      {"Message fragment", "isup_apm.msg.fragment",
8545       FT_FRAMENUM, BASE_NONE, NULL, 0x00, NULL, HFILL }
8546     },
8547     {&hf_isup_apm_msg_fragment_overlap,
8548      {"Message fragment overlap", "isup_apm.msg.fragment.overlap",
8549       FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL }
8550     },
8551     {&hf_isup_apm_msg_fragment_overlap_conflicts,
8552      {"Message fragment overlapping with conflicting data","isup_apm.msg.fragment.overlap.conflicts",
8553       FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL }
8554     },
8555     {&hf_isup_apm_msg_fragment_multiple_tails,
8556      {"Message has multiple tail fragments", "isup_apm.msg.fragment.multiple_tails",
8557       FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL }
8558     },
8559     {&hf_isup_apm_msg_fragment_too_long_fragment,
8560      {"Message fragment too long", "isup_apm.msg.fragment.too_long_fragment",
8561       FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL }
8562     },
8563     {&hf_isup_apm_msg_fragment_error,
8564      {"Message defragmentation error", "isup_apm.msg.fragment.error",
8565       FT_FRAMENUM, BASE_NONE, NULL, 0x00, NULL, HFILL }
8566     },
8567     {&hf_isup_apm_msg_fragment_count,
8568      {"Message fragment count", "isup_apm.msg.fragment.count",
8569       FT_UINT32, BASE_DEC, NULL, 0x00, NULL, HFILL }
8570     },
8571     {&hf_isup_apm_msg_reassembled_in,
8572      {"Reassembled in", "isup_apm.msg.reassembled.in",
8573       FT_FRAMENUM, BASE_NONE, NULL, 0x00, NULL, HFILL }
8574     },
8575     {&hf_isup_apm_msg_reassembled_length,
8576      {"Reassembled ISUP length", "isup_apm.msg.reassembled.length",
8577       FT_UINT32, BASE_DEC, NULL, 0x00, NULL, HFILL }
8578     },
8579     {&hf_isup_cvr_rsp_ind,
8580      {"CVR Response Ind", "conn_rsp_ind",
8581       FT_UINT8, BASE_DEC, VALS(isup_cvr_rsp_ind_value), BA_8BIT_MASK,
8582       NULL, HFILL }},
8583     {&hf_isup_cvr_cg_car_ind,
8584      {"CVR Circuit Group Carrier","cg_carrier_ind",
8585       FT_UINT8, BASE_HEX, VALS(isup_cvr_cg_car_ind_value), BA_8BIT_MASK,
8586       NULL, HFILL }},
8587     {&hf_isup_cvr_cg_double_seize,
8588      {"Double Seize Control", "cg_char_ind.doubleSeize",
8589       FT_UINT8, BASE_HEX, VALS(isup_cvr_cg_double_seize_value), DC_8BIT_MASK,
8590       NULL, HFILL }},
8591     {&hf_isup_cvr_cg_alarm_car_ind,
8592      {"Alarm Carrier Indicator", "cg_alarm_car_ind",
8593       FT_UINT8, BASE_HEX, VALS(isup_cvr_alarm_car_ind_value), FE_8BIT_MASK,
8594       NULL, HFILL }},
8595     {&hf_isup_cvr_cont_chk_ind,
8596      {"Continuity Check Indicator","cg_alarm_cnt_chk",
8597       FT_UINT8, BASE_HEX, VALS(isup_cvr_cont_chk_ind_value), HG_8BIT_MASK,
8598       NULL,HFILL }},
8599
8600     { &hf_isup_geo_loc_presentation_restricted_ind,
8601       { "Calling Geodetic Location presentation restricted indicator",  "isup.location_presentation_restr_ind",
8602         FT_UINT8, BASE_DEC, VALS(isup_location_presentation_restricted_ind_value), DC_8BIT_MASK,
8603         NULL, HFILL }},
8604     { &hf_isup_geo_loc_screening_ind,
8605       { "Calling Geodetic Location screening indicator",  "isup.location_screening_ind",
8606         FT_UINT8, BASE_DEC, VALS(isup_screening_ind_enhanced_value), BA_8BIT_MASK,        /* using previously defined screening values */
8607         NULL, HFILL }}
8608   };
8609
8610 /* Setup protocol subtree array */
8611   static gint *ett[] = {
8612     &ett_isup,
8613     &ett_isup_parameter,
8614     &ett_isup_address_digits,
8615     &ett_isup_pass_along_message,
8616     &ett_isup_circuit_state_ind,
8617     &ett_bat_ase,
8618     &ett_bat_ase_element,
8619     &ett_bat_ase_iwfa,
8620     &ett_scs,
8621     &ett_acs,
8622     &ett_isup_apm_msg_fragment,
8623     &ett_isup_apm_msg_fragments,
8624   };
8625
8626 /* Register the protocol name and description */
8627   proto_isup = proto_register_protocol("ISDN User Part",
8628                                        "ISUP", "isup");
8629
8630   register_dissector("isup", dissect_isup, proto_isup);
8631
8632 /* Required function calls to register the header fields and subtrees used */
8633   proto_register_field_array(proto_isup, hf, array_length(hf));
8634   proto_register_subtree_array(ett, array_length(ett));
8635
8636   isup_tap = register_tap("isup");
8637
8638   isup_module = prefs_register_protocol(proto_isup, NULL);
8639
8640
8641   prefs_register_bool_preference(isup_module, "show_cic_in_info", "Show CIC in Info column",
8642                                  "Show the CIC value (in addition to the message type) in the Info column",
8643                                  (gint *)&isup_show_cic_in_info);
8644
8645   prefs_register_bool_preference(isup_module, "defragment_apm",
8646                                  "Reassemble APM messages",
8647                                  "Whether APM messages datagrams should be reassembled",
8648                                  &isup_apm_desegment);
8649
8650   /* Register the stats_tree */
8651   stats_tree_register_with_group("isup", "isup_msg", "_ISUP Messages",
8652                                  0, msg_stats_tree_packet, msg_stats_tree_init,
8653                                  NULL, REGISTER_STAT_GROUP_TELEPHONY);
8654 }
8655
8656
8657 /* ------------------------------------------------------------------ */
8658 /* Register isup with the sub-laying MTP L3 dissector */
8659 void
8660 proto_reg_handoff_isup(void)
8661 {
8662   dissector_handle_t isup_handle;
8663   dissector_handle_t application_isup_handle;
8664
8665   isup_handle = create_dissector_handle(dissect_isup, proto_isup);
8666   application_isup_handle = create_dissector_handle(dissect_application_isup, proto_isup);
8667   dissector_add_uint("mtp3.service_indicator", MTP3_ISUP_SERVICE_INDICATOR, isup_handle);
8668   dissector_add_string("media_type","application/isup", application_isup_handle);
8669   dissector_add_string("tali.opcode", "isot", isup_handle);
8670
8671 }
8672
8673 void
8674 proto_register_bicc(void)
8675 {
8676 /* Setup list of header fields  See Section 1.6.1 for details*/
8677   static hf_register_info hf[] = {
8678     { &hf_bicc_cic,
8679       { "Call identification Code (CIC)",           "bicc.cic",
8680         FT_UINT32, BASE_HEX, NULL, 0x0,
8681         NULL, HFILL }},
8682   };
8683
8684 /* Setup protocol subtree array */
8685   static gint *ett[] = {
8686     &ett_bicc
8687   };
8688   proto_bicc = proto_register_protocol("Bearer Independent Call Control",
8689                                        "BICC", "bicc");
8690   register_dissector("bicc", dissect_bicc, proto_bicc);
8691 /* Required function calls to register the header fields and subtrees used */
8692   proto_register_field_array(proto_bicc, hf, array_length(hf));
8693   proto_register_subtree_array(ett, array_length(ett));
8694
8695   register_init_routine(isup_apm_defragment_init);
8696 }
8697
8698 /* Register isup with the sub-laying MTP L3 dissector */
8699 void
8700 proto_reg_handoff_bicc(void)
8701 {
8702   dissector_handle_t bicc_handle;
8703   sdp_handle = find_dissector("sdp");
8704   q931_ie_handle = find_dissector("q931.ie");
8705
8706   bicc_handle = create_dissector_handle(dissect_bicc, proto_bicc);
8707   dissector_add_uint("mtp3.service_indicator", MTP3_BICC_SERVICE_INDICATOR, bicc_handle);
8708   dissector_add_uint("sctp.ppi", BICC_PAYLOAD_PROTOCOL_ID, bicc_handle);
8709 }