Commit bc528d0c authored by Thomas Laurent's avatar Thomas Laurent
Browse files

fix wireshark interface headers

parent 389a8e58
......@@ -59,12 +59,7 @@ typedef uint16_t guint16;
typedef uint32_t guint32;
typedef guint8 gboolean;
#include "packet-mac-lte.h"
#include "packet-rlc-lte.h"
#include "packet-pdcp-lte.h"
#include "packet-mac-nr.h"
#include "packet-rlc-nr.h"
#include "packet-pdcp-nr.h"
#include <openair2/UTIL/OPT/wireshark_headers.h>
#include "mac_pcap.h"
......
/* packet-mac-nr.h
*
* Martin Mathieson
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
/* radioType */
#define FDD_RADIO 1
#define TDD_RADIO 2
/* Direction */
#define DIRECTION_UPLINK 0
#define DIRECTION_DOWNLINK 1
/* rntiType */
#define WS_NO_RNTI 0
#define WS_P_RNTI 1
#define WS_RA_RNTI 2
#define WS_C_RNTI 3
#define WS_SI_RNTI 4
#define WS_CS_RNTI 5
/* Context info attached to each NR MAC frame */
typedef struct mac_nr_info
{
/* Needed for decode */
guint8 radioType;
guint8 direction;
guint8 rntiType;
/* Extra info to display */
guint16 rnti;
guint16 ueid;
guint8 harqid;
/* Will these be included in the ME PHR report? */
guint8 phr_type2_othercell;
/* Timing info */
gboolean sfnSlotInfoPresent;
guint16 sysframeNumber;
guint16 slotNumber;
/* Length of DL PDU or UL grant size in bytes */
guint16 length;
} mac_nr_info;
/*****************************************************************/
/* UDP framing format */
/* ----------------------- */
/* Several people have asked about dissecting MAC by framing */
/* PDUs over IP. A suggested format over UDP has been created */
/* and implemented by this dissector, using the definitions */
/* below. */
/* */
/* A heuristic dissector (enabled by a preference) will */
/* recognise a signature at the beginning of these frames. */
/*****************************************************************/
/* Signature. Rather than try to define a port for this, or make the
port number a preference, frames will start with this string (with no
terminating NULL */
#define MAC_NR_START_STRING "mac-nr"
/* Fixed fields. This is followed by the following 3 mandatory fields:
- radioType (1 byte)
- direction (1 byte)
- rntiType (1 byte)
(where the allowed values are defined above */
/* Optional fields. Attaching this info to frames will allow you
to show you display/filter/plot/add-custom-columns on these fields, so should
be added if available.
The format is to have the tag, followed by the value (there is no length field,
it's implicit from the tag) */
#define MAC_NR_RNTI_TAG 0x02
/* 2 bytes, network order */
#define MAC_NR_UEID_TAG 0x03
/* 2 bytes, network order */
#define MAC_NR_FRAME_SUBFRAME_TAG 0x04
/* 2 bytes, deprecated, do not use it */
#define MAC_NR_PHR_TYPE2_OTHERCELL_TAG 0x05
/* 1 byte, TRUE/FALSE */
#define MAC_NR_HARQID 0x06
/* 1 byte */
#define MAC_NR_FRAME_SLOT_TAG 0x07
/* 4 bytes, network order, SFN is stored in the 2 first bytes and slot number in the 2 last bytes */
/* MAC PDU. Following this tag comes the actual MAC PDU (there is no length, the PDU
continues until the end of the frame) */
#define MAC_NR_PAYLOAD_TAG 0x01
/* Type to store parameters for configuring LCID->RLC channel settings for DRB */
/* Some are optional, and may not be seen (e.g. on reestablishment) */
typedef struct nr_drb_mac_rlc_mapping_t
{
gboolean active;
guint16 ueid; /* Mandatory */
guint8 drbid; /* Mandatory */
gboolean lcid_present;
guint8 lcid; /* Part of LogicalChannelConfig - optional */
gboolean rlcMode_present;
guint8 rlcMode; /* Part of RLC config - optional */
guint8 tempDirection; /* So know direction of next SN length... */
gboolean rlcUlSnLength_present;
guint8 rlcUlSnLength; /* Part of RLC config - optional */
gboolean rlcDlSnLength_present;
guint8 rlcDlSnLength; /* Part of RLC config - optional */
} nr_drb_mac_rlc_mapping_t;
/*
* Editor modelines - https://www.wireshark.org/tools/modelines.html
*
* Local variables:
* c-basic-offset: 4
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* vi: set shiftwidth=4 tabstop=8 expandtab:
* :indentSize=4:tabSize=8:noTabs=true:
*/
/* packet-pdcp-lte.h
*
* Martin Mathieson
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
/* Direction */
#define DIRECTION_UPLINK 0
#define DIRECTION_DOWNLINK 1
enum pdcp_plane
{
SIGNALING_PLANE = 1,
USER_PLANE = 2
};
typedef enum LogicalChannelType
{
Channel_DCCH=1,
Channel_BCCH=2,
Channel_CCCH=3,
Channel_PCCH=4,
Channel_DCCH_NB=5,
Channel_BCCH_NB=6,
Channel_CCCH_NB=7,
Channel_PCCH_NB=8
} LogicalChannelType;
typedef enum
{
BCH_TRANSPORT=1,
DLSCH_TRANSPORT=2
} BCCHTransportType;
#define PDCP_SN_LENGTH_5_BITS 5
#define PDCP_SN_LENGTH_7_BITS 7
#define PDCP_SN_LENGTH_12_BITS 12
#define PDCP_SN_LENGTH_15_BITS 15
#define PDCP_SN_LENGTH_18_BITS 18
enum lte_security_integrity_algorithm_e { eia0, eia1, eia2, eia3 };
enum lte_security_ciphering_algorithm_e { eea0, eea1, eea2, eea3 };
typedef struct pdcp_lte_security_info_t
{
guint32 configuration_frame;
gboolean seen_next_ul_pdu; /* i.e. have we seen SecurityModeResponse */
enum lte_security_integrity_algorithm_e integrity;
enum lte_security_ciphering_algorithm_e ciphering;
/* Store previous settings so can revert if get SecurityModeFailure */
guint32 previous_configuration_frame;
enum lte_security_integrity_algorithm_e previous_integrity;
enum lte_security_ciphering_algorithm_e previous_ciphering;
} pdcp_lte_security_info_t;
/***********************************************************************/
/* UDP framing format */
/* ----------------------- */
/* Several people have asked about dissecting PDCP by framing */
/* PDUs over IP. A suggested format over UDP has been defined */
/* and implemented by this dissector, using the definitions */
/* below. A link to an example program showing you how to encode */
/* these headers and send LTE PDCP PDUs on a UDP socket is */
/* provided at https://gitlab.com/wireshark/wireshark/-/wikis/PDCP-LTE */
/* */
/* A heuristic dissecter (enabled by a preference) will */
/* recognise a signature at the beginning of these frames. */
/* Until someone is using this format, suggestions for changes */
/* are welcome. */
/***********************************************************************/
/* Signature. Rather than try to define a port for this, or make the
port number a preference, frames will start with this string (with no
terminating NULL */
#define PDCP_LTE_START_STRING "pdcp-lte"
/* Fixed fields. This is followed by the following 3 mandatory fields:
- no_header_pdu (1 byte)
- plane (1 byte)
- rohc_compression ( byte)
(where the allowed values are defined above) */
/* Conditional field. This field is mandatory in case of User Plane PDCP PDU.
The format is to have the tag, followed by the value (there is no length field,
it's implicit from the tag). The allowed values are defined above. */
#define PDCP_LTE_SEQNUM_LENGTH_TAG 0x02
/* 1 byte */
/* Optional fields. Attaching this info to frames will allow you
to show you display/filter/plot/add-custom-columns on these fields, so should
be added if available.
The format is to have the tag, followed by the value (there is no length field,
it's implicit from the tag) */
#define PDCP_LTE_DIRECTION_TAG 0x03
/* 1 byte */
#define PDCP_LTE_LOG_CHAN_TYPE_TAG 0x04
/* 1 byte */
#define PDCP_LTE_BCCH_TRANSPORT_TYPE_TAG 0x05
/* 1 byte */
#define PDCP_LTE_ROHC_IP_VERSION_TAG 0x06
/* 2 bytes, network order */
#define PDCP_LTE_ROHC_CID_INC_INFO_TAG 0x07
/* 1 byte */
#define PDCP_LTE_ROHC_LARGE_CID_PRES_TAG 0x08
/* 1 byte */
#define PDCP_LTE_ROHC_MODE_TAG 0x09
/* 1 byte */
#define PDCP_LTE_ROHC_RND_TAG 0x0A
/* 1 byte */
#define PDCP_LTE_ROHC_UDP_CHECKSUM_PRES_TAG 0x0B
/* 1 byte */
#define PDCP_LTE_ROHC_PROFILE_TAG 0x0C
/* 2 bytes, network order */
#define PDCP_LTE_CHANNEL_ID_TAG 0x0D
/* 2 bytes, network order */
#define PDCP_LTE_UEID_TAG 0x0E
/* 2 bytes, network order */
/* PDCP PDU. Following this tag comes the actual PDCP PDU (there is no length, the PDU
continues until the end of the frame) */
#define PDCP_LTE_PAYLOAD_TAG 0x01
/* Called by RRC, or other configuration protocols */
/* Function to configure ciphering & integrity algorithms */
void set_pdcp_lte_security_algorithms(guint16 ueid, pdcp_lte_security_info_t *security_info);
/* Function to indicate securityModeCommand did not complete */
void set_pdcp_lte_security_algorithms_failed(guint16 ueid);
/* Called by external dissectors */
void set_pdcp_lte_rrc_ciphering_key(guint16 ueid, const char *key);
void set_pdcp_lte_rrc_integrity_key(guint16 ueid, const char *key);
void set_pdcp_lte_up_ciphering_key(guint16 ueid, const char *key);
/*
* Editor modelines - https://www.wireshark.org/tools/modelines.html
*
* Local variables:
* c-basic-offset: 4
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* vi: set shiftwidth=4 tabstop=8 expandtab:
* :indentSize=4:tabSize=8:noTabs=true:
*/
/* packet-pdcp-nr.h
*
* Martin Mathieson
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
/* Direction */
#define PDCP_NR_DIRECTION_UPLINK 0
#define PDCP_NR_DIRECTION_DOWNLINK 1
enum pdcp_nr_plane
{
NR_SIGNALING_PLANE = 1,
NR_USER_PLANE = 2
};
typedef enum NRBearerType
{
Bearer_DCCH=1,
Bearer_BCCH_BCH=2,
Bearer_BCCH_DL_SCH=3,
Bearer_CCCH=4,
Bearer_PCCH=5,
} NRBearerType;
#define PDCP_NR_SN_LENGTH_12_BITS 12
#define PDCP_NR_SN_LENGTH_18_BITS 18
#define PDCP_NR_UL_SDAP_HEADER_PRESENT 0x01
#define PDCP_NR_DL_SDAP_HEADER_PRESENT 0x02
enum nr_security_integrity_algorithm_e { nia0, nia1, nia2, nia3 };
enum nr_security_ciphering_algorithm_e { nea0, nea1, nea2, nea3, nea_disabled=999};
typedef struct pdcp_nr_security_info_t
{
guint32 configuration_frame;
gboolean seen_next_ul_pdu; /* i.e. have we seen SecurityModeResponse */
enum nr_security_integrity_algorithm_e integrity;
enum nr_security_ciphering_algorithm_e ciphering;
/* Store previous settings so can revert if get SecurityModeFailure */
guint32 previous_configuration_frame;
enum nr_security_integrity_algorithm_e previous_integrity;
enum nr_security_ciphering_algorithm_e previous_ciphering;
} pdcp_nr_security_info_t;
/*****************************************************************/
/* UDP framing format */
/* ----------------------- */
/* Several people have asked about dissecting PDCP by framing */
/* PDUs over IP. A suggested format over UDP has been defined */
/* and implemented by this dissector, using the definitions */
/* below. */
/* */
/* A heuristic dissector (enabled by a preference) will */
/* recognise a signature at the beginning of these frames. */
/* Until someone is using this format, suggestions for changes */
/* are welcome. */
/*****************************************************************/
/* Signature. Rather than try to define a port for this, or make the
port number a preference, frames will start with this string (with no
terminating NULL */
#define PDCP_NR_START_STRING "pdcp-nr"
/* Fixed fields:
- plane (1 byte) */
/* Conditional field. This field is mandatory in case of User Plane PDCP PDU.
The format is to have the tag, followed by the value (there is no length field,
it's implicit from the tag). The allowed values are defined above. */
#define PDCP_NR_SEQNUM_LENGTH_TAG 0x02
/* 1 byte */
/* Optional fields. Attaching this info should be added if available.
The format is to have the tag, followed by the value (there is no length field,
it's implicit from the tag) */
#define PDCP_NR_DIRECTION_TAG 0x03
/* 1 byte */
#define PDCP_NR_BEARER_TYPE_TAG 0x04
/* 1 byte */
#define PDCP_NR_BEARER_ID_TAG 0x05
/* 1 byte */
#define PDCP_NR_UEID_TAG 0x06
/* 2 bytes, network order */
#define PDCP_NR_ROHC_COMPRESSION_TAG 0x07
/* 0 byte */
/* N.B. The following ROHC values only have significance if rohc_compression
is in use for the current channel */
#define PDCP_NR_ROHC_IP_VERSION_TAG 0x08
/* 1 byte */
#define PDCP_NR_ROHC_CID_INC_INFO_TAG 0x09
/* 0 byte */
#define PDCP_NR_ROHC_LARGE_CID_PRES_TAG 0x0A
/* 0 byte */
#define PDCP_NR_ROHC_MODE_TAG 0x0B
/* 1 byte */
#define PDCP_NR_ROHC_RND_TAG 0x0C
/* 0 byte */
#define PDCP_NR_ROHC_UDP_CHECKSUM_PRES_TAG 0x0D
/* 0 byte */
#define PDCP_NR_ROHC_PROFILE_TAG 0x0E
/* 2 bytes, network order */
#define PDCP_NR_MACI_PRES_TAG 0x0F
/* 0 byte */
#define PDCP_NR_SDAP_HEADER_TAG 0x10
/* 1 byte, bitmask with PDCP_NR_UL_SDAP_HEADER_PRESENT and/or PDCP_NR_DL_SDAP_HEADER_PRESENT */
#define PDCP_NR_CIPHER_DISABLED_TAG 0x11
/* 0 byte */
/* PDCP PDU. Following this tag comes the actual PDCP PDU (there is no length, the PDU
continues until the end of the frame) */
#define PDCP_NR_PAYLOAD_TAG 0x01
/* Called by RRC, or other configuration protocols */
/* Function to configure ciphering & integrity algorithms */
void set_pdcp_nr_security_algorithms(guint16 ueid, pdcp_nr_security_info_t *security_info);
/* Function to indicate securityModeCommand did not complete */
void set_pdcp_nr_security_algorithms_failed(guint16 ueid);
/* Called by external dissectors */
void set_pdcp_nr_rrc_ciphering_key(guint16 ueid, const char *key);
void set_pdcp_nr_rrc_integrity_key(guint16 ueid, const char *key);
void set_pdcp_nr_up_ciphering_key(guint16 ueid, const char *key);
void set_pdcp_nr_up_integrity_key(guint16 ueid, const char *key);
/*
* Editor modelines - https://www.wireshark.org/tools/modelines.html
*
* Local variables:
* c-basic-offset: 4
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* vi: set shiftwidth=4 tabstop=8 expandtab:
* :indentSize=4:tabSize=8:noTabs=true:
*/
/* packet-rlc-lte.h
*
* Martin Mathieson
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#ifndef PACKET_RLC_LTE_H
#define PACKET_RLC_LTE_H
/* rlcMode */
#define RLC_TM_MODE 1
#define RLC_UM_MODE 2
#define RLC_AM_MODE 4
#define RLC_PREDEF 8
/* direction */
#define DIRECTION_UPLINK 0
#define DIRECTION_DOWNLINK 1
/* priority ? */
/* channelType */
#define CHANNEL_TYPE_CCCH 1
#define CHANNEL_TYPE_BCCH_BCH 2
#define CHANNEL_TYPE_PCCH 3
#define CHANNEL_TYPE_SRB 4
#define CHANNEL_TYPE_DRB 5
#define CHANNEL_TYPE_BCCH_DL_SCH 6
#define CHANNEL_TYPE_MCCH 7
#define CHANNEL_TYPE_MTCH 8
/* sequenceNumberLength */
#define UM_SN_LENGTH_5_BITS 5
#define UM_SN_LENGTH_10_BITS 10
#define AM_SN_LENGTH_10_BITS 10
#define AM_SN_LENGTH_16_BITS 16
typedef enum rlc_lte_nb_mode {
rlc_no_nb_mode = 0,
rlc_nb_mode = 1
} rlc_lte_nb_mode;
/* Info attached to each LTE RLC frame */
typedef struct rlc_lte_info
{
guint8 rlcMode;
guint8 direction;
guint8 priority;
guint8 sequenceNumberLength;
guint16 ueid;
guint16 channelType;
guint16 channelId; /* for SRB: 1=SRB1, 2=SRB2, 3=SRB1bis; for DRB: DRB ID */
guint16 pduLength;
gboolean extendedLiField;
rlc_lte_nb_mode nbMode;
} rlc_lte_info;
typedef struct rlc_lte_tap_info {
/* Info from context */
guint8 rlcMode;
guint8 direction;
guint8 priority;
guint16 ueid;
guint16 channelType;
guint16 channelId;
guint16 pduLength;
guint8 sequenceNumberLength;
nstime_t rlc_lte_time;
guint8 loggedInMACFrame;
guint16 sequenceNumber;
guint8 isResegmented;
guint8 isControlPDU;
guint16 ACKNo;
#define MAX_NACKs 128
guint16 noOfNACKs;
guint16 NACKs[MAX_NACKs];
guint16 missingSNs;
} rlc_lte_tap_info;
/* Signature. Rather than try to define a port for this, or make the
port number a preference, frames will start with this string (with no
terminating NULL */
#define RLC_LTE_START_STRING "rlc-lte"
/* Fixed field. This is followed by the following 1 mandatory field:
- rlcMode (1 byte)
(where the allowed values are defined above */
/* Conditional field. This field is mandatory in case of RLC Unacknowledged mode.
In case of RLC Acknowledged mode, the field is optional (assume 10 bits by default).
The format is to have the tag, followed by the value (there is no length field,
it's implicit from the tag). The allowed values are defined above. */
#define RLC_LTE_SN_LENGTH_TAG 0x02
/* 1 byte */
/* Optional fields. Attaching this info to frames will allow you
to show you display/filter/plot/add-custom-columns on these fields, so should
be added if available.
The format is to have the tag, followed by the value (there is no length field,
it's implicit from the tag) */
#define RLC_LTE_DIRECTION_TAG 0x03
/* 1 byte */
#define RLC_LTE_PRIORITY_TAG 0x04
/* 1 byte */
#define RLC_LTE_UEID_TAG 0x05
/* 2 bytes, network order */
#define RLC_LTE_CHANNEL_TYPE_TAG 0x06
/* 2 bytes, network order */
#define RLC_LTE_CHANNEL_ID_TAG 0x07
/* 2 bytes, network order */
#define RLC_LTE_EXT_LI_FIELD_TAG 0x08
/* 0 byte, tag presence indicates that AM DRB PDU is using an extended LI field of 15 bits */
#define RLC_LTE_NB_MODE_TAG 0x09
/* 1 byte containing rlc_lte_nb_mode enum value */
/* RLC PDU. Following this tag comes the actual RLC PDU (there is no length, the PDU
continues until the end of the frame) */
#define RLC_LTE_PAYLOAD_TAG 0x01