*
* $Id$
*
- * Ethereal - Network traffic analyzer
- * By Gerald Combs <gerald@ethereal.com>
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
* Copyright 1998
*
* This program is free software; you can redistribute it and/or
# include "config.h"
#endif
-#include <stdio.h>
#include <glib.h>
-#include <string.h>
#include <epan/packet.h>
-#include "oui.h"
-#include "nlpid.h"
-#include "etypes.h"
+#include <epan/oui.h>
+#include <epan/nlpid.h>
+#include <epan/etypes.h>
#include "packet-q931.h"
#include "packet-arp.h"
return;
}
- while (len != 0) {
+ while (len >= 0) {
identifier = tvb_get_guint8(tvb, offset);
switch (identifier) {
guint8 identifier;
guint32 value;
- while (len != 0) {
+ while (len >= 0) {
identifier = tvb_get_guint8(tvb, offset);
switch (identifier) {
{ Q2931_CAUSE_MAND_IE_MISSING, "Mandatory information element is missing" },
{ Q2931_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" },
- { Q2931_CAUSE_IE_NONEX_OR_UNIMPL,"Information element nonexistant or not implemented" },
+ { Q2931_CAUSE_IE_NONEX_OR_UNIMPL,"Information element non-existent or not implemented" },
{ Q2931_CAUSE_INVALID_IE_CONTENTS,"Invalid information element contents" },
{ Q2931_CAUSE_MSG_INCOMPAT_W_CS,"Message not compatible with call state" },
{ Q2931_CAUSE_REC_TIMER_EXP, "Recovery on timer expiry" },
"Unknown (0x%02X)"));
offset += 1;
len -= 1;
- } while (len != 0);
+ } while (len >= 0);
break;
case Q2931_CAUSE_CELL_RATE_UNAVAIL:
"Unknown (0x%02X)"));
offset += 1;
len -= 1;
- } while (len != 0);
+ } while (len >= 0);
break;
case Q2931_CAUSE_CHAN_NONEXISTENT:
if (len < 3)
return;
proto_tree_add_text(tree, tvb, offset, 3,
- "Timer: %.3s", tvb_get_ptr(tvb, offset, 3));
+ "Timer: %.3s", tvb_get_ephemeral_string(tvb, offset, 3));
break;
default:
case Q2931_ISDN_NUMBERING:
proto_tree_add_text(tree, tvb, offset, len, "Number: %.*s",
- len, tvb_get_ptr(tvb, offset, len));
+ len, tvb_get_ephemeral_string(tvb, offset, len));
break;
case Q2931_NSAP_ADDRESSING:
while (len >= 3) {
identifier = tvb_get_guint8(tvb, offset);
value = tvb_get_ntohs(tvb, offset + 1);
+ len -=3;
switch (identifier) {
case 0x01: /* Cumulative transit delay identifier */
{
guint8 identifier;
- while (len != 0) {
+ while (len >= 0) {
identifier = tvb_get_guint8(tvb, offset);
switch (identifier) {
if (len == 0)
return;
proto_tree_add_text(tree, tvb, offset, len,
- "Network identification: %.*s", len, tvb_get_ptr(tvb, offset, len));
+ "Network identification: %.*s", len, tvb_get_ephemeral_string(tvb, offset, len));
}
/*
};
static const value_string q2931_user_net_fault_mgmt_vals[] = {
- { 0x00, "No user-originated fault managment indications" },
+ { 0x00, "No user-originated fault management indications" },
{ 0x01, "User-originated fault management indications, cell rate 1 cell/s" },
{ 0, NULL }
};
"Information element extension: 0x%02x",
info_element_ext);
ie_ext_tree = proto_item_add_subtree(ti, ett_q2931_ie_ext);
- proto_tree_add_text(ie_ext_tree, tvb, offset + 1, 1,
+ proto_tree_add_text(ie_ext_tree, tvb, offset + 1, 1, "%s",
decode_enumerated_bitfield(info_element_ext,
Q2931_IE_COMPAT_CODING_STD, 8,
coding_std_vals, "Coding standard: %s"));
- proto_tree_add_text(ie_ext_tree, tvb, offset + 1, 1,
+ proto_tree_add_text(ie_ext_tree, tvb, offset + 1, 1, "%s",
decode_boolean_bitfield(info_element_ext,
Q2931_IE_COMPAT_FOLLOW_INST, 8,
"Follow explicit error handling instructions",
"Regular error handling procedures apply"));
if (info_element_ext & Q2931_IE_COMPAT_FOLLOW_INST) {
- proto_tree_add_text(ie_ext_tree, tvb, offset + 1, 1,
+ proto_tree_add_text(ie_ext_tree, tvb, offset + 1, 1, "%s",
decode_enumerated_bitfield(info_element_ext,
Q2931_IE_COMPAT_ACTION_IND, 8,
ie_action_ind_vals,
guint8 info_element;
guint8 info_element_ext;
guint16 info_element_len;
+#if 0
int codeset;
gboolean non_locking_shift;
+#endif
- if (check_col(pinfo->cinfo, COL_PROTOCOL))
- col_set_str(pinfo->cinfo, COL_PROTOCOL, "Q.2931");
+ col_set_str(pinfo->cinfo, COL_PROTOCOL, "Q.2931");
if (tree) {
ti = proto_tree_add_item(tree, proto_q2931, tvb, offset, -1,
- FALSE);
+ ENC_NA);
q2931_tree = proto_item_add_subtree(ti, ett_q2931);
proto_tree_add_uint(q2931_tree, hf_q2931_discriminator, tvb, offset, 1, tvb_get_guint8(tvb, offset));
/*
* And now for the information elements....
*/
+#if 0
codeset = 0; /* start out in codeset 0 */
non_locking_shift = TRUE;
+#endif
while (tvb_reported_length_remaining(tvb, offset) > 0) {
info_element = tvb_get_guint8(tvb, offset);
info_element_ext = tvb_get_guint8(tvb, offset + 1);
dissect_q2931_ie(tvb, offset, info_element_len,
q2931_tree, info_element, info_element_ext);
}
+#if 0 /* XXX: Is codeset & etc supoosed to be used somehow ? */
if (non_locking_shift)
codeset = 0;
-
/*
* Handle shifts.
*/
}
break;
}
+#endif
offset += 1 + 1 + 2 + info_element_len;
}
}
static hf_register_info hf[] = {
{ &hf_q2931_discriminator,
{ "Protocol discriminator", "q2931.disc", FT_UINT8, BASE_HEX, NULL, 0x0,
- "", HFILL }},
+ NULL, HFILL }},
{ &hf_q2931_call_ref_len,
{ "Call reference value length", "q2931.call_ref_len", FT_UINT8, BASE_DEC, NULL, 0x0,
- "", HFILL }},
+ NULL, HFILL }},
{ &hf_q2931_call_ref_flag,
{ "Call reference flag", "q2931.call_ref_flag", FT_BOOLEAN, BASE_NONE, TFS(&tfs_call_ref_flag), 0x0,
- "", HFILL }},
+ NULL, HFILL }},
{ &hf_q2931_call_ref,
- { "Call reference value", "q2931.call_ref", FT_BYTES, BASE_HEX, NULL, 0x0,
- "", HFILL }},
+ { "Call reference value", "q2931.call_ref", FT_BYTES, BASE_NONE, NULL, 0x0,
+ NULL, HFILL }},
{ &hf_q2931_message_type,
{ "Message type", "q2931.message_type", FT_UINT8, BASE_HEX, VALS(q2931_message_type_vals), 0x0,
- "", HFILL }},
+ NULL, HFILL }},
{ &hf_q2931_message_type_ext,
{ "Message type extension", "q2931.message_type_ext", FT_UINT8, BASE_HEX, NULL, 0x0,
- "", HFILL }},
+ NULL, HFILL }},
{ &hf_q2931_message_flag,
{ "Flag", "q2931.message_flag", FT_BOOLEAN, 8, TFS(&tos_msg_flag), Q2931_MSG_TYPE_EXT_FOLLOW_INST,
- "", HFILL }},
+ NULL, HFILL }},
{ &hf_q2931_message_action_indicator,
{ "Action indicator", "q2931.message_action_indicator", FT_UINT8, BASE_DEC, VALS(msg_action_ind_vals), Q2931_MSG_TYPE_EXT_ACTION_IND,
- "", HFILL }},
+ NULL, HFILL }},
{ &hf_q2931_message_len,
{ "Message length", "q2931.message_len", FT_UINT16, BASE_DEC, NULL, 0x0,
- "", HFILL }},
+ NULL, HFILL }},
};
static gint *ett[] = {