diff options
author | Jorge Mora <jmora1300@gmail.com> | 2022-03-09 21:27:09 -0700 |
---|---|---|
committer | A Wireshark GitLab Utility <gerald+gitlab-utility@wireshark.org> | 2022-03-16 05:33:46 +0000 |
commit | 4cc8e0921363eca99d10f0c240bf85b67a470b78 (patch) | |
tree | 401c899b631783fd40620780636da74df8cf2eb7 | |
parent | 2523f6781d311d6aaa4aa8755fbda369a8931a79 (diff) |
IWARP_DDP_RDMAP: add untagged buffer items to struct rdmapinfo
Include last_flag, is_tagged, queue_number, message_seq_num and
message_offset in rdmapinfo to pass to payload subdissectors.
Also, add a typedef for struct rdmapinfo.
Related to #17963.
-rw-r--r-- | epan/dissectors/packet-iwarp-ddp-rdmap.c | 32 | ||||
-rw-r--r-- | epan/dissectors/packet-iwarp-ddp-rdmap.h | 11 |
2 files changed, 24 insertions, 19 deletions
diff --git a/epan/dissectors/packet-iwarp-ddp-rdmap.c b/epan/dissectors/packet-iwarp-ddp-rdmap.c index 097c9419e6..4b31803524 100644 --- a/epan/dissectors/packet-iwarp-ddp-rdmap.c +++ b/epan/dissectors/packet-iwarp-ddp-rdmap.c @@ -270,7 +270,7 @@ static heur_dissector_list_t rdmap_heur_subdissector_list; static void dissect_rdmap_payload(tvbuff_t *tvb, packet_info *pinfo, - proto_tree *tree, struct rdmapinfo *info) + proto_tree *tree, rdmap_info_t *info) { heur_dtbl_entry_t *hdtbl_entry; @@ -539,23 +539,23 @@ dissect_iwarp_ddp_rdmap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi tvbuff_t *next_tvb = NULL; - gboolean is_tagged_buffer_model; guint8 ddp_ctrl_field, rdma_ctrl_field; - struct rdmapinfo info = { 0, }; + rdmap_info_t info = { 0, 0, 0, 0, 0, 0 }; guint32 header_end; guint32 offset = 0; ddp_ctrl_field = tvb_get_guint8(tvb, 0); rdma_ctrl_field = tvb_get_guint8(tvb, 1); info.opcode = rdma_ctrl_field & RDMA_OPCODE; - is_tagged_buffer_model = ddp_ctrl_field & DDP_TAGGED_FLAG; + info.is_tagged = (ddp_ctrl_field & DDP_TAGGED_FLAG) ? TRUE : FALSE; + info.last_flag = (ddp_ctrl_field & DDP_LAST_FLAG) ? TRUE : FALSE; - ddp_rdma_packetlist(pinfo, ddp_ctrl_field & DDP_LAST_FLAG, info.opcode); + ddp_rdma_packetlist(pinfo, info.last_flag, info.opcode); offset = 0; /* determine header length */ - if (is_tagged_buffer_model) { + if (info.is_tagged) { header_end = DDP_TAGGED_HEADER_LEN; } else { header_end = DDP_UNTAGGED_HEADER_LEN; @@ -596,13 +596,13 @@ dissect_iwarp_ddp_rdmap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi /* DDP header field RsvdULP */ - if (!is_tagged_buffer_model) { + if (!info.is_tagged) { proto_tree_add_item(ddp_tree, hf_iwarp_ddp_rsvdulp, tvb, offset, DDP_UNTAGGED_RSVDULP_LEN, ENC_NA); } /* RDMA protocol header subtree */ - if (is_tagged_buffer_model) { + if (info.is_tagged) { header_end = RDMA_CONTROL_FIELD_LEN; } else { header_end = RDMA_CONTROL_FIELD_LEN + RDMA_RESERVED_FIELD_LEN; @@ -642,12 +642,12 @@ dissect_iwarp_ddp_rdmap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi tvb, offset, RDMA_INVAL_STAG_LEN, ENC_BIG_ENDIAN); } - if (!is_tagged_buffer_model) { + if (!info.is_tagged) { offset += RDMA_RESERVED_FIELD_LEN; } /* DDP Buffer Model dissection */ - if (is_tagged_buffer_model) { + if (info.is_tagged) { /* Tagged Buffer Model Case */ ddp_buffer_model_item = proto_tree_add_item(ddp_tree, @@ -680,14 +680,14 @@ dissect_iwarp_ddp_rdmap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi ddp_buffer_model_tree = proto_item_add_subtree(ddp_buffer_model_item, ett_iwarp_ddp); - proto_tree_add_item(ddp_buffer_model_tree, hf_iwarp_ddp_qn, tvb, - offset, DDP_QN_LEN, ENC_BIG_ENDIAN); + proto_tree_add_item_ret_uint(ddp_buffer_model_tree, hf_iwarp_ddp_qn, tvb, + offset, DDP_QN_LEN, ENC_BIG_ENDIAN, &info.queue_number); offset += DDP_QN_LEN; - proto_tree_add_item(ddp_buffer_model_tree, hf_iwarp_ddp_msn, tvb, - offset, DDP_MSN_LEN, ENC_BIG_ENDIAN); + proto_tree_add_item_ret_uint(ddp_buffer_model_tree, hf_iwarp_ddp_msn, tvb, + offset, DDP_MSN_LEN, ENC_BIG_ENDIAN, &info.message_seq_num); offset += DDP_MSN_LEN; - proto_tree_add_item(ddp_buffer_model_tree, hf_iwarp_ddp_mo, tvb, - offset, DDP_MO_LEN, ENC_BIG_ENDIAN); + proto_tree_add_item_ret_uint(ddp_buffer_model_tree, hf_iwarp_ddp_mo, tvb, + offset, DDP_MO_LEN, ENC_BIG_ENDIAN, &info.message_offset); offset += DDP_MO_LEN; if (info.opcode == RDMA_SEND diff --git a/epan/dissectors/packet-iwarp-ddp-rdmap.h b/epan/dissectors/packet-iwarp-ddp-rdmap.h index e3151e2646..be27cd859c 100644 --- a/epan/dissectors/packet-iwarp-ddp-rdmap.h +++ b/epan/dissectors/packet-iwarp-ddp-rdmap.h @@ -24,8 +24,13 @@ #define RDMA_SEND_SE_INVALIDATE 0x06 #define RDMA_TERMINATE 0x07 -struct rdmapinfo { - guint8 opcode; -}; +typedef struct rdmapinfo { + guint8 opcode; + gboolean last_flag; + gboolean is_tagged; + guint32 queue_number; + guint32 message_seq_num; + guint32 message_offset; +} rdmap_info_t; #endif /* __PACKET_IWARP_DDP_RDMAP_H_ */ |