diff options
author | etxrab <etxrab@f5534014-38df-0310-8fa8-9805f1628bb7> | 2007-08-23 17:00:44 +0000 |
---|---|---|
committer | etxrab <etxrab@f5534014-38df-0310-8fa8-9805f1628bb7> | 2007-08-23 17:00:44 +0000 |
commit | 88ff4af70ee8956b22501e332da0f70790bee1d4 (patch) | |
tree | 0e936f0698a7dc3fc725b350e1a78848670b9504 /epan/dissectors/packet-sip.c | |
parent | 3053e09d6a8fce0dcbc02f2d117bd62290df1b7f (diff) |
Translate Q.850 Cause values.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@22602 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'epan/dissectors/packet-sip.c')
-rw-r--r-- | epan/dissectors/packet-sip.c | 44 |
1 files changed, 43 insertions, 1 deletions
diff --git a/epan/dissectors/packet-sip.c b/epan/dissectors/packet-sip.c index 0b2646f1df..aef1d52613 100644 --- a/epan/dissectors/packet-sip.c +++ b/epan/dissectors/packet-sip.c @@ -58,6 +58,7 @@ #include <epan/req_resp_hdrs.h> #include <epan/emem.h> +#include "packet-isup.h" #include "packet-sip.h" #include <epan/tap.h> #include <epan/expert.h> @@ -509,6 +510,8 @@ static header_parameter_t via_parameters_hf_array[] = {"sigcomp-id", &hf_sip_via_sigcomp_id} }; + + /* * Type of line. It's either a SIP Request-Line, a SIP Status-Line, or * another type of line. @@ -1189,6 +1192,45 @@ dissect_sip_authorization_item(tvbuff_t *tvb, proto_tree *tree, gint start_offse return current_offset; } +/* Dissect the details of a Reason header */ +static void +dissect_sip_reason_header(tvbuff_t *tvb, proto_tree *tree, gint start_offset, gint line_end_offset){ + + gint current_offset, semi_colon_offset, length; + gchar *param_name = NULL; + guint cause_value; + + /* skip Spaces and Tabs */ + start_offset = tvb_skip_wsp(tvb, start_offset, line_end_offset - start_offset); + + if (start_offset >= line_end_offset) + { + /* Nothing to parse */ + return; + } + + current_offset = start_offset; + semi_colon_offset = tvb_find_guint8(tvb, current_offset, line_end_offset-current_offset, ';'); + length = semi_colon_offset - current_offset; + proto_tree_add_text(tree, tvb, start_offset, length, + "Reason Protocols: %s", tvb_format_text(tvb, start_offset, length)); + + param_name = tvb_get_ephemeral_string(tvb, start_offset, length); + if (strcasecmp(param_name, "Q.850") == 0){ + current_offset = tvb_find_guint8(tvb, semi_colon_offset, line_end_offset-semi_colon_offset, '=')+1; + length = line_end_offset - current_offset; + + /* q850_cause_code_vals */ + cause_value = atoi(tvb_get_ephemeral_string(tvb, current_offset, length)); + proto_tree_add_text(tree, tvb, current_offset, length, + "Cause: %u(0x%x)[%s]", cause_value,cause_value, + val_to_str(cause_value, q850_cause_code_vals, "Unknown (%d)" )); + + } + +} + + /* Dissect the details of a Via header */ static void dissect_sip_via_header(tvbuff_t *tvb, proto_tree *tree, gint start_offset, gint line_end_offset) { @@ -2319,7 +2361,7 @@ separator_found2: tvb_format_text(tvb, offset, linelen)); reason_tree = proto_item_add_subtree(ti, ett_sip_reason); } - semi_colon_offset = tvb_find_guint8(tvb, value_offset, value_len, ';'); + dissect_sip_reason_header(tvb, reason_tree, value_offset, line_end_offset); break; default : /* Default case is to assume its an FT_STRING field */ |