forked from osmocom/wireshark
packet-iwarp-ddp-rdmap: pass struct rdmapinfo with opcode to the subdissectors
Change-Id: I51bb8a3047bbc16d55d0c089fe869c7534d4c0b5 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-on: https://code.wireshark.org/review/355 Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
This commit is contained in:
parent
98cc3d61dc
commit
6efd2c732a
|
@ -1470,6 +1470,7 @@ DISSECTOR_INCLUDES = \
|
|||
packet-isis-clv.h \
|
||||
packet-isl.h \
|
||||
packet-isup.h \
|
||||
packet-iwarp-ddp-rdmap.h \
|
||||
packet-jxta.h \
|
||||
packet-kerberos.h \
|
||||
packet-klm.h \
|
||||
|
|
|
@ -34,6 +34,8 @@
|
|||
|
||||
#include <epan/packet.h>
|
||||
|
||||
#include "packet-iwarp-ddp-rdmap.h"
|
||||
|
||||
void proto_register_iwarp_ddp_rdmap(void);
|
||||
void proto_reg_handoff_iwarp_ddp_rdmap(void);
|
||||
|
||||
|
@ -261,10 +263,11 @@ static const value_string ddp_errcode_untagged_names[] = {
|
|||
static heur_dissector_list_t rdmap_heur_subdissector_list;
|
||||
|
||||
static void
|
||||
dissect_rdmap_payload(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
||||
dissect_rdmap_payload(tvbuff_t *tvb, packet_info *pinfo,
|
||||
proto_tree *tree, struct rdmapinfo *info)
|
||||
{
|
||||
if (!dissector_try_heuristic(rdmap_heur_subdissector_list,
|
||||
tvb, pinfo, tree, NULL)) {
|
||||
tvb, pinfo, tree, info)) {
|
||||
call_dissector(data_handle, tvb, pinfo, tree);
|
||||
}
|
||||
}
|
||||
|
@ -485,16 +488,17 @@ dissect_iwarp_ddp_rdmap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
tvbuff_t *next_tvb = NULL;
|
||||
|
||||
gboolean is_tagged_buffer_model;
|
||||
guint8 ddp_ctrl_field, rdma_ctrl_field, rdma_msg_opcode;
|
||||
guint8 ddp_ctrl_field, rdma_ctrl_field;
|
||||
struct rdmapinfo info = { 0, };
|
||||
guint32 header_end;
|
||||
guint32 offset = 0;
|
||||
|
||||
ddp_ctrl_field = tvb_get_guint8(tvb, 0);
|
||||
rdma_ctrl_field = tvb_get_guint8(tvb, 1);
|
||||
rdma_msg_opcode = rdma_ctrl_field & RDMA_OPCODE;
|
||||
info.opcode = rdma_ctrl_field & RDMA_OPCODE;
|
||||
is_tagged_buffer_model = ddp_ctrl_field & DDP_TAGGED_FLAG;
|
||||
|
||||
ddp_rdma_packetlist(pinfo, ddp_ctrl_field & DDP_LAST_FLAG, rdma_msg_opcode);
|
||||
ddp_rdma_packetlist(pinfo, ddp_ctrl_field & DDP_LAST_FLAG, info.opcode);
|
||||
|
||||
if (tree) {
|
||||
|
||||
|
@ -507,8 +511,8 @@ dissect_iwarp_ddp_rdmap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
header_end = DDP_UNTAGGED_HEADER_LEN;
|
||||
}
|
||||
|
||||
if (rdma_msg_opcode == RDMA_READ_REQUEST
|
||||
|| rdma_msg_opcode == RDMA_TERMINATE) {
|
||||
if (info.opcode == RDMA_READ_REQUEST
|
||||
|| info.opcode == RDMA_TERMINATE) {
|
||||
header_end = -1;
|
||||
}
|
||||
|
||||
|
@ -574,16 +578,16 @@ dissect_iwarp_ddp_rdmap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
offset += RDMA_CONTROL_FIELD_LEN;
|
||||
|
||||
/* dissection of DDP rsvdULP[8:39] with respect to RDMAP */
|
||||
if (rdma_msg_opcode == RDMA_READ_REQUEST
|
||||
|| rdma_msg_opcode == RDMA_SEND
|
||||
|| rdma_msg_opcode == RDMA_SEND_SE
|
||||
|| rdma_msg_opcode == RDMA_TERMINATE) {
|
||||
if (info.opcode == RDMA_READ_REQUEST
|
||||
|| info.opcode == RDMA_SEND
|
||||
|| info.opcode == RDMA_SEND_SE
|
||||
|| info.opcode == RDMA_TERMINATE) {
|
||||
proto_tree_add_item(rdma_tree, hf_iwarp_rdma_reserved,
|
||||
tvb, offset, RDMA_RESERVED_FIELD_LEN, ENC_NA);
|
||||
}
|
||||
|
||||
if (rdma_msg_opcode == RDMA_SEND_INVALIDATE
|
||||
|| rdma_msg_opcode == RDMA_SEND_SE_INVALIDATE) {
|
||||
if (info.opcode == RDMA_SEND_INVALIDATE
|
||||
|| info.opcode == RDMA_SEND_SE_INVALIDATE) {
|
||||
proto_tree_add_item(rdma_tree, hf_iwarp_rdma_inval_stag,
|
||||
tvb, offset, RDMA_INVAL_STAG_LEN, ENC_BIG_ENDIAN);
|
||||
}
|
||||
|
@ -609,12 +613,12 @@ dissect_iwarp_ddp_rdmap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
offset, DDP_TO_LEN, ENC_NA);
|
||||
offset += DDP_TO_LEN;
|
||||
|
||||
if( rdma_msg_opcode == RDMA_READ_RESPONSE
|
||||
|| rdma_msg_opcode == RDMA_WRITE) {
|
||||
if( info.opcode == RDMA_READ_RESPONSE
|
||||
|| info.opcode == RDMA_WRITE) {
|
||||
|
||||
/* display the payload */
|
||||
next_tvb = tvb_new_subset_remaining(tvb, DDP_TAGGED_HEADER_LEN);
|
||||
dissect_rdmap_payload(next_tvb, pinfo, tree);
|
||||
dissect_rdmap_payload(next_tvb, pinfo, tree, &info);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
@ -636,22 +640,22 @@ dissect_iwarp_ddp_rdmap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
offset, DDP_MO_LEN, ENC_BIG_ENDIAN);
|
||||
offset += DDP_MO_LEN;
|
||||
|
||||
if (rdma_msg_opcode == RDMA_SEND
|
||||
|| rdma_msg_opcode == RDMA_SEND_INVALIDATE
|
||||
|| rdma_msg_opcode == RDMA_SEND_SE
|
||||
|| rdma_msg_opcode == RDMA_SEND_SE_INVALIDATE) {
|
||||
if (info.opcode == RDMA_SEND
|
||||
|| info.opcode == RDMA_SEND_INVALIDATE
|
||||
|| info.opcode == RDMA_SEND_SE
|
||||
|| info.opcode == RDMA_SEND_SE_INVALIDATE) {
|
||||
|
||||
/* display the payload */
|
||||
next_tvb = tvb_new_subset_remaining(tvb, DDP_UNTAGGED_HEADER_LEN);
|
||||
dissect_rdmap_payload(next_tvb, pinfo, tree);
|
||||
dissect_rdmap_payload(next_tvb, pinfo, tree, &info);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* do further dissection for RDMA messages RDMA Read Request & Terminate */
|
||||
if (rdma_msg_opcode == RDMA_READ_REQUEST
|
||||
|| rdma_msg_opcode == RDMA_TERMINATE) {
|
||||
dissect_iwarp_rdmap(tvb, rdma_tree, offset, rdma_msg_opcode);
|
||||
if (info.opcode == RDMA_READ_REQUEST
|
||||
|| info.opcode == RDMA_TERMINATE) {
|
||||
dissect_iwarp_rdmap(tvb, rdma_tree, offset, info.opcode);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
/* packet-iwarp-ddp-rdmap.c
|
||||
* Routines for Direct Data Placement (DDP) and
|
||||
* Remote Direct Memory Access Protocol (RDMAP) dissection
|
||||
* According to IETF RFC 5041 and RFC 5040
|
||||
* Copyright 2008, Yves Geissbuehler <yves.geissbuehler@gmx.net>
|
||||
* Copyright 2008, Philip Frey <frey.philip@gmail.com>
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
* Wireshark - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@wireshark.org>
|
||||
* Copyright 1998 Gerald Combs
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
#ifndef __PACKET_IWARP_DDP_RDMAP_H_
|
||||
#define __PACKET_IWARP_DDP_RDMAP_H_
|
||||
|
||||
/* RDMA messages */
|
||||
#define RDMA_WRITE 0x00
|
||||
#define RDMA_READ_REQUEST 0x01
|
||||
#define RDMA_READ_RESPONSE 0x02
|
||||
#define RDMA_SEND 0x03
|
||||
#define RDMA_SEND_INVALIDATE 0x04
|
||||
#define RDMA_SEND_SE 0x05
|
||||
#define RDMA_SEND_SE_INVALIDATE 0x06
|
||||
#define RDMA_TERMINATE 0x07
|
||||
|
||||
struct rdmapinfo {
|
||||
guint8 opcode;
|
||||
};
|
||||
|
||||
#endif /* __PACKET_IWARP_DDP_RDMAP_H_ */
|
Loading…
Reference in New Issue