Ethereal-dev: [Ethereal-dev] Updates on packet-wsp
Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.
From: "Alexandre P. Ferreira" <alexandref@xxxxxxxxxxxxxxx>
Date: Fri, 09 Feb 2001 16:16:17 -0200
Hi, Some updates and bug fixes in WSP and WTLS decoding in attached file. Best regards, -- Alexandre P. Ferreira Coordenador de Plataforma Splice IP +55 61 3137504
*** ethereal-2001-02-09/packet-wsp.c Thu Feb 1 17:59:40 2001
--- ethereal-0.8.15/packet-wsp.c Fri Feb 9 09:37:48 2001
***************
*** 4,10 ****
*
* Routines to dissect WSP component of WAP traffic.
*
! * $Id: packet-wsp.c,v 1.16 2001/02/01 19:59:40 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@xxxxxxxx>
--- 4,10 ----
*
* Routines to dissect WSP component of WAP traffic.
*
! * $Id: packet-wsp.c,v 1.14 2001/01/28 04:26:53 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@xxxxxxxx>
***************
*** 985,990 ****
--- 985,995 ----
/* proto_tree *wsp_header_fixed; */
proto_tree *wsp_capabilities;
+ /* 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" );
***************
*** 1178,1183 ****
--- 1183,1190 ----
frame_data *fdata = pinfo->fd;
int offset = 0;
+ char szInfo[ 50 ];
+ int cchInfo;
char pdut;
char pdu_msg_type;
guint count = 0;
***************
*** 1189,1202 ****
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
--- 1196,1215 ----
proto_tree *wtls_rec_tree;
proto_tree *wtls_msg_type_tree;
+ /* 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, "WTLS+WSP" );
}
/* Develop the string to put in the Info column */
+ cchInfo = snprintf( szInfo, sizeof( szInfo ), "WTLS");
if (check_col(fdata, COL_INFO)) {
! col_add_str(fdata, COL_INFO, szInfo );
};
/* In the interest of speed, if "tree" is NULL, don't do any work not
***************
*** 1223,1230 ****
else {
count = tvb_length (tvb)-offset_wtls;
}
! ti = proto_tree_add_item(wtls_tree, hf_wtls_record, tvb, offset_wtls,
! count, bo_little_endian);
wtls_rec_tree = proto_item_add_subtree(ti, ett_wtls_rec);
offset = offset_wtls;
--- 1236,1243 ----
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);
offset = offset_wtls;
***************
*** 1288,1296 ****
--- 1301,1311 ----
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;
proto_item *ti;
proto_item *cli_key_item;
***************
*** 1299,1308 ****
proto_tree *wtls_msg_type_item_sub_tree;
proto_tree *wtls_msg_type_item_sub_sub_tree;
! ti = proto_tree_add_item(tree, hf_wtls_hands, 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_hands_type,
tvb,offset,1,bo_big_endian);
offset+=1;
--- 1314,1323 ----
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;
***************
*** 1337,1345 ****
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);
--- 1352,1360 ----
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);
***************
*** 1559,1569 ****
offset+=2;
client_size+=2;
value = tvb_get_guint8 (tvb, offset);
! ti = proto_tree_add_item(
wtls_msg_type_item_sub_tree,
hf_wtls_hands_certificate_wtls_issuer_name,
tvb, offset,1+value,
! bo_big_endian);
offset+=1+value;
client_size+=1+value;
break;
--- 1574,1588 ----
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;
***************
*** 1607,1617 ****
offset+=2;
client_size+=2;
value = tvb_get_guint8 (tvb, offset);
! ti = proto_tree_add_item(
wtls_msg_type_item_sub_tree,
hf_wtls_hands_certificate_wtls_subject_name,
tvb, offset,1+value,
! bo_big_endian);
offset+=1+value;
client_size+=1+value;
break;
--- 1626,1640 ----
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;
***************
*** 1646,1660 ****
switch (public_key) {
case PUBLIC_KEY_RSA :
value = tvb_get_ntohs (tvb, offset);
! ti = proto_tree_add_item(wtls_msg_type_item_sub_tree,
hf_wtls_hands_certificate_wtls_rsa_exponent,
! tvb,offset,value+2,bo_big_endian);
offset+=2+value;
client_size+=2+value;
value = tvb_get_ntohs (tvb, offset);
! ti = proto_tree_add_item(wtls_msg_type_item_sub_tree,
hf_wtls_hands_certificate_wtls_rsa_modules,
! tvb,offset,value+2,bo_big_endian);
offset+=2+value;
client_size+=2+value;
break;
--- 1669,1701 ----
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;
***************
*** 1664,1672 ****
break;
}
value = tvb_get_ntohs (tvb, offset);
! ti = proto_tree_add_item(wtls_msg_type_item_sub_tree,
hf_wtls_hands_certificate_wtls_signature,
! tvb,offset,2+value,bo_big_endian);
offset+=2+value;
client_size+=2+value;
break;
--- 1705,1713 ----
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;
***************
*** 2125,2161 ****
case 0x14: /* Expires */
timeValue.tv_sec = 0;
timeValue.tv_usec = 0;
! switch (valueLen)
{
! 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: Expires value length %d NYI\n", valueLen);
! break;
}
- ti = proto_tree_add_time (tree, hf_wsp_header_expires, header_buff, offset, headerLen, &timeValue);
break;
case 0x17: /* If-Modified-Since */
timeValue.tv_sec = 0;
timeValue.tv_usec = 0;
! switch (valueLen)
{
! 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: If Modified Since value length %d NYI\n", valueLen);
! break;
}
- ti = proto_tree_add_time (tree, hf_wsp_header_if_modified_since, header_buff, offset, headerLen, &timeValue);
break;
case 0x1C: /* Location */
--- 2166,2228 ----
case 0x14: /* Expires */
timeValue.tv_sec = 0;
timeValue.tv_usec = 0;
! if (peek < 31) {
! 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:
! timeValue.tv_sec = 0;
! fprintf (stderr, "dissect_wsp: Expires value length %d NYI\n", peek);
! break;
! }
! 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;
case 0x17: /* If-Modified-Since */
timeValue.tv_sec = 0;
timeValue.tv_usec = 0;
! if (peek < 31) {
! 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:
! timeValue.tv_sec = 0;
! fprintf (stderr, "dissect_wsp: Expires value length %d NYI\n", peek);
! break;
! }
! 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;
case 0x1C: /* Location */
***************
*** 2165,2184 ****
case 0x1D: /* Last-Modified */
timeValue.tv_sec = 0;
timeValue.tv_usec = 0;
! switch (valueLen)
{
! 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: Last Modified value length %d NYI\n", valueLen);
! break;
}
- ti = proto_tree_add_time (tree, hf_wsp_header_last_modified, header_buff, offset, headerLen, &timeValue);
break;
case 0x1F: /* Pragma */
--- 2232,2263 ----
case 0x1D: /* Last-Modified */
timeValue.tv_sec = 0;
timeValue.tv_usec = 0;
! if (peek < 31) {
! 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:
! timeValue.tv_sec = 0;
! fprintf (stderr, "dissect_wsp: Expires value length %d NYI\n", peek);
! break;
! }
! 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;
case 0x1F: /* Pragma */
***************
*** 2384,2390 ****
peek = tvb_get_guint8 (tvb, offset);
if (peek == '=')
{
! variableEnd = offset-1;
valueStart = offset+1;
}
else if (peek == '&')
--- 2463,2469 ----
peek = tvb_get_guint8 (tvb, offset);
if (peek == '=')
{
! variableEnd = offset;
valueStart = offset+1;
}
else if (peek == '&')
***************
*** 2417,2426 ****
char *valueBuffer;
variableBuffer = g_malloc (variableLength+1);
! strncpy (variableBuffer, tvb_get_ptr (tvb, variableStart, variableLength), variableLength+1);
! variableBuffer[variableLength+1] = 0;
! if (valueEnd == 0)
{
valueBuffer = g_malloc (1);
valueBuffer[0] = 0;
--- 2496,2505 ----
char *valueBuffer;
variableBuffer = g_malloc (variableLength+1);
! strncpy (variableBuffer, tvb_get_ptr (tvb, variableStart, variableLength), variableLength);
! variableBuffer[variableLength] = 0;
! if (valueEnd < valueStart)
{
valueBuffer = g_malloc (1);
valueBuffer[0] = 0;
***************
*** 2750,2756 ****
{ &hf_wtls_record,
{ "Record",
"wsp.wtls.record",
! FT_NONE, BASE_NONE, NULL, 0x00,
"Record"
}
},
--- 2829,2835 ----
{ &hf_wtls_record,
{ "Record",
"wsp.wtls.record",
! FT_UINT8, BASE_DEC, VALS ( wtls_vals_record_type ), 0x0f,
"Record"
}
},
***************
*** 2785,2791 ****
{ &hf_wtls_hands,
{ "Handshake",
"wsp.wtls.handshake",
! FT_NONE, BASE_DEC, NULL, 0x00,
"Handshake"
}
},
--- 2864,2870 ----
{ &hf_wtls_hands,
{ "Handshake",
"wsp.wtls.handshake",
! FT_UINT8, BASE_HEX, VALS ( wtls_vals_handshake_type ), 0x00,
"Handshake"
}
},
***************
*** 2855,2861 ****
{ &hf_wtls_hands_cli_hello_key_exchange,
{ "Key Exchange",
"wsp.wtls.handshake.client_hello.key.key_exchange",
! FT_NONE, BASE_NONE, NULL, 0x00,
"Key Exchange"
}
},
--- 2934,2940 ----
{ &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"
}
},
***************
*** 3063,3072 ****
}
},
{ &hf_wtls_hands_certificate_wtls_signature,
! { "Signature",
"wsp.wtls.handshake.certificate.signature.signature",
! FT_NONE, BASE_HEX, NULL, 0x00,
! "Signature"
}
},
{ &hf_wtls_hands_certificate_wtls_issuer_type,
--- 3142,3151 ----
}
},
{ &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,
***************
*** 3086,3092 ****
{ &hf_wtls_hands_certificate_wtls_issuer_name,
{ "Name",
"wsp.wtls.handshake.certificate.issuer.name",
! FT_NONE, BASE_HEX, NULL, 0x00,
"Name"
}
},
--- 3165,3171 ----
{ &hf_wtls_hands_certificate_wtls_issuer_name,
{ "Name",
"wsp.wtls.handshake.certificate.issuer.name",
! FT_STRING, BASE_NONE, NULL, 0x00,
"Name"
}
},
***************
*** 3121,3127 ****
{ &hf_wtls_hands_certificate_wtls_subject_name,
{ "Name",
"wsp.wtls.handshake.certificate.subject.name",
! FT_NONE, BASE_HEX, NULL, 0x00,
"Name"
}
},
--- 3200,3206 ----
{ &hf_wtls_hands_certificate_wtls_subject_name,
{ "Name",
"wsp.wtls.handshake.certificate.subject.name",
! FT_STRING, BASE_NONE, NULL, 0x00,
"Name"
}
},
***************
*** 3149,3162 ****
{ &hf_wtls_hands_certificate_wtls_rsa_exponent,
{ "RSA Exponent",
"wsp.wtls.handshake.certificate.rsa.exponent",
! FT_NONE, BASE_HEX, NULL, 0x00,
"RSA Exponent"
}
},
{ &hf_wtls_hands_certificate_wtls_rsa_modules,
! { "RSA Modulus",
"wsp.wtls.handshake.certificate.rsa.modulus",
! FT_NONE, BASE_HEX, NULL, 0x00,
"RSA Modulus"
}
},
--- 3228,3241 ----
{ &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"
}
},
begin:vcard n:Peixoto Ferreira;Alexandre tel;work:+55 61 3137504 x-mozilla-html:FALSE org:Splice IP adr:;;;;;; version:2.1 email;internet:alexandref@xxxxxxxxxxxxxxx title:Coordenador de Plataforma x-mozilla-cpt:;-9472 fn:Alexandre Peixoto Ferreira end:vcard
- Follow-Ups:
- Re: [Ethereal-dev] Updates on packet-wsp
- From: Guy Harris
- Re: [Ethereal-dev] Updates on packet-wsp
- Prev by Date: RE: [Ethereal-dev] Listing network interfaces in Windows NT/98/2000
- Next by Date: [Ethereal-dev] Re: Files missing from CVS?
- Previous by thread: Re: [Ethereal-dev] Listing network interfaces in Windows NT/98/2000
- Next by thread: Re: [Ethereal-dev] Updates on packet-wsp
- Index(es):