Ethereal-dev: [Ethereal-dev] More new WAP patches

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

From: Neil Hunter <neil.hunter@xxxxxxxxxxxxxxxxxxx>
Date: Mon, 12 Feb 2001 17:11:21 +0000 (GMT)
Attached is a new set of files and a patch to the current CVS for the WAP
dissectors.

The major change is to break out Alexandre's wtls dissection into a separate
dissector which could, potentially, hand-off to the wtp or wsp dissectors (if
we could decrypt the payload). It makes things far cleaner that way and also
allows Alexandre's code to operate on both connection-oriented and
connection-less traffic.

Other minor tweaks include a couple of bug fixes, moving some shared code and
changing some field names to use underscores instead of hyphens (which seems to
upset the filter code!).

Enjoy :)

Cheers,
  Neil

-------------------------------------------------------------------------------
  Neil Hunter                                     Tel:    +44 (0)113 207 6073
  Internet Systems Developer                      Fax:    +44 (0)113 234 6065
  Energis Squared                                 Mobile: +44 (0)7787 100 649
  http://www.energis-squared.com/
                    ---------------------------------------
  This email is confidential and may be privileged. If you are not the named
  recipient please notify the sender immediately and do not disclose to
  another person or use it and take copies. If you receive this message in
  error please call the switchboard on + 44 (0)113 234 5100.
-------------------------------------------------------------------------------

Attachment: wap.tgz
Description: GNU Zip compressed data

? packet-wtls.h
? packet-wtls.c
? packet-wap.c
Index: Makefile.am
===================================================================
RCS file: /cvsroot/ethereal/Makefile.am,v
retrieving revision 1.282
diff -u -r1.282 Makefile.am
--- Makefile.am	2001/02/08 07:08:04	1.282
+++ Makefile.am	2001/02/12 17:06:37
@@ -216,8 +216,10 @@
 	packet-vtp.c  \
 	packet-wccp.c \
 	packet-who.c  \
-	packet-wsp.c \
+	packet-wap.c \
+	packet-wtls.c \
 	packet-wtp.c \
+	packet-wsp.c \
 	packet-x11.c   \
 	packet-x25.c   \
 	packet-xot.c   \
@@ -296,10 +298,11 @@
 	packet-udp.h   \
 	packet-vines.h \
 	packet-vlan.h \
-	packet-wap.h \
 	packet-wccp.h \
-	packet-wsp.h \
+	packet-wap.h \
+	packet-wtls.h \
 	packet-wtp.h \
+	packet-wsp.h \
 	packet-x11-declarations.h	\
 	packet-x11-register-info.h	\
 	packet-x11-keysym.h	\
Index: packet-wap.h
===================================================================
RCS file: /cvsroot/ethereal/packet-wap.h,v
retrieving revision 1.1
diff -u -r1.1 packet-wap.h
--- packet-wap.h	2000/11/04 03:30:40	1.1
+++ packet-wap.h	2001/02/12 17:06:37
@@ -1,5 +1,4 @@
-/* packet-wap.h (c) 2000 Neil Hunter
- * Based on original work by Ben Fowler
+/* packet-wap.h
  *
  * Declarations for WAP packet disassembly
  *
@@ -9,6 +8,9 @@
  * By Gerald Combs <gerald@xxxxxxxx>
  * Copyright 1998 Gerald Combs
  *
+ * WAP dissector based on original work by Ben Fowler
+ * Updated by Neil Hunter <neil.hunter@xxxxxxxxxxxxxxxxxxx>
+ * WTLS support by Alexandre P. Ferreira (Splice IP)
  * 
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -23,13 +25,14 @@
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
- *
- *
  */
 
 #ifndef __PACKET_WAP_H__
 #define __PACKET_WAP_H__
 
+#include <glib.h>
+#include "packet.h"
+
 /* Port Numbers as per IANA */
 /* < URL:http://www.isi.edu/in-notes/iana/assignments/port-numbers/ > */
 #define UDP_PORT_WSP			9200		/* wap-wsp			*/
@@ -37,6 +40,31 @@
 #define UDP_PORT_WTLS_WSP		9202		/* wap-wsp-s		*/
 #define UDP_PORT_WTLS_WTP_WSP	9203		/* wap-wsp-wtp-s	*/
 
+/*
+ * Note:
+ *   There are four dissectors for the WAP protocol:
+ *     WTLS
+ *     WTP
+ *     WSP
+ *     WMLC
+ *   Which of these are necessary is determined by the port number above.
+ *   I.e. port 9200 (wap-wsp) indicates WSP data and possibly WMLC (depending on
+ *   the WSP PDU).
+ *   Port 9203 (wap-wsp-wtp-s), on the other hand, has WTLS, WTP, WSP and
+ *   possibly WMLC data in that order in the packet.
+ *
+ *   Therefore the dissectors are chained as follows:
+ *
+ *   Port        Dissectors
+ *   9200                     WSP  ->  WMLC
+ *   9201            WTP  ->  WSP  ->  WMLC
+ *   9202  WTLS  ->           WSP  ->  WMLC
+ *   9203  WTLS  ->  WTP  ->  WSP  ->  WMLC
+ *
+ *   At present, only the unencrypted parts of WTLS can be analysed. Therefore
+ *   the WTP and WSP dissectors are not called.
+ */
+
 #define HF_EMPTY	( -1 )
 #define ETT_EMPTY	( -1 )
 
@@ -45,5 +73,23 @@
 	bo_big_endian		= 0,
 	bo_little_endian	= 1
 };
+
+/* Utility function for reading Uintvar encoded values */
+guint tvb_get_guintvar (tvbuff_t *, guint , guint *);
+
+/* Character set encoding */
+extern const value_string vals_character_sets[];
+
+/*
+ * Misc TODO:
+ *
+ * WMLC Dissector
+ * Check Protocol display
+ * Check Protocol information display
+ * Check CONNECT/CONNECT REPLY headers
+ * Check add_headers code
+ * Check Content-Length code
+ * 
+ */
 
 #endif /* packet-wap.h */
Index: packet-wsp.c
===================================================================
RCS file: /cvsroot/ethereal/packet-wsp.c,v
retrieving revision 1.17
diff -u -r1.17 packet-wsp.c
--- packet-wsp.c	2001/02/10 09:28:04	1.17
+++ packet-wsp.c	2001/02/12 17:06:38
@@ -1,15 +1,21 @@
-/* packet-wsp.c (c) 2000 Neil Hunter
- * Based on original work by Ben Fowler
- * Updated by Alexandre P. Ferreira (Splice IP)
+/* packet-wsp.c
  *
  * Routines to dissect WSP component of WAP traffic.
  * 
+<<<<<<< packet-wsp.c
+ * $Id: packet-wsp.c,v 1.9 2001/01/09 06:31:45 guy Exp $
+=======
  * $Id: packet-wsp.c,v 1.17 2001/02/10 09:28:04 guy Exp $
+>>>>>>> 1.17
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@xxxxxxxx>
  * Copyright 1998 Didier Jorand
  *
+ * WAP dissector based on original work by Ben Fowler
+ * Updated by Neil Hunter <neil.hunter@xxxxxxxxxxxxxxxxxxx>
+ * WTLS support by Alexandre P. Ferreira (Splice IP)
+ *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
@@ -57,7 +63,6 @@
 
 /* File scoped variables for the protocol and registered fields */
 static int proto_wsp 							= HF_EMPTY;
-static int proto_wtls 						= HF_EMPTY;
 
 /* These fields used by fixed part of header */
 static int hf_wsp_header_tid					= HF_EMPTY;
@@ -81,9 +86,9 @@
 static int hf_wsp_header_accept					= HF_EMPTY;
 static int hf_wsp_header_accept_str				= HF_EMPTY;
 static int hf_wsp_header_accept_charset			= HF_EMPTY;
-static int hf_wsp_header_accept_charset_str			= HF_EMPTY;
+static int hf_wsp_header_accept_charset_str		= HF_EMPTY;
 static int hf_wsp_header_accept_language		= HF_EMPTY;
-static int hf_wsp_header_accept_language_str		= HF_EMPTY;
+static int hf_wsp_header_accept_language_str	= HF_EMPTY;
 static int hf_wsp_header_accept_ranges			= HF_EMPTY;
 static int hf_wsp_header_cache_control			= HF_EMPTY;
 static int hf_wsp_header_content_length			= HF_EMPTY;
@@ -99,72 +104,9 @@
 static int hf_wsp_header_application_header		= HF_EMPTY;
 static int hf_wsp_header_application_value		= HF_EMPTY;
 static int hf_wsp_header_x_wap_tod				= HF_EMPTY;
-static int hf_wsp_header_transfer_encoding            = HF_EMPTY;
-static int hf_wsp_header_transfer_encoding_str                = HF_EMPTY;
-static int hf_wsp_header_via                          = HF_EMPTY;
-
-static int hf_wtls_record                             = HF_EMPTY;
-static int hf_wtls_record_type                                = HF_EMPTY;
-static int hf_wtls_record_length                      = HF_EMPTY;
-static int hf_wtls_record_sequence                    = HF_EMPTY;
-static int hf_wtls_record_ciphered                    = HF_EMPTY;
-static int hf_wtls_hands                              = HF_EMPTY;
-static int hf_wtls_hands_type                 = HF_EMPTY;
-static int hf_wtls_hands_length                       = HF_EMPTY;
-static int hf_wtls_hands_cli_hello            = HF_EMPTY;
-static int hf_wtls_hands_cli_hello_version    = HF_EMPTY;
-static int hf_wtls_hands_cli_hello_gmt                = HF_EMPTY;
-static int hf_wtls_hands_cli_hello_random     = HF_EMPTY;
-static int hf_wtls_hands_cli_hello_session    = HF_EMPTY;
-static int hf_wtls_hands_cli_hello_cli_key_id    = HF_EMPTY;
-static int hf_wtls_hands_cli_hello_trust_key_id    = HF_EMPTY; 
-static int hf_wtls_hands_cli_hello_key_exchange               =HF_EMPTY;
-static int hf_wtls_hands_cli_hello_key_exchange_suite         =HF_EMPTY;
-static int hf_wtls_hands_cli_hello_key_parameter_index                =HF_EMPTY;
-static int hf_wtls_hands_cli_hello_key_parameter_set          =HF_EMPTY;
-static int hf_wtls_hands_cli_hello_key_identifier_type                =HF_EMPTY;
-static int hf_wtls_hands_cli_hello_cipher_suite               =HF_EMPTY;
-static int hf_wtls_hands_cli_hello_cipher_suite_item  =HF_EMPTY;
-static int hf_wtls_hands_cli_hello_cipher_bulk                =HF_EMPTY;
-static int hf_wtls_hands_cli_hello_cipher_mac         =HF_EMPTY;
-static int hf_wtls_hands_cli_hello_compression_methods                =HF_EMPTY;
-static int hf_wtls_hands_cli_hello_compression                =HF_EMPTY;
-static int hf_wtls_hands_cli_hello_sequence_mode      =HF_EMPTY;
-static int hf_wtls_hands_cli_hello_key_refresh        =HF_EMPTY;
-static int hf_wtls_hands_serv_hello           = HF_EMPTY;
-static int hf_wtls_hands_serv_hello_version   = HF_EMPTY;
-static int hf_wtls_hands_serv_hello_gmt               = HF_EMPTY;
-static int hf_wtls_hands_serv_hello_random    = HF_EMPTY;
-static int hf_wtls_hands_serv_hello_session   = HF_EMPTY;
-static int hf_wtls_hands_serv_hello_cli_key_id                =HF_EMPTY;
-static int hf_wtls_hands_serv_hello_cipher_suite_item =HF_EMPTY;
-static int hf_wtls_hands_serv_hello_cipher_bulk               =HF_EMPTY;
-static int hf_wtls_hands_serv_hello_cipher_mac                =HF_EMPTY;
-static int hf_wtls_hands_serv_hello_compression               =HF_EMPTY;
-static int hf_wtls_hands_serv_hello_sequence_mode     =HF_EMPTY;
-static int hf_wtls_hands_serv_hello_key_refresh       =HF_EMPTY;
-static int hf_wtls_hands_certificates =HF_EMPTY;
-static int hf_wtls_hands_certificate 	=HF_EMPTY;
-static int hf_wtls_hands_certificate_type     =HF_EMPTY;
-static int hf_wtls_hands_certificate_wtls_version     =HF_EMPTY;
-static int hf_wtls_hands_certificate_wtls_signature_type      =HF_EMPTY;
-static int hf_wtls_hands_certificate_wtls_issuer_type =HF_EMPTY;
-static int hf_wtls_hands_certificate_wtls_issuer_charset      =HF_EMPTY;
-static int hf_wtls_hands_certificate_wtls_issuer_name =HF_EMPTY;
-static int hf_wtls_hands_certificate_wtls_valid_not_before    =HF_EMPTY;
-static int hf_wtls_hands_certificate_wtls_valid_not_after     =HF_EMPTY;
-static int hf_wtls_hands_certificate_wtls_subject_type        =HF_EMPTY;
-static int hf_wtls_hands_certificate_wtls_subject_charset     =HF_EMPTY;
-static int hf_wtls_hands_certificate_wtls_subject_name        = HF_EMPTY;
-static int hf_wtls_hands_certificate_wtls_public_key_type = HF_EMPTY;
-static int hf_wtls_hands_certificate_wtls_key_parameter_index = HF_EMPTY;
-static int hf_wtls_hands_certificate_wtls_key_parameter_set = HF_EMPTY;
-static int hf_wtls_hands_certificate_wtls_rsa_exponent = HF_EMPTY;
-static int hf_wtls_hands_certificate_wtls_rsa_modules = HF_EMPTY;
-static int hf_wtls_hands_certificate_wtls_signature = HF_EMPTY;
-static int hf_wtls_alert = HF_EMPTY;
-static int hf_wtls_alert_level = HF_EMPTY;
-static int hf_wtls_alert_description = HF_EMPTY;
+static int hf_wsp_header_transfer_encoding		= HF_EMPTY;
+static int hf_wsp_header_transfer_encoding_str	= HF_EMPTY;
+static int hf_wsp_header_via					= HF_EMPTY;
 
 /* Initialize the subtree pointers */
 static gint ett_wsp 							= ETT_EMPTY;
@@ -172,11 +114,9 @@
 static gint ett_headers							= ETT_EMPTY;
 static gint ett_capabilities					= ETT_EMPTY;
 static gint ett_content_type					= ETT_EMPTY;
-static gint ett_wtls_rec                              = ETT_EMPTY;
-static gint ett_wtls_msg_type                                 = ETT_EMPTY;
-static gint ett_wtls_msg_type_item                    = ETT_EMPTY;
-static gint ett_wtls_msg_type_item_sub                        = ETT_EMPTY;
-static gint ett_wtls_msg_type_item_sub_sub            = ETT_EMPTY;
+
+/* Handle for WMLC dissector */
+static dissector_handle_t wmlc_handle;
 
 static const value_string vals_pdu_type[] = {
 	{ 0x00, "Reserved" },
@@ -316,342 +256,103 @@
 	{ 0x00, NULL }
 };
 
