forked from osmocom/wireshark
Do expert "telegrams lost" only of field is > 0;
Don't call expert...() under 'if (tree)' svn path=/trunk/; revision=43683
This commit is contained in:
parent
d5b965176a
commit
5150511879
|
@ -119,7 +119,7 @@ dissect_esio(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
||||||
{
|
{
|
||||||
|
|
||||||
/* Set up structures needed to add the protocol subtree and manage it */
|
/* Set up structures needed to add the protocol subtree and manage it */
|
||||||
proto_item *ti, *et, *hi;
|
proto_item *ti, *et;
|
||||||
proto_tree *esio_tree, *esio_header_tree, *esio_transfer_header_tree,
|
proto_tree *esio_tree, *esio_header_tree, *esio_transfer_header_tree,
|
||||||
*esio_data_tansfer_tree, *esio_data_tree;
|
*esio_data_tansfer_tree, *esio_data_tree;
|
||||||
|
|
||||||
|
@ -171,14 +171,13 @@ dissect_esio(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
||||||
|
|
||||||
}
|
}
|
||||||
/* create display subtree for the protocol */
|
/* create display subtree for the protocol */
|
||||||
if (tree) {
|
offset = 0;
|
||||||
offset =0;
|
|
||||||
ti = proto_tree_add_item(tree, proto_esio, tvb, offset, -1, ENC_NA);
|
ti = proto_tree_add_item(tree, proto_esio, tvb, offset, -1, ENC_NA);
|
||||||
esio_tree = proto_item_add_subtree(ti, ett_esio);
|
esio_tree = proto_item_add_subtree(ti, ett_esio);
|
||||||
/*Add subtree for Ether-S-I/O header*/
|
/*Add subtree for Ether-S-I/O header*/
|
||||||
et = proto_tree_add_text(esio_tree, tvb, offset, 12, "Ether-S-I/O header");
|
et = proto_tree_add_text(esio_tree, tvb, offset, 12, "Ether-S-I/O header");
|
||||||
esio_header_tree = proto_item_add_subtree(et, ett_esio_header);
|
esio_header_tree = proto_item_add_subtree(et, ett_esio_header);
|
||||||
offset +=4; /*first four bytes are "ESIO"*/
|
offset += 4; /*first four bytes are "ESIO"*/
|
||||||
/* add items to the Ether-S-I/O header subtree*/
|
/* add items to the Ether-S-I/O header subtree*/
|
||||||
esio_tlg_type = tvb_get_ntohs(tvb,offset);
|
esio_tlg_type = tvb_get_ntohs(tvb,offset);
|
||||||
proto_tree_add_item(esio_header_tree,
|
proto_tree_add_item(esio_header_tree,
|
||||||
|
@ -195,6 +194,7 @@ dissect_esio(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
||||||
offset += 2;
|
offset += 2;
|
||||||
switch (esio_tlg_type) {
|
switch (esio_tlg_type) {
|
||||||
case ESIO_TRANSFER:
|
case ESIO_TRANSFER:
|
||||||
|
if (tree) {
|
||||||
/*Add subtree for Ether-S-I/O header*/
|
/*Add subtree for Ether-S-I/O header*/
|
||||||
et = proto_tree_add_text(esio_tree, tvb, offset, 12, "Transfer header");
|
et = proto_tree_add_text(esio_tree, tvb, offset, 12, "Transfer header");
|
||||||
esio_transfer_header_tree = proto_item_add_subtree(et, ett_esio_transfer_header);
|
esio_transfer_header_tree = proto_item_add_subtree(et, ett_esio_transfer_header);
|
||||||
|
@ -239,39 +239,39 @@ dissect_esio(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
||||||
offset += 1;
|
offset += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} /* if (tree) */
|
||||||
break;
|
break;
|
||||||
case ESIO_STATUS:
|
case ESIO_STATUS: {
|
||||||
|
proto_item *hi = NULL;
|
||||||
|
if (tree) {
|
||||||
proto_tree_add_item(esio_tree,
|
proto_tree_add_item(esio_tree,
|
||||||
hf_esio_sts_type, tvb, offset, 2, ENC_BIG_ENDIAN);
|
hf_esio_sts_type, tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||||
offset += 2;
|
|
||||||
proto_tree_add_item(esio_tree,
|
proto_tree_add_item(esio_tree,
|
||||||
hf_esio_sts_size, tvb, offset, 2, ENC_BIG_ENDIAN);
|
hf_esio_sts_size, tvb, offset+2, 2, ENC_BIG_ENDIAN);
|
||||||
offset += 2;
|
|
||||||
proto_tree_add_item(esio_tree,
|
proto_tree_add_item(esio_tree,
|
||||||
hf_esio_src_stn_id, tvb, offset, 4, ENC_BIG_ENDIAN);
|
hf_esio_src_stn_id, tvb, offset+4, 4, ENC_BIG_ENDIAN);
|
||||||
offset += 4;
|
|
||||||
proto_tree_add_item(esio_tree,
|
proto_tree_add_item(esio_tree,
|
||||||
hf_esio_rio_sts, tvb, offset,
|
hf_esio_rio_sts, tvb, offset+8,
|
||||||
1, ENC_BIG_ENDIAN);
|
1, ENC_BIG_ENDIAN);
|
||||||
offset += 1;
|
|
||||||
hi = proto_tree_add_item(esio_tree,
|
hi = proto_tree_add_item(esio_tree,
|
||||||
hf_esio_rio_tlgs_lost, tvb, offset,
|
hf_esio_rio_tlgs_lost, tvb, offset+9,
|
||||||
1, ENC_BIG_ENDIAN);
|
1, ENC_BIG_ENDIAN);
|
||||||
|
proto_tree_add_item(esio_tree,
|
||||||
|
hf_esio_rio_diag, tvb, offset+10,
|
||||||
|
1, ENC_BIG_ENDIAN);
|
||||||
|
proto_tree_add_item(esio_tree,
|
||||||
|
hf_esio_rio_flags, tvb, offset+11, 1, ENC_BIG_ENDIAN);
|
||||||
|
} /* if (tree) */
|
||||||
|
if (tvb_get_guint8(tvb, offset + 9) > 0) {
|
||||||
expert_add_info_format(pinfo, hi, PI_SEQUENCE, PI_NOTE,
|
expert_add_info_format(pinfo, hi, PI_SEQUENCE, PI_NOTE,
|
||||||
"Telegram(s) lost");
|
"Telegram(s) lost");
|
||||||
offset += 1;
|
}
|
||||||
proto_tree_add_item(esio_tree,
|
|
||||||
hf_esio_rio_diag, tvb, offset,
|
|
||||||
1, ENC_BIG_ENDIAN);
|
|
||||||
offset += 1;
|
|
||||||
proto_tree_add_item(esio_tree,
|
|
||||||
hf_esio_rio_flags, tvb, offset, 1, ENC_BIG_ENDIAN);
|
|
||||||
offset += 1;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} /*end of tree*/
|
default:
|
||||||
|
break;
|
||||||
|
} /* switch() */
|
||||||
|
|
||||||
return tvb_length(tvb);
|
return tvb_length(tvb);
|
||||||
/*End of dissect_sbus*/
|
/*End of dissect_sbus*/
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue