aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-isns.c
diff options
context:
space:
mode:
Diffstat (limited to 'epan/dissectors/packet-isns.c')
-rw-r--r--epan/dissectors/packet-isns.c57
1 files changed, 27 insertions, 30 deletions
diff --git a/epan/dissectors/packet-isns.c b/epan/dissectors/packet-isns.c
index 4937f22133..da4dc863b2 100644
--- a/epan/dissectors/packet-isns.c
+++ b/epan/dissectors/packet-isns.c
@@ -544,11 +544,18 @@ static gint ett_isns = -1;
/* Code to actually dissect the packets */
-static void
-dissect_isns_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_isns_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
guint offset = 0;
guint16 function_id;
+ guint packet_len;
+ proto_item *ti;
+ proto_tree *isns_tree;
+ guint16 flags;
+ proto_tree *tt;
+ proto_item *tflags;
+ proto_item *tpayload;
/* Make entries in Protocol column and Info column on summary display */
col_set_str(pinfo->cinfo, COL_PROTOCOL, "iSNS");
@@ -562,13 +569,8 @@ dissect_isns_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
val_to_str_ext(function_id, &isns_function_ids_ext,
"Unknown function ID 0x%04x"));
- if (tree) {
- proto_item *ti;
- proto_tree *isns_tree;
- guint16 flags;
- proto_tree *tt;
- proto_item *tflags;
- proto_item *tpayload;
+ if (tree == NULL)
+ return tvb_length(tvb);
/* create display subtree for the protocol */
ti = proto_tree_add_item(tree, proto_isns, tvb, 0, -1, ENC_NA);
@@ -605,7 +607,6 @@ dissect_isns_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
switch (function_id)
{
case ISNS_FUNC_HEARTBEAT:
- {
proto_tree_add_item(tt,hf_isns_heartbeat_ipv6_addr, tvb, offset, 16, ENC_NA);
offset += 16;
@@ -621,7 +622,7 @@ dissect_isns_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_tree_add_item(tt,hf_isns_heartbeat_counter, tvb, offset, 4, ENC_BIG_ENDIAN);
/*offset += 4;*/
break;
- }
+
/* Responses */
case ISNS_FUNC_RSP_DEVATTRREG:
case ISNS_FUNC_RSP_DEVATTRQRY:
@@ -639,17 +640,18 @@ dissect_isns_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
case ISNS_FUNC_RSP_RQSTDOMID:
case ISNS_FUNC_RSP_RLSEDOMID:
case ISNS_FUNC_RSP_GETDOMID:
- {
+
/* Get the Error message of the response */
/* The Error field exists only at the beginning of a message (i.e., in the first PDU */
if(flags&ISNS_FLAGS_FIRST_PDU){
proto_tree_add_item(tt,hf_isns_resp_errorcode, tvb, offset, 4, ENC_BIG_ENDIAN);
offset += 4;
}
- /* Fall Thru if there are attributes */
- if (tvb_reported_length_remaining(tvb, offset) == 0)
- return;
- }
+
+ /* Fall Thru if there are attributes */
+ if (tvb_reported_length_remaining(tvb, offset) == 0)
+ return tvb_length(tvb);
+
/* Messages */
case ISNS_FUNC_DEVATTRREG:
case ISNS_FUNC_DEVATTRQRY:
@@ -668,25 +670,20 @@ dissect_isns_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
case ISNS_FUNC_RLSEDOMID:
case ISNS_FUNC_GETDOMID:
default:
- {
- guint packet_len;
-
/* we can only look at the attributes for the first PDU */
if(!(flags&ISNS_FLAGS_FIRST_PDU)){
- proto_tree_add_text(tt, tvb, offset, -1, "This is not the first PDU. The attributes are not decoded");
- return;
+ proto_tree_add_text(tt, tvb, offset, -1, "This is not the first PDU. The attributes are not decoded");
+ return tvb_length(tvb);
}
- packet_len = tvb_reported_length(tvb);
+ packet_len = tvb_reported_length(tvb);
while( offset < packet_len )
{
- offset = AddAttribute(pinfo, tvb, tt, offset, function_id);
+ offset = AddAttribute(pinfo, tvb, tt, offset, function_id);
}
- }
- }
}
- return;
+ return tvb_length(tvb);
}
static guint
@@ -699,7 +696,7 @@ get_isns_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
}
static int
-dissect_isns_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
+dissect_isns_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
gint length = tvb_length(tvb);
guint16 isns_protocol_version;
@@ -725,12 +722,12 @@ dissect_isns_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
}
tcp_dissect_pdus(tvb, pinfo, tree, isns_desegment, ISNS_HEADER_SIZE, get_isns_pdu_len,
- dissect_isns_pdu);
+ dissect_isns_pdu, data);
return length;
}
static int
-dissect_isns_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
+dissect_isns_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
gint length = tvb_length(tvb);
guint16 isns_protocol_version;
@@ -755,7 +752,7 @@ dissect_isns_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
return 0;
}
- dissect_isns_pdu(tvb, pinfo, tree);
+ dissect_isns_pdu(tvb, pinfo, tree, data);
return length;
}