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