Ethereal-dev: [Ethereal-dev] Fixes for WSP

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

From: "Alexandre P. Ferreira" <alexandref@xxxxxxxxxxxx>
Date: Tue, 08 May 2001 14:15:28 -0300
Hi,

Some fixes for WSP decoding.

Thanks,

--
Alexandre Peixoto Ferreira
Coordenador de Planejamento
TCO IP
+55 61 3137504


*** ethereal-2001-05-02.new/packet-wsp.c	Mon May  7 20:26:05 2001
--- ethereal-2001-05-08/packet-wsp.c	Mon Apr 23 01:29:54 2001
***************
*** 75,81 ****
  static int hf_wsp_headers_section				= HF_EMPTY;
  static int hf_wsp_header						= HF_EMPTY;
  static int hf_wsp_content_type					= HF_EMPTY;
- static int hf_wsp_content_type_str					= HF_EMPTY;
  static int hf_wsp_parameter_well_known_charset	= HF_EMPTY;
  static int hf_wsp_reply_data					= HF_EMPTY;
  static int hf_wsp_post_data						= HF_EMPTY;
--- 75,80 ----
***************
*** 1021,1055 ****
  				break;
  
  			case 0x05:		/* Age */
! 				if (peek < 31)
  				{
! 					/* Peek contains the number of octets to follow */
! 					switch (peek)
! 					{
! 						case 1:
! 							proto_tree_add_uint (tree, hf_wsp_header_age, header_buff, offset, 
! 								headerLen, tvb_get_guint8 (value_buff, 1) );
  						break;
! 						case 2:
! 							proto_tree_add_uint (tree, hf_wsp_header_age, header_buff, offset, 
! 								headerLen, tvb_get_ntohs (value_buff, 1) );
  						break;
! 						case 3:
! 							proto_tree_add_uint (tree, hf_wsp_header_age, header_buff, offset, 
! 								headerLen, tvb_get_ntoh24 (value_buff, 1) );
  						break;
! 						case 4:
! 							proto_tree_add_uint (tree, hf_wsp_header_age, header_buff, offset, 
! 								headerLen, tvb_get_ntohl (value_buff, 1) );
  						break;
! 						default:
! 							fprintf (stderr, "dissect_wsp: age size %d NYI\n", peek);
! 					}
! 				}
! 				else
! 				{
! 					fprintf (stderr, "dissect_wsp: age size %d NYI\n", peek);
! 				}
  				break;
  
  			case 0x08:		/* Cache-Control */
--- 1020,1040 ----
  				break;
  
  			case 0x05:		/* Age */
! 				switch (valueLen)
  				{
! 					case 1:
! 						proto_tree_add_uint (tree, hf_wsp_header_age, header_buff, offset, headerLen, tvb_get_guint8 (value_buff, 0));
  						break;
! 					case 2:
! 						proto_tree_add_uint (tree, hf_wsp_header_age, header_buff, offset, headerLen, tvb_get_ntohs (value_buff, 0));
  						break;
! 					case 3:
! 						proto_tree_add_uint (tree, hf_wsp_header_age, header_buff, offset, headerLen, tvb_get_ntoh24 (value_buff, 0));
  						break;
! 					case 4:
! 						proto_tree_add_uint (tree, hf_wsp_header_age, header_buff, offset, headerLen, tvb_get_ntohl (value_buff, 0));
  						break;
! 				};
  				break;
  
  			case 0x08:		/* Cache-Control */
***************
*** 1285,1291 ****
  	guint fieldLength = 0;
  	guint octet = tvb_get_guint8 (tvb, offset);
  	guint totalSizeOfField = 0;
- 	char newBuffer[1024];
  
  	if (octet <= 31)
  	{
--- 1270,1275 ----
***************
*** 1299,1315 ****
  	}
  	else
  	{
! 		for (totalSizeOfField = 0;totalSizeOfField < 1024;)
! 		{
! 			newBuffer[totalSizeOfField++]=octet;
! 			octet=tvb_get_guint8 (tvb, offset+totalSizeOfField);
! 			if (octet == 0)
! 				break;
! 		}
! 		newBuffer[totalSizeOfField++]=0;
! 		
! 		contentTypeTree = proto_tree_add_string (tree, hf_wsp_content_type_str, tvb, offset, totalSizeOfField, newBuffer);
! 		return (offset+totalSizeOfField);
  	}
  
  	*contentType = (tvb_get_guint8 (tvb, nextOffset) & 0x7F);
--- 1283,1289 ----
  	}
  	else
  	{
! 		fprintf (stderr, "dissect-wsp: Content-type is un-supported\n");
  	}
  
  	*contentType = (tvb_get_guint8 (tvb, nextOffset) & 0x7F);
***************
*** 1620,1632 ****
  			{ 	"Content Type",           
  				"wsp.content_type.type",
  				 FT_UINT8, BASE_HEX, VALS ( vals_content_types ), 0x00,
- 				"Content Type" 
- 			}
- 		},
- 		{ &hf_wsp_content_type_str,
- 			{ 	"Content Type",           
- 				"wsp.content_type.type_str",
- 				 FT_STRING, BASE_HEX, NULL, 0x00,
  				"Content Type" 
  			}
  		},
--- 1594,1599 ----
begin:vcard 
n:Peixoto Ferreira;Alexandre
tel;cell:_55 61 96184223
tel;work:+55 61 3137504
x-mozilla-html:FALSE
org:TCO - Tele Centro Oeste Celular S.A.;TCO IP
adr:;;SCS Qd 2 ED Toufic 1 andar;Brasília;DF;70302-918;
version:2.1
email;internet:alexandre.ferreira@xxxxxxxxxxxx
title:Coordenandor de Planejamento
x-mozilla-cpt:;-16832
fn:Alexandre Peixoto Ferreira
end:vcard