Use ENC_ values in proto_tree_add_item() calls.

In the AgentX dissector, make the "flags" arguments guint8, to match
what's passed in.

In the AIM dissector, use val_to_str() in col_add_str() calls - it gives
the same result if there's a match, and puts a note in the Info column
if there isn't, and is less complicated.

In the AJP13 dissector:

	update the URL for the protocol documentation;

	add #defines for message types, and use them;

	for "enumerated data type" fields, make the fields numerical
	rather than strings and give them the value_string tables;

	get rid of col_check() calls;

	make a Boolean item an FT_BOOLEAN.

svn path=/trunk/; revision=39085
This commit is contained in:
Guy Harris 2011-09-22 03:10:30 +00:00
parent ad1efb6b9c
commit fd2f818353
8 changed files with 190 additions and 195 deletions

View File

@ -347,13 +347,13 @@ static gint ett_afs_vldb_flags = -1;
/* Output a unsigned integer, stored into field 'field'
Assumes it is in network byte order, converts to host before using */
#define OUT_UINT64(field) \
proto_tree_add_item(tree, field, tvb, offset, 8, FALSE); \
proto_tree_add_item(tree, field, tvb, offset, 8, ENC_BIG_ENDIAN); \
offset += 8;
/* Output a unsigned integer, stored into field 'field'
Assumes it is in network byte order, converts to host before using */
#define OUT_INT64(field) \
proto_tree_add_item(tree, field, tvb, offset, 8, FALSE); \
proto_tree_add_item(tree, field, tvb, offset, 8, ENC_BIG_ENDIAN); \
offset += 8;
/* Output a unsigned integer, stored into field 'field'
@ -418,7 +418,7 @@ static gint ett_afs_vldb_flags = -1;
i_orxs = tvb_get_ntohl(tvb, offset); \
len_orxs = ((i_orxs+4-1)/4)*4 + 4; \
proto_tree_add_item(tree, field, tvb, offset-4, len_orxs, \
FALSE); \
ENC_ASCII|ENC_BIG_ENDIAN); \
offset += len_orxs; \
}
@ -768,7 +768,7 @@ static gint ett_afs_vldb_flags = -1;
/* Raw data */
#define OUT_BYTES(field, bytes) \
proto_tree_add_item(tree, field, tvb, offset, bytes, FALSE);\
proto_tree_add_item(tree, field, tvb, offset, bytes, ENC_NA);\
offset += bytes;
@ -1597,7 +1597,7 @@ dissect_afs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if (tree) {
ti = proto_tree_add_item(tree, proto_afs, tvb, offset, -1,
FALSE);
ENC_NA);
afs_tree = proto_item_add_subtree(ti, ett_afs);
proto_tree_add_text(afs_tree, tvb, 0, 0,

View File

@ -297,7 +297,7 @@ enum OID_USAGE { OID_START_RANGE, OID_END_RANGE, OID_EXACT };
tvb_get_letohs(tvb, offset)
static int
dissect_octet_string(tvbuff_t *tvb, proto_tree *tree, int offset, char flags)
dissect_octet_string(tvbuff_t *tvb, proto_tree *tree, int offset, guint8 flags)
{
guint32 n_oct, p_noct;
@ -306,7 +306,11 @@ dissect_octet_string(tvbuff_t *tvb, proto_tree *tree, int offset, char flags)
p_noct = PADDING(n_oct);
proto_tree_add_uint(tree, hf_ostring_len, tvb, offset, 4, n_oct);
proto_tree_add_item(tree, hf_ostring, tvb, offset + 4, n_oct, FALSE);
/*
* XXX - an "octet string" is not necessarily a text string, so
* having hf_ostring be FT_STRING is not necessarily appropriate.
*/
proto_tree_add_item(tree, hf_ostring, tvb, offset + 4, n_oct, ENC_ASCII|ENC_BIG_ENDIAN);
return p_noct + 4;
}
@ -333,7 +337,7 @@ convert_oid_to_str(guint32 *oid, int len, char* str, int slen, char prefix)
}
static int
dissect_object_id(tvbuff_t *tvb, proto_tree *tree, int offset, char flags, enum OID_USAGE oid_usage)
dissect_object_id(tvbuff_t *tvb, proto_tree *tree, int offset, guint8 flags, enum OID_USAGE oid_usage)
{
guint8 n_subid;
guint8 prefix;
@ -381,7 +385,7 @@ dissect_object_id(tvbuff_t *tvb, proto_tree *tree, int offset, char flags, enum
}
static int
dissect_search_range(tvbuff_t *tvb, proto_tree *tree, int start_offset, char flags, guint8 pdu_type)
dissect_search_range(tvbuff_t *tvb, proto_tree *tree, int start_offset, guint8 flags, guint8 pdu_type)
{
int offset = start_offset;
offset += dissect_object_id(tvb, tree, offset, flags, (pdu_type == AGENTX_GET_PDU) ? OID_EXACT : OID_START_RANGE);
@ -391,27 +395,27 @@ dissect_search_range(tvbuff_t *tvb, proto_tree *tree, int start_offset, char fla
}
static int
dissect_val64(tvbuff_t *tvb, proto_tree *tree, int offset, char flags)
dissect_val64(tvbuff_t *tvb, proto_tree *tree, int offset, guint8 flags)
{
gboolean little_endian = !(flags & NETWORK_BYTE_ORDER);
guint encoding = (flags & NETWORK_BYTE_ORDER) ? ENC_BIG_ENDIAN : ENC_LITTLE_ENDIAN;
proto_tree_add_item(tree, hf_val64, tvb, offset, 8, little_endian);
proto_tree_add_item(tree, hf_val64, tvb, offset, 8, encoding);
return 8;
}
static int
dissect_val32(tvbuff_t *tvb, proto_tree *tree, int offset, char flags)
dissect_val32(tvbuff_t *tvb, proto_tree *tree, int offset, guint8 flags)
{
gboolean little_endian = !(flags & NETWORK_BYTE_ORDER);
guint encoding = (flags & NETWORK_BYTE_ORDER) ? ENC_BIG_ENDIAN : ENC_LITTLE_ENDIAN;
proto_tree_add_item(tree, hf_val32, tvb, offset, 4, little_endian);
proto_tree_add_item(tree, hf_val32, tvb, offset, 4, encoding);
return 4;
}
static int
dissect_varbind(tvbuff_t *tvb, proto_tree *tree, int offset, int len, char flags)
dissect_varbind(tvbuff_t *tvb, proto_tree *tree, int offset, int len, guint8 flags)
{
guint16 vtag;
int tlen;
@ -462,23 +466,21 @@ dissect_varbind(tvbuff_t *tvb, proto_tree *tree, int offset, int len, char flags
}
static void
dissect_response_pdu(tvbuff_t *tvb, proto_tree *tree, int offset, int len, char flags)
dissect_response_pdu(tvbuff_t *tvb, proto_tree *tree, int offset, int len, guint8 flags)
{
proto_item* item;
proto_tree* subtree;
gboolean little_endian = !(flags & NETWORK_BYTE_ORDER);
guint encoding = (flags & NETWORK_BYTE_ORDER) ? ENC_BIG_ENDIAN : ENC_LITTLE_ENDIAN;
guint32 r_uptime;
item = proto_tree_add_text(tree, tvb, offset, len, "Response-PDU");
subtree = proto_item_add_subtree(item, ett_response);
r_uptime = little_endian ? \
tvb_get_letohl(tvb, offset) : tvb_get_ntohl(tvb, offset);
NORLEL(flags, r_uptime, tvb, offset);
proto_tree_add_uint_format(subtree, hf_resp_uptime, tvb, offset, 4, r_uptime,
"sysUptime: %s", time_msecs_to_str(r_uptime));
proto_tree_add_item(subtree, hf_resp_error, tvb, offset + 4, 2, little_endian);
proto_tree_add_item(subtree, hf_resp_index, tvb, offset + 6, 2, little_endian);
proto_tree_add_item(subtree, hf_resp_error, tvb, offset + 4, 2, encoding);
proto_tree_add_item(subtree, hf_resp_index, tvb, offset + 6, 2, encoding);
offset += 8;
len += PDU_HDR_LEN;
@ -488,7 +490,7 @@ dissect_response_pdu(tvbuff_t *tvb, proto_tree *tree, int offset, int len, char
}
static void
dissect_getnext_pdu(tvbuff_t *tvb, proto_tree *tree, int offset, int len, char flags)
dissect_getnext_pdu(tvbuff_t *tvb, proto_tree *tree, int offset, int len, guint8 flags)
{
proto_item* item;
proto_tree* subtree;
@ -508,7 +510,7 @@ dissect_getnext_pdu(tvbuff_t *tvb, proto_tree *tree, int offset, int len, char f
}
static void
dissect_get_pdu(tvbuff_t *tvb, proto_tree *tree, int offset, int len, char flags)
dissect_get_pdu(tvbuff_t *tvb, proto_tree *tree, int offset, int len, guint8 flags)
{
proto_item* item;
proto_tree* subtree;
@ -528,11 +530,11 @@ dissect_get_pdu(tvbuff_t *tvb, proto_tree *tree, int offset, int len, char flags
}
static void
dissect_getbulk_pdu(tvbuff_t *tvb, proto_tree *tree, int offset, int len, char flags)
dissect_getbulk_pdu(tvbuff_t *tvb, proto_tree *tree, int offset, int len, guint8 flags)
{
proto_item* item;
proto_tree* subtree;
gboolean little_endian = !(flags & NETWORK_BYTE_ORDER);
guint encoding = (flags & NETWORK_BYTE_ORDER) ? ENC_BIG_ENDIAN : ENC_LITTLE_ENDIAN;
item = proto_tree_add_text(tree, tvb, offset, len, "GetBulk-PDU");
subtree = proto_item_add_subtree(item, ett_getbulk);
@ -542,8 +544,8 @@ dissect_getbulk_pdu(tvbuff_t *tvb, proto_tree *tree, int offset, int len, char f
offset += dissect_octet_string(tvb, subtree, offset, flags);
}
proto_tree_add_item(subtree, hf_gbulk_nrepeat, tvb, offset, 2, little_endian);
proto_tree_add_item(subtree, hf_gbulk_mrepeat, tvb, offset + 2, 2, little_endian);
proto_tree_add_item(subtree, hf_gbulk_nrepeat, tvb, offset, 2, encoding);
proto_tree_add_item(subtree, hf_gbulk_mrepeat, tvb, offset + 2, 2, encoding);
offset+=4;
while(len >= offset) {
@ -552,7 +554,7 @@ dissect_getbulk_pdu(tvbuff_t *tvb, proto_tree *tree, int offset, int len, char f
}
static int
dissect_open_pdu(tvbuff_t *tvb, proto_tree *tree, int offset, int len, char flags)
dissect_open_pdu(tvbuff_t *tvb, proto_tree *tree, int offset, int len, guint8 flags)
{
proto_item* item;
proto_tree* subtree;
@ -595,12 +597,12 @@ dissect_close_pdu(tvbuff_t *tvb, proto_tree *tree, int offset, int len)
static int
dissect_register_pdu(tvbuff_t *tvb, proto_tree *tree, int offset, int len, char flags)
dissect_register_pdu(tvbuff_t *tvb, proto_tree *tree, int offset, int len, guint8 flags)
{
proto_item* item;
proto_tree* subtree;
gboolean little_endian = !(flags & NETWORK_BYTE_ORDER);
guint encoding = (flags & NETWORK_BYTE_ORDER) ? ENC_BIG_ENDIAN : ENC_LITTLE_ENDIAN;
item = proto_tree_add_text(tree, tvb, offset, len, "Register-PDU");
subtree = proto_item_add_subtree(item, ett_register);
@ -610,9 +612,9 @@ dissect_register_pdu(tvbuff_t *tvb, proto_tree *tree, int offset, int len, char
offset += dissect_octet_string(tvb, subtree, offset, flags);
}
proto_tree_add_item(subtree, hf_reg_timeout, tvb, offset, 1, FALSE);
proto_tree_add_item(subtree, hf_reg_prio, tvb, offset+1, 1, FALSE);
proto_tree_add_item(subtree, hf_reg_rsid, tvb, offset+2, 1, FALSE);
proto_tree_add_item(subtree, hf_reg_timeout, tvb, offset, 1, encoding);
proto_tree_add_item(subtree, hf_reg_prio, tvb, offset+1, 1, encoding);
proto_tree_add_item(subtree, hf_reg_rsid, tvb, offset+2, 1, encoding);
offset+=4;
/* Region */
@ -622,7 +624,7 @@ dissect_register_pdu(tvbuff_t *tvb, proto_tree *tree, int offset, int len, char
len += PDU_HDR_LEN;
if(len > offset) {
/* Upper bound (opt) */
proto_tree_add_item(subtree, hf_reg_ubound, tvb, offset, 4, little_endian);
proto_tree_add_item(subtree, hf_reg_ubound, tvb, offset, 4, encoding);
offset += 4;
}
return offset;
@ -630,11 +632,11 @@ dissect_register_pdu(tvbuff_t *tvb, proto_tree *tree, int offset, int len, char
static int
dissect_unregister_pdu(tvbuff_t *tvb, proto_tree *tree, int offset, int len, char flags)
dissect_unregister_pdu(tvbuff_t *tvb, proto_tree *tree, int offset, int len, guint8 flags)
{
proto_item* item;
proto_tree* subtree;
gboolean little_endian = !(flags & NETWORK_BYTE_ORDER);
guint encoding = (flags & NETWORK_BYTE_ORDER) ? ENC_BIG_ENDIAN : ENC_LITTLE_ENDIAN;
item = proto_tree_add_text(tree, tvb, offset, len, "Unregister-PDU");
subtree = proto_item_add_subtree(item, ett_unregister);
@ -644,9 +646,9 @@ dissect_unregister_pdu(tvbuff_t *tvb, proto_tree *tree, int offset, int len, cha
offset += dissect_octet_string(tvb, subtree, offset, flags);
}
proto_tree_add_item(subtree, hf_unreg_timeout, tvb, offset, 1, FALSE);
proto_tree_add_item(subtree, hf_unreg_prio, tvb, offset+1, 1, FALSE);
proto_tree_add_item(subtree, hf_unreg_rsid, tvb, offset+2, 1, FALSE);
proto_tree_add_item(subtree, hf_unreg_timeout, tvb, offset, 1, encoding);
proto_tree_add_item(subtree, hf_unreg_prio, tvb, offset+1, 1, encoding);
proto_tree_add_item(subtree, hf_unreg_rsid, tvb, offset+2, 1, encoding);
offset+=4;
/* Region */
@ -655,7 +657,7 @@ dissect_unregister_pdu(tvbuff_t *tvb, proto_tree *tree, int offset, int len, cha
len += PDU_HDR_LEN;
if(len > offset) {
/* Upper bound (opt) */
proto_tree_add_item(subtree, hf_unreg_ubound, tvb, offset, 4, little_endian);
proto_tree_add_item(subtree, hf_unreg_ubound, tvb, offset, 4, encoding);
offset += 4;
}
@ -663,7 +665,7 @@ dissect_unregister_pdu(tvbuff_t *tvb, proto_tree *tree, int offset, int len, cha
}
static void
dissect_testset_pdu(tvbuff_t *tvb, proto_tree *tree, int offset, int len, char flags)
dissect_testset_pdu(tvbuff_t *tvb, proto_tree *tree, int offset, int len, guint8 flags)
{
proto_item* item;
proto_tree* subtree;
@ -682,7 +684,7 @@ dissect_testset_pdu(tvbuff_t *tvb, proto_tree *tree, int offset, int len, char f
}
static void
dissect_notify_pdu(tvbuff_t *tvb, proto_tree *tree, int offset, int len, char flags)
dissect_notify_pdu(tvbuff_t *tvb, proto_tree *tree, int offset, int len, guint8 flags)
{
proto_item* item;
proto_tree* subtree;
@ -701,7 +703,7 @@ dissect_notify_pdu(tvbuff_t *tvb, proto_tree *tree, int offset, int len, char fl
}
static int
dissect_ping_pdu(tvbuff_t *tvb, proto_tree *tree, int offset, int len, char flags)
dissect_ping_pdu(tvbuff_t *tvb, proto_tree *tree, int offset, int len, guint8 flags)
{
proto_item* item;
proto_tree* subtree;
@ -717,7 +719,7 @@ dissect_ping_pdu(tvbuff_t *tvb, proto_tree *tree, int offset, int len, char flag
}
static void
dissect_idx_alloc_pdu(tvbuff_t *tvb, proto_tree *tree, int offset, int len, char flags)
dissect_idx_alloc_pdu(tvbuff_t *tvb, proto_tree *tree, int offset, int len, guint8 flags)
{
proto_item* item;
proto_tree* subtree;
@ -737,7 +739,7 @@ dissect_idx_alloc_pdu(tvbuff_t *tvb, proto_tree *tree, int offset, int len, char
static void
dissect_idx_dealloc_pdu(tvbuff_t *tvb, proto_tree *tree, int offset, int len, char flags)
dissect_idx_dealloc_pdu(tvbuff_t *tvb, proto_tree *tree, int offset, int len, guint8 flags)
{
proto_item* item;
proto_tree* subtree;
@ -756,7 +758,7 @@ dissect_idx_dealloc_pdu(tvbuff_t *tvb, proto_tree *tree, int offset, int len, ch
}
static int
dissect_add_caps_pdu(tvbuff_t *tvb, proto_tree *tree, int offset, int len, char flags)
dissect_add_caps_pdu(tvbuff_t *tvb, proto_tree *tree, int offset, int len, guint8 flags)
{
proto_item* item;
proto_tree* subtree;
@ -777,7 +779,7 @@ dissect_add_caps_pdu(tvbuff_t *tvb, proto_tree *tree, int offset, int len, char
}
static int
dissect_rem_caps_pdu(tvbuff_t *tvb, proto_tree *tree, int offset, int len, char flags)
dissect_rem_caps_pdu(tvbuff_t *tvb, proto_tree *tree, int offset, int len, guint8 flags)
{
proto_item* item;
proto_tree* subtree;

View File

@ -129,16 +129,16 @@ static int dissect_aim_snac_location_request_user_information(tvbuff_t *tvb,
/* Info Type */
proto_tree_add_item(tree, hf_aim_snac_location_request_user_info_infotype,
tvb, offset, 2, FALSE);
tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
/* Buddy Name length */
buddyname_length = tvb_get_guint8(tvb, offset);
proto_tree_add_item(tree, hf_aim_buddyname_len, tvb, offset, 1, FALSE);
proto_tree_add_item(tree, hf_aim_buddyname_len, tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
/* Buddy name */
proto_tree_add_item(tree, hf_aim_buddyname, tvb, offset, buddyname_length, FALSE);
proto_tree_add_item(tree, hf_aim_buddyname, tvb, offset, buddyname_length, ENC_ASCII|ENC_BIG_ENDIAN);
offset += buddyname_length;
return offset;
@ -153,15 +153,15 @@ static int dissect_aim_snac_location_user_information(tvbuff_t *tvb,
/* Buddy Name length */
buddyname_length = tvb_get_guint8(tvb, offset);
proto_tree_add_item(tree, hf_aim_buddyname_len, tvb, offset, 1, FALSE);
proto_tree_add_item(tree, hf_aim_buddyname_len, tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
/* Buddy name */
proto_tree_add_item(tree, hf_aim_buddyname, tvb, offset, buddyname_length, FALSE);
proto_tree_add_item(tree, hf_aim_buddyname, tvb, offset, buddyname_length, ENC_ASCII|ENC_BIG_ENDIAN);
offset += buddyname_length;
/* Warning level */
proto_tree_add_item(tree, hf_aim_userinfo_warninglevel, tvb, offset, 2, FALSE);
proto_tree_add_item(tree, hf_aim_userinfo_warninglevel, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
offset = dissect_aim_tlv_list(tvb, pinfo, offset, tree, aim_onlinebuddy_tlvs);

View File

@ -80,7 +80,7 @@ static int dissect_aim_snac_signon_signon(tvbuff_t *tvb, packet_info *pinfo,
guchar buddyname[MAX_BUDDYNAME_LENGTH + 1];
/* Info Type */
proto_tree_add_item(tree, hf_aim_infotype, tvb, offset, 2, FALSE);
proto_tree_add_item(tree, hf_aim_infotype, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
/* Unknown */
@ -108,11 +108,11 @@ static int dissect_aim_snac_signon_signon_reply(tvbuff_t *tvb,
/* Logon Challenge Length */
challenge_length = tvb_get_ntohs(tvb, offset);
proto_tree_add_item(tree, hf_aim_signon_challenge_len, tvb, offset, 2, FALSE);
proto_tree_add_item(tree, hf_aim_signon_challenge_len, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
/* Challenge */
proto_tree_add_item(tree, hf_aim_signon_challenge, tvb, offset, challenge_length, FALSE);
proto_tree_add_item(tree, hf_aim_signon_challenge, tvb, offset, challenge_length, ENC_ASCII|ENC_BIG_ENDIAN);
offset += challenge_length;
return offset;
}

View File

@ -112,31 +112,31 @@ static int dissect_ssi_item(tvbuff_t *tvb, packet_info *pinfo _U_, int offset, p
/* Buddy Name Length */
buddyname_length = tvb_get_ntohs(tvb, offset);
proto_tree_add_item(ssi_entry, hf_aim_fnac_subtype_ssi_buddyname_len, tvb, offset, 2, FALSE);
proto_tree_add_item(ssi_entry, hf_aim_fnac_subtype_ssi_buddyname_len, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
/* Buddy Name */
if (buddyname_length > 0) {
proto_tree_add_item(ssi_entry, hf_aim_fnac_subtype_ssi_buddyname, tvb, offset, buddyname_length, FALSE);
proto_tree_add_item(ssi_entry, hf_aim_fnac_subtype_ssi_buddyname, tvb, offset, buddyname_length, ENC_ASCII|ENC_BIG_ENDIAN);
offset += buddyname_length;
}
/* Buddy group ID */
proto_tree_add_item(ssi_entry, hf_aim_fnac_subtype_ssi_gid, tvb, offset, 2, FALSE);
proto_tree_add_item(ssi_entry, hf_aim_fnac_subtype_ssi_gid, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
/* Buddy ID */
proto_tree_add_item(ssi_entry, hf_aim_fnac_subtype_ssi_bid, tvb, offset, 2, FALSE);
proto_tree_add_item(ssi_entry, hf_aim_fnac_subtype_ssi_bid, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
/* Buddy Type */
proto_tree_add_item(ssi_entry, hf_aim_fnac_subtype_ssi_type, tvb, offset, 2, FALSE);
proto_tree_add_item(ssi_entry, hf_aim_fnac_subtype_ssi_type, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
/* Size of the following TLV in bytes (as opposed to the number of
TLV objects in the chain) */
tlv_len = tvb_get_ntohs(tvb, offset);
proto_tree_add_item(ssi_entry, hf_aim_fnac_subtype_ssi_tlvlen, tvb, offset, 2, FALSE);
proto_tree_add_item(ssi_entry, hf_aim_fnac_subtype_ssi_tlvlen, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
endoffset = offset;
@ -192,7 +192,7 @@ static int dissect_aim_snac_ssi_time_and_items_num(tvbuff_t *tvb, packet_info *p
offset += 4;
/* get number of SSI items */
proto_tree_add_item(tree, hf_aim_fnac_subtype_ssi_numitems, tvb, offset, 2, FALSE);
proto_tree_add_item(tree, hf_aim_fnac_subtype_ssi_numitems, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
return offset;
@ -208,11 +208,11 @@ static int dissect_aim_snac_ssi_list(tvbuff_t *tvb, packet_info *pinfo _U_, prot
gint ssi_entry_size;
/* SSI Version */
proto_tree_add_item(tree, hf_aim_fnac_subtype_ssi_version, tvb, offset, 1, FALSE);
proto_tree_add_item(tree, hf_aim_fnac_subtype_ssi_version, tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
/* Number of items */
proto_tree_add_item(tree, hf_aim_fnac_subtype_ssi_numitems, tvb, offset, 2, FALSE);
proto_tree_add_item(tree, hf_aim_fnac_subtype_ssi_numitems, tvb, offset, 2, ENC_BIG_ENDIAN);
num_items = tvb_get_ntohs(tvb, offset);
offset += 2;
@ -237,28 +237,28 @@ static int dissect_aim_snac_ssi_auth_request(tvbuff_t *tvb, packet_info *pinfo _
/* get buddy length (1 byte) */
guint8 buddyname_length = tvb_get_guint8(tvb, offset);
proto_tree_add_item(tree, hf_aim_fnac_subtype_ssi_buddyname_len8, tvb, offset, 1, FALSE);
proto_tree_add_item(tree, hf_aim_fnac_subtype_ssi_buddyname_len8, tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
/* show buddy name */
if (buddyname_length > 0) {
proto_tree_add_item(tree, hf_aim_fnac_subtype_ssi_buddyname, tvb, offset, buddyname_length, FALSE);
proto_tree_add_item(tree, hf_aim_fnac_subtype_ssi_buddyname, tvb, offset, buddyname_length, ENC_ASCII|ENC_BIG_ENDIAN);
offset += buddyname_length;
}
/* get reason message length (2 bytes) */
reason_length = tvb_get_ntohs(tvb, offset);
proto_tree_add_item(tree, hf_aim_fnac_subtype_ssi_reason_str_len, tvb, offset, 2, FALSE);
proto_tree_add_item(tree, hf_aim_fnac_subtype_ssi_reason_str_len, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
/* show reason message if present */
if (reason_length > 0) {
proto_tree_add_item(tree, hf_aim_fnac_subtype_ssi_reason_str, tvb, offset, reason_length, FALSE);
proto_tree_add_item(tree, hf_aim_fnac_subtype_ssi_reason_str, tvb, offset, reason_length, ENC_ASCII|ENC_BIG_ENDIAN);
offset += reason_length;
}
/* unknown (always 0x0000 ???) */
/*unknown = tvb_get_ntohs(tvb, offset);*/
proto_tree_add_item(tree, hf_aim_fnac_subtype_ssi_grant_auth_unkn, tvb, offset, 2, FALSE);
proto_tree_add_item(tree, hf_aim_fnac_subtype_ssi_grant_auth_unkn, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
return offset;
@ -271,27 +271,27 @@ static int dissect_aim_snac_ssi_auth_reply(tvbuff_t *tvb, packet_info *pinfo _U_
/* get buddy length (1 byte) */
guint8 buddyname_length = tvb_get_guint8(tvb, offset);
proto_tree_add_item(tree, hf_aim_fnac_subtype_ssi_buddyname_len8, tvb, offset, 1, FALSE);
proto_tree_add_item(tree, hf_aim_fnac_subtype_ssi_buddyname_len8, tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
/* show buddy name */
if (buddyname_length > 0) {
proto_tree_add_item(tree, hf_aim_fnac_subtype_ssi_buddyname, tvb, offset, buddyname_length, FALSE);
proto_tree_add_item(tree, hf_aim_fnac_subtype_ssi_buddyname, tvb, offset, buddyname_length, ENC_ASCII|ENC_BIG_ENDIAN);
offset += buddyname_length;
}
/* accept/reject authorization flag */
proto_tree_add_item(tree, hf_aim_fnac_subtype_ssi_allow_auth, tvb, offset, 1, FALSE);
proto_tree_add_item(tree, hf_aim_fnac_subtype_ssi_allow_auth, tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
/* get reason message length (2 bytes) */
reason_length = tvb_get_ntohs(tvb, offset);
proto_tree_add_item(tree, hf_aim_fnac_subtype_ssi_reason_str_len, tvb, offset, 2, FALSE);
proto_tree_add_item(tree, hf_aim_fnac_subtype_ssi_reason_str_len, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
/* show reason message if present */
if (reason_length > 0) {
proto_tree_add_item(tree, hf_aim_fnac_subtype_ssi_reason_str, tvb, offset, reason_length, FALSE);
proto_tree_add_item(tree, hf_aim_fnac_subtype_ssi_reason_str, tvb, offset, reason_length, ENC_ASCII|ENC_BIG_ENDIAN);
offset += reason_length;
}

View File

@ -48,7 +48,7 @@ static gint ett_aim_userlookup = -1;
static int dissect_aim_userlookup_search(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *lookup_tree)
{
proto_tree_add_item(lookup_tree, hf_aim_userlookup_email, tvb, 0, tvb_length(tvb), FALSE);
proto_tree_add_item(lookup_tree, hf_aim_userlookup_email, tvb, 0, tvb_length(tvb), ENC_ASCII|ENC_BIG_ENDIAN);
return tvb_length(tvb);
}

View File

@ -611,26 +611,23 @@ dissect_aim_newconn(tvbuff_t *tvb, packet_info *pinfo, int offset,
col_set_str(pinfo->cinfo, COL_INFO, "New Connection");
if (tvb_length_remaining(tvb, offset) > 0) {
proto_tree_add_item(tree, hf_aim_version, tvb, offset, 4, FALSE);
proto_tree_add_item(tree, hf_aim_version, tvb, offset, 4, ENC_NA);
offset+=4;
offset = dissect_aim_tlv_sequence(tvb, pinfo, offset, tree, aim_client_tlvs);
}
if (tvb_length_remaining(tvb, offset) > 0)
proto_tree_add_item(tree, hf_aim_data, tvb, offset, -1, FALSE);
proto_tree_add_item(tree, hf_aim_data, tvb, offset, -1, ENC_NA);
}
int
dissect_aim_snac_error(tvbuff_t *tvb, packet_info *pinfo, proto_tree *aim_tree)
{
const char *name;
col_add_str(pinfo->cinfo, COL_INFO,
val_to_str(tvb_get_ntohs(tvb, 0), aim_snac_errors, "Unknown SNAC error 0x%02x"));
if ((name = match_strval(tvb_get_ntohs(tvb, 0), aim_snac_errors)) != NULL) {
col_add_str(pinfo->cinfo, COL_INFO, name);
}
proto_tree_add_item (aim_tree, hf_aim_snac_error, tvb, 0, 2, FALSE);
proto_tree_add_item (aim_tree, hf_aim_snac_error, tvb, 0, 2, ENC_BIG_ENDIAN);
return dissect_aim_tlv_sequence(tvb, pinfo, 2, aim_tree, aim_client_tlvs);
}
@ -638,13 +635,10 @@ dissect_aim_snac_error(tvbuff_t *tvb, packet_info *pinfo, proto_tree *aim_tree)
int
dissect_aim_ssi_result(tvbuff_t *tvb, packet_info *pinfo, proto_tree *aim_tree)
{
const char *name;
col_add_str(pinfo->cinfo, COL_INFO,
val_to_str(tvb_get_ntohs(tvb, 0), aim_ssi_result_codes, "Unknown SSI result code 0x%02x"));
if ((name = match_strval(tvb_get_ntohs(tvb, 0), aim_ssi_result_codes)) != NULL) {
col_add_str(pinfo->cinfo, COL_INFO, name);
}
proto_tree_add_item (aim_tree, hf_aim_ssi_result_code, tvb, 0, 2, FALSE);
proto_tree_add_item (aim_tree, hf_aim_ssi_result_code, tvb, 0, 2, ENC_BIG_ENDIAN);
return 2;
}
@ -655,7 +649,7 @@ dissect_aim_userinfo(tvbuff_t *tvb, packet_info *pinfo,
{
offset = dissect_aim_buddyname(tvb, pinfo, offset, tree);
proto_tree_add_item(tree, hf_aim_userinfo_warninglevel, tvb, offset, 2, FALSE);
proto_tree_add_item(tree, hf_aim_userinfo_warninglevel, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
return dissect_aim_tlv_list(tvb, pinfo, offset, tree, aim_onlinebuddy_tlvs);
@ -772,7 +766,7 @@ dissect_aim_snac(tvbuff_t *tvb, packet_info *pinfo, int offset,
if(aim_tree && family != NULL)
{
proto_item *ti = proto_tree_add_item(root_tree, family->proto_id, subtvb, 0, -1, FALSE);
proto_item *ti = proto_tree_add_item(root_tree, family->proto_id, subtvb, 0, -1, ENC_NA);
family_tree = proto_item_add_subtree(ti, family->ett);
if(subtype)
proto_item_append_text(ti, ", %s", subtype->name);
@ -794,7 +788,7 @@ dissect_aim_flap_err(tvbuff_t *tvb, packet_info *pinfo, int offset,
/* Show the undissected payload */
if (tvb_length_remaining(tvb, offset) > 0)
proto_tree_add_item(tree, hf_aim_data, tvb, offset, -1, FALSE);
proto_tree_add_item(tree, hf_aim_data, tvb, offset, -1, ENC_NA);
}
static void
@ -805,7 +799,7 @@ dissect_aim_keep_alive(tvbuff_t *tvb, packet_info *pinfo, int offset,
/* Show the undissected payload */
if (tvb_length_remaining(tvb, offset) > 0)
proto_tree_add_item(tree, hf_aim_data, tvb, offset, -1, FALSE);
proto_tree_add_item(tree, hf_aim_data, tvb, offset, -1, ENC_NA);
}
static void
@ -825,7 +819,7 @@ dissect_aim_unknown_channel(tvbuff_t *tvb, packet_info *pinfo, int offset,
/* Show the undissected payload */
if (tvb_length_remaining(tvb, offset) > 0)
proto_tree_add_item(tree, hf_aim_data, tvb, offset, -1, FALSE);
proto_tree_add_item(tree, hf_aim_data, tvb, offset, -1, ENC_NA);
}
int
@ -845,8 +839,8 @@ dissect_aim_buddyname(tvbuff_t *tvb, packet_info *pinfo _U_, int offset,
"Buddy: %s",
tvb_format_text(tvb, offset, buddyname_length));
buddy_tree = proto_item_add_subtree(ti, ett_aim_buddyname);
proto_tree_add_item(buddy_tree, hf_aim_buddyname_len, tvb, offset-1, 1, FALSE);
proto_tree_add_item(buddy_tree, hf_aim_buddyname, tvb, offset, buddyname_length, FALSE);
proto_tree_add_item(buddy_tree, hf_aim_buddyname_len, tvb, offset-1, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(buddy_tree, hf_aim_buddyname, tvb, offset, buddyname_length, ENC_ASCII|ENC_BIG_ENDIAN);
}
return offset+buddyname_length;
@ -1151,17 +1145,17 @@ dissect_aim_tlv_value_dcinfo(proto_item *ti, guint16 valueid _U_, tvbuff_t *tvb,
proto_tree *dctree = proto_item_add_subtree(ti, ett_aim_dcinfo);
proto_tree_add_item(dctree, hf_aim_dcinfo_ip , tvb, offset, 4, FALSE); offset+=4;
proto_tree_add_item(dctree, hf_aim_dcinfo_tcpport, tvb, offset, 4, FALSE); offset+=4;
proto_tree_add_item(dctree, hf_aim_dcinfo_type, tvb, offset, 1, FALSE); offset+=1;
proto_tree_add_item(dctree, hf_aim_dcinfo_proto_version, tvb, offset, 2, FALSE); offset+=2;
proto_tree_add_item(dctree, hf_aim_dcinfo_auth_cookie, tvb, offset, 4, FALSE); offset+=2;
proto_tree_add_item(dctree, hf_aim_dcinfo_webport, tvb, offset, 4, FALSE); offset+=4;
proto_tree_add_item(dctree, hf_aim_dcinfo_client_future, tvb, offset, 4, FALSE); offset+=4;
proto_tree_add_item(dctree, hf_aim_dcinfo_last_info_update, tvb, offset, 4, FALSE); offset+=4;
proto_tree_add_item(dctree, hf_aim_dcinfo_last_ext_info_update, tvb, offset, 4, FALSE); offset+=4;
proto_tree_add_item(dctree, hf_aim_dcinfo_last_ext_status_update, tvb, offset, 4, FALSE); offset+=4;
proto_tree_add_item(dctree, hf_aim_dcinfo_unknown, tvb, offset, 2, FALSE); offset+=2;
proto_tree_add_item(dctree, hf_aim_dcinfo_ip , tvb, offset, 4, ENC_BIG_ENDIAN); offset+=4;
proto_tree_add_item(dctree, hf_aim_dcinfo_tcpport, tvb, offset, 4, ENC_BIG_ENDIAN); offset+=4;
proto_tree_add_item(dctree, hf_aim_dcinfo_type, tvb, offset, 1, ENC_BIG_ENDIAN); offset+=1;
proto_tree_add_item(dctree, hf_aim_dcinfo_proto_version, tvb, offset, 2, ENC_BIG_ENDIAN); offset+=2;
proto_tree_add_item(dctree, hf_aim_dcinfo_auth_cookie, tvb, offset, 4, ENC_NA); offset+=2;
proto_tree_add_item(dctree, hf_aim_dcinfo_webport, tvb, offset, 4, ENC_BIG_ENDIAN); offset+=4;
proto_tree_add_item(dctree, hf_aim_dcinfo_client_future, tvb, offset, 4, ENC_BIG_ENDIAN); offset+=4;
proto_tree_add_item(dctree, hf_aim_dcinfo_last_info_update, tvb, offset, 4, ENC_BIG_ENDIAN); offset+=4;
proto_tree_add_item(dctree, hf_aim_dcinfo_last_ext_info_update, tvb, offset, 4, ENC_BIG_ENDIAN); offset+=4;
proto_tree_add_item(dctree, hf_aim_dcinfo_last_ext_status_update, tvb, offset, 4, ENC_BIG_ENDIAN); offset+=4;
proto_tree_add_item(dctree, hf_aim_dcinfo_unknown, tvb, offset, 2, ENC_BIG_ENDIAN); offset+=2;
return offset;
}
@ -1251,25 +1245,25 @@ dissect_aim_tlv_value_messageblock (proto_item *ti, guint16 valueid _U_, tvbuff_
/* Features descriptor */
proto_tree_add_item(entry, hf_aim_messageblock_featuresdes, tvb, offset,
2, FALSE);
2, ENC_BIG_ENDIAN);
offset += 2;
/* Features Length */
featurelen = tvb_get_ntohs(tvb, offset);
proto_tree_add_item(entry, hf_aim_messageblock_featureslen, tvb, offset,
2, FALSE);
2, ENC_BIG_ENDIAN);
offset += 2;
/* Features (should be expanded further @@@@@@@ ) */
proto_tree_add_item(entry, hf_aim_messageblock_features, tvb, offset,
featurelen, FALSE);
featurelen, ENC_NA);
offset += featurelen;
/* There can be multiple messages in this message block */
while (tvb_length_remaining(tvb, offset) > 0) {
/* Info field */
proto_tree_add_item(entry, hf_aim_messageblock_info, tvb,
offset, 2, FALSE);
offset, 2, ENC_BIG_ENDIAN);
offset += 2;
/* Block length (includes charset and charsubset) */
@ -1281,17 +1275,17 @@ dissect_aim_tlv_value_messageblock (proto_item *ti, guint16 valueid _U_, tvbuff_
break;
}
proto_tree_add_item(entry, hf_aim_messageblock_len, tvb, offset,
2, FALSE);
2, ENC_BIG_ENDIAN);
offset += 2;
/* Character set */
proto_tree_add_item(entry, hf_aim_messageblock_charset, tvb,
offset, 2, FALSE);
offset, 2, ENC_BIG_ENDIAN);
offset += 2;
/* Character subset */
proto_tree_add_item(entry, hf_aim_messageblock_charsubset, tvb,
offset, 2, FALSE);
offset, 2, ENC_BIG_ENDIAN);
offset += 2;
/* The actual message */
@ -1299,7 +1293,7 @@ dissect_aim_tlv_value_messageblock (proto_item *ti, guint16 valueid _U_, tvbuff_
proto_item_set_text(ti, "Message: %s",
format_text(buf, blocklen - 4));
proto_tree_add_item(entry, hf_aim_messageblock_message, tvb,
offset, blocklen-4, FALSE);
offset, blocklen-4, ENC_ASCII|ENC_BIG_ENDIAN);
offset += tvb_length_remaining(tvb, offset);
}
@ -1397,7 +1391,7 @@ dissect_aim_tlv_list(tvbuff_t *tvb, packet_info *pinfo, int offset,
{
guint16 i, tlv_count = tvb_get_ntohs(tvb, offset);
proto_tree_add_item(tree, hf_aim_tlvcount, tvb, offset, 2, FALSE);
proto_tree_add_item(tree, hf_aim_tlvcount, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
for(i = 0; i < tlv_count; i++) {
@ -1454,10 +1448,10 @@ dissect_aim_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* 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_aim, tvb, 0, -1, FALSE);
ti = proto_tree_add_item(tree, proto_aim, tvb, 0, -1, ENC_NA);
aim_tree = proto_item_add_subtree(ti, ett_aim);
proto_tree_add_uint(aim_tree, hf_aim_cmd_start, tvb, 0, 1, '*');
proto_tree_add_item(aim_tree, hf_aim_channel, tvb, 1, 1, FALSE);
proto_tree_add_item(aim_tree, hf_aim_channel, tvb, 1, 1, ENC_BIG_ENDIAN);
proto_tree_add_uint(aim_tree, hf_aim_seqno, tvb, 2, 2, hdr_sequence_no);
proto_tree_add_uint(aim_tree, hf_aim_data_len, tvb, 4, 2, hdr_data_field_length);

View File

@ -40,8 +40,9 @@
/* IMPORTANT IMPLEMENTATION NOTES
*
* You need to be looking at: jk/doc/AJP13.html in the
* jakarta-tomcat-connectors repository.
* You need to be looking at:
*
* http://tomcat.apache.org/connectors-doc/ajp/ajpv13a.html
*
* If you're a wireshark dissector guru, then you can skip the rest of
* this. I'm writing it all down because I've written 3 dissectors so
@ -157,17 +158,24 @@ static const value_string rsp_header_codes[] = {
};
#define MTYPE_FORWARD_REQUEST 2
#define MTYPE_SEND_BODY_CHUNK 3
#define MTYPE_SEND_HEADERS 4
#define MTYPE_END_RESPONSE 5
#define MTYPE_GET_BODY_CHUNK 6
#define MTYPE_SHUTDOWN 7
#define MTYPE_CPONG 9
#define MTYPE_CPING 10
static const value_string mtype_codes[] = {
{ 0, "BAD" },
{ 1, "BAD" },
{ 2, "FORWARD REQUEST" },
{ 3, "SEND BODY CHUNK" },
{ 4, "SEND HEADERS" },
{ 5, "END RESPONSE" },
{ 6, "GET BODY CHUNK" },
{ 7, "SHUTDOWN" },
{ 9, "CPONG" },
{10, "CPING" },
{ MTYPE_FORWARD_REQUEST, "FORWARD REQUEST" },
{ MTYPE_SEND_BODY_CHUNK, "SEND BODY CHUNK" },
{ MTYPE_SEND_HEADERS, "SEND HEADERS" },
{ MTYPE_END_RESPONSE, "END RESPONSE" },
{ MTYPE_GET_BODY_CHUNK, "GET BODY CHUNK" },
{ MTYPE_SHUTDOWN, "SHUTDOWN" },
{ MTYPE_CPONG, "CPONG" },
{ MTYPE_CPING, "CPING" },
{ 0, NULL }
};
@ -233,7 +241,7 @@ typedef struct ajp13_frame_data {
/* ajp13, in sort of a belt-and-suspenders move, encodes strings with
* both a leading length field, and a trailing null. Mostly, see
* AJPv13.html. The returned length _includes_ the trailing null, if
* ajpv13a.html. The returned length _includes_ the trailing null, if
* there is one.
*
* XXX - is there a tvbuff routine to handle this?
@ -258,42 +266,40 @@ ajp13_get_nstring(tvbuff_t *tvb, gint offset, guint16* ret_len)
static void
display_rsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ajp13_tree, ajp13_conv_data* cd)
{
const gchar* msg_code = NULL;
int pos = 0;
guint8 mcode = 0;
char *mcode_buf;
int i;
/* MAGIC
*/
if (ajp13_tree)
proto_tree_add_item(ajp13_tree, hf_ajp13_magic, tvb, pos, 2, 0);
proto_tree_add_item(ajp13_tree, hf_ajp13_magic, tvb, pos, 2, ENC_NA);
pos+=2;
/* PDU LENGTH
*/
if (ajp13_tree)
proto_tree_add_item(ajp13_tree, hf_ajp13_len, tvb, pos, 2, 0);
proto_tree_add_item(ajp13_tree, hf_ajp13_len, tvb, pos, 2, ENC_BIG_ENDIAN);
pos+=2;
/* MESSAGE TYPE CODE
*/
mcode = tvb_get_guint8(tvb, pos);
msg_code = val_to_str(mcode, mtype_codes, "UNKNOWN");
mcode_buf=ep_strdup_printf("(%d) %s", mcode, msg_code);
col_append_str(pinfo->cinfo, COL_INFO, val_to_str(mcode, mtype_codes, "Unknown message code %u"));
if (ajp13_tree)
proto_tree_add_string(ajp13_tree, hf_ajp13_code, tvb, pos, 1, mcode_buf);
proto_tree_add_item(ajp13_tree, hf_ajp13_code, tvb, pos, 1, ENC_BIG_ENDIAN);
pos+=1;
col_append_str(pinfo->cinfo, COL_INFO, msg_code);
switch (mcode) {
if (mcode == 5) {
case MTYPE_END_RESPONSE:
if (ajp13_tree)
proto_tree_add_item(ajp13_tree, hf_ajp13_reusep, tvb, pos, 1, 0);
proto_tree_add_item(ajp13_tree, hf_ajp13_reusep, tvb, pos, 1, ENC_BIG_ENDIAN);
pos+=1;
break;
} else if (mcode == 4) {
case MTYPE_SEND_HEADERS:
{
const gchar *rsmsg;
guint16 rsmsg_len;
guint16 nhdr;
@ -302,27 +308,25 @@ display_rsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ajp13_tree, ajp13_con
/* HTTP RESPONSE STATUS CODE
*/
rcode_num = tvb_get_ntohs(tvb, pos);
col_append_fstr(pinfo->cinfo, COL_INFO, ":%d", rcode_num);
if (ajp13_tree)
proto_tree_add_item(ajp13_tree, hf_ajp13_rstatus, tvb, pos, 2, 0);
proto_tree_add_item(ajp13_tree, hf_ajp13_rstatus, tvb, pos, 2, ENC_BIG_ENDIAN);
pos+=2;
if(check_col(pinfo->cinfo, COL_INFO))
col_append_fstr(pinfo->cinfo, COL_INFO, ":%d", rcode_num);
/* HTTP RESPONSE STATUS MESSAGE
*/
rsmsg = ajp13_get_nstring(tvb, pos, &rsmsg_len);
pos+=2;
col_append_fstr(pinfo->cinfo, COL_INFO, " %s", rsmsg);
if (ajp13_tree)
proto_tree_add_item(ajp13_tree, hf_ajp13_rsmsg, tvb, pos, rsmsg_len, 0);
proto_tree_add_item(ajp13_tree, hf_ajp13_rsmsg, tvb, pos, rsmsg_len, ENC_UTF_8|ENC_BIG_ENDIAN);
pos+=rsmsg_len;
if(check_col(pinfo->cinfo, COL_INFO))
col_append_fstr(pinfo->cinfo, COL_INFO, " %s", rsmsg);
/* NUMBER OF HEADERS
*/
nhdr = tvb_get_ntohs(tvb, pos);
if (ajp13_tree)
proto_tree_add_item(ajp13_tree, hf_ajp13_nhdr, tvb, pos, 2, 0);
proto_tree_add_item(ajp13_tree, hf_ajp13_nhdr, tvb, pos, 2, ENC_BIG_ENDIAN);
pos+=2;
/* HEADERS
@ -372,22 +376,29 @@ display_rsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ajp13_tree, ajp13_con
proto_tree_add_string_format(ajp13_tree, hf_ajp13_hval, tvb, orig_pos, dp, "%s : %s", hname, hval);
}
}
break;
}
} else if (mcode == 6) {
case MTYPE_GET_BODY_CHUNK:
{
guint16 rlen;
rlen = tvb_get_ntohs(tvb, pos);
cd->content_length = rlen;
if (ajp13_tree)
proto_tree_add_item(ajp13_tree, hf_ajp13_rlen, tvb, pos, 2, 0);
proto_tree_add_item(ajp13_tree, hf_ajp13_rlen, tvb, pos, 2, ENC_BIG_ENDIAN);
pos+=2;
break;
}
} else if ( mcode == 9 ) {
case MTYPE_CPONG:
break;
} else {
default:
/* MESSAGE DATA (COPOUT)
*/
if (ajp13_tree)
proto_tree_add_item(ajp13_tree, hf_ajp13_data, tvb, pos+2, -1, 0);
proto_tree_add_item(ajp13_tree, hf_ajp13_data, tvb, pos+2, -1, ENC_UTF_8|ENC_BIG_ENDIAN);
break;
}
}
@ -412,13 +423,13 @@ display_req_body(tvbuff_t *tvb, proto_tree *ajp13_tree, ajp13_conv_data* cd)
/* MAGIC
*/
proto_tree_add_item(ajp13_tree, hf_ajp13_magic, tvb, pos, 2, 0);
proto_tree_add_item(ajp13_tree, hf_ajp13_magic, tvb, pos, 2, ENC_NA);
pos+=2;
/* PACKET LENGTH
*/
packet_length = tvb_get_ntohs(tvb, pos);
proto_tree_add_item(ajp13_tree, hf_ajp13_len, tvb, pos, 2, 0);
proto_tree_add_item(ajp13_tree, hf_ajp13_len, tvb, pos, 2, ENC_BIG_ENDIAN);
pos+=2;
if (packet_length == 0)
@ -436,7 +447,7 @@ display_req_body(tvbuff_t *tvb, proto_tree *ajp13_tree, ajp13_conv_data* cd)
*/
content_length = tvb_get_ntohs( tvb, pos);
cd->content_length -= content_length;
proto_tree_add_item(ajp13_tree, hf_ajp13_data, tvb, pos+2, content_length-1, 0);
proto_tree_add_item(ajp13_tree, hf_ajp13_data, tvb, pos+2, content_length-1, ENC_UTF_8|ENC_BIG_ENDIAN);
}
@ -468,50 +479,38 @@ display_req_forward(tvbuff_t *tvb, packet_info *pinfo,
guint i;
if (ajp13_tree)
proto_tree_add_item(ajp13_tree, hf_ajp13_magic, tvb, pos, 2, 0);
proto_tree_add_item(ajp13_tree, hf_ajp13_magic, tvb, pos, 2, ENC_NA);
pos+=2;
if (ajp13_tree)
proto_tree_add_item(ajp13_tree, hf_ajp13_len, tvb, pos, 2, 0);
proto_tree_add_item(ajp13_tree, hf_ajp13_len, tvb, pos, 2, ENC_BIG_ENDIAN);
pos+=2;
/* PACKET CODE
*/
cod = tvb_get_guint8(tvb, 4);
if (ajp13_tree) {
const gchar* msg_code = NULL;
char *mcode_buf;
msg_code = val_to_str(cod, mtype_codes, "UNKNOWN");
mcode_buf=ep_strdup_printf("(%d) %s", cod, msg_code);
proto_tree_add_string(ajp13_tree, hf_ajp13_code, tvb, pos, 1, mcode_buf);
}
if (ajp13_tree)
proto_tree_add_item(ajp13_tree, hf_ajp13_code, tvb, pos, 1, ENC_BIG_ENDIAN);
pos+=1;
if ( cod == 10 ) {
if ( cod == MTYPE_CPING ) {
col_append_str(pinfo->cinfo, COL_INFO, "CPING" );
return;
}
/* HTTP METHOD (ENCODED AS INTEGER)
*/
{
const gchar* meth_code = NULL;
meth = tvb_get_guint8(tvb, pos);
meth_code = val_to_str(meth, http_method_codes, "UNKNOWN");
if (ajp13_tree) {
char *mcode_buf;
mcode_buf=ep_strdup_printf("(%d) %s", meth, meth_code);
proto_tree_add_string(ajp13_tree, hf_ajp13_method, tvb, pos, 1, mcode_buf);
}
col_append_str(pinfo->cinfo, COL_INFO, meth_code);
pos+=1;
}
meth = tvb_get_guint8(tvb, pos);
col_append_str(pinfo->cinfo, COL_INFO, val_to_str(meth, http_method_codes, "Unknown method %u"));
if (ajp13_tree)
proto_tree_add_item(ajp13_tree, hf_ajp13_method, tvb, pos, 1, ENC_BIG_ENDIAN);
pos+=1;
/* HTTP VERSION STRING
*/
ver = ajp13_get_nstring(tvb, pos, &ver_len);
pos+=2; /* skip over size */
if (ajp13_tree)
proto_tree_add_item(ajp13_tree, hf_ajp13_ver, tvb, pos, ver_len, 0);
proto_tree_add_item(ajp13_tree, hf_ajp13_ver, tvb, pos, ver_len, ENC_UTF_8|ENC_BIG_ENDIAN);
pos=pos+ver_len; /* skip over chars + trailing null */
/* URI
@ -519,7 +518,7 @@ display_req_forward(tvbuff_t *tvb, packet_info *pinfo,
uri = ajp13_get_nstring(tvb, pos, &uri_len);
pos+=2; /* skip over size */
if (ajp13_tree)
proto_tree_add_item(ajp13_tree, hf_ajp13_uri, tvb, pos, uri_len, 0);
proto_tree_add_item(ajp13_tree, hf_ajp13_uri, tvb, pos, uri_len, ENC_UTF_8|ENC_BIG_ENDIAN);
pos=pos+uri_len; /* skip over chars + trailing null */
@ -532,7 +531,7 @@ display_req_forward(tvbuff_t *tvb, packet_info *pinfo,
ajp13_get_nstring(tvb, pos, &raddr_len);
pos+=2; /* skip over size */
if (ajp13_tree)
proto_tree_add_item(ajp13_tree, hf_ajp13_raddr, tvb, pos, raddr_len, 0);
proto_tree_add_item(ajp13_tree, hf_ajp13_raddr, tvb, pos, raddr_len, ENC_UTF_8|ENC_BIG_ENDIAN);
pos=pos+raddr_len; /* skip over chars + trailing null */
/* REMOTE HOST
@ -540,7 +539,7 @@ display_req_forward(tvbuff_t *tvb, packet_info *pinfo,
ajp13_get_nstring(tvb, pos, &rhost_len);
pos+=2; /* skip over size */
if (ajp13_tree)
proto_tree_add_item(ajp13_tree, hf_ajp13_rhost, tvb, pos, rhost_len, 0);
proto_tree_add_item(ajp13_tree, hf_ajp13_rhost, tvb, pos, rhost_len, ENC_UTF_8|ENC_BIG_ENDIAN);
pos=pos+rhost_len; /* skip over chars + trailing null */
/* SERVER NAME
@ -548,19 +547,19 @@ display_req_forward(tvbuff_t *tvb, packet_info *pinfo,
ajp13_get_nstring(tvb, pos, &srv_len);
pos+=2; /* skip over size */
if (ajp13_tree)
proto_tree_add_item(ajp13_tree, hf_ajp13_srv, tvb, pos, srv_len, 0);
proto_tree_add_item(ajp13_tree, hf_ajp13_srv, tvb, pos, srv_len, ENC_UTF_8|ENC_BIG_ENDIAN);
pos=pos+srv_len; /* skip over chars + trailing null */
/* SERVER PORT
*/
if (ajp13_tree)
proto_tree_add_item(ajp13_tree, hf_ajp13_port, tvb, pos, 2, 0);
proto_tree_add_item(ajp13_tree, hf_ajp13_port, tvb, pos, 2, ENC_BIG_ENDIAN);
pos+=2;
/* IS SSL?
*/
if (ajp13_tree)
proto_tree_add_item(ajp13_tree, hf_ajp13_sslp, tvb, pos, 1, 0);
proto_tree_add_item(ajp13_tree, hf_ajp13_sslp, tvb, pos, 1, ENC_NA);
pos+=1;
/* NUM HEADERS
@ -568,7 +567,7 @@ display_req_forward(tvbuff_t *tvb, packet_info *pinfo,
nhdr = tvb_get_ntohs(tvb, pos);
if (ajp13_tree)
proto_tree_add_item(ajp13_tree, hf_ajp13_nhdr, tvb, pos, 2, 0);
proto_tree_add_item(ajp13_tree, hf_ajp13_nhdr, tvb, pos, 2, ENC_BIG_ENDIAN);
pos+=2;
cd->content_length = 0;
@ -694,7 +693,7 @@ dissect_ajp13_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if (tree) {
proto_item *ti;
ti = proto_tree_add_item(tree, proto_ajp13, tvb, 0, tvb_length(tvb), FALSE);
ti = proto_tree_add_item(tree, proto_ajp13, tvb, 0, -1, ENC_NA);
ajp13_tree = proto_item_add_subtree(ti, ett_ajp13);
}
@ -759,11 +758,11 @@ proto_register_ajp13(void)
HFILL }
},
{ &hf_ajp13_code,
{ "Code", "ajp13.code", FT_STRING, BASE_NONE, NULL, 0x0, "Type Code",
{ "Code", "ajp13.code", FT_UINT32, BASE_DEC, VALS(mtype_codes), 0x0, "Type Code",
HFILL }
},
{ &hf_ajp13_method,
{ "Method", "ajp13.method", FT_STRING, BASE_NONE, NULL, 0x0, "HTTP Method",
{ "Method", "ajp13.method", FT_UINT8, BASE_DEC, VALS(http_method_codes), 0x0, "HTTP Method",
HFILL }
},
{ &hf_ajp13_ver,
@ -791,7 +790,7 @@ proto_register_ajp13(void)
HFILL }
},
{ &hf_ajp13_sslp,
{ "SSLP", "ajp13.sslp", FT_UINT8, BASE_DEC, NULL, 0x0, "Is SSL?",
{ "SSLP", "ajp13.sslp", FT_BOOLEAN, BASE_NONE, NULL, 0x0, "Is SSL?",
HFILL }
},
{ &hf_ajp13_nhdr,