Ethereal-dev: [Ethereal-dev] Patch for WSP decoding.

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: Mon, 30 Jul 2001 14:28:57 -0300
Hi,

A small patch for correct decoding of WSP capabilities in a connect reply. Please apply.

Thanks,

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

*** ethereal-2001-07-30/packet-wsp.c	Mon Jul 30 02:20:44 2001
--- ethereal-2001-07-30.new/packet-wsp.c	Mon Jul 30 09:41:43 2001
***************
*** 750,756 ****
      value_type_t, int);
  static void add_accept_application_header (proto_tree *, tvbuff_t *, int,
      tvbuff_t *, value_type_t, int);
! static void add_capabilities (proto_tree *tree, tvbuff_t *tvb);
  static value_type_t get_value_type_len (tvbuff_t *, int, guint *, int *, int *);
  static guint get_uintvar (tvbuff_t *, guint, guint);
  static gint get_integer (tvbuff_t *, guint, guint, value_type_t, guint *);
--- 750,756 ----
      value_type_t, int);
  static void add_accept_application_header (proto_tree *, tvbuff_t *, int,
      tvbuff_t *, value_type_t, int);
! static void add_capabilities (proto_tree *tree, tvbuff_t *tvb, int type);
  static value_type_t get_value_type_len (tvbuff_t *, int, guint *, int *, int *);
  static guint get_uintvar (tvbuff_t *, guint, guint);
  static gint get_integer (tvbuff_t *, guint, guint, value_type_t, guint *);
***************
*** 1045,1051 ****
  				if (capabilityLength > 0)
  				{
  					tmp_tvb = tvb_new_subset (tvb, offset, capabilityLength, capabilityLength);
! 					add_capabilities (wsp_tree, tmp_tvb);
  					offset += capabilityLength;
  				}
  
--- 1045,1051 ----
  				if (capabilityLength > 0)
  				{
  					tmp_tvb = tvb_new_subset (tvb, offset, capabilityLength, capabilityLength);
! 					add_capabilities (wsp_tree, tmp_tvb, CONNECT);
  					offset += capabilityLength;
  				}
  
***************
*** 1079,1085 ****
  				if (capabilityLength > 0)
  				{
  					tmp_tvb = tvb_new_subset (tvb, offset, capabilityLength, capabilityLength);
! 					add_capabilities (wsp_tree, tmp_tvb);
  					offset += capabilityLength;
  				}
  
--- 1079,1085 ----
  				if (capabilityLength > 0)
  				{
  					tmp_tvb = tvb_new_subset (tvb, offset, capabilityLength, capabilityLength);
! 					add_capabilities (wsp_tree, tmp_tvb, CONNECTREPLY);
  					offset += capabilityLength;
  				}
  
***************
*** 2271,2277 ****
  }
  
  static void
! add_capabilities (proto_tree *tree, tvbuff_t *tvb)
  {
  	proto_item *ti;
  	proto_tree *wsp_capabilities;
--- 2271,2277 ----
  }
  
  static void
! add_capabilities (proto_tree *tree, tvbuff_t *tvb, int type)
  {
  	proto_item *ti;
  	proto_tree *wsp_capabilities;
***************
*** 2366,2383 ****
  			case 0x05 : /* Extended Methods */ 
  				offsetStr = offset;
  				offset++;
! 				i = 0;
! 				while ((offsetStr-capabilitiesStart) <= length)
  				{
! 					value = tvb_get_guint8(tvb, offsetStr);
! 					i += snprintf(valString+i,200-i,"(%d - ",value);
! 					offsetStr++;
! 					for (;(valString[i] = tvb_get_guint8(tvb, offsetStr));i++,offsetStr++);
! 					offsetStr++;
! 					valString[i++] = ')';
! 					valString[i++] = ' ';
  				}
- 				valString[i]=0;
  				proto_tree_add_string(wsp_capabilities, hf_wsp_capabilities_extended_methods, tvb, capabilitiesStart, length+1, valString);
  				break;
  			case 0x06 : /* Header Code Pages */ 
--- 2366,2397 ----
  			case 0x05 : /* Extended Methods */ 
  				offsetStr = offset;
  				offset++;
! 				if (type == CONNECT)
! 				{
! 					i = 0;
! 					while ((offsetStr-capabilitiesStart) <= length)
! 					{
! 						value = tvb_get_guint8(tvb, offsetStr);
! 						i += snprintf(valString+i,200-i,"(%d - ",value);
! 						offsetStr++;
! 						for (;(valString[i] = tvb_get_guint8(tvb, offsetStr));i++,offsetStr++);
! 						offsetStr++;
! 						valString[i++] = ')';
! 						valString[i++] = ' ';
! 					}
! 					valString[i]=0;
! 				}
! 				else
  				{
! 					i = 0;
! 					while ((offsetStr-capabilitiesStart) <= length)
! 					{
! 						value = tvb_get_guint8(tvb, offsetStr);
! 						i += snprintf(valString+i,200-i,"(%d) ",value);
! 						offsetStr++;
! 					}
! 					valString[i]=0;
  				}
  				proto_tree_add_string(wsp_capabilities, hf_wsp_capabilities_extended_methods, tvb, capabilitiesStart, length+1, valString);
  				break;
  			case 0x06 : /* Header Code Pages */