-static const value_string vals_character_sets[] = {
-	{ 0 ,"hz-gb-2312" },
-	{ 3 ,"us-ascii" },
-	{ 4 ,"iso-8859-1" },
-	{ 5 ,"iso-8859-2" },
-	{ 6 ,"iso-8859-3" },
-	{ 7 ,"iso-8859-4" },
-	{ 8 ,"iso-8859-5" },
-	{ 9 ,"iso-8859-6" },
-	{ 10 ,"iso-8859-7" },
-	{ 11 ,"iso-8859-8" },
-	{ 12 ,"iso-8859-9" },
-	{ 13 ,"iso-8859-10" },
-	{ 14 ,"iso_6937-2-add" },
-	{ 15 ,"jis_x0201" },
-	{ 16 ,"jis_encoding" },
-	{ 17 ,"shift_jis" },
-	{ 18 ,"euc-jp" },
-	{ 19 ,"extended_unix_code_fixed_width_for_japanese" },
-	{ 20 ,"bs_4730" },
-	{ 21 ,"sen_850200_c" },
-	{ 22 ,"it" },
-	{ 23 ,"es" },
-	{ 24 ,"din_66003" },
-	{ 25 ,"ns_4551-1" },
-	{ 26 ,"nf_z_62-010" },
-	{ 27 ,"iso-10646-utf-1" },
-	{ 28 ,"iso_646.basic:1983" },
-	{ 29 ,"invariant" },
-	{ 30 ,"iso_646.irv:1983" },
-	{ 31 ,"nats-sefi" },
-	{ 32 ,"nats-sefi-add" },
-	{ 33 ,"nats-dano" },
-	{ 34 ,"nats-dano-add" },
-	{ 35 ,"sen_850200_b" },
-	{ 36 ,"ks_c_5601-1987" },
-	{ 37 ,"iso-2022-kr" },
-	{ 38 ,"euc-kr" },
-	{ 39 ,"iso-2022-jp" },
-	{ 40 ,"iso-2022-jp-2" },
-	{ 41 ,"jis_c6220-1969-jp" },
-	{ 42 ,"jis_c6220-1969-ro" },
-	{ 43 ,"pt" },
-	{ 44 ,"greek7-old" },
-	{ 45 ,"latin-greek" },
-	{ 46 ,"nf_z_62-010_(1973)" },
-	{ 47 ,"latin-greek-1" },
-	{ 48 ,"iso_5427" },
-	{ 49 ,"jis_c6226-1978" },
-	{ 50 ,"bs_viewdata" },
-	{ 51 ,"inis" },
-	{ 52 ,"inis-8" },
-	{ 53 ,"inis-cyrillic" },
-	{ 54 ,"iso_5427:1981" },
-	{ 55 ,"iso_5428:1980" },
-	{ 56 ,"gb_1988-80" },
-	{ 57 ,"gb_2312-80" },
-	{ 58 ,"ns_4551-2" },
-	{ 59 ,"videotex-suppl" },
-	{ 60 ,"pt2" },
-	{ 61 ,"es2" },
-	{ 62 ,"msz_7795.3" },
-	{ 63 ,"jis_c6226-1983" },
-	{ 64 ,"greek7" },
-	{ 65 ,"asmo_449" },
-	{ 66 ,"iso-ir-90" },
-	{ 67 ,"jis_c6229-1984-a" },
-	{ 68 ,"jis_c6229-1984-b" },
-	{ 69 ,"jis_c6229-1984-b-add" },
-	{ 70 ,"jis_c6229-1984-hand" },
-	{ 71 ,"jis_c6229-1984-hand-add" },
-	{ 72 ,"jis_c6229-1984-kana" },
-	{ 73 ,"iso_2033-1983" },
-	{ 74 ,"ansi_x3.110-1983" },
-	{ 75 ,"t.61-7bit" },
-	{ 76 ,"t.61-8bit" },
-	{ 77 ,"ecma-cyrillic" },
-	{ 78 ,"csa_z243.4-1985-1" },
-	{ 79 ,"csa_z243.4-1985-2" },
-	{ 80 ,"csa_z243.4-1985-gr" },
-	{ 81 ,"iso_8859-6-e" },
-	{ 82 ,"iso_8859-6-i" },
-	{ 83 ,"t.101-g2" },
-	{ 84 ,"iso_8859-8-e" },
-	{ 85 ,"iso_8859-8-i" },
-	{ 86 ,"csn_369103" },
-	{ 87 ,"jus_i.b1.002" },
-	{ 88 ,"iec_p27-1" },
-	{ 89 ,"jus_i.b1.003-serb" },
-	{ 90 ,"jus_i.b1.003-mac" },
-	{ 91 ,"greek-ccitt" },
-	{ 92 ,"nc_nc00-10:81" },
-	{ 93 ,"iso_6937-2-25" },
-	{ 94 ,"gost_19768-74" },
-	{ 95 ,"iso_8859-supp" },
-	{ 96 ,"iso_10367-box" },
-	{ 97 ,"latin-lap" },
-	{ 98 ,"jis_x0212-1990" },
-	{ 99 ,"ds_2089" },
-	{ 100 ,"us-dk" },
-	{ 101 ,"dk-us" },
-	{ 102 ,"ksc5636" },
-	{ 103 ,"unicode-1-1-utf-7" },
-	{ 104 ,"iso-2022-cn" },
-	{ 105 ,"iso-2022-cn-ext" },
-	{ 106 ,"utf-8" },
-	{ 109 ,"iso-8859-13" },
-	{ 110 ,"iso-8859-14" },
-	{ 111 ,"iso-8859-15" },
-	{ 1000 ,"iso-10646-ucs-2" },
-	{ 1001 ,"iso-10646-ucs-4" },
-	{ 1002 ,"iso-10646-ucs-basic" },
-	{ 1003 ,"iso-10646-j-1" },
-	{ 1003 ,"iso-10646-unicode-latin1" },
-	{ 1005 ,"iso-unicode-ibm-1261" },
-	{ 1006 ,"iso-unicode-ibm-1268" },
-	{ 1007 ,"iso-unicode-ibm-1276" },
-	{ 1008 ,"iso-unicode-ibm-1264" },
-	{ 1009 ,"iso-unicode-ibm-1265" },
-	{ 1010 ,"unicode-1-1" },
-	{ 1011 ,"scsu" },
-	{ 1012 ,"utf-7" },
-	{ 1013 ,"utf-16be" },
-	{ 1014 ,"utf-16le" },
-	{ 1015 ,"utf-16" },
-	{ 2000 ,"iso-8859-1-windows-3.0-latin-1" },
-	{ 2001 ,"iso-8859-1-windows-3.1-latin-1" },
-	{ 2002 ,"iso-8859-2-windows-latin-2" },
-	{ 2003 ,"iso-8859-9-windows-latin-5" },
-	{ 2004 ,"hp-roman8" },
-	{ 2005 ,"adobe-standard-encoding" },
-	{ 2006 ,"ventura-us" },
-	{ 2007 ,"ventura-international" },
-	{ 2008 ,"dec-mcs" },
-	{ 2009 ,"ibm850" },
-	{ 2010 ,"ibm852" },
-	{ 2011 ,"ibm437" },
-	{ 2012 ,"pc8-danish-norwegian" },
-	{ 2013 ,"ibm862" },
-	{ 2014 ,"pc8-turkish" },
-	{ 2015 ,"ibm-symbols" },
-	{ 2016 ,"ibm-thai" },
-	{ 2017 ,"hp-legal" },
-	{ 2018 ,"hp-pi-font" },
-	{ 2019 ,"hp-math8" },
-	{ 2020 ,"adobe-symbol-encoding" },
-	{ 2021 ,"hp-desktop" },
-	{ 2022 ,"ventura-math" },
-	{ 2023 ,"microsoft-publishing" },
-	{ 2024 ,"windows-31j" },
-	{ 2025 ,"gb2312" },
-	{ 2026 ,"big5" },
-	{ 2027 ,"macintosh" },
-	{ 2028 ,"ibm037" },
-	{ 2029 ,"ibm038" },
-	{ 2030 ,"ibm273" },
-	{ 2031 ,"ibm274" },
-	{ 2032 ,"ibm275" },
-	{ 2033 ,"ibm277" },
-	{ 2034 ,"ibm278" },
-	{ 2035 ,"ibm280" },
-	{ 2036 ,"ibm281" },
-	{ 2037 ,"ibm284" },
-	{ 2038 ,"ibm285" },
-	{ 2039 ,"ibm290" },
-	{ 2040 ,"ibm297" },
-	{ 2041 ,"ibm420" },
-	{ 2042 ,"ibm423" },
-	{ 2043 ,"ibm424" },
-	{ 2044 ,"ibm500" },
-	{ 2045 ,"ibm851" },
-	{ 2046 ,"ibm855" },
-	{ 2047 ,"ibm857" },
-	{ 2048 ,"ibm860" },
-	{ 2049 ,"ibm861" },
-	{ 2050 ,"ibm863" },
-	{ 2051 ,"ibm864" },
-	{ 2052 ,"ibm865" },
-	{ 2053 ,"ibm868" },
-	{ 2054 ,"ibm869" },
-	{ 2055 ,"ibm870" },
-	{ 2056 ,"ibm871" },
-	{ 2057 ,"ibm880" },
-	{ 2058 ,"ibm891" },
-	{ 2059 ,"ibm903" },
-	{ 2060 ,"ibm904" },
-	{ 2061 ,"ibm905" },
-	{ 2062 ,"ibm918" },
-	{ 2063 ,"ibm1026" },
-	{ 2064 ,"ebcdic-at-de" },
-	{ 2065 ,"ebcdic-at-de-a" },
-	{ 2066 ,"ebcdic-ca-fr" },
-	{ 2067 ,"ebcdic-dk-no" },
-	{ 2068 ,"ebcdic-dk-no-a" },
-	{ 2069 ,"ebcdic-fi-se" },
-	{ 2070 ,"ebcdic-fi-se-a" },
-	{ 2071 ,"ebcdic-fr" },
-	{ 2072 ,"ebcdic-it" },
-	{ 2073 ,"ebcdic-pt" },
-	{ 2074 ,"ebcdic-es" },
-	{ 2075 ,"ebcdic-es-a" },
-	{ 2076 ,"ebcdic-es-s" },
-	{ 2077 ,"ebcdic-uk" },
-	{ 2078 ,"ebcdic-us" },
-	{ 2079 ,"unknown-8bit" },
-	{ 2080 ,"mnemonic" },
-	{ 2081 ,"mnem" },
-	{ 2082 ,"viscii" },
-	{ 2083 ,"viqr" },
-	{ 2084 ,"koi8-r" },
-	{ 2086 ,"ibm866" },
-	{ 2087 ,"ibm775" },
-	{ 2088 ,"koi8-u" },
-	{ 2089 ,"ibm00858" },
-	{ 2090 ,"ibm00924" },
-	{ 2091 ,"ibm01140" },
-	{ 2092 ,"ibm01141" },
-	{ 2093 ,"ibm01142" },
-	{ 2094 ,"ibm01143" },
-	{ 2095 ,"ibm01144" },
-	{ 2096 ,"ibm01145" },
-	{ 2097 ,"ibm01146" },
-	{ 2098 ,"ibm01147" },
-	{ 2099 ,"ibm01148" },
-	{ 2100 ,"ibm01149" },
-	{ 2101 ,"big5-hkscs" },
-	{ 2250 ,"windows-1250" },
-	{ 2251 ,"windows-1251" },
-	{ 2252 ,"windows-1252" },
-	{ 2253 ,"windows-1253" },
-	{ 2254 ,"windows-1254" },
-	{ 2255 ,"windows-1255" },
-	{ 2256 ,"windows-1256" },
-	{ 2257 ,"windows-1257" },
-	{ 2258 ,"windows-1258" },
-	{ 2259 ,"tis-620" },
-	{ 0x00, NULL }
-};
-
 static const value_string vals_languages[] = {
-	{ 0x01,"Afar(aa)" },
-	{ 0x02,"Abkhazian(ab)" },
-	{ 0x03,"Afrikaans(af)" },
-	{ 0x04,"Amharic(am)" },
-	{ 0x05,"Arabic(ar)" },
-	{ 0x06,"Assamese(as)" },
-	{ 0x07,"Aymara(ay)" },
-	{ 0x08,"Azerbaijani(az)" },
-	{ 0x09,"Bashkir(ba)" },
-	{ 0x0A,"Byelorussian(be)" },
-	{ 0x0B,"Bulgarian(bg)" },
-	{ 0x0C,"Bihari(bh)" },
-	{ 0x0D,"Bislama(bi)" },
-	{ 0x0E,"Bengali; Bangla(bn)" },
-	{ 0x0F,"Tibetan(bo)" },
-	{ 0x10,"Breton(br)" },
-	{ 0x11,"Catalan(ca)" },
-	{ 0x12,"Corsican(co)" },
-	{ 0x13,"Czech(cs)" },
-	{ 0x14,"Welsh(cy)" },
-	{ 0x15,"Danish(da)" },
-	{ 0x16,"German(de)" },
-	{ 0x17,"Bhutani(dz)" },
-	{ 0x18,"Greek(el)" },
-	{ 0x19,"English(en)" },
-	{ 0x1A,"Esperanto(eo)" },
-	{ 0x1B,"Spanish(es)" },
-	{ 0x1C,"Estonian(et)" },
-	{ 0x1D,"Basque(eu)" },
-	{ 0x1E,"Persian(fa)" },
-	{ 0x1F,"Finnish(fi)" },
-	{ 0x20,"Fiji(fj)" },
-	{ 0x22,"French(fr)" },
-	{ 0x24,"Irish(ga)" },
-	{ 0x25,"Scots Gaelic(gd)" },
-	{ 0x26,"Galician(gl)" },
-	{ 0x27,"Guarani(gn)" },
-	{ 0x28,"Gujarati(gu)" },
-	{ 0x29,"Hausa(ha)" },
-	{ 0x2A,"Hebrew (formerly iw)(he)" },
-	{ 0x2B,"Hindi(hi)" },
-	{ 0x2C,"Croatian(hr)" },
-	{ 0x2D,"Hungarian(hu)" },
-	{ 0x2E,"Armenian(hy)" },
-	{ 0x30,"Indonesian (formerly in)(id)" },
-	{ 0x47,"Maori(mi)" },
-	{ 0x48,"Macedonian(mk)" },
-	{ 0x49,"Malayalam(ml)" },
-	{ 0x4A,"Mongolian(mn)" },
-	{ 0x4B,"Moldavian(mo)" },
-	{ 0x4C,"Marathi(mr)" },
-	{ 0x4D,"Malay(ms)" },
-	{ 0x4E,"Maltese(mt)" },
-	{ 0x4F,"Burmese(my)" },
-	{ 0x51,"Nepali(ne)" },
-	{ 0x52,"Dutch(nl)" },
-	{ 0x53,"Norwegian(no)" },
-	{ 0x54,"Occitan(oc)" },
-	{ 0x55,"(Afan) Oromo(om)" },
-	{ 0x56,"Oriya(or)" },
-	{ 0x57,"Punjabi(pa)" },
-	{ 0x58,"Polish(po)" },
-	{ 0x59,"Pashto, Pushto(ps)" },
-	{ 0x5A,"Portuguese(pt)" },
-	{ 0x5B,"Quechua(qu)" },
-	{ 0x5D,"Kirundi(rn)" },
-	{ 0x5E,"Romanian(ro)" },
-	{ 0x5F,"Russian(ru)" },
-	{ 0x60,"Kinyarwanda(rw)" },
-	{ 0x61,"Sanskrit(sa)" },
-	{ 0x62,"Sindhi(sd)" },
-	{ 0x63,"Sangho(sg)" },
-	{ 0x64,"Serbo-Croatian(sh)" },
-	{ 0x65,"Sinhalese(si)" },
-	{ 0x66,"Slovak(sk)" },
-	{ 0x67,"Slovenian(sl)" },
-	{ 0x68,"Samoan(sm)" },
-	{ 0x69,"Shona(sn)" },
-	{ 0x6A,"Somali(so)" },
-	{ 0x6B,"Albanian(sq)" },
-	{ 0x6C,"Serbian(sr)" },
-	{ 0x6D,"Siswati(ss)" },
-	{ 0x6E,"Sesotho(st)" },
-	{ 0x6F,"Sundanese(su)" },
-	{ 0x70,"Swedish(sv)" },
-	{ 0x71,"Swahili(sw)" },
-	{ 0x72,"Tamil(ta)" },
-	{ 0x73,"Telugu(te)" },
-	{ 0x74,"Tajik(tg)" },
-	{ 0x75,"Thai(th)" },
-	{ 0x76,"Tigrinya(ti)" },
-	{ 0x81,"Nauru(na)" },
-	{ 0x82,"Faeroese(fo)" },
-	{ 0x83,"Frisian(fy)" },
-	{ 0x84,"Interlingua(ia)" },
-	{ 0x8C,"Rhaeto-Romance(rm)" },
+	{ 0x01, "Afar (aa)" },
+	{ 0x02, "Abkhazian (ab)" },
+	{ 0x03, "Afrikaans (af)" },
+	{ 0x04, "Amharic (am)" },
+	{ 0x05, "Arabic (ar)" },
+	{ 0x06, "Assamese (as)" },
+	{ 0x07, "Aymara (ay)" },
+	{ 0x08, "Azerbaijani (az)" },
+	{ 0x09, "Bashkir (ba)" },
+	{ 0x0A, "Byelorussian (be)" },
+	{ 0x0B, "Bulgarian (bg)" },
+	{ 0x0C, "Bihari (bh)" },
+	{ 0x0D, "Bislama (bi)" },
+	{ 0x0E, "Bengali; Bangla (bn)" },
+	{ 0x0F, "Tibetan (bo)" },
+	{ 0x10, "Breton (br)" },
+	{ 0x11, "Catalan (ca)" },
+	{ 0x12, "Corsican (co)" },
+	{ 0x13, "Czech (cs)" },
+	{ 0x14, "Welsh (cy)" },
+	{ 0x15, "Danish (da)" },
+	{ 0x16, "German (de)" },
+	{ 0x17, "Bhutani (dz)" },
+	{ 0x18, "Greek (el)" },
+	{ 0x19, "English (en)" },
+	{ 0x1A, "Esperanto (eo)" },
+	{ 0x1B, "Spanish (es)" },
+	{ 0x1C, "Estonian (et)" },
+	{ 0x1D, "Basque (eu)" },
+	{ 0x1E, "Persian (fa)" },
+	{ 0x1F, "Finnish (fi)" },
+	{ 0x20, "Fiji (fj)" },
+	{ 0x22, "French (fr)" },
+	{ 0x24, "Irish (ga)" },
+	{ 0x25, "Scots Gaelic (gd)" },
+	{ 0x26, "Galician (gl)" },
+	{ 0x27, "Guarani (gn)" },
+	{ 0x28, "Gujarati (gu)" },
+	{ 0x29, "Hausa (ha)" },
+	{ 0x2A, "Hebrew (formerly iw) (he)" },
+	{ 0x2B, "Hindi (hi)" },
+	{ 0x2C, "Croatian (hr)" },
+	{ 0x2D, "Hungarian (hu)" },
+	{ 0x2E, "Armenian (hy)" },
+	{ 0x30, "Indonesian (formerly in) (id)" },
+	{ 0x47, "Maori (mi)" },
+	{ 0x48, "Macedonian (mk)" },
+	{ 0x49, "Malayalam (ml)" },
+	{ 0x4A, "Mongolian (mn)" },
+	{ 0x4B, "Moldavian (mo)" },
+	{ 0x4C, "Marathi (mr)" },
+	{ 0x4D, "Malay (ms)" },
+	{ 0x4E, "Maltese (mt)" },
+	{ 0x4F, "Burmese (my)" },
+	{ 0x51, "Nepali (ne)" },
+	{ 0x52, "Dutch (nl)" },
+	{ 0x53, "Norwegian (no)" },
+	{ 0x54, "Occitan (oc)" },
+	{ 0x55, "(Afan) Oromo (om)" },
+	{ 0x56, "Oriya (or)" },
+	{ 0x57, "Punjabi (pa)" },
+	{ 0x58, "Polish (po)" },
+	{ 0x59, "Pashto, Pushto (ps)" },
+	{ 0x5A, "Portuguese (pt)" },
+	{ 0x5B, "Quechua (qu)" },
+	{ 0x5D, "Kirundi (rn)" },
+	{ 0x5E, "Romanian (ro)" },
+	{ 0x5F, "Russian (ru)" },
+	{ 0x60, "Kinyarwanda (rw)" },
+	{ 0x61, "Sanskrit (sa)" },
+	{ 0x62, "Sindhi (sd)" },
+	{ 0x63, "Sangho (sg)" },
+	{ 0x64, "Serbo-Croatian (sh)" },
+	{ 0x65, "Sinhalese (si)" },
+	{ 0x66, "Slovak (sk)" },
+	{ 0x67, "Slovenian (sl)" },
+	{ 0x68, "Samoan (sm)" },
+	{ 0x69, "Shona (sn)" },
+	{ 0x6A, "Somali (so)" },
+	{ 0x6B, "Albanian (sq)" },
+	{ 0x6C, "Serbian (sr)" },
+	{ 0x6D, "Siswati (ss)" },
+	{ 0x6E, "Sesotho (st)" },
+	{ 0x6F, "Sundanese (su)" },
+	{ 0x70, "Swedish (sv)" },
+	{ 0x71, "Swahili (sw)" },
+	{ 0x72, "Tamil (ta)" },
+	{ 0x73, "Telugu (te)" },
+	{ 0x74, "Tajik (tg)" },
+	{ 0x75, "Thai (th)" },
+	{ 0x76, "Tigrinya (ti)" },
+	{ 0x81, "Nauru (na)" },
+	{ 0x82, "Faeroese (fo)" },
+	{ 0x83, "Frisian (fy)" },
+	{ 0x84, "Interlingua (ia)" },
+	{ 0x8C, "Rhaeto-Romance (rm)" },
 	{ 0x00, NULL }
 };
 
@@ -680,164 +381,7 @@
 	{ 0x80, "Chunked" },
 	{ 0x00, NULL }
 };
