Skip to content

Commit

Permalink
Display AVP:s of Dimater type Unsigned32 as such even when they have …
Browse files Browse the repository at this point in the history
…"value translation".

svn path=/trunk/; revision=16510
  • Loading branch information
AndersBroman committed Nov 16, 2005
1 parent 00131b0 commit 6c466a1
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 7 deletions.
2 changes: 1 addition & 1 deletion epan/dissectors/packet-diameter-defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -886,7 +886,7 @@ static struct old_avp_info old_diameter_avps[] = {
{ 265, "Supported-Vendor-Id", DIAMETER_UNSIGNED32, (value_string *)NULL},
{ 266, "Vendor-Id", DIAMETER_ENUMERATED, sminmpec_values},
{ 267, "Firmware-Revision", DIAMETER_UNSIGNED32, (value_string *)NULL},
{ 268, "Result-Code", DIAMETER_ENUMERATED, diameter_result_code_vals},
{ 268, "Result-Code", DIAMETER_UNSIGNED32, diameter_result_code_vals},
{ 269, "Product-Name", DIAMETER_UTF8STRING, (value_string *)NULL},
{ 270, "Session-Binding", DIAMETER_UNSIGNED32, diameter_session_binding_vals},
{ 271, "Session-Server-Failover", DIAMETER_ENUMERATED, diameter_session_server_failover_vals},
Expand Down
46 changes: 40 additions & 6 deletions epan/dissectors/packet-diameter.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ typedef enum {
DIAMETER_INTEGER32,
DIAMETER_INTEGER64,
DIAMETER_UNSIGNED32,
DIAMETER_UNSIGNED32ENUM,
DIAMETER_UNSIGNED64,
DIAMETER_FLOAT32,
DIAMETER_FLOAT64,
Expand Down Expand Up @@ -96,6 +97,7 @@ static const value_string TypeValues[]={
{ DIAMETER_INTEGER32, "Integer32" },
{ DIAMETER_INTEGER64, "Integer64" },
{ DIAMETER_UNSIGNED32, "Unsigned32" },
{ DIAMETER_UNSIGNED32ENUM, "Unsigned32" }, /* This is needed to get value translation for Uint32:s with a value*/
{ DIAMETER_UNSIGNED64, "Unsigned64" },
{ DIAMETER_FLOAT32, "Float32" },
{ DIAMETER_FLOAT64, "Float64" },
Expand Down Expand Up @@ -397,8 +399,13 @@ addStaticAVP(int code, const gchar *name, diameterDataType type, const value_str
entry->vendorName = NULL;
entry->type = type;
entry->values = vEntry;
if (vEntry)
entry->type = DIAMETER_ENUMERATED;
/* Unsigned32 might have values to ( Result-code 268 ) */
if (vEntry){
if (type != DIAMETER_ENUMERATED){
entry->type = DIAMETER_UNSIGNED32ENUM;
}
}


/* And, add it to the list */
entry->next = avpListHead;
Expand Down Expand Up @@ -444,8 +451,13 @@ addVendorAVP(int code, const gchar *name, diameterDataType type, const value_str
else
entry->vendorName = NULL; entry->type = type;
entry->values = vEntry;
if (vEntry)
entry->type = DIAMETER_ENUMERATED;

/* Unsigned32 might have values to ( Result-code 268 ) */
if (vEntry){
if (type != DIAMETER_ENUMERATED){
entry->type = DIAMETER_UNSIGNED32ENUM;
}
}

/* And, add it to the list */
entry->next = avpListHead;
Expand Down Expand Up @@ -545,8 +557,12 @@ xmlParseAVP(xmlNodePtr cur)
entry->vendorName = NULL;
entry->type = avpType;
entry->values = vEntry;
if (vEntry)
entry->type = DIAMETER_ENUMERATED;
/* Unsigned32 might have values to ( Result-code 268 ) */
if (vEntry){
if (avpType != DIAMETER_ENUMERATED){
entry->type = DIAMETER_UNSIGNED32ENUM;
}
}

/* And, add it to the list */
entry->next = avpListHead;
Expand Down Expand Up @@ -1827,6 +1843,24 @@ static void dissect_avps(tvbuff_t *tvb, packet_info *pinfo, proto_tree *avp_tree
}
break;

case DIAMETER_UNSIGNED32ENUM:
if (avpDataLength == 4) {
guint32 data;

data = tvb_get_ntohl(tvb, offset);
valstr = diameter_avp_get_value(avph.avp_code, vendorId, data);
proto_tree_add_uint_format(avpi_tree, hf_diameter_avp_data_uint32,
tvb, offset, avpDataLength, data,
"Value: 0x%08x (%u): %s", data,
data, valstr);
} else {
proto_tree_add_bytes_format(avpi_tree, hf_diameter_avp_data_bytes,
tvb, offset, avpDataLength,
tvb_get_ptr(tvb, offset, avpDataLength),
"Error! Bad Enumerated Length");
}
break;

case DIAMETER_INTEGER64:
if (avpDataLength == 8) {
proto_tree_add_item(avpi_tree, hf_diameter_avp_data_int64,
Expand Down

0 comments on commit 6c466a1

Please sign in to comment.