MCTP: Add header for MCTP packet types

We have a few hard-coded MCTP type definitions in use (for MCTP control
protocol, and NVMe-MI) already, and we're about to add a couple more.

This change adds a header for packet-mctp, just with the type
definitions, and uses it for the current types.

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
This commit is contained in:
Jeremy Kerr 2022-11-21 21:04:28 +08:00 committed by AndersBroman
parent 7b53d22b27
commit 728e89b955
3 changed files with 28 additions and 2 deletions

View File

@ -23,6 +23,7 @@
#include <epan/packet.h>
#include <epan/to_str.h>
#include <epan/dissectors/packet-mctp.h>
#include <epan/dissectors/packet-sll.h>
#define MCTP_CTRL_MIN_LENGTH 3
@ -187,7 +188,7 @@ proto_reg_handoff_mctp_control(void)
{
dissector_handle_t mctp_ctrl_handle;
mctp_ctrl_handle = create_dissector_handle(dissect_mctp_ctrl, proto_mctp_ctrl);
dissector_add_uint("mctp.type", 0, mctp_ctrl_handle);
dissector_add_uint("mctp.type", MCTP_TYPE_CONTROL, mctp_ctrl_handle);
}
/*

View File

@ -0,0 +1,24 @@
/* packet-mctp.c
* Definitions for Management Component Transport Protocol (MCTP) packet
* disassembly
* Copyright 2022, Jeremy Kerr <jk@codeconstruct.com.au>
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#ifndef __PACKET_MCTP_H__
#define __PACKET_MCTP_H__
/* MCTP type values */
#define MCTP_TYPE_CONTROL 0
#define MCTP_TYPE_PLDM 1
#define MCTP_TYPE_NCSI 2
#define MCTP_TYPE_ETHERNET 3
#define MCTP_TYPE_NVME 4
#endif /* __PACKET_MCTP_H__ */

View File

@ -20,6 +20,7 @@
#include <epan/packet.h>
#include <epan/to_str.h>
#include <epan/dissectors/packet-sll.h>
#include <epan/dissectors/packet-mctp.h>
#include <epan/dissectors/packet-nvme.h>
void proto_register_nvme_mi(void);
@ -630,7 +631,7 @@ proto_reg_handoff_nvme_mi(void)
{
dissector_handle_t nvme_mi_handle;
nvme_mi_handle = create_dissector_handle(dissect_nvme_mi, proto_nvme_mi);
dissector_add_uint("mctp.type", 4, nvme_mi_handle);
dissector_add_uint("mctp.type", MCTP_TYPE_NVME, nvme_mi_handle);
}
/*