*
* Routines to dissect WTLS component of WAP traffic.
*
- * $Id: packet-wtls.c,v 1.1 2001/02/13 00:17:54 guy Exp $
+ * $Id: packet-wtls.c,v 1.4 2001/03/09 04:35:22 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
else {
count = tvb_length (tvb)-offset_wtls;
}
- ti = proto_tree_add_item(wtls_tree, hf_wtls_record, tvb, offset_wtls,
- count, bo_little_endian);
+ 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;
int size = 0;
guint public_key = 0;
guint signature = 0;
+ char valStr[1024];
proto_item *ti;
proto_item *cli_key_item;
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);
+ 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);
- 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;
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,
+ value = tvb_get_guint8 (tvb, offset);
+ cli_key_item = proto_tree_add_uint(wtls_msg_type_item_sub_tree,
hf_wtls_hands_cli_hello_key_exchange, tvb, offset,1,
- bo_little_endian);
+ value);
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,
+ ti = proto_tree_add_uint(wtls_msg_type_item_sub_sub_tree,
hf_wtls_hands_cli_hello_key_exchange_suite,
- tvb,offset,1,bo_big_endian);
+ tvb,offset,1,value);
offset++;
value = tvb_get_guint8 (tvb, offset);
ti = proto_tree_add_item(wtls_msg_type_item_sub_sub_tree,
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,
+ value = tvb_get_guint8 (tvb, offset);
+ cli_key_item = proto_tree_add_uint(wtls_msg_type_item_sub_tree,
hf_wtls_hands_cli_hello_key_exchange, tvb, offset,1,
- bo_little_endian);
+ value);
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,
+ ti = proto_tree_add_uint(wtls_msg_type_item_sub_sub_tree,
hf_wtls_hands_cli_hello_key_exchange_suite,
- tvb,offset,1,bo_big_endian);
+ tvb,offset,1,value);
offset++;
value = tvb_get_guint8 (tvb, offset);
ti = proto_tree_add_item(wtls_msg_type_item_sub_sub_tree,
offset+=2;
client_size+=2;
value = tvb_get_guint8 (tvb, offset);
- ti = proto_tree_add_item(
+ strncpy(valStr,tvb_get_ptr (tvb, offset+1, value),value);
+ valStr[value]=0;
+ ti = proto_tree_add_string(
wtls_msg_type_item_sub_tree,
hf_wtls_hands_certificate_wtls_issuer_name,
tvb, offset,1+value,
- bo_big_endian);
+ valStr);
offset+=1+value;
client_size+=1+value;
break;
offset+=2;
client_size+=2;
value = tvb_get_guint8 (tvb, offset);
- ti = proto_tree_add_item(
+ strncpy(valStr,tvb_get_ptr (tvb, offset+1, value),value);
+ valStr[value]=0;
+ ti = proto_tree_add_string(
wtls_msg_type_item_sub_tree,
hf_wtls_hands_certificate_wtls_subject_name,
tvb, offset,1+value,
- bo_big_endian);
+ valStr);
offset+=1+value;
client_size+=1+value;
break;
switch (public_key) {
case PUBLIC_KEY_RSA :
value = tvb_get_ntohs (tvb, offset);
- ti = proto_tree_add_item(wtls_msg_type_item_sub_tree,
+ ti = proto_tree_add_uint(wtls_msg_type_item_sub_tree,
hf_wtls_hands_certificate_wtls_rsa_exponent,
- tvb,offset,value+2,bo_big_endian);
+ tvb,offset,value+2,value*8);
offset+=2+value;
client_size+=2+value;
value = tvb_get_ntohs (tvb, offset);
- ti = proto_tree_add_item(wtls_msg_type_item_sub_tree,
+ ti = proto_tree_add_uint(wtls_msg_type_item_sub_tree,
hf_wtls_hands_certificate_wtls_rsa_modules,
- tvb,offset,value+2,bo_big_endian);
+ tvb,offset,value+2,value*8);
offset+=2+value;
client_size+=2+value;
break;
break;
}
value = tvb_get_ntohs (tvb, offset);
- ti = proto_tree_add_item(wtls_msg_type_item_sub_tree,
+ ti = proto_tree_add_uint(wtls_msg_type_item_sub_tree,
hf_wtls_hands_certificate_wtls_signature,
- tvb,offset,2+value,bo_big_endian);
+ tvb,offset,2+value,value*8);
offset+=2+value;
client_size+=2+value;
break;
{ &hf_wtls_record,
{ "Record",
"wsp.wtls.record",
- FT_NONE, BASE_NONE, NULL, 0x00,
+ FT_UINT8, BASE_NONE, 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,
+ FT_UINT8, BASE_NONE, VALS ( wtls_vals_record_type ), 0x0f,
"Record Type"
}
},
{ &hf_wtls_hands,
{ "Handshake",
"wsp.wtls.handshake",
- FT_NONE, BASE_DEC, NULL, 0x00,
+ FT_UINT8, BASE_HEX, VALS ( wtls_vals_handshake_type ), 0x00,
"Handshake"
}
},
{ &hf_wtls_hands_cli_hello_key_exchange,
{ "Key Exchange",
"wsp.wtls.handshake.client_hello.key.key_exchange",
- FT_NONE, BASE_NONE, NULL, 0x00,
+ FT_UINT8, BASE_HEX, VALS ( wtls_vals_key_exchange_suite ), 0x00,
"Key Exchange"
}
},
}
},
{ &hf_wtls_hands_certificate_wtls_signature,
- { "Signature",
+ { "Signature Size",
"wsp.wtls.handshake.certificate.signature.signature",
- FT_NONE, BASE_HEX, NULL, 0x00,
- "Signature"
+ FT_UINT32, BASE_DEC, NULL, 0x00,
+ "Signature Size"
}
},
{ &hf_wtls_hands_certificate_wtls_issuer_type,
{ &hf_wtls_hands_certificate_wtls_issuer_name,
{ "Name",
"wsp.wtls.handshake.certificate.issuer.name",
- FT_NONE, BASE_HEX, NULL, 0x00,
+ FT_STRING, BASE_NONE, NULL, 0x00,
"Name"
}
},
{ &hf_wtls_hands_certificate_wtls_subject_name,
{ "Name",
"wsp.wtls.handshake.certificate.subject.name",
- FT_NONE, BASE_HEX, NULL, 0x00,
+ FT_STRING, BASE_NONE, NULL, 0x00,
"Name"
}
},
}
},
{ &hf_wtls_hands_certificate_wtls_rsa_exponent,
- { "RSA Exponent",
+ { "RSA Exponent Size",
"wsp.wtls.handshake.certificate.rsa.exponent",
- FT_NONE, BASE_HEX, NULL, 0x00,
- "RSA Exponent"
+ FT_UINT32, BASE_DEC, NULL, 0x00,
+ "RSA Exponent Size"
}
},
{ &hf_wtls_hands_certificate_wtls_rsa_modules,
- { "RSA Modulus",
+ { "RSA Modulus Size",
"wsp.wtls.handshake.certificate.rsa.modulus",
- FT_NONE, BASE_HEX, NULL, 0x00,
- "RSA Modulus"
+ FT_UINT32, BASE_DEC, NULL, 0x00,
+ "RSA Modulus Size"
}
},
{ &hf_wtls_alert,
proto_register_subtree_array(ett, array_length(ett));
register_dissector("wtls", dissect_wtls, proto_wtls);
-};
+}
void
proto_reg_handoff_wtls(void)