Make the avp_str available to sub dissectors and Let the subdissector have

precedence filling in the avp_item string. Use that in a couple of places.

Change-Id: I1af7a1ca4c14fb56ddeaab336202e6c2a18e556b
Reviewed-on: https://code.wireshark.org/review/699
Reviewed-by: Michael Mann <mmann78@netscape.net>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
AndersBroman 2014-03-16 18:57:18 +01:00 committed by Anders Broman
parent 5f508e8b29
commit fcf1c44b50
2 changed files with 19 additions and 2 deletions

View File

@ -61,6 +61,7 @@
#include <epan/diam_dict.h>
#include <epan/sctpppids.h>
#include <epan/show_exception.h>
#include <epan/to_str.h>
#include "packet-tcp.h"
#include "packet-diameter.h"
@ -420,6 +421,7 @@ dissect_diameter_3gpp2_exp_res(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree
static int
dissect_diameter_base_framed_ipv6_prefix(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void *data _U_)
{
diam_sub_dis_t *diam_sub_dis = (diam_sub_dis_t*)data;
guint8 prefix_len, prefix_len_bytes;
/*diam_sub_dis_t *diam_sub_dis_inf = (diam_sub_dis_t*)data;*/
@ -443,6 +445,7 @@ dissect_diameter_base_framed_ipv6_prefix(tvbuff_t *tvb, packet_info *pinfo _U_,
tvb_memcpy(tvb, (guint8 *)&value.bytes, 2, prefix_len_bytes);
value.bytes[prefix_len_bytes] = value.bytes[prefix_len_bytes] & (0xff<<(prefix_len % 8));
proto_tree_add_ipv6(tree, hf_framed_ipv6_prefix_ipv6, tvb, 2, prefix_len_bytes, value.bytes);
diam_sub_dis->avp_str = wmem_strdup_printf(wmem_packet_scope(), "%s/%u", ip6_to_str((const struct e_in6_addr *)&value),prefix_len);
}
return(prefix_len_bytes+2);
@ -642,10 +645,17 @@ dissect_diameter_avp(diam_ctx_t *c, tvbuff_t *tvb, int offset, diam_sub_dis_t *d
}
c->tree = save_tree;
if (avp_str) proto_item_append_text(avp_item," val=%s", avp_str);
diam_sub_dis_inf->avp_str = NULL;
call_avp_subdissector(vendorid, code, subtvb, c->pinfo, avp_tree, diam_sub_dis_inf);
/* Let the subdissector have precedence filling in the avp_item string */
if(diam_sub_dis_inf->avp_str){
proto_item_append_text(avp_item," val=%s", diam_sub_dis_inf->avp_str);
}else if (avp_str){
proto_item_append_text(avp_item," val=%s", avp_str);
}
if (pad_len) {
guint8 i;

View File

@ -187,6 +187,7 @@ dissect_diameter_3gpp_ms_timezone(tvbuff_t *tvb, packet_info *pinfo _U_, proto_t
int offset = 0;
guint8 oct;
char sign;
diam_sub_dis_t *diam_sub_dis = (diam_sub_dis_t*)data;
/* 3GPP TS 23.040 version 6.6.0 Release 6
* 9.2.3.11 TP-Service-Centre-Time-Stamp (TP-SCTS)
@ -208,6 +209,12 @@ dissect_diameter_3gpp_ms_timezone(tvbuff_t *tvb, packet_info *pinfo _U_, proto_t
proto_tree_add_text(tree, tvb, offset, 1, "%s", val_to_str_const(oct, daylight_saving_time_vals, "Unknown"));
offset++;
diam_sub_dis->avp_str = wmem_strdup_printf(wmem_packet_scope(), "Timezone: GMT %c %d hours %d minutes %s",
sign,
oct / 4,
oct % 4 * 15,
val_to_str_const(oct, daylight_saving_time_vals, "Unknown"));
return offset;
}