Convert proto_tree_add_boolean to proto_tree_add_bitmask_[value|value_with_flags|list]

Final part.

While there change deprecated tvb_length-xxx() calls

Change-Id: I8b0cf823c2d37a92c58fcb653f7fe1e8fdad5a79
Reviewed-on: https://code.wireshark.org/review/8642
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
Michael Mann 2015-05-21 22:20:29 -04:00 committed by Anders Broman
parent a25c46bc7b
commit 4963c77285
18 changed files with 496 additions and 595 deletions

View File

@ -1468,7 +1468,7 @@ static gboolean qnet6_lwl4_check_crc = TRUE;
/*
* when dissect_qnet6_lr is called in dissect_qnet6, it has already
* checked whether left length > sizeof(struct qnet6_lr_pkt) so here we
* have to check whether off, len > left length proto_tree_add_text and
* have to check whether off, len > left length proto_tree_add_subtree and
* proto_tree_add_string's difference are text doesn't need the hf_... so
* it can't be searched.
*/
@ -4022,6 +4022,12 @@ dissect_qnet6(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void * dat
gint offset = 0;
gint len, plen, cklen;
guint32 crc, crcp;
static const int * flags[] = {
&hf_qnet6_l4_flags_first,
&hf_qnet6_l4_flags_last,
&hf_qnet6_l4_flags_crc,
NULL
};
memset(crcbuf, 0, sizeof(crcbuf));
/*
@ -4060,18 +4066,9 @@ dissect_qnet6(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void * dat
/*
* flags
*/
proto_tree_add_bitmask_with_flags(qnet6_tree, tvb, offset,
hf_qnet6_l4_flags, ett_qnet6_flags, flags, ENC_NA, BMT_NO_APPEND|BMT_NO_FALSE);
qflags = tvb_get_guint8(tvb, offset);
ti = proto_tree_add_uint(qnet6_tree, hf_qnet6_l4_flags, tvb, offset, 1, qflags);
stree = proto_item_add_subtree(ti, ett_qnet6_flags);
proto_tree_add_boolean(stree, hf_qnet6_l4_flags_first, tvb, offset, 1, qflags);
if (qflags & (QNET_L4_FLAGS_FIRST))
proto_item_append_text(ti, " (First Fragment)");
proto_tree_add_boolean(stree, hf_qnet6_l4_flags_last, tvb, offset, 1, qflags);
if (qflags & QNET_L4_FLAGS_LAST)
proto_item_append_text(ti, " (Last Fragment)");
proto_tree_add_boolean(stree, hf_qnet6_l4_flags_crc, tvb, offset, 1, qflags);
if (qflags & QNET_L4_FLAGS_CRC)
proto_item_append_text(ti, " (CRC)");
offset++;
/*
* layer
@ -4310,17 +4307,17 @@ proto_register_qnet6(void)
NULL, HFILL}
},
{&hf_qnet6_l4_flags_first,
{"First", "qnet6.l4.flags.first",
{"First Fragment", "qnet6.l4.flags.first",
FT_BOOLEAN, 8, TFS(&tfs_yes_no), QNET_L4_FLAGS_FIRST,
"QNET6 L4 Packet first fragment", HFILL}
},
{&hf_qnet6_l4_flags_last,
{"Last", "qnet6.l4.flags.last",
{"Last Fragment", "qnet6.l4.flags.last",
FT_BOOLEAN, 8, TFS(&tfs_yes_no), QNET_L4_FLAGS_LAST,
"QNET6 L4 Packet last fragment", HFILL}
},
{&hf_qnet6_l4_flags_crc,
{"Crc", "qnet6.l4.flags.crc",
{"CRC", "qnet6.l4.flags.crc",
FT_BOOLEAN, 8, TFS(&tfs_used_notused), QNET_L4_FLAGS_CRC,
"QNET6 L4 Packet crc used", HFILL}
},

View File

@ -389,7 +389,7 @@ static const gchar* dissect_packetcable_redirected_from_info(proto_tree* tree, t
static const gchar* dissect_packetcable_time_electr_surv_ind(proto_tree* tree, tvbuff_t* tvb, packet_info *pinfo _U_) {
if (tvb_length(tvb) == 0)
if (tvb_reported_length(tvb) == 0)
return "None";
proto_tree_add_item(tree, hf_packetcable_electronic_surveillance_indication_df_cdc_address,
@ -418,18 +418,18 @@ static const gchar* dissect_packetcable_term_dsply_info(proto_tree* tree, tvbuff
/* XXX - this logic seems buggy because the offsets don't line up */
guint8 bitmask = tvb_get_guint8(tvb, 2);
guint intval = 1;
proto_item* ti = proto_tree_add_item(tree, hf_packetcable_terminal_display_info_terminal_display_status_bitmask,
tvb, 0, 1, ENC_BIG_ENDIAN);
proto_tree* obj_tree = proto_item_add_subtree(ti, ett_packetcable_term_dsply);
static const int * flags[] = {
&hf_packetcable_terminal_display_info_sbm_general_display,
&hf_packetcable_terminal_display_info_sbm_calling_number,
&hf_packetcable_terminal_display_info_sbm_calling_name,
&hf_packetcable_terminal_display_info_sbm_message_waiting,
NULL
};
proto_tree_add_boolean(obj_tree, hf_packetcable_terminal_display_info_sbm_general_display,
tvb, 0, 1, bitmask);
proto_tree_add_boolean(obj_tree, hf_packetcable_terminal_display_info_sbm_calling_number,
tvb, 0, 1, bitmask);
proto_tree_add_boolean(obj_tree, hf_packetcable_terminal_display_info_sbm_calling_name,
tvb, 0, 1, bitmask);
proto_tree_add_boolean(obj_tree, hf_packetcable_terminal_display_info_sbm_message_waiting,
tvb, 0, 1, bitmask);
proto_item* ti = proto_tree_add_bitmask_with_flags(tree, tvb, 0, hf_packetcable_terminal_display_info_terminal_display_status_bitmask,
ett_packetcable_term_dsply, flags, ENC_NA, BMT_NO_APPEND|BMT_NO_FALSE);
proto_tree* obj_tree = proto_item_add_subtree(ti, ett_packetcable_term_dsply);
if (bitmask & PACKETCABLE_GENERAL_DISPLAY) {
proto_tree_add_item(obj_tree, hf_packetcable_terminal_display_info_general_display,

View File

@ -150,18 +150,18 @@ dissect_rfc2190( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree )
offset++;
/* TR 4 octect, 8 bits */
proto_tree_add_uint( rfc2190_tree, hf_rfc2190_tr, tvb, offset, 1, tvb_get_guint8( tvb, offset ) );
proto_tree_add_item( rfc2190_tree, hf_rfc2190_tr, tvb, offset, 1, ENC_NA );
offset++;
} else { /* MODE B or MODE C */
/* QUANT 2 octect, 5 bits */
proto_tree_add_uint( rfc2190_tree, hf_rfc2190_quant, tvb, offset, 1, tvb_get_guint8( tvb, offset ) & 0x1f );
proto_tree_add_item( rfc2190_tree, hf_rfc2190_quant, tvb, offset, 1, ENC_NA);
offset++;
/* GOBN 3 octect, 5 bits */
proto_tree_add_uint( rfc2190_tree, hf_rfc2190_gobn, tvb, offset, 1, ( tvb_get_guint8( tvb, offset ) & 0xf8 ) >> 3);
proto_tree_add_item( rfc2190_tree, hf_rfc2190_gobn, tvb, offset, 1, ENC_NA);
/* MBA 3 octect, 3 bits + 4 octect 6 bits */
proto_tree_add_uint( rfc2190_tree, hf_rfc2190_mba, tvb, offset, 2, ( ( tvb_get_guint8( tvb, offset ) & 0x7 ) << 6 ) + ( ( tvb_get_guint8( tvb, offset + 1 ) & 0xfc ) >> 2 ) );
@ -197,7 +197,7 @@ dissect_rfc2190( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree )
offset++;
/* VMV2 8th octect, 7 bits*/
proto_tree_add_uint( rfc2190_tree, hf_rfc2190_vmv2, tvb, offset, 1, tvb_get_guint8( tvb, offset ) & 0x7f );
proto_tree_add_item( rfc2190_tree, hf_rfc2190_vmv2, tvb, offset, 1, ENC_NA);
offset++;
@ -409,7 +409,7 @@ proto_register_rfc2190(void)
FT_UINT8,
BASE_DEC,
NULL,
0x0,
0x1F,
"Quantization value for the first MB coded at the starting of the packet.", HFILL
}
},
@ -421,7 +421,7 @@ proto_register_rfc2190(void)
FT_UINT8,
BASE_DEC,
NULL,
0x0,
0xF8,
"GOB number in effect at the start of the packet.", HFILL
}
},
@ -481,7 +481,7 @@ proto_register_rfc2190(void)
FT_UINT8,
BASE_DEC,
NULL,
0x0,
0x7F,
"Vertical motion vector predictor for block number 3 in the first MB in this packet when four motion vectors are used with the advanced prediction option.", HFILL
}
},

View File