-static const value_string wtls_vals_record_type[] = {
-	{ 0x01, "change_cipher_data" },
-	{ 0x02, "alert" },
-	{ 0x03, "handshake" },
-	{ 0x04, "application_data" },
-	{ 0x00, NULL }
-};
-
-static const value_string wtls_vals_cipher_bulk[] = {
-	{ 0x00, "Null" },
-	{ 0x01, "RC5 CBC 40" },
-	{ 0x02, "RC5 CBC 56" },
-	{ 0x03, "RC5 CBC" },
-	{ 0x04, "DES CBC 40" },
-	{ 0x05, "DES CBC" },
-	{ 0x06, "3DES CBC cwEDE40" },
-	{ 0x07, "IDEA CBC 40" },
-	{ 0x08, "IDEA CBC 56" },
-	{ 0x09, "IDEA CBC" },
-	{ 0x00, NULL }
-};
-
-static const value_string wtls_vals_cipher_mac[] = {
-	{ 0x00, "SHA 0" },
-	{ 0x01, "SHA 40 " },
-	{ 0x02, "SHA 80" },
-	{ 0x03, "SHA" },
-	{ 0x04, "SHA XOR 40" },
-	{ 0x05, "MD5 40" },
-	{ 0x06, "MD5 80" },
-	{ 0x07, "MD5" },
-	{ 0x00, NULL }
-};
-
-static const value_string wtls_vals_handshake_type[] = {
-	{ 0, "Hello Request" },
-	{ 1, "Client Hello" },
-	{ 2, "Server Hello" },
-	{ 11, "Certificate" },
-	{ 12, "Server Key Exchange" },
-	{ 13, "Certificate Request" },
-	{ 14, "Server Hello Done" },
-	{ 15, "Certificate Verify" },
-	{ 16, "Client Key Exchange" },
-	{ 20, "Finished" },
-	{ 0x00, NULL }
-};
-
-static const value_string wtls_vals_key_exchange_suite[] = {
-	{ 0, "NULL" },
-	{ 1, "Shared Secret" },
-	{ 2, "Diffie Hellman Anonymous" },
-	{ 3, "Diffie Hellman Anonymous 512" },
-	{ 4, "Diffie Hellman Anonymous 768" },
-	{ 5, "RSA Anonymous" },
-	{ 6, "RSA Anonymous 512" },
-	{ 7, "RSA Anonymous 768" },
-	{ 8, "RSA" },
-	{ 9, "RSA 512" },
-	{ 10, "RSA 768" },
-	{ 11, "EC Diffie Hellman Anonymous" },
-	{ 12, "EC Diffie Hellman Anonymous 113" },
-	{ 13, "EC Diffie Hellman Anonymous 131" },
-	{ 14, "EC Diffie Hellman ECDSA" },
-	{ 15, "EC Diffie Hellman Anonymous Uncomp" },
-	{ 16, "EC Diffie Hellman Anonymous Uncomp 113" },
-	{ 17, "EC Diffie Hellman Anonymous Uncomp 131" },
-	{ 18, "EC Diffie Hellman ECDSA Uncomp" },
-	{ 0x00, NULL }
-};
-
-static const value_string wtls_vals_identifier_type[] = {
-	{ 0, "No identifier" },
-	{ 1, "Textual Name" },
-	{ 2, "Binary Name" },
-	{ 254, "SHA-1 Hash Publie Key" },
-	{ 255, "x509 Distinguished Name" },
-	{ 0x00, NULL }
-};
-
-static const value_string wtls_vals_certificate_type[] = {
-	{ 1, "WTLS" },
-	{ 2, "X509" },
-	{ 3, "X968" },
-	{ 4, "Url" },
-	{ 0x00, NULL }
-};
-
-static const value_string wtls_vals_compression[] = {
-	{ 0, "Null" },
-	{ 0x00, NULL }
-};
-
-static const value_string wtls_vals_sequence_mode[] = {
-	{ 0, "Off" },
-	{ 1, "Implicit" },
-	{ 2, "Explicit" },
-	{ 0x00, NULL }
-};
-
-static const value_string wtls_vals_certificate_signature[] = {
-	{ 0, "Anonymous" },
-	{ 1, "ECDSA_SHA" },
-	{ 2, "RSA_SHA" },
-	{ 0x00, NULL }
-};
-
-static const value_string wtls_vals_public_key_type[] = {
-	{ 2, "RSA" },
-	{ 3, "ECDH" },
-	{ 4, "ECSA" },
-	{ 0x00, NULL }
-};
-
-static const value_string wtls_vals_alert_level[] = {
-	{ 1, "Warning" },
-	{ 2, "Critical" },
-	{ 3, "Fatal" },
-	{ 0x00, NULL }
-};
 
-static const value_string wtls_vals_alert_description[] = {
-	{ 0,"connection_close_notify"},
-	{ 1,"session_close_notify"},
-	{ 5,"no_connection"},
-	{ 10,"unexpected_message"},
-	{ 11,"time_required"},
-	{ 20,"bad_record_mac"},
-	{ 21,"decryption_failed"},
-	{ 22,"record_overflow"},
-	{ 30,"decompression_failure"},
-	{ 40,"handshake_failure"},
-	{ 42,"bad_certificate"},
-	{ 43,"unsupported_certificate"},
-	{ 44,"certificate_revoked"},
-	{ 45,"certificate_expired"},
-	{ 46,"certificate_unknown"},
-	{ 47,"illegal_parameter"},
-	{ 48,"unknown_ca"},
-	{ 49,"access_denied"},
-	{ 50,"decode_error"},
-	{ 51,"decrypt_error"},
-	{ 52,"unknown_key_id"},
-	{ 53,"disabled_key_id"},
-	{ 54,"key_exchange_disabled"},
-	{ 55,"session_not_ready"},
-	{ 56,"unknown_parameter_index"},
-	{ 57,"duplicate_finished_received"},
-	{ 60,"export_restriction"},
-	{ 70,"protocol_version"},
-	{ 71,"insufficient_security"},
-	{ 80,"internal_error"},
-	{ 90,"user_canceled"},
-	{ 100,"no_renegotiation"},
-	{ 0x00, NULL }
-};
-
-
 /*
  * Windows appears to define DELETE.
  */
@@ -867,95 +411,18 @@
 	PUT				= 0x61,			/* No sample data */
 };
 
-#define WTLS_RECORD_TYPE_LENGTH 	0x80
-#define WTLS_RECORD_TYPE_SEQUENCE 	0x40
-#define WTLS_RECORD_TYPE_CIPHER_CUR 	0x20
-#define WTLS_RECORD_CONTENT_TYPE 	0x0f
-
-#define WTLS_ALERT 			0x02
-#define WTLS_PLAIN_HANDSHAKE 		0x03
-
-#define WTLS_HANDSHAKE_CLIENT_HELLO	1
-#define WTLS_HANDSHAKE_SERVER_HELLO	2
-#define WTLS_HANDSHAKE_CERTIFICATE	11
-
-#define CERTIFICATE_WTLS		1
-#define CERTIFICATE_X509		2
-#define CERTIFICATE_X968		3
-#define CERTIFICATE_URL			4
-
-#define IDENTIFIER_NULL			0
-#define IDENTIFIER_TEXT			1
-#define IDENTIFIER_BIN			2
-#define IDENTIFIER_SHA_1		254
-#define IDENTIFIER_X509			255
-
-#define PUBLIC_KEY_RSA			2
-#define PUBLIC_KEY_ECDH			3
-#define PUBLIC_KEY_ECDSA		4
-
 static void add_uri (proto_tree *, tvbuff_t *, guint, guint);
 static void add_headers (proto_tree *, tvbuff_t *);
 static void add_header (proto_tree *, tvbuff_t *, tvbuff_t *);
 static guint get_value_length (tvbuff_t *, guint, guint *);
 static guint add_content_type (proto_tree *, tvbuff_t *, guint, guint *);
+static gint get_date_value (tvbuff_t * ,guint ,struct timeval *);
+static void add_date_value (tvbuff_t * ,guint ,proto_tree * ,int ,
+	tvbuff_t * ,guint ,guint ,struct timeval *, const char *);
 static guint add_parameter (proto_tree *, tvbuff_t *, guint);
 static guint add_parameter_charset (proto_tree *, tvbuff_t *, guint, guint);
 static void add_post_data (proto_tree *, tvbuff_t *, guint);
 static void add_post_variable (proto_tree *, tvbuff_t *, guint, guint, guint, guint);
-static void dissect_wtls_handshake (proto_tree *, tvbuff_t *, guint, guint);
-
-/* 
- * Accessor to retrieve variable length int as used in WAP protocol.
- * The value is encoded in the lower 7 bits. If the top bit is set, then the
- * value continues into the next byte.
- * The octetCount parameter holds the number of bytes read in order to return
- * the final value. Can be pre-initialised to start at offset+count.
-*/
-static guint
-tvb_get_guintvar (tvbuff_t *tvb, guint offset, guint *octetCount)
-{
-	guint value = 0;
-	guint octet;
-	guint counter = 0;
-	char cont = 1;
-	
-	if (octetCount == NULL)
-	{
-#ifdef DEBUG
-		fprintf (stderr, "dissect_wsp: Starting tvb_get_guintvar at offset %d, count=NULL\n", offset);
-#endif
-	}
-	else
-	{
-#ifdef DEBUG
-		fprintf (stderr, "dissect_wsp: Starting tvb_get_guintvar at offset %d, count=%d\n", offset, *octetCount);
-#endif
-		counter = *octetCount;
-	}
-
-	while (cont != 0)
-	{
-		value<<=7;	/* Value only exists in 7 of the 8 bits */
-		octet = tvb_get_guint8 (tvb, offset+counter);
-		counter++;
-		value += (octet & 0x7F);
-		cont = (octet & 0x80);
-#ifdef DEBUG
-		fprintf (stderr, "dissect_wsp: octet is %d (0x%02x), count=%d, value=%d, cont=%d\n", octet, octet, counter, value, cont);
-#endif
-	}
-
-	if (octetCount != NULL)
-	{
-		*octetCount = counter;
-#ifdef DEBUG
-		fprintf (stderr, "dissect_wsp: Leaving tvb_get_guintvar count=%d\n", *octetCount);
-#endif
-	}
-
-	return (value);
-}
 
 /* Code to actually dissect the packets */
 static void
@@ -985,22 +452,42 @@
 /*	proto_tree *wsp_header_fixed; */
 	proto_tree *wsp_capabilities;
 	
+	CHECK_DISPLAY_AS_DATA(proto_wsp, tvb, pinfo, tree);
+
+	pinfo->current_proto = "WSP";
+
+/* This field shows up as the "Info" column in the display; you should make
+   it, if possible, summarize what's in the packet, so that a user looking
+   at the list of packets can tell what type of packet it is. */
+    
+	/* Display protocol type depending on the port */
 	if (check_col(fdata, COL_PROTOCOL)) 
 	{
-		col_set_str(fdata, COL_PROTOCOL, "WSP" );
+		switch ( pinfo->match_port )
+		{
+			case UDP_PORT_WSP:
+				col_set_str(fdata, COL_PROTOCOL, "WSP" );
+				break;
+			case UDP_PORT_WTLS_WSP:
+				col_set_str(fdata, COL_PROTOCOL, "WTLS+WSP" );
+				break;
+		}
 	}
-	if (check_col(fdata, COL_INFO)) {
-		col_clear(fdata, COL_INFO);
-	};
 
 	/* Connection-less mode has a TID first */
-	offset++;
+	if (	(pinfo->match_port == UDP_PORT_WSP) ||
+			(pinfo->match_port == UDP_PORT_WTLS_WSP))
+	{
+		offset++;
+	};
 
 	/* Find the PDU type */
 	pdut = tvb_get_guint8 (tvb, offset);
 
 	/* Develop the string to put in the Info column */
