* Routines for Q.931 frame disassembly
* Guy Harris <guy@alum.mit.edu>
*
- * $Id: packet-q931.c,v 1.49 2002/11/09 08:09:18 guy Exp $
+ * $Id: packet-q931.c,v 1.58 2003/08/05 17:45:52 guy Exp $
*
* Modified by Andreas Sikkema for possible use with H.323
*
static int hf_q931_call_ref_flag = -1;
static int hf_q931_call_ref = -1;
static int hf_q931_message_type = -1;
+static int hf_q931_cause_value = -1;
+static int hf_q931_calling_party_number = -1;
+static int hf_q931_called_party_number = -1;
+static int hf_q931_connected_number = -1;
+static int hf_q931_redirecting_number = -1;
static gint ett_q931 = -1;
static gint ett_q931_ie = -1;
+static dissector_table_t codeset_dissector_table;
+static dissector_table_t ie_dissector_table;
+
/* desegmentation of Q.931 over TPKT over TCP */
static gboolean q931_desegment = TRUE;
* Information elements.
*/
+/* Shifted codeset values */
+#define CS0 0x000
+#define CS1 0x100
+#define CS2 0x200
+#define CS3 0x300
+#define CS4 0x400
+#define CS5 0x500
+#define CS6 0x600
+#define CS7 0x700
+
+#define Q931_IE_SO_MASK 0x80 /* single-octet/variable-length mask */
/*
* Single-octet IEs.
*/
#define Q931_IE_SO_IE_MASK 0x0F /* IE mask */
#define Q931_IE_SHIFT 0x90
-#define Q931_IE_SHIFT_LOCKING 0x08 /* locking shift */
+#define Q931_IE_SHIFT_NON_LOCKING 0x08 /* non-locking shift */
#define Q931_IE_SHIFT_CODESET 0x0F /* codeset */
#define Q931_IE_MORE_DATA_OR_SEND_COMP 0xA0 /* More Data or Sending Complete */
/* 0x76 is Redirection Number, but that's also Codeset 0 */
#define Q931_IE_CALL_APPEARANCE 0x7B
-static const value_string q931_info_element_vals[] = {
+/* Codeset 0 */
+static const value_string q931_info_element_vals0[] = {
{ Q931_IE_SEGMENTED_MESSAGE, "Segmented message" },
{ Q931_IE_BEARER_CAPABILITY, "Bearer capability" },
{ Q931_IE_CAUSE, "Cause" },
{ Q931_IE_ESCAPE, "Escape" },
{ Q931_IE_CONNECTED_NUMBER, "Connected number" },
{ Q931_IE_CONNECTED_SUBADDR, "Connected subaddress" },
+ { 0, NULL }
+};
+/* Codeset 1 */
+static const value_string q931_info_element_vals1[] = {
+ { 0, NULL }
+};
+/* Codeset 2 */
+static const value_string q931_info_element_vals2[] = {
+ { 0, NULL }
+};
+/* Codeset 3 */
+static const value_string q931_info_element_vals3[] = {
+ { 0, NULL }
+};
+/* Codeset 4 */
+static const value_string q931_info_element_vals4[] = {
+ { 0, NULL }
+};
+/* Codeset 5 */
+static const value_string q931_info_element_vals5[] = {
{ Q931_IE_CHARGING_ADVICE, "Charging advice" },
{ Q931_IE_OPERATOR_SYSTEM_ACCESS, "Operator system access" },
+ { 0, NULL }
+};
+/* Codeset 6 */
+static const value_string q931_info_element_vals6[] = {
{ Q931_IE_REDIRECTING_NUMBER, "Redirecting number" },
{ Q931_IE_REDIRECTING_SUBADDR, "Redirecting subaddress" },
{ Q931_IE_CALL_APPEARANCE, "Call appearance" },
{ 0, NULL }
};
+/* Codeset 7 */
+static const value_string q931_info_element_vals7[] = {
+ { 0, NULL }
+};
+
+/* Codeset array */
+static const value_string *q931_info_element_vals[] = {
+ q931_info_element_vals0,
+ q931_info_element_vals1,
+ q931_info_element_vals2,
+ q931_info_element_vals3,
+ q931_info_element_vals4,
+ q931_info_element_vals5,
+ q931_info_element_vals6,
+ q931_info_element_vals7,
+};
static const value_string q931_congestion_level_vals[] = {
{ 0x0, "Receiver ready" },
/*
* Cause codes for Cause.
*/
+#define Q931_CAUSE_UNALLOC_NUMBER 0x01
+#define Q931_CAUSE_NO_ROUTE_TO_DEST 0x03
+#define Q931_CAUSE_CALL_REJECTED 0x15
+#define Q931_CAUSE_NUMBER_CHANGED 0x16
+#define Q931_CAUSE_ACCESS_INFO_DISC 0x2B
+#define Q931_CAUSE_QOS_UNAVAILABLE 0x31
+#define Q931_CAUSE_CHAN_NONEXISTENT 0x52
+#define Q931_CAUSE_INCOMPATIBLE_DEST 0x58
+#define Q931_CAUSE_MAND_IE_MISSING 0x60
+#define Q931_CAUSE_MT_NONEX_OR_UNIMPL 0x61
+#define Q931_CAUSE_IE_NONEX_OR_UNIMPL 0x63
+#define Q931_CAUSE_INVALID_IE_CONTENTS 0x64
+#define Q931_CAUSE_MSG_INCOMPAT_W_CS 0x65
+#define Q931_CAUSE_REC_TIMER_EXP 0x66
+
const value_string q931_cause_code_vals[] = {
- { 0x00, "Valid cause code not yet received" },
- { 0x01, "Unallocated (unassigned) number" },
- { 0x02, "No route to specified transit network" },
- { 0x03, "No route to destination" },
- { 0x04, "Send special information tone" },
- { 0x05, "Misdialled trunk prefix" },
- { 0x06, "Channel unacceptable" },
- { 0x07, "Call awarded and being delivered in an established channel" },
- { 0x08, "Prefix 0 dialed but not allowed" },
- { 0x09, "Prefix 1 dialed but not allowed" },
- { 0x0A, "Prefix 1 dialed but not required" },
- { 0x0B, "More digits received than allowed, call is proceeding" },
- { 0x10, "Normal call clearing" },
- { 0x11, "User busy" },
- { 0x12, "No user responding" },
- { 0x13, "No answer from user (user alerted)" },
- { 0x14, "Subscriber absent" },
- { 0x15, "Call rejected" },
- { 0x16, "Number changed" },
- { 0x17, "Reverse charging rejected" },
- { 0x18, "Call suspended" },
- { 0x19, "Call resumed" },
- { 0x1A, "Non-selected user clearing" },
- { 0x1B, "Destination out of order" },
- { 0x1C, "Invalid number format (incomplete number)" },
- { 0x1D, "Facility rejected" },
- { 0x1E, "Response to STATUS ENQUIRY" },
- { 0x1F, "Normal unspecified" },
- { 0x21, "Circuit out of order" },
- { 0x22, "No circuit/channel available" },
- { 0x23, "Destination unattainable" },
- { 0x25, "Degraded service" },
- { 0x26, "Network out of order" },
- { 0x27, "Transit delay range cannot be achieved" },
- { 0x28, "Throughput range cannot be achieved" },
- { 0x29, "Temporary failure" },
- { 0x2A, "Switching equipment congestion" },
- { 0x2B, "Access information discarded" },
- { 0x2C, "Requested circuit/channel not available" },
- { 0x2D, "Pre-empted" },
- { 0x2E, "Precedence call blocked" },
- { 0x2F, "Resources unavailable, unspecified" },
- { 0x31, "Quality of service unavailable" },
- { 0x32, "Requested facility not subscribed" },
- { 0x33, "Reverse charging not allowed" },
- { 0x34, "Outgoing calls barred" },
- { 0x35, "Outgoing calls barred within CUG" },
- { 0x36, "Incoming calls barred" },
- { 0x37, "Incoming calls barred within CUG" },
- { 0x38, "Call waiting not subscribed" },
- { 0x39, "Bearer capability not authorized" },
- { 0x3A, "Bearer capability not presently available" },
- { 0x3E, "Inconsistency in designated outgoing access information and subscriber class" },
- { 0x3F, "Service or option not available, unspecified" },
- { 0x41, "Bearer capability not implemented" },
- { 0x42, "Channel type not implemented" },
- { 0x43, "Transit network selection not implemented" },
- { 0x44, "Message not implemented" },
- { 0x45, "Requested facility not implemented" },
- { 0x46, "Only restricted digital information bearer capability is available" },
- { 0x4F, "Service or option not implemented, unspecified" },
- { 0x51, "Invalid call reference value" },
- { 0x52, "Identified channel does not exist" },
- { 0x53, "Call identity does not exist for suspended call" },
- { 0x54, "Call identity in use" },
- { 0x55, "No call suspended" },
- { 0x56, "Call having the requested call identity has been cleared" },
- { 0x57, "Called user not member of CUG" },
- { 0x58, "Incompatible destination" },
- { 0x59, "Non-existent abbreviated address entry" },
- { 0x5A, "Destination address missing, and direct call not subscribed" },
- { 0x5B, "Invalid transit network selection (national use)" },
- { 0x5C, "Invalid facility parameter" },
- { 0x5D, "Mandatory information element is missing" },
- { 0x5F, "Invalid message, unspecified" },
- { 0x60, "Mandatory information element is missing" },
- { 0x61, "Message type non-existent or not implemented" },
- { 0x62, "Message not compatible with call state or message type non-existent or not implemented" },
- { 0x63, "Information element nonexistant or not implemented" },
- { 0x64, "Invalid information element contents" },
- { 0x65, "Message not compatible with call state" },
- { 0x66, "Recovery on timer expiry" },
- { 0x67, "Parameter non-existent or not implemented - passed on" },
- { 0x6E, "Message with unrecognized parameter discarded" },
- { 0x6F, "Protocol error, unspecified" },
- { 0x7F, "Internetworking, unspecified" },
- { 0, NULL }
+ { 0x00, "Valid cause code not yet received" },
+ { Q931_CAUSE_UNALLOC_NUMBER, "Unallocated (unassigned) number" },
+ { 0x02, "No route to specified transit network" },
+ { Q931_CAUSE_NO_ROUTE_TO_DEST, "No route to destination" },
+ { 0x04, "Send special information tone" },
+ { 0x05, "Misdialled trunk prefix" },
+ { 0x06, "Channel unacceptable" },
+ { 0x07, "Call awarded and being delivered in an established channel" },
+ { 0x08, "Prefix 0 dialed but not allowed" },
+ /* Q.850 - "Preemption" */
+ { 0x09, "Prefix 1 dialed but not allowed" },
+ /* Q.850 - "Preemption - circuit reserved for reuse" */
+ { 0x0A, "Prefix 1 dialed but not required" },
+ { 0x0B, "More digits received than allowed, call is proceeding" },
+ { 0x0E, "QoR: ported number" },
+ { 0x10, "Normal call clearing" },
+ { 0x11, "User busy" },
+ { 0x12, "No user responding" },
+ { 0x13, "No answer from user (user alerted)" },
+ { 0x14, "Subscriber absent" },
+ { Q931_CAUSE_CALL_REJECTED, "Call rejected" },
+ { Q931_CAUSE_NUMBER_CHANGED, "Number changed" },
+ { 0x17, "Reverse charging rejected" },
+ /* Q.850 - "Redirection to new destination" */
+ { 0x18, "Call suspended" },
+ /* Q.850 Amendment 1 - "Call rejected due to feature at the destination" */
+ { 0x19, "Call resumed" },
+ /* Q.850 - "Exchange routing error */
+ { 0x1A, "Non-selected user clearing" },
+ { 0x1B, "Destination out of order" },
+ { 0x1C, "Invalid number format (incomplete number)" },
+ { 0x1D, "Facility rejected" },
+ { 0x1E, "Response to STATUS ENQUIRY" },
+ { 0x1F, "Normal unspecified" },
+ { 0x21, "Circuit out of order" },
+ { 0x22, "No circuit/channel available" },
+ { 0x23, "Destination unattainable" },
+ { 0x25, "Degraded service" },
+ { 0x26, "Network out of order" },
+ { 0x27, "Transit delay range cannot be achieved" },
+ /* Q.850 - "Permanent frame mode connection out of service" */
+ { 0x28, "Throughput range cannot be achieved" },
+ /* Q.850 - "Permanent frame mode connection operational" */
+ { 0x29, "Temporary failure" },
+ { 0x2A, "Switching equipment congestion" },
+ { Q931_CAUSE_ACCESS_INFO_DISC, "Access information discarded" },
+ { 0x2C, "Requested circuit/channel not available" },
+ { 0x2D, "Pre-empted" },
+ { 0x2E, "Precedence call blocked" },
+ { 0x2F, "Resources unavailable, unspecified" },
+ { Q931_CAUSE_QOS_UNAVAILABLE, "Quality of service unavailable" },
+ { 0x32, "Requested facility not subscribed" },
+ { 0x33, "Reverse charging not allowed" },
+ { 0x34, "Outgoing calls barred" },
+ { 0x35, "Outgoing calls barred within CUG" },
+ { 0x36, "Incoming calls barred" },
+ { 0x37, "Incoming calls barred within CUG" },
+ { 0x38, "Call waiting not subscribed" },
+ { 0x39, "Bearer capability not authorized" },
+ { 0x3A, "Bearer capability not presently available" },
+ { 0x3E, "Inconsistency in designated outgoing access information and subscriber class" },
+ { 0x3F, "Service or option not available, unspecified" },
+ { 0x41, "Bearer capability not implemented" },
+ { 0x42, "Channel type not implemented" },
+ { 0x43, "Transit network selection not implemented" },
+ { 0x44, "Message not implemented" },
+ { 0x45, "Requested facility not implemented" },
+ { 0x46, "Only restricted digital information bearer capability is available" },
+ { 0x4F, "Service or option not implemented, unspecified" },
+ { 0x51, "Invalid call reference value" },
+ { Q931_CAUSE_CHAN_NONEXISTENT, "Identified channel does not exist" },
+ { 0x53, "Call identity does not exist for suspended call" },
+ { 0x54, "Call identity in use" },
+ { 0x55, "No call suspended" },
+ { 0x56, "Call having the requested call identity has been cleared" },
+ { 0x57, "Called user not member of CUG" },
+ { Q931_CAUSE_INCOMPATIBLE_DEST, "Incompatible destination" },
+ { 0x59, "Non-existent abbreviated address entry" },
+ { 0x5A, "Destination address missing, and direct call not subscribed" },
+ /* Q.850 - "Non-existent CUG" */
+ { 0x5B, "Invalid transit network selection (national use)" },
+ { 0x5C, "Invalid facility parameter" },
+ { 0x5D, "Mandatory information element is missing" },
+ { 0x5F, "Invalid message, unspecified" },
+ { Q931_CAUSE_MAND_IE_MISSING, "Mandatory information element is missing" },
+ { Q931_CAUSE_MT_NONEX_OR_UNIMPL,"Message type non-existent or not implemented" },
+ { 0x62, "Message not compatible with call state or message type non-existent or not implemented" },
+ { Q931_CAUSE_IE_NONEX_OR_UNIMPL,"Information element nonexistant or not implemented" },
+ { Q931_CAUSE_INVALID_IE_CONTENTS,"Invalid information element contents" },
+ { Q931_CAUSE_MSG_INCOMPAT_W_CS, "Message not compatible with call state" },
+ { Q931_CAUSE_REC_TIMER_EXP, "Recovery on timer expiry" },
+ { 0x67, "Parameter non-existent or not implemented - passed on" },
+ { 0x6E, "Message with unrecognized parameter discarded" },
+ { 0x6F, "Protocol error, unspecified" },
+ { 0x7F, "Internetworking, unspecified" },
+ { 0, NULL }
};
-static void
+static const value_string q931_cause_condition_vals[] = {
+ { 0x00, "Unknown" },
+ { 0x01, "Permanent" },
+ { 0x02, "Transient" },
+ { 0x00, NULL }
+};
+
+#define Q931_REJ_USER_SPECIFIC 0x00
+#define Q931_REJ_IE_MISSING 0x04
+#define Q931_REJ_IE_INSUFFICIENT 0x08
+
+static const value_string q931_rejection_reason_vals[] = {
+ { 0x00, "User specific" },
+ { 0x04, "Information element missing" },
+ { 0x08, "Information element contents are not sufficient" },
+ { 0x00, NULL }
+};
+
+void
dissect_q931_cause_ie(tvbuff_t *tvb, int offset, int len,
- proto_tree *tree)
+ proto_tree *tree, int hf_cause_value)
{
guint8 octet;
+ guint8 cause_value;
guint8 coding_standard;
+ guint8 rejection_reason;
if (len == 0)
return;
if (len == 0)
return;
octet = tvb_get_guint8(tvb, offset);
- proto_tree_add_text(tree, tvb, offset, 1,
- "Cause value: %s",
- val_to_str(octet & 0x7F, q931_cause_code_vals,
- "Unknown (0x%02X)"));
+ cause_value = octet & 0x7F;
+ proto_tree_add_uint(tree, hf_cause_value, tvb, 0, 1, cause_value);
offset += 1;
len -= 1;
if (len == 0)
return;
- proto_tree_add_text(tree, tvb, offset, len,
- "Diagnostics: %s",
- tvb_bytes_to_str(tvb, offset, len));
+ switch (cause_value) {
+
+ case Q931_CAUSE_UNALLOC_NUMBER:
+ case Q931_CAUSE_NO_ROUTE_TO_DEST:
+ case Q931_CAUSE_QOS_UNAVAILABLE:
+ octet = tvb_get_guint8(tvb, offset);
+ proto_tree_add_text(tree, tvb, offset, 1,
+ "Network service: %s",
+ (octet & 0x80) ? "User" : "Provider");
+ proto_tree_add_text(tree, tvb, offset, 1,
+ "%s",
+ (octet & 0x40) ? "Abnormal" : "Normal");
+ proto_tree_add_text(tree, tvb, offset, 1,
+ "Condition: %s",
+ val_to_str(octet & 0x03, q931_cause_condition_vals,
+ "Unknown (0x%X)"));
+ break;
+
+ case Q931_CAUSE_CALL_REJECTED:
+ rejection_reason = octet & 0x7C;
+ proto_tree_add_text(tree, tvb, offset, 1,
+ "Rejection reason: %s",
+ val_to_str(octet & 0x7C, q931_rejection_reason_vals,
+ "Unknown (0x%X)"));
+ proto_tree_add_text(tree, tvb, offset, 1,
+ "Condition: %s",
+ val_to_str(octet & 0x03, q931_cause_condition_vals,
+ "Unknown (0x%X)"));
+ offset += 1;
+ len -= 1;
+
+ if (len == 0)
+ return;
+ switch (rejection_reason) {
+
+ case Q931_REJ_USER_SPECIFIC:
+ proto_tree_add_text(tree, tvb, offset, len,
+ "User specific diagnostic: %s",
+ tvb_bytes_to_str(tvb, offset, len));
+ break;
+
+ case Q931_REJ_IE_MISSING:
+ proto_tree_add_text(tree, tvb, offset, 1,
+ "Missing information element: %s",
+ val_to_str(tvb_get_guint8(tvb, offset), q931_info_element_vals0,
+ "Unknown (0x%02X)"));
+ break;
+
+ case Q931_REJ_IE_INSUFFICIENT:
+ proto_tree_add_text(tree, tvb, offset, 1,
+ "Insufficient information element: %s",
+ val_to_str(tvb_get_guint8(tvb, offset), q931_info_element_vals0,
+ "Unknown (0x%02X)"));
+ break;
+
+ default:
+ proto_tree_add_text(tree, tvb, offset, len,
+ "Diagnostic: %s",
+ tvb_bytes_to_str(tvb, offset, len));
+ break;
+ }
+ break;
+
+ case Q931_CAUSE_ACCESS_INFO_DISC:
+ case Q931_CAUSE_INCOMPATIBLE_DEST:
+ case Q931_CAUSE_MAND_IE_MISSING:
+ case Q931_CAUSE_IE_NONEX_OR_UNIMPL:
+ case Q931_CAUSE_INVALID_IE_CONTENTS:
+ do {
+ proto_tree_add_text(tree, tvb, offset, 1,
+ "Information element: %s",
+ val_to_str(tvb_get_guint8(tvb, offset), q931_info_element_vals0,
+ "Unknown (0x%02X)"));
+ offset += 1;
+ len -= 1;
+ } while (len != 0);
+ break;
+
+ case Q931_CAUSE_MT_NONEX_OR_UNIMPL:
+ case Q931_CAUSE_MSG_INCOMPAT_W_CS:
+ proto_tree_add_text(tree, tvb, offset, 1,
+ "Message type: %s",
+ val_to_str(tvb_get_guint8(tvb, offset), q931_message_type_vals,
+ "Unknown (0x%02X)"));
+ break;
+
+ case Q931_CAUSE_REC_TIMER_EXP:
+ if (len < 3)
+ return;
+ proto_tree_add_text(tree, tvb, offset, 3,
+ "Timer: %.3s", tvb_get_ptr(tvb, offset, 3));
+ break;
+
+ default:
+ proto_tree_add_text(tree, tvb, offset, len,
+ "Diagnostics: %s",
+ tvb_bytes_to_str(tvb, offset, len));
+ }
}
/*
static void
dissect_q931_number_ie(tvbuff_t *tvb, int offset, int len,
- proto_tree *tree)
+ proto_tree *tree, int hfindex)
{
guint8 octet;
if (len == 0)
return;
- proto_tree_add_text(tree, tvb, offset, len, "Number: %s",
- tvb_format_text(tvb, offset, len));
+ proto_tree_add_item(tree, hfindex, tvb, offset, len, FALSE);
}
/*
{ 0, NULL }
};
-static void
+void
dissect_q931_user_user_ie(tvbuff_t *tvb, int offset, int len,
proto_tree *tree)
{
guint8 message_type;
guint8 info_element;
guint16 info_element_len;
- int codeset;
+ int codeset, locked_codeset;
gboolean non_locking_shift;
- tvbuff_t *h225_tvb;
+ tvbuff_t *h225_tvb, *next_tvb;
if (check_col(pinfo->cinfo, COL_PROTOCOL))
col_set_str(pinfo->cinfo, COL_PROTOCOL, "Q.931");
/*
* And now for the information elements....
*/
- codeset = 0; /* start out in codeset 0 */
+ codeset = locked_codeset = 0; /* start out in codeset 0 */
non_locking_shift = TRUE;
while (tvb_reported_length_remaining(tvb, offset) > 0) {
info_element = tvb_get_guint8(tvb, offset);
- /*
- * Check for the single-octet IEs.
- */
- switch (info_element & Q931_IE_SO_IDENTIFIER_MASK) {
-
- case Q931_IE_SHIFT:
- non_locking_shift =
- !(info_element & Q931_IE_SHIFT_LOCKING);
+ /* Check for the codeset shift */
+ if ((info_element & Q931_IE_SO_MASK) &&
+ ((info_element & Q931_IE_SO_IDENTIFIER_MASK) == Q931_IE_SHIFT)) {
+ non_locking_shift = info_element & Q931_IE_SHIFT_NON_LOCKING;
codeset = info_element & Q931_IE_SHIFT_CODESET;
+ if (!non_locking_shift)
+ locked_codeset = codeset;
if (q931_tree != NULL) {
proto_tree_add_text(q931_tree, tvb, offset, 1,
"%s shift to codeset %u: %s",
}
offset += 1;
continue;
+ }
- case Q931_IE_MORE_DATA_OR_SEND_COMP:
- switch (info_element) {
+ /*
+ * Check for the single-octet IEs.
+ */
+ if (info_element & Q931_IE_SO_MASK) {
+ /*
+ * Check for subdissectors for this IE or
+ * for all IEs in this codeset.
+ */
+ if (dissector_get_port_handle(codeset_dissector_table, codeset) ||
+ dissector_get_port_handle(ie_dissector_table, (codeset << 8) | (info_element & Q931_IE_SO_IDENTIFIER_MASK))) {
+ next_tvb = tvb_new_subset (tvb, offset, 1, 1);
+ if (dissector_try_port(ie_dissector_table, (codeset << 8) | (info_element & Q931_IE_SO_IDENTIFIER_MASK), next_tvb, pinfo, q931_tree) ||
+ dissector_try_port(codeset_dissector_table, codeset, next_tvb, pinfo, q931_tree)) {
+ offset += 1;
+ codeset = locked_codeset;
+ continue;
+ }
+ }
- case Q931_IE_MORE_DATA:
+ switch ((codeset << 8) | (info_element & Q931_IE_SO_IDENTIFIER_MASK)) {
+
+ case CS0 | Q931_IE_MORE_DATA_OR_SEND_COMP:
+ switch (info_element) {
+
+ case Q931_IE_MORE_DATA:
+ if (q931_tree != NULL) {
+ proto_tree_add_text(q931_tree, tvb, offset, 1,
+ "More data");
+ }
+ break;
+
+ case Q931_IE_SENDING_COMPLETE:
+ if (q931_tree != NULL) {
+ proto_tree_add_text(q931_tree, tvb, offset, 1,
+ "Sending complete");
+ }
+ break;
+
+ default:
+ if (q931_tree != NULL) {
+ proto_tree_add_text(q931_tree, tvb, offset, 1,
+ "Unknown information element (0x%02X)",
+ info_element);
+ }
+ break;
+ }
+ break;
+
+ case CS0 | Q931_IE_CONGESTION_LEVEL:
if (q931_tree != NULL) {
proto_tree_add_text(q931_tree, tvb, offset, 1,
- "More data");
+ "Congestion level: %s",
+ val_to_str(info_element & Q931_IE_SO_IE_MASK,
+ q931_congestion_level_vals,
+ "Unknown (0x%X)"));
}
break;
- case Q931_IE_SENDING_COMPLETE:
+ case CS0 | Q931_IE_REPEAT_INDICATOR:
if (q931_tree != NULL) {
proto_tree_add_text(q931_tree, tvb, offset, 1,
- "Sending complete");
+ "Repeat indicator: %s",
+ val_to_str(info_element & Q931_IE_SO_IE_MASK,
+ q931_repeat_indication_vals,
+ "Unknown (0x%X)"));
}
break;
default:
if (q931_tree != NULL) {
proto_tree_add_text(q931_tree, tvb, offset, 1,
- "Unknown information element (0x%02X",
+ "Unknown information element (0x%02X)",
info_element);
}
break;
}
offset += 1;
- if (non_locking_shift)
- codeset = 0;
+ codeset = locked_codeset;
continue;
-
- case Q931_IE_CONGESTION_LEVEL:
- if (q931_tree != NULL) {
- proto_tree_add_text(q931_tree, tvb, offset, 1,
- "Congestion level: %s",
- val_to_str(info_element & Q931_IE_SO_IE_MASK,
- q931_congestion_level_vals,
- "Unknown (0x%X)"));
- }
- offset += 1;
- if (non_locking_shift)
- codeset = 0;
- continue;
-
- case Q931_IE_REPEAT_INDICATOR:
- if (q931_tree != NULL) {
- proto_tree_add_text(q931_tree, tvb, offset, 1,
- "Repeat indicator: %s",
- val_to_str(info_element & Q931_IE_SO_IE_MASK,
- q931_repeat_indication_vals,
- "Unknown (0x%X)"));
- }
- offset += 1;
- if (non_locking_shift)
- codeset = 0;
- continue;
-
- default:
- break;
}
/*
* IE with ASN.1 encoding of the user information.
*/
if (is_tpkt && tvb_bytes_exist(tvb, offset, 4) &&
- tvb_get_guint8(tvb, offset) == Q931_IE_USER_USER &&
+ codeset == 0 && tvb_get_guint8(tvb, offset) == Q931_IE_USER_USER &&
tvb_get_guint8(tvb, offset + 3) == Q931_PROTOCOL_DISCRIMINATOR_ASN1) {
info_element_len = tvb_get_ntohs(tvb, offset + 1);
if (q931_tree != NULL) {
ti = proto_tree_add_text(q931_tree, tvb, offset,
1+2+info_element_len, "%s",
val_to_str(info_element,
- q931_info_element_vals,
+ q931_info_element_vals[codeset],
"Unknown information element (0x%02X)"));
ie_tree = proto_item_add_subtree(ti,
ett_q931_ie);
proto_tree_add_text(ie_tree, tvb, offset, 1,
"Information element: %s",
val_to_str(info_element,
- q931_info_element_vals, "Unknown (0x%02X)"));
+ q931_info_element_vals[codeset], "Unknown (0x%02X)"));
proto_tree_add_text(ie_tree, tvb, offset + 1,
2, "Length: %u", info_element_len);
proto_tree_add_text(ie_tree, tvb, offset + 3,
offset += 1 + 2 + info_element_len;
} else {
info_element_len = tvb_get_guint8(tvb, offset + 1);
+
+ /*
+ * Check for subdissectors for this IE or
+ * for all IEs in this codeset.
+ */
+ if (dissector_get_port_handle(codeset_dissector_table, codeset) ||
+ dissector_get_port_handle(ie_dissector_table, (codeset << 8) | info_element)) {
+ next_tvb = tvb_new_subset (tvb, offset, info_element_len + 2, info_element_len + 2);
+ if (dissector_try_port(ie_dissector_table, (codeset << 8) | info_element, next_tvb, pinfo, q931_tree) ||
+ dissector_try_port(codeset_dissector_table, codeset, next_tvb, pinfo, q931_tree)) {
+ offset += 2 + info_element_len;;
+ codeset = locked_codeset;
+ continue;
+ }
+ }
+
if (q931_tree != NULL) {
ti = proto_tree_add_text(q931_tree, tvb, offset,
1+1+info_element_len, "%s",
- val_to_str(info_element, q931_info_element_vals,
+ val_to_str(info_element, q931_info_element_vals[codeset],
"Unknown information element (0x%02X)"));
ie_tree = proto_item_add_subtree(ti, ett_q931_ie);
proto_tree_add_text(ie_tree, tvb, offset, 1,
"Information element: %s",
- val_to_str(info_element, q931_info_element_vals,
+ val_to_str(info_element, q931_info_element_vals[codeset],
"Unknown (0x%02X)"));
proto_tree_add_text(ie_tree, tvb, offset + 1, 1,
"Length: %u", info_element_len);
- switch (info_element) {
+ switch ((codeset << 8) | info_element) {
- case Q931_IE_SEGMENTED_MESSAGE:
+ case CS0 | Q931_IE_SEGMENTED_MESSAGE:
dissect_q931_segmented_message_ie(tvb,
offset + 2, info_element_len,
ie_tree);
break;
- case Q931_IE_BEARER_CAPABILITY:
- case Q931_IE_LOW_LAYER_COMPAT:
+ case CS0 | Q931_IE_BEARER_CAPABILITY:
+ case CS0 | Q931_IE_LOW_LAYER_COMPAT:
dissect_q931_bearer_capability_ie(tvb,
offset + 2, info_element_len,
ie_tree);
break;
- case Q931_IE_CAUSE:
+ case CS0 | Q931_IE_CAUSE:
dissect_q931_cause_ie(tvb,
offset + 2, info_element_len,
- ie_tree);
+ ie_tree,
+ hf_q931_cause_value);
break;
- case Q931_IE_CALL_STATE:
+ case CS0 | Q931_IE_CALL_STATE:
dissect_q931_call_state_ie(tvb,
offset + 2, info_element_len,
ie_tree);
break;
- case Q931_IE_CHANNEL_IDENTIFICATION:
+ case CS0 | Q931_IE_CHANNEL_IDENTIFICATION:
dissect_q931_channel_identification_ie(
tvb, offset + 2, info_element_len,
ie_tree);
break;
- case Q931_IE_PROGRESS_INDICATOR:
+ case CS0 | Q931_IE_PROGRESS_INDICATOR:
dissect_q931_progress_indicator_ie(tvb,
offset + 2, info_element_len,
ie_tree);
break;
- case Q931_IE_NETWORK_SPECIFIC_FACIL:
- case Q931_IE_TRANSIT_NETWORK_SEL:
+ case CS0 | Q931_IE_NETWORK_SPECIFIC_FACIL:
+ case CS0 | Q931_IE_TRANSIT_NETWORK_SEL:
dissect_q931_ns_facilities_ie(tvb,
offset + 2, info_element_len,
ie_tree);
break;
- case Q931_IE_NOTIFICATION_INDICATOR:
+ case CS0 | Q931_IE_NOTIFICATION_INDICATOR:
dissect_q931_notification_indicator_ie(
tvb, offset + 2, info_element_len,
ie_tree);
break;
- case Q931_IE_DISPLAY:
+ case CS0 | Q931_IE_DISPLAY:
dissect_q931_ia5_ie(tvb, offset + 2,
info_element_len, ie_tree,
"Display information");
break;
- case Q931_IE_DATE_TIME:
+ case CS0 | Q931_IE_DATE_TIME:
dissect_q931_date_time_ie(tvb,
offset + 2, info_element_len,
ie_tree);
break;
- case Q931_IE_KEYPAD_FACILITY:
+ case CS0 | Q931_IE_KEYPAD_FACILITY:
dissect_q931_ia5_ie(tvb, offset + 2,
info_element_len, ie_tree,
"Keypad facility");
break;
- case Q931_IE_SIGNAL:
+ case CS0 | Q931_IE_SIGNAL:
dissect_q931_signal_ie(tvb,
offset + 2, info_element_len,
ie_tree);
break;
- case Q931_IE_INFORMATION_RATE:
+ case CS0 | Q931_IE_INFORMATION_RATE:
dissect_q931_information_rate_ie(tvb,
offset + 2, info_element_len,
ie_tree);
break;
- case Q931_IE_E2E_TRANSIT_DELAY:
+ case CS0 | Q931_IE_E2E_TRANSIT_DELAY:
dissect_q931_e2e_transit_delay_ie(tvb,
offset + 2, info_element_len,
ie_tree);
break;
- case Q931_IE_TD_SELECTION_AND_INT:
+ case CS0 | Q931_IE_TD_SELECTION_AND_INT:
dissect_q931_td_selection_and_int_ie(
tvb, offset + 2, info_element_len,
ie_tree);
break;
- case Q931_IE_PL_BINARY_PARAMETERS:
+ case CS0 | Q931_IE_PL_BINARY_PARAMETERS:
dissect_q931_pl_binary_parameters_ie(
tvb, offset + 2, info_element_len,
ie_tree);
break;
- case Q931_IE_PL_WINDOW_SIZE:
+ case CS0 | Q931_IE_PL_WINDOW_SIZE:
dissect_q931_pl_window_size_ie(tvb,
offset + 2, info_element_len,
ie_tree);
break;
- case Q931_IE_PACKET_SIZE:
+ case CS0 | Q931_IE_PACKET_SIZE:
dissect_q931_packet_size_ie(tvb,
offset + 2, info_element_len,
ie_tree);
break;
- case Q931_IE_CUG:
+ case CS0 | Q931_IE_CUG:
dissect_q931_cug_ie(tvb,
offset + 2, info_element_len,
ie_tree);
break;
- case Q931_IE_REVERSE_CHARGE_IND:
+ case CS0 | Q931_IE_REVERSE_CHARGE_IND:
dissect_q931_reverse_charge_ind_ie(tvb,
offset + 2, info_element_len,
ie_tree);
break;
- case Q931_IE_CALLING_PARTY_NUMBER:
- case Q931_IE_CONNECTED_NUMBER_DEFAULT:
- case Q931_IE_CALLED_PARTY_NUMBER:
- case Q931_IE_REDIRECTING_NUMBER:
+ case CS0 | Q931_IE_CALLING_PARTY_NUMBER:
dissect_q931_number_ie(tvb,
offset + 2, info_element_len,
- ie_tree);
+ ie_tree,
+ hf_q931_calling_party_number);
+ break;
+
+ case CS0 | Q931_IE_CONNECTED_NUMBER_DEFAULT:
+ dissect_q931_number_ie(tvb,
+ offset + 2, info_element_len,
+ ie_tree,
+ hf_q931_connected_number);
break;
- case Q931_IE_CALLING_PARTY_SUBADDR:
- case Q931_IE_CALLED_PARTY_SUBADDR:
+ case CS0 | Q931_IE_CALLED_PARTY_NUMBER:
+ dissect_q931_number_ie(tvb,
+ offset + 2, info_element_len,
+ ie_tree,
+ hf_q931_called_party_number);
+ break;
+
+ case CS0 | Q931_IE_REDIRECTING_NUMBER:
+ dissect_q931_number_ie(tvb,
+ offset + 2, info_element_len,
+ ie_tree,
+ hf_q931_redirecting_number);
+ break;
+
+ case CS0 | Q931_IE_CALLING_PARTY_SUBADDR:
+ case CS0 | Q931_IE_CALLED_PARTY_SUBADDR:
dissect_q931_party_subaddr_ie(tvb,
offset + 2, info_element_len,
ie_tree);
break;
- case Q931_IE_RESTART_INDICATOR:
+ case CS0 | Q931_IE_RESTART_INDICATOR:
dissect_q931_restart_indicator_ie(tvb,
offset + 2, info_element_len,
ie_tree);
break;
- case Q931_IE_HIGH_LAYER_COMPAT:
+ case CS0 | Q931_IE_HIGH_LAYER_COMPAT:
dissect_q931_high_layer_compat_ie(tvb,
offset + 2, info_element_len,
ie_tree);
break;
- case Q931_IE_USER_USER:
+ case CS0 | Q931_IE_USER_USER:
dissect_q931_user_user_ie(tvb,
offset + 2, info_element_len,
ie_tree);
}
offset += 1 + 1 + info_element_len;
}
- if (non_locking_shift)
- codeset = 0;
+ codeset = locked_codeset;
}
}
static hf_register_info hf[] = {
{ &hf_q931_discriminator,
{ "Protocol discriminator", "q931.disc", FT_UINT8, BASE_HEX, NULL, 0x0,
- "", HFILL }},
+ "", HFILL }},
{ &hf_q931_call_ref_len,
{ "Call reference value length", "q931.call_ref_len", FT_UINT8, BASE_DEC, NULL, 0x0,
- "", HFILL }},
+ "", HFILL }},
{ &hf_q931_call_ref_flag,
{ "Call reference flag", "q931.call_ref_flag", FT_BOOLEAN, BASE_NONE, TFS(&tfs_call_ref_flag), 0x0,
- "", HFILL }},
+ "", HFILL }},
{ &hf_q931_call_ref,
{ "Call reference value", "q931.call_ref", FT_BYTES, BASE_HEX, NULL, 0x0,
- "", HFILL }},
+ "", HFILL }},
{ &hf_q931_message_type,
{ "Message type", "q931.message_type", FT_UINT8, BASE_HEX, VALS(q931_message_type_vals), 0x0,
- "", HFILL }},
+ "", HFILL }},
+
+ { &hf_q931_cause_value,
+ { "Cause value", "q931.cause_value", FT_UINT8, BASE_DEC, VALS(q931_cause_code_vals), 0x0,
+ "", HFILL }},
+
+ { &hf_q931_calling_party_number,
+ { "Calling party number digits", "q931.calling_party_number.digits", FT_STRING, BASE_NONE, NULL, 0x0,
+ "", HFILL }},
+
+ { &hf_q931_called_party_number,
+ { "Called party number digits", "q931.called_party_number.digits", FT_STRING, BASE_NONE, NULL, 0x0,
+ "", HFILL }},
+
+ { &hf_q931_connected_number,
+ { "Connected party number digits", "q931.connected_number.digits", FT_STRING, BASE_NONE, NULL, 0x0,
+ "", HFILL }},
+
+ { &hf_q931_redirecting_number,
+ { "Redirecting party number digits", "q931.redirecting_number.digits", FT_STRING, BASE_NONE, NULL, 0x0,
+ "", HFILL }},
};
static gint *ett[] = {
&ett_q931,
q931_tpkt_pdu_handle = create_dissector_handle(dissect_q931_tpkt_pdu,
proto_q931);
+ /* subdissector code */
+ codeset_dissector_table = register_dissector_table("q931.codeset", "Q.931 Codeset", FT_UINT8, BASE_HEX);
+ ie_dissector_table = register_dissector_table("q931.ie", "Q.931 IE", FT_UINT16, BASE_HEX);
+
q931_module = prefs_register_protocol(proto_q931, NULL);
prefs_register_bool_preference(q931_module, "desegment_h323_messages",
"Desegment all Q.931 messages spanning multiple TCP segments",