@ -602,7 +602,7 @@ dissect_rpc_opaque_data(tvbuff_t *tvb, int offset,
string_length = tvb_get_ntohl(tvb,offset);
data_offset = offset + 4;
}
string_length_captured = tvb_length_remaining(tvb, data_offset);
string_length_captured = tvb_captured_length_remaining(tvb, data_offset);
string_length_packet = tvb_reported_length_remaining(tvb, data_offset);
string_length_full = rpc_roundup(string_length);
if (string_length_captured < string_length) {
@ -620,7 +620,7 @@ dissect_rpc_opaque_data(tvbuff_t *tvb, int offset,
/* full string data */
string_length_copy = string_length;
fill_length = string_length_full - string_length;
fill_length_captured = tvb_length_remaining(tvb,
fill_length_captured = tvb_captured_length_remaining(tvb,
data_offset + string_length);
fill_length_packet = tvb_reported_length_remaining(tvb,
data_offset + string_length);
@ -1103,17 +1103,10 @@ dissect_rpc_authglusterfs_v2_cred(tvbuff_t* tvb, proto_tree* tree, int offset)
static int
dissect_rpc_authgssapi_cred(tvbuff_t* tvb, proto_tree* tree, int offset)
{
guint agc_v;
guint agc_msg;
agc_v = tvb_get_ntohl(tvb, offset);
proto_tree_add_uint(tree, hf_rpc_authgssapi_v,
tvb, offset, 4, agc_v);
proto_tree_add_item(tree, hf_rpc_authgssapi_v, tvb, offset, 4, ENC_BIG_ENDIAN);
offset += 4;
agc_msg = tvb_get_ntohl(tvb, offset);
proto_tree_add_boolean(tree, hf_rpc_authgssapi_msg,
tvb, offset, 4, agc_msg);
proto_tree_add_item(tree, hf_rpc_authgssapi_msg, tvb, offset, 4, ENC_BIG_ENDIAN);
offset += 4;
offset = dissect_rpc_data(tvb, tree, hf_rpc_authgssapi_handle,
@ -1209,7 +1202,7 @@ dissect_rpc_authgss_token(tvbuff_t* tvb, proto_tree* tree, int offset,
offset += 4;
if (opaque_length != 0) {
length = tvb_length_remaining(tvb, offset);
length = tvb_captured_length_remaining(tvb, offset);
reported_length = tvb_reported_length_remaining(tvb, offset);
DISSECTOR_ASSERT(length >= 0);
DISSECTOR_ASSERT(reported_length >= 0);
@ -1403,7 +1396,7 @@ call_dissect_function(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
{
const char *saved_proto;
tvb_ensure_length_remaining(tvb, offset);
tvb_ensure_captured_length_remaining(tvb, offset);
if (dissect_function != NULL) {
/* set the current protocol name */
saved_proto = pinfo->current_proto;
@ -2683,7 +2676,7 @@ dissect_rpc_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
/*
* Don't call any subdissector if we have no more date to dissect.
*/
if (tvb_length_remaining(tvb, offset) == 0) {
if (tvb_reported_length_remaining(tvb, offset) == 0) {
return TRUE;
}
@ -2760,7 +2753,7 @@ dissect_rpc_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
pinfo, ptree, 4,
dissect_function,
progname, rpc_call);
offset = tvb_length(pinfo->gssapi_decrypted_tvb);
offset = tvb_reported_length(pinfo->gssapi_decrypted_tvb);
}
}
break;
@ -2822,7 +2815,7 @@ dissect_rpc_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
break;
}
if (tvb_length_remaining(tvb, offset) > 0) {
if (tvb_reported_length_remaining(tvb, offset) > 0) {
/*
* dissect any remaining bytes (incomplete dissection) as pure
* data in the ptree
@ -2865,7 +2858,7 @@ dissect_rpc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
if (!dissect_rpc_message(tvb, pinfo, tree, NULL, NULL, FALSE, 0,
TRUE)) {
if (tvb_length(tvb) != 0)
if (tvb_reported_length(tvb) != 0)
dissect_rpc_continuation(tvb, pinfo, tree);
}
}
@ -3080,7 +3073,7 @@ dissect_rpc_fragment(tvbuff_t *tvb, int offset, packet_info *pinfo,
if (len > max_rpc_tcp_pdu_size)
return 0; /* pretend it's not valid */
if (rpc_desegment) {
seglen = tvb_length_remaining(tvb, offset + 4);
seglen = tvb_reported_length_remaining(tvb, offset + 4);
if ((gint)len > seglen && pinfo->can_desegment) {
/*
@ -3119,7 +3112,7 @@ dissect_rpc_fragment(tvbuff_t *tvb, int offset, packet_info *pinfo,
}
}
len += 4; /* include record mark */
tvb_len = tvb_length_remaining(tvb, offset);
tvb_len = tvb_captured_length_remaining(tvb, offset);
tvb_reported_len = tvb_reported_length_remaining(tvb, offset);
if (tvb_len > (gint)len)
tvb_len = len;
@ -3696,7 +3689,7 @@ dissect_rpc_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
if (dissect_rpc_tcp_common(tvb, pinfo, tree, FALSE, tcpinfo) == IS_NOT_RPC)
dissect_rpc_continuation(tvb, pinfo, tree);
return tvb_length(tvb);
return tvb_reported_length(tvb);
}
/* Discard any state we've saved. */

View File

@ -1964,7 +1964,7 @@ dissect_rtcp_app( tvbuff_t *tvb,packet_info *pinfo, int offset, proto_tree *tree
next_tvb = tvb_new_subset_length(tvb, offset-8, app_length+4);
/* look for registered sub-dissectors */
if (dissector_try_string(rtcp_dissector_table, ascii_name, next_tvb, pinfo, tree, NULL)) {
/* found subdissector - return tvb_length */
/* found subdissector - return tvb_reported_length */
offset += 4;
packet_len -= 4;
if ( padding ) {
@ -2160,7 +2160,13 @@ dissect_rtcp_sdes( tvbuff_t *tvb, int offset, proto_tree *tree,
static void parse_xr_type_specific_field(tvbuff_t *tvb, gint offset, guint block_type,
proto_tree *tree, guint8 *thinning)
{
guint8 flags = tvb_get_guint8(tvb, offset);
static const int * flags[] = {
&hf_rtcp_xr_stats_loss_flag,
&hf_rtcp_xr_stats_dup_flag,
&hf_rtcp_xr_stats_jitter_flag,
&hf_rtcp_xr_stats_ttl,
NULL
};
switch (block_type) {
case RTCP_XR_LOSS_RLE:
@ -2171,10 +2177,7 @@ static void parse_xr_type_specific_field(tvbuff_t *tvb, gint offset, guint block
break;
case RTCP_XR_STATS_SUMRY:
proto_tree_add_boolean(tree, hf_rtcp_xr_stats_loss_flag, tvb, offset, 1, flags);
proto_tree_add_boolean(tree, hf_rtcp_xr_stats_dup_flag, tvb, offset, 1, flags);
proto_tree_add_boolean(tree, hf_rtcp_xr_stats_jitter_flag, tvb, offset, 1, flags);
proto_tree_add_item(tree, hf_rtcp_xr_stats_ttl, tvb, offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_bitmask_list(tree, tvb, offset, 1, flags, ENC_BIG_ENDIAN);
break;
default:
@ -3350,7 +3353,7 @@ dissect_rtcp( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree )
gboolean e_bit;
srtcp_info = p_conv_data->srtcp_info;
/* get the offset to the start of the SRTCP fields at the end of the packet */
srtcp_offset = tvb_length_remaining(tvb, offset) - srtcp_info->auth_tag_len - srtcp_info->mki_len - 4;
srtcp_offset = tvb_reported_length_remaining(tvb, offset) - srtcp_info->auth_tag_len - srtcp_info->mki_len - 4;
/* It has been setup as SRTCP, but skip to the SRTCP E field at the end
to see if this particular packet is encrypted or not. The E bit is the MSB. */
srtcp_index = tvb_get_ntohl(tvb,srtcp_offset);

View File

@ -330,6 +330,12 @@ dissect_rtp_events( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree )
guint8 rtp_evt;
guint8 octet;
static const int * events[] = {
&hf_rtp_events_end,
&hf_rtp_events_reserved,
&hf_rtp_events_volume,
NULL
};
col_set_str(pinfo->cinfo, COL_PROTOCOL, "RTP EVENT");
col_clear(pinfo->cinfo, COL_INFO);
@ -359,9 +365,7 @@ dissect_rtp_events( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree )
proto_tree_add_uint ( rtp_events_tree, hf_rtp_events_event, tvb, offset, 1, rtp_evt);
offset++;
octet = tvb_get_guint8(tvb, offset);
proto_tree_add_boolean (rtp_events_tree, hf_rtp_events_end, tvb, offset, 1, octet);
proto_tree_add_boolean (rtp_events_tree, hf_rtp_events_reserved, tvb, offset, 1, octet);
proto_tree_add_uint ( rtp_events_tree, hf_rtp_events_volume, tvb, offset, 1, octet);
proto_tree_add_bitmask_list(rtp_events_tree, tvb, offset, 1, events, ENC_NA);
offset++;
/* The duration field indicates the duration of the event or segment

View File

@ -1937,6 +1937,13 @@ dissect_rtp( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
static struct _rtp_info rtp_info_arr[4];
static int rtp_info_current = 0;
struct _rtp_info *rtp_info;
static const int * octet1_fields[] = {
&hf_rtp_version,
&hf_rtp_padding,
&hf_rtp_extension,
&hf_rtp_csrc_count,
NULL
};
rtp_info_current++;
if (rtp_info_current == 4) {
@ -2141,14 +2148,7 @@ dissect_rtp( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
show_setup_info(tvb, pinfo, rtp_tree);
}
proto_tree_add_uint( rtp_tree, hf_rtp_version, tvb,
offset, 1, octet1 );
proto_tree_add_boolean( rtp_tree, hf_rtp_padding, tvb,
offset, 1, octet1 );
proto_tree_add_boolean( rtp_tree, hf_rtp_extension, tvb,
offset, 1, octet1 );
proto_tree_add_uint( rtp_tree, hf_rtp_csrc_count, tvb,
offset, 1, octet1 );
proto_tree_add_bitmask_list(rtp_tree, tvb, offset, 1, octet1_fields, ENC_NA);
offset++;
proto_tree_add_boolean( rtp_tree, hf_rtp_marker, tvb, offset,

View File

@ -357,7 +357,7 @@ dissect_sasp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data
"Invalid SASP Header Type [0x%04x]", hdr_type);
/* XXX: The folowing should actually happen automatically ? */
col_set_str(pinfo->cinfo, COL_INFO, "[Malformed: Invalid SASP Header Type]");
return tvb_length(tvb);
return tvb_reported_length(tvb);
}
offset += 2;
@ -462,7 +462,7 @@ dissect_sasp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data
"Unknown SASP Message Type: 0x%4x", msg_type);
break;
}
return tvb_length(tvb);
return tvb_reported_length(tvb);
}
@ -471,7 +471,7 @@ dissect_sasp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
tcp_dissect_pdus(tvb, pinfo, tree, sasp_desegment, SASP_MIN_PACKET_LEN, get_sasp_pdu_len,
dissect_sasp_pdu, data);
return tvb_length(tvb);
return tvb_reported_length(tvb);
}
@ -925,7 +925,6 @@ static guint32 dissect_memstatedatacomp(tvbuff_t *tvb, proto_tree *pay_load, gui
{
proto_tree *memstatedatacomp_tree;
proto_tree *memdatacomp_tree;
guint8 memstate_flag;
offset = dissect_memdatacomp(tvb, pay_load, offset, &memdatacomp_tree);
@ -947,9 +946,8 @@ static guint32 dissect_memstatedatacomp(tvbuff_t *tvb, proto_tree *pay_load, gui
offset += 1;
/* Quiesce flag*/
memstate_flag = tvb_get_guint8(tvb, offset);
proto_tree_add_boolean(memstatedatacomp_tree, hf_sasp_memstatedatacomp_quiesce_flag,
tvb, offset, 1, memstate_flag);
proto_tree_add_item(memstatedatacomp_tree, hf_sasp_memstatedatacomp_quiesce_flag,
tvb, offset, 1, ENC_NA);
offset += 1;
return offset;

View File

@ -1088,7 +1088,7 @@ dissect_relaydef_frame(tvbuff_t *tvb, proto_tree *tree, int offset)
proto_tree_add_item(relaydef_tree, hf_selfm_checksum, tvb, offset, 1, ENC_BIG_ENDIAN);
return tvb_length(tvb);
return tvb_reported_length(tvb);
}
@ -1194,7 +1194,7 @@ dissect_fmconfig_frame(tvbuff_t *tvb, proto_tree *tree, int offset)
proto_tree_add_item(fmconfig_tree, hf_selfm_checksum, tvb, offset, 1, ENC_BIG_ENDIAN);
return tvb_length(tvb);
return tvb_reported_length(tvb);
}
@ -1422,7 +1422,7 @@ dissect_fmdata_frame(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, int of
}
}
return tvb_length(tvb);
return tvb_reported_length(tvb);
}
@ -1506,7 +1506,7 @@ dissect_foconfig_frame(tvbuff_t *tvb, proto_tree *tree, int offset)
proto_tree_add_item(foconfig_tree, hf_selfm_checksum, tvb, offset, 1, ENC_BIG_ENDIAN);
return tvb_length(tvb);
return tvb_reported_length(tvb);
}
@ -1546,7 +1546,7 @@ dissect_alt_fastop_config_frame(tvbuff_t *tvb, proto_tree *tree, int offset)
proto_tree_add_item(foconfig_tree, hf_selfm_alt_foconfig_funccode, tvb, offset+7, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(foconfig_tree, hf_selfm_alt_foconfig_funccode, tvb, offset+8, 1, ENC_BIG_ENDIAN);
return tvb_length(tvb);
return tvb_reported_length(tvb);
}
@ -1595,7 +1595,7 @@ dissect_fastop_frame(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, int of
/* Add checksum */
proto_tree_add_item(fastop_tree, hf_selfm_checksum, tvb, offset, 1, ENC_BIG_ENDIAN);
return tvb_length(tvb);
return tvb_reported_length(tvb);
}
@ -1631,7 +1631,7 @@ dissect_alt_fastop_frame(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, in
/* Operate Code Validation */
proto_tree_add_item(fastop_tree, hf_selfm_alt_fastop_valid, tvb, offset, 2, ENC_BIG_ENDIAN);
return tvb_length(tvb);
return tvb_reported_length(tvb);
}
@ -1884,18 +1884,23 @@ static int
dissect_fastmsg_frame(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, int offset)
{
/* Set up structures needed to add the protocol subtree and manage it */
proto_item *fastmsg_def_fc_item, *fastmsg_seq_item, *fastmsg_elementlist_item;
proto_item *fastmsg_def_fc_item, *fastmsg_elementlist_item;
proto_item *fastmsg_tag_item;
proto_item *pi_baseaddr, *fastmsg_crc16_item;
proto_tree *fastmsg_tree, *fastmsg_def_fc_tree=NULL, *fastmsg_seq_tree=NULL, *fastmsg_elementlist_tree=NULL;
proto_tree *fastmsg_tree, *fastmsg_def_fc_tree=NULL, *fastmsg_elementlist_tree=NULL;
proto_tree *fastmsg_element_tree=NULL, *fastmsg_datareg_tree=NULL, *fastmsg_tag_tree=NULL;
gint cnt, num_elements, elmt_status32_ofs=0, elmt_status, null_offset;
guint8 len, funccode, seq, rx_num_fc, tx_num_fc;
guint8 seq_cnt, seq_fir, seq_fin, elmt_idx, fc_enable;
guint8 seq_cnt, elmt_idx, fc_enable;
guint8 *fid_str_ptr, *rid_str_ptr, *region_name_ptr, *tag_name_ptr;
guint16 base_addr, num_addr, num_reg, addr1, addr2, crc16, crc16_calc;
guint32 tod_ms, elmt_status32, elmt_ts_offset;
static const int * seq_fields[] = {
&hf_selfm_fastmsg_seq_fir,
&hf_selfm_fastmsg_seq_fin,
&hf_selfm_fastmsg_seq_cnt,
NULL
};
len = tvb_get_guint8(tvb, offset);
@ -1924,18 +1929,9 @@ dissect_fastmsg_frame(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, int o
/* Get Sequence Byte, add to Tree */
seq = tvb_get_guint8(tvb, offset);
seq_cnt = seq & FAST_MSG_SEQ_CNT;
seq_fir = seq & FAST_MSG_SEQ_FIR;
seq_fin = seq & FAST_MSG_SEQ_FIN;
fastmsg_seq_item = proto_tree_add_uint_format_value(fastmsg_tree, hf_selfm_fastmsg_seq, tvb, offset, 1, seq, "0x%02x (", seq);
if (seq_fir) proto_item_append_text(fastmsg_seq_item, "FIR, ");
if (seq_fin) proto_item_append_text(fastmsg_seq_item, "FIN, ");
proto_item_append_text(fastmsg_seq_item, "Count %u)", seq_cnt);
fastmsg_seq_tree = proto_item_add_subtree(fastmsg_seq_item, ett_selfm_fastmsg_seq);
proto_tree_add_boolean(fastmsg_seq_tree, hf_selfm_fastmsg_seq_fir, tvb, offset, 1, seq);
proto_tree_add_boolean(fastmsg_seq_tree, hf_selfm_fastmsg_seq_fin, tvb, offset, 1, seq);
proto_tree_add_item(fastmsg_seq_tree, hf_selfm_fastmsg_seq_cnt, tvb, offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_bitmask_with_flags(fastmsg_tree, tvb, offset, hf_selfm_fastmsg_seq, ett_selfm_fastmsg_seq,
seq_fields, ENC_NA, BMT_NO_APPEND);
offset += 1;
/* Add Response Number to tree */
@ -2339,7 +2335,7 @@ dissect_fastmsg_frame(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, int o
}
return tvb_length(tvb);
return tvb_reported_length(tvb);
}
@ -2364,7 +2360,7 @@ dissect_selfm(tvbuff_t *selfm_tvb, packet_info *pinfo, proto_tree *tree, void* d
col_set_str(pinfo->cinfo, COL_PROTOCOL, "SEL Protocol");
col_clear(pinfo->cinfo, COL_INFO);
len = tvb_length(selfm_tvb);
len = tvb_reported_length(selfm_tvb);
msg_type = tvb_get_ntohs(selfm_tvb, offset);
@ -2556,7 +2552,7 @@ dissect_selfm(tvbuff_t *selfm_tvb, packet_info *pinfo, proto_tree *tree, void* d
} /* remaining length > 0 */
} /* tree */
return tvb_length(selfm_tvb);
return tvb_reported_length(selfm_tvb);
}
/******************************************************************************************************/
@ -2571,11 +2567,11 @@ get_selfm_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset _U_, void *data
/* XXX: this logic doesn't take into account the offset */
/* Get length byte from message */
if (tvb_length(tvb) > 2) {
if (tvb_reported_length(tvb) > 2) {
message_len = tvb_get_guint8(tvb, 2);
}
/* for 2-byte poll messages, set the length to 2 */
else if (tvb_length(tvb) == 2) {
else if (tvb_reported_length(tvb) == 2) {
message_len = 2;
}
@ -2590,7 +2586,7 @@ dissect_selfm_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
{
tvbuff_t *selfm_tvb;
gint length = tvb_length(tvb);
gint length = tvb_reported_length(tvb);
/* Check for a SEL Protocol packet. It should begin with 0xA5 */
if(length < 2 || tvb_get_guint8(tvb, 0) != 0xA5) {
@ -2620,7 +2616,7 @@ dissect_selfm_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
static int
dissect_selfm_simple(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
gint length = tvb_length(tvb);
gint length = tvb_reported_length(tvb);
/* Check for a SEL Protocol packet. It should begin with 0xA5 */
if(length < 2 || tvb_get_guint8(tvb, 0) != 0xA5) {

View File

@ -916,7 +916,7 @@ static int dissect_smb_command(tvbuff_t *tvb, packet_info *pinfo, int offset, pr
#define END_OF_SMB \
if (bc != 0) { \
gint bc_remaining; \
bc_remaining = tvb_length_remaining(tvb, offset); \
bc_remaining = tvb_reported_length_remaining(tvb, offset); \
if ( ((gint)bc) > bc_remaining) { \
bc = bc_remaining; \
} \
@ -1803,53 +1803,38 @@ dissect_file_ext_attr_bits(tvbuff_t *tvb, proto_tree *parent_tree, int offset,
int len, guint32 mask)
{
proto_item *item;
proto_tree *tree;
/*
* XXX - Network Monitor disagrees on some of the
* bits, e.g. the bits above temporary are "atomic write"
* and "transaction write", and it says nothing about the
* bits above that.
*
* Does the Win32 API documentation, or the NT Native API book,
* suggest anything?
*/
static const int * mask_fields[] = {
&hf_smb_file_eattr_read_only,
&hf_smb_file_eattr_hidden,
&hf_smb_file_eattr_system,
&hf_smb_file_eattr_volume,
&hf_smb_file_eattr_directory,
&hf_smb_file_eattr_archive,
&hf_smb_file_eattr_device,
&hf_smb_file_eattr_normal,
&hf_smb_file_eattr_temporary,
&hf_smb_file_eattr_sparse,
&hf_smb_file_eattr_reparse,
&hf_smb_file_eattr_compressed,
&hf_smb_file_eattr_offline,
&hf_smb_file_eattr_not_content_indexed,
&hf_smb_file_eattr_encrypted,
NULL
};
if (parent_tree) {
item = proto_tree_add_uint(parent_tree, hf_smb_file_eattr, tvb, offset, len, mask);
tree = proto_item_add_subtree(item, ett_smb_file_attributes);
if (len == 0)
PROTO_ITEM_SET_GENERATED(item);
/*
* XXX - Network Monitor disagrees on some of the
* bits, e.g. the bits above temporary are "atomic write"
* and "transaction write", and it says nothing about the
* bits above that.
*
* Does the Win32 API documentation, or the NT Native API book,
* suggest anything?
*/
proto_tree_add_boolean(tree, hf_smb_file_eattr_read_only,
tvb, offset, len, mask);
proto_tree_add_boolean(tree, hf_smb_file_eattr_hidden,
tvb, offset, len, mask);
proto_tree_add_boolean(tree, hf_smb_file_eattr_system,
tvb, offset, len, mask);
proto_tree_add_boolean(tree, hf_smb_file_eattr_volume,
tvb, offset, len, mask);
proto_tree_add_boolean(tree, hf_smb_file_eattr_directory,
tvb, offset, len, mask);
proto_tree_add_boolean(tree, hf_smb_file_eattr_archive,
tvb, offset, len, mask);
proto_tree_add_boolean(tree, hf_smb_file_eattr_device,
tvb, offset, len, mask);
proto_tree_add_boolean(tree, hf_smb_file_eattr_normal,
tvb, offset, len, mask);
proto_tree_add_boolean(tree, hf_smb_file_eattr_temporary,
tvb, offset, len, mask);
proto_tree_add_boolean(tree, hf_smb_file_eattr_sparse,
tvb, offset, len, mask);
proto_tree_add_boolean(tree, hf_smb_file_eattr_reparse,
tvb, offset, len, mask);
proto_tree_add_boolean(tree, hf_smb_file_eattr_compressed,
tvb, offset, len, mask);
proto_tree_add_boolean(tree, hf_smb_file_eattr_offline,
tvb, offset, len, mask);
proto_tree_add_boolean(tree, hf_smb_file_eattr_not_content_indexed,
tvb, offset, len, mask);
proto_tree_add_boolean(tree, hf_smb_file_eattr_encrypted,
tvb, offset, len, mask);
}
item = proto_tree_add_bitmask_value_with_flags(parent_tree, tvb, offset,
hf_smb_file_eattr, ett_smb_file_attributes, mask_fields, mask, BMT_NO_APPEND);
if (len == 0)
PROTO_ITEM_SET_GENERATED(item);
offset += len;
@ -2505,8 +2490,8 @@ dissect_negprot_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, in
* of the security blob.
*/
sbloblen = bc;
if (sbloblen > tvb_length_remaining(tvb, offset)) {
sbloblen = tvb_length_remaining(tvb, offset);
if (sbloblen > tvb_reported_length_remaining(tvb, offset)) {
sbloblen = tvb_reported_length_remaining(tvb, offset);
}
blob_item = proto_tree_add_item(
tree, hf_smb_security_blob,
@ -3212,16 +3197,6 @@ dissect_nt_create_bits(tvbuff_t *tvb, proto_tree *parent_tree, int offset,
int len, guint32 mask)
{
proto_item *item = NULL;
proto_tree *tree = NULL;
if (parent_tree) {
item = proto_tree_add_uint(parent_tree, hf_smb_create_flags, tvb, offset, len, mask);
tree = proto_item_add_subtree(item, ett_smb_nt_create_bits);
if (len == 0)
PROTO_ITEM_SET_GENERATED(item);
}
/*
* XXX - it's 0x00000016 in at least one capture, but
* Network Monitor doesn't say what the 0x00000010 bit is.
@ -3234,14 +3209,20 @@ dissect_nt_create_bits(tvbuff_t *tvb, proto_tree *parent_tree, int offset,
* in the response. However, Windows does not do that. Or at least
* Win2K doesn't.
*/
proto_tree_add_boolean(tree, hf_smb_nt_create_bits_oplock,
tvb, offset, len, mask);
proto_tree_add_boolean(tree, hf_smb_nt_create_bits_boplock,
tvb, offset, len, mask);
proto_tree_add_boolean(tree, hf_smb_nt_create_bits_dir,
tvb, offset, len, mask);
proto_tree_add_boolean(tree, hf_smb_nt_create_bits_ext_resp,
tvb, offset, len, mask);
static const int * fields[] = {
&hf_smb_nt_create_bits_oplock,
&hf_smb_nt_create_bits_boplock,
&hf_smb_nt_create_bits_dir,
&hf_smb_nt_create_bits_ext_resp,
NULL
};
item = proto_tree_add_bitmask_value_with_flags(parent_tree, tvb, offset, hf_smb_create_flags, ett_smb_nt_create_bits,
fields, mask, BMT_NO_APPEND);
if (len == 0)
PROTO_ITEM_SET_GENERATED(item);
offset += len;
return offset;
@ -3253,62 +3234,43 @@ dissect_smb_access_mask_bits(tvbuff_t *tvb, proto_tree *parent_tree,
int offset, int len, guint32 mask)
{
proto_item *item;
proto_tree *tree;
/*
* Some of these bits come from
*
* http://www.samba.org/samba/ftp/specs/smb-nt01.doc
*
* and others come from the section on ZwOpenFile in "Windows(R)
* NT(R)/2000 Native API Reference".
*/
static const int * fields[] = {
&hf_smb_nt_access_mask_read,
&hf_smb_nt_access_mask_write,
&hf_smb_nt_access_mask_append,
&hf_smb_nt_access_mask_read_ea,
&hf_smb_nt_access_mask_write_ea,
&hf_smb_nt_access_mask_execute,
&hf_smb_nt_access_mask_delete_child,
&hf_smb_nt_access_mask_read_attributes,
&hf_smb_nt_access_mask_write_attributes,
&hf_smb_nt_access_mask_delete,
&hf_smb_nt_access_mask_read_control,
&hf_smb_nt_access_mask_write_dac,
&hf_smb_nt_access_mask_write_owner,
&hf_smb_nt_access_mask_synchronize,
&hf_smb_nt_access_mask_system_security,
&hf_smb_nt_access_mask_maximum_allowed,
&hf_smb_nt_access_mask_generic_all,
&hf_smb_nt_access_mask_generic_execute,
&hf_smb_nt_access_mask_generic_write,
&hf_smb_nt_access_mask_generic_read,
NULL
};
if (parent_tree) {
item = proto_tree_add_uint(parent_tree, hf_smb_access_mask, tvb, offset, len, mask);
tree = proto_item_add_subtree(item, ett_smb_nt_access_mask);
if (len == 0)
PROTO_ITEM_SET_GENERATED(item);
/*
* Some of these bits come from
*
* http://www.samba.org/samba/ftp/specs/smb-nt01.doc
*
* and others come from the section on ZwOpenFile in "Windows(R)
* NT(R)/2000 Native API Reference".
*/
proto_tree_add_boolean(tree, hf_smb_nt_access_mask_read,
tvb, offset, len, mask);
proto_tree_add_boolean(tree, hf_smb_nt_access_mask_write,
tvb, offset, len, mask);
proto_tree_add_boolean(tree, hf_smb_nt_access_mask_append,
tvb, offset, len, mask);
proto_tree_add_boolean(tree, hf_smb_nt_access_mask_read_ea,
tvb, offset, len, mask);
proto_tree_add_boolean(tree, hf_smb_nt_access_mask_write_ea,
tvb, offset, len, mask);
proto_tree_add_boolean(tree, hf_smb_nt_access_mask_execute,
tvb, offset, len, mask);
proto_tree_add_boolean(tree, hf_smb_nt_access_mask_delete_child,
tvb, offset, len, mask);
proto_tree_add_boolean(tree, hf_smb_nt_access_mask_read_attributes,
tvb, offset, len, mask);
proto_tree_add_boolean(tree, hf_smb_nt_access_mask_write_attributes,
tvb, offset, len, mask);
proto_tree_add_boolean(tree, hf_smb_nt_access_mask_delete,
tvb, offset, len, mask);
proto_tree_add_boolean(tree, hf_smb_nt_access_mask_read_control,
tvb, offset, len, mask);
proto_tree_add_boolean(tree, hf_smb_nt_access_mask_write_dac,
tvb, offset, len, mask);
proto_tree_add_boolean(tree, hf_smb_nt_access_mask_write_owner,
tvb, offset, len, mask);
proto_tree_add_boolean(tree, hf_smb_nt_access_mask_synchronize,
tvb, offset, len, mask);
proto_tree_add_boolean(tree, hf_smb_nt_access_mask_system_security,
tvb, offset, len, mask);
proto_tree_add_boolean(tree, hf_smb_nt_access_mask_maximum_allowed,
tvb, offset, len, mask);
proto_tree_add_boolean(tree, hf_smb_nt_access_mask_generic_all,
tvb, offset, len, mask);
proto_tree_add_boolean(tree, hf_smb_nt_access_mask_generic_execute,
tvb, offset, len, mask);
proto_tree_add_boolean(tree, hf_smb_nt_access_mask_generic_write,
tvb, offset, len, mask);
proto_tree_add_boolean(tree, hf_smb_nt_access_mask_generic_read,
tvb, offset, len, mask);
}
item = proto_tree_add_bitmask_value_with_flags(parent_tree, tvb, offset, hf_smb_access_mask, ett_smb_nt_access_mask,
fields, mask, BMT_NO_APPEND);
if (len == 0)
PROTO_ITEM_SET_GENERATED(item);
offset += len;
return offset;
@ -3335,30 +3297,17 @@ dissect_nt_share_access_bits(tvbuff_t *tvb, proto_tree *parent_tree,
int offset, int len, guint32 mask)
{
proto_item *item;
proto_tree *tree;
static const int * fields[] = {
&hf_smb_nt_share_access_read,
&hf_smb_nt_share_access_write,
&hf_smb_nt_share_access_delete,
NULL
};
if (parent_tree) {
item = proto_tree_add_uint(parent_tree, hf_smb_share_access, tvb, offset, len, mask);
tree = proto_item_add_subtree(item, ett_smb_nt_share_access);
if (len == 0)
PROTO_ITEM_SET_GENERATED(item);
item = proto_tree_add_bitmask_value(parent_tree, tvb, offset, hf_smb_share_access, ett_smb_nt_share_access, fields, mask);
proto_tree_add_boolean(tree, hf_smb_nt_share_access_read,
tvb, offset, len, mask);
if (mask & SHARE_ACCESS_READ) {
proto_item_append_text(item, " SHARE_READ");
}
proto_tree_add_boolean(tree, hf_smb_nt_share_access_write,
tvb, offset, len, mask);
if (mask & SHARE_ACCESS_WRITE) {
proto_item_append_text(item, " SHARE_WRITE");
}
proto_tree_add_boolean(tree, hf_smb_nt_share_access_delete,
tvb, offset, len, mask);
if (mask & SHARE_ACCESS_DELETE) {
proto_item_append_text(item, " SHARE_DELETE");
}
}
if (len == 0)
PROTO_ITEM_SET_GENERATED(item);
offset += len;
@ -3383,59 +3332,39 @@ dissect_nt_create_options_bits(tvbuff_t *tvb, proto_tree *parent_tree,
int offset, int len, guint32 mask)
{
proto_item *item;
proto_tree *tree;
/*
* From
*
* http://www.samba.org/samba/ftp/specs/smb-nt01.doc
*/
static const int * fields[] = {
&hf_smb_nt_create_options_directory_file,
&hf_smb_nt_create_options_write_through,
&hf_smb_nt_create_options_sequential_only,
&hf_smb_nt_create_options_no_intermediate_buffering,
&hf_smb_nt_create_options_sync_io_alert,
&hf_smb_nt_create_options_sync_io_nonalert,
&hf_smb_nt_create_options_non_directory_file,
&hf_smb_nt_create_options_create_tree_connection,
&hf_smb_nt_create_options_complete_if_oplocked,
&hf_smb_nt_create_options_no_ea_knowledge,
&hf_smb_nt_create_options_eight_dot_three_only,
&hf_smb_nt_create_options_random_access,
&hf_smb_nt_create_options_delete_on_close,
&hf_smb_nt_create_options_open_by_fileid,
&hf_smb_nt_create_options_backup_intent,
&hf_smb_nt_create_options_no_compression,
&hf_smb_nt_create_options_reserve_opfilter,
&hf_smb_nt_create_options_open_reparse_point,
&hf_smb_nt_create_options_open_no_recall,
&hf_smb_nt_create_options_open_for_free_space_query,
NULL
};
item = proto_tree_add_bitmask_value_with_flags(parent_tree, tvb, offset, hf_smb_create_options, ett_smb_nt_create_options, fields, mask, BMT_NO_APPEND);
if (len == 0)
PROTO_ITEM_SET_GENERATED(item);
if (parent_tree) {
item = proto_tree_add_uint(parent_tree, hf_smb_create_options, tvb, offset, len, mask);
tree = proto_item_add_subtree(item, ett_smb_nt_create_options);
if (len == 0)
PROTO_ITEM_SET_GENERATED(item);
/*
* From
*
* http://www.samba.org/samba/ftp/specs/smb-nt01.doc
*/
proto_tree_add_boolean(tree, hf_smb_nt_create_options_directory_file,
tvb, offset, len, mask);
proto_tree_add_boolean(tree, hf_smb_nt_create_options_write_through,
tvb, offset, len, mask);
proto_tree_add_boolean(tree, hf_smb_nt_create_options_sequential_only,
tvb, offset, len, mask);
proto_tree_add_boolean(tree, hf_smb_nt_create_options_no_intermediate_buffering,
tvb, offset, len, mask);
proto_tree_add_boolean(tree, hf_smb_nt_create_options_sync_io_alert,
tvb, offset, len, mask);
proto_tree_add_boolean(tree, hf_smb_nt_create_options_sync_io_nonalert,
tvb, offset, len, mask);
proto_tree_add_boolean(tree, hf_smb_nt_create_options_non_directory_file,
tvb, offset, len, mask);
proto_tree_add_boolean(tree, hf_smb_nt_create_options_create_tree_connection,
tvb, offset, len, mask);
proto_tree_add_boolean(tree, hf_smb_nt_create_options_complete_if_oplocked,
tvb, offset, len, mask);
proto_tree_add_boolean(tree, hf_smb_nt_create_options_no_ea_knowledge,
tvb, offset, len, mask);
proto_tree_add_boolean(tree, hf_smb_nt_create_options_eight_dot_three_only,
tvb, offset, len, mask);
proto_tree_add_boolean(tree, hf_smb_nt_create_options_random_access,
tvb, offset, len, mask);
proto_tree_add_boolean(tree, hf_smb_nt_create_options_delete_on_close,
tvb, offset, len, mask);
proto_tree_add_boolean(tree, hf_smb_nt_create_options_open_by_fileid,
tvb, offset, len, mask);
proto_tree_add_boolean(tree, hf_smb_nt_create_options_backup_intent,
tvb, offset, len, mask);
proto_tree_add_boolean(tree, hf_smb_nt_create_options_no_compression,
tvb, offset, len, mask);
proto_tree_add_boolean(tree, hf_smb_nt_create_options_reserve_opfilter,
tvb, offset, len, mask);
proto_tree_add_boolean(tree, hf_smb_nt_create_options_open_reparse_point,
tvb, offset, len, mask);
proto_tree_add_boolean(tree, hf_smb_nt_create_options_open_no_recall,
tvb, offset, len, mask);
proto_tree_add_boolean(tree, hf_smb_nt_create_options_open_for_free_space_query,
tvb, offset, len, mask);
}
offset += len;
return offset;
@ -4203,7 +4132,7 @@ dissect_file_data(tvbuff_t *tvb, proto_tree *tree, int offset, guint16 bc, guint
offset += bc-datalen;
bc = datalen;
}
tvblen = tvb_length_remaining(tvb, offset);
tvblen = tvb_reported_length_remaining(tvb, offset);
if (bc > tvblen) {
proto_tree_add_bytes_format_value(tree, hf_smb_file_data, tvb, offset, tvblen, NULL, "Incomplete. Only %d of %u bytes", tvblen, bc);
offset += tvblen;
@ -4229,7 +4158,7 @@ dissect_file_data_dcerpc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
offset += bc-datalen;
bc = datalen;
}
tvblen = tvb_length_remaining(tvb, offset);
tvblen = tvb_reported_length_remaining(tvb, offset);
dcerpc_tvb = tvb_new_subset(tvb, offset, tvblen, bc);
dissect_pipe_dcerpc(dcerpc_tvb, pinfo, top_tree, tree, fid);
if (bc > tvblen)
@ -4329,7 +4258,7 @@ dissect_read_file_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
}
/* feed the export object tap listener */
tvblen = tvb_length_remaining(tvb, dataoffset);
tvblen = tvb_reported_length_remaining(tvb, dataoffset);
if (have_tap_listener(smb_eo_tap) && (datalen == tvblen) && rwi) {
feed_eo_smb(SMB_COM_READ, fid, tvb, pinfo, dataoffset, datalen, rwi->len, rwi->offset, si);
}
@ -4457,7 +4386,7 @@ dissect_write_file_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
}
/* feed the export object tap listener */
tvblen = tvb_length_remaining(tvb, dataoffset);
tvblen = tvb_reported_length_remaining(tvb, dataoffset);
if (have_tap_listener(smb_eo_tap) && (datalen == tvblen) && rwi) {
feed_eo_smb(SMB_COM_WRITE, fid, tvb, pinfo, dataoffset, datalen, rwi->len, rwi->offset, si);
}
@ -6547,7 +6476,7 @@ dissect_read_andx_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
}
/* feed the export object tap listener */
tvblen = tvb_length_remaining(tvb, dataoffset);
tvblen = tvb_reported_length_remaining(tvb, dataoffset);
if (have_tap_listener(smb_eo_tap) && (datalen == tvblen) && rwi) {
feed_eo_smb(SMB_COM_READ_ANDX, fid, tvb, pinfo, dataoffset, datalen, rwi->len, rwi->offset, si);
}
@ -6723,7 +6652,7 @@ dissect_write_andx_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
}
/* feed the export object tap listener */
tvblen = tvb_length_remaining(tvb, dataoffset);
tvblen = tvb_reported_length_remaining(tvb, dataoffset);
if (have_tap_listener(smb_eo_tap) && (datalen == tvblen) && rwi) {
feed_eo_smb(SMB_COM_WRITE_ANDX, fid, tvb, pinfo, dataoffset, datalen, rwi->len, rwi->offset, si);
}
@ -6983,8 +6912,8 @@ dissect_session_setup_andx_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree
* of the security blob.
*/
sbloblen_short = sbloblen;
if (sbloblen_short > tvb_length_remaining(tvb, offset)) {
sbloblen_short = tvb_length_remaining(tvb, offset);
if (sbloblen_short > tvb_reported_length_remaining(tvb, offset)) {
sbloblen_short = tvb_reported_length_remaining(tvb, offset);
}
blob_item = proto_tree_add_item(tree, hf_smb_security_blob,
tvb, offset, sbloblen_short,
@ -7278,8 +7207,8 @@ dissect_session_setup_andx_response(tvbuff_t *tvb, packet_info *pinfo, proto_tre
* short frames and then we will not see anything at all
* of the security blob.
*/
if (sbloblen > tvb_length_remaining(tvb, offset)) {
sbloblen = tvb_length_remaining(tvb, offset);
if (sbloblen > tvb_reported_length_remaining(tvb, offset)) {
sbloblen = tvb_reported_length_remaining(tvb, offset);
}
blob_item = proto_tree_add_item(tree, hf_smb_security_blob,
tvb, offset, sbloblen, ENC_NA);
@ -8336,7 +8265,7 @@ dissect_nt_trans_data_request(tvbuff_t *tvb, packet_info *pinfo, int offset, pro
break;
case NT_TRANS_IOCTL:
/* ioctl data */
ioctl_tvb = tvb_new_subset(tvb, offset, MIN((int)bc, tvb_length_remaining(tvb, offset)), bc);
ioctl_tvb = tvb_new_subset(tvb, offset, MIN((int)bc, tvb_reported_length_remaining(tvb, offset)), bc);
if (nti) {
dissect_smb2_ioctl_data(ioctl_tvb, pinfo, tree, top_tree_global, nti->ioctl_function, TRUE);
}
@ -8832,7 +8761,7 @@ dissect_nt_transaction_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr
if (pd_tvb) {
/* we have reassembled data, grab param and data from there */
dissect_nt_trans_param_request(pd_tvb, pinfo, 0, tree, tp,
&ntd, (guint16) tvb_length(pd_tvb), nti, si);
&ntd, (guint16) tvb_reported_length(pd_tvb), nti, si);
dissect_nt_trans_data_request(pd_tvb, pinfo, tp, tree, td, &ntd, nti, si);
COUNT_BYTES(bc); /* We are done */
} else {
@ -8918,7 +8847,7 @@ dissect_nt_trans_data_response(tvbuff_t *tvb, packet_info *pinfo,
break;
case NT_TRANS_IOCTL:
/* ioctl data */
ioctl_tvb = tvb_new_subset(tvb, offset, MIN((int)len, tvb_length_remaining(tvb, offset)), len);
ioctl_tvb = tvb_new_subset(tvb, offset, MIN((int)len, tvb_reported_length_remaining(tvb, offset)), len);
dissect_smb2_ioctl_data(ioctl_tvb, pinfo, tree, top_tree_global, nti->ioctl_function, FALSE);
offset += len;
@ -9367,7 +9296,7 @@ dissect_nt_transaction_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t
if (pd_tvb) {
/* we have reassembled data, grab param and data from there */
dissect_nt_trans_param_response(pd_tvb, pinfo, 0, tree, tp,
&ntd, (guint16) tvb_length(pd_tvb), si);
&ntd, (guint16) tvb_reported_length(pd_tvb), si);
dissect_nt_trans_data_response(pd_tvb, pinfo, tp, tree, td, &ntd, nti, si);
COUNT_BYTES(bc); /* We are done */
} else {
@ -13107,7 +13036,7 @@ dissect_sfsi_request(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree,
/* security blob */
blob_item = proto_tree_add_item(tree, hf_smb_security_blob,
tvb, offset,
tvb_length_remaining(tvb, offset),
tvb_reported_length_remaining(tvb, offset),
ENC_NA);
/* As an optimization, because Windows is perverse,
@ -13129,7 +13058,7 @@ dissect_sfsi_request(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree,
call_dissector(gssapi_handle, blob_tvb, pinfo, blob_tree);
}
offset += tvb_length_remaining(tvb, offset);
offset += tvb_reported_length_remaining(tvb, offset);
*bcp = 0;
break;
}
@ -13160,7 +13089,7 @@ dissect_sfsi_response(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree,
/* security blob */
blob_item = proto_tree_add_item(tree, hf_smb_security_blob,
tvb, offset,
tvb_length_remaining(tvb, offset),
tvb_reported_length_remaining(tvb, offset),
ENC_NA);
/* As an optimization, because Windows is perverse,
@ -13182,7 +13111,7 @@ dissect_sfsi_response(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree,
call_dissector(gssapi_handle, blob_tvb, pinfo, blob_tree);
}
offset += tvb_length_remaining(tvb, offset);
offset += tvb_reported_length_remaining(tvb, offset);
*bcp = 0;
break;
}
@ -13665,8 +13594,8 @@ dissect_transaction_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
tvbuff_t *sp_tvb, *pd_tvb;
if (pc > 0) {
if (pc>tvb_length_remaining(tvb, po)) {
p_tvb = tvb_new_subset(tvb, po, tvb_length_remaining(tvb, po), pc);
if (pc>tvb_reported_length_remaining(tvb, po)) {
p_tvb = tvb_new_subset(tvb, po, tvb_reported_length_remaining(tvb, po), pc);
} else {
p_tvb = tvb_new_subset_length(tvb, po, pc);
}
@ -13674,8 +13603,8 @@ dissect_transaction_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
p_tvb = NULL;
}
if (dc > 0) {
if (dc>tvb_length_remaining(tvb, od)) {
d_tvb = tvb_new_subset(tvb, od, tvb_length_remaining(tvb, od), dc);
if (dc>tvb_reported_length_remaining(tvb, od)) {
d_tvb = tvb_new_subset(tvb, od, tvb_reported_length_remaining(tvb, od), dc);
} else {
d_tvb = tvb_new_subset_length(tvb, od, dc);
}
@ -13683,8 +13612,8 @@ dissect_transaction_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
d_tvb = NULL;
}
if (sl) {
if (sl>tvb_length_remaining(tvb, so)) {
s_tvb = tvb_new_subset(tvb, so, tvb_length_remaining(tvb, so), sl);
if (sl>tvb_reported_length_remaining(tvb, so)) {
s_tvb = tvb_new_subset(tvb, so, tvb_reported_length_remaining(tvb, so), sl);
} else {
s_tvb = tvb_new_subset_length(tvb, so, sl);
}
@ -15026,31 +14955,19 @@ dissect_fs_attributes(tvbuff_t *tvb, proto_tree *parent_tree, int offset)
static int
dissect_device_characteristics(tvbuff_t *tvb, proto_tree *parent_tree, int offset)
{
guint32 mask;
proto_item *item;
proto_tree *tree;
static const int * mask[] = {
&hf_smb_device_char_removable,
&hf_smb_device_char_read_only,
&hf_smb_device_char_floppy,
&hf_smb_device_char_write_once,
&hf_smb_device_char_remote,
&hf_smb_device_char_mounted,
&hf_smb_device_char_virtual,
NULL
};
mask = tvb_get_letohl(tvb, offset);
if (parent_tree) {
item = proto_tree_add_item(parent_tree, hf_smb_device_char, tvb, offset, 4, ENC_LITTLE_ENDIAN);
tree = proto_item_add_subtree(item, ett_smb_device_characteristics);
proto_tree_add_boolean(tree, hf_smb_device_char_removable,
tvb, offset, 4, mask);
proto_tree_add_boolean(tree, hf_smb_device_char_read_only,
tvb, offset, 4, mask);
proto_tree_add_boolean(tree, hf_smb_device_char_floppy,
tvb, offset, 4, mask);
proto_tree_add_boolean(tree, hf_smb_device_char_write_once,
tvb, offset, 4, mask);
proto_tree_add_boolean(tree, hf_smb_device_char_remote,
tvb, offset, 4, mask);
proto_tree_add_boolean(tree, hf_smb_device_char_mounted,
tvb, offset, 4, mask);
proto_tree_add_boolean(tree, hf_smb_device_char_virtual,
tvb, offset, 4, mask);
}
proto_tree_add_bitmask_with_flags(parent_tree, tvb, offset, hf_smb_device_char,
ett_smb_device_characteristics, mask, ENC_LITTLE_ENDIAN, BMT_NO_APPEND);
offset += 4;
return offset;
@ -16181,8 +16098,8 @@ dissect_transaction_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree
/* if there were any setup bytes, put them in a tvb for later */
if (sc) {
if ((2*sc) > tvb_length_remaining(tvb, offset)) {
s_tvb = tvb_new_subset(tvb, offset, tvb_length_remaining(tvb, offset), 2*sc);
if ((2*sc) > tvb_reported_length_remaining(tvb, offset)) {
s_tvb = tvb_new_subset(tvb, offset, tvb_reported_length_remaining(tvb, offset), 2*sc);
} else {
s_tvb = tvb_new_subset_length(tvb, offset, 2*sc);
}
@ -16251,12 +16168,12 @@ dissect_transaction_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree
if ( (pd == 0) && (dd == 0) ) {
int min;
int reported_min;
min = MIN(pc, tvb_length_remaining(tvb, po));
min = MIN(pc, tvb_reported_length_remaining(tvb, po));
reported_min = MIN(pc, tvb_reported_length_remaining(tvb, po));
if (min && reported_min) {
p_tvb = tvb_new_subset(tvb, po, min, reported_min);
}
min = MIN(dc, tvb_length_remaining(tvb, od));
min = MIN(dc, tvb_reported_length_remaining(tvb, od));
reported_min = MIN(dc, tvb_reported_length_remaining(tvb, od));
if (min && reported_min) {
d_tvb = tvb_new_subset(tvb, od, min, reported_min);
@ -16266,7 +16183,7 @@ dissect_transaction_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree
* and the data.
* XXX - check pc and dc as well?
*/
if (tvb_length_remaining(tvb, po)) {
if (tvb_reported_length_remaining(tvb, po)) {
pd_tvb = tvb_new_subset_remaining(tvb, po);
}
}
@ -17719,7 +17636,7 @@ static gboolean
dissect_smb_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void *data _U_)
{
/* must check that this really is a smb packet */
if (tvb_length(tvb) < 4)
if (tvb_reported_length(tvb) < 4)
return FALSE;
if ( (tvb_get_guint8(tvb, 0) != 0xff)

View File

@ -193,16 +193,24 @@ static const true_false_string m_bit = {
static void
dissect_sndcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
guint8 addr_field, comp_field, npdu_field1, nsapi, dcomp=0, pcomp=0;
guint8 addr_field, comp_field, npdu_field1, dcomp=0, pcomp=0;
guint16 offset=0, npdu=0, segment=0, npdu_field2;
tvbuff_t *next_tvb, *npdu_tvb;
gint len;
gboolean first, more_frags, unack;
static const int * addr_fields[] = {
&hf_sndcp_x,
&hf_sndcp_f,
&hf_sndcp_t,
&hf_sndcp_m,
&hf_sndcp_nsapib,
NULL
};
/* Set up structures needed to add the protocol subtree and manage it
*/
proto_item *ti, *address_field_item;
proto_tree *sndcp_tree, *address_field_tree, *compression_field_tree, *npdu_field_tree;
proto_item *ti;
proto_tree *sndcp_tree, *compression_field_tree, *npdu_field_tree;
/* Make entries in Protocol column and clear Info column on summary display
*/
@ -217,24 +225,14 @@ dissect_sndcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* get address field from next byte
*/
addr_field = tvb_get_guint8(tvb,offset);
nsapi = addr_field & 0xF;
first = addr_field & MASK_F;
more_frags = addr_field & MASK_M;
unack = addr_field & MASK_T;
/* add subtree for the address field
*/
if (tree) {
address_field_item = proto_tree_add_uint_format(sndcp_tree,hf_sndcp_nsapi,
tvb, offset,1, nsapi,
"Address field NSAPI: %d", nsapi );
address_field_tree = proto_item_add_subtree(address_field_item, ett_sndcp_address_field);
proto_tree_add_boolean(address_field_tree, hf_sndcp_x, tvb,offset,1, addr_field );
proto_tree_add_boolean(address_field_tree, hf_sndcp_f, tvb,offset,1, addr_field );
proto_tree_add_boolean(address_field_tree, hf_sndcp_t, tvb,offset,1, addr_field );
proto_tree_add_boolean(address_field_tree, hf_sndcp_m, tvb,offset,1, addr_field );
proto_tree_add_uint(address_field_tree, hf_sndcp_nsapib, tvb, offset, 1, addr_field );
}
proto_tree_add_bitmask_with_flags(sndcp_tree, tvb, offset, hf_sndcp_nsapi,
ett_sndcp_address_field, addr_fields, ENC_NA, BMT_NO_APPEND);
offset++;
/* get compression pointers from next byte if this is the first segment
@ -316,7 +314,7 @@ dissect_sndcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
guint32 reassembled_in = 0;
gboolean save_fragmented = pinfo->fragmented;
len = tvb_length_remaining(tvb, offset);
len = tvb_captured_length_remaining(tvb, offset);
if(len<=0){
return;
}
@ -380,7 +378,7 @@ proto_register_sndcp(void)
*/
static hf_register_info hf[] = {
{ &hf_sndcp_nsapi,
{ "NSAPI",
{ "Address field NSAPI",
"sndcp.nsapi",
FT_UINT8, BASE_DEC, VALS(nsapi_abrv), 0x0,
"Network Layer Service Access Point Identifier", HFILL

View File

@ -638,8 +638,6 @@ static int hf_main_client_agent_tokens = -1;
static int hf_tranparent_src_color = -1;
static int hf_tranparent_true_color = -1;
static int hf_spice_sasl_auth_result = -1;
static int hf_playback_cap_celt = -1;
static int hf_playback_cap_volume = -1;
static int hf_record_cap_volume = -1;
static int hf_record_cap_celt = -1;
static int hf_display_cap_sized_stream = -1;
@ -2842,6 +2840,13 @@ dissect_spice_common_capabilities(tvbuff_t *tvb, packet_info* pinfo, proto_tree
/* TODO: save common and per-channel capabilities in spice_info ? */
guint i;
guint32 val;
static const int * caps[] = {
&hf_common_cap_auth_select,
&hf_common_cap_auth_spice,
&hf_common_cap_auth_sasl,
&hf_common_cap_mini_header,
NULL
};
for(i = 0; i < caps_len; i++) {
val = tvb_get_letohl(tvb, offset);
@ -2852,11 +2857,8 @@ dissect_spice_common_capabilities(tvbuff_t *tvb, packet_info* pinfo, proto_tree
} else {
spice_info->server_auth = val;
}
proto_tree_add_boolean(tree, hf_common_cap_auth_select, tvb, offset, 4, val);
proto_tree_add_boolean(tree, hf_common_cap_auth_spice, tvb, offset, 4, val);
proto_tree_add_boolean(tree, hf_common_cap_auth_sasl, tvb, offset, 4, val);
proto_tree_add_boolean(tree, hf_common_cap_mini_header, tvb, offset, 4, val);
proto_tree_add_bitmask_list(tree, tvb, offset, 4, caps, ENC_LITTLE_ENDIAN);
if (val & SPICE_COMMON_CAP_MINI_HEADER_MASK) {
if (is_client) {
spice_info->client_mini_header = TRUE;
@ -2879,16 +2881,21 @@ dissect_spice_link_capabilities(tvbuff_t *tvb, packet_info* pinfo, proto_tree *t
{
/* TODO: save common and per-channel capabilities in spice_info ? */
guint i;
guint32 val;
for(i = 0; i < caps_len; i++) {
val = tvb_get_letohl(tvb, offset);
switch (spice_info->channel_type) {
case SPICE_CHANNEL_PLAYBACK:
switch (i) {
case 0:
proto_tree_add_boolean(tree, hf_playback_cap_celt, tvb, offset, 4, val);
proto_tree_add_boolean(tree, hf_playback_cap_volume, tvb, offset, 4, val);
{
const int * playback[] = {
&hf_common_cap_auth_select,
&hf_common_cap_auth_spice,
NULL
};
proto_tree_add_bitmask_list(tree, tvb, offset, 4, playback, ENC_LITTLE_ENDIAN);
}
break;
default:
break;
@ -2897,10 +2904,17 @@ dissect_spice_link_capabilities(tvbuff_t *tvb, packet_info* pinfo, proto_tree *t
case SPICE_CHANNEL_MAIN:
switch (i) {
case 0:
proto_tree_add_boolean(tree, hf_main_cap_semi_migrate, tvb, offset, 4, val);
proto_tree_add_boolean(tree, hf_main_cap_vm_name_uuid, tvb, offset, 4, val); /*Note: only relevant for client. TODO: dissect only for client */
proto_tree_add_boolean(tree, hf_main_cap_agent_connected_tokens, tvb, offset, 4, val);
proto_tree_add_boolean(tree, hf_main_cap_seamless_migrate, tvb, offset, 4 ,val);
{
const int * main_cap[] = {
&hf_main_cap_semi_migrate,
&hf_main_cap_vm_name_uuid, /*Note: only relevant for client. TODO: dissect only for client */
&hf_main_cap_agent_connected_tokens,
&hf_main_cap_seamless_migrate,
NULL
};
proto_tree_add_bitmask_list(tree, tvb, offset, 4, main_cap, ENC_LITTLE_ENDIAN);
}
break;
default:
break;
@ -2909,10 +2923,17 @@ dissect_spice_link_capabilities(tvbuff_t *tvb, packet_info* pinfo, proto_tree *t
case SPICE_CHANNEL_DISPLAY:
switch (i) {
case 0:
proto_tree_add_boolean(tree, hf_display_cap_sized_stream, tvb, offset, 4, val);
proto_tree_add_boolean(tree, hf_display_cap_monitors_config, tvb, offset, 4, val);
proto_tree_add_boolean(tree, hf_display_cap_composite, tvb, offset, 4, val);
proto_tree_add_boolean(tree, hf_display_cap_a8_surface, tvb, offset, 4, val);
{
const int * display_cap[] = {
&hf_display_cap_sized_stream,
&hf_display_cap_monitors_config,
&hf_display_cap_composite,
&hf_display_cap_a8_surface,
NULL
};
proto_tree_add_bitmask_list(tree, tvb, offset, 4, display_cap, ENC_LITTLE_ENDIAN);
}
break;
default:
break;
@ -2927,8 +2948,15 @@ dissect_spice_link_capabilities(tvbuff_t *tvb, packet_info* pinfo, proto_tree *t
case SPICE_CHANNEL_RECORD:
switch (i) {
case 0:
proto_tree_add_boolean(tree, hf_record_cap_celt, tvb, offset, 4, val);
proto_tree_add_boolean(tree, hf_record_cap_volume, tvb, offset, 4, val);
{
const int * record_cap[] = {
&hf_record_cap_celt,
&hf_record_cap_volume,
NULL
};
proto_tree_add_bitmask_list(tree, tvb, offset, 4, record_cap, ENC_LITTLE_ENDIAN);
}
break;
default:
break;
@ -3508,16 +3536,6 @@ proto_register_spice(void)
FT_BOOLEAN, 4, TFS(&tfs_set_notset), SPICE_COMMON_CAP_MINI_HEADER_MASK,
NULL, HFILL }
},
{ &hf_playback_cap_celt,
{ "CELT 0.5.1 playback channel support", "spice.playback_cap_celt",
FT_BOOLEAN, 3, TFS(&tfs_set_notset), SPICE_PLAYBACK_CAP_CELT_0_5_1_MASK,
NULL, HFILL }
},
{ &hf_playback_cap_volume,
{ "Volume playback channel support", "spice.playback_cap_volume",
FT_BOOLEAN, 3, TFS(&tfs_set_notset), SPICE_PLAYBACK_CAP_VOLUME_MASK,
NULL, HFILL }
},
{ &hf_record_cap_volume,
{ "Volume record channel support", "spice.record_cap_volume",
FT_BOOLEAN, 3, TFS(&tfs_set_notset), SPICE_RECORD_CAP_VOLUME_MASK,

View File

@ -105,43 +105,35 @@ spp_datastream(guint8 type)
static void
dissect_spp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
proto_tree *spp_tree = NULL;
proto_tree *spp_tree;
proto_item *ti;
tvbuff_t *next_tvb;
guint8 conn_ctrl;
proto_tree *cc_tree;
guint8 datastream_type;
const char *datastream_type_string;
guint16 spp_seq;
const char *spp_msg_string;
guint16 low_socket, high_socket;
static const int * ctrl[] = {
&hf_spp_connection_control_sys,
&hf_spp_connection_control_send_ack,
&hf_spp_connection_control_attn,
&hf_spp_connection_control_eom,
NULL
};
col_set_str(pinfo->cinfo, COL_PROTOCOL, "SPP");
col_set_str(pinfo->cinfo, COL_INFO, "SPP");
if (tree) {
ti = proto_tree_add_item(tree, proto_spp, tvb, 0, SPP_HEADER_LEN, ENC_NA);
spp_tree = proto_item_add_subtree(ti, ett_spp);
}
ti = proto_tree_add_item(tree, proto_spp, tvb, 0, SPP_HEADER_LEN, ENC_NA);
spp_tree = proto_item_add_subtree(ti, ett_spp);
conn_ctrl = tvb_get_guint8(tvb, 0);
spp_msg_string = spp_conn_ctrl(conn_ctrl);
col_append_fstr(pinfo->cinfo, COL_INFO, " %s", spp_msg_string);
if (tree) {
ti = proto_tree_add_uint_format_value(spp_tree, hf_spp_connection_control, tvb,
0, 1, conn_ctrl,
"%s (0x%02X)",
spp_msg_string, conn_ctrl);
cc_tree = proto_item_add_subtree(ti, ett_spp_connctrl);
proto_tree_add_boolean(cc_tree, hf_spp_connection_control_sys, tvb,
0, 1, conn_ctrl);
proto_tree_add_boolean(cc_tree, hf_spp_connection_control_send_ack, tvb,
0, 1, conn_ctrl);
proto_tree_add_boolean(cc_tree, hf_spp_connection_control_attn, tvb,
0, 1, conn_ctrl);
proto_tree_add_boolean(cc_tree, hf_spp_connection_control_eom, tvb,
0, 1, conn_ctrl);
}
proto_tree_add_bitmask_with_flags(spp_tree, tvb, 0, hf_spp_connection_control, ett_spp_connctrl,
ctrl, ENC_NA, BMT_NO_FALSE);
datastream_type = tvb_get_guint8(tvb, 1);
datastream_type_string = spp_datastream(datastream_type);

View File

@ -979,15 +979,16 @@ static const value_string auth_krb5_types[] = {
static void
dissect_authentication_type_pair(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, proto_tree *tree)
{
guint8 mod;
static const int * auth_mods[] = {
&hf_telnet_auth_mod_enc,
&hf_telnet_auth_mod_cred_fwd,
&hf_telnet_auth_mod_how,
&hf_telnet_auth_mod_who,
NULL
};
proto_tree_add_item(tree, hf_telnet_auth_type, tvb, offset, 1, ENC_BIG_ENDIAN);
mod=tvb_get_guint8(tvb, offset+1);
proto_tree_add_uint(tree, hf_telnet_auth_mod_enc, tvb, offset+1, 1, mod);
proto_tree_add_boolean(tree, hf_telnet_auth_mod_cred_fwd, tvb, offset+1, 1, mod);
proto_tree_add_boolean(tree, hf_telnet_auth_mod_how, tvb, offset+1, 1, mod);
proto_tree_add_boolean(tree, hf_telnet_auth_mod_who, tvb, offset+1, 1, mod);
proto_tree_add_bitmask_list(tree, tvb, offset+1, 1, auth_mods, ENC_BIG_ENDIAN);
}
/* no kerberos blobs are ever >10kb ? (arbitrary limit) */
@ -1556,7 +1557,7 @@ telnet_sub_option(packet_info *pinfo, proto_tree *option_tree, proto_item *optio
/* Search for an unescaped IAC. */
cur_offset = offset;
len = tvb_length_remaining(tvb, offset);
len = tvb_reported_length_remaining(tvb, offset);
do {
iac_offset = tvb_find_guint8(tvb, cur_offset, len, TN_IAC);
iac_found = TRUE;
@ -1783,7 +1784,7 @@ static int find_unescaped_iac(tvbuff_t *tvb, int offset, int len)
(tvb_get_guint8(tvb, iac_offset + 1) == TN_IAC))
{
iac_offset+=2;
len = tvb_length_remaining(tvb, iac_offset);
len = tvb_reported_length_remaining(tvb, iac_offset);
}
return iac_offset;
}
@ -1812,7 +1813,7 @@ dissect_telnet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/*
* Scan through the buffer looking for an IAC byte.
*/
while ((len = tvb_length_remaining(tvb, offset)) > 0) {
while ((len = tvb_reported_length_remaining(tvb, offset)) > 0) {
iac_offset = find_unescaped_iac(tvb, offset, len);
if (iac_offset != -1) {
/*

View File

@ -323,7 +323,7 @@ static expert_field ei_xtp_spans_bad = EI_INIT;
/* dissector of each payload */
static int
dissect_xtp_aseg(tvbuff_t *tvb, proto_tree *tree, guint32 offset) {
guint32 len = tvb_length_remaining(tvb, offset);
guint32 len = tvb_reported_length_remaining(tvb, offset);
guint32 start = offset;
proto_item *ti, *ti2, *top_ti;
proto_tree *xtp_subtree;
@ -439,7 +439,7 @@ dissect_xtp_aseg(tvbuff_t *tvb, proto_tree *tree, guint32 offset) {
static int
dissect_xtp_traffic_cntl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
guint32 offset) {
guint32 len = tvb_length_remaining(tvb, offset);
guint32 len = tvb_reported_length_remaining(tvb, offset);
guint32 start = offset;
proto_item *top_ti;
proto_tree *xtp_subtree;
@ -514,7 +514,7 @@ dissect_xtp_traffic_cntl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
static int
dissect_xtp_tspec(tvbuff_t *tvb, proto_tree *tree, guint32 offset) {
guint32 len = tvb_length_remaining(tvb, offset);
guint32 len = tvb_reported_length_remaining(tvb, offset);
guint32 start = offset;
proto_item *ti, *ti2;
proto_tree *xtp_subtree;
@ -629,7 +629,7 @@ dissect_xtp_tspec(tvbuff_t *tvb, proto_tree *tree, guint32 offset) {
static void
dissect_xtp_data(tvbuff_t *tvb, proto_tree *tree, guint32 offset, gboolean have_btag) {
guint32 len = tvb_length_remaining(tvb, offset);
guint32 len = tvb_reported_length_remaining(tvb, offset);
proto_tree *xtp_subtree;
guint64 btag;
@ -652,7 +652,7 @@ dissect_xtp_data(tvbuff_t *tvb, proto_tree *tree, guint32 offset, gboolean have_
static void
dissect_xtp_cntl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
guint32 offset) {
guint32 len = tvb_length_remaining(tvb, offset);
guint32 len = tvb_reported_length_remaining(tvb, offset);
guint32 start = offset;
proto_item *top_ti;
proto_tree *xtp_subtree;
@ -723,7 +723,7 @@ dissect_xtp_first(tvbuff_t *tvb, proto_tree *tree, guint32 offset) {
static void
dissect_xtp_ecntl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
guint32 offset) {
guint32 len = tvb_length_remaining(tvb, offset);
guint32 len = tvb_reported_length_remaining(tvb, offset);
guint32 start = offset;
proto_item *top_ti;
proto_tree *xtp_subtree;
@ -843,7 +843,7 @@ dissect_xtp_jcntl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
static void
dissect_xtp_diag(tvbuff_t *tvb, proto_tree *tree, guint32 offset) {
guint32 len = tvb_length_remaining(tvb, offset);
guint32 len = tvb_reported_length_remaining(tvb, offset);
guint32 start = offset;
proto_item *ti;
proto_tree *xtp_subtree;
@ -867,7 +867,7 @@ dissect_xtp_diag(tvbuff_t *tvb, proto_tree *tree, guint32 offset) {
diag->val = tvb_get_ntohl(tvb, offset);
offset += 4;
/* message(n) */
msg_len = tvb_length_remaining(tvb, offset);
msg_len = tvb_reported_length_remaining(tvb, offset);
diag->msg = tvb_get_string_enc(NULL, tvb, offset, msg_len, ENC_ASCII);
/** display **/
@ -906,8 +906,26 @@ dissect_xtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
vec_t cksum_vec[1];
guint16 computed_cksum;
gboolean have_btag;
static const int * cmd_options_flags[] = {
&hf_xtp_cmd_options_nocheck,
&hf_xtp_cmd_options_edge,
&hf_xtp_cmd_options_noerr,
&hf_xtp_cmd_options_multi,
&hf_xtp_cmd_options_res,
&hf_xtp_cmd_options_sort,
&hf_xtp_cmd_options_noflow,
&hf_xtp_cmd_options_fastnak,
&hf_xtp_cmd_options_sreq,
&hf_xtp_cmd_options_dreq,
&hf_xtp_cmd_options_rclose,
&hf_xtp_cmd_options_wclose,
&hf_xtp_cmd_options_eom,
&hf_xtp_cmd_options_end,
&hf_xtp_cmd_options_btag,
NULL
};
if ((len = tvb_length(tvb)) < XTP_HEADER_LEN)
if ((len = tvb_reported_length(tvb)) < XTP_HEADER_LEN)
return 0;
col_set_str(pinfo->cinfo, COL_PROTOCOL, "XTP");
@ -986,43 +1004,9 @@ dissect_xtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
ti = proto_tree_add_uint(xtp_tree, hf_xtp_cmd,
tvb, offset, 4, xtph->cmd);
xtp_cmd_tree = proto_item_add_subtree(ti, ett_xtp_cmd);
ti = proto_tree_add_uint(xtp_cmd_tree, hf_xtp_cmd_options,
tvb, offset, 3, xtph->cmd_options);
/** add summary **/
proto_item_append_text(ti, " [%s]", options);
xtp_subtree = proto_item_add_subtree(ti, ett_xtp_cmd_options);
proto_tree_add_boolean(xtp_subtree, hf_xtp_cmd_options_nocheck,
tvb, offset, 3, xtph->cmd_options);
proto_tree_add_boolean(xtp_subtree, hf_xtp_cmd_options_edge,
tvb, offset, 3, xtph->cmd_options);
proto_tree_add_boolean(xtp_subtree, hf_xtp_cmd_options_noerr,
tvb, offset, 3, xtph->cmd_options);
proto_tree_add_boolean(xtp_subtree, hf_xtp_cmd_options_multi,
tvb, offset, 3, xtph->cmd_options);
proto_tree_add_boolean(xtp_subtree, hf_xtp_cmd_options_res,
tvb, offset, 3, xtph->cmd_options);
proto_tree_add_boolean(xtp_subtree, hf_xtp_cmd_options_sort,
tvb, offset, 3, xtph->cmd_options);
proto_tree_add_boolean(xtp_subtree, hf_xtp_cmd_options_noflow,
tvb, offset, 3, xtph->cmd_options);
proto_tree_add_boolean(xtp_subtree, hf_xtp_cmd_options_fastnak,
tvb, offset, 3, xtph->cmd_options);
proto_tree_add_boolean(xtp_subtree, hf_xtp_cmd_options_sreq,
tvb, offset, 3, xtph->cmd_options);
proto_tree_add_boolean(xtp_subtree, hf_xtp_cmd_options_dreq,
tvb, offset, 3, xtph->cmd_options);
proto_tree_add_boolean(xtp_subtree, hf_xtp_cmd_options_rclose,
tvb, offset, 3, xtph->cmd_options);
proto_tree_add_boolean(xtp_subtree, hf_xtp_cmd_options_wclose,
tvb, offset, 3, xtph->cmd_options);
proto_tree_add_boolean(xtp_subtree, hf_xtp_cmd_options_eom,
tvb, offset, 3, xtph->cmd_options);
proto_tree_add_boolean(xtp_subtree, hf_xtp_cmd_options_end,
tvb, offset, 3, xtph->cmd_options);
proto_tree_add_boolean(xtp_subtree, hf_xtp_cmd_options_btag,
tvb, offset, 3, xtph->cmd_options);
proto_tree_add_bitmask(xtp_cmd_tree, tvb, offset, hf_xtp_cmd_options, ett_xtp_cmd_options, cmd_options_flags, ENC_BIG_ENDIAN);
offset += 3;
ti = proto_tree_add_uint(xtp_cmd_tree, hf_xtp_cmd_ptype,
tvb, offset, 1, xtph->cmd_ptype);
xtp_subtree = proto_item_add_subtree(ti, ett_xtp_cmd_ptype);
@ -1111,7 +1095,7 @@ dissect_xtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
}
}
return tvb_length(tvb);
return tvb_reported_length(tvb);
}
void

View File

@ -1015,18 +1015,15 @@ dissect_zbee_nwk_status(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gui
static guint
dissect_zbee_nwk_leave(tvbuff_t *tvb, proto_tree *tree, guint offset)
{
guint8 leave_options;
static const int * leave_options[] = {
&hf_zbee_nwk_cmd_leave_rejoin,
&hf_zbee_nwk_cmd_leave_request,
&hf_zbee_nwk_cmd_leave_children,
NULL
};
/* Get and display the leave options. */
leave_options = tvb_get_guint8(tvb, offset);
if (tree) {
proto_tree_add_boolean(tree, hf_zbee_nwk_cmd_leave_rejoin, tvb, offset, 1,
leave_options & ZBEE_NWK_CMD_LEAVE_OPTION_REJOIN);
proto_tree_add_boolean(tree, hf_zbee_nwk_cmd_leave_request, tvb, offset, 1,
leave_options & ZBEE_NWK_CMD_LEAVE_OPTION_REQUEST);
proto_tree_add_boolean(tree, hf_zbee_nwk_cmd_leave_children, tvb, offset, 1,
leave_options & ZBEE_NWK_CMD_LEAVE_OPTION_CHILDREN);
}
proto_tree_add_bitmask_list(tree, tvb, offset, 1, leave_options, ENC_NA);
offset += 1;
/* Done */
@ -1176,17 +1173,17 @@ dissect_zbee_nwk_link_status(tvbuff_t *tvb, proto_tree *tree, guint offset)
guint8 options;
int i, link_count;
proto_tree *subtree;
static const int * link_options[] = {
&hf_zbee_nwk_cmd_link_last,
&hf_zbee_nwk_cmd_link_first,
&hf_zbee_nwk_cmd_link_count,
NULL
};
/* Get and Display the link status options. */
options = tvb_get_guint8(tvb, offset);
link_count = options & ZBEE_NWK_CMD_LINK_OPTION_COUNT_MASK;
if (tree) {
proto_tree_add_boolean(tree, hf_zbee_nwk_cmd_link_last, tvb, offset, 1,
options & ZBEE_NWK_CMD_LINK_OPTION_LAST_FRAME);
proto_tree_add_boolean(tree, hf_zbee_nwk_cmd_link_first, tvb, offset, 1,
options & ZBEE_NWK_CMD_LINK_OPTION_FIRST_FRAME);
proto_tree_add_uint(tree, hf_zbee_nwk_cmd_link_count, tvb, offset, 1, link_count);
}
proto_tree_add_bitmask_list(tree, tvb, offset, 1, link_options, ENC_NA);
offset += 1;
/* Get and Display the link status list. */

View File

@ -359,16 +359,16 @@ dissect_zbee_zdp_req_mgmt_leave(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t
{
guint offset = 0;
guint64 ext_addr;
guint8 flags;
static const int * flags[] = {
&hf_zbee_zdp_leave_children,
&hf_zbee_zdp_leave_rejoin,
NULL
};
ext_addr = zbee_parse_eui64(tree, hf_zbee_zdp_ext_addr, tvb, &offset, 8, NULL);
if (version >= ZBEE_VERSION_2007) {
/* Flags present on ZigBee 2006 & later. */
flags = tvb_get_guint8(tvb, offset);
if (tree) {
proto_tree_add_boolean(tree, hf_zbee_zdp_leave_children, tvb, offset, 1, flags & ZBEE_ZDP_MGMT_LEAVE_CHILDREN);
proto_tree_add_boolean(tree, hf_zbee_zdp_leave_rejoin, tvb, offset, 1, flags & ZBEE_ZDP_MGMT_LEAVE_REJOIN);
}
proto_tree_add_bitmask_list(tree, tvb, offset, 1, flags, ENC_NA);
offset += 1;
}

View File

@ -74,6 +74,7 @@ static int hf_zbee_zdp_status = -1;
int hf_zbee_zdp_cache_address = -1;
/* Capability information indicies. */
static int hf_zbee_zdp_cinfo = -1;
static int hf_zbee_zdp_cinfo_alloc = -1;
static int hf_zbee_zdp_cinfo_security = -1;
static int hf_zbee_zdp_cinfo_idle_rx = -1;
@ -82,6 +83,7 @@ static int hf_zbee_zdp_cinfo_ffd = -1;
static int hf_zbee_zdp_cinfo_alt_coord = -1;
/* Server mode flag indicies. */
static int hf_zbee_zdp_server = -1;
static int hf_zbee_zdp_server_pri_trust = -1;
static int hf_zbee_zdp_server_bak_trust = -1;
static int hf_zbee_zdp_server_pri_bind = -1;
@ -100,10 +102,12 @@ static int hf_zbee_zdp_node_manufacturer = -1;
static int hf_zbee_zdp_node_max_buffer = -1;
static int hf_zbee_zdp_node_max_incoming_transfer = -1;
static int hf_zbee_zdp_node_max_outgoing_transfer = -1;
static int hf_zbee_zdp_dcf = -1;
static int hf_zbee_zdp_dcf_eaela = -1;
static int hf_zbee_zdp_dcf_esdla = -1;
/* Power descriptor indicies. */
static int hf_zbee_zdp_power = -1;
static int hf_zbee_zdp_power_mode = -1;
static int hf_zbee_zdp_power_avail_ac = -1;
static int hf_zbee_zdp_power_avail_recharge = -1;
@ -695,27 +699,21 @@ zdp_parse_chanmask(proto_tree *tree, tvbuff_t *tvb, guint *offset, int hf_channe
guint8
zdp_parse_cinfo(proto_tree *tree, gint ettindex, tvbuff_t *tvb, guint *offset)
{
proto_tree *field_tree;
guint8 flags;
static const int * cinfo[] = {
&hf_zbee_zdp_cinfo_alt_coord,
&hf_zbee_zdp_cinfo_ffd,
&hf_zbee_zdp_cinfo_power,
&hf_zbee_zdp_cinfo_idle_rx,
&hf_zbee_zdp_cinfo_security,
&hf_zbee_zdp_cinfo_alloc,
NULL
};
/* Get and display the flags. */
proto_tree_add_bitmask_with_flags(tree, tvb, *offset, hf_zbee_zdp_cinfo, ettindex, cinfo, ENC_NA, BMT_NO_APPEND);
flags = tvb_get_guint8(tvb, *offset);
if (tree) {
if (ettindex != -1) {
field_tree = proto_tree_add_subtree(tree, tvb, *offset, (int)sizeof(guint8),
ettindex, NULL, "Capability Information");
}
else
field_tree = tree;
proto_tree_add_boolean(field_tree, hf_zbee_zdp_cinfo_alt_coord, tvb, *offset, (int)sizeof(guint8), flags & ZBEE_CINFO_ALT_COORD);
proto_tree_add_boolean(field_tree, hf_zbee_zdp_cinfo_ffd, tvb, *offset, (int)sizeof(guint8), flags & ZBEE_CINFO_FFD);
proto_tree_add_boolean(field_tree, hf_zbee_zdp_cinfo_power, tvb, *offset, (int)sizeof(guint8), flags & ZBEE_CINFO_POWER);
proto_tree_add_boolean(field_tree, hf_zbee_zdp_cinfo_idle_rx, tvb, *offset, (int)sizeof(guint8), flags & ZBEE_CINFO_IDLE_RX);
proto_tree_add_boolean(field_tree, hf_zbee_zdp_cinfo_security, tvb, *offset, (int)sizeof(guint8), flags & ZBEE_CINFO_SECURITY);
proto_tree_add_boolean(field_tree, hf_zbee_zdp_cinfo_alloc, tvb, *offset, (int)sizeof(guint8), flags & ZBEE_CINFO_ALLOC);
}
*offset += (int)sizeof(guint8);
*offset += 1;
return flags;
} /* zdp_parse_cinfo */
@ -738,26 +736,21 @@ zdp_parse_cinfo(proto_tree *tree, gint ettindex, tvbuff_t *tvb, guint *offset)
guint16
zdp_parse_server_flags(proto_tree *tree, gint ettindex, tvbuff_t *tvb, guint *offset)
{
proto_tree *field_tree;
guint16 flags;
static const int * server_flags[] = {
&hf_zbee_zdp_server_pri_trust,
&hf_zbee_zdp_server_bak_trust,
&hf_zbee_zdp_server_pri_bind,
&hf_zbee_zdp_server_bak_bind,
&hf_zbee_zdp_server_pri_disc,
&hf_zbee_zdp_server_bak_disc,
NULL
};
/* Get and display the flags. */
flags = tvb_get_letohs(tvb, *offset);
if (tree) {
if (ettindex != -1) {
field_tree = proto_tree_add_subtree(tree, tvb, *offset, 2, ettindex, NULL, "Server Flags");
}
else
field_tree = tree;
proto_tree_add_boolean(field_tree, hf_zbee_zdp_server_pri_trust, tvb, *offset, (int)sizeof(guint16), flags & ZBEE_ZDP_NODE_SERVER_PRIMARY_TRUST);
proto_tree_add_boolean(field_tree, hf_zbee_zdp_server_bak_trust, tvb, *offset, (int)sizeof(guint16), flags & ZBEE_ZDP_NODE_SERVER_BACKUP_TRUST);
proto_tree_add_boolean(field_tree, hf_zbee_zdp_server_pri_bind, tvb, *offset, (int)sizeof(guint16), flags & ZBEE_ZDP_NODE_SERVER_PRIMARY_BIND);
proto_tree_add_boolean(field_tree, hf_zbee_zdp_server_bak_bind, tvb, *offset, (int)sizeof(guint16), flags & ZBEE_ZDP_NODE_SERVER_BACKUP_BIND);
proto_tree_add_boolean(field_tree, hf_zbee_zdp_server_pri_disc, tvb, *offset, (int)sizeof(guint16), flags & ZBEE_ZDP_NODE_SERVER_PRIMARY_DISC);
proto_tree_add_boolean(field_tree, hf_zbee_zdp_server_bak_disc, tvb, *offset, (int)sizeof(guint16), flags & ZBEE_ZDP_NODE_SERVER_BACKUP_DISC);
}
*offset += (int)sizeof(guint16);
proto_tree_add_bitmask_with_flags(tree, tvb, *offset, hf_zbee_zdp_server, ettindex, server_flags, ENC_LITTLE_ENDIAN, BMT_NO_APPEND);
*offset += 2;
return flags;
} /* zdp_parse_server_flags */
@ -786,12 +779,19 @@ zdp_parse_node_desc(proto_tree *tree, gint ettindex, tvbuff_t *tvb, guint *offse
proto_item *field_root = NULL;
proto_tree *field_tree = NULL;
guint8 d_c_field;
guint16 flags;
/*guint8 capability;*/
/*guint16 mfr_code;*/
/*guint8 max_buff;*/
/*guint16 max_transfer;*/
static const int * nodes[] = {
&hf_zbee_zdp_node_complex,
&hf_zbee_zdp_node_user,
&hf_zbee_zdp_node_freq_868,
&hf_zbee_zdp_node_freq_900,
&hf_zbee_zdp_node_freq_2400,
NULL
};
if ((tree) && (ettindex != -1)) {
field_tree = proto_tree_add_subtree(tree, tvb, *offset, -1, ettindex, &field_root, "Node Descriptor");
@ -803,12 +803,9 @@ zdp_parse_node_desc(proto_tree *tree, gint ettindex, tvbuff_t *tvb, guint *offse
flags = tvb_get_letohs(tvb, *offset);
if (tree) {
guint16 type = flags & ZBEE_ZDP_NODE_TYPE;
ti = proto_tree_add_uint(field_tree, hf_zbee_zdp_node_type, tvb, *offset, (int)sizeof(guint16), type);
proto_tree_add_boolean(field_tree, hf_zbee_zdp_node_complex, tvb, *offset, (int)sizeof(guint16), flags & ZBEE_ZDP_NODE_COMPLEX);
proto_tree_add_boolean(field_tree, hf_zbee_zdp_node_user, tvb, *offset, (int)sizeof(guint16), flags & ZBEE_ZDP_NODE_USER);
proto_tree_add_boolean(field_tree, hf_zbee_zdp_node_freq_868, tvb, *offset, (int)sizeof(guint16), flags & ZBEE_ZDP_NODE_FREQ_868MHZ);
proto_tree_add_boolean(field_tree, hf_zbee_zdp_node_freq_900, tvb, *offset, (int)sizeof(guint16), flags & ZBEE_ZDP_NODE_FREQ_900MHZ);
proto_tree_add_boolean(field_tree, hf_zbee_zdp_node_freq_2400, tvb, *offset, (int)sizeof(guint16), flags & ZBEE_ZDP_NODE_FREQ_2400MHZ);
ti = proto_tree_add_uint(field_tree, hf_zbee_zdp_node_type, tvb, *offset, 2, type);
/* XXX - should probably be converted to proto_tree_add_bitmask */
proto_tree_add_bitmask_list(field_tree, tvb, *offset, 2, nodes, ENC_LITTLE_ENDIAN);
/* Enumerate the type field. */
if (type == ZBEE_ZDP_NODE_TYPE_COORD) proto_item_append_text(ti, " (Coordinator)");
@ -816,7 +813,7 @@ zdp_parse_node_desc(proto_tree *tree, gint ettindex, tvbuff_t *tvb, guint *offse
else if (type == ZBEE_ZDP_NODE_TYPE_RFD) proto_item_append_text(ti, " (End Device)");
else proto_item_append_text(ti, " (Reserved)");
}
*offset += (int)sizeof(guint16);
*offset += 2;
/* Get and display the capability flags. */
/*capability =*/ zdp_parse_cinfo(field_tree, ett_zbee_zdp_cinfo, tvb, offset);
@ -826,15 +823,15 @@ zdp_parse_node_desc(proto_tree *tree, gint ettindex, tvbuff_t *tvb, guint *offse
/* Get and display the server flags. */
if (version >= ZBEE_VERSION_2007) {
const int * descriptors[] = {
&hf_zbee_zdp_dcf_eaela,
&hf_zbee_zdp_dcf_esdla,
NULL
};
zdp_parse_server_flags(field_tree, ett_zbee_zdp_server, tvb, offset);
zbee_parse_uint(field_tree, hf_zbee_zdp_node_max_outgoing_transfer, tvb, offset, 2, NULL);
d_c_field = tvb_get_guint8(tvb, *offset);
field_tree = proto_tree_add_subtree(field_tree, tvb, *offset, 1,
ett_zbee_zdp_descriptor_capability_field, NULL, "Descriptor Capability Field");
proto_tree_add_boolean(field_tree, hf_zbee_zdp_dcf_eaela, tvb, *offset, 1, d_c_field & ZBEE_ZDP_DCF_EAELA);
proto_tree_add_boolean(field_tree, hf_zbee_zdp_dcf_esdla, tvb, *offset, 1, d_c_field & ZBEE_ZDP_DCF_ESDLA);
proto_tree_add_bitmask_with_flags(field_tree, tvb, *offset, hf_zbee_zdp_dcf, ett_zbee_zdp_descriptor_capability_field, descriptors, ENC_NA, BMT_NO_APPEND);
*offset += 1;
}
@ -862,50 +859,40 @@ zdp_parse_node_desc(proto_tree *tree, gint ettindex, tvbuff_t *tvb, guint *offse
* void
*---------------------------------------------------------------
*/
static const value_string zbee_zdp_power_mode_vals[] = {
{ ZBEE_ZDP_POWER_MODE_RX_ON, "Receiver Always On" },
{ ZBEE_ZDP_POWER_MODE_RX_PERIODIC, "Receiver Periodically On" },
{ ZBEE_ZDP_POWER_MODE_RX_STIMULATE, "Receiver On When Stimulated" },
{ 0, NULL }
};
static const value_string zbee_zdp_power_level_vals[] = {
{ ZBEE_ZDP_POWER_LEVEL_FULL, "Full" },
{ ZBEE_ZDP_POWER_LEVEL_OK, "OK" },
{ ZBEE_ZDP_POWER_LEVEL_LOW, "Low" },
{ ZBEE_ZDP_POWER_LEVEL_CRITICAL, "Critical" },
{ 0, NULL }
};
void
zdp_parse_power_desc(proto_tree *tree, gint ettindex, tvbuff_t *tvb, guint *offset)
{
proto_item *ti;
proto_tree *field_tree;
static const int * power_desc[] = {
&hf_zbee_zdp_power_mode,
&hf_zbee_zdp_power_avail_ac,
&hf_zbee_zdp_power_avail_recharge,
&hf_zbee_zdp_power_avail_dispose,
&hf_zbee_zdp_power_source_ac,
&hf_zbee_zdp_power_source_recharge,
&hf_zbee_zdp_power_source_dispose,
&hf_zbee_zdp_power_level,
NULL
};
guint16 flags;
guint16 mode;
guint16 level;
if ((tree) && (ettindex != -1)) {
field_tree = proto_tree_add_subtree(tree, tvb, *offset, (int)sizeof(guint16), ettindex, NULL, "Power Descriptor");
}
else field_tree = tree;
flags = tvb_get_letohs(tvb, *offset);
mode = flags & ZBEE_ZDP_POWER_MODE;
level = flags & ZBEE_ZDP_POWER_LEVEL;
if (tree) {
ti = proto_tree_add_uint(field_tree, hf_zbee_zdp_power_mode, tvb, *offset, (int)sizeof(guint16), mode);
if (mode == ZBEE_ZDP_POWER_MODE_RX_ON) proto_item_append_text(ti, " (Receiver Always On)");
else if (mode == ZBEE_ZDP_POWER_MODE_RX_PERIODIC) proto_item_append_text(ti, " (Receiver Periodically On)");
else if (mode == ZBEE_ZDP_POWER_MODE_RX_STIMULATE) proto_item_append_text(ti, " (Receiver On When Stimulated)");
else proto_item_append_text(ti, " (Reserved)");
proto_tree_add_boolean(field_tree, hf_zbee_zdp_power_avail_ac, tvb, *offset, (int)sizeof(guint16), flags & ZBEE_ZDP_POWER_AVAIL_AC);
proto_tree_add_boolean(field_tree, hf_zbee_zdp_power_avail_recharge, tvb, *offset, (int)sizeof(guint16), flags & ZBEE_ZDP_POWER_AVAIL_RECHARGEABLE);
proto_tree_add_boolean(field_tree, hf_zbee_zdp_power_avail_dispose, tvb, *offset, (int)sizeof(guint16), flags & ZBEE_ZDP_POWER_AVAIL_DISPOSEABLE);
proto_tree_add_boolean(field_tree, hf_zbee_zdp_power_source_ac, tvb, *offset, (int)sizeof(guint16), flags & ZBEE_ZDP_POWER_SOURCE_AC);
proto_tree_add_boolean(field_tree, hf_zbee_zdp_power_source_recharge, tvb, *offset, (int)sizeof(guint16), flags & ZBEE_ZDP_POWER_SOURCE_RECHARGEABLE);
proto_tree_add_boolean(field_tree, hf_zbee_zdp_power_source_dispose, tvb, *offset, (int)sizeof(guint16), flags & ZBEE_ZDP_POWER_SOURCE_DISPOSEABLE);
if (level == ZBEE_ZDP_POWER_LEVEL_FULL)
proto_tree_add_uint_format_value(field_tree, hf_zbee_zdp_power_level, tvb, *offset, (int)sizeof(guint16), level, "Full");
else if (level == ZBEE_ZDP_POWER_LEVEL_OK)
proto_tree_add_uint_format_value(field_tree, hf_zbee_zdp_power_level, tvb, *offset, (int)sizeof(guint16), level, "OK");
else if (level == ZBEE_ZDP_POWER_LEVEL_LOW)
proto_tree_add_uint_format_value(field_tree, hf_zbee_zdp_power_level, tvb, *offset, (int)sizeof(guint16), level, "Low");
else if (level == ZBEE_ZDP_POWER_LEVEL_CRITICAL)
proto_tree_add_uint_format_value(field_tree, hf_zbee_zdp_power_level, tvb, *offset, (int)sizeof(guint16), level, "Critical");
else proto_tree_add_uint_format_value(field_tree, hf_zbee_zdp_power_level, tvb, *offset, (int)sizeof(guint16), level, "Reserved");
}
*offset += (int)sizeof(guint16);
proto_tree_add_bitmask_with_flags(tree, tvb, *offset, hf_zbee_zdp_power, ettindex, power_desc, ENC_LITTLE_ENDIAN, BMT_NO_APPEND);
*offset += 2;
} /* zdp_parse_power_desc */
/*FUNCTION:------------------------------------------------------
@ -1485,6 +1472,10 @@ void proto_register_zbee_zdp(void)
{ "Associated Device", "zbee_zdp.assoc_device", FT_UINT16, BASE_HEX, NULL, 0x0,
NULL, HFILL }},
{ &hf_zbee_zdp_cinfo,
{ "Capability Information", "zbee_zdp.cinfo", FT_UINT8, BASE_HEX, NULL, 0x0,
NULL, HFILL }},
{ &hf_zbee_zdp_cinfo_alt_coord,
{ "Alternate Coordinator", "zbee_zdp.cinfo.alt_coord", FT_BOOLEAN, 8, NULL, ZBEE_CINFO_ALT_COORD,
"Indicates that the device is able to operate as a PAN coordinator.", HFILL }},
@ -1509,6 +1500,10 @@ void proto_register_zbee_zdp(void)
{ "Allocate Short Address", "zbee_zdp.cinfo.alloc", FT_BOOLEAN, 8, NULL, ZBEE_CINFO_ALLOC,
"Flag requesting the parent to allocate a short address for this device.", HFILL }},
{ &hf_zbee_zdp_dcf,
{ "Descriptor Capability Field", "zbee_zdp.dcf", FT_UINT8, BASE_HEX, NULL, 0,
NULL, HFILL }},
{ &hf_zbee_zdp_dcf_eaela,
{ "Extended Active Endpoint List Available", "zbee_zdp.dcf.eaela", FT_BOOLEAN, 8, NULL, ZBEE_ZDP_DCF_EAELA,
NULL, HFILL }},
@ -1517,6 +1512,10 @@ void proto_register_zbee_zdp(void)
{ "Extended Simple Descriptor List Available", "zbee_zdp.dcf.esdla", FT_BOOLEAN, 8, NULL, ZBEE_ZDP_DCF_ESDLA,
NULL, HFILL }},
{ &hf_zbee_zdp_server,
{ "Server Flags", "zbee_zdp.server", FT_UINT16, BASE_HEX, NULL, 0x0,
NULL, HFILL }},
{ &hf_zbee_zdp_server_pri_trust,
{ "Primary Trust Center", "zbee_zdp.server.pri_trust", FT_BOOLEAN, 16, NULL, ZBEE_ZDP_NODE_SERVER_PRIMARY_TRUST,
NULL, HFILL }},
@ -1581,8 +1580,12 @@ void proto_register_zbee_zdp(void)
{ "Max Outgoing Transfer Size", "zbee_zdp.node.max_outgoing_transfer", FT_UINT16, BASE_DEC, NULL, 0x0,
NULL, HFILL }},
{ &hf_zbee_zdp_power,
{ "Power Descriptor", "zbee_zdp.power", FT_UINT16, BASE_HEX, NULL, 0x0,
NULL, HFILL }},
{ &hf_zbee_zdp_power_mode,
{ "Mode", "zbee_zdp.power.mode", FT_UINT16, BASE_DEC, NULL, ZBEE_ZDP_POWER_MODE,
{ "Mode", "zbee_zdp.power.mode", FT_UINT16, BASE_DEC, VALS(zbee_zdp_power_mode_vals), ZBEE_ZDP_POWER_MODE,
NULL, HFILL }},
{ &hf_zbee_zdp_power_avail_ac,
@ -1610,7 +1613,7 @@ void proto_register_zbee_zdp(void)
NULL, HFILL }},
{ &hf_zbee_zdp_power_level,
{ "Level", "zbee_zdp.power.level", FT_UINT16, BASE_DEC, NULL, ZBEE_ZDP_POWER_LEVEL,
{ "Level", "zbee_zdp.power.level", FT_UINT16, BASE_DEC, VALS(zbee_zdp_power_level_vals), ZBEE_ZDP_POWER_LEVEL,
NULL, HFILL }},
{ &hf_zbee_zdp_simple_app_device,