-	if (check_col(fdata, COL_INFO)) {
+	if (check_col(fdata, COL_INFO))
+	{
+		col_clear(fdata, COL_INFO);
 		col_add_fstr(fdata, COL_INFO, "WSP %s",
 			val_to_str (pdut, vals_pdu_type, "Unknown PDU type (0x%02x)"));
 	};
@@ -1014,712 +501,169 @@
 
 /* Code to process the packet goes here */
 /*
-		wsp_header_fixed = proto_item_add_subtree(ti, ett_header);
+			wsp_header_fixed = proto_item_add_subtree(ti, ett_header );
 */
-
-		/* Add common items: only TID and PDU Type */
-
-		/* TID Field is always first (if it exists) */
-		ti = proto_tree_add_item (wsp_tree, hf_wsp_header_tid,tvb,0,1,bo_little_endian);
-
-		ti = proto_tree_add_item(
-				wsp_tree, 		/* tree */
-				hf_wsp_header_pdu_type, 	/* id */
-				tvb, 
-				offset++, 			/* start of high light */
-				1,				/* length of high light */
-				bo_little_endian				/* value */
-		     );
-
-		switch (pdut)
-		{
-		case CONNECT:
-			ti = proto_tree_add_item (wsp_tree, hf_wsp_version_major,tvb,offset,1,bo_little_endian);
-			ti = proto_tree_add_item (wsp_tree, hf_wsp_version_minor,tvb,offset,1,bo_little_endian);
-			offset++;
-			capabilityStart = offset;
-			capabilityLength = tvb_get_guintvar (tvb, offset, &count);
-			offset += count;
-			ti = proto_tree_add_uint (wsp_tree, hf_wsp_capability_length,tvb,capabilityStart,count,capabilityLength);
-
-			count = 0;
-			headerStart = offset;
-			headerLength = tvb_get_guintvar (tvb, offset, &count);
-			offset += count;
-			ti = proto_tree_add_uint (wsp_tree, hf_wsp_header_length,tvb,headerStart,count,headerLength);
-			if (capabilityLength > 0)
-			{
-				ti = proto_tree_add_item (wsp_tree, hf_wsp_capabilities_section,tvb,offset,capabilityLength,bo_little_endian);
-				wsp_capabilities = proto_item_add_subtree( ti, ett_capabilities );
-				offset += capabilityLength;
-			}
-
-			if (headerLength > 0)
-			{
-				tmp_tvb = tvb_new_subset (tvb, offset, headerLength, headerLength);
-				add_headers (wsp_tree, tmp_tvb);
-			}
-
-			break;
-
-		case CONNECTREPLY:
-			value = tvb_get_guintvar (tvb, offset, &count);
-			ti = proto_tree_add_uint (wsp_tree, hf_wsp_server_session_id,tvb,offset,count,value);
-			offset += count;
-
-			count = 0;
-			capabilityStart = offset;
-			capabilityLength = tvb_get_guintvar (tvb, offset, &count);
-			offset += count;
-			ti = proto_tree_add_uint (wsp_tree, hf_wsp_capability_length,tvb,capabilityStart,count,capabilityLength);
-
-			count = 0;
-			headerStart = offset;
-			headerLength = tvb_get_guintvar (tvb, offset, &count);
-			offset += count;
-			ti = proto_tree_add_uint (wsp_tree, hf_wsp_header_length,tvb,headerStart,count,headerLength);
-			if (capabilityLength > 0)
-			{
-				ti = proto_tree_add_item (wsp_tree, hf_wsp_capabilities_section,tvb,offset,capabilityLength,bo_little_endian);
-				wsp_capabilities = proto_item_add_subtree( ti, ett_capabilities );
-				offset += capabilityLength;
-			}
-
-			if (headerLength > 0)
-			{
-				/*
-				ti = proto_tree_add_item (wsp_tree, hf_wsp_headers_section,tvb,offset,headerLength,bo_little_endian);
-				wsp_headers = proto_item_add_subtree( ti, ett_headers );
-				*/
-				tmp_tvb = tvb_new_subset (tvb, offset, headerLength, headerLength);
-				add_headers (wsp_tree, tmp_tvb);
-			}
-
-			break;
-
-		case DISCONNECT:
-			value = tvb_get_guintvar (tvb, offset, &count);
-			ti = proto_tree_add_uint (wsp_tree, hf_wsp_server_session_id,tvb,offset,count,value);
-			break;
-
-		case GET:
-			/* Length of URI and size of URILen field */
-			count = 0;
-			value = tvb_get_guintvar (tvb, offset, &count);
-			nextOffset = offset + count;
-			add_uri (wsp_tree, tvb, offset, nextOffset);
-			offset += (value+count);
-			tmp_tvb = tvb_new_subset (tvb, offset, -1, -1);
-			add_headers (wsp_tree, tmp_tvb);
-			break;
-
-		case POST:
-			/* Length of URI and size of URILen field */
-			uriStart = offset;
-			uriLength = tvb_get_guintvar (tvb, offset, &count);
-			headerStart = uriStart+count;
-			count = 0;
-			headersLength = tvb_get_guintvar (tvb, headerStart, &count);
-			offset = headerStart + count;
-
-			add_uri (wsp_tree, tvb, uriStart, offset);
-			offset += uriLength;
-
-			ti = proto_tree_add_item (wsp_tree, hf_wsp_header_length,tvb,headerStart,count,bo_little_endian);
-
-			contentTypeStart = offset;
-			nextOffset = add_content_type (wsp_tree, tvb, offset, &contentType);
-
-			/* Add headers subtree that will hold the headers fields */
-			/* Runs from nextOffset for value-(length of content-type field)*/
-			headerLength = headersLength-(nextOffset-contentTypeStart);
-			tmp_tvb = tvb_new_subset (tvb, nextOffset, headerLength, headerLength);
-			add_headers (wsp_tree, tmp_tvb);
-
-			/* TODO: Post DATA */
-			/* Runs from start of headers+headerLength to END_OF_FRAME */
-			offset = nextOffset+headerLength;
-			tmp_tvb = tvb_new_subset (tvb, offset, tvb_reported_length (tvb)-offset, tvb_reported_length (tvb)-offset);
-			add_post_data (wsp_tree, tmp_tvb, contentType);
-			break;
-
-		case REPLY:
-			ti = proto_tree_add_item (wsp_tree, hf_wsp_header_status,tvb,offset,1,bo_little_endian);
-			value = tvb_get_guintvar (tvb, offset+1, &count);
-			nextOffset = offset + 1 + count;
-			
-			ti = proto_tree_add_uint (wsp_tree, hf_wsp_header_length,tvb,offset+1,count,value);
-
-			contentTypeStart = nextOffset;
-			nextOffset = add_content_type (wsp_tree, tvb, nextOffset, &contentType);
-
-			/* Add headers subtree that will hold the headers fields */
-			/* Runs from nextOffset for value-(length of content-type field)*/
-			headerLength = value-(nextOffset-contentTypeStart);
-			tmp_tvb = tvb_new_subset (tvb, nextOffset, headerLength, headerLength);
-			add_headers (wsp_tree, tmp_tvb);
-			offset += count+value+1;
-
-			/* TODO: Data - decode WMLC */
-			/* Runs from offset+1+count+value+1 to END_OF_FRAME */
-			if (offset < tvb_reported_length (tvb))
-			{
-				ti = proto_tree_add_item (wsp_tree, hf_wsp_reply_data,tvb,offset,tvb_reported_length(tvb)-offset,bo_little_endian);
-			}
-			break;
-		}
-	}
-}
-
-/* Code to actually dissect the packets */
-static void
-dissect_wtls(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
-{
-	frame_data *fdata = pinfo->fd;
-	int offset = 0;
-
-	char pdut;
-	char pdu_msg_type;
-	guint count = 0;
-	guint offset_wtls = 0;
 
-/* Set up structures we will need to add the protocol subtree and manage it */
-	proto_item *ti;
-	proto_tree *wtls_tree;
-	proto_tree *wtls_rec_tree;
-	proto_tree *wtls_msg_type_tree;
-
-	if (check_col(fdata, COL_PROTOCOL)) 
-	{
-		col_set_str(fdata, COL_PROTOCOL, "WTLS+WSP" );
-	}
-
-	/* Develop the string to put in the Info column */
-	if (check_col(fdata, COL_INFO)) {
-		col_set_str(fdata, COL_INFO, "WTLS" );
-	};
-
-	/* In the interest of speed, if "tree" is NULL, don't do any work not
-	necessary to generate protocol tree items. */
-
-	if (tree) {
-		ti = proto_tree_add_item(tree, proto_wtls, tvb, offset_wtls,
-				 tvb_length(tvb), bo_little_endian);
-		wtls_tree = proto_item_add_subtree(ti, ett_wsp);
+			/* Add common items: only TID and PDU Type */
 
-		for (offset_wtls=0; offset_wtls < (tvb_length(tvb)-1);) {
-			pdut = tvb_get_guint8 (tvb, offset_wtls);
-
-			offset = offset_wtls+1;
-
-			if (pdut & WTLS_RECORD_TYPE_SEQUENCE) {
-				offset+=2;
-			}
-			if (pdut & WTLS_RECORD_TYPE_LENGTH) {
-				count = tvb_get_ntohs(tvb, offset);
-				offset+=2;
-				count += offset-offset_wtls;
-			}
-			else {
-				count = tvb_length (tvb)-offset_wtls;
-			}
-			ti = proto_tree_add_uint(wtls_tree, hf_wtls_record, tvb, offset_wtls,
-				 count, pdut);
-			wtls_rec_tree = proto_item_add_subtree(ti, ett_wtls_rec);
+			/* If this is connectionless, then the TID Field is always first */
+			if (	(pinfo->match_port == UDP_PORT_WSP) ||
+					(pinfo->match_port == UDP_PORT_WTLS_WSP))
+			{
+				ti = proto_tree_add_item (wsp_tree, hf_wsp_header_tid,tvb,
+					0,1,bo_little_endian);
+			}
+
+			ti = proto_tree_add_item(
+					wsp_tree, 		/* tree */
+					hf_wsp_header_pdu_type, 	/* id */
+					tvb, 
+					offset++, 			/* start of high light */
+					1,				/* length of high light */
+					bo_little_endian				/* value */
+			     );
+
+			switch (pdut)
+			{
+				case CONNECT:
+					ti = proto_tree_add_item (wsp_tree, hf_wsp_version_major,tvb,offset,1,bo_little_endian);
+					ti = proto_tree_add_item (wsp_tree, hf_wsp_version_minor,tvb,offset,1,bo_little_endian);
+					offset++;
+					capabilityStart = offset;
+					count = 0;	/* Initialise count */
+					capabilityLength = tvb_get_guintvar (tvb, offset, &count);
+					offset += count;
+					ti = proto_tree_add_uint (wsp_tree, hf_wsp_capability_length,tvb,capabilityStart,count,capabilityLength);
+
+					headerStart = offset;
+					count = 0;	/* Initialise count */
+					headerLength = tvb_get_guintvar (tvb, offset, &count);
+					offset += count;
+					ti = proto_tree_add_uint (wsp_tree, hf_wsp_header_length,tvb,headerStart,count,headerLength);
+					if (capabilityLength > 0)
+					{
+						ti = proto_tree_add_item (wsp_tree, hf_wsp_capabilities_section,tvb,offset,capabilityLength,bo_little_endian);
+						wsp_capabilities = proto_item_add_subtree( ti, ett_capabilities );
+						offset += capabilityLength;
+					}
 
-			offset = offset_wtls;
+					if (headerLength > 0)
+					{
+						tmp_tvb = tvb_new_subset (tvb, offset, headerLength, headerLength);
+						add_headers (wsp_tree, tmp_tvb);
+					}
 
-			ti = proto_tree_add_item (wtls_rec_tree, hf_wtls_record_type,
-					tvb,offset,1,bo_big_endian);
+					break;
 
-			offset++;
+				case CONNECTREPLY:
+					count = 0;	/* Initialise count */
+					value = tvb_get_guintvar (tvb, offset, &count);
+					ti = proto_tree_add_uint (wsp_tree, hf_wsp_server_session_id,tvb,offset,count,value);
+					offset += count;
+
+					capabilityStart = offset;
+					count = 0;	/* Initialise count */
+					capabilityLength = tvb_get_guintvar (tvb, offset, &count);
+					offset += count;
+					ti = proto_tree_add_uint (wsp_tree, hf_wsp_capability_length,tvb,capabilityStart,count,capabilityLength);
+
+					headerStart = offset;
+					count = 0;	/* Initialise count */
+					headerLength = tvb_get_guintvar (tvb, offset, &count);
+					offset += count;
+					ti = proto_tree_add_uint (wsp_tree, hf_wsp_header_length,tvb,headerStart,count,headerLength);
+					if (capabilityLength > 0)
+					{
+						ti = proto_tree_add_item (wsp_tree, hf_wsp_capabilities_section,tvb,offset,capabilityLength,bo_little_endian);
+						wsp_capabilities = proto_item_add_subtree( ti, ett_capabilities );
+						offset += capabilityLength;
+					}
 
-			offset_wtls += count;
+					if (headerLength > 0)
+					{
 
-			if (pdut & WTLS_RECORD_TYPE_SEQUENCE) {
-				ti = proto_tree_add_item (wtls_rec_tree, hf_wtls_record_sequence,
-						tvb,offset,2,bo_big_endian);
-				offset+=2;
-			}
-			if (pdut & WTLS_RECORD_TYPE_LENGTH) {
-				count = tvb_get_ntohs(tvb, offset);
-				ti = proto_tree_add_item (wtls_rec_tree, hf_wtls_record_length,
-						tvb,offset,2,bo_big_endian);
-				offset+=2;
-			}
-			else {
-				count = tvb_length (tvb)-offset;
-			}
+						/*
+						ti = proto_tree_add_item (wsp_tree, hf_wsp_headers_section,tvb,offset,headerLength,bo_little_endian);
+						wsp_headers = proto_item_add_subtree( ti, ett_headers );
+						*/
+						tmp_tvb = tvb_new_subset (tvb, offset, headerLength, headerLength);
+						add_headers (wsp_tree, tmp_tvb);
+					}
 
-			if (pdut & WTLS_RECORD_TYPE_CIPHER_CUR) {
-				ti = proto_tree_add_item (wtls_rec_tree, hf_wtls_record_ciphered,
-						tvb,offset,count,bo_big_endian);
-				continue;
-			}
+					break;
 
-			switch (pdut & WTLS_RECORD_CONTENT_TYPE) {
-				case WTLS_PLAIN_HANDSHAKE :
-					dissect_wtls_handshake(wtls_rec_tree,tvb,offset,count);
+				case DISCONNECT:
+					count = 0;	/* Initialise count */
+					value = tvb_get_guintvar (tvb, offset, &count);
+					ti = proto_tree_add_uint (wsp_tree, hf_wsp_server_session_id,tvb,offset,count,value);
 					break;
-				case WTLS_ALERT :
-					ti = proto_tree_add_item(wtls_rec_tree, hf_wtls_alert, tvb, offset,
-							 count, bo_little_endian);
-					wtls_msg_type_tree = proto_item_add_subtree(ti, ett_wtls_msg_type);
-					pdu_msg_type = tvb_get_guint8 (tvb, offset);
-					ti = proto_tree_add_item (wtls_msg_type_tree, hf_wtls_alert_level,
-							tvb,offset,1,bo_big_endian);
-					offset+=1;
-					count = tvb_get_ntohs (tvb, offset);
-					ti = proto_tree_add_item (wtls_msg_type_tree, hf_wtls_alert_description,
-							tvb,offset,1,bo_big_endian);
-					offset+=1;
-				default:
-					offset+=count;
+
+				case GET:
+					count = 0;	/* Initialise count */
+					/* Length of URI and size of URILen field */
+					value = tvb_get_guintvar (tvb, offset, &count);
+					nextOffset = offset + count;
+					add_uri (wsp_tree, tvb, offset, nextOffset);
+					offset += (value+count); /* VERIFY */
+					tmp_tvb = tvb_new_subset (tvb, offset, -1, -1);
+					add_headers (wsp_tree, tmp_tvb);
 					break;
-			}
-		}
-	}
-}
 
-static void
-dissect_wtls_handshake(proto_tree *tree, tvbuff_t *tvb, guint offset, guint count)
-{
-	char pdu_msg_type;
-	struct timeval timeValue;
-	int client_size = 0;
-	guint value = 0;
-	guint value_exponent;
-	int size = 0;
-	guint public_key = 0;
-	guint signature = 0;
-	char *newBuffer;
+				case POST:
+					uriStart = offset;
+					count = 0;	/* Initialise count */
+					uriLength = tvb_get_guintvar (tvb, offset, &count);
+					headerStart = uriStart+count;
+					count = 0;	/* Initialise count */
+					headersLength = tvb_get_guintvar (tvb, headerStart, &count);
+					offset = headerStart + count;
+
+					add_uri (wsp_tree, tvb, uriStart, offset);
+					offset += uriLength;
+
+					ti = proto_tree_add_item (wsp_tree, hf_wsp_header_length,tvb,headerStart,count,bo_little_endian);
+
+					contentTypeStart = offset;
+					nextOffset = add_content_type (wsp_tree, tvb, offset, &contentType);
+
+					/* Add headers subtree that will hold the headers fields */
+					/* Runs from nextOffset for value-(length of content-type field)*/
+					headerLength = headersLength-(nextOffset-contentTypeStart);
+					tmp_tvb = tvb_new_subset (tvb, nextOffset, headerLength, headerLength);
+					add_headers (wsp_tree, tmp_tvb);
+
+					/* TODO: Post DATA */
+					/* Runs from start of headers+headerLength to END_OF_FRAME */
+					offset = nextOffset+headerLength;
+					tmp_tvb = tvb_new_subset (tvb, offset, tvb_reported_length (tvb)-offset, tvb_reported_length (tvb)-offset);
+					add_post_data (wsp_tree, tmp_tvb, contentType);
+					break;
 
-	proto_item *ti;
-	proto_item *cli_key_item;
-	proto_tree *wtls_msg_type_tree;
-	proto_tree *wtls_msg_type_item_tree;
-	proto_tree *wtls_msg_type_item_sub_tree;
-	proto_tree *wtls_msg_type_item_sub_sub_tree;
-
-	pdu_msg_type = tvb_get_guint8 (tvb, offset);
-	ti = proto_tree_add_uint(tree, hf_wtls_hands, tvb, offset,count, pdu_msg_type);
-	wtls_msg_type_tree = proto_item_add_subtree(ti, ett_wtls_msg_type);
-	
-	ti = proto_tree_add_item (wtls_msg_type_tree, hf_wtls_hands_type,
-			tvb,offset,1,bo_big_endian);
-	offset+=1;
-	count = tvb_get_ntohs (tvb, offset);
-	ti = proto_tree_add_item (wtls_msg_type_tree, hf_wtls_hands_length,
-			tvb,offset,2,bo_big_endian);
-	offset+=2;
-	switch(pdu_msg_type) {
-		case WTLS_HANDSHAKE_CLIENT_HELLO :
-			ti = proto_tree_add_item(wtls_msg_type_tree, hf_wtls_hands_cli_hello, tvb, offset,
-					 count, bo_little_endian);
-			wtls_msg_type_item_tree = proto_item_add_subtree(ti, ett_wtls_msg_type_item);
-			ti = proto_tree_add_item (wtls_msg_type_item_tree, hf_wtls_hands_cli_hello_version,
-					tvb,offset,1,bo_big_endian);
-			offset++;
-			timeValue.tv_sec = tvb_get_ntohl (tvb, offset);
-			timeValue.tv_usec = 0;
-			ti = proto_tree_add_time (wtls_msg_type_item_tree, hf_wtls_hands_cli_hello_gmt, tvb,
-					offset, 4, &timeValue);
-			offset+=4;
-			ti = proto_tree_add_item (wtls_msg_type_item_tree, hf_wtls_hands_cli_hello_random,
-					tvb,offset,12,bo_big_endian);
-			offset+=12;
-			count = tvb_get_guint8(tvb, offset);
-			ti = proto_tree_add_item (wtls_msg_type_item_tree, hf_wtls_hands_cli_hello_session,
-					tvb,offset,count+1,bo_big_endian);
-			offset+=1+count;
-			count = tvb_get_ntohs (tvb, offset);
-			ti = proto_tree_add_item(wtls_msg_type_item_tree, 
-					hf_wtls_hands_cli_hello_cli_key_id, tvb, offset,
-					 count+2, bo_little_endian);
-			wtls_msg_type_item_sub_tree = proto_item_add_subtree(ti, ett_wtls_msg_type_item_sub);
-			offset+=2;
-			for (;count > 0;count-=client_size) {
-				cli_key_item = proto_tree_add_uint(wtls_msg_type_item_sub_tree, 
-						hf_wtls_hands_cli_hello_key_exchange, tvb, offset,1,
-						tvb_get_guint8 (tvb,offset));
-				client_size=1;
-				wtls_msg_type_item_sub_sub_tree = proto_item_add_subtree(cli_key_item, 
-								  ett_wtls_msg_type_item_sub_sub);
-				ti = proto_tree_add_item(wtls_msg_type_item_sub_sub_tree,
-						hf_wtls_hands_cli_hello_key_exchange_suite,
-						tvb,offset,1,bo_big_endian);
-				offset++;
-				value = tvb_get_guint8 (tvb, offset);
-				ti = proto_tree_add_item(wtls_msg_type_item_sub_sub_tree,
-					hf_wtls_hands_cli_hello_key_parameter_index,
-					tvb,offset,1,bo_big_endian);
-				offset++;
-				client_size++;
-				if (value == 0xff) {
-					size = tvb_get_ntohs (tvb, offset);
-					ti = proto_tree_add_item(wtls_msg_type_item_sub_sub_tree,
-						hf_wtls_hands_cli_hello_key_parameter_set,
-						tvb,offset,size+2,bo_big_endian);
-					offset+=size+2;
-					client_size+=size+2;
-				}
-				value = tvb_get_guint8 (tvb, offset);
-				ti = proto_tree_add_item(wtls_msg_type_item_sub_sub_tree,
-						hf_wtls_hands_cli_hello_key_identifier_type,
-						tvb,offset,1,bo_big_endian);
-				offset++;
-				client_size++;
-				proto_item_set_len(cli_key_item, client_size);
-			}
-			count = tvb_get_ntohs (tvb, offset);
-			ti = proto_tree_add_item(wtls_msg_type_item_tree, 
-					hf_wtls_hands_cli_hello_trust_key_id, tvb, offset,
-					 count+2, bo_little_endian);
-			wtls_msg_type_item_sub_tree = proto_item_add_subtree(ti, ett_wtls_msg_type_item_sub);
-			offset+=2;
-			for (;count > 0;count-=client_size) {
-				cli_key_item = proto_tree_add_item(wtls_msg_type_item_sub_tree, 
-						hf_wtls_hands_cli_hello_key_exchange, tvb, offset,1,
-						bo_little_endian);
-				client_size=1;
-				wtls_msg_type_item_sub_sub_tree = proto_item_add_subtree(cli_key_item, 
-								  ett_wtls_msg_type_item_sub_sub);
-				ti = proto_tree_add_item(wtls_msg_type_item_sub_sub_tree,
-						hf_wtls_hands_cli_hello_key_exchange_suite,
-						tvb,offset,1,bo_big_endian);
-				offset++;
-				value = tvb_get_guint8 (tvb, offset);
-				ti = proto_tree_add_item(wtls_msg_type_item_sub_sub_tree,
-					hf_wtls_hands_cli_hello_key_parameter_index,
-					tvb,offset,1,bo_big_endian);
-				offset++;
-				client_size++;
-				if (value == 0xff) {
-					size = tvb_get_ntohs (tvb, offset);
-					ti = proto_tree_add_item(wtls_msg_type_item_sub_sub_tree,
-						hf_wtls_hands_cli_hello_key_parameter_set,
-						tvb,offset,size+2,bo_big_endian);
-					offset+=size+2;
-					client_size+=size+2;
-				}
-				value = tvb_get_guint8 (tvb, offset);
-				ti = proto_tree_add_item(wtls_msg_type_item_sub_sub_tree,
-						hf_wtls_hands_cli_hello_key_identifier_type,
-						tvb,offset,1,bo_big_endian);
-				offset++;
-				client_size++;
-				proto_item_set_len(cli_key_item, client_size);
-			}
-			count = tvb_get_guint8 (tvb, offset);
-			ti = proto_tree_add_item(wtls_msg_type_item_tree, 
-					hf_wtls_hands_cli_hello_cipher_suite, tvb, offset,
-					 count+1, bo_little_endian);
-			wtls_msg_type_item_sub_tree = proto_item_add_subtree(ti, ett_wtls_msg_type_item_sub);
-			offset+=1;
-			for (;count > 0;count-=client_size) {
-				cli_key_item = proto_tree_add_item(wtls_msg_type_item_sub_tree, 
-						hf_wtls_hands_cli_hello_cipher_suite_item, tvb, offset,1,
-						bo_little_endian);
-				client_size=1;
-				wtls_msg_type_item_sub_sub_tree = proto_item_add_subtree(cli_key_item, 
-								  ett_wtls_msg_type_item_sub_sub);
-				ti = proto_tree_add_item(wtls_msg_type_item_sub_sub_tree,
-						hf_wtls_hands_cli_hello_cipher_bulk,
-						tvb,offset,1,bo_big_endian);
-				offset++;
-				value = tvb_get_guint8 (tvb, offset);
-				ti = proto_tree_add_item(wtls_msg_type_item_sub_sub_tree,
-					hf_wtls_hands_cli_hello_cipher_mac,
-					tvb,offset,1,bo_big_endian);
-				offset++;
-				client_size++;
-				proto_item_set_len(cli_key_item, client_size);
-			}
-			count = tvb_get_guint8 (tvb, offset);
-			ti = proto_tree_add_item(wtls_msg_type_item_tree, 
-					hf_wtls_hands_cli_hello_compression_methods, tvb, offset,
-					 count+1, bo_little_endian);
-			wtls_msg_type_item_sub_tree = proto_item_add_subtree(ti, ett_wtls_msg_type_item_sub);
-			offset+=1;
-			for (;count > 0;count-=client_size) {
-				client_size=0;
-				ti = proto_tree_add_item(wtls_msg_type_item_sub_tree, 
-						hf_wtls_hands_cli_hello_compression, tvb, offset,1,
-						bo_little_endian);
-				offset++;
-				client_size++;
-			}
-			ti = proto_tree_add_item(wtls_msg_type_item_tree, 
-					hf_wtls_hands_cli_hello_sequence_mode, tvb, offset,
-					 1, bo_little_endian);
-			offset++;
-			ti = proto_tree_add_item(wtls_msg_type_item_tree, 
-					hf_wtls_hands_cli_hello_key_refresh, tvb, offset,
-					 1, bo_little_endian);
-			break;
-		case WTLS_HANDSHAKE_SERVER_HELLO :
-			ti = proto_tree_add_item(wtls_msg_type_tree, hf_wtls_hands_serv_hello, tvb, offset,
-					 count, bo_little_endian);
-			wtls_msg_type_item_tree = proto_item_add_subtree(ti, ett_wtls_msg_type_item);
-			ti = proto_tree_add_item (wtls_msg_type_item_tree, hf_wtls_hands_serv_hello_version,
-					tvb,offset,1,bo_big_endian);
-			offset++;
-			timeValue.tv_sec = tvb_get_ntohl (tvb, offset);
-			timeValue.tv_usec = 0;
-			ti = proto_tree_add_time (wtls_msg_type_item_tree, hf_wtls_hands_serv_hello_gmt, tvb,
-					offset, 4, &timeValue);
-			offset+=4;
-			ti = proto_tree_add_item (wtls_msg_type_item_tree, hf_wtls_hands_serv_hello_random,
-					tvb,offset,12,bo_big_endian);
-			offset+=12;
-			count = tvb_get_guint8(tvb, offset);
-			ti = proto_tree_add_item (wtls_msg_type_item_tree, hf_wtls_hands_serv_hello_session,
-					tvb,offset,count+1,bo_big_endian);
-			offset+=1+count;
-			ti = proto_tree_add_item(wtls_msg_type_item_tree,
-					hf_wtls_hands_serv_hello_cli_key_id,
-					tvb,offset,1,bo_big_endian);
-			offset++;
-			cli_key_item = proto_tree_add_item(wtls_msg_type_item_tree, 
-					hf_wtls_hands_serv_hello_cipher_suite_item, tvb, offset,2,
-					bo_little_endian);
-			wtls_msg_type_item_sub_tree = proto_item_add_subtree(cli_key_item, 
-							  ett_wtls_msg_type_item_sub);
-			ti = proto_tree_add_item(wtls_msg_type_item_sub_tree,
-					hf_wtls_hands_serv_hello_cipher_bulk,
-					tvb,offset,1,bo_big_endian);
-			offset++;
-			value = tvb_get_guint8 (tvb, offset);
-			ti = proto_tree_add_item(wtls_msg_type_item_sub_tree,
-				hf_wtls_hands_serv_hello_cipher_mac,
-				tvb,offset,1,bo_big_endian);
-			offset++;
-			ti = proto_tree_add_item(wtls_msg_type_item_tree, 
-					hf_wtls_hands_serv_hello_compression, tvb, offset,1,
-					bo_little_endian);
-			offset++;
-			ti = proto_tree_add_item(wtls_msg_type_item_tree, 
-					hf_wtls_hands_serv_hello_sequence_mode, tvb, offset,
-					 1, bo_little_endian);
-			offset++;
-			ti = proto_tree_add_item(wtls_msg_type_item_tree, 
-					hf_wtls_hands_serv_hello_key_refresh, tvb, offset,
-					 1, bo_little_endian);
-			offset++;
-			break;
-		case WTLS_HANDSHAKE_CERTIFICATE :
-			ti = proto_tree_add_item(wtls_msg_type_tree, hf_wtls_hands_certificates,
-					tvb, offset,count, bo_little_endian);
-			wtls_msg_type_item_tree = proto_item_add_subtree(ti, ett_wtls_msg_type_item);
-			count = tvb_get_ntohs (tvb, offset);
-			offset+=2;
-			for (;count > 0;count-=client_size) {
-				cli_key_item = proto_tree_add_item(wtls_msg_type_item_tree, 
-						hf_wtls_hands_certificate, tvb, offset,1,
-						bo_little_endian);
-				client_size=0;
-				wtls_msg_type_item_sub_tree = proto_item_add_subtree(cli_key_item, 
-								  ett_wtls_msg_type_item_sub);
-				proto_item_set_len(cli_key_item, client_size);
-				value =  tvb_get_guint8 (tvb, offset);
-				ti = proto_tree_add_item(wtls_msg_type_item_sub_tree, 
-						hf_wtls_hands_certificate_type, tvb, offset,1,
-						bo_little_endian);
-				offset++;
-				client_size++;
-				switch(value) {
-					case CERTIFICATE_WTLS:
-						ti = proto_tree_add_item(wtls_msg_type_item_sub_tree, 
-							hf_wtls_hands_certificate_wtls_version,
-							tvb, offset,1,
-							bo_little_endian);
-						offset++;
-						client_size++;
-						signature =  tvb_get_guint8 (tvb, offset);
-						ti = proto_tree_add_item(wtls_msg_type_item_sub_tree, 
-							hf_wtls_hands_certificate_wtls_signature_type,
-							tvb, offset,1,
-							bo_little_endian);
-						offset++;
-						client_size++;
-						value =  tvb_get_guint8 (tvb, offset);
-						ti = proto_tree_add_item(wtls_msg_type_item_sub_tree, 
-							hf_wtls_hands_certificate_wtls_issuer_type,
-							tvb, offset,1,
-							bo_little_endian);
-						offset++;
-						client_size++;
-						switch (value) {
-							case IDENTIFIER_NULL :
-								break;
-							case IDENTIFIER_TEXT :
-								ti = proto_tree_add_item(
-										wtls_msg_type_item_sub_tree, 
-										hf_wtls_hands_certificate_wtls_issuer_charset,
-										tvb, offset,2,
-										bo_big_endian);
-								offset+=2;
-								client_size+=2;
-								value =  tvb_get_guint8 (tvb, offset);
-								newBuffer = g_malloc (value+1);
-								strncpy (newBuffer, tvb_get_ptr (tvb, offset+1, value), value);
-								newBuffer[value] = 0;
-								ti = proto_tree_add_string(
-										wtls_msg_type_item_sub_tree, 
-										hf_wtls_hands_certificate_wtls_issuer_name,
-										tvb, offset,1+value,
-										newBuffer);
-								g_free (newBuffer);
-								offset+=1+value;
-								client_size+=1+value;
-								break;
-							case IDENTIFIER_BIN :
-								break;
-							case IDENTIFIER_SHA_1 :
-								break;
-							case IDENTIFIER_X509 :
-								break;
-						}
-						timeValue.tv_sec = tvb_get_ntohl (tvb, offset);
-						timeValue.tv_usec = 0;
-						ti = proto_tree_add_time (wtls_msg_type_item_sub_tree, 
-								hf_wtls_hands_certificate_wtls_valid_not_before,
-								tvb, offset, 4, &timeValue);
-						offset+=4;
-						client_size+=4;
-						timeValue.tv_sec = tvb_get_ntohl (tvb, offset);
-						timeValue.tv_usec = 0;
-						ti = proto_tree_add_time (wtls_msg_type_item_sub_tree, 
-								hf_wtls_hands_certificate_wtls_valid_not_after,
-								tvb, offset, 4, &timeValue);
-						offset+=4;
-						client_size+=4;
-						value =  tvb_get_guint8 (tvb, offset);
-						ti = proto_tree_add_item(wtls_msg_type_item_sub_tree, 
-							hf_wtls_hands_certificate_wtls_subject_type,
-							tvb, offset,1,
-							bo_little_endian);
-						offset++;
-						client_size++;
-						switch (value) {
-							case IDENTIFIER_NULL :
-								break;
-							case IDENTIFIER_TEXT :
-								ti = proto_tree_add_item(
-										wtls_msg_type_item_sub_tree, 
-										hf_wtls_hands_certificate_wtls_subject_charset,
-										tvb, offset,2,
-										bo_big_endian);
-								offset+=2;
-								client_size+=2;
-								value =  tvb_get_guint8 (tvb, offset);
-								newBuffer = g_malloc (value+1);
-								strncpy (newBuffer, tvb_get_ptr (tvb, offset+1, value), value);
-								newBuffer[value] = 0;
-								ti = proto_tree_add_string(
-										wtls_msg_type_item_sub_tree, 
-										hf_wtls_hands_certificate_wtls_subject_name,
-										tvb, offset,1+value,
-										newBuffer);
-								g_free (newBuffer);
-								offset+=1+value;
-								client_size+=1+value;
-								break;
-							case IDENTIFIER_BIN :
-								break;
-							case IDENTIFIER_SHA_1 :
-								break;
-							case IDENTIFIER_X509 :
-								break;
-						}
-						public_key =  tvb_get_guint8 (tvb, offset);
-						ti = proto_tree_add_item(wtls_msg_type_item_sub_tree, 
-							hf_wtls_hands_certificate_wtls_public_key_type,
-							tvb, offset,1,
-							bo_little_endian);
-						offset++;
-						client_size++;
-						value = tvb_get_guint8 (tvb, offset);
-						ti = proto_tree_add_item(wtls_msg_type_item_sub_tree,
-							hf_wtls_hands_certificate_wtls_key_parameter_index,
-							tvb,offset,1,bo_big_endian);
-						offset++;
-						client_size++;
-						if (value == 0xff) {
-							size = tvb_get_ntohs (tvb, offset);
-							ti = proto_tree_add_item(wtls_msg_type_item_sub_tree,
-								hf_wtls_hands_certificate_wtls_key_parameter_set,
-								tvb,offset,size+2,bo_big_endian);
-							offset+=size+2;
-							client_size+=size+2;
-						}
-						switch (public_key) {
-							case PUBLIC_KEY_RSA :
-								value = tvb_get_ntohs (tvb, offset);
-								switch (value)
-								{
-									case 1 :
-										value_exponent = tvb_get_guint8 (tvb, offset+2);
-										break;
-									case 2 :	
-										value_exponent = tvb_get_ntohs (tvb, offset+2);
-										break;
-									case 3 :	
-										value_exponent = tvb_get_ntoh24 (tvb, offset+2);
-										break;
-									case 4 :
-										value_exponent = tvb_get_ntohl (tvb, offset+2);
-										break;
-									default :
-										value_exponent = 0;
-										break;
-								}
-								ti = proto_tree_add_uint(wtls_msg_type_item_sub_tree,
-									hf_wtls_hands_certificate_wtls_rsa_exponent,
-									tvb,offset,value+2,value_exponent);
-								offset+=2+value;
-								client_size+=2+value;
-								value = tvb_get_ntohs (tvb, offset);
-								ti = proto_tree_add_uint(wtls_msg_type_item_sub_tree,
-									hf_wtls_hands_certificate_wtls_rsa_modules,
-									tvb,offset,value+2,value*8);
-								offset+=2+value;
-								client_size+=2+value;
-								break;
-							case PUBLIC_KEY_ECDH :
-								break;
-							case PUBLIC_KEY_ECDSA :
-								break;
-						}
-						value = tvb_get_ntohs (tvb, offset);
-						ti = proto_tree_add_uint(wtls_msg_type_item_sub_tree,
-							hf_wtls_hands_certificate_wtls_signature,
-							tvb,offset,2+value,value*8);
-						offset+=2+value;
-						client_size+=2+value;
-						break;
-					case CERTIFICATE_X509:
-					case CERTIFICATE_X968:
-						value =  tvb_get_ntohs (tvb, offset);
-						offset+=2;
-						client_size+=2;
-						client_size += value;
-						offset += value;
-						break;
-					case CERTIFICATE_URL:
-						value =  tvb_get_guint8 (tvb, offset);
-						offset++;
-						client_size++;
-						client_size += value;
-						offset += value;
-						break;
-				}
-				proto_item_set_len(cli_key_item, client_size);
+				case REPLY:
+					ti = proto_tree_add_item (wsp_tree, hf_wsp_header_status,tvb,offset,1,bo_little_endian);
+					count = 0;	/* Initialise count */
+					value = tvb_get_guintvar (tvb, offset+1, &count);
+					nextOffset = offset + 1 + count;
+					ti = proto_tree_add_uint (wsp_tree, hf_wsp_header_length,tvb,offset+1,count,value);
+
+					contentTypeStart = nextOffset;
+					nextOffset = add_content_type (wsp_tree, tvb, nextOffset, &contentType);
+
+					/* Add headers subtree that will hold the headers fields */
+					/* Runs from nextOffset for value-(length of content-type field)*/
+					headerLength = value-(nextOffset-contentTypeStart);
+					tmp_tvb = tvb_new_subset (tvb, nextOffset, headerLength, headerLength);
+					add_headers (wsp_tree, tmp_tvb);
+					offset += count+value+1;
+
+					/* TODO: Data - decode WMLC */
+					/* Runs from offset+1+count+value+1 to END_OF_FRAME */
+					if (offset < tvb_reported_length (tvb))
+					{
+						ti = proto_tree_add_item (wsp_tree, hf_wsp_reply_data,tvb,offset,END_OF_FRAME,bo_little_endian);
+					}
+					break;
 			}
-			break;
-		default: 
-			offset+=count;
-			break;
 	}
 }
 
@@ -1824,6 +768,7 @@
 #ifdef DEBUG
 			fprintf (stderr, "dissect_wsp: Looking for %d octets\n", peek);
 #endif
+			/* VERIFY: valueStart++; */
 			valueEnd = offset+1+peek;
 			offset += (peek+1);
 		}
@@ -1832,7 +777,7 @@
 #ifdef DEBUG
 			fprintf (stderr, "dissect_wsp: Looking for uintvar octets\n");
 #endif
-			count = 0;
+			count = 0;	/* Initialise count */
 			tvb_get_guintvar (tvb, valueStart, &count);
 			valueEnd = offset+1+count;
 			offset += (count+1);
@@ -1869,17 +814,23 @@
 add_header (proto_tree *tree, tvbuff_t *header_buff, tvbuff_t *value_buff)
 {
 	guint offset = 0;
+	guint valueStart = 0;
 	guint8 headerType = 0;
 	proto_item *ti;
 	guint headerLen = tvb_reported_length (header_buff);
 	guint valueLen = tvb_reported_length (value_buff);
 	guint peek = 0;
 	struct timeval timeValue;
+	guint count = 0;
 	guint value = 0;
-	guint valSize = 0;
+	guint valueLength = 0;
 	char valString[100];
-	char *valMatch;
-	guint q_value = 0;
+	char *valMatch = NULL;
+	double q_value = 1.0;
+
+	/* Initialise time values */
+	timeValue.tv_sec=0;
+	timeValue.tv_usec = 0;
 
 	headerType = tvb_get_guint8 (header_buff, 0);
 	peek = tvb_get_guint8 (value_buff, 0);
@@ -1899,393 +850,343 @@
 		headerType = headerType & 0x7F;
 		switch (headerType)
 		{
-		case 0x00:		/* Accept */
-			if (peek & 0x80)
-			{
-				proto_tree_add_uint (tree, hf_wsp_header_accept, header_buff, offset, headerLen, (peek & 0x7F));
-			}
-			else
-			{
-				proto_tree_add_string (tree, hf_wsp_header_accept_str,header_buff,offset,headerLen,tvb_get_ptr (value_buff, 0, valueLen));
-			}
-			break;
-
-		case 0x01:		/* Accept-Charset */
-			if (peek < 31)
-			{
-				/* Peek contains the number of octets to follow */
-				valSize = tvb_get_guint8 (value_buff, 1);
-				/* decode Charset */
-				if (valSize & 0x80) {
-					value = valSize & 0x7f;
-					valSize = 1;
-				}
-				else if (valSize < 31) { 
-					switch (valSize)
-					{
-						case 1:
-							value = tvb_get_guint8 (value_buff, 2);
-							break;
-						case 2:
-							value = tvb_get_ntohs (value_buff, 2);
-							break;
-						case 3:
-							value = tvb_get_ntoh24 (value_buff, 2);
-							break;
-						case 4:
-							value = tvb_get_ntohl (value_buff, 2);
-							break;
-						default:
-							value = 0;
-							fprintf (stderr, "dissect_wsp: accept-charset size %d NYI\n", peek);
-							break;
-					}
-					valSize++;
+			case 0x00:		/* Accept */
+				if (peek & 0x80)
+				{
+					proto_tree_add_uint (tree, hf_wsp_header_accept, header_buff, offset, headerLen, (peek & 0x7F));
 				}
-				else {
-					fprintf (stderr, "dissect_wsp: Accept-Charset value %d (0x%02X) NYI\n", peek, value);
+				else
+				{
+					proto_tree_add_string (tree, hf_wsp_header_accept_str,header_buff,offset,headerLen,tvb_get_ptr (value_buff, 0, valueLen));
 				}
-				valMatch = match_strval(value,vals_character_sets);
-				if (peek > valSize) {
-					q_value = tvb_get_guintvar (value_buff, 1+valSize, NULL);
-					if (q_value <= 100) {
-						q_value = (q_value - 1) * 10;
+				break;
+
+			case 0x01:		/* Accept-Charset */
+				if (peek <= 31)				/* Accept-charset-general-form */
+				{
+					/* Get Value-Length */
+					valueLength = get_value_length (value_buff, offset,
+						&valueStart);
+					offset = valueStart;
+
+					peek = tvb_get_guint8 (value_buff, offset);
+					if ((peek >= 0x80) || (peek <= 30))	/* Well-known-charset */
+					{
+						if (peek == 0x80)		/* Any */
+						{
+							value = peek;
+							offset++;
+						}
+						else if (peek & 0x80)	/* Short-Integer */
+						{
+							value = peek & 0x7F;
+							offset++;
+						}
+						else if (peek <= 30)	/* Long-Integer */
+						{
+							offset++;
+	
+							/* TODO: Need to read peek octets */
+							value = 0x00;
+							offset += peek;
+						}
+						valMatch = match_strval(value, vals_character_sets);
 					}
-					else {
-						q_value -= 100;
+					else						/* Assume Token-text */
+					{
+						fprintf (stderr, "dissect_wsp: Accept-Charset Token-text NYI\n");
 					}
-				}
-				else {
-					q_value = 1000;
-				}
-				if (valMatch != NULL)  {
-					snprintf(valString,100,"%s;Q=%5.3f",valMatch,q_value/1000.0);
-				}
-				else {
-					snprintf(valString,100,"Unknow %d;Q=%5.3f",value,q_value/1000.0);
-				}
-				proto_tree_add_string (tree, hf_wsp_header_accept_charset_str, header_buff, offset, headerLen, valString);
-			}
-			else if (peek & 0x80)
-			{
-				proto_tree_add_uint (tree, hf_wsp_header_accept_charset, header_buff, offset, headerLen, (peek & 0x7F) );
-			}
-			else
-			{
-				fprintf (stderr, "dissect_wsp: Accept-Charset value %d (0x%02X) NYI\n", peek, peek);
-			}
-			break;
 
-		case 0x03:		/* Accept-Language */
-			if (peek < 31)
-			{
-				/* Peek contains the number of octets to follow */
-				switch (peek)
-				{
-					case 1:
-						proto_tree_add_uint (tree, hf_wsp_header_accept_language, header_buff, offset, 
-								headerLen, tvb_get_guint8 (value_buff, 1) );
-						break;
-					case 2:
-						proto_tree_add_uint (tree, hf_wsp_header_accept_language, header_buff, offset, 
-								headerLen, tvb_get_ntohs (value_buff, 1) );
-						break;
-					case 4:
-						proto_tree_add_uint (tree, hf_wsp_header_accept_language, header_buff, offset, 
-								headerLen, tvb_get_ntohl (value_buff, 1) );
-						break;
-					default:
-						fprintf (stderr, "dissect_wsp: accept-language size %d NYI\n", peek);
-				}
-			}
-			else if (peek & 0x80)
-			{
-				proto_tree_add_uint (tree, hf_wsp_header_accept_language, header_buff, offset, headerLen, (peek & 0x7F) );
-			}
-			else
-			{
-				proto_tree_add_string (tree, hf_wsp_header_accept_language_str, header_buff, offset,headerLen,
-						tvb_get_ptr (value_buff, 0, valueLen));
-			}
-			break;
-
-		case 0x04:		/* Accept-Ranges */
-			if ((peek == 128) || (peek == 129))
-			{
-				proto_tree_add_uint (tree, hf_wsp_header_accept_ranges, header_buff, offset, headerLen, peek);
-			}
-			else
-			{
-				fprintf (stderr, "dissect_wsp: accept-ranges NYI\n");
-			}
-			
-			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 */
-			if (peek & 0x80)
-			{
-				if (valueLen == 1)	/* Well-known value */
-				{
-					proto_tree_add_uint (tree, hf_wsp_header_cache_control, header_buff, offset, headerLen, peek);
-				}
-				else
-				{
-					if ((peek == 0x82) || (peek == 0x83) || (peek == 0x84))	/* Delta seconds value to follow */
+					/* Any remaining data relates to Q-Value */
+					if (offset < valueLen)
 					{
-						value = tvb_get_guint8 (value_buff, 1);
-						if (value & 0x80)
+						count = 0;
+						q_value = tvb_get_guintvar (value_buff, offset, &count);
+						if (count == 1)			/* Two decimal quality factors */
+						{
+							q_value -= 1;
+							q_value /= 100;
+						}
+						else if (count == 2) /* Three decimal quality factors */
 						{
-							proto_tree_add_text (tree,
-							    header_buff, 0,
-							    headerLen,
-							    "Cache-Control: %s %d (0x%02X)",
-							    val_to_str (peek,
-							        vals_cache_control,
-							        "Unknown (0x%02x)"),
-							        (value & 0x7F),
-							        peek);
+							q_value -= 100;
+							q_value /= 1000;
 						}
 						else
 						{
-							fprintf (stderr, "dissect_wsp: Cache-Control integer value Delta seconds NYI\n");
+							fprintf (stderr, "dissect_wsp: Accept-Charset invalid Q-value %f\n", q_value);
 						}
 					}
-					else if ((peek == 0x80) || (peek == 0x87))	/* Fields to follow */
+
+					/* Build string including Q values if present */
+					if (q_value == 1.0)			/* Default */
 					{
-						fprintf (stderr, "dissect_wsp: Cache-Control field values NYI\n");
+						if (valMatch == NULL)
+						{
+							snprintf (valString, 100, "Unknown (%02X)", peek);
+						}
+						else
+						{
+							snprintf (valString, 100, "%s", valMatch);
+						}
 					}
 					else
 					{
-						fprintf (stderr, "dissect_wsp: Cache-Control cache extension NYI\n");
+						snprintf (valString, 100, "Unknown %d; Q=%5.3f", value,
+							q_value/1000.0);
+						if (valMatch == NULL)
+						{
+							snprintf (valString, 100, "Unknown (%02X)", peek);
+						}
+						else
+						{
+							snprintf (valString, 100, "%s", valMatch);
+						}
 					}
+
+					/* Add string to tree */
+					proto_tree_add_string (tree, hf_wsp_header_accept_charset_str,
+						header_buff, 0, headerLen, valString);
 				}
-			}
-			else
-			{
-				fprintf (stderr, "dissect_wsp: Cache-Control cache extension NYI\n");
-			}
-			break;
-				
-		case 0x0D:		/* Content-Length */
-			if (peek & 0x80)
-			{
-				proto_tree_add_uint (tree, hf_wsp_header_content_length, header_buff, offset, headerLen, (peek & 0x7F));
-			}
-			else if (peek < 31) {
-				switch (peek)
+				else						/* Constrained-charset */
 				{
-					case 1:
-						proto_tree_add_uint (tree, hf_wsp_header_content_length, header_buff, offset, headerLen, 
-								tvb_get_guint8 (value_buff, 1) );
-						break;
-					case 2:
-						proto_tree_add_uint (tree, hf_wsp_header_content_length, header_buff, offset, headerLen, 
-								tvb_get_ntohs (value_buff, 1) );
-						break;
-					case 3:
-						proto_tree_add_uint (tree, hf_wsp_header_content_length, header_buff, offset, headerLen, 
-								(tvb_get_ntohs (value_buff, 1) << 8) + tvb_get_guint8 (value_buff, 3) );
-						break;
-					case 4:
-						proto_tree_add_uint (tree, hf_wsp_header_content_length, header_buff, offset, headerLen, 
-								tvb_get_ntohl (value_buff, 1) );
-						break;
-					default:
-						fprintf (stderr, "dissect_wsp: accept-charset size %d NYI\n", peek);
-				}
-			}
-			else
-			{
-				fprintf (stderr, "dissect_wsp: Content-Length long-integer size NYI\n");
-			}
-			break;
-				
-		case 0x12:		/* Date */
-			if (peek < 31) {
-				timeValue.tv_sec=0;
-				timeValue.tv_usec = 0;
-				switch (peek) {
-					case 1:
-						timeValue.tv_sec = tvb_get_guint8 (value_buff, 1);
-						break;
-					case 2:
-						timeValue.tv_sec = tvb_get_ntohs (value_buff, 1);
-						break;
-					case 3:
-						timeValue.tv_sec = tvb_get_ntoh24 (value_buff, 1);
-						break;
-					case 4:
-						timeValue.tv_sec = tvb_get_ntohl (value_buff, 1);
-						break;
-					default:
-						fprintf (stderr, "dissect_wsp: accept-charset size %d NYI\n", peek);
-						break;
+					if (peek == 0x80)		/* Any-charset */
+					{
+						proto_tree_add_string (tree, hf_wsp_header_accept_charset,
+							header_buff, offset, headerLen,
+							'*');
+					}
+					else if (peek & 0x80)	/* Short-Integer */
+					{
+						proto_tree_add_uint (tree, hf_wsp_header_accept_charset,
+							header_buff, offset, headerLen, (peek & 0x7F) );
+					}
+					else					/* Assume *TEXT */
+					{
+						proto_tree_add_string (tree, hf_wsp_header_accept_charset,
+							header_buff, offset, headerLen,
+							tvb_get_ptr (value_buff, 0, valueLen));
+					}
 				}
-				ti = proto_tree_add_time (tree, hf_wsp_header_date, header_buff, offset, headerLen, &timeValue);
-			}
-			else {
-				fprintf (stderr, "dissect_wsp: accept-charset size %d NYI\n", peek);
-			}
-			break;
-
-		case 0x13:		/* Etag */
-			ti = proto_tree_add_string (tree, hf_wsp_header_etag,header_buff,offset,headerLen,tvb_get_ptr (value_buff, 0, valueLen));
-			break;
+				break;
 
-		case 0x14:		/* Expires */
-			timeValue.tv_sec = 0;
-			timeValue.tv_usec = 0;
-			if (peek < 31) {
-				switch (peek)
+			case 0x03:		/* Accept-Language */
+				if (peek < 31)
 				{
-					case 1:
-						timeValue.tv_sec = tvb_get_guint8 (value_buff, 1);
-						break;
-					case 2:
-						timeValue.tv_sec = tvb_get_ntohs (value_buff, 1);
-						break;
-					case 3:
-						timeValue.tv_sec = tvb_get_ntoh24 (value_buff, 1);
+					/* Peek contains the number of octets to follow */
+					switch (peek)
+					{
+						case 1:
+							proto_tree_add_uint (tree, hf_wsp_header_accept_language, header_buff, offset, 
+								headerLen, tvb_get_guint8 (value_buff, 1) );
 						break;
-					case 4:
-						timeValue.tv_sec = tvb_get_ntohl (value_buff, 1);
+						case 2:
+							proto_tree_add_uint (tree, hf_wsp_header_accept_language, header_buff, offset, 
+								headerLen, tvb_get_ntohs (value_buff, 1) );
 						break;
-					default:
-						timeValue.tv_sec = 0;
-						fprintf (stderr, "dissect_wsp: Expires value length %d NYI\n", peek);
+						case 4:
+							proto_tree_add_uint (tree, hf_wsp_header_accept_language, header_buff, offset, 
+								headerLen, tvb_get_ntohl (value_buff, 1) );
 						break;
+						default:
+							fprintf (stderr, "dissect_wsp: accept-language size %d NYI\n", peek);
+					}
 				}
-				ti = proto_tree_add_time (tree, hf_wsp_header_expires, header_buff, offset, headerLen, &timeValue);
-			}
-			else
-			{
-				fprintf (stderr, "dissect_wsp: Expires value 0x%02x NYI\n", peek);
-			}
-			break;
+				else if (peek & 0x80)
+				{
+					proto_tree_add_uint (tree, hf_wsp_header_accept_language, header_buff, offset, headerLen, (peek & 0x7F) );
+				}
+				else
+				{
+					proto_tree_add_string (tree, hf_wsp_header_accept_language_str, header_buff, offset,headerLen,
+						tvb_get_ptr (value_buff, 0, valueLen));
+				}
+				break;
 
-		case 0x17:		/* If-Modified-Since */
-			timeValue.tv_sec = 0;
-			timeValue.tv_usec = 0;
-			if (peek < 31) {
-				switch (peek)
+			case 0x04:		/* Accept-Ranges */
+				if ((peek == 128) || (peek == 129))
 				{
-					case 1:
-						timeValue.tv_sec = tvb_get_guint8 (value_buff, 1);
-						break;
-					case 2:
-						timeValue.tv_sec = tvb_get_ntohs (value_buff, 1);
-						break;
-					case 3:
-						timeValue.tv_sec = tvb_get_ntoh24 (value_buff, 1);
-						break;
-					case 4:
-						timeValue.tv_sec = tvb_get_ntohl (value_buff, 1);
-						break;
-					default:
-						timeValue.tv_sec = 0;
-						fprintf (stderr, "dissect_wsp: Expires value length %d NYI\n", peek);
-						break;
+					proto_tree_add_uint (tree, hf_wsp_header_accept_ranges, header_buff, offset, headerLen, peek);
 				}
-				ti = proto_tree_add_time (tree, hf_wsp_header_if_modified_since, header_buff, offset, headerLen, &timeValue);
-			}
-			else
-			{
-				fprintf (stderr, "dissect_wsp: Expires value 0x%02x NYI\n", peek);
-			}
-			break;
+				else
+				{
+					fprintf (stderr, "dissect_wsp: accept-ranges NYI\n");
+				}
 				
-		case 0x1C:		/* Location */
-			ti = proto_tree_add_string (tree, hf_wsp_header_location,header_buff,offset,headerLen,tvb_get_ptr (value_buff, 0, valueLen));
-			break;
+				break;
 
-		case 0x1D:		/* Last-Modified */
-			timeValue.tv_sec = 0;
-			timeValue.tv_usec = 0;
-			if (peek < 31) {
-				switch (peek)
+			case 0x05:		/* Age */
+				switch (valueLen)
 				{
 					case 1:
-						timeValue.tv_sec = tvb_get_guint8 (value_buff, 1);
+						proto_tree_add_uint (tree, hf_wsp_header_age, header_buff, offset, headerLen, tvb_get_guint8 (value_buff, 0));
 						break;
 					case 2:
-						timeValue.tv_sec = tvb_get_ntohs (value_buff, 1);
+						proto_tree_add_uint (tree, hf_wsp_header_age, header_buff, offset, headerLen, tvb_get_ntohs (value_buff, 0));
 						break;
 					case 3:
-						timeValue.tv_sec = tvb_get_ntoh24 (value_buff, 1);
+						proto_tree_add_uint (tree, hf_wsp_header_age, header_buff, offset, headerLen, tvb_get_ntoh24 (value_buff, 0));
 						break;
 					case 4:
-						timeValue.tv_sec = tvb_get_ntohl (value_buff, 1);
+						proto_tree_add_uint (tree, hf_wsp_header_age, header_buff, offset, headerLen, tvb_get_ntohl (value_buff, 0));
 						break;
-					default:
-						timeValue.tv_sec = 0;
-						fprintf (stderr, "dissect_wsp: Expires value length %d NYI\n", peek);
-						break;
+				};
+				break;
+
+			case 0x08:		/* Cache-Control */
+				if (peek & 0x80)
+				{
+					if (valueLen == 1)	/* Well-known value */
+					{
+						proto_tree_add_uint (tree, hf_wsp_header_cache_control, header_buff, offset, headerLen, peek);
+					}
+					else
+					{
+						if ((peek == 0x82) || (peek == 0x83) || (peek == 0x84))	/* Delta seconds value to follow */
+						{
+							value = tvb_get_guint8 (value_buff, 1);
+							if (value & 0x80)
+							{
+								proto_tree_add_text (tree, header_buff, 0,
+									headerLen, "Cache-Control: %s %d (0x%02X)",
+							    	val_to_str (peek, vals_cache_control,
+							        	"Unknown (0x%02x)"),
+							        (value & 0x7F), peek);
+							}
+							else
+							{
+								fprintf (stderr, "dissect_wsp: Cache-Control integer value Delta seconds NYI\n");
+							}
+						}
+						else if ((peek == 0x80) || (peek == 0x87))	/* Fields to follow */
+						{
+							fprintf (stderr, "dissect_wsp: Cache-Control field values NYI\n");
+						}
+						else
+						{
+							fprintf (stderr, "dissect_wsp: Cache-Control cache extension NYI\n");
+						}
+					}
 				}
-				ti = proto_tree_add_time (tree, hf_wsp_header_last_modified, header_buff, offset, headerLen, &timeValue);
-			}
-			else
-			{
-				fprintf (stderr, "dissect_wsp: Expires value 0x%02x NYI\n", peek);
-			}
-			break;
+				else
+				{
+					fprintf (stderr, "dissect_wsp: Cache-Control cache extension NYI\n");
+				}
+				break;
 				
-		case 0x1F:		/* Pragma */
-			if (peek == 0x80)
-			{
-				proto_tree_add_text (tree, header_buff, 0, headerLen, "Pragma: No-cache");
-			}
-			else
-			{
-				proto_tree_add_text (tree, header_buff, 0, headerLen, "Unsupported Header (0x%02X)", (tvb_get_guint8 (header_buff, 0) & 0x7F));
-			}
-			break;
+			case 0x0D:		/* Content-Length */
+				if (peek < 31)
+				{
+					switch (peek)
+					{
+						case 1:
+							proto_tree_add_uint (tree,
+								hf_wsp_header_content_length, header_buff, offset,
+								headerLen, tvb_get_guint8 (value_buff, 1) );
+							break;
+						case 2:
+							proto_tree_add_uint (tree,
+								hf_wsp_header_content_length, header_buff, offset,
+								headerLen, tvb_get_ntohs (value_buff, 1) );
+							break;
+						case 3:
+							proto_tree_add_uint (tree,
+								hf_wsp_header_content_length, header_buff, offset,
+								headerLen, (tvb_get_ntohs (value_buff, 1) << 8) +
+								tvb_get_guint8 (value_buff, 3) );
+							break;
+						case 4:
+							proto_tree_add_uint (tree,
+								hf_wsp_header_content_length, header_buff, offset,
+								headerLen, tvb_get_ntohl (value_buff, 1) );
+							break;
+						default:
+							fprintf (stderr, "dissect_wsp: accept-charset size %d NYI\n", peek);
+					}
+				}
+				else if (peek & 0x80)
+				{
+					proto_tree_add_uint (tree, hf_wsp_header_content_length, header_buff, offset, headerLen, (peek & 0x7F));
+				}
+				else
+				{
+					fprintf (stderr, "dissect_wsp: Content-Length long-integer size NYI\n");
+				}
+				break;
 				
-		case 0x26:		/* Server */
-			ti = proto_tree_add_string (tree, hf_wsp_header_server,header_buff,offset,headerLen,tvb_get_ptr (value_buff, 0, valueLen));
-			break;
+			case 0x12:		/* Date */
+				add_date_value (value_buff, 0, tree,
+					hf_wsp_header_date, header_buff, offset,
+					headerLen, &timeValue, "Date");
+				break;
 
-		case 0x27:		/* Transfer encoding */
-			if (peek & 0x80)
-			{
-				proto_tree_add_uint (tree, hf_wsp_header_transfer_encoding, header_buff, offset, headerLen, peek);
-			}
-			else
-			{
-				proto_tree_add_string (tree, hf_wsp_header_transfer_encoding_str, header_buff, offset,headerLen,tvb_get_ptr (value_buff, 0, valueLen));
-			}
-			break;
+			case 0x13:		/* Etag */
+				ti = proto_tree_add_string (tree, hf_wsp_header_etag,header_buff,offset,headerLen,tvb_get_ptr (value_buff, 0, valueLen));
+				break;
 
+			case 0x14:		/* Expires */
+				add_date_value (value_buff, 0, tree,
+					hf_wsp_header_expires, header_buff, offset,
+					headerLen, &timeValue, "Expires");
+				break;
 
-		case 0x29:		/* User-Agent */
-			ti = proto_tree_add_string (tree, hf_wsp_header_user_agent,header_buff,offset,headerLen,tvb_get_ptr (value_buff, 0, valueLen));
-			break;
+			case 0x17:		/* If-Modified-Since */
+				add_date_value (value_buff, 0, tree,
+					hf_wsp_header_if_modified_since, header_buff, offset,
+					headerLen, &timeValue, "If-Modified-Since");
+				break;
+				
+			case 0x1C:		/* Location */
+				ti = proto_tree_add_string (tree, hf_wsp_header_location,header_buff,offset,headerLen,tvb_get_ptr (value_buff, 0, valueLen));
+				break;
 
-		case 0x2B:		/* Via */
-			ti = proto_tree_add_string (tree, hf_wsp_header_via,header_buff,offset,headerLen,tvb_get_ptr (value_buff, 0, valueLen));
-			break;
+			case 0x1D:		/* Last-Modified */
+				add_date_value (value_buff, 0, tree,
+					hf_wsp_header_last_modified, header_buff, offset,
+					headerLen, &timeValue, "Last-Modified");
+				break;
+				
+			case 0x1F:		/* Pragma */
+				if (peek == 0x80)
+				{
+					proto_tree_add_text (tree, header_buff, 0, headerLen, "Pragma: No-cache");
+				}
+				else
+				{
+					proto_tree_add_text (tree, header_buff, 0, headerLen, "Unsupported Header (0x%02X)", (tvb_get_guint8 (header_buff, 0) & 0x7F));
+				}
+				break;
+				
+			case 0x26:		/* Server */
+				ti = proto_tree_add_string (tree, hf_wsp_header_server,header_buff,offset,headerLen,tvb_get_ptr (value_buff, 0, valueLen));
+				break;
 
+			case 0x27:		/* Transfer encoding */
+				if (peek & 0x80)
+				{
+					proto_tree_add_uint (tree, hf_wsp_header_transfer_encoding,
+						header_buff, offset, headerLen, peek);
+				}
+				else
+				{
+					proto_tree_add_string (tree,
+						hf_wsp_header_transfer_encoding_str, header_buff, offset,
+						headerLen,tvb_get_ptr (value_buff, 0, valueLen));
+				}
+				break;
 
-		default:
-			ti = proto_tree_add_text (tree, header_buff, 0, headerLen, "Unsupported Header (0x%02X)", (tvb_get_guint8 (header_buff, 0) & 0x7F));
-			break;
+			case 0x29:		/* User-Agent */
+				ti = proto_tree_add_string (tree, hf_wsp_header_user_agent,header_buff,offset,headerLen,tvb_get_ptr (value_buff, 0, valueLen));
+				break;
+
+			case 0x2B:		/* Via */
+				ti = proto_tree_add_string (tree, hf_wsp_header_via, header_buff,
+					offset, headerLen, tvb_get_ptr (value_buff, 0, valueLen));
+				break;
+
+			default:
+				ti = proto_tree_add_text (tree, header_buff, 0, headerLen, "Unsupported Header (0x%02X)", (tvb_get_guint8 (header_buff, 0) & 0x7F));
+				break;
 		}
 	}
 	else
@@ -2294,27 +1195,21 @@
 		 * by a 4-byte date value */
 		if (strncasecmp ("x-wap.tod", tvb_get_ptr (header_buff, 0, headerLen), 9) == 0)
 		{
-			timeValue.tv_sec = 0;
-			timeValue.tv_usec = 0;
-			switch( peek) {
-				case 1:
-					timeValue.tv_sec = tvb_get_guint8 (value_buff, 1);
-					break;
-				case 2:
-					timeValue.tv_sec = tvb_get_ntohs (value_buff, 1);
-					break;
-				case 3:
-					timeValue.tv_sec = (tvb_get_ntohs (value_buff, 1) << 8) +  tvb_get_guint8 (value_buff, 3);
-					break;
-				case 4:
-					timeValue.tv_sec = tvb_get_ntohl (value_buff, 1);
-					break;
-				default:
-					timeValue.tv_sec = 0;
-					fprintf (stderr, "dissect_wsp: x-wap-top unkown\n");
-					break;
+			if (tvb_reported_length (value_buff) == 4)	/* Probably a date value */
+			{
+				timeValue.tv_sec = tvb_get_ntohl (value_buff, 0);
+				ti = proto_tree_add_time (tree, hf_wsp_header_x_wap_tod, header_buff, offset, headerLen, &timeValue);
+			}
+			else if (tvb_reported_length (value_buff) == 5) /* Probably a date */
+			{
+				add_date_value (value_buff, 0, tree,
+					hf_wsp_header_x_wap_tod, header_buff, offset,
+					headerLen, &timeValue, "X-Wap.Tod");
 			}
-			ti = proto_tree_add_time (tree, hf_wsp_header_x_wap_tod, header_buff, offset, headerLen, &timeValue);
+			else
+			{
+				ti = proto_tree_add_text (tree, header_buff, 0, headerLen, "%s: %s", tvb_get_ptr (header_buff, 0, headerLen), tvb_get_ptr (value_buff, 0, valueLen));
+			}
 		}
 		else
 		{
@@ -2385,6 +1280,70 @@
 	return (offset+totalSizeOfField);
 }
 
+/* Utility function to extract date values from the packet */
+static gint
+get_date_value (tvbuff_t *buffer, guint offset, struct timeval *timeValue)
+{
+	guint ShortLength = 0;
+
+	/* Initialise time values */
+	timeValue->tv_sec=0;
+	timeValue->tv_usec = 0;
+
+	/* Date values are encoded as: Short-length Multi-octet-integer
+	 * Where Short-length = 0-30
+	 */
+	ShortLength = tvb_get_guint8 (buffer, offset++);
+	if (ShortLength > 30)
+	{
+		fprintf (stderr, "dissect_wsp: Invalid Date-value (Short-length=%d)\n",
+			ShortLength);
+		return (-1);
+	}
+
+	switch (ShortLength)
+	{
+		case 1:
+			timeValue->tv_sec = tvb_get_guint8 (buffer, offset);
+			break;
+		case 2:
+			timeValue->tv_sec = tvb_get_ntohs (buffer, offset);
+			break;
+		case 3:
+			timeValue->tv_sec = tvb_get_ntoh24 (buffer, offset);
+			break;
+		case 4:
+			timeValue->tv_sec = tvb_get_ntohl (buffer, offset);
+			break;
+		default:
+			fprintf (stderr, "dissect_wsp: Date-value Short-length of %d NYI\n",
+				ShortLength);
+			return (-1);
+			break;
+	}
+
+	return (0);
+}
+
+/* Utility function to add a date value to the protocol tree */
+static void
+add_date_value (tvbuff_t *buffer, guint offset, proto_tree *tree,
+		int header, tvbuff_t *headerBuffer, guint headerOffset,
+		guint headerLen, struct timeval *timeValue, const char *fieldName)
+{
+	/* Attempt to get the date value from the buffer */
+	if (get_date_value (buffer, offset, timeValue) == 0)
+	{
+		/* If successful, add it to the protocol tree */
+		proto_tree_add_time (tree, header, headerBuffer, headerOffset,
+			headerLen, timeValue);
+	}
+	else
+	{
+		fprintf (stderr, "dissect_wsp: Invalid %s value\n", fieldName);
+	}
+}
+
 static guint
 add_parameter (proto_tree *tree, tvbuff_t *tvb, guint offset)
 {
@@ -2440,6 +1399,7 @@
 	guint8 peek = 0;
 	proto_item *ti;
 	
+	/* VERIFY ti = proto_tree_add_item (tree, hf_wsp_post_data,tvb,offset,END_OF_FRAME,bo_little_endian); */
 	ti = proto_tree_add_item (tree, hf_wsp_post_data,tvb,offset,tvb_reported_length(tvb),bo_little_endian);
 
 	if (contentType == 0x12)	/* URL Encoded data */
@@ -2530,7 +1490,7 @@
 		},
 		{ &hf_wsp_header_pdu_type,
 			{ 	"PDU Type",           
-				"wsp.pdu-type",
+				"wsp.pdu_type",
 				 FT_UINT8, BASE_HEX, VALS( vals_pdu_type ), 0x00,
 				"PDU Type" 
 			}
@@ -2558,7 +1518,7 @@
 		},
 		{ &hf_wsp_header_length,
 			{ 	"Headers Length",           
-				"wsp.headers-length",
+				"wsp.headers_length",
 				 FT_UINT32, BASE_DEC, NULL, 0x00,
 				"Headers Length" 
 			}
@@ -2586,7 +1546,7 @@
 		},
 		{ &hf_wsp_header_uri_len,
 			{ 	"URI Length",           
-				"wsp.uri-length",
+				"wsp.uri_length",
 				 FT_UINT32, BASE_DEC, NULL, 0x00,
 				"URI Length" 
 			}
@@ -2600,7 +1560,7 @@
 		},
 		{ &hf_wsp_server_session_id,
 			{ 	"Server Session ID",           
-				"wsp.server.session-id",
+				"wsp.server.session_id",
 				 FT_UINT32, BASE_DEC, NULL, 0x00,
 				"Server Session ID" 
 			}
@@ -2614,14 +1574,14 @@
 		},
 		{ &hf_wsp_content_type,
 			{ 	"Content Type",           
-				"wsp.content-type.type",
+				"wsp.content_type.type",
 				 FT_UINT8, BASE_HEX, VALS ( vals_content_types ), 0x00,
 				"Content Type" 
 			}
 		},
 		{ &hf_wsp_parameter_well_known_charset,
 			{ 	"Charset",           
-				"wsp.content-type.parameter.charset",
+				"wsp.content_type.parameter.charset",
 				 FT_UINT16, BASE_HEX, VALS ( vals_character_sets ), 0x00,
 				"Charset" 
 			}
@@ -2650,35 +1610,35 @@
 		},
 		{ &hf_wsp_header_accept_charset,
 			{ 	"Accept-Charset",           
-				"wsp.header.accept-charset",
+				"wsp.header.accept_charset",
 				 FT_UINT16, BASE_HEX, VALS ( vals_character_sets ), 0x00,
 				"Accept-Charset" 
 			}
 		},
 		{ &hf_wsp_header_accept_charset_str,
 			{ 	"Accept-Charset",           
-				"wsp.header.accept-charset.string",
+				"wsp.header.accept_charset.string",
 				 FT_STRING, BASE_NONE, NULL, 0x00,
 				"Accept-Charset" 
 			}
 		},
 		{ &hf_wsp_header_accept_language,
 			{ 	"Accept-Language",           
-				"wsp.header.accept-language",
+				"wsp.header.accept_language",
 				 FT_UINT8, BASE_HEX, VALS ( vals_languages ), 0x00,
 				"Accept-Language" 
 			}
 		},
 		{ &hf_wsp_header_accept_language_str,
 			{ 	"Accept-Language",           
-				"wsp.header.accept-language.string",
+				"wsp.header.accept_language.string",
 				 FT_STRING, BASE_NONE, NULL, 0x00,
 				"Accept-Language" 
 			}
 		},
 		{ &hf_wsp_header_accept_ranges,
 			{ 	"Accept-Ranges",           
-				"wsp.header.accept-ranges",
+				"wsp.header.accept_ranges",
 				 FT_UINT8, BASE_HEX, VALS ( vals_accept_ranges ), 0x00,
 				"Accept-Ranges" 
 			}
@@ -2692,14 +1652,14 @@
 		},
 		{ &hf_wsp_header_cache_control,
 			{ 	"Cache-Control",           
-				"wsp.header.cache-control",
+				"wsp.header.cache_control",
 				 FT_UINT8, BASE_HEX, VALS ( vals_cache_control ), 0x00,
 				"Cache-Control" 
 			}
 		},
 		{ &hf_wsp_header_content_length,
 			{ 	"Content-Length",           
-				"wsp.header.content-length",
+				"wsp.header.content_length",
 				 FT_UINT32, BASE_DEC, NULL, 0x00,
 				"Content-Length" 
 			}
@@ -2728,7 +1688,7 @@
 		},
 		{ &hf_wsp_header_last_modified,
 			{ 	"Last-Modified",           
-				"wsp.header.last-modified",
+				"wsp.header.last_modified",
 				 FT_ABSOLUTE_TIME, BASE_NONE, NULL, 0x0,
 				"Last-Modified" 
 			}
@@ -2742,7 +1702,7 @@
 		},
 		{ &hf_wsp_header_if_modified_since,
 			{ 	"If-Modified-Since",           
-				"wsp.header.if-modified-since",
+				"wsp.header.if_modified_since",
 				 FT_ABSOLUTE_TIME, BASE_NONE, NULL, 0x0,
 				"If-Modified-Since" 
 			}
@@ -2755,24 +1715,46 @@
 				"Server" 
 			}
 		},
+		{ &hf_wsp_header_transfer_encoding,
+			{ 	"Transfer Encoding",           
+				"wsp.header.transfer_enc",
+				 /*FT_NONE, BASE_DEC, NULL, 0x00,*/
+				 FT_UINT8, BASE_HEX, VALS ( vals_transfer_encoding ), 0x00,
+				"Transfer Encoding" 
+			}
+		},
+		{ &hf_wsp_header_transfer_encoding_str,
+			{ 	"Transfer Encoding",           
+				"wsp.header.transfer_enc_str",
+				 FT_STRING, BASE_NONE, NULL, 0x00,
+				"Transfer Encoding" 
+			}
+		},
 		{ &hf_wsp_header_user_agent,
 			{ 	"User-Agent",           
-				"wsp.header.user-agent",
+				"wsp.header.user_agent",
 				 /*FT_NONE, BASE_DEC, NULL, 0x00,*/
 				 FT_STRING, BASE_NONE, NULL, 0x00,
 				"User-Agent" 
 			}
 		},
+		{ &hf_wsp_header_via,
+			{ 	"Via",           
+				"wsp.header.via",
+				 FT_STRING, BASE_NONE, NULL, 0x00,
+				"Via" 
+			}
+		},
 		{ &hf_wsp_header_application_header,
 			{ 	"Application Header",           
-				"wsp.header.application-header",
+				"wsp.header.application_header",
 				 FT_STRING, BASE_NONE, NULL, 0x00,
 				"Application Header" 
 			}
 		},
 		{ &hf_wsp_header_application_value,
 			{ 	"Application Header Value",           
-				"wsp.header.application-header.value",
+				"wsp.header.application_header.value",
 				 FT_STRING, BASE_NONE, NULL, 0x00,
 				"Application Header Value" 
 			}
@@ -2784,28 +1766,6 @@
 				"X-WAP.TOD" 
 			}
 		},
-		{ &hf_wsp_header_transfer_encoding,
-			{ 	"Transfer Encoding",           
-				"wsp.header.transfer_enc",
-				 /*FT_NONE, BASE_DEC, NULL, 0x00,*/
-				 FT_UINT8, BASE_HEX, VALS ( vals_transfer_encoding ), 0x00,
-				"Transfer Encoding" 
-			}
-		},
-		{ &hf_wsp_header_transfer_encoding_str,
-			{ 	"Transfer Encoding",           
-				"wsp.header.transfer_enc_str",
-				 FT_STRING, BASE_NONE, NULL, 0x00,
-				"Transfer Encoding" 
-			}
-		},
-		{ &hf_wsp_header_via,
-			{ 	"Via",           
-				"wsp.header.via",
-				 FT_STRING, BASE_NONE, NULL, 0x00,
-				"Via" 
-			}
-		},
 		{ &hf_wsp_post_data,
 			{ 	"Post Data",           
 				"wsp.post.data",
@@ -2813,440 +1773,6 @@
 				"Post Data" 
 			}
 		},
-		{ &hf_wtls_record,
-			{ 	"Record",           
-				"wsp.wtls.record",
-				 FT_UINT8, BASE_DEC, VALS ( wtls_vals_record_type ), 0x0f,
-				"Record" 
-			}
-		},
-		{ &hf_wtls_record_type,
-			{ 	"Record Type",           
-				"wsp.wtls.rec_type",
-				 FT_UINT8, BASE_DEC, VALS ( wtls_vals_record_type ), 0x0f,
-				"Record Type" 
-			}
-		},
-		{ &hf_wtls_record_length,
-			{ 	"Record Length",           
-				"wsp.wtls.rec_length",
-				 FT_UINT16, BASE_DEC, NULL, 0x00,
-				"Record Length" 
-			}
-		},
-		{ &hf_wtls_record_sequence,
-			{ 	"Record Sequence",           
-				"wsp.wtls.rec_seq",
-				 FT_UINT16, BASE_DEC, NULL, 0x00,
-				"Record Sequence" 
-			}
-		},
-		{ &hf_wtls_record_ciphered,
-			{ 	"Record Ciphered",           
-				"wsp.wtls.rec_cipher",
-				 FT_NONE, BASE_DEC, NULL, 0x00,
-				"Record Ciphered" 
-			}
-		},
-		{ &hf_wtls_hands,
-			{ 	"Handshake",           
-				"wsp.wtls.handshake",
-				 FT_UINT8, BASE_HEX, VALS ( wtls_vals_handshake_type ), 0x00,
-				"Handshake" 
-			}
-		},
-		{ &hf_wtls_hands_type,
-			{ 	"Type",           
-				"wsp.wtls.handshake.type",
-				 FT_UINT8, BASE_HEX, VALS ( wtls_vals_handshake_type ), 0x00,
-				"Type" 
-			}
-		},
-		{ &hf_wtls_hands_length,
-			{ 	"Length",           
-				"wsp.wtls.handshake.length",
-				 FT_UINT16, BASE_DEC, NULL, 0x00,
-				"Length" 
-			}
-		},
-		{ &hf_wtls_hands_cli_hello,
-			{ 	"Client Hello",           
-				"wsp.wtls.handshake.client_hello",
-				 FT_NONE, BASE_NONE,NULL, 0x00,
-				"Client Hello" 
-			}
-		},
-		{ &hf_wtls_hands_cli_hello_version,
-			{ 	"Version",           
-				"wsp.wtls.handshake.client_hello.version",
-				 FT_UINT8, BASE_DEC, NULL, 0x00,
-				"Version" 
-			}
-		},
-		{ &hf_wtls_hands_cli_hello_gmt,
-			{ 	"Time GMT",           
-				"wsp.wtls.handshake.client_hello.gmt",
-				 FT_ABSOLUTE_TIME, BASE_NONE, NULL, 0x00,
-				"Time GMT" 
-			}
-		},
-		{ &hf_wtls_hands_cli_hello_random,
-			{ 	"Random",           
-				"wsp.wtls.handshake.client_hello.random",
-				 FT_NONE, BASE_DEC, NULL, 0x00,
-				"Random" 
-			}
-		},
-		{ &hf_wtls_hands_cli_hello_session,
-			{ 	"Session ID",           
-				"wsp.wtls.handshake.client_hello.sessionid",
-				 FT_NONE, BASE_DEC, NULL, 0x00,
-				"Session ID" 
-			}
-		},
-		{ &hf_wtls_hands_cli_hello_cli_key_id,
-			{ 	"Client Keys",           
-				"wsp.wtls.handshake.client_hello.client_keys_id",
-				 FT_NONE, BASE_DEC, NULL, 0x00,
-			 	"Client Keys"           
-			}
-		},
-		{ &hf_wtls_hands_cli_hello_trust_key_id,
-			{ 	"Trusted Keys",           
-				"wsp.wtls.handshake.client_hello.trusted_keys_id",
-				 FT_NONE, BASE_DEC, NULL, 0x00,
-			 	"Trusted Keys"           
-			}
-		},
-		{ &hf_wtls_hands_cli_hello_key_exchange,
-			{ 	"Key Exchange",           
-				"wsp.wtls.handshake.client_hello.key.key_exchange",
-				 FT_UINT8, BASE_HEX, VALS ( wtls_vals_key_exchange_suite ), 0x00,
-				"Key Exchange" 
-			}
-		},
-		{ &hf_wtls_hands_cli_hello_key_exchange_suite,
-			{ 	"Suite",           
-				"wsp.wtls.handshake.client_hello.key.key_exchange.suite",
-				 FT_UINT8, BASE_HEX, VALS ( wtls_vals_key_exchange_suite ), 0x00,
-				"Suite" 
-			}
-		},
-		{ &hf_wtls_hands_cli_hello_key_parameter_index,
-			{ 	"Parameter Index",           
-				"wsp.wtls.handshake.client_hello.parameter_index",
-				 FT_UINT8, BASE_DEC, NULL, 0x00,
-				"Parameter Index" 
-			}
-		},
-		{ &hf_wtls_hands_cli_hello_key_parameter_set,
-			{ 	"Parameter Set",           
-				"wsp.wtls.handshake.client_hello.parameter",
-				 FT_STRING, BASE_NONE, NULL, 0x00,
-				"Parameter Set" 
-			}
-		},
-		{ &hf_wtls_hands_cli_hello_key_identifier_type,
-			{ 	"Identifier Type",           
-				"wsp.wtls.handshake.client_hello.ident_type",
-				 FT_UINT8, BASE_HEX, VALS ( wtls_vals_identifier_type ), 0x00,
-				"Identifier Type" 
-			}
-		},
-		{ &hf_wtls_hands_cli_hello_cipher_suite,
-			{ 	"Cipher Suites",           
-				"wsp.wtls.handshake.client_hello.ciphers",
-				 FT_NONE, BASE_DEC, NULL, 0x00,
-				"Cipher Suite" 
-			}
-		},
-		{ &hf_wtls_hands_cli_hello_cipher_suite_item,
-			{ 	"Cipher",           
-				"wsp.wtls.handshake.client_hello.cipher",
-				 FT_NONE, BASE_DEC, NULL, 0x00,
-				"Cipher" 
-			}
-		},
-		{ &hf_wtls_hands_cli_hello_cipher_bulk,
-			{ 	"Cipher Bulk",           
-				"wsp.wtls.handshake.client_hello.cipher.bulk",
-				 FT_UINT8, BASE_HEX, VALS ( wtls_vals_cipher_bulk ), 0x00,
-				"Cipher Bulk" 
-			}
-		},
-		{ &hf_wtls_hands_cli_hello_cipher_mac,
-			{ 	"Cipher MAC",           
-				"wsp.wtls.handshake.client_hello.cipher.mac",
-				 FT_UINT8, BASE_HEX, VALS ( wtls_vals_cipher_mac ), 0x00,
-				"Cipher MAC" 
-			}
-		},
-		{ &hf_wtls_hands_cli_hello_compression_methods,
-			{ 	"Compression Methods",           
-				"wsp.wtls.handshake.client_hello.comp_methods",
-				 FT_NONE, BASE_DEC, NULL, 0x00,
-				"Compression Methods" 
-			}
-		},
-		{ &hf_wtls_hands_cli_hello_compression,
-			{ 	"Compression",           
-				"wsp.wtls.handshake.client_hello.compression",
-				 FT_UINT8, BASE_HEX, VALS ( wtls_vals_compression ), 0x00,
-				"Compression" 
-			}
-		},
-		{ &hf_wtls_hands_cli_hello_sequence_mode,
-			{ 	"Sequence Mode",           
-				"wsp.wtls.handshake.client_hello.sequence_mode",
-				 FT_UINT8, BASE_HEX, VALS ( wtls_vals_sequence_mode ), 0x00,
-				"Sequence Mode" 
-			}
-		},
-		{ &hf_wtls_hands_cli_hello_key_refresh,
-			{ 	"Refresh",           
-				"wsp.wtls.handshake.client_hello.refresh",
-				 FT_UINT8, BASE_DEC,NULL, 0x00,
-				"Refresh" 
-			}
-		},
-		{ &hf_wtls_hands_serv_hello,
-			{ 	"Server Hello",           
-				"wsp.wtls.handshake.server_hello",
-				 FT_NONE, BASE_NONE,NULL, 0x00,
-				"Server Hello" 
-			}
-		},
-		{ &hf_wtls_hands_serv_hello_version,
-			{ 	"Version",           
-				"wsp.wtls.handshake.server_hello.version",
-				 FT_UINT8, BASE_DEC, NULL, 0x00,
-				"Version" 
-			}
-		},
-		{ &hf_wtls_hands_serv_hello_gmt,
-			{ 	"Time GMT",           
-				"wsp.wtls.handshake.server_hello.gmt",
-				 FT_ABSOLUTE_TIME, BASE_NONE, NULL, 0x00,
-				"Time GMT" 
-			}
-		},
-		{ &hf_wtls_hands_serv_hello_random,
-			{ 	"Random",           
-				"wsp.wtls.handshake.server_hello.random",
-				 FT_NONE, BASE_DEC, NULL, 0x00,
-				"Random" 
-			}
-		},
-		{ &hf_wtls_hands_serv_hello_session,
-			{ 	"Session ID",           
-				"wsp.wtls.handshake.server_hello.sessionid",
-				 FT_NONE, BASE_DEC, NULL, 0x00,
-				"Session ID" 
-			}
-		},
-		{ &hf_wtls_hands_serv_hello_cli_key_id,
-			{ 	"Client Key ID",           
-				"wsp.wtls.handshake.server_hello.key",
-				 FT_UINT8, BASE_HEX, NULL, 0x00,
-				"Client Key ID" 
-			}
-		},
-		{ &hf_wtls_hands_serv_hello_cipher_suite_item,
-			{ 	"Cipher",           
-				"wsp.wtls.handshake.server_hello.cipher",
-				 FT_NONE, BASE_DEC, NULL, 0x00,
-				"Cipher" 
-			}
-		},
-		{ &hf_wtls_hands_serv_hello_cipher_bulk,
-			{ 	"Cipher Bulk",           
-				"wsp.wtls.handshake.server_hello.cipher.bulk",
-				 FT_UINT8, BASE_HEX, VALS ( wtls_vals_cipher_bulk ), 0x00,
-				"Cipher Bulk" 
-			}
-		},
-		{ &hf_wtls_hands_serv_hello_cipher_mac,
-			{ 	"Cipher MAC",           
-				"wsp.wtls.handshake.server_hello.cipher.mac",
-				 FT_UINT8, BASE_HEX, VALS ( wtls_vals_cipher_mac ), 0x00,
-				"Cipher MAC" 
-			}
-		},
-		{ &hf_wtls_hands_serv_hello_compression,
-			{ 	"Compression",           
-				"wsp.wtls.handshake.server_hello.compression",
-				 FT_UINT8, BASE_HEX, VALS ( wtls_vals_compression ), 0x00,
-				"Compression" 
-			}
-		},
-		{ &hf_wtls_hands_serv_hello_sequence_mode,
-			{ 	"Sequence Mode",           
-				"wsp.wtls.handshake.server_hello.sequence_mode",
-				 FT_UINT8, BASE_HEX, VALS ( wtls_vals_sequence_mode ), 0x00,
-				"Sequence Mode" 
-			}
-		},
-		{ &hf_wtls_hands_serv_hello_key_refresh,
-			{ 	"Refresh",           
-				"wsp.wtls.handshake.server_hello.refresh",
-				 FT_UINT8, BASE_DEC,NULL, 0x00,
-				"Refresh" 
-			}
-		},
-		{ &hf_wtls_hands_certificates,
-			{ 	"Certificates",
-				"wsp.wtls.handshake.certificates",
-				 FT_NONE, BASE_DEC, NULL, 0x00,
-				"Certificates" 
-			}
-		},
-		{ &hf_wtls_hands_certificate,
-			{ 	"Certificate",           
-				"wsp.wtls.handshake.certificate",
-				 FT_NONE, BASE_DEC, NULL, 0x00,
-				"Certificate" 
-			}
-		},
-		{ &hf_wtls_hands_certificate_type,
-			{ 	"Type",           
-				"wsp.wtls.handshake.certificate.type",
-				 FT_UINT8, BASE_HEX, VALS ( wtls_vals_certificate_type ), 0x00,
-				"Type" 
-			}
-		},
-		{ &hf_wtls_hands_certificate_wtls_version,
-			{ 	"Version",           
-				"wsp.wtls.handshake.certificate.version",
-				 FT_UINT8, BASE_HEX, NULL, 0x00,
-				"Version" 
-			}
-		},
-		{ &hf_wtls_hands_certificate_wtls_signature_type,
-			{ 	"Signature Type",           
-				"wsp.wtls.handshake.certificate.signature.type",
-				 FT_UINT8, BASE_HEX, VALS ( wtls_vals_certificate_signature ), 0x00,
-				"Signature Type" 
-			}
-		},
-		{ &hf_wtls_hands_certificate_wtls_signature,
-			{ 	"Signature Size",           
-				"wsp.wtls.handshake.certificate.signature.signature",
-				 FT_UINT32, BASE_DEC, NULL, 0x00,
-				"Signature Size" 
-			}
-		},
-		{ &hf_wtls_hands_certificate_wtls_issuer_type,
-			{ 	"Issuer",           
-				"wsp.wtls.handshake.certificate.issuer.type",
-				 FT_UINT8, BASE_HEX, VALS ( wtls_vals_identifier_type ), 0x00,
-				"Issuer" 
-			}
-		},
-		{ &hf_wtls_hands_certificate_wtls_issuer_charset,
-			{ 	"Charset",           
-				"wsp.wtls.handshake.certificate.issuer.charset",
-				 FT_UINT16, BASE_HEX, VALS ( vals_character_sets ), 0x00,
-				"Charset" 
-			}
-		},
-		{ &hf_wtls_hands_certificate_wtls_issuer_name,
-			{ 	"Name",           
-				"wsp.wtls.handshake.certificate.issuer.name",
-				 FT_STRING, BASE_NONE, NULL, 0x00,
-				"Name" 
-			}
-		},
-		{ &hf_wtls_hands_certificate_wtls_valid_not_before,
-			{ 	"Valid not before",           
-				"wsp.wtls.handshake.certificate.before",
-				 FT_ABSOLUTE_TIME, BASE_NONE, NULL, 0x00,
-				"Valid not before" 
-			}
-		},
-		{ &hf_wtls_hands_certificate_wtls_valid_not_after,
-			{ 	"Valid not after",           
-				"wsp.wtls.handshake.certificate.after",
-				 FT_ABSOLUTE_TIME, BASE_NONE, NULL, 0x00,
-				"Valid not after" 
-			}
-		},
-		{ &hf_wtls_hands_certificate_wtls_subject_type,
-			{ 	"Subject",           
-				"wsp.wtls.handshake.certificate.subject.type",
-				 FT_UINT8, BASE_HEX, VALS ( wtls_vals_identifier_type ), 0x00,
-				"Subject" 
-			}
-		},
-		{ &hf_wtls_hands_certificate_wtls_subject_charset,
-			{ 	"Charset",           
-				"wsp.wtls.handshake.certificate.subject.charset",
-				 FT_UINT16, BASE_HEX, VALS ( vals_character_sets ), 0x00,
-				"Charset" 
-			}
-		},
-		{ &hf_wtls_hands_certificate_wtls_subject_name,
-			{ 	"Name",           
-				"wsp.wtls.handshake.certificate.subject.name",
-				 FT_STRING, BASE_NONE, NULL, 0x00,
-				"Name" 
-			}
-		},
-		{ &hf_wtls_hands_certificate_wtls_public_key_type,
-			{ 	"Public Key Type",           
-				"wsp.wtls.handshake.certificate.public.type",
-				 FT_UINT8, BASE_HEX, VALS ( wtls_vals_public_key_type ), 0x00,
-				"Public Key Type" 
-			}
-		},
-		{ &hf_wtls_hands_certificate_wtls_key_parameter_index,
-			{ 	"Parameter Index",           
-				"wsp.wtls.handshake.certificate.parameter_index",
-				 FT_UINT8, BASE_DEC, NULL, 0x00,
-				"Parameter Index" 
-			}
-		},
-		{ &hf_wtls_hands_certificate_wtls_key_parameter_set,
-			{ 	"Parameter Set",           
-				"wsp.wtls.handshake.certificate.parameter",
-				 FT_STRING, BASE_NONE, NULL, 0x00,
-				"Parameter Set" 
-			}
-		},
-		{ &hf_wtls_hands_certificate_wtls_rsa_exponent,
-			{ 	"RSA Exponent",           
-				"wsp.wtls.handshake.certificate.rsa.exponent",
-				 FT_UINT32, BASE_DEC, NULL, 0x00,
-				"RSA Exponent" 
-			}
-		},
-		{ &hf_wtls_hands_certificate_wtls_rsa_modules,
-			{ 	"RSA Modulus Size",           
-				"wsp.wtls.handshake.certificate.rsa.modulus",
-				 FT_UINT32, BASE_DEC, NULL, 0x00,
-				"RSA Modulus" 
-			}
-		},
-		{ &hf_wtls_alert,
-			{ 	"Alert",           
-				"wsp.wtls.alert",
-				 FT_NONE, BASE_HEX, NULL, 0x00,
-				"Alert" 
-			}
-		},
-		{ &hf_wtls_alert_level,
-			{ 	"Level",           
-				"wsp.wtls.alert.level",
-				 FT_UINT8, BASE_HEX, VALS ( wtls_vals_alert_level ), 0x00,
-				"Level" 
-			}
-		},
-		{ &hf_wtls_alert_description,
-			{ 	"Description",           
-				"wsp.wtls.alert.description",
-				 FT_UINT8, BASE_HEX, VALS ( wtls_vals_alert_description ), 0x00,
-				"Description" 
-			}
-		},
 	};
 	
 /* Setup protocol subtree array */
@@ -3256,11 +1782,6 @@
 		&ett_headers,
 		&ett_capabilities,
 		&ett_content_type,
-		&ett_wtls_rec,
-		&ett_wtls_msg_type,
-		&ett_wtls_msg_type_item,
-		&ett_wtls_msg_type_item_sub,
-		&ett_wtls_msg_type_item_sub_sub,
 	};
 
 /* Register the protocol name and description */
@@ -3272,28 +1793,23 @@
 						  */
 	);
 
-	proto_wtls = proto_register_protocol(
-		"Wireless Transport Layer Security",   	/* protocol name for use by ethereal */ 
-		"WTLS",                          /* short version of name */
-		"wap-wtls"                    	/* Abbreviated protocol name, should Match IANA 
-						    < URL:http://www.isi.edu/in-notes/iana/assignments/port-numbers/ >
-						  */
-	);
-
 /* Required function calls to register the header fields and subtrees used  */
 	proto_register_field_array(proto_wsp, hf, array_length(hf));
 	proto_register_subtree_array(ett, array_length(ett));
 
 	register_dissector("wsp", dissect_wsp, proto_wsp);
-	register_dissector("wtls", dissect_wtls, proto_wtls);
 };
 
 void
 proto_reg_handoff_wsp(void)
 {
+	/*
+	 * Get a handle for the WMLC dissector
+	 */
+	wmlc_handle = find_dissector("wmlc");	/* Coming soon :) */
+
 	/* Only connection-less WSP has no previous handler */
 	dissector_add("udp.port", UDP_PORT_WSP, dissect_wsp, proto_wsp);
-	/* dissector_add("udp.port", UDP_PORT_WTP_WSP, dissect_wsp, proto_wsp); */
-	dissector_add("udp.port", UDP_PORT_WTLS_WSP, dissect_wtls, proto_wtls); 
-	/* dissector_add("udp.port", UDP_PORT_WTLS_WTP_WSP, dissect_wsp, proto_wsp); */
+
+	/* This dissector is also called from the WTP and WTLS dissectors */
 }
Index: packet-wsp.h
===================================================================
RCS file: /cvsroot/ethereal/packet-wsp.h,v
retrieving revision 1.2
diff -u -r1.2 packet-wsp.h
--- packet-wsp.h	2001/01/03 08:42:48	1.2
+++ packet-wsp.h	2001/02/12 17:06:38
@@ -1,5 +1,4 @@
-/* packet-wsp.h (c) 2000 Neil Hunter
- * Based on original work by Ben Fowler
+/* packet-wsp.h
  *
  * Declarations for disassembly of WSP component of WAP traffic.
  *
@@ -9,6 +8,9 @@
  * By Gerald Combs <gerald@xxxxxxxx>
  * Copyright 1998 Gerald Combs
  *
+ * WAP dissector based on original work by Ben Fowler
+ * Updated by Neil Hunter <neil.hunter@xxxxxxxxxxxxxxxxxxx>
+ * WTLS support by Alexandre P. Ferreira (Splice IP)
  * 
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -23,8 +25,6 @@
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
- *
- *
  */
 
 #ifndef __PACKET_WSP_H__
@@ -38,11 +38,11 @@
  * TODO:
  *	Capability encoding
  *	Remaining headers (perhaps a place holder for those yet to be implemented)
- *	Decoding of WMLC content
  *	Remaining PDUs
  */
 
-/* Reason codes also used in WTP dissector as we assume WSP is the user */
+/* These reason codes are also used in the WTP dissector as the WTP user is
+ * assumed to be WSP */
 static const value_string vals_wsp_reason_codes[] = {
 	{ 0xE0, "Protocol Error (Illegal PDU)" },
 	{ 0xE1, "Session disconnected" },
Index: packet-wtp.c
===================================================================
RCS file: /cvsroot/ethereal/packet-wtp.c,v
retrieving revision 1.10
diff -u -r1.10 packet-wtp.c
--- packet-wtp.c	2001/01/22 08:03:46	1.10
+++ packet-wtp.c	2001/02/12 17:06:38
@@ -1,5 +1,4 @@
-/* packet-wtp.c (c) 2000 Neil Hunter
- * Base on original work by Ben Fowler
+/* packet-wtp.c
  *
  * Routines to dissect WTP component of WAP traffic.
  * 
@@ -9,6 +8,10 @@
  * By Gerald Combs <gerald@xxxxxxxx>
  * Copyright 1998 Didier Jorand
  *
+ * WAP dissector based on original work by Ben Fowler
+ * Updated by Neil Hunter <neil.hunter@xxxxxxxxxxxxxxxxxxx>
+ * WTLS support by Alexandre P. Ferreira (Splice IP)
+ *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
@@ -167,6 +170,7 @@
 static gint ett_wtp 							= ETT_EMPTY;
 static gint ett_header 							= ETT_EMPTY;
 
+/* Handle for WSP dissector */
 static dissector_handle_t wsp_handle;
 
 /* Declarations */
@@ -424,10 +428,12 @@
 #endif
 	}
 		
-	/* Any remaining data ought to be WSP data, so hand off to the WSP dissector */
+	/* Any remaining data ought to be WSP data,
+	 * so hand off to the WSP dissector */
 	if (tvb_reported_length (tvb) > cbHeader)
 	{
-		wsp_tvb = tvb_new_subset(tvb, cbHeader, -1, tvb_reported_length (tvb)-cbHeader);
+		wsp_tvb = tvb_new_subset(tvb, cbHeader, -1,
+			tvb_reported_length (tvb)-cbHeader);
 		call_dissector(wsp_handle, wsp_tvb, pinfo, tree);
 	}
 
@@ -471,21 +477,21 @@
 		},
 		{ &hf_wtp_header_flag_continue,
 			{ 	"Continue Flag",           
-				"wtp.continue-flag",
+				"wtp.continue_flag",
 				FT_BOOLEAN, 8, TFS( &continue_truth ), 0x80,          
 				"Continue Flag" 
 			}
 		},
 		{ &hf_wtp_header_pdu_type,
 			{ 	"PDU Type",           
-				"wtp.pdu-type",
+				"wtp.pdu_type",
 				 FT_UINT8, BASE_HEX, VALS( vals_pdu_type ), 0x78,
 				"PDU Type" 
 			}
 		},
 		{ &hf_wtp_header_flag_Trailer,
 			{ 	"Trailer Flags",           
-				"wtp.trailer-flags",
+				"wtp.trailer_flags",
 				 FT_UINT8, BASE_HEX, VALS( vals_transmission_trailer ), 0x06,
 				"PDU Type" 
 			}
@@ -541,7 +547,7 @@
 		},
 		{ &hf_wtp_header_Inv_TransactionClass,
 			{ 	"Transaction Class",           
-				"wtp.inv.transaction-class",
+				"wtp.inv.transaction_class",
 				 FT_UINT8, BASE_HEX, NULL, 0x03,
 				"Transaction Class" 
 			}
@@ -629,10 +635,9 @@
 proto_reg_handoff_wtp(void)
 {
 	/*
-	 * Get a handle for the IP WSP dissector.
+	 * Get a handle for the IP WSP dissector - if WTP PDUs have data, it is WSP
 	 */
 	wsp_handle = find_dissector("wsp");
 
 	dissector_add("udp.port", UDP_PORT_WTP_WSP, dissect_wtp, proto_wtp);
-	/* dissector_add("udp.port", UDP_PORT_WTLS_WTP_WSP, dissect_wtp, proto_wtp); */
 }
Index: packet-wtp.h
===================================================================
RCS file: /cvsroot/ethereal/packet-wtp.h,v
retrieving revision 1.2
diff -u -r1.2 packet-wtp.h
--- packet-wtp.h	2000/11/04 07:39:16	1.2
+++ packet-wtp.h	2001/02/12 17:06:38
@@ -1,5 +1,4 @@
-/* packet-wtp.h (c) 2000 Neil Hunter
- * Based on original work by Ben Fowler
+/* packet-wtp.h
  *
  * Declarations for disassembly of WTP component of WAP traffic.
  *
@@ -9,6 +8,9 @@
  * By Gerald Combs <gerald@xxxxxxxx>
  * Copyright 1998 Gerald Combs
  *
+ * WAP dissector based on original work by Ben Fowler
+ * Updated by Neil Hunter <neil.hunter@xxxxxxxxxxxxxxxxxxx>
+ * WTLS support by Alexandre P. Ferreira (Splice IP)
  * 
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -23,8 +25,6 @@
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
- *
- *
  */
 
 #ifndef __PACKET_WTP_H__