Bill Meier:
[metze/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  * Ethereal - Network traffic analyzer
16  * By Gerald Combs <gerald@ethereal.com>
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 <stdio.h>
46 #include <stdlib.h>
47 #include <string.h>
48
49 #include <glib.h>
50
51 #include <epan/packet.h>
52 #include <epan/stats_tree.h>
53 #include <prefs.h>
54 #include "packet-q931.h"
55 #include "packet-isup.h"
56 #include "packet-e164.h"
57 #include <epan/sctpppids.h>
58 #include <epan/emem.h>
59 #include <epan/circuit.h>
60 #include <epan/reassemble.h>
61
62 #define MTP3_ISUP_SERVICE_INDICATOR     5
63 #define MTP3_BICC_SERVICE_INDICATOR     13
64 #define ASCII_NUMBER_DELTA              0x30
65 #define ASCII_LETTER_DELTA              0x37
66
67 /* Definition of protocol field values und lengths */
68
69 /* Definition of Message Types */
70 #define MESSAGE_TYPE_INITIAL_ADDR       1
71 #define MESSAGE_TYPE_SUBSEQ_ADDR        2
72 #define MESSAGE_TYPE_INFO_REQ           3
73 #define MESSAGE_TYPE_INFO               4
74 #define MESSAGE_TYPE_CONTINUITY         5
75 #define MESSAGE_TYPE_ADDR_CMPL          6
76 #define MESSAGE_TYPE_CONNECT            7
77 #define MESSAGE_TYPE_FORW_TRANS         8
78 #define MESSAGE_TYPE_ANSWER             9
79 #define MESSAGE_TYPE_RELEASE           12
80 #define MESSAGE_TYPE_SUSPEND           13
81 #define MESSAGE_TYPE_RESUME            14
82 #define MESSAGE_TYPE_REL_CMPL          16
83 #define MESSAGE_TYPE_CONT_CHECK_REQ    17
84 #define MESSAGE_TYPE_RESET_CIRCUIT     18
85 #define MESSAGE_TYPE_BLOCKING          19
86 #define MESSAGE_TYPE_UNBLOCKING        20
87 #define MESSAGE_TYPE_BLOCK_ACK         21
88 #define MESSAGE_TYPE_UNBLOCK_ACK       22
89 #define MESSAGE_TYPE_CIRC_GRP_RST      23
90 #define MESSAGE_TYPE_CIRC_GRP_BLCK     24
91 #define MESSAGE_TYPE_CIRC_GRP_UNBL     25
92 #define MESSAGE_TYPE_CIRC_GRP_BL_ACK   26
93 #define MESSAGE_TYPE_CIRC_GRP_UNBL_ACK 27
94 #define MESSAGE_TYPE_FACILITY_REQ      31
95 #define MESSAGE_TYPE_FACILITY_ACC      32
96 #define MESSAGE_TYPE_FACILITY_REJ      33
97 #define MESSAGE_TYPE_LOOP_BACK_ACK     36
98 #define MESSAGE_TYPE_PASS_ALONG        40
99 #define MESSAGE_TYPE_CIRC_GRP_RST_ACK  41
100 #define MESSAGE_TYPE_CIRC_GRP_QRY      42
101 #define MESSAGE_TYPE_CIRC_GRP_QRY_RSP  43
102 #define MESSAGE_TYPE_CALL_PROGRSS      44
103 #define MESSAGE_TYPE_USER2USER_INFO    45
104 #define MESSAGE_TYPE_UNEQUIPPED_CIC    46
105 #define MESSAGE_TYPE_CONFUSION         47
106 #define MESSAGE_TYPE_OVERLOAD          48
107 #define MESSAGE_TYPE_CHARGE_INFO       49
108 #define MESSAGE_TYPE_NETW_RESRC_MGMT   50
109 #define MESSAGE_TYPE_FACILITY          51
110 #define MESSAGE_TYPE_USER_PART_TEST    52
111 #define MESSAGE_TYPE_USER_PART_AVAIL   53
112 #define MESSAGE_TYPE_IDENT_REQ         54
113 #define MESSAGE_TYPE_IDENT_RSP         55
114 #define MESSAGE_TYPE_SEGMENTATION      56
115 #define MESSAGE_TYPE_LOOP_PREVENTION   64
116 #define MESSAGE_TYPE_APPLICATION_TRANS 65
117 #define MESSAGE_TYPE_PRE_RELEASE_INFO  66
118 #define MESSAGE_TYPE_SUBSEQUENT_DIR_NUM 67
119
120
121 const value_string isup_message_type_value[] = {
122   { MESSAGE_TYPE_INITIAL_ADDR,          "Initial address"},
123   { MESSAGE_TYPE_SUBSEQ_ADDR,           "Subsequent address"},
124   { MESSAGE_TYPE_INFO_REQ,              "Information request (national use)"},
125   { MESSAGE_TYPE_INFO,                  "Information (national use)"},
126   { MESSAGE_TYPE_CONTINUITY,            "Continuity"},
127   { MESSAGE_TYPE_ADDR_CMPL,             "Address complete"},
128   { MESSAGE_TYPE_CONNECT,               "Connect"},
129   { MESSAGE_TYPE_FORW_TRANS,            "Forward transfer"},
130   { MESSAGE_TYPE_ANSWER,                "Answer"},
131   { MESSAGE_TYPE_RELEASE,               "Release"},
132   { MESSAGE_TYPE_SUSPEND,               "Suspend"},
133   { MESSAGE_TYPE_RESUME,                "Resume"},
134   { MESSAGE_TYPE_REL_CMPL,              "Release complete"},
135   { MESSAGE_TYPE_CONT_CHECK_REQ,        "Continuity check request"},
136   { MESSAGE_TYPE_RESET_CIRCUIT,         "Reset Circuit"},
137   { MESSAGE_TYPE_BLOCKING,              "Blocking"},
138   { MESSAGE_TYPE_UNBLOCKING,            "Unblocking"},
139   { MESSAGE_TYPE_BLOCK_ACK,             "Blocking acknowledgement"},
140   { MESSAGE_TYPE_UNBLOCK_ACK,           "Unblocking acknowledgment"},
141   { MESSAGE_TYPE_CIRC_GRP_RST,          "Circuit group reset"},
142   { MESSAGE_TYPE_CIRC_GRP_BLCK,         "Circuit group blocking"},
143   { MESSAGE_TYPE_CIRC_GRP_UNBL,         "Circuit group unblocking"},
144   { MESSAGE_TYPE_CIRC_GRP_BL_ACK,       "Circuit group blocking acknowledgement"},
145   { MESSAGE_TYPE_CIRC_GRP_UNBL_ACK,     "Circuit group unblocking acknowledgement"},
146   { MESSAGE_TYPE_FACILITY_REQ,          "Facility request"},
147   { MESSAGE_TYPE_FACILITY_ACC,          "Facility accepted"},
148   { MESSAGE_TYPE_FACILITY_REJ,          "Facility reject"},
149   { MESSAGE_TYPE_LOOP_BACK_ACK,         "Loop back acknowledgement (national use)"},
150   { MESSAGE_TYPE_PASS_ALONG,            "Pass-along (national use)"},
151   { MESSAGE_TYPE_CIRC_GRP_RST_ACK,      "Circuit group reset acknowledgement"},
152   { MESSAGE_TYPE_CIRC_GRP_QRY,          "Circuit group query (national use)"},
153   { MESSAGE_TYPE_CIRC_GRP_QRY_RSP,      "Circuit group query response (national use)"},
154   { MESSAGE_TYPE_CALL_PROGRSS,          "Call progress"},
155   { MESSAGE_TYPE_USER2USER_INFO,        "User-to-user information"},
156   { MESSAGE_TYPE_UNEQUIPPED_CIC,        "Unequipped CIC (national use)"},
157   { MESSAGE_TYPE_CONFUSION,             "Confusion"},
158   { MESSAGE_TYPE_OVERLOAD,              "Overload (national use)"},
159   { MESSAGE_TYPE_CHARGE_INFO,           "Charge information (national use)"},
160   { MESSAGE_TYPE_NETW_RESRC_MGMT,       "Network resource management"},
161   { MESSAGE_TYPE_FACILITY,              "Facility"},
162   { MESSAGE_TYPE_USER_PART_TEST,        "User part test"},
163   { MESSAGE_TYPE_USER_PART_AVAIL,       "User part available"},
164   { MESSAGE_TYPE_IDENT_REQ,             "Identification request"},
165   { MESSAGE_TYPE_IDENT_RSP,             "Identification response"},
166   { MESSAGE_TYPE_SEGMENTATION,          "Segmentation"},
167   { MESSAGE_TYPE_LOOP_PREVENTION,       "Loop prevention"},
168   { MESSAGE_TYPE_APPLICATION_TRANS,     "Application transport"},
169   { MESSAGE_TYPE_PRE_RELEASE_INFO,      "Pre-release information"},     
170   { MESSAGE_TYPE_SUBSEQUENT_DIR_NUM,    "Subsequent Directory Number (national use)"},
171
172   { 0,                                  NULL}};
173
174 /* Same as above but in acronym form (for the Info column) */
175 const value_string isup_message_type_value_acro[] = {
176   { MESSAGE_TYPE_INITIAL_ADDR,          "IAM"},
177   { MESSAGE_TYPE_SUBSEQ_ADDR,           "SAM"},
178   { MESSAGE_TYPE_INFO_REQ,              "INR"},
179   { MESSAGE_TYPE_INFO,                  "INF"},
180   { MESSAGE_TYPE_CONTINUITY,            "COT"},
181   { MESSAGE_TYPE_ADDR_CMPL,             "ACM"},
182   { MESSAGE_TYPE_CONNECT,               "CON"},
183   { MESSAGE_TYPE_FORW_TRANS,            "FOT"},
184   { MESSAGE_TYPE_ANSWER,                "ANM"},
185   { MESSAGE_TYPE_RELEASE,               "REL"},
186   { MESSAGE_TYPE_SUSPEND,               "SUS"},
187   { MESSAGE_TYPE_RESUME,                "RES"},
188   { MESSAGE_TYPE_REL_CMPL,              "RLC"},
189   { MESSAGE_TYPE_CONT_CHECK_REQ,        "CCR"},
190   { MESSAGE_TYPE_RESET_CIRCUIT,         "RSC"},
191   { MESSAGE_TYPE_BLOCKING,              "BLO"},
192   { MESSAGE_TYPE_UNBLOCKING,            "UBL"},
193   { MESSAGE_TYPE_BLOCK_ACK,             "BLA"},
194   { MESSAGE_TYPE_UNBLOCK_ACK,           "UBLA"},
195   { MESSAGE_TYPE_CIRC_GRP_RST,          "GRS"},
196   { MESSAGE_TYPE_CIRC_GRP_BLCK,         "CGB"},
197   { MESSAGE_TYPE_CIRC_GRP_UNBL,         "CGU"},
198   { MESSAGE_TYPE_CIRC_GRP_BL_ACK,       "CGBA"},
199   { MESSAGE_TYPE_CIRC_GRP_UNBL_ACK,     "CGUA"},
200   { MESSAGE_TYPE_FACILITY_REQ,          "FAR"},
201   { MESSAGE_TYPE_FACILITY_ACC,          "FAA"},
202   { MESSAGE_TYPE_FACILITY_REJ,          "FRJ"},
203   { MESSAGE_TYPE_LOOP_BACK_ACK,         "LPA"},
204   { MESSAGE_TYPE_PASS_ALONG,            "PAM"},
205   { MESSAGE_TYPE_CIRC_GRP_RST_ACK,      "GRA"},
206   { MESSAGE_TYPE_CIRC_GRP_QRY,          "CQM"},
207   { MESSAGE_TYPE_CIRC_GRP_QRY_RSP,      "CQR"},
208   { MESSAGE_TYPE_CALL_PROGRSS,          "CPG"},
209   { MESSAGE_TYPE_USER2USER_INFO,        "UUI"},
210   { MESSAGE_TYPE_UNEQUIPPED_CIC,        "UCIC"},
211   { MESSAGE_TYPE_CONFUSION,             "CFN"},
212   { MESSAGE_TYPE_OVERLOAD,              "OLM"},
213   { MESSAGE_TYPE_CHARGE_INFO,           "CRG"},
214   { MESSAGE_TYPE_NETW_RESRC_MGMT,       "NRM"},
215   { MESSAGE_TYPE_FACILITY,              "FAC"},
216   { MESSAGE_TYPE_USER_PART_TEST,        "UPT"},
217   { MESSAGE_TYPE_USER_PART_AVAIL,       "UPA"},
218   { MESSAGE_TYPE_IDENT_REQ,             "IDR"},
219   { MESSAGE_TYPE_IDENT_RSP,             "IDS"},
220   { MESSAGE_TYPE_SEGMENTATION,          "SGM"},
221   { MESSAGE_TYPE_LOOP_PREVENTION,       "LOP"},
222   { MESSAGE_TYPE_APPLICATION_TRANS,             "APM"},
223   { MESSAGE_TYPE_PRE_RELEASE_INFO,              "PRI"},         
224   { MESSAGE_TYPE_SUBSEQUENT_DIR_NUM,    "SDN"},
225
226   { 0,                                  NULL}};
227
228 const value_string isup_parameter_type_value[] = {
229 { PARAM_TYPE_END_OF_OPT_PARAMS,        "End of optional parameters"},
230   { PARAM_TYPE_CALL_REF,               "Call Reference (national use)"},
231   { PARAM_TYPE_TRANSM_MEDIUM_REQU,     "Transmission medium requirement"},
232   { PARAM_TYPE_ACC_TRANSP,             "Access transport"},
233   { PARAM_TYPE_CALLED_PARTY_NR,        "Called party number"},
234   { PARAM_TYPE_SUBSQT_NR,              "Subsequent number"},
235   { PARAM_TYPE_NATURE_OF_CONN_IND,     "Nature of connection indicators"},
236   { PARAM_TYPE_FORW_CALL_IND,          "Forward call indicators"},
237   { PARAM_TYPE_OPT_FORW_CALL_IND,      "Optional forward call indicators"},
238   { PARAM_TYPE_CALLING_PRTY_CATEG,     "Calling party's category"},
239   { PARAM_TYPE_CALLING_PARTY_NR,       "Calling party number"},
240   { PARAM_TYPE_REDIRECTING_NR,         "Redirecting number"},
241   { PARAM_TYPE_REDIRECTION_NR,         "Redirection number"},
242   { PARAM_TYPE_CONNECTION_REQ,         "Connection request"},
243   { PARAM_TYPE_INFO_REQ_IND,           "Information request indicators (national use)"},
244   { PARAM_TYPE_INFO_IND,               "Information indicators (national use)"},
245   { PARAM_TYPE_CONTINUITY_IND,         "Continuity request"},
246   { PARAM_TYPE_BACKW_CALL_IND,         "Backward call indicators"},
247   { PARAM_TYPE_CAUSE_INDICATORS,       "Cause indicators"},
248   { PARAM_TYPE_REDIRECTION_INFO,       "Redirection information"},
249   { PARAM_TYPE_CIRC_GRP_SV_MSG_TYPE,   "Circuit group supervision message type"},
250   { PARAM_TYPE_RANGE_AND_STATUS,       "Range and Status"},
251   { PARAM_TYPE_FACILITY_IND,           "Facility indicator"},
252   { PARAM_TYPE_CLSD_USR_GRP_ILOCK_CD,  "Closed user group interlock code"},
253   { PARAM_TYPE_USER_SERVICE_INFO,      "User service information"},
254   { PARAM_TYPE_SIGNALLING_POINT_CODE,  "Signalling point code (national use)"},
255   { PARAM_TYPE_USER_TO_USER_INFO,      "User-to-user information"},
256   { PARAM_TYPE_CONNECTED_NR,           "Connected number"},
257   { PARAM_TYPE_SUSP_RESUME_IND,        "Suspend/Resume indicators"},
258   { PARAM_TYPE_TRANSIT_NETW_SELECT,    "Transit network selection (national use)"},
259   { PARAM_TYPE_EVENT_INFO,             "Event information"},
260   { PARAM_TYPE_CIRC_ASSIGN_MAP,        "Circuit assignment map"},
261   { PARAM_TYPE_CIRC_STATE_IND,         "Circuit state indicator (national use)"},
262   { PARAM_TYPE_AUTO_CONG_LEVEL,        "Automatic congestion level"},
263   { PARAM_TYPE_ORIG_CALLED_NR,         "Original called number"},
264   { PARAM_TYPE_OPT_BACKW_CALL_IND,     "Backward call indicators"},
265   { PARAM_TYPE_USER_TO_USER_IND,       "User-to-user indicators"},
266   { PARAM_TYPE_ORIG_ISC_POINT_CODE,    "Origination ISC point code"},
267   { PARAM_TYPE_GENERIC_NOTIF_IND,      "Generic notification indicator"},
268   { PARAM_TYPE_CALL_HIST_INFO,         "Call history information"},
269   { PARAM_TYPE_ACC_DELIV_INFO,         "Access delivery information"},
270   { PARAM_TYPE_NETW_SPECIFIC_FACLTY,   "Network specific facility (national use)"},
271   { PARAM_TYPE_USER_SERVICE_INFO_PR,   "User service information prime"},
272   { PARAM_TYPE_PROPAG_DELAY_COUNTER,   "Propagation delay counter"},
273   { PARAM_TYPE_REMOTE_OPERATIONS,      "Remote operations (national use)"},
274   { PARAM_TYPE_SERVICE_ACTIVATION,     "Service activation"},
275   { PARAM_TYPE_USER_TELESERV_INFO,     "User teleservice information"},
276   { PARAM_TYPE_TRANSM_MEDIUM_USED,     "Transmission medium used"},
277   { PARAM_TYPE_CALL_DIV_INFO,          "Call diversion information"},
278   { PARAM_TYPE_ECHO_CTRL_INFO,         "Echo control information"},
279   { PARAM_TYPE_MSG_COMPAT_INFO,        "Message compatibility information"},
280   { PARAM_TYPE_PARAM_COMPAT_INFO,      "Parameter compatibility information"},
281   { PARAM_TYPE_MLPP_PRECEDENCE,        "MLPP precedence"},
282   { PARAM_TYPE_MCID_REQ_IND,           "MCID request indicators"},
283   { PARAM_TYPE_MCID_RSP_IND,           "MCID response indicators"},
284   { PARAM_TYPE_HOP_COUNTER,            "Hop counter"},
285   { PARAM_TYPE_TRANSM_MEDIUM_RQUR_PR,  "Transmission medium requirement prime"},
286   { PARAM_TYPE_LOCATION_NR,            "Location number"},
287   { PARAM_TYPE_REDIR_NR_RSTRCT,        "Redirection number restriction"},
288   { PARAM_TYPE_CALL_TRANS_REF,         "Call transfer reference"},
289   { PARAM_TYPE_LOOP_PREV_IND,          "Loop prevention indicators"},
290   { PARAM_TYPE_CALL_TRANS_NR,          "Call transfer number"},
291   { PARAM_TYPE_CCSS,                   "CCSS"},
292   { PARAM_TYPE_FORW_GVNS,              "Forward GVNS"},
293   { PARAM_TYPE_BACKW_GVNS,             "Backward GVNS"},
294   { PARAM_TYPE_REDIRECT_CAPAB,         "Redirect capability (reserved for national use)"},
295   { PARAM_TYPE_NETW_MGMT_CTRL,         "Network management controls"},
296   { PARAM_TYPE_CORRELATION_ID,         "Correlation id"},
297   { PARAM_TYPE_SCF_ID,                 "SCF id"},
298   { PARAM_TYPE_CALL_DIV_TREAT_IND,     "Call diversion treatment indicators"},
299   { PARAM_TYPE_CALLED_IN_NR,           "Called IN number"},
300   { PARAM_TYPE_CALL_OFF_TREAT_IND,     "Call offering treatment indicators"},
301   { PARAM_TYPE_CHARGED_PARTY_IDENT,    "Charged party identification (national use)"},
302   { PARAM_TYPE_CONF_TREAT_IND,         "Conference treatment indicators"},
303   { PARAM_TYPE_DISPLAY_INFO,           "Display information"},
304   { PARAM_TYPE_UID_ACTION_IND,         "UID action indicators"},
305   { PARAM_TYPE_UID_CAPAB_IND,          "UID capability indicators"},
306   { PARAM_TYPE_REDIRECT_COUNTER,       "Redirect counter (reserved for national use)"},
307   { PARAM_TYPE_COLLECT_CALL_REQ,       "Collect call request"},
308   { PARAM_TYPE_GENERIC_NR,             "Generic number"},
309   { PARAM_TYPE_GENERIC_DIGITS,         "Generic digits (national use)"},
310   { PARAM_TYPE_APPLICATON_TRANS,       "Application transport"},
311   { 0,                                 NULL}};
312
313
314 #define CIC_LENGTH                             2
315 #define BICC_CIC_LENGTH                        4
316 #define MESSAGE_TYPE_LENGTH                    1
317 #define COMMON_HEADER_LENGTH                   (CIC_LENGTH + MESSAGE_TYPE_LENGTH)
318 #define BICC_COMMON_HEADER_LENGTH              (BICC_CIC_LENGTH + MESSAGE_TYPE_LENGTH)
319
320 #define MAXDIGITS                              32 /* Max number of address digits */
321
322 #define PARAMETER_TYPE_LENGTH                  1
323 #define PARAMETER_POINTER_LENGTH               1
324 #define PARAMETER_LENGTH_IND_LENGTH            1
325
326 /* All following parameter length definitions are WITHOUT the parameter type byte and length indicator for optional parameters*/
327 #define PARAMETER_NAME_LENGTH                  1
328 #define PARAMETER_LENGTH_IND_LENGTH            1
329 #define ACCESS_DELIVERY_INFO_LENGTH            1
330 #define AUTO_CONGEST_LEVEL_LENGTH              1
331 #define BACKWARD_CALL_IND_LENGTH               2
332 #define BACKWARD_GVNS_LENGTH                   1
333 #define CALL_DIV_INFO_LENGTH                   1
334 #define CALL_DIV_TREATMENT_IND_LENGTH          1
335 #define CALL_HISTORY_INFO_LENGTH               2
336 #define CALL_OFFERING_TREATMENT_IND_LENGTH     1
337 #define CALL_REFERENCE_LENGTH                  5
338 #define CALL_TRANSFER_REF_LENGTH               1
339 #define CALLING_PRTYS_CATEGORY_LENGTH          1
340 #define CCSS_LENGTH                            1
341 #define CIRCUIT_ASSIGNMENT_MAP_LENGTH          5
342 #define CIRC_GRP_SV_MSG_TYPE_LENGTH            1
343 #define CLOSED_USR_GRP_INTERLOCK_CODE_LENGTH   4
344 #define COLLECT_CALL_REQUEST_LENGTH            1
345 #define CONFERENCE_TREATMENT_IND_LENGTH        1
346 #define CONNECTION_REQUEST_LENGTH              7
347 #define CONTINUITY_IND_LENGTH                  1
348 #define ECHO_CONTROL_INFO_LENGTH               1
349 #define END_OF_OPT_PART_LENGTH                 1
350 #define EVENT_INFO_LENGTH                      1
351 #define FACILITY_IND_LENGTH                    1
352 #define FORWARD_CALL_IND_LENGTH                2
353 #define GENERIC_NOTIFICATION_IND_LENGTH        1
354 #define HOP_COUNTER_LENGTH                     1
355 #define INFO_IND_LENGTH                        2
356 #define INFO_REQUEST_IND_LENGTH                2
357 #define LOOP_PREVENTION_IND_LENGTH             1
358 #define MCID_REQUEST_IND_LENGTH                1
359 #define MCID_RESPONSE_IND_LENGTH               1
360 #define MLPP_PRECEDENCE_LENGTH                 1
361 #define NATURE_OF_CONNECTION_IND_LENGTH        1
362 #define NETWORK_MANAGEMENT_CONTROLS_LENGTH     1
363 #define OPTIONAL_BACKWARD_CALL_IND_LENGTH      1
364 #define OPTIONAL_FORWARD_CALL_IND_LENGTH       1
365 #define ORIGINAL_ISC_POINT_CODE_LENGTH         2
366 #define PROPAGATION_DELAY_COUNT_LENGTH         2
367 #define REDIRECTION_NUMBER_LENGTH              2
368 #define REDIRECTION_INFO_LENGTH                2
369 #define REDIRECTION_NUMBER_RESTRICTION_LENGTH  1
370 #define SIGNALLING_POINT_CODE_LENGTH           2
371 #define SUSPEND_RESUME_IND_LENGTH              1
372 #define TRANSMISSION_MEDIUM_REQUIREMENT_LENGTH 1
373 #define TRANSMISSION_MEDIUM_RQMT_PRIME_LENGTH  1
374 #define TRANSMISSION_MEDIUM_USED_LENGTH        1
375 #define UID_ACTION_IND_LENGTH                  1
376 #define UID_CAPABILITY_IND_LENGTH              1
377 #define USER_TELESERVICE_INFO_LENGTH           2
378 #define USER_TO_USER_IND_LENGTH                1
379 #define RANGE_LENGTH                           1
380
381 #define CALL_ID_LENGTH        3 /* for parameter Call Reference */
382 #define SPC_LENGTH            2 /* for parameter Call Reference, Connection request */
383 #define LOCAL_REF_LENGTH      3 /* for parameter Connection request */
384 #define PROTOCOL_CLASS_LENGTH 1 /* for parameter Connection request */
385 #define CREDIT_LENGTH         1 /* for parameter Connection request */
386
387 #define CIC_OFFSET            0
388 #define BICC_CIC_OFFSET       0
389
390 #define NO_SATELLITE_CIRCUIT_IN_CONNECTION   0
391 #define ONE_SATELLITE_CIRCUIT_IN_CONNECTION  1
392 #define TWO_SATELLITE_CIRCUIT_IN_CONNECTION  2
393 static const value_string isup_satellite_ind_value[] = {
394   { NO_SATELLITE_CIRCUIT_IN_CONNECTION,          "No Satellite circuit in connection"},
395   { ONE_SATELLITE_CIRCUIT_IN_CONNECTION,         "One Satellite circuit in connection"},
396   { TWO_SATELLITE_CIRCUIT_IN_CONNECTION,         "Two Satellite circuits in connection"},
397   { 0,                                 NULL}};
398
399 #define CONTINUITY_CHECK_NOT_REQUIRED           0
400 #define CONTINUITY_CHECK_REQUIRED               1
401 #define CONTINUITY_CHECK_ON_A_PREVIOUS_CIRCUIT  2
402 static const value_string isup_continuity_check_ind_value[] = {
403   { CONTINUITY_CHECK_NOT_REQUIRED,               "Continuity check not required"},
404   { CONTINUITY_CHECK_REQUIRED,                   "Continuity check required on this circuit"},
405   { CONTINUITY_CHECK_ON_A_PREVIOUS_CIRCUIT ,     "Continuity check performed on a previous circuit"},
406   { 0,                                 NULL}};
407
408 static const true_false_string isup_echo_control_device_ind_value = {
409   "Echo control device included",
410   "Echo control device not included"
411 };
412
413 static const true_false_string isup_natnl_inatnl_call_ind_value = {
414   "Call to be treated as international call",
415   "Call to be treated as national call"
416 };
417
418 #define NO_END_TO_END_METHOD_AVAILABLE       0
419 #define PASS_ALONG_METHOD_AVAILABLE          1
420 #define SCCP_METHOD_AVAILABLE                2
421 #define PASS_ALONG_AND_SCCP_METHOD_AVAILABLE 3
422 static const value_string isup_end_to_end_method_ind_value[] = {
423   { NO_END_TO_END_METHOD_AVAILABLE,          "No End-to-end method available (only link-by-link method available)"},
424   { PASS_ALONG_METHOD_AVAILABLE,             "Pass-along method available (national use)"},
425   { SCCP_METHOD_AVAILABLE,                   "SCCP method available"},
426   { PASS_ALONG_AND_SCCP_METHOD_AVAILABLE,    "pass-along and SCCP method available (national use)"},
427   { 0,                                 NULL}};
428
429 static const true_false_string isup_interworking_ind_value = {
430   "interworking encountered",
431   "no interworking encountered (No.7 signalling all the way)"
432 };
433
434 static const true_false_string isup_end_to_end_info_ind_value = {
435   "end-to-end information available",
436   "no end-to-end information available"
437 };
438
439 static const true_false_string isup_ISDN_user_part_ind_value = {
440   "ISDN user part used all the way",
441   "ISDN user part not used all the way"
442 };
443
444 #define ISUP_PREFERED_ALL_THE_WAY               0
445 #define ISUP_NOT_REQUIRED_ALL_THE_WAY           1
446 #define ISUP_REQUIRED_ALL_WAY                   2
447 #define ISUP_ISDN_USER_PART_IND_SPARE           3
448 static const value_string isup_preferences_ind_value[] = {
449   { ISUP_PREFERED_ALL_THE_WAY,                   "ISDN user part prefered all the way"},
450   { ISUP_NOT_REQUIRED_ALL_THE_WAY,               "ISDN user part not required all the way"},
451   { ISUP_REQUIRED_ALL_WAY,                       "ISDN user part required all the way"},
452   { ISUP_ISDN_USER_PART_IND_SPARE,               "spare"},
453   { 0,                                 NULL}};
454
455 static const true_false_string isup_ISDN_originating_access_ind_value = {
456   "originating access ISDN",
457   "originating access non-ISDN"
458 };
459
460 #define NO_INDICATION                                0
461 #define CONNECTIONLESS_METHOD_AVAILABLE              1
462 #define CONNECITON_ORIENTED_METHOD_AVAILABLE         2
463 #define CONNECTIONLESS_AND_ORIENTED_METHOD_AVAILABLE 3
464 static const value_string isup_SCCP_method_ind_value[] = {
465   { NO_INDICATION,                                  "No indication"},
466   { CONNECTIONLESS_METHOD_AVAILABLE,                "Connectionless method available (national use)"},
467   { CONNECITON_ORIENTED_METHOD_AVAILABLE,           "Connection oriented method available"},
468   { CONNECTIONLESS_AND_ORIENTED_METHOD_AVAILABLE,   "Connectionless and -oriented method available (national use)"},
469   { 0,                                 NULL}};
470
471 #define UNKNOWN_AT_THIS_TIME                 0
472 #define OPERATOR_FRENCH                      1
473 #define OPERATOR_ENGLISH                     2
474 #define OPERATOR_GERMAN                      3
475 #define OPERATOR_RUSSIAN                     4
476 #define OPERATOR_SPANISH                     5
477 #define ORDINARY_CALLING_SUBSCRIBER         10
478 #define CALLING_SUBSCRIBER_WITH_PRIORITY    11
479 #define DATA_CALL                           12
480 #define TEST_CALL                           13
481 #define PAYPHONE                            15
482 const value_string isup_calling_partys_category_value[] = {
483   { UNKNOWN_AT_THIS_TIME,               "Category unknown at this time (national use)"},
484   { OPERATOR_FRENCH,                    "operator, language French"},
485   { OPERATOR_ENGLISH,                   "operator, language English"},
486   { OPERATOR_GERMAN,                    "operator, language German"},
487   { OPERATOR_RUSSIAN,                   "operator, language Russian"},
488   { OPERATOR_SPANISH,                   "operator, language Spanish"},
489   { ORDINARY_CALLING_SUBSCRIBER,        "ordinary calling subscriber"},
490   { CALLING_SUBSCRIBER_WITH_PRIORITY,   "calling subscriber with priority"},
491   { DATA_CALL,                          "data call (voice band data)"},
492   { TEST_CALL,                          "test call"},
493   /* q.763-200212Amd2 */
494   { 14,                                                                 "IEPS call marking for preferential call set up"},
495   { PAYPHONE,                           "payphone"},
496   { 0,                                 NULL}};
497
498 #define MEDIUM_SPEECH                        0
499 #define MEDIUM_64KBS                         2
500 #define MEDIUM_3_1_KHZ_AUDIO                 3
501 #define MEDIUM_RESERVED_SERVICE2_1           4
502 #define MEDIUM_RESERVED_SERVICE1_2           5
503 #define MEDIUM_64KBS_PREFERED                6
504 #define MEDIUM_2_64KBS                       7
505 #define MEDIUM_384KBS                        8
506 #define MEDIUM_1536KBS                       9
507 #define MEDIUM_1920KBS                      10
508 #define MEDIUM_3_64KBS                      16
509 #define MEDIUM_4_64KBS                      17
510 #define MEDIUM_5_64KBS                      18
511 #define MEDIUM_7_64KBS                      20
512 #define MEDIUM_8_64KBS                      21
513 #define MEDIUM_9_64KBS                      22
514 #define MEDIUM_10_64KBS                     23
515 #define MEDIUM_11_64KBS                     24
516 #define MEDIUM_12_64KBS                     25
517 #define MEDIUM_13_64KBS                     26
518 #define MEDIUM_14_64KBS                     27
519 #define MEDIUM_15_64KBS                     28
520 #define MEDIUM_16_64KBS                     29
521 #define MEDIUM_17_64KBS                     30
522 #define MEDIUM_18_64KBS                     31
523 #define MEDIUM_19_64KBS                     32
524 #define MEDIUM_20_64KBS                     33
525 #define MEDIUM_21_64KBS                     34
526 #define MEDIUM_22_64KBS                     35
527 #define MEDIUM_23_64KBS                     36
528 #define MEDIUM_25_64KBS                     38
529 #define MEDIUM_26_64KBS                     39
530 #define MEDIUM_27_64KBS                     40
531 #define MEDIUM_28_64KBS                     41
532 #define MEDIUM_29_64KBS                     42
533
534 const value_string isup_transmission_medium_requirement_value[] = {
535   { MEDIUM_SPEECH,                       "speech"},
536   { MEDIUM_64KBS,                        "64 kbit/s unrestricted"},
537   { MEDIUM_3_1_KHZ_AUDIO,                "3.1 kHz audio"},
538   { MEDIUM_RESERVED_SERVICE2_1,          "reserved for alternate speech (service 2)/64 kbit/s unrestricted (service 1)"},
539   { MEDIUM_RESERVED_SERVICE1_2,          "reserved for alternate 64 kbit/s unrestricted (service 1)/speech (service 2)"},
540   { MEDIUM_64KBS_PREFERED,               "64 kbit/s prefered"},
541   { MEDIUM_2_64KBS,                      "2x64 kbit/s unrestricted"},
542   { MEDIUM_384KBS,                       "384 kbit/s unrestricted"},
543   { MEDIUM_1536KBS,                      "1536 kbit/s unrestricted"},
544   { MEDIUM_1920KBS,                      "1920 kbit/s unrestricted"},
545   { MEDIUM_3_64KBS,                      "3x64 kbit/s unrestricted"},
546   { MEDIUM_4_64KBS,                      "4x64 kbit/s unrestricted"},
547   { MEDIUM_5_64KBS,                      "5x64 kbit/s unrestricted"},
548   { MEDIUM_7_64KBS,                      "7x64 kbit/s unrestricted"},
549   { MEDIUM_8_64KBS,                      "8x64 kbit/s unrestricted"},
550   { MEDIUM_9_64KBS,                      "9x64 kbit/s unrestricted"},
551   { MEDIUM_10_64KBS,                     "10x64 kbit/s unrestricted"},
552   { MEDIUM_11_64KBS,                     "11x64 kbit/s unrestricted"},
553   { MEDIUM_12_64KBS,                     "12x64 kbit/s unrestricted"},
554   { MEDIUM_13_64KBS,                     "13x64 kbit/s unrestricted"},
555   { MEDIUM_14_64KBS,                     "14x64 kbit/s unrestricted"},
556   { MEDIUM_15_64KBS,                     "15x64 kbit/s unrestricted"},
557   { MEDIUM_16_64KBS,                     "16x64 kbit/s unrestricted"},
558   { MEDIUM_17_64KBS,                     "17x64 kbit/s unrestricted"},
559   { MEDIUM_18_64KBS,                     "18x64 kbit/s unrestricted"},
560   { MEDIUM_19_64KBS,                     "19x64 kbit/s unrestricted"},
561   { MEDIUM_20_64KBS,                     "20x64 kbit/s unrestricted"},
562   { MEDIUM_21_64KBS,                     "21x64 kbit/s unrestricted"},
563   { MEDIUM_22_64KBS,                     "22x64 kbit/s unrestricted"},
564   { MEDIUM_23_64KBS,                     "23x64 kbit/s unrestricted"},
565   { MEDIUM_25_64KBS,                     "25x64 kbit/s unrestricted"},
566   { MEDIUM_26_64KBS,                     "26x64 kbit/s unrestricted"},
567   { MEDIUM_27_64KBS,                     "27x64 kbit/s unrestricted"},
568   { MEDIUM_28_64KBS,                     "28x64 kbit/s unrestricted"},
569   { MEDIUM_29_64KBS,                     "29x64 kbit/s unrestricted"},
570   { 0,                                 NULL}};
571 static const value_string isup_transmission_medium_requirement_prime_value[] = {
572   { MEDIUM_SPEECH,                       "speech"},
573   { MEDIUM_64KBS,                        "reserved for 64 kbit/s unrestricted"},
574   { MEDIUM_3_1_KHZ_AUDIO,                "3.1 kHz audio"},
575   { MEDIUM_RESERVED_SERVICE2_1,          "reserved for alternate speech (service 2)/64 kbit/s unrestricted (service 1)"},
576   { MEDIUM_RESERVED_SERVICE1_2,          "reserved for alternate 64 kbit/s unrestricted (service 1)/speech (service 2)"},
577   { MEDIUM_64KBS_PREFERED,               "reserved for 64 kbit/s prefered"},
578   { MEDIUM_2_64KBS,                      "reserved for 2x64 kbit/s unrestricted"},
579   { MEDIUM_384KBS,                       "reserved for 384 kbit/s unrestricted"},
580   { MEDIUM_1536KBS,                      "reserved for 1536 kbit/s unrestricted"},
581   { MEDIUM_1920KBS,                      "reserved for 1920 kbit/s unrestricted"},
582   { 0,                                 NULL}};
583
584
585 /* Definitions for Called and Calling Party number */
586 #define ISUP_ODD_EVEN_MASK                       0x80
587 #define ISUP_NATURE_OF_ADDRESS_IND_MASK          0x7F
588 #define ISUP_INN_MASK                            0x80
589 #define ISUP_NI_MASK                             0x80
590 #define ISUP_NUMBERING_PLAN_IND_MASK             0x70
591 #define ISUP_ADDRESS_PRESENTATION_RESTR_IND_MASK 0x0C
592 #define ISUP_SCREENING_IND_MASK                  0x03
593 #define ISUP_ODD_ADDRESS_SIGNAL_DIGIT_MASK       0x0F
594 #define ISUP_EVEN_ADDRESS_SIGNAL_DIGIT_MASK      0xF0
595
596 static const true_false_string isup_odd_even_ind_value = {
597   "odd number of address signals",
598   "even number of address signals"
599 };
600
601 #define ISUP_CALLED_PARTY_NATURE_SUBSCRIBER_NR  1
602 #define ISUP_CALLED_PARTY_NATURE_UNKNOWN        2
603 #define ISUP_CALLED_PARTY_NATURE_NATIONAL_NR    3
604 #define ISUP_CALLED_PARTY_NATURE_INTERNATNL_NR  4
605 #define ISUP_CALLED_PARTY_NATURE_NETW_SPEC_NR   5
606 static const value_string isup_called_party_nature_of_address_ind_value[] = {
607   { ISUP_CALLED_PARTY_NATURE_SUBSCRIBER_NR,     "subscriber number (national use)"},
608   { ISUP_CALLED_PARTY_NATURE_UNKNOWN,           "unknown (national use)"},
609   { ISUP_CALLED_PARTY_NATURE_NATIONAL_NR,       "national (significant) number"},
610   { ISUP_CALLED_PARTY_NATURE_INTERNATNL_NR,     "international number"},
611   { ISUP_CALLED_PARTY_NATURE_NETW_SPEC_NR,      "network-specific number (national use)"},
612   { 0,                                 NULL}};
613
614 static const value_string isup_calling_party_nature_of_address_ind_value[] = {
615   { ISUP_CALLED_PARTY_NATURE_SUBSCRIBER_NR,     "subscriber number (national use)"},
616   { ISUP_CALLED_PARTY_NATURE_UNKNOWN,           "unknown (national use)"},
617   { ISUP_CALLED_PARTY_NATURE_NATIONAL_NR,       "national (significant) number"},
618   { ISUP_CALLED_PARTY_NATURE_INTERNATNL_NR,     "international number"},
619   { 0,                                 NULL}};
620
621 static const true_false_string isup_INN_ind_value = {
622   "routing to internal network number not allowed",
623   "routing to internal network number allowed "
624 };
625 static const true_false_string isup_NI_ind_value = {
626   "incomplete",
627   "complete"
628 };
629
630 #define ISDN_NUMBERING_PLAN                     1
631 #define DATA_NUMBERING_PLAN                     3
632 #define TELEX_NUMBERING_PLAN                    4
633 static const value_string isup_numbering_plan_ind_value[] = {
634   { ISDN_NUMBERING_PLAN,     "ISDN (Telephony) numbering plan"},
635   { DATA_NUMBERING_PLAN,     "Data numbering plan (national use)"},
636   { TELEX_NUMBERING_PLAN,    "Telex numbering plan (national use)"},
637   { 5,                       "Reserved for national use"},
638   { 6,                       "Reserved for national use"},
639   { 0,                                 NULL}};
640
641 #define ADDRESS_PRESETATION_ALLOWED      0
642 #define ADDRESS_PRESETATION_RESTRICTED   1
643 #define ADDRESS_NOT_AVAILABLE            2
644 static const value_string isup_address_presentation_restricted_ind_value[] = {
645   { ADDRESS_PRESETATION_ALLOWED,     "presentation allowed"},
646   { ADDRESS_PRESETATION_RESTRICTED,  "presentation restricted"},
647   { ADDRESS_NOT_AVAILABLE,           "address not available (national use)"},
648   { 3,                                 "spare"},
649   { 0,                                 NULL}};
650
651 static const value_string isup_screening_ind_value[] = {
652   { 0,     "reserved"},
653   { 1,     "user provided, verified and passed"},
654   { 2,     "reserved"},
655   { 3,     "network provided"},
656   { 0,     NULL}};
657
658 static const value_string isup_screening_ind_enhanced_value[] = {
659   { 0,     "user provided, not verified"},
660   { 1,     "user provided, verified and passed"},
661   { 2,     "user provided, verified and failed"},
662   { 3,     "network provided"},
663   { 0,     NULL}};
664
665 static const value_string isup_called_party_address_digit_value[] = {
666   { 0,  "0"},
667   { 1,  "1"},
668   { 2,  "2"},
669   { 3,  "3"},
670   { 4,  "4"},
671   { 5,  "5"},
672   { 6,  "6"},
673   { 7,  "7"},
674   { 8,  "8"},
675   { 9,  "9"},
676   { 10, "spare"},
677   { 11, "code 11 "},
678   { 12, "code 12"},
679   { 15, "Stop sending"},
680   { 0,  NULL}};
681
682 static const value_string isup_calling_party_address_digit_value[] = {
683   { 0,  "0"},
684   { 1,  "1"},
685   { 2,  "2"},
686   { 3,  "3"},
687   { 4,  "4"},
688   { 5,  "5"},
689   { 6,  "6"},
690   { 7,  "7"},
691   { 8,  "8"},
692   { 9,  "9"},
693   { 10, "spare"},
694   { 11, "code 11 "},
695   { 12, "code 12"},
696   { 15, "spare"},
697   { 0,  NULL}};
698
699 /*End of Called/Calling party address definitions */
700
701
702 static const true_false_string isup_calling_party_address_request_ind_value = {
703   "calling party address requested",
704   "calling party address not requested"
705 };
706 static const true_false_string isup_holding_ind_value = {
707   "holding requested",
708   "holding not requested"
709 };
710 static const true_false_string isup_calling_partys_category_request_ind_value = {
711   "Calling Party's category requested",
712   "Calling Party's category not requested",
713 };
714 static const true_false_string isup_charge_information_request_ind_value = {
715   "Charge Information requested",
716   "Charge Information not requested"
717 };
718 static const true_false_string isup_malicious_call_identification_request_ind_value = {
719   "Malicious call identification requested",
720   "Malicious call identification not requested"
721 };
722
723 #define CALLING_PARTY_ADDRESS_NOT_INCLUDED             0
724 #define CALLING_PARTY_ADDRESS_NOT_AVAILABLE            1
725 #define CALLING_PARTY_ADDRESS_INCLUDED                 3
726 static const value_string isup_calling_party_address_response_ind_value[] = {
727   { CALLING_PARTY_ADDRESS_NOT_INCLUDED, "Calling party address not included"},
728   { CALLING_PARTY_ADDRESS_NOT_AVAILABLE,"Calling party address not available"},
729   { 4,                                  "spare"},
730   { CALLING_PARTY_ADDRESS_INCLUDED,     "Calling party address included"},
731   { 0,                                 NULL}};
732
733 static const true_false_string isup_hold_provided_ind_value = {
734   "hold provided",
735   "hold not provided"
736 };
737 static const true_false_string isup_calling_partys_category_response_ind_value = {
738   "Calling Party's category included",
739   "Calling Party's category not included",
740 };
741 static const true_false_string isup_charge_information_response_ind_value = {
742   "Charge Information included",
743   "Charge Information not included"
744 };
745 static const true_false_string isup_solicited_information_ind_value = {
746   "unsolicited",
747   "solicited"
748 };
749
750 static const true_false_string isup_continuity_ind_value = {
751   "Continuity check successful",
752   "Continuity ckec failed"
753 };
754
755 #define CHARGE_NO_IND       0
756 #define CHARGE_NO_CHARGE    1
757 #define CHARGE_CHARGE       2
758 static const value_string isup_charge_ind_value[] = {
759   { CHARGE_NO_IND,    "No indication"},
760   { CHARGE_NO_CHARGE, "No charge"},
761   { CHARGE_CHARGE,    "Charge"},
762   { 3,                "spare"},
763   { 0,                NULL}};
764
765 #define CALLED_PARTYS_STATUS_NO_IND            0
766 #define CALLED_PARTYS_STATUS_SUBSCR_FREE       1
767 #define CALLED_PARTYS_STATUS_CONNECT_WHEN_FREE 2
768 static const value_string isup_called_partys_status_ind_value[] = {
769   { CALLED_PARTYS_STATUS_NO_IND,            "No indication"},
770   { CALLED_PARTYS_STATUS_SUBSCR_FREE,       "Subscriber free"},
771   { CALLED_PARTYS_STATUS_CONNECT_WHEN_FREE, "Connect when free (national use)"},
772   { 3,                                      "spare"},
773   { 0,                NULL}};
774
775 #define CALLED_PARTYS_CATEGORY_NO_IND            0
776 #define CALLED_PARTYS_CATEGORY_ORDINARY_SUBSCR   1
777 #define CALLED_PARTYS_CATEGORY_PAYPHONE          2
778 static const value_string isup_called_partys_category_ind_value[] = {
779   { CALLED_PARTYS_CATEGORY_NO_IND,             "No indication"},
780   { CALLED_PARTYS_CATEGORY_ORDINARY_SUBSCR,    "Ordinary subscriber"},
781   { CALLED_PARTYS_CATEGORY_PAYPHONE,           "Payphone"},
782   { 3,                                         "spare"},
783   { 0,                NULL}};
784
785 static const true_false_string isup_ISDN_terminating_access_ind_value = {
786   "terminating access ISDN",
787   "terminating access non-ISDN"
788 };
789
790 static const true_false_string isup_suspend_resume_ind_value = {
791   "network initiated",
792   "ISDN subscriber initiated"
793 };
794 #define MAINTENANCE            0
795 #define HARDWARE_FAILURE       1
796 #define RES_FOR_NATNL_USE      2
797 static const value_string isup_cgs_message_type_value[] = {
798   { MAINTENANCE,            "maintenance oriented"},
799   { HARDWARE_FAILURE,       "hardware failure oriented"},
800   { RES_FOR_NATNL_USE,      "reserved for national use (ISUP'84)"},
801   { 3,                      "spare"},
802   { 0,                NULL}};
803
804 #define USER_TO_USER_SERVICE      2
805 static const value_string isup_facility_ind_value[] = {
806   { USER_TO_USER_SERVICE,     "user-to-user service"},
807   { 0,                NULL}};
808
809 #define MTC_BLCK_STATE_TRANSIENT  0
810 #define MTC_BLCK_STATE_UNEQUIPPED 3
811 static const value_string isup_mtc_blocking_state_DC00_value[] = {
812   {  MTC_BLCK_STATE_TRANSIENT,  "transient"},
813   { 1,                          "spare"},
814   { 2,                          "spare"},
815   {  MTC_BLCK_STATE_UNEQUIPPED, "unequipped"},
816   { 0,                NULL}};
817
818 #define MTC_BLCK_NO_BLOCKING      0
819 #define MTC_LOCALLY_BLOCKED       1
820 #define MTC_REMOTELY_BLOCKED      2
821 #define MTC_LOCAL_REMOTE_BLOCKED  3
822 static const value_string isup_mtc_blocking_state_DCnot00_value[] = {
823   {  MTC_BLCK_NO_BLOCKING,     "no blocking (active)"},
824   {  MTC_LOCALLY_BLOCKED,      "locally blocked"},
825   {  MTC_REMOTELY_BLOCKED,     "remotely blocked"},
826   {  MTC_LOCAL_REMOTE_BLOCKED, "locally and remotely blocked"},
827   {  0,                NULL}};
828
829 #define CALL_PROC_INCOMING_BUSY 1
830 #define CALL_PROC_OUTGOING_BUSY 2
831 #define CALL_PROC_IDLE          3
832 static const value_string isup_call_processing_state_value[] = {
833   {  CALL_PROC_INCOMING_BUSY,     "circuit incoming busy"},
834   {  CALL_PROC_OUTGOING_BUSY,     "circuit outgoing busy"},
835   {  CALL_PROC_IDLE,              "idle"},
836   {  0,                NULL}};
837
838 #define HW_BLCK_NO_BLOCKING          0
839 #define HW_LOCALLY_BLOCKED           1
840 #define HW_REMOTELY_BLOCKED          2
841 #define HW_LOCAL_REMOTE_BLOCKED      3
842 static const value_string isup_HW_blocking_state_value[] = {
843   {  HW_BLCK_NO_BLOCKING,     "no blocking (active)"},
844   {  HW_LOCALLY_BLOCKED,      "locally blocked"},
845   {  HW_REMOTELY_BLOCKED,     "remotely blocked"},
846   {  HW_LOCAL_REMOTE_BLOCKED, "locally and remotely blocked"},
847   {  0,                NULL}};
848
849 #define EVENT_ALERTING      1
850 #define EVENT_PROGRESS      2
851 #define EVENT_INBAND_INFO   3
852 #define EVENT_ON_BUSY       4
853 #define EVENT_ON_NO_REPLY   5
854 #define EVENT_UNCONDITIONAL 6
855 static const value_string isup_event_ind_value[] = {
856   /* according 3.21/Q.763 */
857   {  EVENT_ALERTING,     "ALERTING"},
858   {  EVENT_PROGRESS,     "PROGRESS"},
859   {  EVENT_INBAND_INFO,  "in-band information or an appropriate pattern is now available"},
860   {  EVENT_ON_BUSY,      "call forwarded on busy (national use)"},
861   {  EVENT_ON_NO_REPLY,  "call forwarded on no reply (national use)"},
862   {  EVENT_UNCONDITIONAL,"call forwarded unconditional (national use)"},
863   {  0,                NULL}};
864
865 static const true_false_string isup_event_presentation_restricted_ind_value = {
866   /* according 3.21/Q.763 */
867   "presentation restricted",
868   "no indication"
869 };
870 #define CUG_NON_CUG_CALL                      0
871 #define CUG_CALL_OUTGOING_ACCESS_ALLOWED      2
872 #define CUG_CALL_OUTGOING_ACCESS_NOT_ALLOWED  3
873 static const value_string isup_CUG_call_ind_value[] = {
874   /* according 3.38/Q.763 */
875   {  CUG_NON_CUG_CALL,                     "non-CUG call"},
876   {  1,                                    "spare"},
877   {  CUG_CALL_OUTGOING_ACCESS_ALLOWED,     "closed user group call, outgoing access allowed"},
878   {  CUG_CALL_OUTGOING_ACCESS_NOT_ALLOWED, "closed user group call, outgoing access not allowed"},
879   {  0,                NULL}};
880
881
882 static const true_false_string isup_simple_segmentation_ind_value = {
883   /* according 3.38/Q.763 */
884   "additional information will be sent in a segmentation message",
885   "no additional information will be sent"
886 };
887
888 static const true_false_string isup_connected_line_identity_request_ind_value = {
889   /* according 3.38/Q.763 */
890   "requested",
891   "not requested"
892 };
893
894 static const value_string isup_redirecting_ind_value[] = {
895   /* according 3.45/Q.763 */
896   {  0,        "no redirection (national use)"},
897   {  1,        "call rerouted (national use)"},
898   {  2,        "call rerouted, all redirection information presentation restricted (national use)"},
899   {  3,        "call diverted"},
900   {  4,        "call diverted, all redirection information presentation restricted"},
901   {  5,        "call rerouted, redirection number presentation restricted (national use)"},
902   {  6,        "call diversion, redirection number presentation restricted (national use)"},
903   {  7,        "spare"},
904   {  0,         NULL}};
905
906 static const value_string isup_original_redirection_reason_value[] = {
907   /* according 3.45/Q.763 */
908   {  0,        "unknown/not available"},
909   {  1,        "user busy (national use)"},
910   {  2,        "no reply (national use)"},
911   {  3,        "unconditional (national use)"},
912   {  0,         NULL}};
913
914 static const value_string isup_redirection_reason_value[] = {
915   /* according 3.45/Q.763 */
916   {  0,        "unknown/not available"},
917   {  1,        "user busy (national use)"},
918   {  2,        "no reply (national use)"},
919   {  3,        "unconditional (national use)"},
920   {  4,        "deflection during alerting"},
921   {  5,        "deflection immediate response"},
922   {  6,        "mobile subscriber not reachable"},
923   {  0,         NULL}};
924
925 static const value_string isup_type_of_network_identification_value[] = {
926   /* according 3.53/Q.763 */
927   {  0,        "CCITT/ITU-T-standardized identification"},
928   {  2,        "national network identification"},
929   {  0,         NULL}};
930
931 static const value_string isup_network_identification_plan_value[] = {
932   /* according 3.53/Q.763 */
933   {  0,        "if CCITT/ITU-T id - unknown"},
934   {  3,        "if CCITT/ITU-T id - public data network id code (X.121)"},
935   {  6,        "if CCITT/ITU-T id - public land Mobile Network id code (E.211)"},
936   {  0,         NULL}};
937
938 static const value_string isup_map_type_value[] = {
939   /* according 3.69/Q.763 */
940   {  1,        "1544 kbit/s digital path map format (64 kbit/s base rate"},
941   {  2,        "2048 kbit/s digital path map format (64 kbit/s base rate"},
942   {  0,         NULL}};
943
944 static const value_string isup_auto_congestion_level_value[] = {
945   /* according 3.4/Q.763 */
946   {  1,        "Congestion level 1 exceeded"},
947   {  2,        "Congestion level 2 exceeded"},
948   {  0,         NULL}};
949
950 static const true_false_string isup_inband_information_ind_value = {
951   /* according 3.37/Q.763 */
952   "in-band information or an appropirate pattern is now available",
953   "no indication"
954 };
955 static const true_false_string isup_call_diversion_may_occur_ind_value = {
956   /* according 3.37/Q.763 */
957   "call diversion may occur",
958   "no indication"
959 };
960 static const true_false_string isup_MLPP_user_ind_value = {
961   /* according 3.37/Q.763 */
962   "MLPP user",
963   "no indication"
964 };
965
966 static const true_false_string isup_access_delivery_ind_value = {
967   /* according 3.2/Q.763 */
968   "No set-up message generated",
969   "Set-up message generated"
970 };
971
972 static const value_string isup_loop_prevention_response_ind_value[] = {
973   /* according 3.67/Q.763 */
974   {  0,        "insufficient information"},
975   {  1,        "no loop exists"},
976   {  2,        "simultaneous transfer"},
977   {  0,         NULL}};
978
979 static const true_false_string isup_temporary_alternative_routing_ind_value = {
980   /* according 3.68/Q.763 */
981   "TAR controlled call",
982   "no indication"
983 };
984 static const true_false_string isup_extension_ind_value = {
985   /* according 3.68/Q.763 */
986   "last octet",
987   "information continues through the next octet"
988 };
989
990
991
992 static const value_string isup_call_to_be_diverted_ind_value[] = {
993   /* according 3.72/Q.763 */
994   {  0,        "no indication"},
995   {  1,        "call diversion allowed"},
996   {  2,        "call diversion not allowed"},
997   {  3,        "spare"},
998   {  0,         NULL}};
999
1000 static const value_string isup_call_to_be_offered_ind_value[] = {
1001   /* according 3.72/Q.763 */
1002   {  0,        "no indication"},
1003   {  1,        "call offering not allowed"},
1004   {  2,        "call offering allowed"},
1005   {  3,        "spare"},
1006   {  0,         NULL}};
1007
1008 static const value_string isup_conference_acceptance_ind_value[] = {
1009   /* according 3.76/Q.763 */
1010   {  0,        "no indication"},
1011   {  1,        "accept conference request"},
1012   {  2,        "reject conference request"},
1013   {  3,        "spare"},
1014   {  0,         NULL}};
1015
1016 static const value_string isup_application_transport_parameter_value[] = {
1017   /* according 3.82/Q.763 */
1018   {  0,         "Unidentified Context and Error Handling (UCEH) ASE"},
1019   {  1,         "PSS1 ASE (VPN)"},
1020   {  2,         "spare"},
1021   {  3,         "Charging ASE"},
1022   {  4,         "GAT"},
1023   {  5,         "BAT ASE"},
1024   {  6,         "Enhanced Unidentified Context and Error Handling ASE (EUCEH ASE)"},
1025   {  0,         NULL}};
1026
1027 static const true_false_string isup_Release_call_indicator_value = {
1028   "release call",
1029   "do not release call"
1030 };
1031
1032 static const true_false_string isup_Send_notification_ind_value = {
1033   "send notification",
1034   "do not send notification"
1035 };
1036 static const value_string isup_APM_segmentation_ind_value[] = {
1037  
1038   {  0x00,                     "final segment"},
1039   {  0x01,                     "number of following segments"},
1040   {  0x02,                     "number of following segments"},
1041   {  0x03,                     "number of following segments"},
1042   {  0x04,                     "number of following segments"},
1043   {  0x05,                     "number of following segments"},
1044   {  0x06,                     "number of following segments"},
1045   {  0x07,                     "number of following segments"},
1046   {  0x08,                     "number of following segments"},
1047   {  0x09,                     "number of following segments"},
1048   {  0,                NULL}};
1049
1050 static const true_false_string isup_Sequence_ind_value = {
1051   "new sequence",
1052   "subsequent segment to first segment"
1053 };
1054
1055
1056 /* Generalized bit masks for 8 and 16 bits fields */
1057 #define A_8BIT_MASK  0x01
1058 #define B_8BIT_MASK  0x02
1059 #define C_8BIT_MASK  0x04
1060 #define D_8BIT_MASK  0x08
1061 #define E_8BIT_MASK  0x10
1062 #define F_8BIT_MASK  0x20
1063 #define G_8BIT_MASK  0x40
1064 #define H_8BIT_MASK  0x80
1065
1066 #define BA_8BIT_MASK 0x03
1067 #define CB_8BIT_MASK 0x06
1068 #define DC_8BIT_MASK 0x0C
1069 #define ED_8BIT_MASK 0x18
1070 #define FE_8BIT_MASK 0x30
1071 #define GF_8BIT_MASK 0x60
1072 #define HG_8BIT_MASK 0xC0
1073 #define GFE_8BIT_MASK 0x70
1074 #define DCBA_8BIT_MASK 0x0F
1075 #define EDCBA_8BIT_MASK 0x1F
1076 #define HGFE_8BIT_MASK 0xF0
1077 #define GFEDCBA_8BIT_MASK 0x7F
1078 #define FEDCBA_8BIT_MASK 0x3F
1079
1080 #define A_16BIT_MASK  0x0100
1081 #define B_16BIT_MASK  0x0200
1082 #define C_16BIT_MASK  0x0400
1083 #define D_16BIT_MASK  0x0800
1084 #define E_16BIT_MASK  0x1000
1085 #define F_16BIT_MASK  0x2000
1086 #define G_16BIT_MASK  0x4000
1087 #define H_16BIT_MASK  0x8000
1088 #define I_16BIT_MASK  0x0001
1089 #define J_16BIT_MASK  0x0002
1090 #define K_16BIT_MASK  0x0004
1091 #define L_16BIT_MASK  0x0008
1092 #define M_16BIT_MASK  0x0010
1093 #define N_16BIT_MASK  0x0020
1094 #define O_16BIT_MASK  0x0040
1095 #define P_16BIT_MASK  0x0080
1096
1097 #define BA_16BIT_MASK 0x0300
1098 #define CB_16BIT_MASK 0x0600
1099 #define DC_16BIT_MASK 0x0C00
1100 #define FE_16BIT_MASK 0x3000
1101 #define HG_16BIT_MASK 0xC000
1102 #define KJ_16BIT_MASK 0x0006
1103 #define PO_16BIT_MASK 0x00C0
1104
1105 #define CBA_16BIT_MASK 0x0700
1106 #define KJI_16BIT_MASK 0x0007
1107 #define HGFE_16BIT_MASK 0xF000
1108 #define PONM_16BIT_MASK 0x00F0
1109
1110 /* Initialize the protocol and registered fields */
1111 static int proto_isup = -1;
1112 static int proto_bicc = -1;
1113 static module_t *isup_module;
1114
1115 static gboolean isup_show_cic_in_info = TRUE;
1116
1117 static int hf_isup_called = -1;
1118 static int hf_isup_calling = -1;
1119 static int hf_isup_redirecting = -1;
1120
1121 static int hf_isup_cic = -1;
1122 static int hf_bicc_cic = -1;
1123
1124 static int isup_tap = -1;
1125
1126 static int hf_isup_message_type = -1;
1127 static int hf_isup_parameter_type = -1;
1128 static int hf_isup_parameter_length = -1;
1129 static int hf_isup_mandatory_variable_parameter_pointer = -1;
1130 static int hf_isup_pointer_to_start_of_optional_part = -1;
1131
1132 static int hf_isup_satellite_indicator = -1;
1133 static int hf_isup_continuity_check_indicator = -1;
1134 static int hf_isup_echo_control_device_indicator = -1;
1135
1136 static int hf_isup_forw_call_natnl_inatnl_call_indicator = -1;
1137 static int hf_isup_forw_call_end_to_end_method_indicator = -1;
1138 static int hf_isup_forw_call_interworking_indicator = -1;
1139 static int hf_isup_forw_call_end_to_end_info_indicator = -1;
1140 static int hf_isup_forw_call_isdn_user_part_indicator = -1;
1141 static int hf_isup_forw_call_preferences_indicator = -1;
1142 static int hf_isup_forw_call_isdn_access_indicator = -1;
1143 static int hf_isup_forw_call_sccp_method_indicator = -1;
1144
1145 static int hf_isup_calling_partys_category = -1;
1146
1147 static int hf_isup_transmission_medium_requirement = -1;
1148
1149 static int hf_isup_odd_even_indicator = -1;
1150 static int hf_isup_called_party_nature_of_address_indicator = -1;
1151 static int hf_isup_calling_party_nature_of_address_indicator = -1;
1152 static int hf_isup_inn_indicator = -1;
1153 static int hf_isup_ni_indicator = -1;
1154 static int hf_isup_numbering_plan_indicator = -1;
1155 static int hf_isup_address_presentation_restricted_indicator = -1;
1156 static int hf_isup_screening_indicator = -1;
1157 static int hf_isup_screening_indicator_enhanced = -1;
1158 static int hf_isup_called_party_odd_address_signal_digit = -1;
1159 static int hf_isup_calling_party_odd_address_signal_digit = -1;
1160 static int hf_isup_called_party_even_address_signal_digit               = -1;
1161 static int hf_isup_calling_party_even_address_signal_digit              = -1;
1162
1163 static int hf_isup_OECD_inf_ind                                         = -1;
1164 static int hf_isup_IECD_inf_ind                                         = -1;
1165 static int hf_isup_OECD_req_ind                                         = -1;
1166 static int hf_isup_IECD_req_ind                                         = -1;
1167
1168 static int hf_isup_calling_party_address_request_indicator = -1;
1169 static int hf_isup_info_req_holding_indicator = -1;
1170 static int hf_isup_calling_partys_category_request_indicator = -1;
1171 static int hf_isup_charge_information_request_indicator = -1;
1172 static int hf_isup_malicious_call_identification_request_indicator = -1;
1173
1174 static int hf_isup_calling_party_address_response_indicator = -1;
1175 static int hf_isup_hold_provided_indicator = -1;
1176 static int hf_isup_calling_partys_category_response_indicator = -1;
1177 static int hf_isup_charge_information_response_indicator = -1;
1178 static int hf_isup_solicited_indicator = -1;
1179
1180 static int hf_isup_continuity_indicator = -1;
1181
1182 static int hf_isup_backw_call_charge_ind = -1 ;
1183 static int hf_isup_backw_call_called_partys_status_ind = -1;
1184 static int hf_isup_backw_call_called_partys_category_ind = -1;
1185 static int hf_isup_backw_call_end_to_end_method_ind = -1;
1186 static int hf_isup_backw_call_interworking_ind = -1;
1187 static int hf_isup_backw_call_end_to_end_info_ind = -1;
1188 static int hf_isup_backw_call_isdn_user_part_ind = -1;
1189 static int hf_isup_backw_call_holding_ind = -1;
1190 static int hf_isup_backw_call_isdn_access_ind = -1;
1191 static int hf_isup_backw_call_echo_control_device_ind = -1;
1192 static int hf_isup_backw_call_sccp_method_ind = -1;
1193
1194 static int hf_isup_cause_indicator = -1;
1195
1196 static int hf_isup_suspend_resume_indicator = -1;
1197
1198 static int hf_isup_range_indicator = -1;
1199 static int hf_isup_cgs_message_type = -1;
1200
1201 static int hf_isup_mtc_blocking_state1 = -1;
1202 static int hf_isup_mtc_blocking_state2 = -1;
1203 static int hf_isup_call_proc_state = -1;
1204 static int hf_isup_hw_blocking_state = -1;
1205
1206 static int hf_isup_event_ind = -1;
1207 static int hf_isup_event_presentation_restricted_ind = -1;
1208
1209 static int hf_isup_cug_call_ind = -1;
1210 static int hf_isup_simple_segmentation_ind = -1;
1211 static int hf_isup_connected_line_identity_request_ind = -1;
1212
1213 static int hf_isup_redirecting_ind = -1;
1214 static int hf_isup_original_redirection_reason = -1;
1215 static int hf_isup_redirection_counter = -1;
1216 static int hf_isup_redirection_reason = -1;
1217
1218 static int hf_isup_type_of_network_identification = -1;
1219 static int hf_isup_network_identification_plan = -1;
1220
1221 static int hf_isup_map_type = -1;
1222
1223 static int hf_isup_automatic_congestion_level                           = -1;
1224
1225 static int hf_isup_inband_information_ind                                       = -1;
1226 static int hf_isup_call_diversion_may_occur_ind                         = -1;
1227 static int hf_isup_mlpp_user_ind                                                        = -1;
1228
1229 static int hf_isup_UUI_type                                                                     = -1;
1230 static int hf_isup_UUI_req_service1                                                     = -1;
1231 static int hf_isup_UUI_req_service2                                                     = -1;
1232 static int hf_isup_UUI_req_service3                                                     = -1;
1233 static int hf_isup_UUI_res_service1                                                     = -1;
1234 static int hf_isup_UUI_res_service2                                                     = -1;
1235 static int hf_isup_UUI_res_service3                                                     = -1;
1236 static int hf_isup_UUI_network_discard_ind                                      = -1;
1237 static int hf_isup_access_delivery_ind                                          = -1;
1238
1239 static int hf_isup_transmission_medium_requirement_prime        = -1;
1240
1241 static int hf_isup_loop_prevention_response_ind                         = -1;
1242
1243 static int hf_isup_temporary_alternative_routing_ind            = -1;
1244 static int hf_isup_extension_ind                                                        = -1;
1245
1246 static int hf_isup_call_to_be_diverted_ind                                      = -1;
1247
1248 static int hf_isup_call_to_be_offered_ind                                       = -1;
1249
1250 static int hf_isup_conference_acceptance_ind                            = -1;
1251
1252 static int hf_isup_transit_at_intermediate_exchange_ind         = -1;
1253 static int hf_isup_Release_call_ind                                             = -1;
1254 static int hf_isup_Send_notification_ind                                        = -1;
1255 static int hf_isup_Discard_message_ind_value                            = -1;
1256 static int hf_isup_Discard_parameter_ind                                        = -1;
1257 static int hf_isup_Pass_on_not_possible_indicator                       = -1;
1258 static int hf_isup_pass_on_not_possible_indicator2                      = -1;
1259 static int hf_isup_Broadband_narrowband_interworking_ind        = -1;
1260 static int hf_isup_Broadband_narrowband_interworking_ind2       = -1;
1261
1262 static int hf_isup_app_cont_ident                                       = -1;
1263 static int hf_isup_app_Send_notification_ind            = -1;
1264 static int hf_isup_apm_segmentation_ind                         = -1;
1265 static int hf_isup_apm_si_ind                                           = -1;
1266 static int hf_isup_apm_slr                                                      = -1;
1267 static int hf_isup_orig_addr_len                                        = -1;
1268 static int hf_isup_dest_addr_len                                        = -1;
1269 static int hf_isup_app_Release_call_ind                         = -1;
1270 static int hf_length_indicator                                          = -1;
1271 static int hf_afi                                                                       = -1;
1272 static int hf_bicc_nsap_dsp                                                     = -1;
1273 static int hf_bat_ase_identifier                                        = -1;
1274         
1275 static int hf_Action_Indicator                                          = -1;
1276
1277 static int hf_Instruction_ind_for_general_action                                = -1;   
1278
1279 static int hf_Send_notification_ind_for_general_action                  = -1;
1280
1281 static int hf_Instruction_ind_for_pass_on_not_possible                  = -1;
1282
1283 static int hf_Send_notification_ind_for_pass_on_not_possible    = -1;
1284 static int hf_BCTP_Version_Indicator                                    = -1;
1285 static int hf_Tunnelled_Protocol_Indicator                              = -1;
1286 static int hf_TPEI                                                      = -1;
1287 static int hf_BVEI                                                      = -1;
1288 static int hf_bncid                                                     = -1;
1289 static int hf_bat_ase_biwfa                                             = -1;
1290 static int hf_characteristics                                           = -1;
1291
1292 static int hf_Organization_Identifier                                   = -1;
1293 static int hf_codec_type                                                = -1;
1294 static int hf_etsi_codec_type                                           = -1;
1295 static int hf_active_code_set  = -1;
1296 static int hf_active_code_set_12_2  = -1;
1297 static int hf_active_code_set_10_2  = -1;
1298 static int hf_active_code_set_7_95  = -1;
1299 static int hf_active_code_set_7_40  = -1;
1300 static int hf_active_code_set_6_70  = -1;
1301 static int hf_active_code_set_5_90  = -1;
1302 static int hf_active_code_set_5_15  = -1;
1303 static int hf_active_code_set_4_75  = -1;
1304 static int hf_supported_code_set  = -1;
1305 static int hf_supported_code_set_12_2  = -1;
1306 static int hf_supported_code_set_10_2  = -1;
1307 static int hf_supported_code_set_7_95  = -1;
1308 static int hf_supported_code_set_7_40  = -1;
1309 static int hf_supported_code_set_6_70  = -1;
1310 static int hf_supported_code_set_5_90  = -1;
1311 static int hf_supported_code_set_5_15  = -1;
1312 static int hf_supported_code_set_4_75  = -1;
1313 static int hf_initial_codec_mode  = -1;
1314 static int hf_max_codec_modes  = -1;
1315 static int hf_bearer_control_tunneling                  = -1;
1316 static int hf_Local_BCU_ID                                              = -1;
1317 static int hf_late_cut_trough_cap_ind                   = -1;
1318 static int hf_bat_ase_signal                                    = -1;
1319 static int hf_bat_ase_duration                                  = -1;
1320 static int hf_bat_ase_bearer_redir_ind                  = -1;
1321 static int hf_BAT_ASE_Comp_Report_Reason                = -1;
1322 static int hf_BAT_ASE_Comp_Report_ident                 = -1;
1323 static int hf_BAT_ASE_Comp_Report_diagnostic    = -1;
1324 static int hf_nsap_ipv4_addr                                    = -1;
1325 static int hf_nsap_ipv6_addr                                    = -1;
1326 static int hf_iana_icp                                                  = -1;
1327
1328 static int hf_isup_apm_msg_fragments = -1;
1329 static int hf_isup_apm_msg_fragment = -1;
1330 static int hf_isup_apm_msg_fragment_overlap = -1;
1331 static int hf_isup_apm_msg_fragment_overlap_conflicts = -1;
1332 static int hf_isup_apm_msg_fragment_multiple_tails = -1;
1333 static int hf_isup_apm_msg_fragment_too_long_fragment = -1;
1334 static int hf_isup_apm_msg_fragment_error = -1;
1335 static int hf_isup_apm_msg_reassembled_in = -1;
1336  
1337 /* Initialize the subtree pointers */
1338 static gint ett_isup                                                    = -1;
1339 static gint ett_isup_parameter                                  = -1;
1340 static gint ett_isup_address_digits                     = -1;
1341 static gint ett_isup_pass_along_message                 = -1;
1342 static gint ett_isup_circuit_state_ind                  = -1;
1343 static gint ett_bat_ase                                                 = -1;   
1344 static gint ett_bicc                                                    = -1;
1345 static gint ett_bat_ase_element                                 = -1;
1346 static gint ett_bat_ase_iwfa                                    = -1;
1347 static gint ett_acs                                                             = -1;
1348 static gint ett_scs                                                             = -1;
1349
1350 static gint ett_isup_apm_msg_fragment = -1;
1351 static gint ett_isup_apm_msg_fragments = -1;
1352
1353
1354 static dissector_handle_t sdp_handle = NULL;
1355 static dissector_handle_t q931_ie_handle = NULL; 
1356
1357 /* Declarations to desegment APM Messages */
1358 static gboolean isup_apm_desegment = TRUE;
1359
1360 static const fragment_items isup_apm_msg_frag_items = {
1361         /* Fragment subtrees */
1362         &ett_isup_apm_msg_fragment,
1363         &ett_isup_apm_msg_fragments,
1364         /* Fragment fields */
1365         &hf_isup_apm_msg_fragments,
1366         &hf_isup_apm_msg_fragment,
1367         &hf_isup_apm_msg_fragment_overlap,
1368         &hf_isup_apm_msg_fragment_overlap_conflicts,
1369         &hf_isup_apm_msg_fragment_multiple_tails,
1370         &hf_isup_apm_msg_fragment_too_long_fragment,
1371         &hf_isup_apm_msg_fragment_error,
1372         /* Reassembled in field */
1373         &hf_isup_apm_msg_reassembled_in,
1374         /* Tag */
1375         "ISUP APM Message fragments"
1376 };
1377
1378 static GHashTable *isup_apm_msg_fragment_table = NULL;
1379 static GHashTable *isup_apm_msg_reassembled_table = NULL;
1380
1381
1382 static void
1383 isup_apm_defragment_init(void)
1384 {
1385         fragment_table_init (&isup_apm_msg_fragment_table);
1386         reassembled_table_init(&isup_apm_msg_reassembled_table);
1387 }
1388
1389 /* Info for the tap that must be passed between procedures */
1390 gchar *tap_called_number = NULL;
1391 gchar *tap_calling_number = NULL;
1392 guint8 tap_cause_value = 0;
1393
1394 /* ------------------------------------------------------------------
1395   Mapping number to ASCII-character
1396  ------------------------------------------------------------------ */
1397 static char number_to_char(int number)
1398 {
1399   if (number < 10)
1400     return ((char) number + ASCII_NUMBER_DELTA);
1401   else
1402     return ((char) number + ASCII_LETTER_DELTA);
1403 }
1404
1405
1406 /* ------------------------------------------------------------------ */
1407 /* Dissectors for all used parameter types                            */
1408 /* ------------------------------------------------------------------ */
1409 /* argument tvbuff_t contains only parameter-specific length          */
1410 /* length indicator is already dissected in dissect_isup_message() or */
1411 /* dissect_isup_optional_parameter()                                  */
1412 /* ------------------------------------------------------------------ */
1413
1414 /* ------------------------------------------------------------------
1415  Dissector Parameter nature of connection flags
1416  */
1417 static void
1418 dissect_isup_nature_of_connection_indicators_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
1419 {
1420   guint8 nature_of_connection_ind;
1421
1422   nature_of_connection_ind = tvb_get_guint8(parameter_tvb, 0);
1423   proto_tree_add_uint(parameter_tree, hf_isup_satellite_indicator, parameter_tvb, 0,NATURE_OF_CONNECTION_IND_LENGTH, nature_of_connection_ind);
1424   proto_tree_add_uint(parameter_tree, hf_isup_continuity_check_indicator, parameter_tvb, 0,NATURE_OF_CONNECTION_IND_LENGTH, nature_of_connection_ind);
1425   proto_tree_add_boolean(parameter_tree, hf_isup_echo_control_device_indicator, parameter_tvb, 0,  NATURE_OF_CONNECTION_IND_LENGTH, nature_of_connection_ind);
1426
1427   proto_item_set_text(parameter_item, "Nature of Connection Indicators: 0x%x", nature_of_connection_ind);
1428 }
1429
1430 /* ------------------------------------------------------------------
1431  Dissector Parameter Forward Call Indicators
1432  */
1433 static void
1434 dissect_isup_forward_call_indicators_parameter(tvbuff_t *parameter_tvb,proto_tree *parameter_tree, proto_item *parameter_item)
1435 {
1436   guint16 forward_call_ind;
1437
1438   forward_call_ind = tvb_get_ntohs(parameter_tvb, 0);
1439   proto_tree_add_boolean(parameter_tree, hf_isup_forw_call_natnl_inatnl_call_indicator, parameter_tvb, 0, FORWARD_CALL_IND_LENGTH, forward_call_ind);
1440   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);
1441   proto_tree_add_boolean(parameter_tree, hf_isup_forw_call_interworking_indicator, parameter_tvb, 0, FORWARD_CALL_IND_LENGTH, forward_call_ind);
1442   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);
1443   proto_tree_add_boolean(parameter_tree, hf_isup_forw_call_isdn_user_part_indicator, parameter_tvb, 0, FORWARD_CALL_IND_LENGTH, forward_call_ind);
1444   proto_tree_add_uint(parameter_tree, hf_isup_forw_call_preferences_indicator, parameter_tvb, 0, FORWARD_CALL_IND_LENGTH, forward_call_ind);
1445   proto_tree_add_boolean(parameter_tree, hf_isup_forw_call_isdn_access_indicator, parameter_tvb, 0, FORWARD_CALL_IND_LENGTH, forward_call_ind);
1446   proto_tree_add_uint(parameter_tree, hf_isup_forw_call_sccp_method_indicator, parameter_tvb, 0, FORWARD_CALL_IND_LENGTH, forward_call_ind);
1447
1448   proto_item_set_text(parameter_item, "Forward Call Indicators: 0x%x", forward_call_ind );
1449 }
1450
1451 /* ------------------------------------------------------------------
1452  Dissector Parameter Calling Party's Category
1453  */
1454 static void
1455 dissect_isup_calling_partys_category_parameter(tvbuff_t *parameter_tvb,proto_tree *parameter_tree, proto_item *parameter_item)
1456 {
1457   guint8 calling_partys_category;
1458
1459   calling_partys_category = tvb_get_guint8(parameter_tvb, 0);
1460   proto_tree_add_uint(parameter_tree, hf_isup_calling_partys_category, parameter_tvb, 0, CALLING_PRTYS_CATEGORY_LENGTH, calling_partys_category);
1461
1462   proto_item_set_text(parameter_item, "Calling Party's category: 0x%x (%s)", calling_partys_category, val_to_str(calling_partys_category, isup_calling_partys_category_value, "reserved/spare"));
1463 }
1464
1465
1466 /* ------------------------------------------------------------------
1467   Dissector Parameter Transmission medium requirement
1468  */
1469 static void
1470 dissect_isup_transmission_medium_requirement_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
1471 {
1472   guint8 transmission_medium_requirement;
1473
1474   transmission_medium_requirement = tvb_get_guint8(parameter_tvb, 0);
1475   proto_tree_add_uint(parameter_tree, hf_isup_transmission_medium_requirement, parameter_tvb, 0, TRANSMISSION_MEDIUM_REQUIREMENT_LENGTH,transmission_medium_requirement);
1476
1477   proto_item_set_text(parameter_item, "Transmission medium requirement: %u (%s)",  transmission_medium_requirement, val_to_str(transmission_medium_requirement, isup_transmission_medium_requirement_value, "spare"));
1478 }
1479 /* ------------------------------------------------------------------
1480   Dissector Parameter Called party number
1481  */
1482 void
1483 dissect_isup_called_party_number_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
1484 {
1485   proto_item *address_digits_item;
1486   proto_tree *address_digits_tree;
1487   guint8 indicators1, indicators2;
1488   guint8 address_digit_pair=0;
1489   gint offset=0;
1490   gint i=0;
1491   gint length;
1492   char called_number[MAXDIGITS + 1]="";
1493   e164_info_t e164_info;
1494   gint number_plan;
1495
1496   indicators1 = tvb_get_guint8(parameter_tvb, 0);
1497   proto_tree_add_boolean(parameter_tree, hf_isup_odd_even_indicator, parameter_tvb, 0, 1, indicators1);
1498   proto_tree_add_uint(parameter_tree, hf_isup_called_party_nature_of_address_indicator, parameter_tvb, 0, 1, indicators1);
1499   indicators2 = tvb_get_guint8(parameter_tvb, 1);
1500   number_plan = (indicators2 & 0x70)>> 4;
1501   proto_tree_add_boolean(parameter_tree, hf_isup_inn_indicator, parameter_tvb, 1, 1, indicators2);
1502   proto_tree_add_uint(parameter_tree, hf_isup_numbering_plan_indicator, parameter_tvb, 1, 1, indicators2);
1503   offset = 2;
1504
1505   address_digits_item = proto_tree_add_text(parameter_tree, parameter_tvb,
1506                                             offset, -1,
1507                                             "Called Party Number");
1508   address_digits_tree = proto_item_add_subtree(address_digits_item, ett_isup_address_digits);
1509
1510   while((length = tvb_reported_length_remaining(parameter_tvb, offset)) > 0){
1511           address_digit_pair = tvb_get_guint8(parameter_tvb, offset);
1512           proto_tree_add_uint(address_digits_tree, hf_isup_called_party_odd_address_signal_digit, parameter_tvb, offset, 1, address_digit_pair);
1513           called_number[i++] = number_to_char(address_digit_pair & ISUP_ODD_ADDRESS_SIGNAL_DIGIT_MASK);
1514                 if (i > MAXDIGITS)
1515                         THROW(ReportedBoundsError);
1516                 if ((length - 1) > 0 ){
1517                         proto_tree_add_uint(address_digits_tree, hf_isup_called_party_even_address_signal_digit, parameter_tvb, offset, 1, address_digit_pair);
1518                         called_number[i++] = number_to_char((address_digit_pair & ISUP_EVEN_ADDRESS_SIGNAL_DIGIT_MASK) / 0x10);
1519                         if (i > MAXDIGITS)
1520                                 THROW(ReportedBoundsError);
1521                         }
1522                 offset++;
1523                 }
1524   if  (((indicators1 & 0x80) == 0) && (tvb_length(parameter_tvb) > 0)){ /* Even Indicator set -> last even digit is valid & has be displayed */
1525                 proto_tree_add_uint(address_digits_tree, hf_isup_called_party_even_address_signal_digit, parameter_tvb, offset - 1, 1, address_digit_pair);
1526                 called_number[i++] = number_to_char((address_digit_pair & ISUP_EVEN_ADDRESS_SIGNAL_DIGIT_MASK) / 0x10);
1527                 if (i > MAXDIGITS)
1528                         THROW(ReportedBoundsError);
1529   }
1530
1531   called_number[i++] = '\0';
1532   proto_item_set_text(address_digits_item, "Called Party Number: %s", called_number);
1533   proto_item_set_text(parameter_item, "Called Party Number: %s", called_number);
1534   if ( number_plan == 1 ) {
1535                 e164_info.e164_number_type = CALLED_PARTY_NUMBER;
1536                 e164_info.nature_of_address = indicators1 & 0x7f;
1537                 e164_info.E164_number_str = called_number;
1538                 e164_info.E164_number_length = i - 1;
1539                 dissect_e164_number(parameter_tvb, address_digits_tree, 2, (offset - 2), e164_info);
1540                 proto_tree_add_string_hidden(address_digits_tree, hf_isup_called, parameter_tvb,
1541                 offset - length, length, called_number);
1542   } else {
1543                 proto_tree_add_string(address_digits_tree, hf_isup_called, parameter_tvb, 
1544                         offset - length, length, called_number);
1545   }
1546   tap_called_number = ep_strdup(called_number);
1547 }
1548 /* ------------------------------------------------------------------
1549   Dissector Parameter  Subsequent number
1550  */
1551 static void
1552 dissect_isup_subsequent_number_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
1553 {
1554   proto_item *address_digits_item;
1555   proto_tree *address_digits_tree;
1556   guint8 indicators1;
1557   guint8 address_digit_pair=0;
1558   gint offset=0;
1559   gint i=0;
1560   gint length;
1561   char called_number[MAXDIGITS + 1]="";
1562
1563   indicators1 = tvb_get_guint8(parameter_tvb, 0);
1564   proto_tree_add_boolean(parameter_tree, hf_isup_odd_even_indicator, parameter_tvb, 0, 1, indicators1);
1565   offset = 1;
1566
1567   address_digits_item = proto_tree_add_text(parameter_tree, parameter_tvb,
1568                                             offset, -1,
1569                                             "Subsequent Number");
1570   address_digits_tree = proto_item_add_subtree(address_digits_item, ett_isup_address_digits);
1571
1572   while((length = tvb_reported_length_remaining(parameter_tvb, offset)) > 0){
1573     address_digit_pair = tvb_get_guint8(parameter_tvb, offset);
1574     proto_tree_add_uint(address_digits_tree, hf_isup_called_party_odd_address_signal_digit, parameter_tvb, offset, 1, address_digit_pair);
1575     called_number[i++] = number_to_char(address_digit_pair & ISUP_ODD_ADDRESS_SIGNAL_DIGIT_MASK);
1576     if (i > MAXDIGITS)
1577       THROW(ReportedBoundsError);
1578     if ((length - 1) > 0 ){
1579       proto_tree_add_uint(address_digits_tree, hf_isup_called_party_even_address_signal_digit, parameter_tvb, offset, 1, address_digit_pair);
1580       called_number[i++] = number_to_char((address_digit_pair & ISUP_EVEN_ADDRESS_SIGNAL_DIGIT_MASK) / 0x10);
1581       if (i > MAXDIGITS)
1582         THROW(ReportedBoundsError);
1583     }
1584     offset++;
1585   }
1586
1587   if (((indicators1 & 0x80) == 0) && (tvb_length(parameter_tvb) > 0)){ /* Even Indicator set -> last even digit is valid & has be displayed */
1588       proto_tree_add_uint(address_digits_tree, hf_isup_called_party_even_address_signal_digit, parameter_tvb, offset - 1, 1, address_digit_pair);
1589       called_number[i++] = number_to_char((address_digit_pair & ISUP_EVEN_ADDRESS_SIGNAL_DIGIT_MASK) / 0x10);
1590       if (i > MAXDIGITS)
1591         THROW(ReportedBoundsError);
1592   }
1593   called_number[i++] = '\0';
1594
1595   proto_item_set_text(address_digits_item, "Subsequent Number: %s", called_number);
1596   proto_item_set_text(parameter_item, "Subsequent Number: %s", called_number);
1597
1598 }
1599 /* ------------------------------------------------------------------
1600   Dissector Parameter Information Request Indicators
1601  */
1602 static void
1603 dissect_isup_information_request_indicators_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
1604 {
1605   guint16 information_request_indicators;
1606
1607   information_request_indicators = tvb_get_ntohs(parameter_tvb, 0);
1608   proto_tree_add_boolean(parameter_tree, hf_isup_calling_party_address_request_indicator, parameter_tvb, 0, INFO_REQUEST_IND_LENGTH,  information_request_indicators);
1609   proto_tree_add_boolean(parameter_tree, hf_isup_info_req_holding_indicator, parameter_tvb, 0, INFO_REQUEST_IND_LENGTH,  information_request_indicators);
1610   proto_tree_add_boolean(parameter_tree, hf_isup_calling_partys_category_request_indicator, parameter_tvb, 0, INFO_REQUEST_IND_LENGTH,  information_request_indicators);
1611   proto_tree_add_boolean(parameter_tree, hf_isup_charge_information_request_indicator, parameter_tvb, 0, INFO_REQUEST_IND_LENGTH,  information_request_indicators);
1612   proto_tree_add_boolean(parameter_tree, hf_isup_malicious_call_identification_request_indicator, parameter_tvb, 0, INFO_REQUEST_IND_LENGTH,  information_request_indicators);
1613
1614
1615   proto_item_set_text(parameter_item, "Information request indicators: 0x%x", information_request_indicators);
1616 }
1617 /* ------------------------------------------------------------------
1618   Dissector Parameter Information Indicators
1619  */
1620 static void
1621 dissect_isup_information_indicators_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
1622 {
1623   guint16 information_indicators;
1624
1625   information_indicators = tvb_get_ntohs(parameter_tvb, 0);
1626   proto_tree_add_uint(parameter_tree, hf_isup_calling_party_address_response_indicator, parameter_tvb, 0, INFO_IND_LENGTH,  information_indicators);
1627   proto_tree_add_boolean(parameter_tree, hf_isup_hold_provided_indicator, parameter_tvb, 0, INFO_IND_LENGTH,  information_indicators);
1628   proto_tree_add_boolean(parameter_tree, hf_isup_calling_partys_category_response_indicator, parameter_tvb, 0, INFO_IND_LENGTH,  information_indicators);
1629   proto_tree_add_boolean(parameter_tree, hf_isup_charge_information_response_indicator, parameter_tvb, 0, INFO_IND_LENGTH,  information_indicators);
1630   proto_tree_add_boolean(parameter_tree, hf_isup_solicited_indicator, parameter_tvb, 0, INFO_IND_LENGTH,  information_indicators);
1631
1632
1633   proto_item_set_text(parameter_item, "Information indicators: 0x%x", information_indicators);
1634 }
1635 /* ------------------------------------------------------------------
1636   Dissector Parameter Continuity Indicators
1637  */
1638 static void
1639 dissect_isup_continuity_indicators_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
1640 {
1641   guint8 continuity_indicators;
1642
1643   continuity_indicators = tvb_get_guint8(parameter_tvb, 0);
1644   proto_tree_add_boolean(parameter_tree, hf_isup_continuity_indicator, parameter_tvb, 0, CONTINUITY_IND_LENGTH,  continuity_indicators);
1645
1646   proto_item_set_text(parameter_item, "Continuity indicators: 0x%x", continuity_indicators);
1647 }
1648 /* ------------------------------------------------------------------
1649  Dissector Parameter Backward Call Indicators
1650  */
1651 static void
1652 dissect_isup_backward_call_indicators_parameter(tvbuff_t *parameter_tvb,proto_tree *parameter_tree, proto_item *parameter_item)
1653 {
1654   guint16 backward_call_ind;
1655
1656   backward_call_ind = tvb_get_ntohs(parameter_tvb, 0);
1657
1658
1659   proto_tree_add_uint(parameter_tree, hf_isup_backw_call_charge_ind, parameter_tvb, 0, BACKWARD_CALL_IND_LENGTH, backward_call_ind);
1660   proto_tree_add_uint(parameter_tree, hf_isup_backw_call_called_partys_status_ind, parameter_tvb, 0, BACKWARD_CALL_IND_LENGTH, backward_call_ind);
1661   proto_tree_add_uint(parameter_tree, hf_isup_backw_call_called_partys_category_ind, parameter_tvb, 0, BACKWARD_CALL_IND_LENGTH, backward_call_ind);
1662   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);
1663   proto_tree_add_boolean(parameter_tree, hf_isup_backw_call_interworking_ind, parameter_tvb, 0, BACKWARD_CALL_IND_LENGTH, backward_call_ind);
1664   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);
1665   proto_tree_add_boolean(parameter_tree, hf_isup_backw_call_isdn_user_part_ind, parameter_tvb, 0, BACKWARD_CALL_IND_LENGTH, backward_call_ind);
1666   proto_tree_add_boolean(parameter_tree, hf_isup_backw_call_holding_ind, parameter_tvb, 0, BACKWARD_CALL_IND_LENGTH,  backward_call_ind);
1667   proto_tree_add_boolean(parameter_tree, hf_isup_backw_call_isdn_access_ind, parameter_tvb, 0, BACKWARD_CALL_IND_LENGTH, backward_call_ind);
1668   proto_tree_add_boolean(parameter_tree, hf_isup_backw_call_echo_control_device_ind, parameter_tvb, 0, BACKWARD_CALL_IND_LENGTH, backward_call_ind);
1669   proto_tree_add_uint(parameter_tree, hf_isup_backw_call_sccp_method_ind, parameter_tvb, 0, BACKWARD_CALL_IND_LENGTH, backward_call_ind);
1670
1671   proto_item_set_text(parameter_item, "Backward Call Indicators: 0x%x", backward_call_ind);
1672 }
1673 /* ------------------------------------------------------------------
1674   Dissector Parameter Cause Indicators - no detailed dissection since defined in Rec. Q.850
1675  */
1676
1677 /*
1678  * Cause codes for Cause.
1679  * The decoding of cause indicators parameter field are defined in ITU-T
1680  * Recommendation Q.850; those are different from the ones in the Q.931
1681  * dissector, as that has some values not specified by the standard but
1682  * that appear to be used for purposes other than the ones in Q.850.
1683  */
1684 const value_string q850_cause_code_vals[] = {
1685         { 0x00, "Valid cause code not yet received" },
1686         { 0x01, "Unallocated (unassigned) number" },
1687         { 0x02, "No route to specified transit network" },
1688         { 0x03, "No route to destination" },
1689         { 0x04, "Send special information tone" },
1690         { 0x05, "Misdialled trunk prefix" },
1691         { 0x06, "Channel unacceptable" },
1692         { 0x07, "Call awarded and being delivered in an established channel" },
1693         { 0x08, "Preemption" },
1694         { 0x09, "Preemption - circuit reserved for reuse" },
1695         { 0x0E, "QoR: ported number" },
1696         { 0x10, "Normal call clearing" },
1697         { 0x11, "User busy" },
1698         { 0x12, "No user responding" },
1699         { 0x13, "No answer from user (user alerted)" },
1700         { 0x14, "Subscriber absent" },
1701         { 0x15, "Call rejected" },
1702         { 0x16, "Number changed" },
1703         { 0x17, "Redirection to new destination" },
1704         { 0x18, "Call rejected due to feature at the destination" },
1705         { 0x19, "Exchange routing error" },
1706         { 0x1A, "Non-selected user clearing" },
1707         { 0x1B, "Destination out of order" },
1708         { 0x1C, "Invalid number format (address incomplete)" },
1709         { 0x1D, "Facility rejected" },
1710         { 0x1E, "Response to STATUS ENQUIRY" },
1711         { 0x1F, "Normal unspecified" },
1712         { 0x21, "Circuit out of order" },
1713         { 0x22, "No circuit/channel available" },
1714         { 0x26, "Network out of order" },
1715         { 0x27, "Permanent frame mode connection out of service" },
1716         { 0x28, "Permanent frame mode connection operational" },
1717         { 0x29, "Temporary failure" },
1718         { 0x2A, "Switching equipment congestion" },
1719         { 0x2B, "Access information discarded" },
1720         { 0x2C, "Requested circuit/channel not available" },
1721         { 0x2E, "Precedence call blocked" },
1722         { 0x2F, "Resources unavailable, unspecified" },
1723         { 0x31, "Quality of service unavailable" },
1724         { 0x32, "Requested facility not subscribed" },
1725         { 0x35, "Outgoing calls barred within CUG" },
1726         { 0x37, "Incoming calls barred within CUG" },
1727         { 0x38, "Call waiting not subscribed" },
1728         { 0x39, "Bearer capability not authorized" },
1729         { 0x3A, "Bearer capability not presently available" },
1730         { 0x3E, "Inconsistency in designated outgoing access information and subscriber class" },
1731         { 0x3F, "Service or option not available, unspecified" },
1732         { 0x41, "Bearer capability not implemented" },
1733         { 0x42, "Channel type not implemented" },
1734         { 0x45, "Requested facility not implemented" },
1735         { 0x46, "Only restricted digital information bearer capability is available" },
1736         { 0x4F, "Service or option not implemented, unspecified" },
1737         { 0x51, "Invalid call reference value" },
1738         { 0x52, "Identified channel does not exist" },
1739         { 0x53, "Call identity does not exist for suspended call" },
1740         { 0x54, "Call identity in use" },
1741         { 0x55, "No call suspended" },
1742         { 0x56, "Call having the requested call identity has been cleared" },
1743         { 0x57, "Called user not member of CUG" },
1744         { 0x58, "Incompatible destination" },
1745         { 0x5A, "Non-existing CUG" },
1746         { 0x5B, "Invalid transit network selection (national use)" },
1747         { 0x5F, "Invalid message, unspecified" },
1748         { 0x60, "Mandatory information element is missing" },
1749         { 0x61, "Message type non-existent or not implemented" },
1750         { 0x62, "Message not compatible with call state or message type non-existent or not implemented" },
1751         { 0x63, "Information element nonexistant or not implemented" },
1752         { 0x64, "Invalid information element contents" },
1753         { 0x65, "Message not compatible with call state" },
1754         { 0x66, "Recovery on timer expiry" },
1755         { 0x67, "Parameter non-existent or not implemented - passed on" },
1756         { 0x6E, "Message with unrecognized parameter discarded" },
1757         { 0x6F, "Protocol error, unspecified" },
1758         { 0x7F, "Internetworking, unspecified" },
1759         { 0,    NULL }
1760 };
1761
1762
1763
1764
1765 void
1766 dissect_isup_cause_indicators_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
1767 { guint length = tvb_reported_length(parameter_tvb);
1768   proto_tree_add_text(parameter_tree, parameter_tvb,0, -1, "Cause indicators (-> Q.850)");
1769   dissect_q931_cause_ie(parameter_tvb,0,length,
1770                                             parameter_tree,
1771                                             hf_isup_cause_indicator, &tap_cause_value);
1772   proto_item_set_text(parameter_item, "Cause indicators, see Q.850 (%u byte%s length)", length , plurality(length, "", "s"));
1773 }
1774
1775 /* ------------------------------------------------------------------
1776   Dissector Parameter Suspend/Resume Indicators
1777  */
1778 static void
1779 dissect_isup_suspend_resume_indicators_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
1780 {
1781   guint8 indicators;
1782
1783   indicators = tvb_get_guint8(parameter_tvb, 0);
1784   proto_tree_add_boolean(parameter_tree, hf_isup_suspend_resume_indicator, parameter_tvb, 0, SUSPEND_RESUME_IND_LENGTH,  indicators);
1785
1786   proto_item_set_text(parameter_item, "Suspend/Resume indicator: 0x%x", indicators);
1787 }
1788 /* ------------------------------------------------------------------
1789   Dissector Parameter Range and Status Indicators
1790  */
1791 static void
1792 dissect_isup_range_and_status_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
1793 {
1794   guint8 range, actual_status_length;
1795
1796   range = tvb_get_guint8(parameter_tvb, 0);
1797   proto_tree_add_uint_format(parameter_tree, hf_isup_range_indicator, parameter_tvb, 0, RANGE_LENGTH, range, "Range: %u", range);
1798   actual_status_length = tvb_reported_length_remaining(parameter_tvb, RANGE_LENGTH);
1799   if (actual_status_length > 0)
1800     proto_tree_add_text(parameter_tree, parameter_tvb , RANGE_LENGTH, -1, "Status subfield");
1801   else
1802     proto_tree_add_text(parameter_tree, parameter_tvb , 0, 0, "Status subfield is not present with this message type");
1803
1804
1805   proto_item_set_text(parameter_item, "Range (%u) and status", range);
1806 }
1807 /* ------------------------------------------------------------------
1808   Dissector Parameter Circuit group supervision message type
1809  */
1810 static void
1811 dissect_isup_circuit_group_supervision_message_type_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
1812 {
1813   guint8 cgs_message_type;
1814
1815   cgs_message_type = tvb_get_guint8(parameter_tvb, 0);
1816   proto_tree_add_uint(parameter_tree, hf_isup_cgs_message_type, parameter_tvb, 0, CIRC_GRP_SV_MSG_TYPE_LENGTH, cgs_message_type);
1817
1818   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);
1819 }
1820 /* ------------------------------------------------------------------
1821   Dissector Parameter Facility indicator parameter
1822  */
1823 static void
1824 dissect_isup_facility_ind_parameter(tvbuff_t *parameter_tvb, proto_item *parameter_item)
1825 {
1826   guint8 indicator;
1827
1828   indicator = tvb_get_guint8(parameter_tvb, 0);
1829
1830   proto_item_set_text(parameter_item, "Facility indicator: %s (%u)"  ,val_to_str(indicator, isup_facility_ind_value,"spare"), indicator);
1831 }
1832 /* ------------------------------------------------------------------
1833   Dissector Parameter Circuit state indicator
1834  */
1835 static void
1836 dissect_isup_circuit_state_ind_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
1837 {
1838   proto_item *circuit_state_item;
1839   proto_tree *circuit_state_tree;
1840   guint8 circuit_state;
1841   gint offset=0;
1842   gint i=0;
1843   gint length;
1844
1845   while((length = tvb_reported_length_remaining(parameter_tvb, offset)) > 0){
1846     circuit_state_item = proto_tree_add_text(parameter_tree, parameter_tvb,
1847                                              offset, -1,
1848                                              "Circuit# CIC+%u state", i);
1849     circuit_state_tree = proto_item_add_subtree(circuit_state_item, ett_isup_circuit_state_ind);
1850     circuit_state = tvb_get_guint8(parameter_tvb, offset);
1851     if ((circuit_state & DC_8BIT_MASK) == 0){
1852       proto_tree_add_uint(circuit_state_tree, hf_isup_mtc_blocking_state1, parameter_tvb, offset, 1, circuit_state);
1853       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"));
1854     }
1855     else {
1856       proto_tree_add_uint(circuit_state_tree, hf_isup_mtc_blocking_state2, parameter_tvb, offset, 1, circuit_state);
1857       proto_tree_add_uint(circuit_state_tree, hf_isup_call_proc_state, parameter_tvb, offset, 1, circuit_state);
1858       proto_tree_add_uint(circuit_state_tree, hf_isup_hw_blocking_state, parameter_tvb, offset, 1, circuit_state);
1859       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"));
1860     }
1861     offset++;
1862   }
1863   proto_item_set_text(parameter_item, "Circuit state indicator (national use)");
1864 }
1865 /* ------------------------------------------------------------------
1866   Dissector Parameter Event information
1867  */
1868 static void
1869 dissect_isup_event_information_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
1870 {
1871   guint8 indicators;
1872
1873   indicators = tvb_get_guint8(parameter_tvb, 0);
1874   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);
1875   proto_tree_add_boolean(parameter_tree, hf_isup_event_presentation_restricted_ind, parameter_tvb, 0, EVENT_INFO_LENGTH, indicators);
1876
1877   proto_item_set_text(parameter_item,"Event information: %s (%u)", val_to_str(indicators & GFEDCBA_8BIT_MASK, isup_event_ind_value, "spare"),indicators );
1878 }
1879 /* ------------------------------------------------------------------
1880   Dissector Parameter User-to-user information- no detailed dissection since defined in Rec. Q.931
1881  */
1882 static void
1883 dissect_isup_user_to_user_information_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
1884 { guint length = tvb_reported_length(parameter_tvb);
1885   proto_tree_add_text(parameter_tree, parameter_tvb, 0, -1, 
1886           "User-to-user info (-> Q.931)");
1887   dissect_q931_user_user_ie(parameter_tvb, 0, length,
1888     parameter_tree );
1889   proto_item_set_text(parameter_item, "User-to-user information,(%u byte%s length)",
1890         length , plurality(length, "", "s"));
1891 }
1892 /* ------------------------------------------------------------------
1893   Dissector Parameter Call Reference
1894  */
1895 static void
1896 dissect_isup_call_reference_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
1897 {
1898   guint32 call_id;
1899   guint16 spc;
1900
1901   call_id = tvb_get_ntoh24(parameter_tvb, 0);
1902   spc = tvb_get_letohs(parameter_tvb, CALL_ID_LENGTH) & 0x3FFF; /*since 1st 2 bits spare */
1903   proto_tree_add_text(parameter_tree, parameter_tvb, 0, CALL_ID_LENGTH, "Call identity: %u", call_id);
1904   proto_tree_add_text(parameter_tree, parameter_tvb, CALL_ID_LENGTH, SPC_LENGTH, "Signalling Point Code: %u", spc);
1905
1906   proto_item_set_text(parameter_item, "Call Reference: Call ID = %u, SPC = %u", call_id, spc);
1907 }
1908 /* ------------------------------------------------------------------
1909   Dissector Parameter Access Transport - no detailed dissection since defined in Rec. Q.931
1910  */
1911 static void
1912 dissect_isup_access_transport_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree,
1913                          proto_item *parameter_item, packet_info *pinfo)
1914 { guint length = tvb_reported_length(parameter_tvb);
1915
1916   proto_tree_add_text(parameter_tree, parameter_tvb, 0, -1, 
1917           "Access transport parameter field (-> Q.931)");
1918   
1919   if (q931_ie_handle)
1920     call_dissector(q931_ie_handle, parameter_tvb, pinfo, parameter_tree);
1921
1922   proto_item_set_text(parameter_item, "Access transport (%u byte%s length)",
1923           length , plurality(length, "", "s"));
1924 }
1925
1926 /* dissect x.213 NSAP coded Address */
1927
1928 static const value_string x213_afi_value[] = {
1929         { 0x34, "IANA ICP"},
1930         { 0x35, "IANA ICP"},
1931         { 0x36, "X.121"},
1932         { 0x37, "X.121"},
1933         { 0x38, "ISO DCC"},
1934         { 0x39, "ISO DCC"},
1935         { 0x40, "F.69"},
1936         { 0x41, "F.69"},
1937         { 0x42, "E.163"},
1938         { 0x43, "E.163"},
1939         { 0x44, "E.164"},
1940         { 0x45, "E.164"},
1941         { 0x46, "ISO 6523-ICD"},
1942         { 0x47, "ISO 6523-ICD"},
1943         { 0x48, "Local"},
1944         { 0x49, "Local"},
1945         { 0x50, "Local ISO/IEC 646 character "},
1946         { 0x51, "Local ( National character )"},
1947         { 0x52, "X.121"},
1948         { 0x53, "X.121"},
1949         { 0x54, "F.69"},
1950         { 0x55, "F.69"},
1951         { 0x56, "E.163"},
1952         { 0x57, "E.163"},
1953         { 0x58, "E.164"},
1954         { 0x59, "E.164"},
1955
1956         { 0x76, "ITU-T IND"},
1957         { 0x77, "ITU-T IND"},
1958
1959         { 0xb8, "IANA ICP Group no"},
1960         { 0xb9, "IANA ICP Group no"},
1961         { 0xba, "X.121 Group no"},
1962         { 0xbb, "X.121 Group no"},
1963         { 0xbc, "ISO DCC Group no"},
1964         { 0xbd, "ISO DCC Group no"},
1965         { 0xbe, "F.69 Group no"},
1966         { 0xbf, "F.69 Group no"},
1967         { 0xc0, "E.163 Group no"},
1968         { 0xc1, "E.163 Group no"},
1969         { 0xc2, "E.164 Group no"},
1970         { 0xc3, "E.164 Group no"},
1971         { 0xc4, "ISO 6523-ICD Group no"},
1972         { 0xc5, "ISO 6523-ICD Group no"},
1973         { 0xc6, "Local Group no"},
1974         { 0xc7, "Local Group no"},
1975         { 0xc8, "Local ISO/IEC 646 character Group no"},
1976         { 0xc9, "Local ( National character ) Group no"},
1977         { 0xca, "X.121 Group no"},
1978         { 0xcb, "X.121 Group no"},
1979         { 0xcd, "F.69 Group no"},
1980         { 0xce, "F.69 Group no"},
1981         { 0xcf, "E.163 Group no"},
1982         { 0xde, "E.163 Group no"},
1983         { 0xd0, "E.164 Group no"},
1984         { 0xd1, "E.164 Group no"},
1985
1986         { 0xe2, "ITU-T IND Group no"},
1987         { 0xe3, "ITU-T IND Group no"},
1988         { 0,    NULL }
1989 };
1990
1991
1992 /* Up-to-date information on the allocated ICP values can be found in   */
1993 /*draft-gray-rfc1888bis-01 at                                           */
1994 /*http://www.ietf.org/internet-drafts/draft-gray-rfc1888bis-01.txt      */
1995 static const value_string iana_icp_values[] = {
1996         {   0x0, "IP Version 6 Address"},
1997         {   0x1, "IP Version 4 Address"},
1998         { 0,    NULL }
1999 };
2000
2001 /*
2002  * XXX - shouldn't there be a centralized routine for dissecting NSAPs?
2003  * See also "dissect_atm_nsap()" in epan/dissectors/packet-arp.c and
2004  * "print_nsap_net_buf()" and "print_nsap_net()" in epan/osi_utils.c.
2005  */
2006 void
2007 dissect_nsap(tvbuff_t *parameter_tvb,gint offset,gint len, proto_tree *parameter_tree)
2008 {
2009         guint8 afi, cc_length = 0;
2010         guint8 length = 0, address_digit_pair = 0;
2011         guint icp,  cc, id_code, cc_offset;
2012
2013         afi = tvb_get_guint8(parameter_tvb, offset);
2014
2015         switch ( afi ) {
2016                 case 0x35:      /* IANA ICP Binary fortmat*/
2017                         proto_tree_add_text(parameter_tree, parameter_tvb, offset, 3,
2018                             "IDP = %s", tvb_bytes_to_str(parameter_tvb, offset, 3));
2019
2020                         proto_tree_add_uint(parameter_tree, hf_afi, parameter_tvb, offset, 1, afi );
2021                         offset = offset + 1;
2022                         icp = tvb_get_ntohs(parameter_tvb, offset);
2023                         proto_tree_add_uint(parameter_tree, hf_iana_icp, parameter_tvb, offset, 1, icp );
2024                         if ( icp == 0 ){ /* IPv6 addr */
2025                                 proto_tree_add_text(parameter_tree, parameter_tvb, offset + 2 , 17,
2026                                     "DSP = %s", tvb_bytes_to_str(parameter_tvb, offset + 2, 17));
2027                                 proto_tree_add_item(parameter_tree, hf_nsap_ipv6_addr, parameter_tvb, offset + 2,
2028                                     16, FALSE);
2029
2030                         }
2031                         else { /* IPv4 addr */
2032                                 /* XXX - this is really only for ICP 1 */
2033                                 proto_tree_add_text(parameter_tree, parameter_tvb, offset + 2, 17,
2034                                     "DSP = %s", tvb_bytes_to_str(parameter_tvb, offset + 2, 17));
2035                                 proto_tree_add_item(parameter_tree, hf_nsap_ipv4_addr, parameter_tvb, offset + 2, 4, FALSE);
2036                         }
2037                         
2038                         break;
2039                 case 0x45:      /* E.164 ATM format */
2040                 case 0xC3:      /* E.164 ATM group format */
2041                         proto_tree_add_text(parameter_tree, parameter_tvb, offset, 9,
2042                             "IDP = %s", tvb_bytes_to_str(parameter_tvb, offset, 9));
2043
2044                         proto_tree_add_uint(parameter_tree, hf_afi, parameter_tvb, offset, 1, afi );
2045         
2046                         proto_tree_add_text(parameter_tree, parameter_tvb, offset + 1, 8,
2047                             "IDI = %s", tvb_bytes_to_str(parameter_tvb, offset + 1, 8));
2048                         offset = offset +1;
2049                         /* Dissect country code after removing non significant zeros */
2050                         cc_offset = offset;
2051                         address_digit_pair = tvb_get_guint8(parameter_tvb, cc_offset);
2052                         while ( address_digit_pair == 0 ) {
2053                                 cc_offset = cc_offset + 1;
2054                                 address_digit_pair = tvb_get_guint8(parameter_tvb, cc_offset);
2055                         }
2056                         cc = tvb_get_ntohs(parameter_tvb, cc_offset);
2057                         if (( address_digit_pair & 0xf0 ) != 0 )
2058                                 cc = cc >> 4;
2059
2060                         switch ( cc & 0x0f00 ) {
2061                 
2062                         case 0x0 :
2063                                 cc_length = 1;  
2064                                 break;
2065
2066                         case 0x0100 : cc_length = 1;    
2067                                 break;
2068
2069                         case 0x0200 : 
2070                                 switch ( cc & 0x00f0 ) {
2071                                         case 0 : 
2072                                         case 7 : 
2073                                                 cc_length = 2;  
2074                                                 break;
2075                                         default : 
2076                                                 cc_length = 3;
2077                                                 break;
2078                                         }
2079                                 break;
2080                                 
2081                         case 0x0300 :
2082                                 switch ( cc & 0x00f0 ) {
2083                                         case 0 : 
2084                                         case 0x10 : 
2085                                         case 0x20 : 
2086                                         case 0x30 : 
2087                                         case 0x40 : 
2088                                         case 0x60 : 
2089                                         case 0x90 : 
2090                                                 cc_length = 2;
2091                                                 break;  
2092                                         default :
2093                                                 cc_length = 3;
2094                                                 break;
2095                                 }
2096                                 break;
2097                         case 0x0400 : 
2098                                 switch ( cc & 0x00f0 ) {
2099                                         case 0x20 :
2100                                                 cc_length = 3;
2101                                                 break;  
2102                                 default :
2103                                         cc_length = 2;
2104                                         break;
2105                                 }
2106                                 break;
2107
2108                         case 0x0500 : 
2109                                 switch ( cc & 0x00f0 ) {
2110                                         case 0 : 
2111                                         case 0x90 :
2112                                                 cc_length = 3;
2113                                                 break;  
2114                                 default :
2115                                         cc_length = 2;
2116                                         break;
2117                                 }
2118                                 break;
2119
2120                         case 0x0600 : 
2121                                 switch ( cc & 0x00f0 ) {
2122                                         case 0x70 : 
2123                                         case 0x80 : 
2124                                         case 0x90 :
2125                                                 cc_length = 3; 
2126                                                 break;  
2127                                         default :
2128                                                 cc_length = 2;
2129                                                 break;
2130                                 }
2131                                 break;
2132
2133                         case 0x0700 : cc_length = 1;    
2134                                 break;
2135
2136                         case 0x0800 : 
2137                                 switch ( cc & 0x00f0 ) {
2138                                         case 0x10: 
2139                                         case 0x20: 
2140                                         case 0x40: 
2141                                         case 0x60:
2142                                                 cc_length = 2; 
2143                                                 break;  
2144                                 default :
2145                                         cc_length = 3;
2146                                         break;
2147                                 }
2148                                 break;
2149
2150                         case 0x0900 : 
2151                                 switch ( cc & 0x00f0 ) {
2152                                         case 0 : 
2153                                         case 0x10 : 
2154                                         case 0x20 :  
2155                                         case 0x30 :  
2156                                         case 0x40 :  
2157                                         case 0x50 :  
2158                                         case 0x80 : 
2159                                                 cc_length = 2; 
2160                                                 break;  
2161                                         default : 
2162                                                 cc_length = 3;
2163                                                 break;
2164                                 }
2165                                 break;
2166
2167                         default: 
2168                                 break;
2169                         }/* End switch cc */
2170                         switch ( cc_length ) {
2171                         case 0x1 :      cc = cc >> 8;
2172                                 length = 1;
2173                                 break;
2174                         case 0x2 :      cc = cc >> 4;
2175                                 length = 1;
2176                                 break;
2177                         default:
2178                                 length = 2;
2179                                 break;
2180                         }/* end switch cc_length */
2181                         proto_tree_add_text(parameter_tree,parameter_tvb, cc_offset, length,"Country Code: %x %s length %u",cc,
2182                                         val_to_str(cc,E164_country_code_value,"unknown (%x)"),cc_length);
2183                         switch ( cc ) {
2184                         case 0x882 :
2185                                         id_code = tvb_get_ntohs(parameter_tvb, cc_offset + 1);
2186                                         id_code = (id_code & 0x0fff) >> 4;
2187                                         proto_tree_add_text(parameter_tree,parameter_tvb, (cc_offset + 1), 2,"Identification Code: %x %s ",id_code,
2188                                                 val_to_str(id_code,E164_International_Networks_vals,"unknown (%x)"));
2189                                 break;
2190                         default:;
2191                         }
2192                         proto_tree_add_text(parameter_tree,parameter_tvb, cc_offset, length,"DSP length %u(len %u -9 )",(len-9),len );
2193
2194                         proto_tree_add_item(parameter_tree, hf_bicc_nsap_dsp, parameter_tvb, offset + 8, (len - 9),FALSE);
2195         
2196                         break;
2197                 default:
2198                         proto_tree_add_uint(parameter_tree, hf_afi, parameter_tvb, offset, len, afi );
2199                 }/* end switch afi */
2200
2201 }
2202
2203
2204 #define  ACTION_INDICATOR                               0x01    
2205 #define  BACKBONE_NETWORK_CONNECTION_IDENTIFIER         0x02    
2206 #define  INTERWORKING_FUNCTION_ADDRESS                  0x03    
2207 #define  CODEC_LIST                                     0x04    
2208 #define  CODEC                                          0x05    
2209 #define  BAT_COMPATIBILITY_REPORT                       0x06    
2210 #define  BEARER_NETWORK_CONNECTION_CHARACTERISTICS      0x07    
2211 #define  BEARER_CONTROL_INFORMATION                     0x08    
2212 #define  BEARER_CONTROL_TUNNELLING                      0x09    
2213 #define  BEARER_CONTROL_UNIT_IDENTIFIER                 0x0A    
2214 #define  SIGNAL                                         0x0B    
2215 #define  BEARER_REDIRECTION_CAPABILITY                  0x0C    
2216 #define  BEARER_REDIRECTION_INDICATORS                  0x0D    
2217 #define  SIGNAL_TYPE                                    0x0E    
2218 #define  DURATION                                       0x0F
2219
2220         
2221 static const value_string bat_ase_list_of_Identifiers_vals[] = {
2222
2223         { 0x00                                          ,       "spare" },
2224         { ACTION_INDICATOR                              ,       "Action Indicator" },
2225         { BACKBONE_NETWORK_CONNECTION_IDENTIFIER        ,       "Backbone Network Connection Identifier" },
2226         { INTERWORKING_FUNCTION_ADDRESS                 ,       "Interworking Function Address" },
2227         { CODEC_LIST                                    ,       "Codec List" },
2228         { CODEC                                         ,       "Codec" },
2229         { BAT_COMPATIBILITY_REPORT                      ,       "BAT Compatibility Report" },
2230         { BEARER_NETWORK_CONNECTION_CHARACTERISTICS     ,       "Bearer Network Connection Characteristics" },
2231         { BEARER_CONTROL_INFORMATION                    ,       "Bearer Control Information"},
2232         { BEARER_CONTROL_TUNNELLING                     ,       "Bearer Control Tunnelling"},
2233         { BEARER_CONTROL_UNIT_IDENTIFIER                ,       "Bearer Control Unit Identifier" },
2234         { SIGNAL                                        ,       "Signal"},
2235         { BEARER_REDIRECTION_CAPABILITY                 ,       "Bearer Redirection Capability"},
2236         { BEARER_REDIRECTION_INDICATORS                 ,       "Bearer Redirection Indicators"},
2237         { SIGNAL_TYPE                                   ,       "Signal Type"},
2238         { DURATION                                      ,       "Duration" },
2239         { 0,    NULL }
2240 };    
2241
2242 /*ITU-T Q.765.5 (06/2000) 13*/
2243 static const value_string Instruction_indicator_for_general_action_vals[] =
2244 {
2245   { 0,     "Pass on information element"},
2246   { 1,     "Discard information element"},
2247   { 2,     "Discard BICC data"},
2248   { 3,     "Release call"},
2249   { 0,     NULL}};
2250
2251 static const value_string Instruction_indicator_for_pass_on_not_possible_vals[] = {
2252   { 0,     "Release call"},
2253   { 1,     "Discard information element"},
2254   { 2,     "Discard BICC data"},
2255   { 3,     "reserved (interpreted as 00)"},
2256   { 0,     NULL}};
2257
2258 static value_string bat_ase_action_indicator_field_vals[] = {
2259       
2260         { 0x00, "no indication"},
2261         { 0x01, "connect backward"},
2262         { 0x02, "connect forward"},
2263         { 0x03, "connect forward, no notification"},
2264         { 0x04, "connect forward, plus notification"},
2265         { 0x05, "connect forward, no notification + selected codec"},
2266         { 0x06, "connect forward, plus notification + selected codec"},
2267         { 0x07, "use idle"},
2268         { 0x08, "connected"},
2269         { 0x09, "switched"},
2270         { 0x0a, "selected codec"},
2271         { 0x0b, "modify codec"},
2272         { 0x0c, "successful codec modification"},
2273         { 0x0d, "codec modification failure"},
2274         { 0x0e, "mid-call codec negotiation"},
2275         { 0x0f, "modify to selected codec information"},
2276         { 0x10, "mid-call codec negotiation failure"},
2277         { 0x11, "start signal, notify"},
2278         { 0x12, "start signal, no notify"},
2279         { 0x13, "stop signal, notify"},
2280         { 0x14, "stop signal, no notify"},
2281         { 0x15, "start signal acknowledge"},
2282         { 0x16, "start signal reject"},
2283         { 0x17, "stop signal acknowledge"},
2284         { 0x18, "bearer redirect"},
2285         { 0,    NULL }
2286 };    
2287
2288 static const true_false_string BCTP_BVEI_value  = {
2289   "Version Error Indication, BCTP version not supported",
2290   "No indication"
2291 };
2292
2293 static value_string BCTP_Tunnelled_Protocol_Indicator_vals[] = {
2294       
2295         { 0x20, "IPBCP (text encoded)"},
2296         { 0x21, "spare (text encoded protocol)"},
2297         { 0x22, "not used"},
2298         { 0,    NULL }
2299 };    
2300
2301 static const true_false_string BCTP_TPEI_value  = {
2302   "Protocol Error Indication, Bearer Control Protocol not supported",
2303   "No indication"
2304 };
2305
2306
2307 #define  ITU_T                                  0x01    
2308 #define  ETSI                                   0x02    
2309
2310 static const value_string bat_ase_organization_identifier_subfield_vals[] = {
2311
2312         { 0x00, "no indication"},
2313         { 0x01, "ITU-T"},
2314         { 0x02, "ETSI (refer to TS 26.103)"},
2315         { 0,    NULL }
2316 };
2317
2318 #define G_711_64_A                                              0x01
2319 #define G_711_64_U                                              0x02
2320 #define G_711_56_A                                              0x03
2321 #define G_711_56_U                                              0x04
2322 #define G_722_SB_ADPCM                                  0x05
2323 #define G_723_1                                                 0x06
2324 #define G_723_1_Annex_A                                 0x07
2325 #define G_726_ADPCM                                             0x08
2326 #define G_727_Embedded_ADPCM                    0x09
2327 #define G_728                                                   0x0a
2328 #define G_729_CS_ACELP                                  0x0b
2329 #define G_729_Annex_B                                   0x0c
2330
2331 static const value_string ITU_T_codec_type_subfield_vals[] = {
2332
2333         { 0x00,                                 "no indication"},
2334         { G_711_64_A,                   "G.711 64 kbit/s A-law"},
2335         { G_711_64_U,                   "G.711 64 kbit/s -law"},
2336         { G_711_56_A,                   "G.711 56 kbit/s A-law"},
2337         { G_711_56_U,                   "G.711 56 kbit/s -law"},
2338         { G_722_SB_ADPCM,               "G.722 (SB-ADPCM)"},
2339         { G_723_1,                              "G.723.1"},
2340         { G_723_1_Annex_A,              "G.723.1 Annex A (silence suppression)"},
2341         { G_726_ADPCM,                  "G.726 (ADPCM)"},
2342         { G_727_Embedded_ADPCM, "G.727 (Embedded ADPCM)"},
2343         { G_728,                                "G.728"},
2344         { G_729_CS_ACELP,               "G.729 (CS-ACELP)"},
2345         { G_729_Annex_B,                "G.729 Annex B (silence suppression)"},
2346         { 0,    NULL }
2347 };
2348
2349 static const value_string ETSI_codec_type_subfield_vals[] = {
2350
2351         { 0x00, "GSM Full Rate (13.0 kBit/s)( GSM FR )"},
2352         { 0x01, "GSM Half Rate (5.6 kBit/s) ( GSM HR )"},
2353         { 0x02, "GSM Enhanced Full Rate (12.2 kBit/s)( GSM EFR )"},
2354         { 0x03, "Full Rate Adaptive Multi-Rate ( FR AMR )"},
2355         { 0x04, "Half Rate Adaptive Multi-Rate ( HR AMR )"},
2356         { 0x05, "UMTS Adaptive Multi-Rate ( UMTS AMR )"},
2357         { 0x06, "UMTS Adaptive Multi-Rate 2 ( UMTS AMR 2 )"},
2358         { 0x07, "TDMA Enhanced Full Rate (7.4 kBit/s) ( TDMA EFR )"},
2359         { 0x08, "PDC Enhanced Full Rate (6.7 kBit/s) ( PDC EFR )"},
2360         { 0x09, "Full Rate Adaptive Multi-Rate WideBand ( FR AMR-WB )"},
2361         { 0x0a, "UMTS Adaptive Multi-Rate WideBand ( UMTS AMR-WB )"},
2362         { 0x0b, "8PSK Half Rate Adaptive Multi-Rate ( OHR AMR )"},
2363         { 0x0c, "8PSK Full Rate Adaptive Multi-Rate WideBand  ( OFR AMR-WB )"},
2364         { 0x0d, "8PSK Half Rate Adaptive Multi-Rate WideBand ( OHR AMR-WB )"},
2365         { 0xfe, "Reserved for future use."},
2366         { 0xff, "Reserved for MuMe dummy Codec Type ( MuMe )"},
2367         { 0,    NULL }
2368 };
2369
2370 static const value_string bat_initial_codec_mode_vals[] = {
2371         {0x7, "12.2 kbps"},
2372         {0x6, "10.2 kbps"},
2373         {0x5, "7.95 kbps"},
2374         {0x4, "7.40 kbps"},
2375         {0x3, "6.70 kbps"},
2376         {0x2, "5.90 kbps"},
2377         {0x1, "5.15 kbps"},
2378         {0x0, "4.75 kbps"},
2379         {0, NULL}
2380 };
2381
2382 static const value_string bearer_network_connection_characteristics_vals[] = {
2383
2384         { 0x00, "no indication"},
2385         { 0x01, "AAL type 1"},
2386         { 0x02, "AAL type 2"},
2387         { 0x03, "Structured AAL type 1"},
2388         { 0x04, "IP/RTP"},
2389         { 0,    NULL }
2390 };
2391
2392 static const true_false_string Bearer_Control_Tunnelling_ind_value  = {
2393   "Tunnelling to be used",
2394   "No indication"
2395 };
2396
2397 static const true_false_string late_cut_trough_cap_ind_value  = {
2398   "Late Cut-through supported",
2399   "Late Cut-through not supported"
2400 };
2401 /*  ITU-T Rec. Q.765.5/Amd.1 (07/2001) */
2402 static const value_string Bearer_Redirection_Indicator_vals[] = {
2403         { 0x00, " no indication"},
2404         { 0x01, "late cut-through request"},
2405         { 0x02, "redirect temporary reject"},
2406         { 0x03, "redirect backwards request"},
2407         { 0x04, "redirect forwards request"},
2408         { 0x05, "redirect bearer release request"},
2409         { 0x06, "redirect bearer release proceed"},
2410         { 0x07, "redirect bearer release complete"},
2411         { 0x08, "redirect cut-through request"},
2412         { 0x09, "redirect bearer connected indication"},
2413         { 0x0a, "redirect failure"},
2414         { 0x0b, "new connection identifier"},
2415         { 0,    NULL }
2416 };
2417
2418 /*26/Q.765.5 - Signal Type */
2419 static const value_string BAt_ASE_Signal_Type_vals[] = {
2420         { 0x00, "DTMF 0"},
2421         { 0x01, "DTMF 1"},
2422         { 0x02, "DTMF 2"},
2423         { 0x03, "DTMF 3"},
2424         { 0x04, "DTMF 4"},
2425         { 0x05, "DTMF 5"},
2426         { 0x06, "DTMF 6"},
2427         { 0x07, "DTMF 7"},
2428         { 0x08, "DTMF 8"},
2429         { 0x09, "DTMF 9"},
2430         { 0x0a, "DTMF *"},
2431         { 0x0b, "DTMF #"},
2432         { 0x0c, "DTMF A"},
2433         { 0x0d, "DTMF B"},
2434         { 0x0e, "DTMF C"},
2435         { 0x1f, "DTMF D"},
2436         { 0x40, "dial tone"},
2437         { 0x41, "PABX internal dial tone"},
2438         { 0x42, "special dial tone"},
2439         { 0x43, "second dial tone"},
2440         { 0x44, "ringing tone"},
2441         { 0x45, "special ringing tone"},
2442         { 0x46, "busy tone"},
2443         { 0x47, "congestion tone"},
2444         { 0x48, "special information tone"},
2445         { 0x49, "warning tone"},
2446         { 0x4a, "intrusion tone"},
2447         { 0x4b, "call waiting tone"},
2448         { 0x4c, "pay tone"},
2449         { 0x4d, "payphone recognition tone"},
2450         { 0x4e, "comfort tone"},
2451         { 0x4f, "tone on hold"},
2452         { 0x50, "record tone"},
2453         { 0x51, "Caller waiting tone"},
2454         { 0x52, "positive indication tone"},
2455         { 0x53, "negative indication tone"},
2456         { 0,    NULL }
2457 };
2458
2459 static const value_string BAT_ASE_Report_Reason_vals[] = {
2460
2461         { 0x00, "no indication"},
2462         { 0x01, "information element non-existent or not implemented"},
2463         { 0x02, "BICC data with unrecognized information element, discarded"},
2464         { 0,    NULL }
2465 };
2466
2467 extern int dissect_codec_mode(proto_tree *tree, tvbuff_t *tvb, int offset, int len) {
2468         guint8 tempdata;
2469         proto_tree *scs_item, *acs_item;
2470         proto_tree *scs_tree, *acs_tree;
2471         
2472         
2473         offset = offset + 1;
2474         tempdata = tvb_get_guint8(tvb, offset);
2475         proto_tree_add_uint(tree, hf_Organization_Identifier , tvb, offset, 1, tempdata );
2476         switch ( tempdata ){
2477                 case ITU_T :
2478                         offset = offset + 1;
2479                         tempdata = tvb_get_guint8(tvb, offset);
2480                         proto_tree_add_uint(tree, hf_codec_type , tvb, offset, 1, tempdata );
2481                         offset = offset + 1;
2482                         switch ( tempdata ) {
2483                                 case G_711_64_A :
2484                                 case G_711_64_U :               
2485                                 case G_711_56_A :               
2486                                 case G_711_56_U :               
2487                                 case G_722_SB_ADPCM :   
2488                                 case G_723_1 :                          
2489                                 case G_723_1_Annex_A :
2490                                         /* These codecs have no configuration data */   
2491                                         break;
2492                                 case G_726_ADPCM :                                      
2493                                 case G_727_Embedded_ADPCM :
2494                                         /* four bit config data, TODO decode config */
2495                                         if ( len > 2 ) {        
2496                                                 tempdata = tvb_get_guint8(tvb, offset);
2497                                                 proto_tree_add_text(tree, tvb, offset, 1, "Configuration data : 0x%x", tempdata);
2498                                                 offset = offset + 1;
2499                                         }
2500                                         break;  
2501                                 case G_728 :                                                    
2502                                 case G_729_CS_ACELP :           
2503                                 case G_729_Annex_B :
2504                                         /* three bit config data, TODO decode config */
2505                                         if ( len > 2 ) {        
2506                                                 tempdata = tvb_get_guint8(tvb, offset);
2507                                                 proto_tree_add_text(tree, tvb, offset, 1 , "Configuration data : 0x%x", tempdata);
2508                                                 offset = offset + 1;
2509                                         }
2510                                         break;
2511                                 default:
2512                                         break;
2513                                         
2514                         }
2515                                 break;  
2516                 case ETSI:
2517                         offset = offset + 1;
2518                         tempdata = tvb_get_guint8(tvb, offset);
2519                         proto_tree_add_uint(tree, hf_etsi_codec_type , tvb, offset, 1, tempdata );
2520                         if ( len > 2 )  {
2521                                 offset = offset + 1;
2522                                 tempdata = tvb_get_guint8(tvb, offset);
2523
2524                                 acs_item = proto_tree_add_item(tree, hf_active_code_set, tvb, offset, 1, TRUE);
2525                                 acs_tree = proto_item_add_subtree(acs_item,ett_acs);
2526                                 proto_tree_add_item(acs_tree, hf_active_code_set_12_2, tvb, offset, 1, TRUE);
2527                                 proto_tree_add_item(acs_tree, hf_active_code_set_10_2, tvb, offset, 1, TRUE);
2528                                 proto_tree_add_item(acs_tree, hf_active_code_set_7_95, tvb, offset, 1, TRUE);
2529                                 proto_tree_add_item(acs_tree, hf_active_code_set_7_40, tvb, offset, 1, TRUE);
2530                                 proto_tree_add_item(acs_tree, hf_active_code_set_6_70, tvb, offset, 1, TRUE);
2531                                 proto_tree_add_item(acs_tree, hf_active_code_set_5_90, tvb, offset, 1, TRUE);
2532                                 proto_tree_add_item(acs_tree, hf_active_code_set_5_15, tvb, offset, 1, TRUE);
2533                                 proto_tree_add_item(acs_tree, hf_active_code_set_4_75, tvb, offset, 1, TRUE);
2534                                 
2535                         }
2536                         if ( len > 3 )  {
2537                                 offset = offset + 1;
2538                                 tempdata = tvb_get_guint8(tvb, offset);
2539                                 
2540                                 scs_item = proto_tree_add_item(tree, hf_supported_code_set, tvb, offset, 1, TRUE);
2541                                 scs_tree = proto_item_add_subtree(scs_item,ett_scs);
2542                                 proto_tree_add_item(scs_tree, hf_supported_code_set_12_2, tvb, offset, 1, TRUE);
2543                                 proto_tree_add_item(scs_tree, hf_supported_code_set_10_2, tvb, offset, 1, TRUE);
2544                                 proto_tree_add_item(scs_tree, hf_supported_code_set_7_95, tvb, offset, 1, TRUE);
2545                                 proto_tree_add_item(scs_tree, hf_supported_code_set_7_40, tvb, offset, 1, TRUE);
2546                                 proto_tree_add_item(scs_tree, hf_supported_code_set_6_70, tvb, offset, 1, TRUE);
2547                                 proto_tree_add_item(scs_tree, hf_supported_code_set_5_90, tvb, offset, 1, TRUE);
2548                                 proto_tree_add_item(scs_tree, hf_supported_code_set_5_15, tvb, offset, 1, TRUE);
2549                                 proto_tree_add_item(scs_tree, hf_supported_code_set_4_75, tvb, offset, 1, TRUE);
2550                         }
2551                         if ( len > 4 )  {
2552                                 offset = offset + 1;
2553                                 proto_tree_add_item(tree, hf_initial_codec_mode, tvb, offset, 1, TRUE);
2554                                 proto_tree_add_item(tree, hf_max_codec_modes, tvb, offset, 1, TRUE);
2555                         }
2556                         offset = offset + 1;
2557                         break;
2558                 default:
2559                         offset = offset + 1;
2560                         tempdata = tvb_get_guint8(tvb, offset);
2561                         proto_tree_add_text(tree, tvb, offset, len ,
2562                                                                 "Unknown organisation Identifier ( Non ITU-T/ETSI codec ) %u", tempdata);
2563                         offset = offset + len - 1;
2564                         break;
2565         }
2566         /* switch OID */
2567         
2568         return offset;
2569 }
2570
2571 static int
2572 dissect_codec(tvbuff_t *parameter_tvb, proto_tree *bat_ase_element_tree, gint length_indicator, gint offset,gint identifier)
2573 {
2574 /* offset is at length indicator e.g 1 step past identifier */
2575 guint8 compatibility_info;
2576
2577         proto_tree_add_uint(bat_ase_element_tree , hf_bat_ase_identifier , parameter_tvb, offset - 1, 1, identifier );
2578         proto_tree_add_uint(bat_ase_element_tree , hf_length_indicator  , parameter_tvb, offset, 1, length_indicator );
2579         offset = offset + 1;    
2580         compatibility_info = tvb_get_guint8(parameter_tvb, offset);
2581         proto_tree_add_uint(bat_ase_element_tree, hf_Instruction_ind_for_general_action , parameter_tvb, offset, 1, compatibility_info );
2582         proto_tree_add_boolean(bat_ase_element_tree, hf_Send_notification_ind_for_general_action , parameter_tvb, offset, 1, compatibility_info );
2583         proto_tree_add_uint(bat_ase_element_tree, hf_Instruction_ind_for_pass_on_not_possible , parameter_tvb, offset, 1, compatibility_info );
2584         proto_tree_add_boolean(bat_ase_element_tree, hf_Send_notification_ind_for_pass_on_not_possible , parameter_tvb, offset, 1, compatibility_info );
2585         proto_tree_add_boolean(bat_ase_element_tree, hf_isup_extension_ind , parameter_tvb, offset, 1, compatibility_info );
2586
2587         offset = dissect_codec_mode(bat_ase_element_tree, parameter_tvb, offset,length_indicator-1);
2588 return offset;
2589 }
2590
2591 /* Dissect BAT ASE message according to Q.765.5 200006 and Amendment 1 200107   
2592  * Layout of message            Length                  Octet   
2593  *      Element name                                                                            
2594  *      Identifier                                      1                       1
2595  *      Length indicator                        1                       2
2596  *      Compatibility information       1                       3
2597  *      Contents                                        1                       4
2598  *      Identifier                                      n                       m
2599  *      Length indicator                        n                       
2600  *      Compatibility information       n                       
2601  *      Contents                                        n                       p                               
2602  */
2603
2604 static void
2605 dissect_bat_ase_Encapsulated_Application_Information(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *parameter_tree, gint offset)
2606
2607         gint            length = tvb_reported_length_remaining(parameter_tvb, offset), list_end;
2608         tvbuff_t        *next_tvb;
2609         proto_tree      *bat_ase_tree, *bat_ase_element_tree, *bat_ase_iwfa_tree;
2610         proto_item      *bat_ase_item, *bat_ase_element_item, *bat_ase_iwfa_item;
2611         guint8 identifier,content, BCTP_Indicator_field_1, BCTP_Indicator_field_2;
2612         guint8 tempdata, element_no, number_of_indicators;
2613         guint16 sdp_length; 
2614         guint8 diagnostic_len;
2615         guint8 length_ind_len;
2616         guint tempdata16;
2617         guint content_len, length_indicator;
2618         guint duration;
2619         guint diagnostic;
2620         guint32 bncid, Local_BCU_ID;
2621         element_no = 0;
2622
2623         bat_ase_item = proto_tree_add_text(parameter_tree,parameter_tvb, offset, -1,
2624                 "Bearer Association Transport (BAT) Application Service Element (ASE) Encapsulated Application Information:");
2625         bat_ase_tree = proto_item_add_subtree(bat_ase_item , ett_bat_ase);
2626
2627         proto_tree_add_text(bat_ase_tree, parameter_tvb, offset, -1, 
2628                 "BAT ASE Encapsulated Application Information, (%u byte%s length)", length, plurality(length, "", "s"));
2629         while(tvb_reported_length_remaining(parameter_tvb, offset) > 0){
2630                 element_no = element_no + 1;
2631                 identifier = tvb_get_guint8(parameter_tvb, offset);
2632
2633                 /* length indicator may be 11 bits long                         */
2634                 offset = offset + 1;
2635                 proto_tree_add_item( bat_ase_tree, hf_isup_extension_ind, parameter_tvb, offset, 1, FALSE );
2636                 tempdata = tvb_get_guint8(parameter_tvb, offset);
2637                 if ( tempdata & 0x80 ) {
2638                         length_indicator = tempdata & 0x7f;
2639                         length_ind_len = 1;     
2640                 }
2641                 else {
2642                         offset = offset + 1;
2643                         tempdata16 = ( tempdata & 0x7f );
2644                         length_indicator = tvb_get_guint8(parameter_tvb, offset)& 0x0f;
2645                         length_indicator = length_indicator << 7;
2646                         length_indicator = length_indicator + tempdata16;
2647                         length_ind_len = 2;
2648                 }
2649
2650                 bat_ase_element_item = proto_tree_add_text(bat_ase_tree,parameter_tvb,
2651                         ( offset - length_ind_len),(length_indicator + 2),"BAT ASE Element %u, Identifier: %s",element_no,
2652                                         val_to_str(identifier,bat_ase_list_of_Identifiers_vals,"unknown (%u)"));
2653                 bat_ase_element_tree = proto_item_add_subtree(bat_ase_element_item , 
2654                         ett_bat_ase_element);
2655                 if ( identifier != CODEC ) {
2656                 /* identifier, lengt indicator and compabillity info must be printed inside CODEC */
2657                 /* dissection in order to use dissect_codec routine for codec list */
2658                 proto_tree_add_uint(bat_ase_element_tree , hf_bat_ase_identifier , parameter_tvb, 
2659                         offset - length_ind_len, 1, identifier );
2660                 proto_tree_add_uint(bat_ase_element_tree , hf_length_indicator  , parameter_tvb, 
2661                         offset - length_ind_len + 1, length_ind_len, length_indicator );
2662                 
2663                 offset = offset + 1;
2664                 proto_tree_add_item( bat_ase_element_tree, hf_isup_extension_ind, parameter_tvb, offset, 1, FALSE );
2665                 proto_tree_add_item( bat_ase_element_tree, hf_Send_notification_ind_for_pass_on_not_possible, parameter_tvb, offset, 1, FALSE );
2666                 proto_tree_add_item( bat_ase_element_tree, hf_Instruction_ind_for_pass_on_not_possible, parameter_tvb, offset, 1, FALSE );
2667                 proto_tree_add_item( bat_ase_element_tree, hf_Send_notification_ind_for_general_action, parameter_tvb, offset, 1, FALSE );
2668                 proto_tree_add_item( bat_ase_element_tree, hf_Instruction_ind_for_general_action, parameter_tvb, offset, 1, FALSE );
2669                 offset = offset + 1;
2670                 }
2671                 content_len = length_indicator - 1 ; /* exclude the treated Compatibility information */
2672         
2673                 /* content will be different depending on identifier */
2674                 switch ( identifier ){
2675
2676                         case ACTION_INDICATOR :
2677
2678                                 content = tvb_get_guint8(parameter_tvb, offset);
2679                                 proto_tree_add_uint(bat_ase_element_tree, hf_Action_Indicator , parameter_tvb, offset, 1, content );
2680                                 proto_item_append_text(bat_ase_element_item, " - %s",
2681                                                  val_to_str(content,bat_ase_action_indicator_field_vals, "unknown (%u)"));
2682                                 offset = offset + 1;
2683                                 break;                          
2684                         case BACKBONE_NETWORK_CONNECTION_IDENTIFIER :           
2685
2686                                 bncid = tvb_get_ntohl(parameter_tvb, offset);
2687                                 switch ( content_len ){
2688                                 case 1:
2689                                                 bncid = bncid & 0x000000ff;
2690                                                 break;  
2691                                 case 2:
2692                                                 bncid = bncid & 0x0000ffff;
2693                                                 break;  
2694                                 case 3:
2695                                                 bncid = bncid & 0x00ffffff;
2696                                                 break;  
2697                                 case 4:;  
2698                                 default:;
2699                                 }
2700                                 proto_tree_add_uint_format(bat_ase_element_tree, hf_bncid, parameter_tvb, offset, content_len, bncid, "BNCId: 0x%08x", bncid);
2701                                 proto_item_append_text(bat_ase_element_item, " - 0x%08x",bncid);
2702                                 offset = offset + content_len;
2703
2704                         break;
2705                         case INTERWORKING_FUNCTION_ADDRESS :            
2706                                 bat_ase_iwfa_item = proto_tree_add_item(bat_ase_element_tree, hf_bat_ase_biwfa, parameter_tvb, offset, content_len,
2707                                                             FALSE);
2708                                 bat_ase_iwfa_tree = proto_item_add_subtree(bat_ase_iwfa_item , ett_bat_ase_iwfa);
2709                                 dissect_nsap(parameter_tvb, offset, content_len, bat_ase_iwfa_tree);
2710
2711                                 offset = offset + content_len;
2712                         break;
2713                         case CODEC_LIST :    
2714                                 list_end = offset + content_len;
2715                                 while ( offset < ( list_end - 1 )) {
2716                                         identifier = tvb_get_guint8(parameter_tvb, offset);
2717                                         offset = offset + 1;
2718                                         tempdata = tvb_get_guint8(parameter_tvb, offset);
2719                                                 if ( tempdata & 0x80 ) {
2720                                                         length_indicator = tempdata & 0x7f;     
2721                                                 }
2722                                                 else {
2723                                                         offset = offset +1;
2724                                                         length_indicator = tvb_get_guint8(parameter_tvb, offset);
2725                                                         length_indicator = length_indicator << 7;
2726                                                         length_indicator = length_indicator & ( tempdata & 0x7f );
2727                                                 }
2728                                         offset = dissect_codec(parameter_tvb, bat_ase_element_tree, length_indicator , offset, identifier);
2729                                 }
2730                         break;
2731                         case CODEC :       
2732                                 /* offset is at length indicator in this case */                        
2733                                 offset = dissect_codec(parameter_tvb, bat_ase_element_tree, length_indicator , offset, identifier);
2734                                 break;/* case codec */
2735                         case BAT_COMPATIBILITY_REPORT :                 
2736                                 tempdata = tvb_get_guint8(parameter_tvb, offset);
2737                                 proto_tree_add_uint(bat_ase_element_tree, hf_BAT_ASE_Comp_Report_Reason, parameter_tvb, offset, 1, tempdata );
2738                                 offset = offset + 1;
2739
2740                                 diagnostic_len = content_len - 1;
2741                                 while ( diagnostic_len > 0 ) {
2742                                         tempdata = tvb_get_guint8(parameter_tvb, offset);
2743                                         proto_tree_add_uint(bat_ase_element_tree, hf_BAT_ASE_Comp_Report_ident, parameter_tvb, offset, 1, tempdata );
2744                                         offset = offset + 1;
2745                                         diagnostic = tvb_get_letohs(parameter_tvb, offset);
2746                                         proto_tree_add_uint(bat_ase_element_tree, hf_BAT_ASE_Comp_Report_diagnostic, parameter_tvb, offset, 2, diagnostic);
2747                                         offset = offset + 2;
2748                                         diagnostic_len = diagnostic_len - 3;
2749                                 }
2750                         break;
2751                         case BEARER_NETWORK_CONNECTION_CHARACTERISTICS :
2752                                 tempdata = tvb_get_guint8(parameter_tvb, offset);
2753                                 proto_tree_add_uint(bat_ase_element_tree, hf_characteristics , parameter_tvb,
2754                                                  offset, 1, tempdata );
2755                                 proto_item_append_text(bat_ase_element_item, " - %s",
2756                                                  val_to_str(tempdata,bearer_network_connection_characteristics_vals, "unknown (%u)"));
2757
2758                                 offset = offset + content_len;
2759                         break;
2760 /* The Bearer Control Information information element contains the bearer control tunnelling protocol */
2761 /* ITU-T Q.1990 (2001), BICC bearer control tunnelling protocol. */
2762
2763                         case BEARER_CONTROL_INFORMATION :               
2764                                 BCTP_Indicator_field_1 = tvb_get_guint8(parameter_tvb, offset);
2765                                 proto_tree_add_uint(bat_ase_element_tree, hf_BCTP_Version_Indicator, 
2766                                         parameter_tvb, offset, 1, BCTP_Indicator_field_1 );
2767                                 
2768                                 proto_tree_add_boolean(bat_ase_element_tree, hf_BVEI,
2769                                         parameter_tvb, offset, 1, BCTP_Indicator_field_1 );
2770                                 offset = offset + 1;
2771
2772                                 BCTP_Indicator_field_2 = tvb_get_guint8(parameter_tvb, offset);
2773                                 
2774                                 proto_tree_add_uint(bat_ase_element_tree, hf_Tunnelled_Protocol_Indicator ,
2775                                         parameter_tvb, offset, 1, BCTP_Indicator_field_2 );
2776                                 
2777                                 proto_tree_add_boolean(bat_ase_element_tree, hf_TPEI,
2778                                         parameter_tvb, offset, 1, BCTP_Indicator_field_2 );
2779                                 offset = offset + 1;
2780
2781                                 sdp_length = ( length_indicator ) - 3;
2782
2783                                 if(sdp_length > tvb_length_remaining(parameter_tvb,offset)){
2784                                         /* If this is a segmented message we may not have all the data */
2785                                         next_tvb = tvb_new_subset(parameter_tvb, offset, -1, -1);
2786                                 }else{
2787                                         next_tvb = tvb_new_subset(parameter_tvb, offset, sdp_length, sdp_length);
2788                                 }
2789                                 call_dissector(sdp_handle, next_tvb, pinfo, bat_ase_element_tree);
2790                                 offset = offset + sdp_length;
2791
2792
2793                         break;
2794                         case BEARER_CONTROL_TUNNELLING :                
2795
2796                                 tempdata = tvb_get_guint8(parameter_tvb, offset);
2797                                 proto_tree_add_boolean(bat_ase_element_tree, hf_bearer_control_tunneling , parameter_tvb, offset, 1, ( tempdata & 0x01 ) );
2798                                 if ( tempdata & 0x01 )
2799                                         proto_item_append_text(bat_ase_element_item, " - Tunnelling to be used ");
2800
2801                                 offset = offset + content_len;
2802                         break;
2803                         case BEARER_CONTROL_UNIT_IDENTIFIER :           
2804                                 tempdata = tvb_get_guint8(parameter_tvb, offset);
2805                                 proto_tree_add_text(bat_ase_element_tree, parameter_tvb, offset, 1, "Network ID Length indicator= %u",tempdata);
2806                                 offset = offset +1;
2807                                 if ( tempdata > 0 ) {
2808                                         offset = offset +1;
2809                                 
2810 /* Q.765.5 amd 1
2811         Network ID
2812         The coding of the Network ID field is identical to the coding of the Network ID field in the
2813         Global Call Reference parameter as specified in clause 6/Q.1902.3 (see [3]).
2814         NOTE .When used inside a network domain, the Network ID may be omitted by setting the
2815         Network ID Length indicator to the value "0".
2816         Q.1902.3
2817         The following codes are used in the subfields of the global call reference parameter field:
2818         a) Network ID
2819         The Network ID contains the value field (coded according to ASN.1 BER) of an object
2820         identifier identifying the network. This means that the tag and length fields are omitted.
2821         An example of such an object identifier can be the following:
2822         .{itu-t (0) administration (2) national regulatory authority (x) network (y)}
2823         The value for x is the value of the national regulatory authority (one of the Data Country
2824         Codes associated to the country as specified in ITU-T X.121 shall be used for "national
2825         regulatory authority"), the value for y is under the control of the national regulatory
2826         authority concerned.
2827         b) Node ID
2828         A binary number that uniquely identifies within the network the node which generates the
2829         call reference.
2830         c) Call Reference ID
2831         A binary number used for the call reference of the call. This is generated by the node for
2832         each call.
2833
2834 */
2835                                         proto_tree_add_text(bat_ase_element_tree, parameter_tvb, offset, tempdata , "Network ID: %s",
2836                                                             tvb_bytes_to_str(parameter_tvb, offset, tempdata));
2837                                         offset = offset + tempdata;
2838                                 } /* end if */
2839
2840                                 Local_BCU_ID = tvb_get_letohl(parameter_tvb, offset);
2841                                 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 );
2842                                 offset = offset + 4;
2843                         break;
2844                         case SIGNAL :           
2845                                 tempdata = tvb_get_guint8(parameter_tvb, offset);
2846                                 proto_tree_add_uint(bat_ase_element_tree, hf_bat_ase_signal , parameter_tvb, offset, 1, tempdata );
2847                                 offset = offset + 1;
2848                                 if ( content_len > 1){
2849                                 duration = tvb_get_letohs(parameter_tvb, offset);
2850                                 proto_tree_add_uint(bat_ase_element_tree, hf_bat_ase_duration , parameter_tvb, offset, 2, duration );
2851                                 offset = offset + 2;
2852                                 }
2853                         break;
2854                         case BEARER_REDIRECTION_CAPABILITY :                    
2855                                 tempdata = tvb_get_guint8(parameter_tvb, offset);
2856                                 proto_tree_add_boolean(bat_ase_element_tree, hf_late_cut_trough_cap_ind , parameter_tvb, offset, 1, tempdata );
2857                                 offset = offset + content_len;
2858                         break;
2859                         case BEARER_REDIRECTION_INDICATORS :
2860                                 number_of_indicators = 0;
2861                                 while ( number_of_indicators < content_len ) {          
2862                                         tempdata = tvb_get_guint8(parameter_tvb, offset);
2863                                         proto_tree_add_uint(bat_ase_element_tree, hf_bat_ase_bearer_redir_ind , parameter_tvb, offset, 1, tempdata );
2864                                         offset = offset + 1;
2865                                         number_of_indicators = number_of_indicators + 1;
2866                                 }
2867                         break;
2868                         case SIGNAL_TYPE :                                      
2869                                 tempdata = tvb_get_guint8(parameter_tvb, offset);
2870                                 proto_tree_add_uint(bat_ase_element_tree, hf_bat_ase_signal , parameter_tvb, offset, 1, tempdata );
2871                                 offset = offset + content_len;
2872                         break;
2873                         case DURATION :
2874                                 duration = tvb_get_letohs(parameter_tvb, offset);
2875                                 proto_tree_add_uint(bat_ase_element_tree, hf_bat_ase_duration , parameter_tvb, offset, 2, duration );
2876                                 offset = offset + content_len;
2877                         break;
2878                         default :
2879                                 proto_tree_add_text(bat_ase_element_tree, parameter_tvb, offset,content_len , "Default ?, (%u byte%s length)", (content_len), plurality(content_len, "", "s"));
2880                                 offset = offset + content_len;
2881                         }                                       
2882         } 
2883
2884 }
2885
2886
2887
2888 /*
2889 Octet
2890         -------------------------------------------
2891 1       | ext. Application context identifier lsb
2892         -------------------------------------------
2893 1a      | ext. msb
2894         -------------------------------------------
2895 2       | ext. spare                                            SNI RCI
2896         -------------------------------------------
2897 3       | ext. SI APM segmentation indicator
2898         -------------------------------------------
2899 3a      | ext. Segmentation local reference
2900         -------------------------------------------
2901 4a      |
2902 :       |       APM-user information
2903 4n      |
2904         +-------------------------------------------
2905         
2906         Figure 77/Q.763 . Application transport parameter field
2907   */
2908 static void
2909 dissect_isup_application_transport_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *parameter_tree, proto_item *parameter_item)
2910
2911
2912         guint8 application_transport_instruction_ind;
2913         guint8 si_and_apm_seg_ind;
2914         guint8 apm_Segmentation_local_ref = 0;
2915         guint16 aci16;
2916         gint offset = 0;
2917         guint8 octet;
2918         guint length = tvb_reported_length(parameter_tvb);
2919
2920         gboolean more_frag;
2921         gboolean   save_fragmented;
2922         tvbuff_t* new_tvb = NULL;
2923         tvbuff_t* next_tvb = NULL;
2924         fragment_data *frag_msg = NULL;
2925          
2926         proto_tree_add_text(parameter_tree, parameter_tvb, offset, -1, "Application transport parameter fields:");
2927         proto_item_set_text(parameter_item, "Application transport, (%u byte%s length)", length , plurality(length, "", "s"));
2928         aci16 = tvb_get_guint8(parameter_tvb, offset);
2929  
2930         if ( (aci16 & H_8BIT_MASK) == 0x80) {
2931                 /* Octet 1 */
2932                 aci16 = aci16 & 0x7f;
2933                 proto_tree_add_item( parameter_tree, hf_isup_extension_ind, parameter_tvb, offset, 1, FALSE );
2934                 proto_tree_add_uint(parameter_tree, hf_isup_app_cont_ident , parameter_tvb, offset, 1, aci16);
2935                 offset = offset + 1;
2936                 }
2937         /* Octet 1a */
2938         else {
2939                 aci16 = (aci16<<8) | (tvb_get_guint8(parameter_tvb, offset) & 0x7f);
2940                 proto_tree_add_uint(parameter_tree, hf_isup_app_cont_ident , parameter_tvb, offset, 2, aci16);
2941                 offset = offset + 2;
2942         }
2943
2944         /* Octet 2 */
2945         proto_tree_add_text(parameter_tree, parameter_tvb, offset, -1, "Application transport instruction indicators: ");
2946         application_transport_instruction_ind = tvb_get_guint8(parameter_tvb, offset);  
2947         proto_tree_add_item( parameter_tree, hf_isup_extension_ind, parameter_tvb, offset, 1, FALSE );
2948         proto_tree_add_item( parameter_tree, hf_isup_app_Send_notification_ind, parameter_tvb, offset, 1, FALSE );
2949         proto_tree_add_item( parameter_tree, hf_isup_app_Release_call_ind, parameter_tvb, offset, 1, FALSE );
2950         offset = offset + 1; 
2951
2952         /* Octet 3*/
2953         proto_tree_add_text(parameter_tree, parameter_tvb, offset, 1, "APM segmentation indicator:");
2954         si_and_apm_seg_ind  = tvb_get_guint8(parameter_tvb, offset);
2955         proto_tree_add_item( parameter_tree, hf_isup_extension_ind, parameter_tvb, offset, 1, FALSE );
2956         proto_tree_add_item( parameter_tree, hf_isup_apm_si_ind, parameter_tvb, offset, 1, FALSE );
2957         proto_tree_add_item( parameter_tree, hf_isup_apm_segmentation_ind, parameter_tvb, offset, 1, FALSE );
2958         offset = offset + 1;
2959
2960         /* Octet 3a */
2961         if ( (si_and_apm_seg_ind & H_8BIT_MASK) == 0x00) {
2962                 apm_Segmentation_local_ref  = tvb_get_guint8(parameter_tvb, offset);
2963                 proto_tree_add_item( parameter_tree, hf_isup_extension_ind, parameter_tvb, offset, 1, FALSE );
2964                 proto_tree_add_item( parameter_tree, hf_isup_apm_slr, parameter_tvb, offset, 1, FALSE );
2965                 offset = offset + 1;
2966         }
2967         /* For APM'98'-user applications. ( aci 0 - 3 ), APM-user information field starts at octet 4 */
2968         if (aci16 > 3) {
2969                 /* Octet 4 Originating Address length */
2970                 octet = tvb_get_guint8(parameter_tvb,offset);
2971                 proto_tree_add_item( parameter_tree, hf_isup_orig_addr_len, parameter_tvb, offset, 1, FALSE );
2972                 offset++;
2973                 if ( octet != 0){
2974                         /* 4b */
2975                         proto_tree_add_item( parameter_tree, hf_isup_odd_even_indicator, parameter_tvb, offset, 1, FALSE );
2976                         /* nature of address indicator */
2977                         offset++;
2978                         proto_tree_add_item( parameter_tree, hf_isup_inn_indicator, parameter_tvb, offset, 1, FALSE );
2979                         proto_tree_add_item( parameter_tree, hf_isup_numbering_plan_indicator, parameter_tvb, offset, 1, FALSE );
2980                         offset++;
2981                         /* Address digits */
2982                         proto_tree_add_text(parameter_tree, parameter_tvb, offset, octet - 2, "Address digits");
2983                         offset = offset + octet - 2;
2984                 }
2985                 /* Octet 5 Destination Address length */
2986                 octet = tvb_get_guint8(parameter_tvb,offset);
2987                 proto_tree_add_item( parameter_tree, hf_isup_dest_addr_len, parameter_tvb, offset, 1, FALSE );
2988                 offset++;
2989                 if ( octet != 0){
2990                         /* 4b */
2991                         proto_tree_add_item( parameter_tree, hf_isup_odd_even_indicator, parameter_tvb, offset, 1, FALSE );
2992                         /* nature of address indicator */
2993                         offset++;
2994                         proto_tree_add_item( parameter_tree, hf_isup_inn_indicator, parameter_tvb, offset, 1, FALSE );
2995                         proto_tree_add_item( parameter_tree, hf_isup_numbering_plan_indicator, parameter_tvb, offset, 1, FALSE );
2996                         offset++;
2997                         /* Address digits */
2998                         proto_tree_add_text(parameter_tree, parameter_tvb, offset, octet - 2, "Address digits");
2999                         offset = offset + octet - 2;
3000                 }
3001         }
3002         /*
3003          * Defragment ?
3004          * (si_and_apm_seg_ind != 0xc0) -> Non segmented APM message
3005          * (si_and_apm_seg_ind & H_8BIT_MASK)
3006          *    -> NO Segmentation local ref ( without SLR defrag. does not work)
3007          * 
3008          */
3009         if (isup_apm_desegment &&
3010             (si_and_apm_seg_ind != 0xc0 || si_and_apm_seg_ind & H_8BIT_MASK)){
3011                 /* Segmented message */
3012                 save_fragmented = pinfo->fragmented;
3013                 pinfo->fragmented = TRUE;
3014                 more_frag = TRUE;
3015                 if ((si_and_apm_seg_ind == 0))
3016                         more_frag = FALSE; 
3017                         
3018                 frag_msg = fragment_add_seq_next(parameter_tvb, offset, pinfo,
3019                                 (apm_Segmentation_local_ref & 0x7f),                    /* ID for fragments belonging together */  
3020                                 isup_apm_msg_fragment_table,                                    /* list of message fragments */
3021                                 isup_apm_msg_reassembled_table,                                 /* list of reassembled messages */
3022                                 tvb_length_remaining(parameter_tvb, offset),    /* fragment length - to the end */
3023                                 more_frag);                                                                             /* More fragments? */
3024
3025                 if ((si_and_apm_seg_ind & 0x3f) !=0 && (si_and_apm_seg_ind &0x40) !=0){
3026                         /* First fragment set number of fragments */
3027                         fragment_set_tot_len(pinfo, apm_Segmentation_local_ref & 0x7f, isup_apm_msg_fragment_table, (si_and_apm_seg_ind & 0x3f));
3028                 }
3029
3030                 new_tvb = process_reassembled_data(parameter_tvb, offset, pinfo,
3031                         "Reassembled Message", frag_msg, &isup_apm_msg_frag_items,
3032                         NULL, parameter_tree);
3033
3034                 if (frag_msg) { /* Reassembled */
3035                         if (check_col(pinfo->cinfo, COL_INFO))
3036                                 col_append_str(pinfo->cinfo, COL_INFO, 
3037                                 " (Message Reassembled)");
3038                 } else { /* Not last packet of reassembled Short Message */
3039                         if (check_col(pinfo->cinfo, COL_INFO))
3040                                 col_append_fstr(pinfo->cinfo, COL_INFO,
3041                                 " (Message fragment )");
3042                 }
3043                 
3044                 pinfo->fragmented = save_fragmented;
3045         }/*isup_apm_desegment*/
3046
3047         if ( offset == (gint)length){
3048                 /* No data */
3049                 proto_tree_add_text(parameter_tree, parameter_tvb, offset, 0, "Empty APM-user information field"  );
3050                 return;
3051         }
3052         if (new_tvb) { /* take it all */
3053                 next_tvb = new_tvb;
3054         } else { /* make a new subset */
3055                 next_tvb = tvb_new_subset(parameter_tvb, offset, -1, -1);
3056         }
3057
3058         proto_tree_add_text(parameter_tree, parameter_tvb, offset, -1, 
3059                 "APM-user information field (%u Bytes)",tvb_length_remaining(parameter_tvb, offset));
3060         
3061         /* dissect BAT ASE element, without transparent data ( Q.765.5-200006) */ 
3062         if ((aci16 & 0x7fff) != 5) {
3063                 proto_tree_add_text(parameter_tree, parameter_tvb, offset, -1, "No further dissection of APM-user information field");
3064                 return;
3065         }
3066
3067         dissect_bat_ase_Encapsulated_Application_Information(next_tvb, pinfo, parameter_tree, 0);
3068 }
3069
3070
3071
3072 /* ------------------------------------------------------------------
3073   Dissector Parameter Optional Forward Call indicators
3074  */
3075 static void
3076 dissect_isup_optional_forward_call_indicators_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
3077 {
3078   guint8 indicators;
3079
3080   indicators = tvb_get_guint8(parameter_tvb, 0);
3081   proto_tree_add_uint(parameter_tree, hf_isup_cug_call_ind, parameter_tvb, 0, OPTIONAL_FORWARD_CALL_IND_LENGTH, indicators);
3082   proto_tree_add_boolean(parameter_tree, hf_isup_simple_segmentation_ind, parameter_tvb, 0, OPTIONAL_FORWARD_CALL_IND_LENGTH, indicators);
3083   proto_tree_add_boolean(parameter_tree, hf_isup_connected_line_identity_request_ind, parameter_tvb, 0, OPTIONAL_FORWARD_CALL_IND_LENGTH, indicators);
3084
3085
3086   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 );
3087 }
3088 /* ------------------------------------------------------------------
3089   Dissector Parameter calling party number
3090  */
3091 void
3092 dissect_isup_calling_party_number_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
3093 {
3094   proto_item *address_digits_item;
3095   proto_tree *address_digits_tree;
3096   guint8 indicators1, indicators2;
3097   guint8 address_digit_pair=0;
3098   gint offset=0;
3099   gint i=0;
3100   gint length;
3101   char calling_number[MAXDIGITS + 1]="";
3102   e164_info_t e164_info;
3103   gint number_plan;
3104
3105   indicators1 = tvb_get_guint8(parameter_tvb, 0);
3106   proto_tree_add_boolean(parameter_tree, hf_isup_odd_even_indicator, parameter_tvb, 0, 1, indicators1);
3107   proto_tree_add_uint(parameter_tree, hf_isup_calling_party_nature_of_address_indicator, parameter_tvb, 0, 1, indicators1);
3108   indicators2 = tvb_get_guint8(parameter_tvb, 1);
3109   number_plan = (indicators2 & 0x70)>> 4;
3110   proto_tree_add_boolean(parameter_tree, hf_isup_ni_indicator, parameter_tvb, 1, 1, indicators2);
3111   proto_tree_add_uint(parameter_tree, hf_isup_numbering_plan_indicator, parameter_tvb, 1, 1, indicators2);
3112   proto_tree_add_uint(parameter_tree, hf_isup_address_presentation_restricted_indicator, parameter_tvb, 1, 1, indicators2);
3113   proto_tree_add_uint(parameter_tree, hf_isup_screening_indicator, parameter_tvb, 1, 1, indicators2);
3114   offset = 2;
3115
3116   length = tvb_length_remaining(parameter_tvb, offset);
3117   if (length > 0) {
3118     address_digits_item = proto_tree_add_text(parameter_tree, parameter_tvb,
3119                                               offset, -1,
3120                                               "Calling Party Number");
3121     address_digits_tree = proto_item_add_subtree(address_digits_item, ett_isup_address_digits);
3122
3123     while(length > 0){
3124       address_digit_pair = tvb_get_guint8(parameter_tvb, offset);
3125       proto_tree_add_uint(address_digits_tree, hf_isup_calling_party_odd_address_signal_digit, parameter_tvb, offset, 1, address_digit_pair);
3126       calling_number[i++] = number_to_char(address_digit_pair & ISUP_ODD_ADDRESS_SIGNAL_DIGIT_MASK);
3127       if (i > MAXDIGITS)
3128         THROW(ReportedBoundsError);
3129       if ((length - 1) > 0 ){
3130         proto_tree_add_uint(address_digits_tree, hf_isup_calling_party_even_address_signal_digit, parameter_tvb, offset, 1, address_digit_pair);
3131         calling_number[i++] = number_to_char((address_digit_pair & ISUP_EVEN_ADDRESS_SIGNAL_DIGIT_MASK) / 0x10);
3132         if (i > MAXDIGITS)
3133           THROW(ReportedBoundsError);
3134       }
3135       offset++;
3136       length = tvb_length_remaining(parameter_tvb, offset);
3137     }
3138
3139     if  (((indicators1 & 0x80) == 0) && (tvb_length(parameter_tvb) > 0)){ /* Even Indicator set -> last even digit is valid & has be displayed */
3140       proto_tree_add_uint(address_digits_tree, hf_isup_calling_party_even_address_signal_digit, parameter_tvb, offset - 1, 1, address_digit_pair);
3141       calling_number[i++] = number_to_char((address_digit_pair & ISUP_EVEN_ADDRESS_SIGNAL_DIGIT_MASK) / 0x10);
3142       if (i > MAXDIGITS)
3143         THROW(ReportedBoundsError);
3144     }
3145     proto_item_set_text(address_digits_item, "Calling Party Number: %s", calling_number);
3146     calling_number[i++] = '\0';
3147     if ( number_plan == 1 ) {
3148       e164_info.e164_number_type = CALLING_PARTY_NUMBER;
3149       e164_info.nature_of_address = indicators1 & 0x7f;
3150       e164_info.E164_number_str = calling_number;
3151       e164_info.E164_number_length = i - 1;
3152       dissect_e164_number(parameter_tvb, address_digits_tree, 2, (offset - 2), e164_info);
3153       proto_tree_add_string_hidden(address_digits_tree, hf_isup_calling, parameter_tvb,
3154             offset - length, length, calling_number);
3155     } else {
3156       proto_tree_add_string(address_digits_tree, hf_isup_calling, parameter_tvb,
3157           offset - length, length, calling_number);
3158     }
3159   }
3160   proto_item_set_text(parameter_item, "Calling Party Number: %s", calling_number);
3161   tap_calling_number = ep_strdup(calling_number);
3162 }
3163 /* ------------------------------------------------------------------
3164   Dissector Parameter Original called  number
3165  */
3166 void
3167 dissect_isup_original_called_number_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
3168 {
3169   proto_item *address_digits_item;
3170   proto_tree *address_digits_tree;
3171   guint8 indicators1, indicators2;
3172   guint8 address_digit_pair=0;
3173   gint offset=0;
3174   gint i=0;
3175   gint length;
3176   char calling_number[MAXDIGITS + 1]="";
3177
3178   indicators1 = tvb_get_guint8(parameter_tvb, 0);
3179   proto_tree_add_boolean(parameter_tree, hf_isup_odd_even_indicator, parameter_tvb, 0, 1, indicators1);
3180   proto_tree_add_uint(parameter_tree, hf_isup_calling_party_nature_of_address_indicator, parameter_tvb, 0, 1, indicators1);
3181   indicators2 = tvb_get_guint8(parameter_tvb, 1);
3182   proto_tree_add_uint(parameter_tree, hf_isup_numbering_plan_indicator, parameter_tvb, 1, 1, indicators2);
3183   proto_tree_add_uint(parameter_tree, hf_isup_address_presentation_restricted_indicator, parameter_tvb, 1, 1, indicators2);
3184   offset = 2;
3185
3186   address_digits_item = proto_tree_add_text(parameter_tree, parameter_tvb,
3187                                             offset, -1,
3188                                             "Original Called Number");
3189   address_digits_tree = proto_item_add_subtree(address_digits_item, ett_isup_address_digits);
3190
3191   length = tvb_length_remaining(parameter_tvb, offset);
3192   while(length > 0){
3193     address_digit_pair = tvb_get_guint8(parameter_tvb, offset);
3194     proto_tree_add_uint(address_digits_tree, hf_isup_calling_party_odd_address_signal_digit, parameter_tvb, offset, 1, address_digit_pair);
3195     calling_number[i++] = number_to_char(address_digit_pair & ISUP_ODD_ADDRESS_SIGNAL_DIGIT_MASK);
3196     if (i > MAXDIGITS)
3197       THROW(ReportedBoundsError);
3198     if ((length - 1) > 0 ){
3199       proto_tree_add_uint(address_digits_tree, hf_isup_calling_party_even_address_signal_digit, parameter_tvb, offset, 1, address_digit_pair);
3200       calling_number[i++] = number_to_char((address_digit_pair & ISUP_EVEN_ADDRESS_SIGNAL_DIGIT_MASK) / 0x10);
3201       if (i > MAXDIGITS)
3202         THROW(ReportedBoundsError);
3203     }
3204     offset++;
3205     length = tvb_length_remaining(parameter_tvb, offset);
3206   }
3207
3208   if  (((indicators1 & 0x80) == 0) && (tvb_length(parameter_tvb) > 0)){ /* Even Indicator set -> last even digit is valid & has be displayed */
3209       proto_tree_add_uint(address_digits_tree, hf_isup_calling_party_even_address_signal_digit, parameter_tvb, offset - 1, 1, address_digit_pair);
3210       calling_number[i++] = number_to_char((address_digit_pair & ISUP_EVEN_ADDRESS_SIGNAL_DIGIT_MASK) / 0x10);
3211       if (i > MAXDIGITS)
3212         THROW(ReportedBoundsError);
3213   }
3214   calling_number[i++] = '\0';
3215
3216   proto_item_set_text(address_digits_item, "Original Called Number: %s", calling_number);
3217   proto_item_set_text(parameter_item, "Original Called Number: %s", calling_number);
3218
3219 }
3220 /* ------------------------------------------------------------------
3221   Dissector Parameter Redirecting number
3222  */
3223 void
3224 dissect_isup_redirecting_number_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
3225 {
3226   proto_item *address_digits_item;
3227   proto_tree *address_digits_tree;
3228   guint8 indicators1, indicators2;
3229   guint8 address_digit_pair=0;
3230   gint offset=0;
3231   gint i=0;
3232   gint length;
3233   char calling_number[MAXDIGITS + 1]="";
3234
3235   indicators1 = tvb_get_guint8(parameter_tvb, 0);
3236   proto_tree_add_boolean(parameter_tree, hf_isup_odd_even_indicator, parameter_tvb, 0, 1, indicators1);
3237   proto_tree_add_uint(parameter_tree, hf_isup_calling_party_nature_of_address_indicator, parameter_tvb, 0, 1, indicators1);
3238   indicators2 = tvb_get_guint8(parameter_tvb, 1);
3239   proto_tree_add_uint(parameter_tree, hf_isup_numbering_plan_indicator, parameter_tvb, 1, 1, indicators2);
3240   proto_tree_add_uint(parameter_tree, hf_isup_address_presentation_restricted_indicator, parameter_tvb, 1, 1, indicators2);
3241   offset = 2;
3242
3243   address_digits_item = proto_tree_add_text(parameter_tree, parameter_tvb,
3244                                             offset, -1,
3245                                             "Redirecting Number");
3246   address_digits_tree = proto_item_add_subtree(address_digits_item, ett_isup_address_digits);
3247
3248   length = tvb_length_remaining(parameter_tvb, offset);
3249   while(length > 0){
3250     address_digit_pair = tvb_get_guint8(parameter_tvb, offset);
3251     proto_tree_add_uint(address_digits_tree, hf_isup_calling_party_odd_address_signal_digit, parameter_tvb, offset, 1, address_digit_pair);
3252     calling_number[i++] = number_to_char(address_digit_pair & ISUP_ODD_ADDRESS_SIGNAL_DIGIT_MASK);
3253     if (i > MAXDIGITS)
3254       THROW(ReportedBoundsError);
3255     if ((length - 1) > 0 ){
3256       proto_tree_add_uint(address_digits_tree, hf_isup_calling_party_even_address_signal_digit, parameter_tvb, offset, 1, address_digit_pair);
3257       calling_number[i++] = number_to_char((address_digit_pair & ISUP_EVEN_ADDRESS_SIGNAL_DIGIT_MASK) / 0x10);
3258       if (i > MAXDIGITS)
3259         THROW(ReportedBoundsError);
3260     }
3261     offset++;
3262     length = tvb_length_remaining(parameter_tvb, offset);
3263   }
3264
3265   if  (((indicators1 & 0x80) == 0) && (tvb_length(parameter_tvb) > 0)){ /* Even Indicator set -> last even digit is valid & has be displayed */
3266       proto_tree_add_uint(address_digits_tree, hf_isup_calling_party_even_address_signal_digit, parameter_tvb, offset - 1, 1, address_digit_pair);
3267       calling_number[i++] = number_to_char((address_digit_pair & ISUP_EVEN_ADDRESS_SIGNAL_DIGIT_MASK) / 0x10);
3268       if (i > MAXDIGITS)
3269         THROW(ReportedBoundsError);
3270   }
3271   calling_number[i++] = '\0';
3272
3273   proto_item_set_text(address_digits_item, "Redirecting Number: %s", calling_number);
3274   proto_tree_add_string(address_digits_tree, hf_isup_redirecting, parameter_tvb, offset - length, length, calling_number);
3275   proto_item_set_text(parameter_item, "Redirecting Number: %s", calling_number);
3276 }
3277 /* ------------------------------------------------------------------
3278   Dissector Parameter Redirection number
3279  */
3280 static void
3281 dissect_isup_redirection_number_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
3282 {
3283   proto_item *address_digits_item;
3284   proto_tree *address_digits_tree;
3285   guint8 indicators1, indicators2;
3286   guint8 address_digit_pair=0;
3287   gint offset=0;
3288   gint i=0;
3289   gint length;
3290   char called_number[MAXDIGITS + 1]="";
3291
3292   indicators1 = tvb_get_guint8(parameter_tvb, 0);
3293   proto_tree_add_boolean(parameter_tree, hf_isup_odd_even_indicator, parameter_tvb, 0, 1, indicators1);
3294   proto_tree_add_uint(parameter_tree, hf_isup_called_party_nature_of_address_indicator, parameter_tvb, 0, 1, indicators1);
3295   indicators2 = tvb_get_guint8(parameter_tvb, 1);
3296   proto_tree_add_boolean(parameter_tree, hf_isup_inn_indicator, parameter_tvb, 1, 1, indicators2);
3297   proto_tree_add_uint(parameter_tree, hf_isup_numbering_plan_indicator, parameter_tvb, 1, 1, indicators2);
3298   offset = 2;
3299
3300   address_digits_item = proto_tree_add_text(parameter_tree, parameter_tvb,
3301                                             offset, -1,
3302                                             "Redirection Number");
3303   address_digits_tree = proto_item_add_subtree(address_digits_item, ett_isup_address_digits);
3304
3305   length = tvb_length_remaining(parameter_tvb, offset);
3306   while(length > 0){
3307     address_digit_pair = tvb_get_guint8(parameter_tvb, offset);
3308     proto_tree_add_uint(address_digits_tree, hf_isup_called_party_odd_address_signal_digit, parameter_tvb, offset, 1, address_digit_pair);
3309     called_number[i++] = number_to_char(address_digit_pair & ISUP_ODD_ADDRESS_SIGNAL_DIGIT_MASK);
3310     if (i > MAXDIGITS)
3311       THROW(ReportedBoundsError);
3312     if ((length - 1) > 0 ){
3313       proto_tree_add_uint(address_digits_tree, hf_isup_called_party_even_address_signal_digit, parameter_tvb, offset, 1, address_digit_pair);
3314       called_number[i++] = number_to_char((address_digit_pair & ISUP_EVEN_ADDRESS_SIGNAL_DIGIT_MASK) / 0x10);
3315       if (i > MAXDIGITS)
3316         THROW(ReportedBoundsError);
3317     }
3318     offset++;
3319     length = tvb_length_remaining(parameter_tvb, offset);
3320   }
3321
3322   if  (((indicators1 & 0x80) == 0) && (tvb_length(parameter_tvb) > 0)){ /* Even Indicator set -> last even digit is valid & has be displayed */
3323       proto_tree_add_uint(address_digits_tree, hf_isup_called_party_even_address_signal_digit, parameter_tvb, offset - 1, 1, address_digit_pair);
3324       called_number[i++] = number_to_char((address_digit_pair & ISUP_EVEN_ADDRESS_SIGNAL_DIGIT_MASK) / 0x10);
3325       if (i > MAXDIGITS)
3326         THROW(ReportedBoundsError);
3327   }
3328   called_number[i++] = '\0';
3329
3330   proto_item_set_text(address_digits_item, "Redirection Number: %s", called_number);
3331   proto_item_set_text(parameter_item, "Redirection Number: %s", called_number);
3332 }
3333 /* ------------------------------------------------------------------
3334   Dissector Parameter Connection request
3335  */
3336 static void
3337 dissect_isup_connection_request_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
3338 {
3339   guint32 local_ref;
3340   guint16 spc;
3341   guint8 protocol_class, credit, offset=0;
3342
3343   local_ref = tvb_get_ntoh24(parameter_tvb, 0);
3344   proto_tree_add_text(parameter_tree, parameter_tvb, offset, LOCAL_REF_LENGTH, "Local Reference: %u", local_ref);
3345   offset = LOCAL_REF_LENGTH;
3346   spc = tvb_get_letohs(parameter_tvb,offset) & 0x3FFF; /*since 1st 2 bits spare */
3347   proto_tree_add_text(parameter_tree, parameter_tvb, offset, SPC_LENGTH, "Signalling Point Code: %u", spc);
3348   offset += SPC_LENGTH;
3349   protocol_class = tvb_get_guint8(parameter_tvb, offset);
3350   proto_tree_add_text(parameter_tree, parameter_tvb, offset, PROTOCOL_CLASS_LENGTH, "Protocol Class: %u", protocol_class);
3351   offset += PROTOCOL_CLASS_LENGTH;
3352   credit = tvb_get_guint8(parameter_tvb, offset);
3353   proto_tree_add_text(parameter_tree, parameter_tvb, offset, CREDIT_LENGTH, "Credit: %u", credit);
3354   offset += CREDIT_LENGTH;
3355
3356   proto_item_set_text(parameter_item, "Connection request: Local Reference = %u, SPC = %u, Protocol Class = %u, Credit = %u", local_ref, spc, protocol_class, credit);
3357 }
3358 /* ------------------------------------------------------------------
3359   Dissector Parameter Redirection information
3360  */
3361 void
3362 dissect_isup_redirection_information_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
3363 {
3364   if (tvb_length(parameter_tvb) == 2){
3365     guint16 indicators;
3366     indicators = tvb_get_ntohs(parameter_tvb, 0);
3367     proto_tree_add_uint(parameter_tree, hf_isup_redirecting_ind, parameter_tvb,0 , REDIRECTION_INFO_LENGTH, indicators);
3368     proto_tree_add_uint(parameter_tree, hf_isup_original_redirection_reason, parameter_tvb,0 , REDIRECTION_INFO_LENGTH, indicators);
3369     proto_tree_add_uint(parameter_tree, hf_isup_redirection_counter, parameter_tvb,0 , REDIRECTION_INFO_LENGTH, indicators);
3370     proto_tree_add_uint(parameter_tree, hf_isup_redirection_reason, parameter_tvb,0 , REDIRECTION_INFO_LENGTH, indicators);
3371     proto_item_set_text(parameter_item, "Redirection Information");
3372   }
3373   else { /* ISUP'88 (blue book) */
3374     guint16 indicators;
3375     indicators = tvb_get_guint8(parameter_tvb, 0) * 0x100; /*since 2nd octet isn't present*/
3376     proto_tree_add_uint(parameter_tree, hf_isup_redirecting_ind, parameter_tvb, 0, 1, indicators);
3377     proto_tree_add_uint(parameter_tree, hf_isup_original_redirection_reason, parameter_tvb,0 , 1, indicators);
3378     proto_item_set_text(parameter_item, "Redirection Information (2nd octet not present since ISUP '88)");
3379   }
3380 }
3381 /* ------------------------------------------------------------------
3382   Dissector Parameter Closed user group interlock code
3383  */
3384 static void
3385 dissect_isup_closed_user_group_interlock_code_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
3386 {
3387   char NI_digits[5]="";
3388   guint8 digit_pair;
3389   guint16 bin_code;
3390
3391   digit_pair = tvb_get_guint8(parameter_tvb, 0);
3392   NI_digits[0] = number_to_char((digit_pair & HGFE_8BIT_MASK) / 0x10);
3393   NI_digits[1] = number_to_char(digit_pair & DCBA_8BIT_MASK);
3394   digit_pair = tvb_get_guint8(parameter_tvb, 1);
3395   NI_digits[2] = number_to_char((digit_pair & HGFE_8BIT_MASK) / 0x10);
3396   NI_digits[3] = number_to_char(digit_pair & DCBA_8BIT_MASK);
3397   NI_digits[4] = '\0';
3398   proto_tree_add_text(parameter_tree, parameter_tvb, 0, 2, "Network Identity: %s", NI_digits);
3399   bin_code = tvb_get_ntohs(parameter_tvb, 2);
3400   proto_tree_add_text(parameter_tree, parameter_tvb, 3, 2, "Binary Code: 0x%x", bin_code);
3401   proto_item_set_text(parameter_item, "Closed user group interlock code: NI = %s, Binary code = 0x%x", NI_digits, bin_code);
3402 }
3403 /* ------------------------------------------------------------------
3404   Dissector Parameter User service information- no detailed dissection since defined in Rec. Q.931
3405  */
3406 static void
3407 dissect_isup_user_service_information_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
3408 { guint length = tvb_length(parameter_tvb);
3409   proto_tree_add_text(parameter_tree, parameter_tvb, 0, length,
3410           "User service information (-> Q.931 Bearer_capability)");
3411   proto_item_set_text(parameter_item, "User service information, (%u byte%s length)",
3412           length , plurality(length, "", "s"));
3413   dissect_q931_bearer_capability_ie(parameter_tvb,
3414                                             0, length,
3415                                             parameter_tree);
3416 }
3417 /* ------------------------------------------------------------------
3418   Dissector Parameter Signalling point code
3419  */
3420 static void
3421 dissect_isup_signalling_point_code_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
3422 {
3423   guint16 spc;
3424
3425   spc = tvb_get_letohs(parameter_tvb, 0) & 0x3FFF; /*since 1st 2 bits spare */
3426   proto_tree_add_text(parameter_tree, parameter_tvb, 0, SIGNALLING_POINT_CODE_LENGTH, "Signalling Point Code: %u", spc);
3427
3428   proto_item_set_text(parameter_item, "Signalling point code: %u", spc);
3429 }
3430 /* ------------------------------------------------------------------
3431   Dissector Parameter Connected number
3432  */
3433 static void
3434 dissect_isup_connected_number_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
3435 {
3436   proto_item *address_digits_item;
3437   proto_tree *address_digits_tree;
3438   guint8 indicators1, indicators2;
3439   guint8 address_digit_pair=0;
3440   gint offset=0;
3441   gint i=0;
3442   gint length;
3443   char calling_number[MAXDIGITS + 1]="";
3444
3445   indicators1 = tvb_get_guint8(parameter_tvb, 0);
3446   proto_tree_add_boolean(parameter_tree, hf_isup_odd_even_indicator, parameter_tvb, 0, 1, indicators1);
3447   proto_tree_add_uint(parameter_tree, hf_isup_calling_party_nature_of_address_indicator, parameter_tvb, 0, 1, indicators1);
3448   indicators2 = tvb_get_guint8(parameter_tvb, 1);
3449   proto_tree_add_uint(parameter_tree, hf_isup_numbering_plan_indicator, parameter_tvb, 1, 1, indicators2);
3450   proto_tree_add_uint(parameter_tree, hf_isup_address_presentation_restricted_indicator, parameter_tvb, 1, 1, indicators2);
3451   proto_tree_add_uint(parameter_tree, hf_isup_screening_indicator, parameter_tvb, 1, 1, indicators2);
3452   offset = 2;
3453
3454   length = tvb_length_remaining(parameter_tvb, offset);
3455   if (length == 0) 
3456         return; /* empty connected number */
3457   address_digits_item = proto_tree_add_text(parameter_tree, parameter_tvb,
3458                                             offset, -1,
3459                                             "Connected Number");
3460   address_digits_tree = proto_item_add_subtree(address_digits_item, ett_isup_address_digits);
3461
3462   while(length > 0){
3463     address_digit_pair = tvb_get_guint8(parameter_tvb, offset);
3464     proto_tree_add_uint(address_digits_tree, hf_isup_calling_party_odd_address_signal_digit, parameter_tvb, offset, 1, address_digit_pair);
3465     calling_number[i++] = number_to_char(address_digit_pair & ISUP_ODD_ADDRESS_SIGNAL_DIGIT_MASK);
3466     if (i > MAXDIGITS)
3467       THROW(ReportedBoundsError);
3468     if ((length - 1) > 0 ){
3469       proto_tree_add_uint(address_digits_tree, hf_isup_calling_party_even_address_signal_digit, parameter_tvb, offset, 1, address_digit_pair);
3470       calling_number[i++] = number_to_char((address_digit_pair & ISUP_EVEN_ADDRESS_SIGNAL_DIGIT_MASK) / 0x10);
3471       if (i > MAXDIGITS)
3472         THROW(ReportedBoundsError);
3473     }
3474     offset++;
3475     length = tvb_length_remaining(parameter_tvb, offset);
3476   }
3477
3478   if  (((indicators1 & 0x80) == 0) && (tvb_length(parameter_tvb) > 0)){ /* Even Indicator set -> last even digit is valid & has be displayed */
3479       proto_tree_add_uint(address_digits_tree, hf_isup_calling_party_even_address_signal_digit, parameter_tvb, offset - 1, 1, address_digit_pair);
3480       calling_number[i++] = number_to_char((address_digit_pair & ISUP_EVEN_ADDRESS_SIGNAL_DIGIT_MASK) / 0x10);
3481       if (i > MAXDIGITS)
3482         THROW(ReportedBoundsError);
3483   }
3484   calling_number[i++] = '\0';
3485
3486   proto_item_set_text(address_digits_item, "Connected Number: %s", calling_number);
3487   proto_item_set_text(parameter_item, "Connected Number: %s", calling_number);
3488
3489 }
3490 /* ------------------------------------------------------------------
3491   Dissector Transit network selection
3492  */
3493 static void
3494 dissect_isup_transit_network_selection_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
3495 {
3496   proto_item *address_digits_item;
3497   proto_tree *address_digits_tree;
3498   guint8 indicators;
3499   guint8 address_digit_pair=0;
3500   gint offset=0;
3501   gint i=0;
3502   gint length;
3503   char network_id[MAXDIGITS + 1]="";
3504
3505   indicators = tvb_get_guint8(parameter_tvb, 0);
3506   proto_tree_add_boolean(parameter_tree, hf_isup_odd_even_indicator, parameter_tvb, 0, 1, indicators);
3507   proto_tree_add_uint(parameter_tree, hf_isup_type_of_network_identification, parameter_tvb, 0, 1, indicators);
3508   proto_tree_add_uint(parameter_tree, hf_isup_network_identification_plan, parameter_tvb, 0, 1, indicators);
3509   offset = 1;
3510
3511   address_digits_item = proto_tree_add_text(parameter_tree, parameter_tvb,
3512                                             offset, -1,
3513                                             "Network identification");
3514   address_digits_tree = proto_item_add_subtree(address_digits_item, ett_isup_address_digits);
3515
3516   length = tvb_length_remaining(parameter_tvb, offset);
3517   while(length > 0){
3518     address_digit_pair = tvb_get_guint8(parameter_tvb, offset);
3519     proto_tree_add_uint(address_digits_tree, hf_isup_calling_party_odd_address_signal_digit, parameter_tvb, offset, 1, address_digit_pair);
3520     network_id[i++] = number_to_char(address_digit_pair & ISUP_ODD_ADDRESS_SIGNAL_DIGIT_MASK);
3521     if (i > MAXDIGITS)
3522       THROW(ReportedBoundsError);
3523     if ((length - 1) > 0 ){
3524       proto_tree_add_uint(address_digits_tree, hf_isup_calling_party_even_address_signal_digit, parameter_tvb, offset, 1, address_digit_pair);
3525       network_id[i++] = number_to_char((address_digit_pair & ISUP_EVEN_ADDRESS_SIGNAL_DIGIT_MASK) / 0x10);
3526       if (i > MAXDIGITS)
3527         THROW(ReportedBoundsError);
3528     }
3529     offset++;
3530     length = tvb_length_remaining(parameter_tvb, offset);
3531   }
3532
3533   if  (((indicators & 0x80) == 0) && (tvb_length(parameter_tvb) > 0)){ /* Even Indicator set -> last even digit is valid & has be displayed */
3534       proto_tree_add_uint(address_digits_tree, hf_isup_calling_party_even_address_signal_digit, parameter_tvb, offset - 1, 1, address_digit_pair);
3535       network_id[i++] = number_to_char((address_digit_pair & ISUP_EVEN_ADDRESS_SIGNAL_DIGIT_MASK) / 0x10);
3536       if (i > MAXDIGITS)
3537         THROW(ReportedBoundsError);
3538   }
3539   network_id[i++] = '\0';
3540
3541   proto_item_set_text(address_digits_item, "Network identification: %s", network_id);
3542   proto_item_set_text(parameter_item, "Transit network selection: %s", network_id);
3543
3544 }
3545 /* ------------------------------------------------------------------
3546   Dissector Parameter Circuit assignment map
3547  */
3548 static void
3549 dissect_isup_circuit_assignment_map_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
3550 { guint8 map_type;
3551
3552   map_type = tvb_get_guint8(parameter_tvb, 0);
3553   proto_tree_add_uint(parameter_tree, hf_isup_map_type, parameter_tvb, 0, 1, map_type);
3554   proto_tree_add_text(parameter_tree, parameter_tvb, 1, 5, "Circuit assignment map (bit position indicates usage of corresponding circuit->3.69/Q.763)");
3555   proto_item_set_text(parameter_item, "Circuit assignment map");
3556 }
3557 /* ------------------------------------------------------------------
3558   Dissector Parameter Automatic congestion level
3559  */
3560 static void
3561 dissect_isup_automatic_congestion_level_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
3562 { guint8 congestion_level;
3563
3564   congestion_level = tvb_get_guint8(parameter_tvb, 0);
3565   proto_tree_add_uint(parameter_tree, hf_isup_automatic_congestion_level, parameter_tvb, 0, AUTO_CONGEST_LEVEL_LENGTH, congestion_level);
3566   proto_item_set_text(parameter_item, "Automatic congestion level: %s (%u)", val_to_str(congestion_level, isup_auto_congestion_level_value, "spare"), congestion_level);
3567 }
3568 /* ------------------------------------------------------------------
3569   Dissector Parameter Optional backward Call indicators
3570  */
3571 static void
3572 dissect_isup_optional_backward_call_indicators_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
3573 {
3574   guint8 indicators;
3575
3576   indicators = tvb_get_guint8(parameter_tvb, 0);
3577   proto_tree_add_boolean(parameter_tree, hf_isup_inband_information_ind, parameter_tvb, 0, OPTIONAL_BACKWARD_CALL_IND_LENGTH, indicators);
3578   proto_tree_add_boolean(parameter_tree, hf_isup_call_diversion_may_occur_ind, parameter_tvb, 0, OPTIONAL_BACKWARD_CALL_IND_LENGTH, indicators);
3579   proto_tree_add_boolean(parameter_tree, hf_isup_simple_segmentation_ind, parameter_tvb, 0, OPTIONAL_BACKWARD_CALL_IND_LENGTH, indicators);
3580   proto_tree_add_boolean(parameter_tree, hf_isup_mlpp_user_ind, parameter_tvb, 0, OPTIONAL_BACKWARD_CALL_IND_LENGTH, indicators);
3581
3582
3583   proto_item_set_text(parameter_item,"Optional backward call indicators: 0x%x", indicators );
3584 }
3585 /* ------------------------------------------------------------------
3586   Dissector Parameter User-to-user indicators
3587  */
3588 static const true_false_string isup_UUI_type_value = {
3589   "Response",
3590   "Request"
3591 };
3592 static const value_string isup_UUI_request_service_values[] = {
3593   { 0,  "No information"},
3594   { 1,  "Spare"},
3595   { 2,  "Request, not essential"},
3596   { 3,  "Request,essential"},
3597   { 0,  NULL}
3598 };
3599
3600 static const value_string isup_UUI_response_service_values[] = {
3601   { 0,  "No information"},
3602   { 1,  "Not provided"},
3603   { 2,  "Provided"},
3604   { 3,  "Spare"},
3605   { 0,  NULL}
3606 };
3607 static const true_false_string isup_UUI_network_discard_ind_value= {
3608   "User-to-user information discarded by the network",
3609   "No information"
3610 };
3611
3612 static void
3613 dissect_isup_user_to_user_indicators_parameter(tvbuff_t *parameter_tvb, 
3614                                                                                            proto_tree *parameter_tree, 
3615                                                                                            proto_item *parameter_item)
3616 {
3617   guint8 indicators;
3618
3619   indicators = tvb_get_guint8(parameter_tvb, 0);
3620   proto_tree_add_boolean(parameter_tree, hf_isup_UUI_type, parameter_tvb, 0, 1, indicators);
3621   if ( (indicators & 0x01) == 0 ){      
3622           /* Request */
3623           proto_tree_add_uint(parameter_tree, hf_isup_UUI_req_service1, parameter_tvb, 0, 1, indicators);
3624           proto_tree_add_uint(parameter_tree, hf_isup_UUI_req_service2, parameter_tvb, 0, 1, indicators);
3625           proto_tree_add_uint(parameter_tree, hf_isup_UUI_req_service3, parameter_tvb, 0, 1, indicators);
3626   }
3627   else {
3628           /* Response */
3629           proto_tree_add_uint(parameter_tree, hf_isup_UUI_res_service1, parameter_tvb, 0, 1, indicators);
3630           proto_tree_add_uint(parameter_tree, hf_isup_UUI_res_service2, parameter_tvb, 0, 1, indicators);
3631           proto_tree_add_uint(parameter_tree, hf_isup_UUI_res_service3, parameter_tvb, 0, 1, indicators);
3632           proto_tree_add_boolean(parameter_tree, hf_isup_UUI_network_discard_ind, parameter_tvb, 0, 1, indicators);
3633         
3634   }  
3635   proto_item_set_text(parameter_item,"User-to-user indicators: 0x%x", indicators );
3636 }
3637 /* ------------------------------------------------------------------
3638   Dissector Parameter Original ISC point code
3639  */
3640 static void
3641 dissect_isup_original_isc_point_code_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
3642 {
3643   guint16 spc;
3644
3645   spc = tvb_get_letohs(parameter_tvb, 0) & 0x3FFF; /*since 1st 2 bits spare */
3646   proto_tree_add_text(parameter_tree, parameter_tvb, 0, ORIGINAL_ISC_POINT_CODE_LENGTH, "Origination ISC Point Code: %u", spc);
3647
3648   proto_item_set_text(parameter_item, "Origination ISC point code: %u", spc);
3649 }
3650 /* ------------------------------------------------------------------
3651   Dissector Parameter Generic notification indicator
3652  */
3653 static void
3654 dissect_isup_generic_notification_indicator_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
3655 {
3656   guint8 indicators;
3657
3658   indicators = tvb_get_guint8(parameter_tvb, 0);
3659   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 );
3660   proto_item_set_text(parameter_item,"Generic notification indicator: 0x%x", indicators );
3661 }
3662 /* ------------------------------------------------------------------
3663   Dissector Parameter Call history information
3664  */
3665 static void
3666 dissect_isup_call_history_information_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
3667 {
3668   guint16 info;
3669
3670   info = tvb_get_ntohs(parameter_tvb, 0);
3671   proto_tree_add_text(parameter_tree, parameter_tvb, 0, CALL_HISTORY_INFO_LENGTH, "Call history info: propagation delay = %u ms", info);
3672   proto_item_set_text(parameter_item,"Call history info: propagation delay = %u ms", info);
3673 }
3674 /* ------------------------------------------------------------------
3675   Dissector Parameter Access delivery information
3676  */
3677 static void
3678 dissect_isup_access_delivery_information_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
3679 { guint8 indicator;
3680
3681   indicator = tvb_get_guint8(parameter_tvb, 0);
3682   proto_tree_add_boolean(parameter_tree, hf_isup_access_delivery_ind, parameter_tvb, 0, ACCESS_DELIVERY_INFO_LENGTH, indicator);
3683   proto_item_set_text(parameter_item, "Access delivery information: 0x%x", indicator);
3684 }
3685 /* ------------------------------------------------------------------
3686   Dissector Parameter Network specific facility
3687  */
3688 static void
3689 dissect_isup_network_specific_facility_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
3690 { guint length = tvb_length(parameter_tvb);
3691   proto_tree_add_text(parameter_tree, parameter_tvb, 0, length, "Network specific facility (refer to 3.36/Q.763 for detailed decoding)");
3692   proto_item_set_text(parameter_item, "Network specific facility (%u byte%s length)", length , plurality(length, "", "s"));
3693 }
3694 /* ------------------------------------------------------------------
3695   Dissector Parameter User service information prime
3696  */
3697 static void
3698 dissect_isup_user_service_information_prime_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
3699 { guint length = tvb_length(parameter_tvb);
3700   proto_tree_add_text(parameter_tree, parameter_tvb, 0, length,
3701           "User service information prime (-> Q.931 Bearer capability information IE)");
3702   dissect_q931_bearer_capability_ie(parameter_tvb,
3703                                             0, length,
3704                                             parameter_tree);
3705
3706   proto_item_set_text(parameter_item, "User service information prime, (%u byte%s length)",
3707           length , plurality(length, "", "s"));
3708 }
3709 /* ------------------------------------------------------------------
3710   Dissector Parameter Propagation delay counter
3711  */
3712 static void
3713 dissect_isup_propagation_delay_counter_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
3714 {
3715   guint16 info;
3716
3717   info = tvb_get_ntohs(parameter_tvb, 0);
3718   proto_tree_add_text(parameter_tree, parameter_tvb, 0, PROPAGATION_DELAY_COUNT_LENGTH, "Propagation delay counter = %u ms", info);
3719   proto_item_set_text(parameter_item,"Propagation delay counter = %u ms", info);
3720 }
3721 /* ------------------------------------------------------------------
3722   Dissector Parameter Remote operations
3723  */
3724 static void
3725 dissect_isup_remote_operations_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
3726 { guint length = tvb_length(parameter_tvb);
3727   proto_tree_add_text(parameter_tree, parameter_tvb, 0, length, "Remote operations");
3728   proto_item_set_text(parameter_item, "Remote operations (%u byte%s length)", length , plurality(length, "", "s"));
3729 }
3730 /* ------------------------------------------------------------------
3731   Dissector Parameter Service activation
3732  */
3733 static void
3734 dissect_isup_service_activation_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
3735 {
3736   guint i;
3737   guint8 feature_code;
3738   guint length = tvb_length(parameter_tvb);
3739   for (i=0; i< length; i++){
3740     feature_code = tvb_get_guint8(parameter_tvb, i);
3741     proto_tree_add_text(parameter_tree, parameter_tvb, i, 1, "Feature Code %u: %u", i+1, feature_code);
3742   }
3743   proto_item_set_text(parameter_item, "Service Activation (%u byte%s length)", length , plurality(length, "", "s"));
3744 }
3745 /* ------------------------------------------------------------------
3746   Dissector Parameter User service information prime - no detailed dissection since defined in Rec. Q.931
3747  */
3748 static void
3749 dissect_isup_user_teleservice_information_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
3750
3751   guint length = tvb_length(parameter_tvb);
3752   proto_tree_add_text(parameter_tree, parameter_tvb, 0, length,
3753           "User teleservice information (-> Q.931 High Layer Compatibility IE)");
3754
3755   dissect_q931_high_layer_compat_ie(parameter_tvb, 0, length, parameter_tree);
3756
3757   proto_item_set_text(parameter_item, 
3758           "User teleservice information");
3759 }
3760 /* ------------------------------------------------------------------
3761   Dissector Parameter Transmission medium requirement used
3762  */
3763 static void
3764 dissect_isup_transmission_medium_used_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
3765 {
3766   guint8 transmission_medium_requirement;
3767
3768   transmission_medium_requirement = tvb_get_guint8(parameter_tvb, 0);
3769   proto_tree_add_uint(parameter_tree, hf_isup_transmission_medium_requirement_prime, parameter_tvb, 0, TRANSMISSION_MEDIUM_RQMT_PRIME_LENGTH,transmission_medium_requirement);
3770
3771   proto_item_set_text(parameter_item, "Transmission medium used: %u (%s)",  transmission_medium_requirement, val_to_str(transmission_medium_requirement, isup_transmission_medium_requirement_prime_value, "spare/reserved"));
3772 }
3773 /* ------------------------------------------------------------------
3774   Dissector Parameter Call diversion information
3775  */
3776 static void
3777 dissect_isup_call_diversion_information_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
3778 { guint8 indicator;
3779
3780   indicator = tvb_get_guint8(parameter_tvb, 0);
3781   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);
3782   proto_item_set_text(parameter_item, "Call diversion information: 0x%x", indicator);
3783 }
3784 /* ------------------------------------------------------------------
3785   Dissector Parameter Echo control  information
3786  */
3787 static const value_string OECD_inf_ind_vals[] = {
3788         {0x00, "no information"},
3789         {0x01, "outgoing echo control device not included and not available"},
3790         {0x02, "outgoing echo control device included"},
3791         {0x03, "outgoing echo control device not included but available"},
3792         { 0,    NULL }
3793 };
3794 static const value_string IECD_inf_ind_vals[] = {
3795         {0x00, "no information"},
3796         {0x01, "incoming echo control device not included and not available"},
3797         {0x02, "incoming echo control device included"},
3798         {0x03, "incoming echo control device not included but available"},
3799         { 0,    NULL }
3800 };
3801
3802 static const value_string OECD_req_ind_vals[] = {
3803         {0x00, "no information"},
3804         {0x01, "outgoing echo control device activation request"},
3805         {0x02, "outgoing echo control device deactivation request"},
3806         {0x03, "spare"},
3807         { 0,    NULL }
3808 };
3809
3810 static const value_string IECD_req_ind_vals[] = {
3811         {0x00, "no information"},
3812         {0x01, "incoming echo control device activation request"},
3813         {0x02, "incoming echo control device deactivation request"},
3814         {0x03, "spare"},
3815         { 0,    NULL }
3816 };
3817
3818 static void
3819 dissect_isup_echo_control_information_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
3820 { guint8 indicator;
3821   gint offset = 0;
3822   indicator = tvb_get_guint8(parameter_tvb, 0);
3823   proto_tree_add_text(parameter_tree, parameter_tvb, 0, ECHO_CONTROL_INFO_LENGTH,
3824           "Echo control information: 0x%x", indicator);
3825
3826   proto_tree_add_uint(parameter_tree, hf_isup_OECD_inf_ind, 
3827                 parameter_tvb, offset, 1, indicator );
3828
3829   proto_tree_add_uint(parameter_tree, hf_isup_IECD_inf_ind, 
3830                 parameter_tvb, offset, 1, indicator );
3831
3832   proto_tree_add_uint(parameter_tree, hf_isup_OECD_req_ind, 
3833                 parameter_tvb, offset, 1, indicator );
3834
3835   proto_tree_add_uint(parameter_tree, hf_isup_IECD_req_ind, 
3836                 parameter_tvb, offset, 1, indicator );
3837
3838   proto_item_set_text(parameter_item, "Echo control information: 0x%x", indicator);
3839 }
3840 /* ------------------------------------------------------------------
3841   Dissector Parameter Message compatibility information
3842  */
3843
3844 static const true_false_string isup_pass_on_not_possible_indicator_value = {
3845         "discard information",
3846         "release call",
3847 };
3848
3849 static void
3850 dissect_isup_message_compatibility_information_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
3851 {
3852  guint length = tvb_length(parameter_tvb);
3853  guint instruction_indicators;
3854  gint offset = 0;
3855  instruction_indicators = tvb_get_guint8(parameter_tvb, offset);
3856  
3857  proto_tree_add_text(parameter_tree, parameter_tvb, 0, length, 
3858           "Message compatibility information");
3859
3860  proto_tree_add_boolean(parameter_tree, hf_isup_transit_at_intermediate_exchange_ind, 
3861                 parameter_tvb, offset, 1, instruction_indicators );
3862
3863  proto_tree_add_boolean(parameter_tree, hf_isup_Release_call_ind, 
3864          parameter_tvb, offset, 1, instruction_indicators );
3865
3866  proto_tree_add_boolean(parameter_tree, hf_isup_Send_notification_ind, 
3867          parameter_tvb, offset, 1, instruction_indicators );
3868
3869  proto_tree_add_boolean(parameter_tree, hf_isup_Discard_message_ind_value, 
3870          parameter_tvb, offset, 1, instruction_indicators );
3871
3872  proto_tree_add_boolean(parameter_tree, hf_isup_pass_on_not_possible_indicator2, 
3873          parameter_tvb, offset, 1,instruction_indicators);
3874
3875  proto_tree_add_uint(parameter_tree, hf_isup_Broadband_narrowband_interworking_ind2,
3876          parameter_tvb, offset, 1,instruction_indicators);
3877
3878  proto_tree_add_boolean(parameter_tree, hf_isup_extension_ind , 
3879          parameter_tvb, offset, 1, instruction_indicators );
3880
3881   proto_item_set_text(parameter_item, "Message compatibility information (%u byte%s length)",
3882           length , plurality(length, "", "s"));
3883 }
3884 /* ------------------------------------------------------------------
3885   Dissector Parameter compatibility information
3886  */
3887 static const true_false_string isup_transit_at_intermediate_exchange_ind_value  = {
3888   "End node interpretation",
3889   "Transit interpretation"
3890 };
3891
3892
3893 static const true_false_string isup_Discard_message_ind_value = {
3894         "Discard message",
3895         "Do not discard message (pass on)",
3896 };
3897
3898 static const true_false_string isup_Discard_parameter_ind_value = {
3899         "Discard parameter",
3900         "Do not discard parameter (pass on)",
3901 };
3902
3903 static const value_string isup_Pass_on_not_possible_indicator_vals[] = {
3904         { 0x00, "Release call" },
3905         { 0x01, "Discard message" },
3906         { 0x02, "Discard parameter" },
3907         { 0x03, "Reserved (interpreted as 00)" },
3908         { 0, NULL },
3909 };
3910 static const value_string ISUP_Broadband_narrowband_interworking_indicator_vals[] = {
3911         { 0x00, "Pass on" },
3912         { 0x01, "Discard message" },
3913         { 0x02, "Release call" },
3914         { 0x03, "Discard parameter" },
3915         { 0, NULL },
3916 }; 
3917
3918 static void
3919 dissect_isup_parameter_compatibility_information_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
3920 {
3921   guint  length = tvb_length(parameter_tvb);
3922   guint  len = length;
3923   guint8 upgraded_parameter, upgraded_parameter_no;
3924   guint8 offset;
3925   guint8 instruction_indicators; 
3926   offset = 0;
3927   upgraded_parameter_no = 0;
3928
3929   proto_item_set_text(parameter_item, "Parameter compatibility information (%u byte%s length)", length , plurality(length, "", "s"));
3930 /* etxrab Decoded as per Q.763 section 3.41 */
3931
3932   while ( len > 0 ) {
3933   upgraded_parameter_no = upgraded_parameter_no + 1;
3934   upgraded_parameter = tvb_get_guint8(parameter_tvb, offset);
3935
3936   proto_tree_add_text(parameter_tree, parameter_tvb, offset, 1,
3937             "Upgraded parameter no: %u = %s", upgraded_parameter_no,
3938             val_to_str(upgraded_parameter, isup_parameter_type_value, "unknown (%u)"));
3939   offset += 1;
3940   len -= 1;
3941   instruction_indicators = tvb_get_guint8(parameter_tvb, offset);
3942
3943   proto_tree_add_text(parameter_tree, parameter_tvb, offset, 1,
3944                     "Instruction indicators: 0x%x ",
3945                     instruction_indicators);
3946
3947  proto_tree_add_boolean(parameter_tree, hf_isup_transit_at_intermediate_exchange_ind, 
3948                 parameter_tvb, offset, 1, instruction_indicators );
3949
3950  proto_tree_add_boolean(parameter_tree, hf_isup_Release_call_ind, parameter_tvb, offset, 1, instruction_indicators );
3951
3952  proto_tree_add_boolean(parameter_tree, hf_isup_Send_notification_ind, parameter_tvb, offset, 1, instruction_indicators );
3953
3954  proto_tree_add_boolean(parameter_tree, hf_isup_Discard_message_ind_value, parameter_tvb, offset, 1, instruction_indicators );
3955
3956  proto_tree_add_boolean(parameter_tree, hf_isup_Discard_parameter_ind, parameter_tvb, offset, 1, instruction_indicators );
3957
3958  proto_tree_add_uint(parameter_tree, hf_isup_Pass_on_not_possible_indicator, parameter_tvb, offset, 1,instruction_indicators);
3959
3960  proto_tree_add_boolean(parameter_tree, hf_isup_extension_ind , parameter_tvb, offset, 1, instruction_indicators );
3961
3962   offset += 1;
3963   len -= 1;
3964   if (!(instruction_indicators & H_8BIT_MASK)) {
3965                 if (len == 0)
3966                         return;
3967                   instruction_indicators = tvb_get_guint8(parameter_tvb, offset);
3968                  proto_tree_add_uint(parameter_tree, hf_isup_Broadband_narrowband_interworking_ind, parameter_tvb, offset, 1,instruction_indicators);
3969                  offset += 1;
3970                   len -= 1;
3971                   }
3972    if (len == 0)
3973    return;
3974   ;
3975  }
3976 /* etxrab */
3977  
3978 }
3979 /* ------------------------------------------------------------------
3980   Dissector Parameter MLPP precedence
3981  */
3982 static void
3983 dissect_isup_mlpp_precedence_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
3984 {
3985   char NI_digits[5]="";
3986   guint8 indicators, digit_pair;
3987   guint32 bin_code;
3988
3989   indicators = tvb_get_guint8(parameter_tvb, 0);
3990   proto_tree_add_text(parameter_tree, parameter_tvb, 0, 1, "LFB (Bits 6+7) and precedence level (Bits 1-4): 0x%x",indicators);
3991   digit_pair = tvb_get_guint8(parameter_tvb, 1);
3992   NI_digits[0] = number_to_char((digit_pair & HGFE_8BIT_MASK) / 0x10);
3993   NI_digits[1] = number_to_char(digit_pair & DCBA_8BIT_MASK);
3994   digit_pair = tvb_get_guint8(parameter_tvb, 2);
3995   NI_digits[2] = number_to_char((digit_pair & HGFE_8BIT_MASK) / 0x10);
3996   NI_digits[3] = number_to_char(digit_pair & DCBA_8BIT_MASK);
3997   NI_digits[4] = '\0';
3998   proto_tree_add_text(parameter_tree, parameter_tvb, 1, 2, "Network Identity: %s", NI_digits);
3999   bin_code = tvb_get_ntoh24(parameter_tvb, 3);
4000   proto_tree_add_text(parameter_tree, parameter_tvb, 3, 3, "MLPP service domain: 0x%x", bin_code);
4001   proto_item_set_text(parameter_item, "MLPP precedence: NI = %s, MLPP service domain = 0x%x", NI_digits, bin_code);
4002 }
4003 /* ------------------------------------------------------------------
4004   Dissector Parameter MCID request indicators
4005  */
4006 static void
4007 dissect_isup_mcid_request_indicators_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4008 { guint8 indicator;
4009
4010   indicator = tvb_get_guint8(parameter_tvb, 0);
4011   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);
4012   proto_item_set_text(parameter_item, "MCID request indicators: 0x%x", indicator);
4013 }
4014 /* ------------------------------------------------------------------
4015   Dissector Parameter MCID response indicators
4016  */
4017 static void
4018 dissect_isup_mcid_response_indicators_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4019 { guint8 indicator;
4020
4021   indicator = tvb_get_guint8(parameter_tvb, 0);
4022   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);
4023   proto_item_set_text(parameter_item, "MCID response indicators: 0x%x", indicator);
4024 }
4025 /* ------------------------------------------------------------------
4026   Dissector Parameter Hop counter
4027  */
4028 static void
4029 dissect_isup_hop_counter_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4030 { guint8 counter;
4031
4032   counter = tvb_get_guint8(parameter_tvb, 0) & EDCBA_8BIT_MASK; /* since bits H,G and F are spare */
4033   proto_tree_add_text(parameter_tree, parameter_tvb, 0, HOP_COUNTER_LENGTH, "Hop counter: %u", counter);
4034   proto_item_set_text(parameter_item,  "Hop counter: %u", counter);
4035 }
4036 /* ------------------------------------------------------------------
4037   Dissector Parameter Transmission medium requirement prime
4038  */
4039 static void
4040 dissect_isup_transmission_medium_requirement_prime_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4041 {
4042   guint8 transmission_medium_requirement;
4043
4044   transmission_medium_requirement = tvb_get_guint8(parameter_tvb, 0);
4045   proto_tree_add_uint(parameter_tree, hf_isup_transmission_medium_requirement_prime, parameter_tvb, 0, TRANSMISSION_MEDIUM_RQMT_PRIME_LENGTH,transmission_medium_requirement);
4046
4047   proto_item_set_text(parameter_item, "Transmission medium requirement prime: %u (%s)",  transmission_medium_requirement, val_to_str(transmission_medium_requirement, isup_transmission_medium_requirement_prime_value, "spare/reserved"));
4048 }
4049
4050 /* ------------------------------------------------------------------
4051   Dissector Parameter location number
4052  */
4053 static void
4054 dissect_isup_location_number_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4055 {
4056   proto_item *address_digits_item;
4057   proto_tree *address_digits_tree;
4058   guint8 indicators1, indicators2;
4059   guint8 address_digit_pair=0;
4060   gint offset=0;
4061   gint i=0;
4062   gint length;
4063   char calling_number[MAXDIGITS + 1]="";
4064
4065   indicators1 = tvb_get_guint8(parameter_tvb, 0);
4066   proto_tree_add_boolean(parameter_tree, hf_isup_odd_even_indicator, parameter_tvb, 0, 1, indicators1);
4067   proto_tree_add_uint(parameter_tree, hf_isup_calling_party_nature_of_address_indicator, parameter_tvb, 0, 1, indicators1);
4068   indicators2 = tvb_get_guint8(parameter_tvb, 1);
4069   proto_tree_add_boolean(parameter_tree, hf_isup_inn_indicator, parameter_tvb, 1, 1, indicators2);
4070   proto_tree_add_uint(parameter_tree, hf_isup_numbering_plan_indicator, parameter_tvb, 1, 1, indicators2);
4071   if ((indicators2 & GFE_8BIT_MASK) == 0x50)
4072     proto_tree_add_text(parameter_tree, parameter_tvb, 1, 1, "Different meaning for Location Number: Numbering plan indicator = private numbering plan");
4073   proto_tree_add_uint(parameter_tree, hf_isup_address_presentation_restricted_indicator, parameter_tvb, 1, 1, indicators2);
4074   proto_tree_add_uint(parameter_tree, hf_isup_screening_indicator, parameter_tvb, 1, 1, indicators2);
4075
4076    /* NOTE  When the address presentation restricted indicator indicates address not available, the
4077     * subfields in items a), b), c) and d) are coded with 0's, and the screening indicator is set to 11
4078     * (network provided).
4079     */
4080   if ( indicators2 == 0x0b ){
4081     proto_tree_add_text(parameter_tree, parameter_tvb, 1, -1, "Location number: address not available");
4082     proto_item_set_text(parameter_item, "Location number: address not available");
4083     return;
4084   }
4085
4086   offset = 2;
4087
4088   address_digits_item = proto_tree_add_text(parameter_tree, parameter_tvb,
4089                                             offset, -1,
4090                                             "Location number");
4091   address_digits_tree = proto_item_add_subtree(address_digits_item, ett_isup_address_digits);
4092
4093   length = tvb_length_remaining(parameter_tvb, offset);
4094   while(length > 0){
4095     address_digit_pair = tvb_get_guint8(parameter_tvb, offset);
4096     proto_tree_add_uint(address_digits_tree, hf_isup_calling_party_odd_address_signal_digit, parameter_tvb, offset, 1, address_digit_pair);
4097     calling_number[i++] = number_to_char(address_digit_pair & ISUP_ODD_ADDRESS_SIGNAL_DIGIT_MASK);
4098     if (i > MAXDIGITS)
4099       THROW(ReportedBoundsError);
4100     if ((length - 1) > 0 ){
4101       proto_tree_add_uint(address_digits_tree, hf_isup_calling_party_even_address_signal_digit, parameter_tvb, offset, 1, address_digit_pair);
4102       calling_number[i++] = number_to_char((address_digit_pair & ISUP_EVEN_ADDRESS_SIGNAL_DIGIT_MASK) / 0x10);
4103       if (i > MAXDIGITS)
4104         THROW(ReportedBoundsError);
4105     }
4106     offset++;
4107     length = tvb_length_remaining(parameter_tvb, offset);
4108   }
4109
4110   if  (((indicators1 & 0x80) == 0) && (tvb_length(parameter_tvb) > 0)){ /* Even Indicator set -> last even digit is valid & has be displayed */
4111       proto_tree_add_uint(address_digits_tree, hf_isup_calling_party_even_address_signal_digit, parameter_tvb, offset - 1, 1, address_digit_pair);
4112       calling_number[i++] = number_to_char((address_digit_pair & ISUP_EVEN_ADDRESS_SIGNAL_DIGIT_MASK) / 0x10);
4113       if (i > MAXDIGITS)
4114         THROW(ReportedBoundsError);
4115   }
4116   calling_number[i++] = '\0';
4117
4118   proto_item_set_text(address_digits_item, "Location number: %s", calling_number);
4119   proto_item_set_text(parameter_item, "Location number: %s", calling_number);
4120
4121 }
4122 /* ------------------------------------------------------------------
4123   Dissector Parameter Redirection number restiriction
4124  */
4125 static void
4126 dissect_isup_redirection_number_restriction_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4127 {
4128   guint8 indicator;
4129
4130   indicator = tvb_get_guint8(parameter_tvb, 0);
4131   switch (indicator & BA_8BIT_MASK) {
4132   case 0:
4133     proto_tree_add_text(parameter_tree, parameter_tvb, 0, REDIRECTION_NUMBER_RESTRICTION_LENGTH, "Presentation indicator: Presentation allowed");
4134     break;
4135   case 1:
4136     proto_tree_add_text(parameter_tree, parameter_tvb, 0, REDIRECTION_NUMBER_RESTRICTION_LENGTH, "Presentation indicator: Presentation restricted");
4137     break;
4138   default:
4139     proto_tree_add_text(parameter_tree, parameter_tvb, 0, REDIRECTION_NUMBER_RESTRICTION_LENGTH, "Presentation indicator: spare");
4140     break;
4141   }
4142   proto_item_set_text(parameter_item, "Redirection number restriction: 0x%x ", indicator);
4143 }
4144 /* ------------------------------------------------------------------
4145   Dissector Parameter Call transfer identity
4146  */
4147 static void
4148 dissect_isup_call_transfer_reference_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4149 { guint8 id;
4150
4151   id = tvb_get_guint8(parameter_tvb, 0);
4152   proto_tree_add_text(parameter_tree, parameter_tvb, 0, CALL_TRANSFER_REF_LENGTH, "Call transfer identity: %u", id);
4153   proto_item_set_text(parameter_item,  "Call transfer reference: %u", id);
4154 }
4155 /* ------------------------------------------------------------------
4156   Dissector Parameter Loop prevention
4157  */
4158 static void
4159 dissect_isup_loop_prevention_indicators_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4160 {
4161   guint8 indicator;
4162
4163   indicator = tvb_get_guint8(parameter_tvb, 0);
4164   if ((indicator & A_8BIT_MASK)==0) {
4165     proto_tree_add_text(parameter_tree, parameter_tvb, 0, LOOP_PREVENTION_IND_LENGTH, "Type: Request");
4166     proto_item_set_text(parameter_item, "Loop prevention indicators: Request (%u)", indicator);
4167   }
4168   else {
4169     proto_tree_add_text(parameter_tree, parameter_tvb, 0, LOOP_PREVENTION_IND_LENGTH, "Type: Response");
4170     proto_tree_add_uint(parameter_tree, hf_isup_loop_prevention_response_ind, parameter_tvb, 0, LOOP_PREVENTION_IND_LENGTH, indicator);
4171     proto_item_set_text(parameter_item, "Loop prevention indicators: Response (%u)", indicator);
4172   }
4173 }
4174 /* ------------------------------------------------------------------
4175   Dissector Parameter Call transfer number
4176  */
4177 static void
4178 dissect_isup_call_transfer_number_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4179 {
4180   proto_item *address_digits_item;
4181   proto_tree *address_digits_tree;
4182   guint8 indicators1, indicators2;
4183   guint8 address_digit_pair=0;
4184   gint offset=0;
4185   gint i=0;
4186   gint length;
4187   char calling_number[MAXDIGITS + 1]="";
4188
4189   indicators1 = tvb_get_guint8(parameter_tvb, 0);
4190   proto_tree_add_boolean(parameter_tree, hf_isup_odd_even_indicator, parameter_tvb, 0, 1, indicators1);
4191   proto_tree_add_uint(parameter_tree, hf_isup_calling_party_nature_of_address_indicator, parameter_tvb, 0, 1, indicators1);
4192   indicators2 = tvb_get_guint8(parameter_tvb, 1);
4193   proto_tree_add_uint(parameter_tree, hf_isup_numbering_plan_indicator, parameter_tvb, 1, 1, indicators2);
4194   if ((indicators2 & GFE_8BIT_MASK) == 0x50)
4195     proto_tree_add_text(parameter_tree, parameter_tvb, 1, 1, "Different meaning for Call Transfer Number: Numbering plan indicator = private numbering plan");
4196   proto_tree_add_uint(parameter_tree, hf_isup_address_presentation_restricted_indicator, parameter_tvb, 1, 1, indicators2);
4197   proto_tree_add_uint(parameter_tree, hf_isup_screening_indicator_enhanced, parameter_tvb, 1, 1, indicators2);
4198   offset = 2;
4199
4200   address_digits_item = proto_tree_add_text(parameter_tree, parameter_tvb,
4201                                             offset, -1,
4202                                             "Call transfer number");
4203   address_digits_tree = proto_item_add_subtree(address_digits_item, ett_isup_address_digits);
4204
4205   length = tvb_length_remaining(parameter_tvb, offset);
4206   while(length > 0){
4207     address_digit_pair = tvb_get_guint8(parameter_tvb, offset);
4208     proto_tree_add_uint(address_digits_tree, hf_isup_calling_party_odd_address_signal_digit, parameter_tvb, offset, 1, address_digit_pair);
4209     calling_number[i++] = number_to_char(address_digit_pair & ISUP_ODD_ADDRESS_SIGNAL_DIGIT_MASK);
4210     if (i > MAXDIGITS)
4211       THROW(ReportedBoundsError);
4212     if ((length - 1) > 0 ){
4213       proto_tree_add_uint(address_digits_tree, hf_isup_calling_party_even_address_signal_digit, parameter_tvb, offset, 1, address_digit_pair);
4214       calling_number[i++] = number_to_char((address_digit_pair & ISUP_EVEN_ADDRESS_SIGNAL_DIGIT_MASK) / 0x10);
4215       if (i > MAXDIGITS)
4216         THROW(ReportedBoundsError);
4217     }
4218     offset++;
4219     length = tvb_length_remaining(parameter_tvb, offset);
4220   }
4221
4222   if  (((indicators1 & 0x80) == 0) && (tvb_length(parameter_tvb) > 0)){ /* Even Indicator set -> last even digit is valid & has be displayed */
4223       proto_tree_add_uint(address_digits_tree, hf_isup_calling_party_even_address_signal_digit, parameter_tvb, offset - 1, 1, address_digit_pair);
4224       calling_number[i++] = number_to_char((address_digit_pair & ISUP_EVEN_ADDRESS_SIGNAL_DIGIT_MASK) / 0x10);
4225       if (i > MAXDIGITS)
4226         THROW(ReportedBoundsError);
4227   }
4228   calling_number[i++] = '\0';
4229
4230   proto_item_set_text(address_digits_item, "Call transfer number: %s", calling_number);
4231   proto_item_set_text(parameter_item, "Call transfer number: %s", calling_number);
4232
4233 }
4234 /* ------------------------------------------------------------------
4235   Dissector Parameter CCSS
4236  */
4237 static void
4238 dissect_isup_ccss_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4239 {
4240   guint8 indicator;
4241
4242   indicator = tvb_get_guint8(parameter_tvb, 0);
4243   if ((indicator & A_8BIT_MASK)==0) {
4244     proto_tree_add_text(parameter_tree, parameter_tvb, 0, LOOP_PREVENTION_IND_LENGTH, "CCSS call indicator: no indication");
4245     proto_item_set_text(parameter_item, "CCSS call indicator: no indication (%u)", indicator);
4246   }
4247   else {
4248     proto_tree_add_text(parameter_tree, parameter_tvb, 0, LOOP_PREVENTION_IND_LENGTH, "CCSS call indicator: CCSS call");
4249     proto_item_set_text(parameter_item, "CCSS call indicator: CCSS call (%u)", indicator);
4250   }
4251 }
4252 /* ------------------------------------------------------------------
4253  Parameter Forward GVNS
4254  */
4255 static void
4256 dissect_isup_forward_gvns_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4257 { guint length = tvb_length(parameter_tvb);
4258   proto_tree_add_text(parameter_tree, parameter_tvb, 0, length, "Forward GVNS (refer to 3.66/Q.763 for detailed decoding)");
4259   proto_item_set_text(parameter_item, "Forward GVNS (%u Byte%s)", length , plurality(length, "", "s"));
4260 }
4261 /* ------------------------------------------------------------------
4262  Parameter Redirect capability
4263  */
4264 static void
4265 dissect_isup_redirect_capability_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4266 { guint length = tvb_length(parameter_tvb);
4267   proto_tree_add_text(parameter_tree, parameter_tvb, 0, length, "Redirect capability (format is a national matter)");
4268   proto_item_set_text(parameter_item, "Redirect Capability (%u Byte%s)", length , plurality(length, "", "s"));
4269 }
4270 /* ------------------------------------------------------------------
4271   Dissector Parameter Backward GVNS
4272  */
4273 static void
4274 dissect_isup_backward_gvns_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4275 { guint8 indicator;
4276
4277   indicator = tvb_get_guint8(parameter_tvb, 0);
4278   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);
4279   proto_item_set_text(parameter_item, "Backward GVNS: 0x%x", indicator);
4280 }
4281 /* ------------------------------------------------------------------
4282   Dissector Parameter Network management controls
4283  */
4284 static void
4285 dissect_isup_network_management_controls_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4286 { guint8 indicator;
4287
4288   indicator = tvb_get_guint8(parameter_tvb, 0);
4289   proto_tree_add_boolean(parameter_tree, hf_isup_temporary_alternative_routing_ind, parameter_tvb, 0,NETWORK_MANAGEMENT_CONTROLS_LENGTH, indicator);
4290   proto_tree_add_boolean(parameter_tree, hf_isup_extension_ind, parameter_tvb, 0,NETWORK_MANAGEMENT_CONTROLS_LENGTH, indicator);
4291   proto_item_set_text(parameter_item, "Network management controls: 0x%x", indicator);
4292 }
4293 /* ------------------------------------------------------------------
4294   Dissector Parameter Correlation id - no detailed dissection since defined in Rec. Q.1281
4295  */
4296 static void
4297 dissect_isup_correlation_id_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4298 { guint length = tvb_length(parameter_tvb);
4299   proto_tree_add_text(parameter_tree, parameter_tvb, 0, length, "Correlation ID (-> Q.1281)");
4300   proto_item_set_text(parameter_item, "Correlation ID, see Q.1281 (%u Byte%s)", length , plurality(length, "", "s"));
4301 }
4302 /* ------------------------------------------------------------------
4303   Dissector Parameter SCF id - no detailed dissection since defined in Rec. Q.1281
4304  */
4305 static void
4306 dissect_isup_scf_id_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4307 { guint length = tvb_length(parameter_tvb);
4308   proto_tree_add_text(parameter_tree, parameter_tvb, 0, length, "SCF ID (-> Q.1281)");
4309   proto_item_set_text(parameter_item, "SCF ID, see Q.1281 (%u Byte%s)", length , plurality(length, "", "s"));
4310 }
4311 /* ------------------------------------------------------------------
4312   Dissector Parameter Call diversion treatment indicators
4313  */
4314 static void
4315 dissect_isup_call_diversion_treatment_indicators_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4316 { guint8 indicator;
4317
4318   indicator = tvb_get_guint8(parameter_tvb, 0);
4319   proto_tree_add_uint(parameter_tree, hf_isup_call_to_be_diverted_ind, parameter_tvb, 0,CALL_DIV_TREATMENT_IND_LENGTH, indicator);
4320   proto_tree_add_boolean(parameter_tree, hf_isup_extension_ind, parameter_tvb, 0, CALL_DIV_TREATMENT_IND_LENGTH, indicator);
4321   proto_item_set_text(parameter_item, "Call diversion treatment indicators: 0x%x", indicator);
4322 }
4323 /* ------------------------------------------------------------------
4324   Dissector Parameter called IN  number
4325  */
4326 static void
4327 dissect_isup_called_in_number_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4328 {
4329   proto_item *address_digits_item;
4330   proto_tree *address_digits_tree;
4331   guint8 indicators1, indicators2;
4332   guint8 address_digit_pair=0;
4333   gint offset=0;
4334   gint i=0;
4335   gint length;
4336   char calling_number[MAXDIGITS + 1]="";
4337
4338   indicators1 = tvb_get_guint8(parameter_tvb, 0);
4339   proto_tree_add_boolean(parameter_tree, hf_isup_odd_even_indicator, parameter_tvb, 0, 1, indicators1);
4340   proto_tree_add_uint(parameter_tree, hf_isup_calling_party_nature_of_address_indicator, parameter_tvb, 0, 1, indicators1);
4341   indicators2 = tvb_get_guint8(parameter_tvb, 1);
4342   proto_tree_add_uint(parameter_tree, hf_isup_numbering_plan_indicator, parameter_tvb, 1, 1, indicators2);
4343   proto_tree_add_uint(parameter_tree, hf_isup_address_presentation_restricted_indicator, parameter_tvb, 1, 1, indicators2);
4344   offset = 2;
4345
4346   address_digits_item = proto_tree_add_text(parameter_tree, parameter_tvb,
4347                                             offset, -1,
4348                                             "Called IN Number");
4349   address_digits_tree = proto_item_add_subtree(address_digits_item, ett_isup_address_digits);
4350
4351   length = tvb_length_remaining(parameter_tvb, offset);
4352   while(length > 0){
4353     address_digit_pair = tvb_get_guint8(parameter_tvb, offset);
4354     proto_tree_add_uint(address_digits_tree, hf_isup_calling_party_odd_address_signal_digit, parameter_tvb, offset, 1, address_digit_pair);
4355     calling_number[i++] = number_to_char(address_digit_pair & ISUP_ODD_ADDRESS_SIGNAL_DIGIT_MASK);
4356     if (i > MAXDIGITS)
4357       THROW(ReportedBoundsError);
4358     if ((length - 1) > 0 ){
4359       proto_tree_add_uint(address_digits_tree, hf_isup_calling_party_even_address_signal_digit, parameter_tvb, offset, 1, address_digit_pair);
4360       calling_number[i++] = number_to_char((address_digit_pair & ISUP_EVEN_ADDRESS_SIGNAL_DIGIT_MASK) / 0x10);
4361       if (i > MAXDIGITS)
4362         THROW(ReportedBoundsError);
4363     }
4364     offset++;
4365     length = tvb_length_remaining(parameter_tvb, offset);
4366   }
4367
4368   if  (((indicators1 & 0x80) == 0) && (tvb_length(parameter_tvb) > 0)){ /* Even Indicator set -> last even digit is valid & has be displayed */
4369       proto_tree_add_uint(address_digits_tree, hf_isup_calling_party_even_address_signal_digit, parameter_tvb, offset - 1, 1, address_digit_pair);
4370       calling_number[i++] = number_to_char((address_digit_pair & ISUP_EVEN_ADDRESS_SIGNAL_DIGIT_MASK) / 0x10);
4371       if (i > MAXDIGITS)
4372         THROW(ReportedBoundsError);
4373   }
4374   calling_number[i++] = '\0';
4375
4376   proto_item_set_text(address_digits_item, "Called IN Number: %s", calling_number);
4377   proto_item_set_text(parameter_item, "Called IN Number: %s", calling_number);
4378
4379 }
4380 /* ------------------------------------------------------------------
4381   Dissector Parameter Call offering treatment indicators
4382  */
4383 static void
4384 dissect_isup_call_offering_treatment_indicators_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4385 { guint8 indicator;
4386
4387   indicator = tvb_get_guint8(parameter_tvb, 0);
4388   proto_tree_add_uint(parameter_tree, hf_isup_call_to_be_offered_ind, parameter_tvb, 0,CALL_OFFERING_TREATMENT_IND_LENGTH, indicator);
4389   proto_tree_add_boolean(parameter_tree, hf_isup_extension_ind, parameter_tvb, 0, CALL_OFFERING_TREATMENT_IND_LENGTH, indicator);
4390   proto_item_set_text(parameter_item, "Call offering treatment indicators: 0x%x", indicator);
4391 }
4392 /* ------------------------------------------------------------------
4393  Parameter Charged party identification
4394  */
4395 static void
4396 dissect_isup_charged_party_identification_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4397 { guint length = tvb_length(parameter_tvb);
4398   proto_tree_add_text(parameter_tree, parameter_tvb, 0, length, "Charged party identification (format is national network specific)");
4399   proto_item_set_text(parameter_item, "Charged party identification (%u Byte%s)", length , plurality(length, "", "s"));
4400 }
4401 /* ------------------------------------------------------------------
4402   Dissector Parameter Conference treatment indicators
4403  */
4404 static void
4405 dissect_isup_conference_treatment_indicators_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4406 { guint8 indicator;
4407
4408   indicator = tvb_get_guint8(parameter_tvb, 0);
4409   proto_tree_add_uint(parameter_tree, hf_isup_conference_acceptance_ind, parameter_tvb, 0,CONFERENCE_TREATMENT_IND_LENGTH, indicator);
4410   proto_tree_add_boolean(parameter_tree, hf_isup_extension_ind, parameter_tvb, 0, CONFERENCE_TREATMENT_IND_LENGTH, indicator);
4411   proto_item_set_text(parameter_item, "Conference treatment indicators: 0x%x", indicator);
4412 }
4413 /* ------------------------------------------------------------------
4414   Dissector Parameter Display information
4415  * TODO Output Display info :
4416  * Quote from Q.931:
4417  * 4.5.16 Display
4418  * The purpose of the Display information element is to supply display information 
4419  * that may be displayed by the user. The information contained in this element is coded
4420  * in IA5 characters.
4421  * 8 7 6 5 4 3 2 1   Octet
4422  * 0 0 1 0 1 0 0 0   1      Display information element identifier
4423  *                   2      Length of display contents 
4424  * 0                 3      Display information (IA5 characters) 
4425  * etc.
4426  * - end - quote -
4427  * Assuming octet 2 and onwards is pased here - just output text ?
4428  */
4429 static void
4430 dissect_isup_display_information_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4431 { guint length = tvb_length(parameter_tvb);
4432   proto_tree_add_text(parameter_tree, parameter_tvb, 0, length,
4433           "Display information (-> Q.931)");
4434   proto_item_set_text(parameter_item, "Display information (%u Byte%s)",
4435           length , plurality(length, "", "s"));
4436 }
4437 /* ------------------------------------------------------------------
4438  Parameter UID action indicators
4439  */
4440 static void
4441 dissect_isup_uid_action_indicators_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4442 { guint8 indicator;
4443
4444   indicator = tvb_get_guint8(parameter_tvb, 0);
4445   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);
4446   proto_item_set_text(parameter_item, "UID action indicators: 0x%x", indicator);
4447 }
4448 /* ------------------------------------------------------------------
4449  Parameter UID capability indicators
4450  */
4451 static void
4452 dissect_isup_uid_capability_indicators_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4453 { guint8 indicator;
4454
4455   indicator = tvb_get_guint8(parameter_tvb, 0);
4456   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);
4457   proto_item_set_text(parameter_item, "UID capability indicators: 0x%x", indicator);
4458 }
4459 /* ------------------------------------------------------------------
4460  Parameter Redirect counter
4461  */
4462 static void
4463 dissect_isup_redirect_counter_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4464 { guint length = tvb_length(parameter_tvb);
4465   proto_tree_add_text(parameter_tree, parameter_tvb, 0, length, "Redirect counter (format is a national matter)");
4466   proto_item_set_text(parameter_item, "Redirect counter (%u Byte%s)", length , plurality(length, "", "s"));
4467 }
4468 /* ------------------------------------------------------------------
4469   Dissector Parameter Collect call request
4470  */
4471 static void
4472 dissect_isup_collect_call_request_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4473 { guint8 indicator;
4474
4475   indicator = tvb_get_guint8(parameter_tvb, 0);
4476   if ((indicator & A_8BIT_MASK) == 0) {
4477     proto_tree_add_text(parameter_tree, parameter_tvb, 0, COLLECT_CALL_REQUEST_LENGTH, "Collect call request indicator: no indication");
4478     proto_item_set_text(parameter_item, "Collect call reqeust: no indication (0x%x)", indicator);
4479   }
4480   else {
4481     proto_tree_add_text(parameter_tree, parameter_tvb, 0, COLLECT_CALL_REQUEST_LENGTH, "Collect call request indicator: collect call requested");
4482     proto_item_set_text(parameter_item, "Collect call reqeust: collect call requested (0x%x)", indicator);
4483   }
4484 }
4485 /* ------------------------------------------------------------------
4486   Dissector Parameter Generic number
4487  */
4488 static void
4489 dissect_isup_generic_number_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4490 {
4491   proto_item *address_digits_item;
4492   proto_tree *address_digits_tree;
4493   guint8 indicators1, indicators2, nr_qualifier_ind;
4494   guint8 address_digit_pair=0;
4495   gint offset=0;
4496   gint i=0;
4497   gint length;
4498   char calling_number[MAXDIGITS + 1]="";
4499
4500   nr_qualifier_ind = tvb_get_guint8(parameter_tvb, 0);
4501   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);
4502   indicators1 = tvb_get_guint8(parameter_tvb, 1);
4503   proto_tree_add_boolean(parameter_tree, hf_isup_odd_even_indicator, parameter_tvb, 1, 1, indicators1);
4504   proto_tree_add_uint(parameter_tree, hf_isup_calling_party_nature_of_address_indicator, parameter_tvb, 0, 1, indicators1);
4505   indicators2 = tvb_get_guint8(parameter_tvb, 2);
4506   proto_tree_add_boolean(parameter_tree, hf_isup_ni_indicator, parameter_tvb, 2, 1, indicators2);
4507   proto_tree_add_uint(parameter_tree, hf_isup_numbering_plan_indicator, parameter_tvb, 2, 1, indicators2);
4508   if ((indicators2 & GFE_8BIT_MASK) == 0x50)
4509     proto_tree_add_text(parameter_tree, parameter_tvb, 2, 1, "Different meaning for Generic Number: Numbering plan indicator = private numbering plan");
4510   proto_tree_add_uint(parameter_tree, hf_isup_address_presentation_restricted_indicator, parameter_tvb, 2, 1, indicators2);
4511   proto_tree_add_uint(parameter_tree, hf_isup_screening_indicator_enhanced, parameter_tvb, 2, 1, indicators2);
4512   offset = 3;
4513
4514   address_digits_item = proto_tree_add_text(parameter_tree, parameter_tvb,
4515                                             offset, -1,
4516                                             "Generic number");
4517   address_digits_tree = proto_item_add_subtree(address_digits_item, ett_isup_address_digits);
4518
4519   length = tvb_length_remaining(parameter_tvb, offset);
4520   while(length > 0){
4521     address_digit_pair = tvb_get_guint8(parameter_tvb, offset);
4522     proto_tree_add_uint(address_digits_tree, hf_isup_calling_party_odd_address_signal_digit, parameter_tvb, offset, 1, address_digit_pair);
4523     calling_number[i++] = number_to_char(address_digit_pair & ISUP_ODD_ADDRESS_SIGNAL_DIGIT_MASK);
4524     if (i > MAXDIGITS)
4525       THROW(ReportedBoundsError);
4526     if ((length - 1) > 0 ){
4527       proto_tree_add_uint(address_digits_tree, hf_isup_calling_party_even_address_signal_digit, parameter_tvb, offset, 1, address_digit_pair);
4528       calling_number[i++] = number_to_char((address_digit_pair & ISUP_EVEN_ADDRESS_SIGNAL_DIGIT_MASK) / 0x10);
4529       if (i > MAXDIGITS)
4530         THROW(ReportedBoundsError);
4531     }
4532     offset++;
4533     length = tvb_length_remaining(parameter_tvb, offset);
4534   }
4535
4536   if  (((indicators1 & 0x80) == 0) && (tvb_length(parameter_tvb) > 0)){ /* Even Indicator set -> last even digit is valid & has be displayed */
4537       proto_tree_add_uint(address_digits_tree, hf_isup_calling_party_even_address_signal_digit, parameter_tvb, offset - 1, 1, address_digit_pair);
4538       calling_number[i++] = number_to_char((address_digit_pair & ISUP_EVEN_ADDRESS_SIGNAL_DIGIT_MASK) / 0x10);
4539       if (i > MAXDIGITS)
4540         THROW(ReportedBoundsError);
4541   }
4542   calling_number[i++] = '\0';
4543
4544   proto_item_set_text(address_digits_item, "Generic number: %s", calling_number);
4545   proto_item_set_text(parameter_item, "Generic number: %s", calling_number);
4546
4547 }
4548 /* ------------------------------------------------------------------
4549  Dissector Parameter Generic digits
4550  */
4551 static void
4552 dissect_isup_generic_digits_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
4553 { guint length = tvb_length(parameter_tvb);
4554   proto_tree_add_text(parameter_tree, parameter_tvb, 0, length, "Generic digits (refer to 3.24/Q.673 for detailed decoding)");
4555   proto_item_set_text(parameter_item, "Generic digits (%u Byte%s)", length , plurality(length, "", "s"));
4556 }
4557 /* ------------------------------------------------------------------ */
4558 static void
4559 dissect_isup_unknown_parameter(tvbuff_t *parameter_tvb, proto_item *parameter_item)
4560 { guint length = tvb_length(parameter_tvb);
4561   proto_item_set_text(parameter_item, "Parameter Type unknown/reserved (%u Byte%s)", length , plurality(length, "", "s"));
4562 }
4563 /* ------------------------------------------------------------------ */
4564
4565 /* ------------------------------------------------------------------
4566   Dissector all optional parameters
4567 */
4568 static void
4569 dissect_isup_optional_parameter(tvbuff_t *optional_parameters_tvb,packet_info *pinfo, proto_tree *isup_tree)
4570 { proto_item* parameter_item;
4571   proto_tree* parameter_tree;
4572   gint offset = 0;
4573   guint parameter_type, parameter_length, actual_length;
4574   tvbuff_t *parameter_tvb;
4575   guint8 octet;
4576
4577   /* Dissect all optional parameters while end of message isn't reached */
4578   parameter_type = 0xFF; /* Start-initializiation since parameter_type is used for while-condition */
4579
4580   while ((tvb_length_remaining(optional_parameters_tvb, offset)  >= 1) && (parameter_type != PARAM_TYPE_END_OF_OPT_PARAMS)){
4581     parameter_type = tvb_get_guint8(optional_parameters_tvb, offset);
4582
4583     if (parameter_type != PARAM_TYPE_END_OF_OPT_PARAMS){
4584       parameter_length = tvb_get_guint8(optional_parameters_tvb, offset + PARAMETER_TYPE_LENGTH);
4585
4586       parameter_item = proto_tree_add_text(isup_tree, optional_parameters_tvb,
4587                                            offset,
4588                                            parameter_length  + PARAMETER_TYPE_LENGTH + PARAMETER_LENGTH_IND_LENGTH,
4589                                            "Parameter: type %u",
4590                                            parameter_type);
4591       parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
4592       proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, optional_parameters_tvb, offset, PARAMETER_TYPE_LENGTH, parameter_type, "Optional Parameter: %u (%s)", parameter_type, val_to_str(parameter_type, isup_parameter_type_value,"unknown"));
4593       offset += PARAMETER_TYPE_LENGTH;
4594
4595           octet = tvb_get_guint8(optional_parameters_tvb,offset);
4596                 
4597       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);
4598       offset += PARAMETER_LENGTH_IND_LENGTH;
4599           if ( octet == 0 )
4600                   continue;
4601                 
4602       actual_length = tvb_length_remaining(optional_parameters_tvb, offset);
4603       if (actual_length > 0){
4604                   parameter_tvb = tvb_new_subset(optional_parameters_tvb, offset, MIN(parameter_length, actual_length), parameter_length);
4605                   switch (parameter_type) {
4606                         case PARAM_TYPE_CALL_REF:
4607                                 dissect_isup_call_reference_parameter(parameter_tvb, parameter_tree, parameter_item);
4608                                 break;
4609                         case PARAM_TYPE_TRANSM_MEDIUM_REQU:
4610                                 dissect_isup_transmission_medium_requirement_parameter(parameter_tvb, parameter_tree, parameter_item);
4611                                 break;
4612                         case PARAM_TYPE_ACC_TRANSP:
4613                                 dissect_isup_access_transport_parameter(parameter_tvb, parameter_tree, parameter_item, pinfo);
4614                                 break;
4615                         case PARAM_TYPE_CALLED_PARTY_NR:
4616                                 dissect_isup_called_party_number_parameter(parameter_tvb, parameter_tree, parameter_item);
4617                                 break;
4618                         case PARAM_TYPE_SUBSQT_NR:
4619                                 dissect_isup_subsequent_number_parameter(parameter_tvb, parameter_tree, parameter_item);
4620                                 break;
4621                         case PARAM_TYPE_NATURE_OF_CONN_IND:
4622                                 dissect_isup_nature_of_connection_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
4623                                 break;
4624                         case PARAM_TYPE_FORW_CALL_IND:
4625                                 dissect_isup_forward_call_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
4626                                 break;
4627                         case PARAM_TYPE_OPT_FORW_CALL_IND:
4628                                 dissect_isup_optional_forward_call_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
4629                                 break;
4630                         case PARAM_TYPE_CALLING_PRTY_CATEG:
4631                                 dissect_isup_calling_partys_category_parameter(parameter_tvb, parameter_tree, parameter_item);
4632                                 break;
4633                         case PARAM_TYPE_CALLING_PARTY_NR:
4634                                 dissect_isup_calling_party_number_parameter(parameter_tvb, parameter_tree, parameter_item);
4635                                 break;
4636                         case PARAM_TYPE_REDIRECTING_NR:
4637                                 dissect_isup_redirecting_number_parameter(parameter_tvb, parameter_tree, parameter_item);
4638                                 break;
4639                         case PARAM_TYPE_REDIRECTION_NR:
4640                                 dissect_isup_redirection_number_parameter(parameter_tvb, parameter_tree, parameter_item);
4641                                 break;
4642                         case PARAM_TYPE_CONNECTION_REQ:
4643                                 dissect_isup_connection_request_parameter(parameter_tvb, parameter_tree, parameter_item);
4644                                 break;
4645                         case PARAM_TYPE_INFO_REQ_IND:
4646                                 dissect_isup_information_request_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
4647                                 break;
4648                         case PARAM_TYPE_INFO_IND:
4649                                 dissect_isup_information_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
4650                                 break;
4651                         case PARAM_TYPE_CONTINUITY_IND:
4652                                 dissect_isup_continuity_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
4653                                 break;
4654                         case PARAM_TYPE_BACKW_CALL_IND:
4655                                 dissect_isup_backward_call_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
4656                                 break;
4657                         case PARAM_TYPE_CAUSE_INDICATORS:
4658                                 dissect_isup_cause_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
4659                                 break;
4660                         case PARAM_TYPE_REDIRECTION_INFO:
4661                                 dissect_isup_redirection_information_parameter(parameter_tvb, parameter_tree, parameter_item);
4662                                 break;
4663                         case PARAM_TYPE_CIRC_GRP_SV_MSG_TYPE:
4664                                 dissect_isup_circuit_group_supervision_message_type_parameter(parameter_tvb, parameter_tree, parameter_item);
4665                                 break;
4666                         case PARAM_TYPE_RANGE_AND_STATUS:
4667                                 dissect_isup_range_and_status_parameter(parameter_tvb, parameter_tree, parameter_item);
4668                                 break;
4669                         case PARAM_TYPE_FACILITY_IND:
4670                                 dissect_isup_facility_ind_parameter(parameter_tvb, parameter_item);
4671                                 break;
4672                         case PARAM_TYPE_CLSD_USR_GRP_ILOCK_CD:
4673                                 dissect_isup_closed_user_group_interlock_code_parameter(parameter_tvb, parameter_tree, parameter_item);
4674                                 break;
4675                         case PARAM_TYPE_USER_SERVICE_INFO:
4676                                 dissect_isup_user_service_information_parameter(parameter_tvb, parameter_tree, parameter_item);
4677                                 break;
4678                         case PARAM_TYPE_SIGNALLING_POINT_CODE:
4679                                 dissect_isup_signalling_point_code_parameter(parameter_tvb, parameter_tree, parameter_item);
4680                                 break;
4681                         case PARAM_TYPE_USER_TO_USER_INFO:
4682                                 dissect_isup_user_to_user_information_parameter(parameter_tvb, parameter_tree, parameter_item);
4683                                 break;
4684                         case PARAM_TYPE_CONNECTED_NR:
4685                                 dissect_isup_connected_number_parameter(parameter_tvb, parameter_tree, parameter_item);
4686                                 break;
4687                         case PARAM_TYPE_SUSP_RESUME_IND:
4688                                 dissect_isup_suspend_resume_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
4689                                 break;
4690                         case PARAM_TYPE_TRANSIT_NETW_SELECT:
4691                                 dissect_isup_transit_network_selection_parameter(parameter_tvb, parameter_tree, parameter_item);
4692                                 break;
4693                         case PARAM_TYPE_EVENT_INFO:
4694                                 dissect_isup_event_information_parameter(parameter_tvb, parameter_tree, parameter_item);
4695                                 break;
4696                         case PARAM_TYPE_CIRC_ASSIGN_MAP:
4697                                 dissect_isup_circuit_assignment_map_parameter(parameter_tvb, parameter_tree, parameter_item);
4698                                 break;
4699                         case PARAM_TYPE_CIRC_STATE_IND:
4700                                 dissect_isup_circuit_state_ind_parameter(parameter_tvb, parameter_tree, parameter_item);
4701                                 break;
4702                         case PARAM_TYPE_AUTO_CONG_LEVEL:
4703                                 dissect_isup_automatic_congestion_level_parameter(parameter_tvb, parameter_tree, parameter_item);
4704                                 break;
4705                         case PARAM_TYPE_ORIG_CALLED_NR:
4706                                 dissect_isup_original_called_number_parameter(parameter_tvb, parameter_tree, parameter_item);
4707                                 break;
4708                         case PARAM_TYPE_OPT_BACKW_CALL_IND:
4709                                 dissect_isup_optional_backward_call_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
4710                                 break;
4711                         case PARAM_TYPE_USER_TO_USER_IND:
4712                                 dissect_isup_user_to_user_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
4713                                 break;
4714                         case PARAM_TYPE_ORIG_ISC_POINT_CODE:
4715                                 dissect_isup_original_isc_point_code_parameter(parameter_tvb, parameter_tree, parameter_item);
4716                                 break;
4717                         case PARAM_TYPE_GENERIC_NOTIF_IND:
4718                                 dissect_isup_generic_notification_indicator_parameter(parameter_tvb, parameter_tree, parameter_item);
4719                                 break;
4720                         case PARAM_TYPE_CALL_HIST_INFO :
4721                                 dissect_isup_call_history_information_parameter(parameter_tvb, parameter_tree, parameter_item);
4722                                 break;
4723                         case PARAM_TYPE_ACC_DELIV_INFO:
4724                                 dissect_isup_access_delivery_information_parameter(parameter_tvb, parameter_tree, parameter_item);
4725                                 break;
4726                         case PARAM_TYPE_NETW_SPECIFIC_FACLTY:
4727                                 dissect_isup_network_specific_facility_parameter(parameter_tvb, parameter_tree, parameter_item);
4728                                 break;
4729                         case PARAM_TYPE_USER_SERVICE_INFO_PR:
4730                                 dissect_isup_user_service_information_prime_parameter(parameter_tvb, parameter_tree, parameter_item);
4731                                 break;
4732                         case PARAM_TYPE_PROPAG_DELAY_COUNTER:
4733                                 dissect_isup_propagation_delay_counter_parameter(parameter_tvb, parameter_tree, parameter_item);
4734                                 break;
4735                         case PARAM_TYPE_REMOTE_OPERATIONS:
4736                                 dissect_isup_remote_operations_parameter(parameter_tvb, parameter_tree, parameter_item);
4737                                 break;
4738                         case PARAM_TYPE_SERVICE_ACTIVATION:
4739                                 dissect_isup_service_activation_parameter(parameter_tvb, parameter_tree, parameter_item);
4740                                 break;
4741                         case PARAM_TYPE_USER_TELESERV_INFO:
4742                                 dissect_isup_user_teleservice_information_parameter(parameter_tvb, parameter_tree, parameter_item);
4743                                 break;
4744                         case PARAM_TYPE_TRANSM_MEDIUM_USED:
4745                                 dissect_isup_transmission_medium_used_parameter(parameter_tvb, parameter_tree, parameter_item);
4746                                 break;
4747                         case PARAM_TYPE_CALL_DIV_INFO:
4748                                 dissect_isup_call_diversion_information_parameter(parameter_tvb, parameter_tree, parameter_item);
4749                                 break;
4750                         case PARAM_TYPE_ECHO_CTRL_INFO:
4751                                 dissect_isup_echo_control_information_parameter(parameter_tvb, parameter_tree, parameter_item);
4752                                 break;
4753                         case PARAM_TYPE_MSG_COMPAT_INFO:
4754                                 dissect_isup_message_compatibility_information_parameter(parameter_tvb, parameter_tree, parameter_item);
4755                                 break;
4756                         case PARAM_TYPE_PARAM_COMPAT_INFO:
4757                                 dissect_isup_parameter_compatibility_information_parameter(parameter_tvb, parameter_tree, parameter_item);
4758                                 break;
4759                         case PARAM_TYPE_MLPP_PRECEDENCE:
4760                                 dissect_isup_mlpp_precedence_parameter(parameter_tvb, parameter_tree, parameter_item);
4761                                 break;
4762                         case PARAM_TYPE_MCID_REQ_IND:
4763                                 dissect_isup_mcid_request_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
4764                                 break;
4765                         case PARAM_TYPE_MCID_RSP_IND:
4766                                 dissect_isup_mcid_response_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
4767                                 break;
4768                         case PARAM_TYPE_HOP_COUNTER:
4769                                 dissect_isup_hop_counter_parameter(parameter_tvb, parameter_tree, parameter_item);
4770                                 break;
4771                         case PARAM_TYPE_TRANSM_MEDIUM_RQUR_PR:
4772                                 dissect_isup_transmission_medium_requirement_prime_parameter(parameter_tvb, parameter_tree, parameter_item);
4773                                 break;
4774                         case PARAM_TYPE_LOCATION_NR:
4775                                 dissect_isup_location_number_parameter(parameter_tvb, parameter_tree, parameter_item);
4776                                 break;
4777                         case PARAM_TYPE_REDIR_NR_RSTRCT:
4778                                 dissect_isup_redirection_number_restriction_parameter(parameter_tvb, parameter_tree, parameter_item);
4779                                 break;
4780                         case PARAM_TYPE_CALL_TRANS_REF:
4781                                 dissect_isup_call_transfer_reference_parameter(parameter_tvb, parameter_tree, parameter_item);
4782                                 break;
4783                         case PARAM_TYPE_LOOP_PREV_IND:
4784                                 dissect_isup_loop_prevention_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
4785                                 break;
4786                         case PARAM_TYPE_CALL_TRANS_NR:
4787                                 dissect_isup_call_transfer_number_parameter(parameter_tvb, parameter_tree, parameter_item);
4788                                 break;
4789                         case PARAM_TYPE_CCSS:
4790                                 dissect_isup_ccss_parameter(parameter_tvb, parameter_tree, parameter_item);
4791                                 break;
4792                         case PARAM_TYPE_FORW_GVNS:
4793                                 dissect_isup_forward_gvns_parameter(parameter_tvb, parameter_tree, parameter_item);
4794                                 break;
4795                         case PARAM_TYPE_BACKW_GVNS:
4796                                 dissect_isup_backward_gvns_parameter(parameter_tvb, parameter_tree, parameter_item);
4797                                 break;
4798                         case PARAM_TYPE_REDIRECT_CAPAB:
4799                                 dissect_isup_redirect_capability_parameter(parameter_tvb, parameter_tree, parameter_item);
4800                                 break;
4801                         case PARAM_TYPE_NETW_MGMT_CTRL:
4802                                 dissect_isup_network_management_controls_parameter(parameter_tvb, parameter_tree, parameter_item);
4803                                 break;
4804                         case PARAM_TYPE_CORRELATION_ID:
4805                                 dissect_isup_correlation_id_parameter(parameter_tvb, parameter_tree, parameter_item);
4806                                 break;
4807                         case PARAM_TYPE_SCF_ID:
4808                                 dissect_isup_scf_id_parameter(parameter_tvb, parameter_tree, parameter_item);
4809                                 break;
4810                         case PARAM_TYPE_CALL_DIV_TREAT_IND:
4811                                 dissect_isup_call_diversion_treatment_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
4812                                 break;
4813                         case PARAM_TYPE_CALLED_IN_NR:
4814                                 dissect_isup_called_in_number_parameter(parameter_tvb, parameter_tree, parameter_item);
4815                                 break;
4816                         case PARAM_TYPE_CALL_OFF_TREAT_IND:
4817                                 dissect_isup_call_offering_treatment_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
4818                                 break;
4819                         case PARAM_TYPE_CHARGED_PARTY_IDENT:
4820                                 dissect_isup_charged_party_identification_parameter(parameter_tvb, parameter_tree, parameter_item);
4821                                 break;
4822                         case PARAM_TYPE_CONF_TREAT_IND:
4823                                 dissect_isup_conference_treatment_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
4824                                 break;
4825                         case PARAM_TYPE_DISPLAY_INFO:
4826                                 dissect_isup_display_information_parameter(parameter_tvb, parameter_tree, parameter_item);
4827                                 break;
4828                         case PARAM_TYPE_UID_ACTION_IND:
4829                                 dissect_isup_uid_action_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
4830                                 break;
4831                         case PARAM_TYPE_UID_CAPAB_IND:
4832                                 dissect_isup_uid_capability_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
4833                                 break;
4834                         case PARAM_TYPE_REDIRECT_COUNTER:
4835                                 dissect_isup_redirect_counter_parameter(parameter_tvb, parameter_tree, parameter_item);
4836                                 break;
4837                         case PARAM_TYPE_COLLECT_CALL_REQ:
4838                                 dissect_isup_collect_call_request_parameter(parameter_tvb, parameter_tree, parameter_item);
4839                                 break;
4840                         case PARAM_TYPE_GENERIC_NR:
4841                                 dissect_isup_generic_number_parameter(parameter_tvb, parameter_tree, parameter_item);
4842                                 break;
4843                         case PARAM_TYPE_GENERIC_DIGITS:
4844                                 dissect_isup_generic_digits_parameter(parameter_tvb, parameter_tree, parameter_item);
4845                                 break;
4846                         case PARAM_TYPE_APPLICATON_TRANS:
4847                                 dissect_isup_application_transport_parameter(parameter_tvb, pinfo, parameter_tree, parameter_item);
4848                                 break;
4849           
4850                         default:
4851                                 dissect_isup_unknown_parameter(parameter_tvb, parameter_item);
4852                                 break;
4853                         }
4854                         
4855         
4856                         offset += MIN(parameter_length, actual_length);
4857                 }
4858
4859          }
4860     else {
4861                 /* End of optional parameters is reached */
4862                 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);
4863     }
4864   }
4865 }
4866
4867 /* ------------------------------------------------------------------ */
4868 /* Dissectors for all used message types                              */
4869 /* Called by dissect_isup_message(),                                  */
4870 /* call parameter dissectors in order of mandatory parameters         */
4871 /* (since not labeled)                                                */
4872 /* ------------------------------------------------------------------
4873   Dissector Message Type Initial address message
4874  */
4875 static gint
4876 dissect_isup_initial_address_message(tvbuff_t *message_tvb, proto_tree *isup_tree)
4877 { proto_item* parameter_item;
4878   proto_tree* parameter_tree;
4879   tvbuff_t *parameter_tvb;
4880   gint offset = 0;
4881   gint parameter_type, parameter_pointer, parameter_length, actual_length;
4882
4883   /* Do stuff for first mandatory fixed parameter: Nature of Connection Indicators */
4884   parameter_type = PARAM_TYPE_NATURE_OF_CONN_IND;
4885   parameter_item = proto_tree_add_text(isup_tree, message_tvb, offset,
4886                                        NATURE_OF_CONNECTION_IND_LENGTH,
4887                                        "Nature of Connection Indicators");
4888   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
4889   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type, "Mandatory Parameter: %u (%s)", parameter_type, val_to_str(parameter_type, isup_parameter_type_value,"unknown"));
4890   actual_length = tvb_ensure_length_remaining(message_tvb, offset);
4891   parameter_tvb = tvb_new_subset(message_tvb, offset, MIN(NATURE_OF_CONNECTION_IND_LENGTH, actual_length), NATURE_OF_CONNECTION_IND_LENGTH);
4892   dissect_isup_nature_of_connection_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
4893   offset += NATURE_OF_CONNECTION_IND_LENGTH;
4894
4895   /* Do stuff for 2nd mandatory fixed parameter: Forward Call Indicators */
4896   parameter_type =  PARAM_TYPE_FORW_CALL_IND;
4897   parameter_item = proto_tree_add_text(isup_tree, message_tvb, offset,
4898                                        FORWARD_CALL_IND_LENGTH,
4899                                        "Forward Call Indicators");
4900   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
4901   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type, "Mandatory Parameter: %u (%s)", parameter_type, val_to_str(parameter_type, isup_parameter_type_value,"unknown"));
4902   actual_length = tvb_ensure_length_remaining(message_tvb, offset);
4903   parameter_tvb = tvb_new_subset(message_tvb, offset, MIN(FORWARD_CALL_IND_LENGTH, actual_length), FORWARD_CALL_IND_LENGTH );
4904   dissect_isup_forward_call_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
4905   offset +=  FORWARD_CALL_IND_LENGTH;
4906
4907   /* Do stuff for 3nd mandatory fixed parameter: Calling party's category */
4908   parameter_type = PARAM_TYPE_CALLING_PRTY_CATEG;
4909   parameter_item = proto_tree_add_text(isup_tree, message_tvb, offset,
4910                                        CALLING_PRTYS_CATEGORY_LENGTH,
4911                                        "Calling Party's category");
4912   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
4913   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type, "Mandatory Parameter: %u (%s)", parameter_type, val_to_str(parameter_type, isup_parameter_type_value,"unknown"));
4914   actual_length = tvb_ensure_length_remaining(message_tvb, offset);
4915   parameter_tvb = tvb_new_subset(message_tvb, offset, MIN(CALLING_PRTYS_CATEGORY_LENGTH, actual_length),CALLING_PRTYS_CATEGORY_LENGTH );
4916   dissect_isup_calling_partys_category_parameter(parameter_tvb, parameter_tree, parameter_item);
4917   offset += CALLING_PRTYS_CATEGORY_LENGTH;
4918
4919   /* Do stuff for 4th mandatory fixed parameter: Transmission medium requirement */
4920   parameter_type = PARAM_TYPE_TRANSM_MEDIUM_REQU;
4921   parameter_item = proto_tree_add_text(isup_tree, message_tvb, offset,
4922                                        TRANSMISSION_MEDIUM_REQUIREMENT_LENGTH,
4923                                        "Transmission medium requirement");
4924   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
4925   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type, "Mandatory Parameter: %u (%s)", parameter_type, val_to_str(parameter_type, isup_parameter_type_value,"unknown"));
4926   actual_length = tvb_ensure_length_remaining(message_tvb, offset);
4927   parameter_tvb = tvb_new_subset(message_tvb, offset, MIN(TRANSMISSION_MEDIUM_REQUIREMENT_LENGTH, actual_length), TRANSMISSION_MEDIUM_REQUIREMENT_LENGTH);
4928   dissect_isup_transmission_medium_requirement_parameter(parameter_tvb, parameter_tree, parameter_item);
4929   offset += TRANSMISSION_MEDIUM_REQUIREMENT_LENGTH;
4930
4931
4932   /* Do stuff for mandatory variable parameter Called party number */
4933   parameter_type = PARAM_TYPE_CALLED_PARTY_NR;
4934   parameter_pointer = tvb_get_guint8(message_tvb, offset);
4935   parameter_length = tvb_get_guint8(message_tvb, offset + parameter_pointer);
4936
4937   parameter_item = proto_tree_add_text(isup_tree, message_tvb,
4938                                        offset +  parameter_pointer,
4939                                        parameter_length + PARAMETER_LENGTH_IND_LENGTH,
4940                                        "Called Party Number");
4941   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
4942   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type, "Mandatory Parameter: %u (%s)", parameter_type, val_to_str(parameter_type, isup_parameter_type_value,"unknown"));
4943   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);
4944   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);
4945   actual_length = tvb_ensure_length_remaining(message_tvb, offset);
4946   parameter_tvb = tvb_new_subset(message_tvb, offset + parameter_pointer + PARAMETER_LENGTH_IND_LENGTH, MIN(parameter_length, actual_length), parameter_length );
4947   dissect_isup_called_party_number_parameter(parameter_tvb, parameter_tree, parameter_item);
4948   offset += PARAMETER_POINTER_LENGTH;
4949
4950   return offset;
4951 }
4952 /* ------------------------------------------------------------------
4953   Dissector Message Type subsequent address message
4954  */
4955 static gint dissect_isup_subsequent_address_message(tvbuff_t *message_tvb, proto_tree *isup_tree)
4956 { proto_item* parameter_item;
4957   proto_tree* parameter_tree;
4958   tvbuff_t *parameter_tvb;
4959   gint offset = 0;
4960   gint parameter_type, parameter_pointer, parameter_length, actual_length;
4961
4962   /* Do stuff for mandatory variable parameter Subsequent number */
4963   parameter_type = PARAM_TYPE_SUBSQT_NR;
4964
4965   parameter_pointer = tvb_get_guint8(message_tvb, offset);
4966   parameter_length = tvb_get_guint8(message_tvb, offset + parameter_pointer);
4967
4968   parameter_item = proto_tree_add_text(isup_tree, message_tvb,
4969                                        offset +  parameter_pointer,
4970                                        parameter_length + PARAMETER_LENGTH_IND_LENGTH,
4971                                        "Subsequent Number");
4972   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
4973   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type, "Mandatory Parameter: %u (%s)", parameter_type, val_to_str(parameter_type, isup_parameter_type_value,"unknown"));
4974   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);
4975   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);
4976   actual_length = tvb_ensure_length_remaining(message_tvb, offset);
4977   parameter_tvb = tvb_new_subset(message_tvb, offset + parameter_pointer + PARAMETER_LENGTH_IND_LENGTH, MIN(parameter_length, actual_length), parameter_length );
4978   dissect_isup_subsequent_number_parameter(parameter_tvb, parameter_tree, parameter_item);
4979   offset += PARAMETER_POINTER_LENGTH;
4980
4981   return offset;
4982 }
4983
4984 /* ------------------------------------------------------------------
4985   Dissector Message Type Information request message
4986  */
4987 static gint
4988 dissect_isup_information_request_message(tvbuff_t *message_tvb, proto_tree *isup_tree)
4989 { proto_item* parameter_item;
4990   proto_tree* parameter_tree;
4991   tvbuff_t *parameter_tvb;
4992   gint offset = 0;
4993   gint parameter_type, actual_length;
4994
4995   /* Do stuff for first mandatory fixed parameter: Information request indicators*/
4996   parameter_type = PARAM_TYPE_INFO_REQ_IND;
4997   parameter_item = proto_tree_add_text(isup_tree, message_tvb, offset,
4998                                        INFO_REQUEST_IND_LENGTH,
4999                                        "Information request indicators");
5000   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
5001   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type, "Mandatory Parameter: %u (%s)", parameter_type, val_to_str(parameter_type, isup_parameter_type_value,"unknown"));
5002   actual_length = tvb_ensure_length_remaining(message_tvb, offset);
5003   parameter_tvb = tvb_new_subset(message_tvb, offset, MIN(INFO_REQUEST_IND_LENGTH, actual_length), INFO_REQUEST_IND_LENGTH);
5004   dissect_isup_information_request_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
5005   offset += INFO_REQUEST_IND_LENGTH;
5006   return offset;
5007 }
5008 /* ------------------------------------------------------------------
5009   Dissector Message Type Information
5010  */
5011 static gint
5012 dissect_isup_information_message(tvbuff_t *message_tvb, proto_tree *isup_tree)
5013 { proto_item* parameter_item;
5014   proto_tree* parameter_tree;
5015   tvbuff_t *parameter_tvb;
5016   gint offset = 0;
5017   gint parameter_type, actual_length;
5018
5019   /* Do stuff for first mandatory fixed parameter: Information  indicators*/
5020   parameter_type = PARAM_TYPE_INFO_IND;
5021   parameter_item = proto_tree_add_text(isup_tree, message_tvb, offset,
5022                                        INFO_IND_LENGTH,
5023                                        "Information indicators");
5024   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
5025   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type, "Mandatory Parameter: %u (%s)", parameter_type, val_to_str(parameter_type, isup_parameter_type_value,"unknown"));
5026   actual_length = tvb_ensure_length_remaining(message_tvb, offset);
5027   parameter_tvb = tvb_new_subset(message_tvb, offset, MIN(INFO_IND_LENGTH, actual_length), INFO_IND_LENGTH);
5028   dissect_isup_information_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
5029   offset += INFO_IND_LENGTH;
5030   return offset;
5031 }
5032 /* ------------------------------------------------------------------
5033   Dissector Message Type Continuity
5034  */
5035 static gint
5036 dissect_isup_continuity_message(tvbuff_t *message_tvb, proto_tree *isup_tree)
5037 { proto_item* parameter_item;
5038   proto_tree* parameter_tree;
5039   tvbuff_t *parameter_tvb;
5040   gint offset = 0;
5041   gint parameter_type, actual_length;
5042
5043   /* Do stuff for first mandatory fixed parameter: Continuity indicators*/
5044   parameter_type = PARAM_TYPE_CONTINUITY_IND;
5045   parameter_item = proto_tree_add_text(isup_tree, message_tvb, offset,
5046                                        CONTINUITY_IND_LENGTH,
5047                                        "Continuity indicators");
5048   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
5049   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type, "Mandatory Parameter: %u (%s)", parameter_type, val_to_str(parameter_type, isup_parameter_type_value,"unknown"));
5050   actual_length = tvb_ensure_length_remaining(message_tvb, offset);
5051   parameter_tvb = tvb_new_subset(message_tvb, offset, MIN(CONTINUITY_IND_LENGTH, actual_length), CONTINUITY_IND_LENGTH);
5052   dissect_isup_continuity_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
5053   offset += CONTINUITY_IND_LENGTH;
5054   return offset;
5055 }
5056 /* ------------------------------------------------------------------
5057   Dissector Message Type Address complete
5058  */
5059 static gint
5060 dissect_isup_address_complete_message(tvbuff_t *message_tvb, proto_tree *isup_tree)
5061 { proto_item* parameter_item;
5062   proto_tree* parameter_tree;
5063   tvbuff_t *parameter_tvb;
5064   gint offset = 0;
5065   gint parameter_type, actual_length;
5066
5067   /* Do stuff for first mandatory fixed parameter: backward call indicators*/
5068   parameter_type = PARAM_TYPE_BACKW_CALL_IND;
5069   parameter_item = proto_tree_add_text(isup_tree, message_tvb, offset,
5070                                        BACKWARD_CALL_IND_LENGTH,
5071                                        "Backward Call Indicators");
5072   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
5073   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type, "Mandatory Parameter: %u (%s)", parameter_type, val_to_str(parameter_type, isup_parameter_type_value,"unknown"));
5074   actual_length = tvb_ensure_length_remaining(message_tvb, offset);
5075   parameter_tvb = tvb_new_subset(message_tvb, offset, MIN(BACKWARD_CALL_IND_LENGTH, actual_length), BACKWARD_CALL_IND_LENGTH);
5076   dissect_isup_backward_call_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
5077   offset += BACKWARD_CALL_IND_LENGTH;
5078   return offset;
5079 }
5080 /* ------------------------------------------------------------------
5081   Dissector Message Type Connect
5082  */
5083 static gint
5084 dissect_isup_connect_message(tvbuff_t *message_tvb, proto_tree *isup_tree)
5085 { proto_item* parameter_item;
5086   proto_tree* parameter_tree;
5087   tvbuff_t *parameter_tvb;
5088   gint offset = 0;
5089   gint parameter_type, actual_length;
5090
5091   /* Do stuff for first mandatory fixed parameter: backward call indicators*/
5092   parameter_type = PARAM_TYPE_BACKW_CALL_IND;
5093   parameter_item = proto_tree_add_text(isup_tree, message_tvb, offset,
5094                                        BACKWARD_CALL_IND_LENGTH,
5095                                        "Backward Call Indicators");
5096   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
5097   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type, "Mandatory Parameter: %u (%s)", parameter_type, val_to_str(parameter_type, isup_parameter_type_value,"unknown"));
5098   actual_length = tvb_ensure_length_remaining(message_tvb, offset);
5099   parameter_tvb = tvb_new_subset(message_tvb, offset, MIN(BACKWARD_CALL_IND_LENGTH, actual_length), BACKWARD_CALL_IND_LENGTH);
5100   dissect_isup_backward_call_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
5101   offset += BACKWARD_CALL_IND_LENGTH;
5102   return offset;
5103 }
5104 /* ------------------------------------------------------------------
5105   Dissector Message Type release message
5106  */
5107 static gint
5108 dissect_isup_release_message(tvbuff_t *message_tvb, proto_tree *isup_tree)
5109 { proto_item* parameter_item;
5110   proto_tree* parameter_tree;
5111   tvbuff_t *parameter_tvb;
5112   gint offset = 0;
5113   gint parameter_type, parameter_pointer, parameter_length, actual_length;
5114
5115   /* Do stuff for mandatory variable parameter Cause indicators */
5116   parameter_type =  PARAM_TYPE_CAUSE_INDICATORS;
5117
5118   parameter_pointer = tvb_get_guint8(message_tvb, offset);
5119   parameter_length = tvb_get_guint8(message_tvb, offset + parameter_pointer);
5120
5121   parameter_item = proto_tree_add_text(isup_tree, message_tvb,
5122                                        offset +  parameter_pointer,
5123                                        parameter_length + PARAMETER_LENGTH_IND_LENGTH,
5124                                        "Cause indicators, see Q.850");
5125   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
5126   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type, "Mandatory Parameter: %u (%s)", parameter_type, val_to_str(parameter_type, isup_parameter_type_value,"unknown"));
5127   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);
5128   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);
5129   actual_length = tvb_ensure_length_remaining(message_tvb, offset);
5130   parameter_tvb = tvb_new_subset(message_tvb, offset + parameter_pointer + PARAMETER_LENGTH_IND_LENGTH, MIN(parameter_length, actual_length), parameter_length );
5131   dissect_isup_cause_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
5132   offset += PARAMETER_POINTER_LENGTH;
5133
5134   return offset;
5135 }
5136 /* ------------------------------------------------------------------
5137   Dissector Message Type Resume/Suspend
5138  */
5139 static gint
5140 dissect_isup_suspend_resume_message(tvbuff_t *message_tvb, proto_tree *isup_tree)
5141 { proto_item* parameter_item;
5142   proto_tree* parameter_tree;
5143   tvbuff_t *parameter_tvb;
5144   gint offset = 0;
5145   gint parameter_type, actual_length;
5146
5147   /* Do stuff for first mandatory fixed parameter: backward call indicators*/
5148   parameter_type = PARAM_TYPE_SUSP_RESUME_IND;
5149   parameter_item = proto_tree_add_text(isup_tree, message_tvb, offset,
5150                                        SUSPEND_RESUME_IND_LENGTH,
5151                                        "Suspend/Resume indicator");
5152   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
5153   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type, "Mandatory Parameter: %u (%s)", parameter_type, val_to_str(parameter_type, isup_parameter_type_value,"unknown"));
5154   actual_length = tvb_ensure_length_remaining(message_tvb, offset);
5155   parameter_tvb = tvb_new_subset(message_tvb, offset, MIN(SUSPEND_RESUME_IND_LENGTH, actual_length), SUSPEND_RESUME_IND_LENGTH);
5156   dissect_isup_suspend_resume_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
5157   offset += SUSPEND_RESUME_IND_LENGTH;
5158   return offset;
5159 }
5160 /* ------------------------------------------------------------------
5161   Dissector Message Type Circuit group reset/query message
5162  */
5163 static gint
5164 dissect_isup_circuit_group_reset_query_message(tvbuff_t *message_tvb, proto_tree *isup_tree)
5165 { proto_item* parameter_item;
5166   proto_tree* parameter_tree;
5167   tvbuff_t *parameter_tvb;
5168   gint offset = 0;
5169   gint parameter_type, parameter_pointer, parameter_length, actual_length;
5170
5171   /* Do stuff for mandatory variable parameter range and status*/
5172   parameter_type =  PARAM_TYPE_RANGE_AND_STATUS;
5173
5174   parameter_pointer = tvb_get_guint8(message_tvb, offset);
5175   parameter_length = tvb_get_guint8(message_tvb, offset + parameter_pointer);
5176
5177   parameter_item = proto_tree_add_text(isup_tree, message_tvb,
5178                                        offset +  parameter_pointer,
5179                                        parameter_length + PARAMETER_LENGTH_IND_LENGTH,
5180                                        "Range and status");
5181   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
5182   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type, "Mandatory Parameter: %u (%s)", parameter_type, val_to_str(parameter_type, isup_parameter_type_value,"unknown"));
5183   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);
5184   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);
5185   actual_length = tvb_ensure_length_remaining(message_tvb, offset);
5186   parameter_tvb = tvb_new_subset(message_tvb, offset + parameter_pointer + PARAMETER_LENGTH_IND_LENGTH, MIN(parameter_length, actual_length), parameter_length );
5187   dissect_isup_range_and_status_parameter(parameter_tvb, parameter_tree, parameter_item);
5188   offset += PARAMETER_POINTER_LENGTH;
5189
5190   return offset;
5191 }
5192 /* ------------------------------------------------------------------
5193   Dissector Message Type Circuit group blocking/blocking ack/unblocking/unblocking ack messages
5194  */
5195 static gint
5196 dissect_isup_circuit_group_blocking_messages(tvbuff_t *message_tvb, proto_tree *isup_tree)
5197 { proto_item* parameter_item;
5198   proto_tree* parameter_tree;
5199   tvbuff_t *parameter_tvb;
5200   gint offset = 0;
5201   gint parameter_type, parameter_pointer, parameter_length, actual_length;
5202
5203    /* Do stuff for first mandatory fixed parameter: circuit group supervision message type*/
5204   parameter_type = PARAM_TYPE_CIRC_GRP_SV_MSG_TYPE;
5205   parameter_item = proto_tree_add_text(isup_tree, message_tvb, offset,
5206                                        CIRC_GRP_SV_MSG_TYPE_LENGTH,
5207                                        "Circuit group supervision message type");
5208   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
5209   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type, "Mandatory Parameter: %u (%s)", parameter_type, val_to_str(parameter_type, isup_parameter_type_value,"unknown"));
5210   actual_length = tvb_ensure_length_remaining(message_tvb, offset);
5211   parameter_tvb = tvb_new_subset(message_tvb, offset, MIN(CIRC_GRP_SV_MSG_TYPE_LENGTH, actual_length), CIRC_GRP_SV_MSG_TYPE_LENGTH);
5212   dissect_isup_circuit_group_supervision_message_type_parameter(parameter_tvb, parameter_tree, parameter_item);
5213   offset += CIRC_GRP_SV_MSG_TYPE_LENGTH;
5214
5215   /* Do stuff for mandatory variable parameter range and status*/
5216   parameter_type =  PARAM_TYPE_RANGE_AND_STATUS;
5217
5218   parameter_pointer = tvb_get_guint8(message_tvb, offset);
5219   parameter_length = tvb_get_guint8(message_tvb, offset + parameter_pointer);
5220
5221   parameter_item = proto_tree_add_text(isup_tree, message_tvb,
5222                                        offset +  parameter_pointer,
5223                                        parameter_length + PARAMETER_LENGTH_IND_LENGTH,
5224                                        "Range and status");
5225   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
5226   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type, "Mandatory Parameter: %u (%s)", parameter_type, val_to_str(parameter_type, isup_parameter_type_value,"unknown"));
5227   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);
5228   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);
5229   actual_length = tvb_ensure_length_remaining(message_tvb, offset);
5230   parameter_tvb = tvb_new_subset(message_tvb, offset + parameter_pointer + PARAMETER_LENGTH_IND_LENGTH, MIN(parameter_length, actual_length), parameter_length );
5231   dissect_isup_range_and_status_parameter(parameter_tvb, parameter_tree, parameter_item);
5232   offset += PARAMETER_POINTER_LENGTH;
5233
5234   return offset;
5235 }
5236
5237 /* ------------------------------------------------------------------
5238   Dissector Message Type Facility request/accepted
5239  */
5240 static gint
5241 dissect_isup_facility_request_accepted_message(tvbuff_t *message_tvb, proto_tree *isup_tree)
5242 { proto_item* parameter_item;
5243   proto_tree* parameter_tree;
5244   tvbuff_t *parameter_tvb;
5245   gint offset = 0;
5246   gint parameter_type, actual_length;
5247
5248   /* Do stuff for first mandatory fixed parameter: facility indicators*/
5249   parameter_type = PARAM_TYPE_FACILITY_IND;
5250   parameter_item = proto_tree_add_text(isup_tree, message_tvb, offset,
5251                                        FACILITY_IND_LENGTH,
5252                                        "Facility indicator");
5253   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
5254   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type, "Mandatory Parameter: %u (%s)", parameter_type, val_to_str(parameter_type, isup_parameter_type_value,"unknown"));
5255   actual_length = tvb_ensure_length_remaining(message_tvb, offset);
5256   parameter_tvb = tvb_new_subset(message_tvb, offset, MIN(FACILITY_IND_LENGTH, actual_length), FACILITY_IND_LENGTH);
5257   dissect_isup_facility_ind_parameter(parameter_tvb, parameter_item);
5258   offset += FACILITY_IND_LENGTH;
5259   return offset;
5260 }
5261 /* ------------------------------------------------------------------
5262   Dissector Message Type Facility reject
5263  */
5264 static gint
5265 dissect_isup_facility_reject_message(tvbuff_t *message_tvb, proto_tree *isup_tree)
5266 { proto_item* parameter_item;
5267   proto_tree* parameter_tree;
5268   tvbuff_t *parameter_tvb;
5269   gint offset = 0;
5270   gint parameter_type, parameter_pointer, parameter_length, actual_length;
5271
5272   /* Do stuff for first mandatory fixed parameter: facility indicators*/
5273   parameter_type = PARAM_TYPE_FACILITY_IND;
5274   parameter_item = proto_tree_add_text(isup_tree, message_tvb, offset,
5275                                        FACILITY_IND_LENGTH,
5276                                        "Facility indicator");
5277   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
5278   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type, "Mandatory Parameter: %u (%s)", parameter_type, val_to_str(parameter_type, isup_parameter_type_value,"unknown"));
5279   actual_length = tvb_ensure_length_remaining(message_tvb, offset);
5280   parameter_tvb = tvb_new_subset(message_tvb, offset, MIN(FACILITY_IND_LENGTH, actual_length), FACILITY_IND_LENGTH);
5281   dissect_isup_facility_ind_parameter(parameter_tvb, parameter_item);
5282   offset += FACILITY_IND_LENGTH;
5283
5284   /* Do stuff for mandatory variable parameter Cause indicators */
5285   parameter_type =  PARAM_TYPE_CAUSE_INDICATORS;
5286
5287   parameter_pointer = tvb_get_guint8(message_tvb, offset);
5288   parameter_length = tvb_get_guint8(message_tvb, offset + parameter_pointer);
5289
5290   parameter_item = proto_tree_add_text(isup_tree, message_tvb,
5291                                        offset +  parameter_pointer,
5292                                        parameter_length + PARAMETER_LENGTH_IND_LENGTH,
5293                                        "Cause indicators, see Q.850");
5294   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
5295   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type, "Mandatory Parameter: %u (%s)", parameter_type, val_to_str(parameter_type, isup_parameter_type_value,"unknown"));
5296   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);
5297   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);
5298   actual_length = tvb_ensure_length_remaining(message_tvb, offset);
5299   parameter_tvb = tvb_new_subset(message_tvb, offset + parameter_pointer + PARAMETER_LENGTH_IND_LENGTH, MIN(parameter_length, actual_length), parameter_length );
5300   dissect_isup_cause_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
5301   offset += PARAMETER_POINTER_LENGTH;
5302
5303   return offset;
5304 }
5305 /* ------------------------------------------------------------------
5306   Dissector Message Type Circuit group reset acknowledgement message
5307  */
5308 static gint
5309 dissect_isup_circuit_group_reset_acknowledgement_message(tvbuff_t *message_tvb, proto_tree *isup_tree)
5310 { proto_item* parameter_item;
5311   proto_tree* parameter_tree;
5312   tvbuff_t *parameter_tvb;
5313   gint offset = 0;
5314   gint parameter_type, parameter_pointer, parameter_length, actual_length;
5315
5316   /* Do stuff for mandatory variable parameter range and status*/
5317   parameter_type =  PARAM_TYPE_RANGE_AND_STATUS;
5318
5319   parameter_pointer = tvb_get_guint8(message_tvb, offset);
5320   parameter_length = tvb_get_guint8(message_tvb, offset + parameter_pointer);
5321
5322   parameter_item = proto_tree_add_text(isup_tree, message_tvb,
5323                                        offset +  parameter_pointer,
5324                                        parameter_length + PARAMETER_LENGTH_IND_LENGTH,
5325                                        "Range and status");
5326   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
5327   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type, "Mandatory Parameter: %u (%s)", parameter_type, val_to_str(parameter_type, isup_parameter_type_value,"unknown"));
5328   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);
5329   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);
5330   actual_length = tvb_ensure_length_remaining(message_tvb, offset);
5331   parameter_tvb = tvb_new_subset(message_tvb, offset + parameter_pointer + PARAMETER_LENGTH_IND_LENGTH, MIN(parameter_length, actual_length), parameter_length );
5332   dissect_isup_range_and_status_parameter(parameter_tvb, parameter_tree, parameter_item);
5333   offset += PARAMETER_POINTER_LENGTH;
5334
5335   return offset;
5336 }
5337 /* ------------------------------------------------------------------
5338   Dissector Message Type Circuit group query response message
5339  */
5340 static gint
5341 dissect_isup_circuit_group_query_response_message(tvbuff_t *message_tvb, proto_tree *isup_tree)
5342 { proto_item* parameter_item;
5343   proto_tree* parameter_tree;
5344   tvbuff_t *parameter_tvb;
5345   gint offset = 0;
5346   gint parameter_type, parameter_pointer, parameter_length, actual_length;
5347
5348   /* Do stuff for 1. mandatory variable parameter range and status*/
5349   parameter_type =  PARAM_TYPE_RANGE_AND_STATUS;
5350
5351   parameter_pointer = tvb_get_guint8(message_tvb, offset);
5352   parameter_length = tvb_get_guint8(message_tvb, offset + parameter_pointer);
5353
5354   parameter_item = proto_tree_add_text(isup_tree, message_tvb,
5355                                        offset +  parameter_pointer,
5356                                        parameter_length + PARAMETER_LENGTH_IND_LENGTH,
5357                                        "Range and status");
5358   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
5359   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type, "Mandatory Parameter: %u (%s)", parameter_type, val_to_str(parameter_type, isup_parameter_type_value,"unknown"));
5360   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);
5361   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);
5362   actual_length = tvb_ensure_length_remaining(message_tvb, offset);
5363   parameter_tvb = tvb_new_subset(message_tvb, offset + parameter_pointer + PARAMETER_LENGTH_IND_LENGTH, MIN(parameter_length, actual_length), parameter_length );
5364   dissect_isup_range_and_status_parameter(parameter_tvb, parameter_tree, parameter_item);
5365   offset += PARAMETER_POINTER_LENGTH;
5366
5367   /* Do stuff for 2. mandatory variable parameter Circuit state indicator*/
5368   parameter_type = PARAM_TYPE_CIRC_STATE_IND;
5369
5370   parameter_pointer = tvb_get_guint8(message_tvb, offset);
5371   parameter_length = tvb_get_guint8(message_tvb, offset + parameter_pointer);
5372
5373   parameter_item = proto_tree_add_text(isup_tree, message_tvb,
5374                                        offset +  parameter_pointer,
5375                                        parameter_length + PARAMETER_LENGTH_IND_LENGTH,
5376                                        "Circuit state indicator (national use)");
5377   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
5378   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type, "Mandatory Parameter: %u (%s)", parameter_type, val_to_str(parameter_type, isup_parameter_type_value,"unknown"));
5379   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);
5380   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);
5381   actual_length = tvb_ensure_length_remaining(message_tvb, offset);
5382   parameter_tvb = tvb_new_subset(message_tvb, offset + parameter_pointer + PARAMETER_LENGTH_IND_LENGTH, MIN(parameter_length, actual_length), parameter_length );
5383   dissect_isup_circuit_state_ind_parameter(parameter_tvb, parameter_tree, parameter_item);
5384   offset += PARAMETER_POINTER_LENGTH;
5385
5386   return offset;
5387 }
5388 /* ------------------------------------------------------------------
5389   Dissector Message Type Call Progress
5390 */
5391 static gint
5392 dissect_isup_call_progress_message(tvbuff_t *message_tvb, proto_tree *isup_tree)
5393 { proto_item* parameter_item;
5394   proto_tree* parameter_tree;
5395   tvbuff_t *parameter_tvb;
5396   gint offset = 0;
5397   gint parameter_type, actual_length;
5398
5399   /* Do stuff for first mandatory fixed parameter: Event information*/
5400   parameter_type = PARAM_TYPE_EVENT_INFO;
5401   parameter_item = proto_tree_add_text(isup_tree, message_tvb, offset,
5402                                        EVENT_INFO_LENGTH,
5403                                        "Event information");
5404   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
5405   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type, "Mandatory Parameter: %u (%s)", parameter_type, val_to_str(parameter_type, isup_parameter_type_value,"unknown"));
5406   actual_length = tvb_ensure_length_remaining(message_tvb, offset);
5407   parameter_tvb = tvb_new_subset(message_tvb, offset, MIN(EVENT_INFO_LENGTH, actual_length), EVENT_INFO_LENGTH);
5408   dissect_isup_event_information_parameter(parameter_tvb, parameter_tree, parameter_item);
5409   offset += EVENT_INFO_LENGTH;
5410   return offset;
5411 }
5412 /* ------------------------------------------------------------------
5413   Dissector Message Type User-to-User information
5414  */
5415 static gint
5416 dissect_isup_user_to_user_information_message(tvbuff_t *message_tvb, proto_tree *isup_tree)
5417 { proto_item* parameter_item;
5418   proto_tree* parameter_tree;
5419   tvbuff_t *parameter_tvb;
5420   gint offset = 0;
5421   gint parameter_type, parameter_pointer, parameter_length, actual_length;
5422
5423   /* Do stuff for mandatory variable parameter User-to-user information*/
5424   parameter_type =  PARAM_TYPE_USER_TO_USER_INFO;
5425
5426   parameter_pointer = tvb_get_guint8(message_tvb, offset);
5427   parameter_length = tvb_get_guint8(message_tvb, offset + parameter_pointer);
5428
5429   parameter_item = proto_tree_add_text(isup_tree, message_tvb,
5430                                        offset +  parameter_pointer,
5431                                        parameter_length + PARAMETER_LENGTH_IND_LENGTH,
5432                                        "User-to-user information, see Q.931");
5433   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
5434   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type, "Mandatory Parameter: %u (%s)", parameter_type, val_to_str(parameter_type, isup_parameter_type_value,"unknown"));
5435   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);
5436   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);
5437   actual_length = tvb_ensure_length_remaining(message_tvb, offset);
5438   parameter_tvb = tvb_new_subset(message_tvb, offset + parameter_pointer + PARAMETER_LENGTH_IND_LENGTH, MIN(parameter_length, actual_length), parameter_length );
5439   dissect_isup_user_to_user_information_parameter(parameter_tvb, parameter_tree, parameter_item);
5440   offset += PARAMETER_POINTER_LENGTH;
5441
5442   return offset;
5443 }
5444 /* ------------------------------------------------------------------
5445   Dissector Message Type Confusion
5446  */
5447 static gint
5448 dissect_isup_confusion_message(tvbuff_t *message_tvb, proto_tree *isup_tree)
5449 { proto_item* parameter_item;
5450   proto_tree* parameter_tree;
5451   tvbuff_t *parameter_tvb;
5452   gint offset = 0;
5453   gint parameter_type, parameter_pointer, parameter_length, actual_length;
5454
5455   /* Do stuff for mandatory variable parameter Cause indicators */
5456   parameter_type =  PARAM_TYPE_CAUSE_INDICATORS;
5457
5458   parameter_pointer = tvb_get_guint8(message_tvb, offset);
5459   parameter_length = tvb_get_guint8(message_tvb, offset + parameter_pointer);
5460
5461   parameter_item = proto_tree_add_text(isup_tree, message_tvb,
5462                                        offset +  parameter_pointer,
5463                                        parameter_length + PARAMETER_LENGTH_IND_LENGTH,
5464                                        "Cause indicators, see Q.850");
5465   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
5466   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type, "Mandatory Parameter: %u (%s)", parameter_type, val_to_str(parameter_type, isup_parameter_type_value,"unknown"));
5467   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);
5468   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);
5469   actual_length = tvb_ensure_length_remaining(message_tvb, offset);
5470   parameter_tvb = tvb_new_subset(message_tvb, offset + parameter_pointer + PARAMETER_LENGTH_IND_LENGTH, MIN(parameter_length, actual_length), parameter_length );
5471   dissect_isup_cause_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
5472   offset += PARAMETER_POINTER_LENGTH;
5473
5474   return offset;
5475 }
5476 /* ------------------------------------------------------------------ */
5477 static void
5478 dissect_isup_message(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree *isup_tree)
5479 {
5480   static isup_tap_rec_t tap_rec;
5481   tvbuff_t *parameter_tvb;
5482   tvbuff_t *optional_parameter_tvb;
5483   proto_item* pass_along_item;
5484   proto_tree* pass_along_tree;
5485   gint offset, bufferlength;
5486   guint8 message_type, opt_parameter_pointer;
5487   gint opt_part_possible = FALSE; /* default setting - for message types allowing optional
5488                                      params explicitely set to TRUE in case statement */
5489   tap_calling_number = NULL;
5490   offset = 0;
5491
5492   /* Extract message type field */
5493   message_type = tvb_get_guint8(message_tvb,0);
5494
5495    proto_tree_add_uint_format(isup_tree, hf_isup_message_type, message_tvb, 0, MESSAGE_TYPE_LENGTH, message_type, "Message type: %s (%u)", val_to_str(message_type, isup_message_type_value, "reserved"), message_type);
5496    offset +=  MESSAGE_TYPE_LENGTH;
5497
5498    tap_rec.message_type = message_type;
5499    tap_rec.calling_number = NULL;
5500    tap_rec.called_number = NULL;
5501
5502    parameter_tvb = tvb_new_subset(message_tvb, offset, -1, -1);
5503
5504    /* distinguish between message types:*/
5505    switch (message_type) {
5506      case MESSAGE_TYPE_INITIAL_ADDR:
5507        offset += dissect_isup_initial_address_message(parameter_tvb, isup_tree);
5508        opt_part_possible = TRUE;
5509       break;
5510     case MESSAGE_TYPE_SUBSEQ_ADDR:
5511        offset += dissect_isup_subsequent_address_message(parameter_tvb, isup_tree);
5512        opt_part_possible = TRUE;
5513       break;
5514     case MESSAGE_TYPE_INFO_REQ:
5515        offset += dissect_isup_information_request_message(parameter_tvb, isup_tree);
5516        opt_part_possible = TRUE;
5517       break;
5518     case MESSAGE_TYPE_INFO:
5519        offset += dissect_isup_information_message(parameter_tvb, isup_tree);
5520        opt_part_possible = TRUE;
5521       break;
5522     case MESSAGE_TYPE_CONTINUITY:
5523        offset += dissect_isup_continuity_message(parameter_tvb, isup_tree);
5524       break;
5525     case MESSAGE_TYPE_ADDR_CMPL:
5526        offset += dissect_isup_address_complete_message(parameter_tvb, isup_tree);
5527        opt_part_possible = TRUE;
5528       break;
5529     case MESSAGE_TYPE_CONNECT:
5530        offset += dissect_isup_connect_message(parameter_tvb, isup_tree);
5531        opt_part_possible = TRUE;
5532       break;
5533     case MESSAGE_TYPE_FORW_TRANS:
5534       /* no dissector necessary since no mandatory parameters included */
5535        opt_part_possible = TRUE;
5536       break;
5537     case MESSAGE_TYPE_ANSWER:
5538       /* no dissector necessary since no mandatory parameters included */
5539        opt_part_possible = TRUE;
5540       break;
5541     case MESSAGE_TYPE_RELEASE:
5542        offset += dissect_isup_release_message(parameter_tvb, isup_tree);
5543        opt_part_possible = TRUE;
5544       break;
5545     case MESSAGE_TYPE_SUSPEND:
5546        offset += dissect_isup_suspend_resume_message(parameter_tvb, isup_tree);
5547        opt_part_possible = TRUE;
5548       break;
5549     case MESSAGE_TYPE_RESUME:
5550        offset += dissect_isup_suspend_resume_message(parameter_tvb, isup_tree);
5551        opt_part_possible = TRUE;
5552       break;
5553     case MESSAGE_TYPE_REL_CMPL:
5554       /* no dissector necessary since no mandatory parameters included */
5555        opt_part_possible = TRUE;
5556       break;
5557     case MESSAGE_TYPE_CONT_CHECK_REQ:
5558       /* no dissector necessary since no mandatory parameters included */
5559       break;
5560     case MESSAGE_TYPE_RESET_CIRCUIT:
5561       /* no dissector necessary since no mandatory parameters included */
5562       break;
5563     case MESSAGE_TYPE_BLOCKING:
5564       /* no dissector necessary since no mandatory parameters included */
5565       break;
5566     case MESSAGE_TYPE_UNBLOCKING:
5567       /* no dissector necessary since no mandatory parameters included */
5568       break;
5569     case MESSAGE_TYPE_BLOCK_ACK:
5570       /* no dissector necessary since no mandatory parameters included */
5571       break;
5572     case MESSAGE_TYPE_UNBLOCK_ACK:
5573       /* no dissector necessary since no mandatory parameters included */
5574       break;
5575     case MESSAGE_TYPE_CIRC_GRP_RST:
5576        offset += dissect_isup_circuit_group_reset_query_message(parameter_tvb, isup_tree);
5577       break;
5578     case MESSAGE_TYPE_CIRC_GRP_BLCK:
5579        offset += dissect_isup_circuit_group_blocking_messages(parameter_tvb, isup_tree);
5580       break;
5581     case MESSAGE_TYPE_CIRC_GRP_UNBL:
5582        offset += dissect_isup_circuit_group_blocking_messages(parameter_tvb, isup_tree);
5583       break;
5584     case MESSAGE_TYPE_CIRC_GRP_BL_ACK:
5585        offset += dissect_isup_circuit_group_blocking_messages(parameter_tvb, isup_tree);
5586       break;
5587     case MESSAGE_TYPE_CIRC_GRP_UNBL_ACK:
5588        offset += dissect_isup_circuit_group_blocking_messages(parameter_tvb, isup_tree);
5589       break;
5590     case MESSAGE_TYPE_FACILITY_REQ:
5591        offset += dissect_isup_facility_request_accepted_message(parameter_tvb, isup_tree);
5592        opt_part_possible = TRUE;
5593       break;
5594     case MESSAGE_TYPE_FACILITY_ACC:
5595        offset += dissect_isup_facility_request_accepted_message(parameter_tvb, isup_tree);
5596        opt_part_possible = TRUE;
5597       break;
5598     case MESSAGE_TYPE_FACILITY_REJ:
5599        offset += dissect_isup_facility_reject_message(parameter_tvb, isup_tree);
5600        opt_part_possible = TRUE;
5601       break;
5602     case MESSAGE_TYPE_LOOP_BACK_ACK:
5603       /* no dissector necessary since no mandatory parameters included */
5604       break;
5605     case MESSAGE_TYPE_PASS_ALONG:
5606       /* call dissect_isup_message recursively */
5607       { guint8 pa_message_type;
5608         pa_message_type = tvb_get_guint8(parameter_tvb, 0);
5609         pass_along_item = proto_tree_add_text(isup_tree, parameter_tvb, offset, -1, "Pass-along: %s Message (%u)", val_to_str(pa_message_type, isup_message_type_value_acro, "reserved"), pa_message_type);
5610         pass_along_tree = proto_item_add_subtree(pass_along_item, ett_isup_pass_along_message);
5611         dissect_isup_message(parameter_tvb, pinfo, pass_along_tree);
5612         break;
5613       }
5614     case MESSAGE_TYPE_CIRC_GRP_RST_ACK:
5615        offset += dissect_isup_circuit_group_reset_acknowledgement_message(parameter_tvb, isup_tree);
5616       break;
5617     case MESSAGE_TYPE_CIRC_GRP_QRY:
5618        offset += dissect_isup_circuit_group_reset_query_message(parameter_tvb, isup_tree);
5619       break;
5620     case MESSAGE_TYPE_CIRC_GRP_QRY_RSP:
5621        offset += dissect_isup_circuit_group_query_response_message(parameter_tvb, isup_tree);
5622       break;
5623     case MESSAGE_TYPE_CALL_PROGRSS:
5624        offset += dissect_isup_call_progress_message(parameter_tvb, isup_tree);
5625        opt_part_possible = TRUE;
5626       break;
5627     case MESSAGE_TYPE_USER2USER_INFO:
5628       offset += dissect_isup_user_to_user_information_message(parameter_tvb, isup_tree);
5629       opt_part_possible = TRUE;
5630       break;
5631     case MESSAGE_TYPE_UNEQUIPPED_CIC:
5632       /* no dissector necessary since no mandatory parameters included */
5633       break;
5634     case MESSAGE_TYPE_CONFUSION:
5635       offset += dissect_isup_confusion_message(parameter_tvb, isup_tree);
5636        opt_part_possible = TRUE;
5637       break;
5638     case MESSAGE_TYPE_OVERLOAD:
5639       /* no dissector necessary since no mandatory parameters included */
5640       break;
5641     case MESSAGE_TYPE_CHARGE_INFO:
5642       /* do nothing since format is a national matter */
5643       bufferlength = tvb_length_remaining(message_tvb, offset);
5644       if (bufferlength != 0)
5645         proto_tree_add_text(isup_tree, parameter_tvb, 0, bufferlength, "Format is a national matter");
5646       break;
5647     case MESSAGE_TYPE_NETW_RESRC_MGMT:
5648       /* no dissector necessary since no mandatory parameters included */
5649        opt_part_possible = TRUE;
5650       break;
5651     case MESSAGE_TYPE_FACILITY:
5652       /* no dissector necessary since no mandatory parameters included */
5653        opt_part_possible = TRUE;
5654       break;
5655     case MESSAGE_TYPE_USER_PART_TEST:
5656       /* no dissector necessary since no mandatory parameters included */
5657        opt_part_possible = TRUE;
5658       break;
5659     case MESSAGE_TYPE_USER_PART_AVAIL:
5660       /* no dissector necessary since no mandatory parameters included */
5661        opt_part_possible = TRUE;
5662       break;
5663     case MESSAGE_TYPE_IDENT_REQ:
5664       /* no dissector necessary since no mandatory parameters included */
5665        opt_part_possible = TRUE;
5666       break;
5667     case MESSAGE_TYPE_IDENT_RSP:
5668       /* no dissector necessary since no mandatory parameters included */
5669        opt_part_possible = TRUE;
5670       break;
5671     case MESSAGE_TYPE_SEGMENTATION:
5672       /* no dissector necessary since no mandatory parameters included */
5673        opt_part_possible = TRUE;
5674       break;
5675     case MESSAGE_TYPE_LOOP_PREVENTION:
5676       /* no dissector necessary since no mandatory parameters included */
5677        opt_part_possible = TRUE;
5678       break;
5679     case MESSAGE_TYPE_APPLICATION_TRANS:
5680       /* no dissector necessary since no mandatory parameters included */
5681        opt_part_possible = TRUE;
5682       break;
5683     case MESSAGE_TYPE_PRE_RELEASE_INFO:
5684       /* no dissector necessary since no mandatory parameters included */
5685        opt_part_possible = TRUE;
5686       break;
5687     case MESSAGE_TYPE_SUBSEQUENT_DIR_NUM:
5688       /* do nothing since format is a national matter */
5689       bufferlength = tvb_length_remaining(message_tvb, offset);
5690       if (bufferlength != 0)
5691         proto_tree_add_text(isup_tree, parameter_tvb, 0, bufferlength, "Format is a national matter");
5692       break;
5693
5694     default:
5695       bufferlength = tvb_length_remaining(message_tvb, offset);
5696       if (bufferlength != 0)
5697         proto_tree_add_text(isup_tree, parameter_tvb, 0, bufferlength, "Unknown Message type (possibly reserved/used in former ISUP version)");
5698       break;
5699   }
5700
5701    /* extract pointer to start of optional part (if any) */
5702    if (opt_part_possible == TRUE){
5703      opt_parameter_pointer = tvb_get_guint8(message_tvb, offset);
5704      if (opt_parameter_pointer > 0){
5705        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);
5706        offset += opt_parameter_pointer;
5707        optional_parameter_tvb = tvb_new_subset(message_tvb, offset, -1, -1 );
5708        dissect_isup_optional_parameter(optional_parameter_tvb, pinfo, isup_tree);
5709      }
5710      else
5711        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);
5712    }
5713    else if (message_type !=MESSAGE_TYPE_CHARGE_INFO)
5714      proto_tree_add_text(isup_tree, message_tvb, 0, 0, "No optional parameters are possible with this message type");
5715    /* if there are calling/called number, we'll get them for the tap */
5716
5717    tap_rec.calling_number=tap_calling_number?tap_calling_number:ep_strdup("");
5718    tap_rec.called_number=tap_called_number;
5719    tap_rec.cause_value=tap_cause_value;
5720    tap_queue_packet(isup_tap, pinfo, &tap_rec);
5721 }
5722
5723 /* ------------------------------------------------------------------ */
5724 static void
5725 dissect_isup(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
5726 {
5727
5728 /* Set up structures needed to add the protocol subtree and manage it */
5729         proto_item *ti;
5730         proto_tree *isup_tree = NULL;
5731         tvbuff_t *message_tvb;
5732         guint16 cic;
5733         guint8 message_type;
5734
5735 /* Make entries in Protocol column and Info column on summary display */
5736         if (check_col(pinfo->cinfo, COL_PROTOCOL))
5737                 col_set_str(pinfo->cinfo, COL_PROTOCOL, "ISUP (ITU)");
5738
5739 /* Extract message type field */
5740         message_type = tvb_get_guint8(tvb, CIC_OFFSET + CIC_LENGTH);
5741         /* dissect CIC in main dissector since pass-along message type carrying complete IUSP message w/o CIC needs
5742            recursive message dissector call */
5743         cic = tvb_get_letohs(tvb, CIC_OFFSET) & 0x0FFF; /*since upper 4 bits spare */
5744
5745
5746         pinfo->ctype = CT_ISUP;
5747         pinfo->circuit_id = cic;
5748
5749         if (check_col(pinfo->cinfo, COL_INFO))
5750         {
5751                 if (isup_show_cic_in_info)
5752                         col_add_fstr(pinfo->cinfo, COL_INFO, "%s (CIC %u) ", val_to_str(message_type, isup_message_type_value_acro, "reserved"), cic);
5753                 else
5754                         col_add_fstr(pinfo->cinfo, COL_INFO, "%s ", val_to_str(message_type, isup_message_type_value_acro, "reserved"));
5755         }
5756
5757 /* In the interest of speed, if "tree" is NULL, don't do any work not
5758    necessary to generate protocol tree items. */
5759         if (tree) {
5760                 ti = proto_tree_add_item(tree, proto_isup, tvb, 0, -1, FALSE);
5761                 isup_tree = proto_item_add_subtree(ti, ett_isup);
5762
5763
5764                 proto_tree_add_uint_format(isup_tree, hf_isup_cic, tvb, CIC_OFFSET, CIC_LENGTH, cic, "CIC: %u", cic);
5765         }
5766
5767         message_tvb = tvb_new_subset(tvb, CIC_LENGTH, -1, -1);
5768         dissect_isup_message(message_tvb, pinfo, isup_tree);
5769 }
5770
5771 /* ------------------------------------------------------------------ */
5772 static void
5773 dissect_bicc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
5774 {
5775
5776 /* Set up structures needed to add the protocol subtree and manage it */
5777         proto_item *ti;
5778         proto_tree *bicc_tree = NULL;
5779         tvbuff_t *message_tvb;
5780         guint32 bicc_cic;
5781         guint8 message_type;
5782
5783         /*circuit_t *circuit;*/
5784
5785 /* Make entries in Protocol column and Info column on summary display */
5786         if (check_col(pinfo->cinfo, COL_PROTOCOL))
5787                 col_set_str(pinfo->cinfo, COL_PROTOCOL, "BICC");
5788
5789 /* Extract message type field */
5790         message_type = tvb_get_guint8(tvb, BICC_CIC_OFFSET + BICC_CIC_LENGTH);
5791
5792         if (check_col(pinfo->cinfo, COL_INFO))
5793                 col_add_fstr(pinfo->cinfo, COL_INFO, "%s ", val_to_str(message_type, isup_message_type_value_acro, "reserved"));
5794
5795         /* dissect CIC in main dissector since pass-along message type carrying complete BICC/ISUP message w/o CIC needs
5796            recursive message dissector call */
5797         bicc_cic = tvb_get_letohl(tvb, BICC_CIC_OFFSET);
5798
5799         pinfo->ctype = CT_BICC;
5800         pinfo->circuit_id = bicc_cic;
5801         /*
5802         XXXX TODO:Reassemble APM messages
5803         circuit = find_circuit( CT_BICC, bicc_cic, pinfo->fd->num );
5804     if( circuit == NULL ) {
5805         circuit = circuit_new( CT_BICC, bicc_cic, pinfo->fd->num );
5806         }else{
5807                 if (message_type == MESSAGE_TYPE_REL_CMPL){
5808                         close_circuit(circuit,pinfo->fd->num);
5809                 }
5810         }
5811         */
5812         /* In the interest of speed, if "tree" is NULL, don't do any work not
5813    necessary to generate protocol tree items. */
5814         if (tree) {
5815                 ti = proto_tree_add_item(tree, proto_bicc, tvb, 0, -1, FALSE);
5816                 bicc_tree = proto_item_add_subtree(ti, ett_bicc);
5817
5818
5819                 proto_tree_add_uint_format(bicc_tree, hf_bicc_cic, tvb, BICC_CIC_OFFSET, BICC_CIC_LENGTH, bicc_cic, "CIC: %u", bicc_cic);
5820         }
5821         
5822         message_tvb = tvb_new_subset(tvb, BICC_CIC_LENGTH, -1, -1);
5823         dissect_isup_message(message_tvb, pinfo, bicc_tree);
5824 }
5825
5826 static void
5827 dissect_application_isup(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
5828 {
5829 /* Set up structures needed to add the protocol subtree and manage it */
5830         proto_item *ti;
5831         proto_tree *isup_tree = NULL;
5832         tvbuff_t *message_tvb;
5833         guint8 message_type;
5834
5835 /* Make entries in Protocol column and Info column on summary display */
5836         if (check_col(pinfo->cinfo, COL_PROTOCOL))
5837                 col_append_str(pinfo->cinfo, COL_PROTOCOL, "/ISUP(ITU)");
5838
5839 /* Extract message type field */
5840         message_type = tvb_get_guint8(tvb, 0);
5841         /* application/ISUP has no  CIC  */
5842
5843         if (check_col(pinfo->cinfo, COL_INFO))
5844                 col_append_sep_fstr(pinfo->cinfo, COL_INFO, ", ", "ISUP:%s", val_to_str(message_type, isup_message_type_value_acro, "reserved"));
5845
5846 /* In the interest of speed, if "tree" is NULL, don't do any work not
5847    necessary to generate protocol tree items. */
5848         if (tree) {
5849                 ti = proto_tree_add_item(tree, proto_isup, tvb, 0, -1, FALSE);
5850                 isup_tree = proto_item_add_subtree(ti, ett_isup);
5851
5852
5853         }
5854
5855         message_tvb = tvb_new_subset(tvb, 0, -1, -1);
5856         dissect_isup_message(message_tvb, pinfo, isup_tree);
5857 }
5858 /* ---------------------------------------------------- stats tree
5859 */
5860 static int st_node_msg = -1;
5861 static int st_node_dir = -1;
5862
5863 static void msg_stats_tree_init(stats_tree* st) {
5864         st_node_msg = stats_tree_create_node(st, "Messages by Type", 0, TRUE);  
5865         st_node_dir = stats_tree_create_node(st, "Messages by Direction", 0, TRUE);     
5866 }
5867
5868 static int msg_stats_tree_packet(stats_tree *st  , packet_info *pinfo, epan_dissect_t *edt _U_, const void *p ) {
5869         const gchar* msg = match_strval(((isup_tap_rec_t*)p)->message_type, isup_message_type_value_acro);
5870         gchar src[32];
5871         gchar dst[32];
5872         gchar dir[64];
5873         int msg_node;
5874         int dir_node;
5875         
5876         address_to_str_buf(&(pinfo->net_src), src, sizeof src);
5877         address_to_str_buf(&(pinfo->net_dst), dst, sizeof dst);
5878         g_snprintf(dir,sizeof(dir),"%s->%s",src,dst);
5879         
5880         msg_node = tick_stat_node(st, msg, st_node_msg, TRUE);
5881         tick_stat_node(st, dir, msg_node, FALSE);
5882         
5883         dir_node = tick_stat_node(st, dir, st_node_dir, TRUE);
5884         tick_stat_node(st, msg, dir_node, FALSE);
5885         
5886         return 1;
5887 }
5888
5889 /*---------------------------------------------------------------------*/
5890 /* Register the protocol with Ethereal */
5891 void
5892 proto_register_isup(void)
5893 {
5894 /* Setup list of header fields  See Section 1.6.1 for details*/
5895         static hf_register_info hf[] = {
5896                 { &hf_isup_cic,
5897                         { "CIC",           "isup.cic",
5898                         FT_UINT16, BASE_HEX, NULL, 0x0,
5899                           "", HFILL }},
5900
5901                 { &hf_isup_message_type,
5902                         { "Message Type",  "isup.message_type",
5903                         FT_UINT8, BASE_DEC, NULL, 0x0,
5904                         "", HFILL }},
5905
5906                 { &hf_isup_parameter_type,
5907                         { "Parameter Type",  "isup.parameter_type",
5908                         FT_UINT8, BASE_DEC, NULL, 0x0,
5909                         "", HFILL }},
5910
5911                 { &hf_isup_parameter_length,
5912                         { "Parameter Length",  "isup.parameter_length",
5913                         FT_UINT8, BASE_DEC, NULL, 0x0,
5914                         "", HFILL }},
5915
5916                 { &hf_isup_mandatory_variable_parameter_pointer,
5917                         { "Pointer to Parameter",  "isup.mandatory_variable_parameter_pointer",
5918                         FT_UINT8, BASE_DEC, NULL, 0x0,
5919                         "", HFILL }},
5920
5921                 { &hf_isup_pointer_to_start_of_optional_part,
5922                         { "Pointer to optional parameter part",  "isup.optional_parameter_part_pointer",
5923                         FT_UINT8, BASE_DEC, NULL, 0x0,
5924                         "", HFILL }},
5925
5926                 { &hf_isup_satellite_indicator,
5927                         { "Satellite Indicator",  "isup.satellite_indicator",
5928                         FT_UINT8, BASE_HEX, VALS(isup_satellite_ind_value), BA_8BIT_MASK,
5929                         "", HFILL }},
5930
5931                 { &hf_isup_continuity_check_indicator,
5932                         { "Continuity Check Indicator",  "isup.continuity_check_indicator",
5933                         FT_UINT8, BASE_HEX, VALS(isup_continuity_check_ind_value), DC_8BIT_MASK,
5934                         "", HFILL }},
5935
5936                 { &hf_isup_echo_control_device_indicator,
5937                         { "Echo Control Device Indicator",  "isup.echo_control_device_indicator",
5938                         FT_BOOLEAN, 8, TFS(&isup_echo_control_device_ind_value),E_8BIT_MASK,
5939                         "", HFILL }},
5940
5941                 { &hf_isup_forw_call_natnl_inatnl_call_indicator,
5942                         { "National/international call indicator",  "isup.forw_call_natnl_inatnl_call_indicator",
5943                         FT_BOOLEAN, 16, TFS(&isup_natnl_inatnl_call_ind_value),A_16BIT_MASK,
5944                         "", HFILL }},
5945
5946                 { &hf_isup_forw_call_end_to_end_method_indicator,
5947                         { "End-to-end method indicator",  "isup.forw_call_end_to_end_method_indicator",
5948                         FT_UINT16, BASE_HEX, VALS(isup_end_to_end_method_ind_value), CB_16BIT_MASK,
5949                         "", HFILL }},
5950
5951                 { &hf_isup_forw_call_interworking_indicator,
5952                         { "Interworking indicator",  "isup.forw_call_interworking_indicator",
5953                         FT_BOOLEAN, 16, TFS(&isup_interworking_ind_value), D_16BIT_MASK,
5954                         "", HFILL }},
5955
5956                 { &hf_isup_forw_call_end_to_end_info_indicator,
5957                         { "End-to-end information indicator",  "isup.forw_call_end_to_end_information_indicator",
5958                         FT_BOOLEAN, 16, TFS(&isup_end_to_end_info_ind_value), E_16BIT_MASK,
5959                         "", HFILL }},
5960
5961                 { &hf_isup_forw_call_isdn_user_part_indicator,
5962                         { "ISDN user part indicator",  "isup.forw_call_isdn_user_part_indicator",
5963                         FT_BOOLEAN, 16, TFS(&isup_ISDN_user_part_ind_value), F_16BIT_MASK,
5964                         "", HFILL }},
5965
5966                 { &hf_isup_forw_call_preferences_indicator,
5967                         { "ISDN user part preference indicator",  "isup.forw_call_preferences_indicator",
5968                         FT_UINT16, BASE_HEX, VALS(isup_preferences_ind_value), HG_16BIT_MASK,
5969                         "", HFILL }},
5970
5971                 { &hf_isup_forw_call_isdn_access_indicator,
5972                         { "ISDN access indicator",  "isup.forw_call_isdn_access_indicator",
5973                         FT_BOOLEAN, 16, TFS(&isup_ISDN_originating_access_ind_value), I_16BIT_MASK,
5974                         "", HFILL }},
5975
5976                 { &hf_isup_forw_call_sccp_method_indicator,
5977                         { "SCCP method indicator",  "isup.forw_call_sccp_method_indicator",
5978                         FT_UINT16, BASE_HEX, VALS(isup_SCCP_method_ind_value), KJ_16BIT_MASK,
5979                         "", HFILL }},
5980
5981                 { &hf_isup_calling_partys_category,
5982                         { "Calling Party's category",  "isup.calling_partys_category",
5983                         FT_UINT8, BASE_HEX, VALS(isup_calling_partys_category_value), 0x0,
5984                         "", HFILL }},
5985
5986                 { &hf_isup_transmission_medium_requirement,
5987                         { "Transmission medium requirement",  "isup.transmission_medium_requirement",
5988                         FT_UINT8, BASE_DEC, VALS(isup_transmission_medium_requirement_value), 0x0,
5989                         "", HFILL }},
5990
5991                 { &hf_isup_odd_even_indicator,
5992                         { "Odd/even indicator",  "isup.isdn_odd_even_indicator",
5993                         FT_BOOLEAN, 8, TFS(&isup_odd_even_ind_value), ISUP_ODD_EVEN_MASK,
5994                         "", HFILL }},
5995
5996                 { &hf_isup_called_party_nature_of_address_indicator,
5997                         { "Nature of address indicator",  "isup.called_party_nature_of_address_indicator",
5998                         FT_UINT8, BASE_DEC, VALS(isup_called_party_nature_of_address_ind_value), ISUP_NATURE_OF_ADDRESS_IND_MASK,
5999                         "", HFILL }},
6000
6001                 { &hf_isup_calling_party_nature_of_address_indicator,
6002                         { "Nature of address indicator",  "isup.calling_party_nature_of_address_indicator",
6003                         FT_UINT8, BASE_DEC, VALS(isup_calling_party_nature_of_address_ind_value), ISUP_NATURE_OF_ADDRESS_IND_MASK,
6004                         "", HFILL }},
6005
6006                 { &hf_isup_inn_indicator,
6007                         { "INN indicator",  "isup.inn_indicator",
6008                         FT_BOOLEAN, 8, TFS(&isup_INN_ind_value), ISUP_INN_MASK,
6009                         "", HFILL }},
6010
6011                 { &hf_isup_ni_indicator,
6012                         { "NI indicator",  "isup.ni_indicator",
6013                         FT_BOOLEAN, 8, TFS(&isup_NI_ind_value), ISUP_NI_MASK,
6014                         "", HFILL }},
6015
6016                 { &hf_isup_numbering_plan_indicator,
6017                         { "Numbering plan indicator",  "isup.numbering_plan_indicator",
6018                         FT_UINT8, BASE_DEC, VALS(isup_numbering_plan_ind_value), ISUP_NUMBERING_PLAN_IND_MASK,
6019                         "", HFILL }},
6020
6021                 { &hf_isup_address_presentation_restricted_indicator,
6022                         { "Address presentation restricted indicator",  "isup.address_presentation_restricted_indicator",
6023                         FT_UINT8, BASE_DEC, VALS(isup_address_presentation_restricted_ind_value), ISUP_ADDRESS_PRESENTATION_RESTR_IND_MASK,
6024                         "", HFILL }},
6025
6026                 { &hf_isup_screening_indicator,
6027                         { "Screening indicator",  "isup.screening_indicator",
6028                         FT_UINT8, BASE_DEC, VALS(isup_screening_ind_value), ISUP_SCREENING_IND_MASK,
6029                         "", HFILL }},
6030
6031                 { &hf_isup_screening_indicator_enhanced,
6032                         { "Screening indicator",  "isup.screening_indicator_enhanced",
6033                         FT_UINT8, BASE_DEC, VALS(isup_screening_ind_enhanced_value), ISUP_SCREENING_IND_MASK,
6034                         "", HFILL }},
6035
6036                 { &hf_isup_called_party_odd_address_signal_digit,
6037                         { "Address signal digit",  "isup.called_party_odd_address_signal_digit",
6038                         FT_UINT8, BASE_DEC, VALS(isup_called_party_address_digit_value), ISUP_ODD_ADDRESS_SIGNAL_DIGIT_MASK,
6039                         "", HFILL }},
6040
6041                 { &hf_isup_calling_party_odd_address_signal_digit,
6042                         { "Address signal digit",  "isup.calling_party_odd_address_signal_digit",
6043                         FT_UINT8, BASE_DEC, VALS(isup_calling_party_address_digit_value), ISUP_ODD_ADDRESS_SIGNAL_DIGIT_MASK,
6044                         "", HFILL }},
6045
6046                 { &hf_isup_called_party_even_address_signal_digit,
6047                         { "Address signal digit",  "isup.called_party_even_address_signal_digit",
6048                         FT_UINT8, BASE_DEC, VALS(isup_called_party_address_digit_value), ISUP_EVEN_ADDRESS_SIGNAL_DIGIT_MASK,
6049                         "", HFILL }},
6050
6051                 { &hf_isup_calling_party_even_address_signal_digit,
6052                         { "Address signal digit",  "isup.calling_party_even_address_signal_digit",
6053                         FT_UINT8, BASE_DEC, VALS(isup_calling_party_address_digit_value), ISUP_EVEN_ADDRESS_SIGNAL_DIGIT_MASK,
6054                         "", HFILL }},
6055
6056                 { &hf_isup_calling_party_address_request_indicator,
6057                         { "Calling party address request indicator",  "isup.calling_party_address_request_indicator",
6058                         FT_BOOLEAN, 16, TFS(&isup_calling_party_address_request_ind_value), A_16BIT_MASK,
6059                         "", HFILL }},
6060
6061                 { &hf_isup_info_req_holding_indicator,
6062                         { "Holding indicator",  "isup.info_req_holding_indicator",
6063                         FT_BOOLEAN, 16, TFS(&isup_holding_ind_value), B_16BIT_MASK,
6064                         "", HFILL }},
6065
6066                 { &hf_isup_calling_partys_category_request_indicator,
6067                         { "Calling party's category request indicator",  "isup.calling_partys_category_request_indicator",
6068                         FT_BOOLEAN, 16, TFS(&isup_calling_partys_category_request_ind_value), D_16BIT_MASK,
6069                         "", HFILL }},
6070
6071                 { &hf_isup_charge_information_request_indicator,
6072                         { "Charge information request indicator",  "isup.charge_information_request_indicator",
6073                         FT_BOOLEAN, 16, TFS(&isup_charge_information_request_ind_value), E_16BIT_MASK,
6074                         "", HFILL }},
6075
6076                 { &hf_isup_malicious_call_identification_request_indicator,
6077                         { "Malicious call identification request indicator (ISUP'88)",  "isup.malicious_call_ident_request_indicator",
6078                         FT_BOOLEAN, 16, TFS(&isup_malicious_call_identification_request_ind_value), H_16BIT_MASK,
6079                         "", HFILL }},
6080
6081                 { &hf_isup_calling_party_address_response_indicator,
6082                         { "Calling party address response indicator",  "isup.calling_party_address_response_indicator",
6083                         FT_UINT16, BASE_HEX, VALS(isup_calling_party_address_response_ind_value), BA_16BIT_MASK,
6084                         "", HFILL }},
6085
6086                 { &hf_isup_OECD_inf_ind,
6087                         { "OECD information indicator",  "isup.OECD_inf_ind_vals",
6088                         FT_UINT8, BASE_HEX, VALS(OECD_inf_ind_vals), BA_8BIT_MASK,
6089                         "", HFILL }},
6090
6091                 { &hf_isup_IECD_inf_ind,
6092                         { "IECD information indicator",  "isup.IECD_inf_ind_vals",
6093                         FT_UINT8, BASE_HEX, VALS(IECD_inf_ind_vals), DC_8BIT_MASK,
6094                         "", HFILL }},
6095
6096                 { &hf_isup_OECD_req_ind,
6097                         { "OECD request indicator",  "isup.OECD_req_ind_vals",
6098                         FT_UINT8, BASE_HEX, VALS(OECD_req_ind_vals), FE_8BIT_MASK,
6099                         "", HFILL }},
6100
6101                 { &hf_isup_IECD_req_ind,
6102                         { "IECD request indicator",  "isup.IECD_req_ind_vals",
6103                         FT_UINT8, BASE_HEX, VALS(IECD_req_ind_vals), HG_8BIT_MASK,
6104                         "", HFILL }},
6105
6106                 { &hf_isup_hold_provided_indicator,
6107                         { "Hold provided indicator",  "isup.hold_provided_indicator",
6108                         FT_BOOLEAN, 16, TFS(&isup_hold_provided_ind_value), C_16BIT_MASK,
6109                         "", HFILL }},
6110
6111                 { &hf_isup_calling_partys_category_response_indicator,
6112                         { "Calling party's category response indicator",  "isup.calling_partys_category_response_indicator",
6113                         FT_BOOLEAN, 16, TFS(&isup_calling_partys_category_response_ind_value), F_16BIT_MASK,
6114                         "", HFILL }},
6115
6116                 { &hf_isup_charge_information_response_indicator,
6117                         { "Charge information response indicator",  "isup.charge_information_response_indicator",
6118                         FT_BOOLEAN, 16, TFS(&isup_charge_information_response_ind_value), G_16BIT_MASK,
6119                         "", HFILL }},
6120
6121                 { &hf_isup_solicited_indicator,
6122                         { "Solicited indicator",  "isup.solicided_indicator",
6123                         FT_BOOLEAN, 16, TFS(&isup_solicited_information_ind_value), H_16BIT_MASK,
6124                         "", HFILL }},
6125
6126                 { &hf_isup_continuity_indicator,
6127                         { "Continuity indicator",  "isup.continuity_indicator",
6128                         FT_BOOLEAN, 8, TFS(&isup_continuity_ind_value), A_8BIT_MASK,
6129                         "", HFILL }},
6130
6131                 { &hf_isup_backw_call_charge_ind,
6132                         { "Charge indicator",  "isup.charge_indicator",
6133                         FT_UINT16, BASE_HEX, VALS(isup_charge_ind_value), BA_16BIT_MASK,
6134                         "", HFILL }},
6135
6136                 { &hf_isup_backw_call_called_partys_status_ind,
6137                         { "Called party's status indicator",  "isup.called_partys_status_indicator",
6138                         FT_UINT16, BASE_HEX, VALS(isup_called_partys_status_ind_value), DC_16BIT_MASK,
6139                         "", HFILL }},
6140
6141                 { &hf_isup_backw_call_called_partys_category_ind,
6142                         { "Called party's category indicator",  "isup.called_partys_category_indicator",
6143                         FT_UINT16, BASE_HEX, VALS(isup_called_partys_category_ind_value), FE_16BIT_MASK,
6144                         "", HFILL }},
6145
6146                 { &hf_isup_backw_call_end_to_end_method_ind,
6147                         { "End-to-end method indicator",  "isup.backw_call_end_to_end_method_indicator",
6148                         FT_UINT16, BASE_HEX, VALS(isup_end_to_end_method_ind_value), HG_16BIT_MASK,
6149                         "", HFILL }},
6150
6151                 { &hf_isup_backw_call_interworking_ind,
6152                         { "Interworking indicator",  "isup.backw_call_interworking_indicator",
6153                         FT_BOOLEAN, 16, TFS(&isup_interworking_ind_value), I_16BIT_MASK,
6154                         "", HFILL }},
6155
6156                 { &hf_isup_backw_call_end_to_end_info_ind,
6157                         { "End-to-end information indicator",  "isup.backw_call_end_to_end_information_indicator",
6158                         FT_BOOLEAN, 16, TFS(&isup_end_to_end_info_ind_value), J_16BIT_MASK,
6159                         "", HFILL }},
6160
6161                 { &hf_isup_backw_call_isdn_user_part_ind,
6162                         { "ISDN user part indicator",  "isup.backw_call_isdn_user_part_indicator",
6163                         FT_BOOLEAN, 16, TFS(&isup_ISDN_user_part_ind_value), K_16BIT_MASK,
6164                         "", HFILL }},
6165
6166                 { &hf_isup_backw_call_holding_ind,
6167                         { "Holding indicator",  "isup.backw_call_holding_indicator",
6168                         FT_BOOLEAN, 16, TFS(&isup_holding_ind_value), L_16BIT_MASK,
6169                         "", HFILL }},
6170
6171                 { &hf_isup_backw_call_isdn_access_ind,
6172                         { "ISDN access indicator",  "isup.backw_call_isdn_access_indicator",
6173                         FT_BOOLEAN, 16, TFS(&isup_ISDN_terminating_access_ind_value), M_16BIT_MASK,
6174                         "", HFILL }},
6175
6176                 { &hf_isup_backw_call_echo_control_device_ind,
6177                         { "Echo Control Device Indicator",  "isup.backw_call_echo_control_device_indicator",
6178                         FT_BOOLEAN, 16, TFS(&isup_echo_control_device_ind_value), N_16BIT_MASK,
6179                         "", HFILL }},
6180
6181                 { &hf_isup_backw_call_sccp_method_ind,
6182                         { "SCCP method indicator",  "isup.backw_call_sccp_method_indicator",
6183                         FT_UINT16, BASE_HEX, VALS(isup_SCCP_method_ind_value), PO_16BIT_MASK,
6184                         "", HFILL }},
6185
6186                 { &hf_isup_cause_indicator,
6187                         { "Cause indicator",  "isup.cause_indicator",
6188                         FT_UINT8, BASE_DEC, VALS(q850_cause_code_vals), 0x7f,
6189                         "", HFILL }},
6190
6191                 { &hf_isup_suspend_resume_indicator,
6192                         { "Suspend/Resume indicator",  "isup.suspend_resume_indicator",
6193                         FT_BOOLEAN, 8, TFS(&isup_suspend_resume_ind_value), A_8BIT_MASK,
6194                         "", HFILL }},
6195
6196                 { &hf_isup_range_indicator,
6197                         { "Range indicator",  "isup.range_indicator",
6198                           FT_UINT8, BASE_DEC, NULL , 0x0,
6199                           "", HFILL }},
6200
6201                 { &hf_isup_cgs_message_type,
6202                         { "Circuit group supervision message type",  "isup.cgs_message_type",
6203                         FT_UINT8, BASE_DEC, VALS(isup_cgs_message_type_value), BA_8BIT_MASK,
6204                         "", HFILL }},
6205
6206                 { &hf_isup_mtc_blocking_state1,
6207                         { "Maintenance blocking state",  "isup.mtc_blocking_state",
6208                         FT_UINT8, BASE_DEC, VALS(isup_mtc_blocking_state_DC00_value), BA_8BIT_MASK,
6209                         "", HFILL }},
6210
6211                 { &hf_isup_mtc_blocking_state2,
6212                         { "Maintenance blocking state",  "isup.mtc_blocking_state",
6213                         FT_UINT8, BASE_DEC, VALS(isup_mtc_blocking_state_DCnot00_value), BA_8BIT_MASK,
6214                         "", HFILL }},
6215
6216                 { &hf_isup_call_proc_state,
6217                         { "Call processing state",  "isup.call_processing_state",
6218                         FT_UINT8, BASE_DEC, VALS(isup_call_processing_state_value), DC_8BIT_MASK,
6219                         "", HFILL }},
6220
6221                 { &hf_isup_hw_blocking_state,
6222                         { "HW blocking state",  "isup.hw_blocking_state",
6223                         FT_UINT8, BASE_DEC, VALS(isup_HW_blocking_state_value), FE_8BIT_MASK,
6224                         "", HFILL }},
6225
6226                 { &hf_isup_event_ind,
6227                         { "Event indicator",  "isup.event_ind",
6228                           FT_UINT8, 8, VALS(isup_event_ind_value), GFEDCBA_8BIT_MASK,
6229                         "", HFILL }},
6230
6231                 { &hf_isup_event_presentation_restricted_ind,
6232                         { "Event presentation restricted indicator",  "isup.event_presentatiation_restr_ind",
6233                         FT_BOOLEAN, 8, TFS(&isup_event_presentation_restricted_ind_value), H_8BIT_MASK,
6234                         "", HFILL }},
6235
6236                 { &hf_isup_cug_call_ind,
6237                         { "Closed user group call indicator",  "isup.clg_call_ind",
6238                         FT_UINT8, BASE_DEC, VALS(isup_CUG_call_ind_value), BA_8BIT_MASK,
6239                         "", HFILL }},
6240
6241                 { &hf_isup_simple_segmentation_ind,
6242                         { "Simple segmentation indicator",  "isup.simple_segmentation_ind",
6243                         FT_BOOLEAN, 8, TFS(&isup_simple_segmentation_ind_value), C_8BIT_MASK,
6244                         "", HFILL }},
6245
6246                 { &hf_isup_connected_line_identity_request_ind,
6247                         { "Connected line identity request indicator",  "isup.connected_line_identity_request_ind",
6248                         FT_BOOLEAN, 8, TFS(&isup_connected_line_identity_request_ind_value), H_8BIT_MASK,
6249                         "", HFILL }},
6250
6251                 { &hf_isup_redirecting_ind,
6252                         { "Redirection indicator",  "isup.redirecting_ind",
6253                         FT_UINT16, BASE_DEC, VALS(isup_redirecting_ind_value), CBA_16BIT_MASK,
6254                         "", HFILL }},
6255
6256                 { &hf_isup_original_redirection_reason,
6257                         { "Original redirection reason",  "isup.original_redirection_reason",
6258                         FT_UINT16, BASE_DEC, VALS(isup_original_redirection_reason_value), HGFE_16BIT_MASK,
6259                         "", HFILL }},
6260
6261                 { &hf_isup_redirection_counter,
6262                         { "Redirection counter",  "isup.redirection_counter",
6263                         FT_UINT16, BASE_DEC, NULL, KJI_16BIT_MASK,
6264                         "", HFILL }},
6265
6266                 { &hf_isup_redirection_reason,
6267                         { "Redirection reason",  "isup.redirection_reason",
6268                         FT_UINT16, BASE_DEC, VALS(isup_redirection_reason_value), PONM_16BIT_MASK,
6269                         "", HFILL }},
6270
6271                 { &hf_isup_type_of_network_identification,
6272                         { "Type of network identification",  "isup.type_of_network_identification",
6273                         FT_UINT8, BASE_DEC, VALS(isup_type_of_network_identification_value), GFE_8BIT_MASK,
6274                         "", HFILL }},
6275
6276                 { &hf_isup_network_identification_plan,
6277                         { "Network identification plan",  "isup.network_identification_plan",
6278                         FT_UINT8, BASE_DEC, VALS(isup_network_identification_plan_value), DCBA_8BIT_MASK,
6279                         "", HFILL }},
6280
6281                 { &hf_isup_map_type,
6282                         { "Map Type",  "isup.map_type",
6283                         FT_UINT8, BASE_DEC, VALS(isup_map_type_value), FEDCBA_8BIT_MASK,
6284                         "", HFILL }},
6285
6286                 { &hf_isup_automatic_congestion_level,
6287                         { "Automatic congestion level",  "isup.automatic_congestion_level",
6288                         FT_UINT8, BASE_DEC, VALS(isup_auto_congestion_level_value), 0x0,
6289                         "", HFILL }},
6290
6291                 { &hf_isup_inband_information_ind,
6292                         { "In-band information indicator",  "isup.inband_information_ind",
6293                         FT_BOOLEAN, 8, TFS(&isup_inband_information_ind_value), A_8BIT_MASK,
6294                         "", HFILL }},
6295
6296                 { &hf_isup_call_diversion_may_occur_ind,
6297                         { "Call diversion may occur indicator",  "isup.call_diversion_may_occur_ind",
6298                         FT_BOOLEAN, 8, TFS(&isup_call_diversion_may_occur_ind_value), B_8BIT_MASK,
6299                         "", HFILL }},
6300
6301                 { &hf_isup_mlpp_user_ind,
6302                         { "MLPP user indicator",  "isup.mlpp_user",
6303                         FT_BOOLEAN, 8, TFS(&isup_MLPP_user_ind_value), D_8BIT_MASK,
6304                         "", HFILL }},
6305
6306                 { &hf_isup_UUI_type,
6307                         { "User-to-User indicator type",  "isup.UUI_type",
6308                         FT_BOOLEAN, 8, TFS(&isup_UUI_type_value), A_8BIT_MASK,
6309                         "", HFILL }},
6310
6311                 { &hf_isup_UUI_req_service1,
6312                         { "User-to-User indicator request service 1",  "isup.UUI_req_service1",
6313                         FT_UINT8, BASE_DEC, VALS(isup_UUI_request_service_values), CB_8BIT_MASK,
6314                         "", HFILL }},
6315
6316                 { &hf_isup_UUI_req_service2,
6317                         { "User-to-User indicator request service 2",  "isup.UUI_req_service2",
6318                         FT_UINT8, BASE_DEC, VALS(isup_UUI_request_service_values), ED_8BIT_MASK,
6319                         "", HFILL }},
6320
6321                 { &hf_isup_UUI_req_service3,
6322                         { "User-to-User indicator request service 3",  "isup.UUI_req_service3",
6323                         FT_UINT8, BASE_DEC, VALS(isup_UUI_request_service_values), GF_8BIT_MASK,
6324                         "", HFILL }},
6325
6326                 { &hf_isup_UUI_res_service1,
6327                         { "User-to-User indicator response service 1",  "isup.UUI_res_service1",
6328                         FT_UINT8, BASE_DEC, VALS(isup_UUI_response_service_values), CB_8BIT_MASK,
6329                         "", HFILL }},
6330
6331                 { &hf_isup_UUI_res_service2,
6332                         { "User-to-User indicator response service 2",  "isup.UUI_res_service2",
6333                         FT_UINT8, BASE_DEC, VALS(isup_UUI_response_service_values), ED_8BIT_MASK,
6334                         "", HFILL }},
6335
6336                 { &hf_isup_UUI_res_service3,
6337                         { "User-to-User response service 3",  "isup.UUI_res_service3",
6338                         FT_UINT8, BASE_DEC, VALS(isup_UUI_response_service_values), GF_8BIT_MASK,
6339                         "", HFILL }},
6340
6341                 { &hf_isup_UUI_network_discard_ind,
6342                         { "User-to-User indicator network discard indicator",  "isup.UUI_network_discard_ind",
6343                         FT_BOOLEAN, 8, TFS(&isup_UUI_network_discard_ind_value), H_8BIT_MASK,
6344                         "", HFILL }},
6345
6346                 { &hf_isup_access_delivery_ind,
6347                         { "Access delivery indicator",  "isup.access_delivery_ind",
6348                         FT_BOOLEAN, 8, TFS(&isup_access_delivery_ind_value), A_8BIT_MASK,
6349                         "", HFILL }},
6350
6351                 { &hf_isup_transmission_medium_requirement_prime,
6352                         { "Transmission medium requirement prime",  "isup.transmission_medium_requirement_prime",
6353                         FT_UINT8, BASE_DEC, VALS(isup_transmission_medium_requirement_prime_value), 0x0,
6354                         "", HFILL }},
6355
6356                 { &hf_isup_loop_prevention_response_ind,
6357                         { "Response indicator",  "isup.loop_prevention_response_ind",
6358                         FT_UINT8, BASE_DEC, VALS(isup_loop_prevention_response_ind_value), CB_8BIT_MASK,
6359                         "", HFILL }},
6360
6361                 { &hf_isup_temporary_alternative_routing_ind,
6362                         { "Temporary alternative routing indicator",  "isup.temporary_alternative_routing_ind",
6363                         FT_BOOLEAN, 8, TFS(&isup_temporary_alternative_routing_ind_value), A_8BIT_MASK,
6364                         "", HFILL }},
6365
6366                 { &hf_isup_extension_ind,
6367                         { "Extension indicator",  "isup.extension_ind",
6368                         FT_BOOLEAN, 8, TFS(&isup_extension_ind_value), H_8BIT_MASK,
6369                         "", HFILL }},
6370
6371                 { &hf_isup_call_to_be_diverted_ind,
6372                         { "Call to be diverted indicator",  "isup.call_to_be_diverted_ind",
6373                         FT_UINT8, BASE_DEC, VALS(isup_call_to_be_diverted_ind_value), BA_8BIT_MASK,
6374                         "", HFILL }},
6375
6376                 { &hf_isup_call_to_be_offered_ind,
6377                         { "Call to be offered indicator",  "isup.call_to_be_offered_ind",
6378                         FT_UINT8, BASE_DEC, VALS(isup_call_to_be_offered_ind_value), BA_8BIT_MASK,
6379                         "", HFILL }},
6380
6381                 { &hf_isup_conference_acceptance_ind,
6382                         { "Conference acceptance indicator",  "isup.conference_acceptance_ind",
6383                         FT_UINT8, BASE_DEC, VALS(isup_conference_acceptance_ind_value), BA_8BIT_MASK,
6384                         "", HFILL }},
6385
6386                 { &hf_isup_transit_at_intermediate_exchange_ind,
6387                         { "Transit at intermediate exchange indicator", "isup.transit_at_intermediate_exchange_ind",
6388                         FT_BOOLEAN, 8, TFS(&isup_transit_at_intermediate_exchange_ind_value), A_8BIT_MASK,
6389                         "", HFILL }},
6390
6391                 { &hf_isup_Release_call_ind,
6392                         { "Release call indicator", "isup.Release_call_ind",
6393                         FT_BOOLEAN, 8, TFS(&isup_Release_call_indicator_value), B_8BIT_MASK,
6394                         "", HFILL }},
6395
6396                 { &hf_isup_Send_notification_ind,
6397                         { "Send notification indicator", "isup.Send_notification_ind",
6398                         FT_BOOLEAN, 8, TFS(&isup_Send_notification_ind_value),C_8BIT_MASK,
6399                         "", HFILL }},
6400
6401                 { &hf_isup_Discard_message_ind_value,
6402                         { "Discard message indicator","isup.Discard_message_ind_value",
6403                         FT_BOOLEAN, 8, TFS(&isup_Discard_message_ind_value), D_8BIT_MASK,
6404                         "", HFILL }},
6405
6406                 { &hf_isup_Discard_parameter_ind,               
6407                         { "Discard parameter indicator","isup.Discard_parameter_ind",
6408                         FT_BOOLEAN, 8, TFS(&isup_Discard_parameter_ind_value), E_8BIT_MASK,
6409                         "", HFILL }},
6410
6411                 { &hf_isup_Pass_on_not_possible_indicator,
6412                         { "Pass on not possible indicator",  "isup_Pass_on_not_possible_ind",
6413                         FT_UINT8, BASE_HEX, VALS(isup_Pass_on_not_possible_indicator_vals),GF_8BIT_MASK,
6414                         "", HFILL }},
6415
6416                 { &hf_isup_pass_on_not_possible_indicator2,
6417                         { "Pass on not possible indicator",  "isup_Pass_on_not_possible_val",
6418                         FT_BOOLEAN, 8, TFS(&isup_pass_on_not_possible_indicator_value),E_8BIT_MASK,
6419                         "", HFILL }},
6420
6421                 { &hf_isup_Broadband_narrowband_interworking_ind,
6422                         { "Broadband narrowband interworking indicator Bits JF",  "isup_broadband-narrowband_interworking_ind",
6423                         FT_UINT8, BASE_HEX, VALS(ISUP_Broadband_narrowband_interworking_indicator_vals),BA_8BIT_MASK,
6424                         "", HFILL }},
6425
6426                 { &hf_isup_Broadband_narrowband_interworking_ind2,
6427                         { "Broadband narrowband interworking indicator Bits GF",  "isup_broadband-narrowband_interworking_ind2",
6428                         FT_UINT8, BASE_HEX, VALS(ISUP_Broadband_narrowband_interworking_indicator_vals),GF_8BIT_MASK,
6429                         "", HFILL }},
6430
6431                 { &hf_isup_app_cont_ident,
6432                         { "Application context identifier",  "isup.app_context_identifier",
6433                         FT_UINT16, BASE_DEC, VALS(isup_application_transport_parameter_value),GFEDCBA_8BIT_MASK,
6434                         "", HFILL }},
6435
6436                 { &hf_isup_app_Release_call_ind, 
6437                         { "Release call indicator (RCI)",  "isup.app_Release_call_indicator",
6438                         FT_BOOLEAN, 8, TFS(&isup_Release_call_indicator_value), A_8BIT_MASK,
6439                         "", HFILL }},
6440
6441                 { &hf_isup_app_Send_notification_ind, 
6442                         { "Send notification indicator (SNI)",  "isup.app_Send_notification_ind",
6443                         FT_BOOLEAN, 8, TFS(&isup_Send_notification_ind_value), B_8BIT_MASK,
6444                         "", HFILL }},
6445
6446                 { &hf_isup_apm_segmentation_ind,
6447                         { "APM segmentation indicator",  "isup.apm_segmentation_ind",
6448                         FT_UINT8, BASE_DEC, VALS(isup_APM_segmentation_ind_value), FEDCBA_8BIT_MASK,
6449                         "", HFILL }},
6450
6451                 { &hf_isup_apm_si_ind, 
6452                         { "Sequence indicator (SI)",  "isup.APM_Sequence_ind",
6453                         FT_BOOLEAN, 8, TFS(&isup_Sequence_ind_value), G_8BIT_MASK,
6454                         "", HFILL }},
6455                 
6456                 { &hf_isup_orig_addr_len, 
6457                         { "Originating Address length",  "isup.orig_addr_len",
6458                         FT_UINT8, BASE_DEC, NULL, 0x0,
6459                         "Originating Address length", HFILL }},
6460
6461                 { &hf_isup_dest_addr_len, 
6462                         { "Destination Address length",  "isup.orig_addr_len",
6463                         FT_UINT8, BASE_DEC, NULL, 0x0,
6464                         "Destination Address length", HFILL }},
6465
6466                 { &hf_isup_apm_slr, 
6467                         { "Segmentation local reference (SLR)",  "isup.APM_slr",
6468                         FT_UINT8, BASE_DEC, NULL,GFEDCBA_8BIT_MASK,
6469                         "", HFILL }},
6470
6471                 { &hf_bat_ase_identifier,
6472                         { "BAT ASE Identifiers",  "bicc.bat_ase_identifier",
6473                         FT_UINT8, BASE_HEX, VALS(bat_ase_list_of_Identifiers_vals),0x0, 
6474                         "", HFILL }},
6475   
6476                 { &hf_length_indicator,
6477                         { "BAT ASE Element length indicator",  "bicc.bat_ase_length_indicator",
6478                         FT_UINT16, BASE_DEC, NULL,0x0,
6479                         "", HFILL }},
6480
6481                 { &hf_Action_Indicator,
6482                         { "BAT ASE action indicator field",  "bicc.bat_ase_bat_ase_action_indicator_field",
6483                         FT_UINT8, BASE_HEX, VALS(bat_ase_action_indicator_field_vals),0x00,     
6484                         "", HFILL }},
6485
6486                 { &hf_Instruction_ind_for_general_action,
6487                         { "BAT ASE Instruction indicator for general action",  "bicc.bat_ase_Instruction_ind_for_general_action",
6488                         FT_UINT8, BASE_HEX, VALS(Instruction_indicator_for_general_action_vals),0x03,   
6489                         "", HFILL }},
6490
6491                 { &hf_Send_notification_ind_for_general_action, 
6492                         { "Send notification indicator for general action",  "bicc.bat_ase_Send_notification_ind_for_general_action",
6493                         FT_BOOLEAN, 8, TFS(&isup_Send_notification_ind_value), 0x04,
6494                         "", HFILL }},
6495
6496                 { &hf_Instruction_ind_for_pass_on_not_possible, 
6497                         { "Instruction ind for pass-on not possible",  "bicc.bat_ase_Instruction_ind_for_pass_on_not_possible",
6498                         FT_UINT8, BASE_HEX, VALS(Instruction_indicator_for_pass_on_not_possible_vals),0x30,     
6499                         "", HFILL }},
6500
6501                 { &hf_Send_notification_ind_for_pass_on_not_possible, 
6502                         { "Send notification indication for pass-on not possible",  "bicc.bat_ase_Send_notification_ind_for_pass_on_not_possible",
6503                         FT_BOOLEAN, 8, TFS(&isup_Send_notification_ind_value), 0x40,
6504                         "", HFILL }},
6505
6506                 { &hf_BCTP_Version_Indicator,
6507                         { "BCTP Version Indicator",  "bicc.bat_ase_BCTP_Version_Indicator",
6508                         FT_UINT8, BASE_DEC, NULL,0x1f,
6509                         "", HFILL }},
6510         
6511                 { &hf_BVEI,
6512                         { "BVEI",  "bicc.bat_ase_BCTP_BVEI",
6513                         FT_BOOLEAN, 8, TFS(&BCTP_BVEI_value), 0x40,
6514                         "", HFILL }},
6515
6516                 { &hf_Tunnelled_Protocol_Indicator,
6517                         { "Tunnelled Protocol Indicator",  "bicc.bat_ase_BCTP_Tunnelled_Protocol_Indicator",
6518                         FT_UINT8, BASE_DEC, VALS(BCTP_Tunnelled_Protocol_Indicator_vals),0x3f,  
6519                         "", HFILL }},
6520
6521                 { &hf_TPEI,
6522                         { "TPEI",  "bicc.bat_ase_BCTP_tpei",
6523                         FT_BOOLEAN, 8, TFS(&BCTP_TPEI_value), 0x40,
6524                         "", HFILL }},
6525
6526                 { &hf_bncid,
6527                         { "Backbone Network Connection Identifier (BNCId)", "bat_ase.bncid",
6528                         FT_UINT32, BASE_HEX, NULL, 0x0,
6529                           "", HFILL }},
6530
6531                 { &hf_bat_ase_biwfa,
6532                         { "Interworking Function Address( X.213 NSAP encoded)", "bat_ase_biwfa",
6533                         FT_BYTES, BASE_HEX, NULL, 0x0,
6534                           "", HFILL }},
6535
6536                 { &hf_afi,
6537                         { "X.213 Address Format Information ( AFI )",  "x213.afi",
6538                         FT_UINT8, BASE_HEX, VALS(x213_afi_value),0x0,   
6539                         "", HFILL }},
6540                 
6541                 { &hf_bicc_nsap_dsp,
6542                         { "X.213 Address Format Information ( DSP )",  "x213.dsp",
6543                         FT_BYTES, BASE_HEX, NULL,0x0,   
6544                         "", HFILL }},
6545                 { &hf_characteristics,
6546                         { "Backbone network connection characteristics", "bat_ase.char",
6547                         FT_UINT8, BASE_HEX, VALS(bearer_network_connection_characteristics_vals),0x0,   
6548                           "", HFILL }},
6549
6550                 { &hf_Organization_Identifier,
6551                         { "Organization identifier subfield ",  "bat_ase.organization_identifier_subfield",
6552                         FT_UINT8, BASE_DEC, VALS(bat_ase_organization_identifier_subfield_vals),0x0,
6553                         "", HFILL }},
6554
6555                 { &hf_codec_type,
6556                         { "ITU-T codec type subfield",  "bat_ase.ITU_T_codec_type_subfield",
6557                         FT_UINT8, BASE_HEX, VALS(ITU_T_codec_type_subfield_vals),0x0,
6558                         "", HFILL }},
6559
6560                 { &hf_etsi_codec_type,
6561                         { "ETSI codec type subfield",  "bat_ase.ETSI_codec_type_subfield",
6562                         FT_UINT8, BASE_HEX, VALS(ETSI_codec_type_subfield_vals),0x0,
6563                         "", HFILL }},
6564
6565                 { &hf_active_code_set,
6566                         { "Active Code Set",  "bat_ase.acs",
6567                         FT_UINT8, BASE_HEX, NULL,0x0,
6568                         "", HFILL }},
6569
6570                 { &hf_active_code_set_12_2,
6571                         { "12.2 kbps rate",  "bat_ase.acs.12_2",
6572                         FT_UINT8, BASE_HEX, NULL,0x80,
6573                         "", HFILL }},
6574
6575                 { &hf_active_code_set_10_2,
6576                         { "10.2 kbps rate",  "bat_ase.acs.10_2",
6577                         FT_UINT8, BASE_HEX, NULL,0x40,
6578                         "", HFILL }},
6579                 
6580                 { &hf_active_code_set_7_95,
6581                         { "7.95 kbps rate",  "bat_ase.acs.7_95",
6582                         FT_UINT8, BASE_HEX, NULL,0x20,
6583                         "", HFILL }},
6584                 
6585                 { &hf_active_code_set_7_40,
6586                         { "7.40 kbps rate",  "bat_ase.acs.7_40",
6587                         FT_UINT8, BASE_HEX, NULL,0x10,
6588                         "", HFILL }},
6589         
6590                 { &hf_active_code_set_6_70,
6591                         { "6.70 kbps rate",  "bat_ase.acs.6_70",
6592                         FT_UINT8, BASE_HEX, NULL,0x08,
6593                         "", HFILL }},
6594                 
6595                 { &hf_active_code_set_5_90,
6596                         { "5.90 kbps rate",  "bat_ase.acs.5_90",
6597                         FT_UINT8, BASE_HEX, NULL,0x04,
6598                         "", HFILL }},
6599
6600                 { &hf_active_code_set_5_15,
6601                         { "5.15 kbps rate",  "bat_ase.acs.5_15",
6602                         FT_UINT8, BASE_HEX, NULL,0x02,
6603                         "", HFILL }},
6604                 
6605                 { &hf_active_code_set_4_75,
6606                         { "4.75 kbps rate",  "bat_ase.acs.4_75",
6607                         FT_UINT8, BASE_HEX, NULL,0x01,
6608                         "", HFILL }},
6609
6610                 { &hf_supported_code_set,
6611                         { "Supported Code Set",  "bat_ase.scs",
6612                         FT_UINT8, BASE_HEX, NULL,0x0,
6613                         "", HFILL }},
6614                 
6615                 { &hf_supported_code_set_12_2,
6616                         { "12.2 kbps rate",  "bat_ase.scs.12_2",
6617                         FT_UINT8, BASE_HEX, NULL,0x80,
6618                         "", HFILL }},
6619         
6620                 { &hf_supported_code_set_10_2,
6621                         { "10.2 kbps rate",  "bat_ase.scs.10_2",
6622                         FT_UINT8, BASE_HEX, NULL,0x40,
6623                         "", HFILL }},
6624                 
6625                 { &hf_supported_code_set_7_95,
6626                         { "7.95 kbps rate",  "bat_ase.scs.7_95",
6627                         FT_UINT8, BASE_HEX, NULL,0x20,
6628                         "", HFILL }},
6629                 
6630                 { &hf_supported_code_set_7_40,
6631                         { "7.40 kbps rate",  "bat_ase.scs.7_40",
6632                         FT_UINT8, BASE_HEX, NULL,0x10,
6633                         "", HFILL }},
6634                 
6635                 { &hf_supported_code_set_6_70,
6636                         { "6.70 kbps rate",  "bat_ase.scs.6_70",
6637                         FT_UINT8, BASE_HEX, NULL,0x08,
6638                         "", HFILL }},
6639                 
6640                 { &hf_supported_code_set_5_90,
6641                         { "5.90 kbps rate",  "bat_ase.scs.5_90",
6642                         FT_UINT8, BASE_HEX, NULL,0x04,
6643                         "", HFILL }},
6644                 
6645                 { &hf_supported_code_set_5_15,
6646                         { "5.15 kbps rate",  "bat_ase.scs.5_15",
6647                         FT_UINT8, BASE_HEX, NULL,0x02,
6648                         "", HFILL }},
6649                 
6650                 { &hf_supported_code_set_4_75,
6651                         { "4.75 kbps rate",  "bat_ase.scs.4_75",
6652                         FT_UINT8, BASE_HEX, NULL,0x01,
6653                         "", HFILL }},
6654                 
6655                 { &hf_initial_codec_mode,
6656                         { "Initial Codec Mode",  "bat_ase.icm",
6657                         FT_UINT8, BASE_HEX, VALS(bat_initial_codec_mode_vals),0x38,
6658                         "", HFILL }},
6659                 
6660                 { &hf_max_codec_modes,
6661                         { "Maximal number of Codec Modes",  "bat_ase.macs",
6662                         FT_UINT8, BASE_DEC, NULL,0x07,
6663                         "", HFILL }},
6664                 
6665                 
6666                 { &hf_bearer_control_tunneling,
6667                         { "Bearer control tunneling",  "bat_ase.bearer_control_tunneling",
6668                         FT_BOOLEAN, 8, TFS(&Bearer_Control_Tunnelling_ind_value),0x01,
6669                         "", HFILL }},
6670
6671                 { &hf_BAT_ASE_Comp_Report_Reason,
6672                         { "Compabillity report reason",  "bat_ase.Comp_Report_Reason",
6673                         FT_UINT8, BASE_HEX, VALS(BAT_ASE_Report_Reason_vals),0x0,
6674                         "", HFILL }},
6675
6676
6677                 { &hf_BAT_ASE_Comp_Report_ident,
6678                         { "Bearer control tunneling",  "bat_ase.bearer_control_tunneling",
6679                         FT_UINT8, BASE_HEX, VALS(bat_ase_list_of_Identifiers_vals),0x0,
6680                         "", HFILL }},
6681
6682                 { &hf_BAT_ASE_Comp_Report_diagnostic,
6683                         { "Diagnostics",  "bat_ase.Comp_Report_diagnostic",
6684                         FT_UINT16, BASE_HEX, NULL,0x0,
6685                         "", HFILL }},
6686
6687                 { &hf_Local_BCU_ID,
6688                         { "Local BCU ID",  "bat_ase.Local_BCU_ID",
6689                         FT_UINT32, BASE_HEX, NULL, 0x0,
6690                           "", HFILL }},
6691
6692                 { &hf_late_cut_trough_cap_ind,
6693                         { "Late Cut-through capability indicator",  "bat_ase.late_cut_trough_cap_ind",
6694                         FT_BOOLEAN, 8, TFS(&late_cut_trough_cap_ind_value),0x01,
6695                         "", HFILL }},
6696
6697                 { &hf_bat_ase_signal,
6698                         { "Q.765.5 - Signal Type",  "bat_ase.signal_type",
6699                         FT_UINT8, BASE_HEX, VALS(BAt_ASE_Signal_Type_vals),0x0,
6700                         "", HFILL }},
6701
6702                 { &hf_bat_ase_duration,
6703                         { "Duration in ms",  "bat_ase.signal_type",
6704                         FT_UINT16, BASE_DEC, NULL,0x0,
6705                         "", HFILL }},
6706
6707                 { &hf_bat_ase_bearer_redir_ind,
6708                         { "Redirection Indicator",  "bat_ase.bearer_redir_ind",
6709                         FT_UINT8, BASE_HEX, VALS(Bearer_Redirection_Indicator_vals),0x0,
6710                         "", HFILL }},
6711
6712                 { &hf_nsap_ipv4_addr,
6713                         { "IWFA IPv4 Address", "nsap.ipv4_addr", 
6714                         FT_IPv4, BASE_NONE, NULL, 0x0,
6715                         "IPv4 address", HFILL }},
6716
6717                 { &hf_nsap_ipv6_addr,
6718                         { "IWFA IPv6 Address", "nsap.ipv6_addr",
6719                         FT_IPv6, BASE_NONE, NULL, 0x0,
6720                         "IPv6 address", HFILL}},
6721
6722                 { &hf_iana_icp,
6723                         { "IANA ICP",  "nsap.iana_icp",
6724                         FT_UINT16, BASE_HEX, VALS(iana_icp_values),0x0,
6725                       "", HFILL }},
6726
6727               { &hf_isup_called,
6728                       { "ISUP Called Number",  "isup.called",
6729                       FT_STRING, BASE_NONE, NULL,0x0,
6730                       "", HFILL }},
6731
6732               { &hf_isup_calling,
6733                       { "ISUP Calling Number",  "isup.calling",
6734                       FT_STRING, BASE_NONE, NULL,0x0,
6735                       "", HFILL }},
6736
6737               { &hf_isup_redirecting,
6738                       { "ISUP Redirecting Number",  "isup.redirecting",
6739                       FT_STRING, BASE_NONE, NULL,0x0,
6740                         "", HFILL }},
6741                 {&hf_isup_apm_msg_fragments,
6742                         {"Message fragments", "isup_apm.msg.fragments",
6743                         FT_NONE, BASE_NONE, NULL, 0x00, NULL, HFILL } 
6744                 },
6745                 {&hf_isup_apm_msg_fragment,
6746                         {"Message fragment", "isup_apm.msg.fragment",
6747                         FT_FRAMENUM, BASE_NONE, NULL, 0x00, NULL, HFILL } 
6748                 },
6749                 {&hf_isup_apm_msg_fragment_overlap,
6750                         {"Message fragment overlap", "isup_apm.msg.fragment.overlap",
6751                         FT_BOOLEAN, BASE_NONE, NULL, 0x00, NULL, HFILL } 
6752                 },
6753                 {&hf_isup_apm_msg_fragment_overlap_conflicts,
6754                         {"Message fragment overlapping with conflicting data","isup_apm.msg.fragment.overlap.conflicts",
6755                         FT_BOOLEAN, BASE_NONE, NULL, 0x00, NULL, HFILL } 
6756                 },
6757                 {&hf_isup_apm_msg_fragment_multiple_tails,
6758                         {"Message has multiple tail fragments", "isup_apm.msg.fragment.multiple_tails", 
6759                         FT_BOOLEAN, BASE_NONE, NULL, 0x00, NULL, HFILL } 
6760                 },
6761                 {&hf_isup_apm_msg_fragment_too_long_fragment,
6762                         {"Message fragment too long", "isup_apm.msg.fragment.too_long_fragment",
6763                         FT_BOOLEAN, BASE_NONE, NULL, 0x00, NULL, HFILL } 
6764                 },
6765                 {&hf_isup_apm_msg_fragment_error,
6766                         {"Message defragmentation error", "isup_apm.msg.fragment.error",
6767                         FT_FRAMENUM, BASE_NONE, NULL, 0x00, NULL, HFILL } 
6768                 },
6769                 {&hf_isup_apm_msg_reassembled_in,
6770                         {"Reassembled in", "isup_apm.msg.reassembled.in",
6771                         FT_FRAMENUM, BASE_NONE, NULL, 0x00, NULL, HFILL } 
6772                 },
6773
6774         };
6775
6776 /* Setup protocol subtree array */
6777         static gint *ett[] = {
6778                 &ett_isup,
6779                 &ett_isup_parameter,
6780                 &ett_isup_address_digits,
6781                 &ett_isup_pass_along_message,
6782                 &ett_isup_circuit_state_ind,
6783                 &ett_bat_ase,
6784                 &ett_bat_ase_element,
6785                 &ett_bat_ase_iwfa,
6786                 &ett_scs,
6787                 &ett_acs,
6788                 &ett_isup_apm_msg_fragment,
6789                 &ett_isup_apm_msg_fragments,
6790         };
6791
6792 /* Register the protocol name and description */
6793         proto_isup = proto_register_protocol("ISDN User Part",
6794             "ISUP", "isup");
6795
6796         register_dissector("isup", dissect_isup, proto_isup);
6797
6798 /* Required function calls to register the header fields and subtrees used */
6799         proto_register_field_array(proto_isup, hf, array_length(hf));
6800         proto_register_subtree_array(ett, array_length(ett));
6801
6802         isup_tap = register_tap("isup");
6803
6804         isup_module = prefs_register_protocol(proto_isup, NULL);
6805
6806         prefs_register_bool_preference(isup_module, "show_cic_in_info", "Show CIC in Info column",
6807                                  "Show the CIC value (in addition to the message type) in the Info column",
6808                                  (gint *)&isup_show_cic_in_info);
6809
6810         prefs_register_bool_preference(isup_module, "defragment_apm",
6811                 "Reassemble APM messages",
6812                 "Whether APM messages datagrams should be reassembled",
6813                 &isup_apm_desegment);   
6814
6815         /* Register the stats_tree */
6816         stats_tree_register("isup","isup_msg","ISUP Messages", msg_stats_tree_packet, msg_stats_tree_init, NULL );
6817 }
6818
6819
6820 /* ------------------------------------------------------------------ */
6821 /* Register isup with the sub-laying MTP L3 dissector */
6822 void
6823 proto_reg_handoff_isup(void)
6824 {
6825   dissector_handle_t isup_handle;
6826   dissector_handle_t application_isup_handle;
6827  
6828   isup_handle = create_dissector_handle(dissect_isup, proto_isup);
6829   application_isup_handle = create_dissector_handle(dissect_application_isup, proto_isup);
6830   dissector_add("mtp3.service_indicator", MTP3_ISUP_SERVICE_INDICATOR, isup_handle);
6831   dissector_add_string("media_type","application/isup", application_isup_handle);
6832   dissector_add_string("tali.opcode", "isot", isup_handle);
6833
6834 }
6835
6836 void
6837 proto_register_bicc(void)
6838 {
6839 /* Setup list of header fields  See Section 1.6.1 for details*/
6840         static hf_register_info hf[] = {
6841                 { &hf_bicc_cic,
6842                         { "Call identification Code (CIC)",           "bicc.cic",
6843                         FT_UINT32, BASE_HEX, NULL, 0x0,
6844                           "", HFILL }},
6845         };
6846
6847 /* Setup protocol subtree array */
6848         static gint *ett[] = {
6849                 &ett_bicc
6850         };
6851         proto_bicc = proto_register_protocol("Bearer Independent Call Control ",
6852             "BICC", "bicc"); 
6853 /* Required function calls to register the header fields and subtrees used */
6854         proto_register_field_array(proto_bicc, hf, array_length(hf));
6855         proto_register_subtree_array(ett, array_length(ett));
6856
6857         register_init_routine(isup_apm_defragment_init);
6858 }
6859
6860 /* Register isup with the sub-laying MTP L3 dissector */
6861 void
6862 proto_reg_handoff_bicc(void)
6863 {
6864   dissector_handle_t bicc_handle;
6865   sdp_handle = find_dissector("sdp");
6866   q931_ie_handle = find_dissector("q931.ie");
6867
6868   bicc_handle = create_dissector_handle(dissect_bicc, proto_bicc);
6869   dissector_add("mtp3.service_indicator", MTP3_BICC_SERVICE_INDICATOR, bicc_handle);
6870   dissector_add("sctp.ppi", BICC_PAYLOAD_PROTOCOL_ID, bicc_handle);
6871 }