Ethereal-dev: [Ethereal-dev] Small diameter patches

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: David Frascone <dave@xxxxxxxxxxxx>
Date: Tue, 10 Apr 2001 13:57:02 -0500
This patch makes the following smallchanges to the Diameter dissector:

o	Two uint types -> time types so they are displayed properly.
o	The identifier -> hop-by-hop and end-to-end identifiers, per the
	new specification.
o	Added g_warnings on bad packets, so the reason for the packet not
	being displayed is shown. 

I'll understand if it's too late for this to make the release.


-Dave
Index: packet-diameter-defs.h
===================================================================
RCS file: /cvsroot/ethereal/packet-diameter-defs.h,v
retrieving revision 1.3
diff -r1.3 packet-diameter-defs.h
538c538
<    { DIAMETER_ATT_TIMESTAMP, DIAMETER_INTEGER32 },
---
>    { DIAMETER_ATT_TIMESTAMP, DIAMETER_TIME },
601c601
<    { DIAMETER_ATT_SUN_PING_TIMESTAMP, DIAMETER_INTEGER32 },
---
>    { DIAMETER_ATT_SUN_PING_TIMESTAMP, DIAMETER_TIME },
Index: packet-diameter.c
===================================================================
RCS file: /cvsroot/ethereal/packet-diameter.c,v
retrieving revision 1.20
diff -r1.20 packet-diameter.c
80c80,81
< static int hf_diameter_id =-1;
---
> static int hf_diameter_hopbyhopid =-1;
> static int hf_diameter_endtoendid =-1;
117c118,119
< 	guint32 identifier;
---
> 	guint32 hopByHopId;
> 	guint32 endToEndId;
183c185,186
< 	dh.identifier = ntohl(dh.identifier);
---
> 	dh.hopByHopId = ntohl(dh.hopByHopId);
> 	dh.endToEndId = ntohl(dh.endToEndId);
194a198,199
> 		g_warning("DIAMETER: Packet too short: %d bytes less than min size (%d bytes))",
> 			dh.pktLength, MIN_DIAMETER_SIZE);
200a206
> 		g_warning("DIAMETER: Bad packet: Bad Flags or Version");
206c212
< 		    "%s%s: %s(%d) vendor=%d (id=%d) EIR=%d%d%d",
---
> 		    "%s%s: %s(%d) vendor=%d (hop-id=%d) (end-id=%d) EIR=%d%d%d",
210c216
< 		    dh.identifier,
---
> 		    dh.hopByHopId, dh.endToEndId,
256,258c262,269
< 		/* Identifier */
< 		proto_tree_add_uint(diameter_tree, hf_diameter_id,
< 		    tvb, offset, 4, dh.identifier);
---
> 		/* Hop-by-hop Identifier */
> 		proto_tree_add_uint(diameter_tree, hf_diameter_hopbyhopid,
> 		    tvb, offset, 4, dh.hopByHopId);
> 		offset += 4;
> 
> 		/* End-to-end Identifier */
> 		proto_tree_add_uint(diameter_tree, hf_diameter_endtoendid,
> 		    tvb, offset, 4, dh.endToEndId);
339a351,352
> 			g_warning("DIAMETER: AVP Payload too short: %d bytes less than min size (%d bytes))",
> 				packetLength, MIN_AVP_SIZE);
365a379,380
> 			g_warning("DIAMETER: AVP payload size invalid: avp_length: %d bytes,  min: %d bytes,    packetLen: %d",
> 				avph.avp_length, MIN_AVP_SIZE, packetLength);
371a387,388
> 		        g_warning("DIAMETER: Invalid AVP: avph.avp_reserved = 0x%x, avph.avp_flags = 0x%x, resFl=0x%x",
> 			avph.avp_reserved, avph.avp_flags, AVP_FLAGS_RESERVED);
385a403,404
> 		        g_warning("DIAMETER: Bad AVP: Bad new length (%d bytes)",
> 				packetLength);
771,773c790,795
< 		{ &hf_diameter_id,
< 		  { "Identifier", "diameter.id", FT_UINT32, BASE_HEX, NULL, 0x0,
< 		    "" }},
---
> 		{ &hf_diameter_hopbyhopid,
> 		  { "Hop-by-Hop Identifier", "diameter.hopbyhopid", FT_UINT32,
> 		    BASE_HEX, NULL, 0x0, "" }},
> 		{ &hf_diameter_endtoendid,
> 		  { "End-to-End Identifier", "diameter.endtoendid", FT_UINT32, 
> 		    BASE_HEX, NULL, 0x0, "" }},