Merge remote-tracking branch 'origin/NR_SA_F1AP_5GRECORDS' into develop-NR_SA_F1AP_5GRECORDS-lts2
# Conflicts: # cmake_targets/CMakeLists.txt # cmake_targets/build_oai # cmake_targets/tools/build_helper # executables/nr-gnb.c # openair1/PHY/INIT/nr_init_ru.c # openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c # openair1/PHY/NR_TRANSPORT/nr_ulsch.c # openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c # openair1/PHY/NR_UE_TRANSPORT/nr_prach.c # openair1/SCHED_NR/phy_procedures_nr_gNB.c # openair1/SCHED_NR_UE/pucch_uci_ue_nr.c # openair2/F1AP/f1ap_du_rrc_message_transfer.c # openair2/F1AP/f1ap_du_rrc_message_transfer.h # openair2/F1AP/f1ap_du_task.c # openair2/GNB_APP/gnb_app.c # openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c # openair2/LAYER2/NR_MAC_gNB/config.c # openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c # openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c # openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c # openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c # openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c # openair2/LAYER2/nr_pdcp/nr_pdcp_entity.c # openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c # openair2/RRC/LTE/rrc_eNB_GTPV1U.c # openair2/RRC/NR/L2_nr_interface.c # openair2/RRC/NR/MESSAGES/asn1_msg.c # openair2/RRC/NR/rrc_gNB.c # openair2/RRC/NR/rrc_gNB_NGAP.c # openair2/RRC/NR_UE/rrc_UE.c # openair3/NAS/NR_UE/nr_nas_msg_sim.c # openair3/ocp-gtpu/gtp_itf.cpp # targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp
This commit is contained in:
@@ -1,13 +1,14 @@
|
||||
|
||||
How to configure wireshark for dissecting LTE protocols:
|
||||
How to configure wireshark for dissecting LTE/NR protocols:
|
||||
- start the wireshark as a sudoers
|
||||
- goto analyze->enabled prototols
|
||||
=> enable mac_lte_udp and rlc_lte_udp
|
||||
=> enable mac_xxx_udp and rlc_xxx_udp (xxx is lte or nr)
|
||||
- goto edit/preferences and expand Protocols
|
||||
- select UDP and check "try heuristic sub-dissectors first"
|
||||
- select MAC-LTE, and check all the options (checkboxes), and set the "which layer info to show in info column" to "MAC info"
|
||||
- select RLC-LTE, and check all the options except the "May see RLC headers only", and
|
||||
- select MAC-LTE (or MAC-NR), and check all the options (checkboxes), and set the "which layer info to show in info column" to "MAC info"
|
||||
- select RLC-LTE (or NR), and check all the options except the "May see RLC headers only", and
|
||||
set the "call PDCP dissector for DRB PDUs" to "12-bit SN". Optionally you may select the sequence analysis for RLC AM/UM.
|
||||
- select PDCP-LTE (or NR)
|
||||
|
||||
How to use
|
||||
- start eNB or UE with option --opt.type wireshark
|
||||
|
||||
@@ -60,6 +60,12 @@ 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 "mac_pcap.h"
|
||||
|
||||
/* OPT parameters definitions */
|
||||
@@ -107,9 +113,10 @@ typedef enum radio_type_e {
|
||||
*/
|
||||
|
||||
extern int opt_enabled;
|
||||
#define trace_pdu(x...) if (opt_enabled) trace_pdu_implementation(x)
|
||||
#define trace_pdu(x...) if (opt_enabled) trace_pdu_implementation(0, x)
|
||||
#define trace_NRpdu(x...) if (opt_enabled) trace_pdu_implementation(1, x)
|
||||
|
||||
void trace_pdu_implementation(int direction, uint8_t *pdu_buffer, unsigned int pdu_buffer_size,
|
||||
void trace_pdu_implementation(int nr, int direction, uint8_t *pdu_buffer, unsigned int pdu_buffer_size,
|
||||
int ueid, int rntiType, int rnti, uint16_t sysFrame, uint8_t subframe,
|
||||
int oob_event, int oob_event_value);
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
this is wireshark, commit: commit eda834b6e29c36e05a63a6056afa98390ff79357
|
||||
Date: Wed Aug 22 14:36:20 2018 +0200
|
||||
@@ -114,6 +114,7 @@ typedef struct mac_lte_info
|
||||
/* Timing info */
|
||||
guint16 sysframeNumber;
|
||||
guint16 subframeNumber;
|
||||
gboolean sfnSfInfoPresent;
|
||||
|
||||
/* Optional field. More interesting for TDD (FDD is always -4 subframeNumber) */
|
||||
gboolean subframeNumberOfGrantPresent;
|
||||
@@ -197,49 +198,27 @@ typedef struct mac_lte_info
|
||||
guint16 oob_rnti[MAX_SRs];
|
||||
} mac_lte_info;
|
||||
|
||||
|
||||
typedef struct mac_lte_tap_info {
|
||||
/* Info from context */
|
||||
guint16 rnti;
|
||||
guint16 ueid;
|
||||
guint8 rntiType;
|
||||
guint8 isPredefinedData;
|
||||
gboolean crcStatusValid;
|
||||
mac_lte_crc_status crcStatus;
|
||||
guint8 direction;
|
||||
|
||||
guint8 isPHYRetx;
|
||||
guint16 ueInTTI;
|
||||
|
||||
nstime_t mac_lte_time;
|
||||
|
||||
/* Number of bytes (which part is used depends upon context settings) */
|
||||
guint32 single_number_of_bytes;
|
||||
guint32 bytes_for_lcid[11];
|
||||
guint32 sdus_for_lcid[11];
|
||||
guint8 number_of_rars;
|
||||
guint8 number_of_paging_ids;
|
||||
|
||||
/* Number of padding bytes includes padding subheaders and trailing padding */
|
||||
guint16 padding_bytes;
|
||||
guint16 raw_length;
|
||||
} mac_lte_tap_info;
|
||||
/* 0 to 10 and 32 to 38 */
|
||||
#define MAC_LTE_DATA_LCID_COUNT_MAX 18
|
||||
|
||||
|
||||
|
||||
/*****************************************************************/
|
||||
/* 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 link to an example program showing you how to encode */
|
||||
/* these headers and send LTE MAC PDUs on a UDP socket is */
|
||||
/* provided at https://wiki.wireshark.org/MAC-LTE */
|
||||
/* */
|
||||
/* A heuristic dissector (enabled by a preference) will */
|
||||
/* recognise a signature at the beginning of these frames. */
|
||||
/*****************************************************************/
|
||||
|
||||
/* Accessor function to check if a frame was considered to be ReTx */
|
||||
|
||||
/**********************************************************************/
|
||||
/* 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 link to an example program showing you how to encode */
|
||||
/* these headers and send LTE MAC PDUs on a UDP socket is */
|
||||
/* provided at https://gitlab.com/wireshark/wireshark/-/wikis/MAC-LTE */
|
||||
/* */
|
||||
/* 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
|
||||
@@ -317,66 +296,4 @@ typedef struct mac_lte_tap_info {
|
||||
continues until the end of the frame) */
|
||||
#define MAC_LTE_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 drb_mapping_t
|
||||
{
|
||||
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 */
|
||||
gboolean rlc_ul_ext_li_field; /* Part of RLC config - optional */
|
||||
gboolean rlc_dl_ext_li_field; /* Part of RLC config - optional */
|
||||
gboolean rlc_ul_ext_am_sn; /* Part of RLC config - optional */
|
||||
gboolean rlc_dl_ext_am_sn; /* Part of RLC config - optional */
|
||||
gboolean um_sn_length_present;
|
||||
guint8 um_sn_length; /* Part of RLC config - optional */
|
||||
gboolean ul_priority_present;
|
||||
guint8 ul_priority; /* Part of LogicalChannelConfig - optional */
|
||||
gboolean pdcp_sn_size_present;
|
||||
guint8 pdcp_sn_size; /* Part of pdcp-Config - optional */
|
||||
} drb_mapping_t;
|
||||
|
||||
|
||||
|
||||
/* Dedicated DRX config. Used to verify that a sensible config is given.
|
||||
Also, beginning to configure MAC with this config and (optionally) show
|
||||
DRX config and state (cycles/timers) attached to each UL/DL PDU! */
|
||||
typedef struct drx_config_t {
|
||||
gboolean configured;
|
||||
guint32 frameNum;
|
||||
guint32 previousFrameNum;
|
||||
|
||||
guint32 onDurationTimer;
|
||||
guint32 inactivityTimer;
|
||||
guint32 retransmissionTimer;
|
||||
guint32 longCycle;
|
||||
guint32 cycleOffset;
|
||||
/* Optional Short cycle */
|
||||
gboolean shortCycleConfigured;
|
||||
guint32 shortCycle;
|
||||
guint32 shortCycleTimer;
|
||||
} drx_config_t;
|
||||
|
||||
/* RRC can indicate whether simultaneous PUCCH/PUSCH is used */
|
||||
typedef enum {
|
||||
SIMULT_PUCCH_PUSCH_PCELL = 0,
|
||||
SIMULT_PUCCH_PUSCH_PSCELL
|
||||
} simult_pucch_pusch_cell_type;
|
||||
/*
|
||||
* Editor modelines - http://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:
|
||||
*/
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,142 @@
|
||||
/* 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:
|
||||
*/
|
||||
@@ -0,0 +1,172 @@
|
||||
/* 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:
|
||||
*/
|
||||
@@ -0,0 +1,168 @@
|
||||
/* 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:
|
||||
*/
|
||||
@@ -0,0 +1,151 @@
|
||||
/* 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
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* 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:
|
||||
*/
|
||||
@@ -0,0 +1,136 @@
|
||||
/* packet-rlc-nr.h
|
||||
*
|
||||
* Pascal Quantin
|
||||
* 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_NR_H
|
||||
#define PACKET_RLC_NR_H
|
||||
|
||||
/* rlcMode */
|
||||
#define RLC_TM_MODE 1
|
||||
#define RLC_UM_MODE 2
|
||||
#define RLC_AM_MODE 4
|
||||
|
||||
/* direction */
|
||||
#define DIRECTION_UPLINK 0
|
||||
#define DIRECTION_DOWNLINK 1
|
||||
|
||||
/* bearerType */
|
||||
#define BEARER_TYPE_CCCH 1
|
||||
#define BEARER_TYPE_BCCH_BCH 2
|
||||
#define BEARER_TYPE_PCCH 3
|
||||
#define BEARER_TYPE_SRB 4
|
||||
#define BEARER_TYPE_DRB 5
|
||||
#define BEARER_TYPE_BCCH_DL_SCH 6
|
||||
|
||||
/* sequenceNumberLength */
|
||||
#define TM_SN_LENGTH_0_BITS 0
|
||||
#define UM_SN_LENGTH_6_BITS 6
|
||||
#define UM_SN_LENGTH_12_BITS 12
|
||||
#define AM_SN_LENGTH_12_BITS 12
|
||||
#define AM_SN_LENGTH_18_BITS 18
|
||||
|
||||
/* Info attached to each NR RLC frame */
|
||||
typedef struct rlc_nr_info
|
||||
{
|
||||
guint8 rlcMode;
|
||||
guint8 direction;
|
||||
guint8 sequenceNumberLength;
|
||||
guint8 bearerType;
|
||||
guint8 bearerId;
|
||||
guint16 ueid;
|
||||
guint16 pduLength;
|
||||
} rlc_nr_info;
|
||||
|
||||
typedef struct nr_drb_rlc_pdcp_mapping_t
|
||||
{
|
||||
gboolean active;
|
||||
guint16 ueid; /* Mandatory */
|
||||
guint8 drbid; /* Mandatory */
|
||||
|
||||
gboolean pdcpUlSnLength_present;
|
||||
guint8 pdcpUlSnLength; /* Part of PDCP config - optional */
|
||||
gboolean pdcpDlSnLength_present;
|
||||
guint8 pdcpDlSnLength; /* Part of PDCP config - optional */
|
||||
gboolean pdcpUlSdap;
|
||||
gboolean pdcpDlSdap;
|
||||
gboolean pdcpIntegrityProtection;
|
||||
gboolean pdcpCipheringDisabled;
|
||||
|
||||
} nr_drb_rlc_pdcp_mapping_t;
|
||||
|
||||
/* TODO: could probably merge this struct with above */
|
||||
typedef struct pdcp_ue_parameters {
|
||||
guint32 id;
|
||||
guint8 pdcp_sn_bits_ul;
|
||||
guint8 pdcp_sn_bits_dl;
|
||||
gboolean pdcp_sdap_ul;
|
||||
gboolean pdcp_sdap_dl;
|
||||
gboolean pdcp_integrity;
|
||||
gboolean pdcp_ciphering_disabled;
|
||||
} pdcp_bearer_parameters;
|
||||
|
||||
/*****************************************************************/
|
||||
/* UDP framing format */
|
||||
/* ----------------------- */
|
||||
/* Several people have asked about dissecting RLC 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. */
|
||||
/*****************************************************************/
|
||||
|
||||
|
||||
/* 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_NR_START_STRING "rlc-nr"
|
||||
|
||||
/* Fixed field. This is followed by the following 2 mandatory field:
|
||||
- rlcMode (1 byte)
|
||||
- sequenceNumberLength (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 RLC_NR_DIRECTION_TAG 0x02
|
||||
/* 1 byte */
|
||||
|
||||
#define RLC_NR_UEID_TAG 0x03
|
||||
/* 2 bytes, network order */
|
||||
|
||||
#define RLC_NR_BEARER_TYPE_TAG 0x04
|
||||
/* 1 byte */
|
||||
|
||||
#define RLC_NR_BEARER_ID_TAG 0x05
|
||||
/* 1 byte */
|
||||
|
||||
/* 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_NR_PAYLOAD_TAG 0x01
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* 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:
|
||||
*/
|
||||
@@ -0,0 +1,72 @@
|
||||
/* packet-rohc.h
|
||||
* Routines for RObust Header Compression (ROHC) dissection.
|
||||
*
|
||||
* Copyright 2011, Anders Broman <anders.broman[at]ericsson.com>
|
||||
*
|
||||
* Wireshark - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@wireshark.org>
|
||||
* Copyright 1998 Gerald Combs
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*
|
||||
* Ref:
|
||||
* http://www.ietf.org/rfc/rfc3095.txt RObust Header Compression (ROHC): Framework and four profiles: RTP, UDP, ESP, and uncompressed
|
||||
* http://datatracker.ietf.org/doc/rfc4815/ RObust Header Compression (ROHC): Corrections and Clarifications to RFC 3095
|
||||
* http://datatracker.ietf.org/doc/rfc5225/ RObust Header Compression Version 2 (ROHCv2): Profiles for RTP, UDP, IP, ESP and UDP-Lite
|
||||
*/
|
||||
|
||||
#ifndef PACKET_ROHC_H
|
||||
#define PACKET_ROHC_H
|
||||
|
||||
#define MAX_CID 15
|
||||
|
||||
/* ROHC Profiles */
|
||||
#define ROHC_PROFILE_UNCOMPRESSED 0
|
||||
#define ROHC_PROFILE_RTP 1
|
||||
#define ROHC_PROFILE_UDP 2
|
||||
#define ROHC_PROFILE_IP 4
|
||||
#define ROHC_PROFILE_UNKNOWN 0xFFFF
|
||||
|
||||
enum rohc_mode
|
||||
{
|
||||
MODE_NOT_SET = 0,
|
||||
UNIDIRECTIONAL = 1,
|
||||
OPTIMISTIC_BIDIRECTIONAL = 2,
|
||||
RELIABLE_BIDIRECTIONAL = 3
|
||||
};
|
||||
|
||||
enum rohc_d_mode
|
||||
{
|
||||
NO_CONTEXT = 1,
|
||||
STATIC_CONTEXT = 2,
|
||||
FULL_CONTEXT = 3
|
||||
};
|
||||
typedef struct rohc_info
|
||||
{
|
||||
gboolean rohc_compression;
|
||||
guint8 rohc_ip_version;
|
||||
gboolean cid_inclusion_info;
|
||||
gboolean large_cid_present;
|
||||
enum rohc_mode mode;
|
||||
gboolean rnd;
|
||||
gboolean udp_checksum_present;
|
||||
guint16 profile;
|
||||
proto_item *last_created_item;
|
||||
} rohc_info;
|
||||
|
||||
|
||||
typedef struct rohc_context
|
||||
{
|
||||
guint8 rohc_ip_version[MAX_CID+1];
|
||||
gboolean large_cid_present[MAX_CID+1];
|
||||
enum rohc_mode mode[MAX_CID+1];
|
||||
enum rohc_d_mode d_mode[MAX_CID+1];
|
||||
gboolean rnd[MAX_CID+1];
|
||||
gboolean udp_checkum_present[MAX_CID+1];
|
||||
guint16 profile[MAX_CID+1];
|
||||
gboolean rohc_context_init[MAX_CID+1];
|
||||
gint ir_frame_number[MAX_CID+1]; /* The frame number of the last IR packet seen */
|
||||
|
||||
} rohc_context;
|
||||
|
||||
#endif /* PACKET_ROHC_H */
|
||||
+94
-20
@@ -128,12 +128,6 @@ typedef struct {
|
||||
|
||||
opt_listener_t opt_listener;
|
||||
|
||||
static void SendFrame(guint8 radioType, guint8 direction, guint8 rntiType,
|
||||
guint16 rnti, guint16 ueid, guint16 sysframeNumber,
|
||||
guint8 isPredefinedData, guint8 retx, guint8 crcStatus,
|
||||
guint8 oob_event, guint8 oob_event_value,
|
||||
uint8_t *pdu_buffer, unsigned int pdu_buffer_size);
|
||||
|
||||
unsigned short checksum(unsigned short *ptr, int length) {
|
||||
int sum = 0;
|
||||
u_short answer = 0;
|
||||
@@ -152,7 +146,7 @@ unsigned short checksum(unsigned short *ptr, int length) {
|
||||
}
|
||||
|
||||
/* Write an individual PDU (PCAP packet header + mac-context + mac-pdu) */
|
||||
static int MAC_LTE_PCAP_WritePDU(const uint8_t *PDU,
|
||||
static int PCAP_WritePDU(const uint8_t *PDU,
|
||||
unsigned int length) {
|
||||
pcaprec_hdr_t packet_header;
|
||||
// IPv4 header
|
||||
@@ -288,7 +282,7 @@ int opt_create_listener_socket(char *ip_address, uint16_t port) {
|
||||
*/
|
||||
/* Add framing header to MAC PDU and send. */
|
||||
static void SendFrame(guint8 radioType, guint8 direction, guint8 rntiType,
|
||||
guint16 rnti, guint16 ueid, guint16 sfnSf,
|
||||
guint16 rnti, guint16 ueid, guint16 frame, guint16 subframe,
|
||||
guint8 isPredefinedData, guint8 retx, guint8 crcStatus,
|
||||
guint8 oob_event, guint8 oob_event_value,
|
||||
uint8_t *pdu_buffer, unsigned int pdu_buffer_size) {
|
||||
@@ -317,9 +311,9 @@ static void SendFrame(guint8 radioType, guint8 direction, guint8 rntiType,
|
||||
tmp16 = htons(ueid);
|
||||
memcpy(frameBuffer+frameOffset, &tmp16, 2);
|
||||
frameOffset += 2;
|
||||
/* Subframe number */
|
||||
/* Subframe number */
|
||||
frameBuffer[frameOffset++] = MAC_LTE_FRAME_SUBFRAME_TAG;
|
||||
tmp16 = htons(sfnSf); // frame counter : this will give an expert info as wireshark expects SF and not F
|
||||
tmp16 = htons((frame<<4)+subframe); // frame counter : this will give an expert info as wireshark expects SF and not F
|
||||
memcpy(frameBuffer+frameOffset, &tmp16, 2);
|
||||
frameOffset += 2;
|
||||
frameBuffer[frameOffset++] = MAC_LTE_CRC_STATUS_TAG;
|
||||
@@ -400,7 +394,76 @@ static void SendFrame(guint8 radioType, guint8 direction, guint8 rntiType,
|
||||
bytesSent = sendto(g_socksd, frameBuffer, frameOffset, 0,
|
||||
(const struct sockaddr *)&g_serv_addr, sizeof(g_serv_addr));
|
||||
else
|
||||
bytesSent = MAC_LTE_PCAP_WritePDU(frameBuffer, frameOffset);
|
||||
bytesSent = PCAP_WritePDU(frameBuffer, frameOffset);
|
||||
|
||||
if (bytesSent != frameOffset) {
|
||||
LOG_W(OPT, "trace_pdu expected %d bytes, got %ld (errno=%d)\n",
|
||||
frameOffset, bytesSent, errno);
|
||||
//exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
static void SendFrameNR(guint8 radioType, guint8 direction, guint8 rntiType,
|
||||
guint16 rnti, guint16 ueid, guint16 frame, guint16 subframe,
|
||||
guint8 isPredefinedData, guint8 retx, guint8 crcStatus,
|
||||
guint8 oob_event, guint8 oob_event_value,
|
||||
uint8_t *pdu_buffer, unsigned int pdu_buffer_size) {
|
||||
unsigned char frameBuffer[9000];
|
||||
unsigned int frameOffset;
|
||||
ssize_t bytesSent;
|
||||
frameOffset = 0;
|
||||
uint16_t tmp16;
|
||||
memcpy(frameBuffer+frameOffset, MAC_NR_START_STRING,
|
||||
strlen(MAC_NR_START_STRING));
|
||||
frameOffset += strlen(MAC_NR_START_STRING);
|
||||
/******************************************************************************/
|
||||
/* Now write out fixed fields (the mandatory elements of struct mac_lte_info) */
|
||||
frameBuffer[frameOffset++] = radioType;
|
||||
frameBuffer[frameOffset++] = direction;
|
||||
frameBuffer[frameOffset++] = rntiType;
|
||||
/*************************************/
|
||||
/* Now optional fields */
|
||||
/* RNTI */
|
||||
frameBuffer[frameOffset++] = MAC_NR_RNTI_TAG;
|
||||
tmp16 = htons(rnti);
|
||||
memcpy(frameBuffer+frameOffset, &tmp16, 2);
|
||||
frameOffset += 2;
|
||||
/* UEId */
|
||||
frameBuffer[frameOffset++] = MAC_NR_UEID_TAG;
|
||||
tmp16 = htons(ueid);
|
||||
memcpy(frameBuffer+frameOffset, &tmp16, 2);
|
||||
frameOffset += 2;
|
||||
/* Subframe number */
|
||||
frameBuffer[frameOffset++] = MAC_NR_FRAME_SLOT_TAG;
|
||||
tmp16 = htons(frame); // frame counter : this will give an expert info as wireshark expects SF and not F
|
||||
memcpy(frameBuffer+frameOffset, &tmp16, 2);
|
||||
frameOffset += 2;
|
||||
tmp16 = htons(subframe); // frame counter : this will give an expert info as wireshark expects SF and not F
|
||||
memcpy(frameBuffer+frameOffset, &tmp16, 2);
|
||||
frameOffset += 2;
|
||||
if (direction == 0 ) { //ulink
|
||||
frameBuffer[frameOffset++] = MAC_NR_PHR_TYPE2_OTHERCELL_TAG;
|
||||
frameBuffer[frameOffset++] = 0;
|
||||
}
|
||||
|
||||
/***************************************/
|
||||
/* Now write the MAC PDU */
|
||||
frameBuffer[frameOffset++] = MAC_NR_PAYLOAD_TAG;
|
||||
|
||||
/* Append actual PDU */
|
||||
//memcpy(frameBuffer+frameOffset, g_PDUBuffer, g_PDUOffset);
|
||||
//frameOffset += g_PDUOffset;
|
||||
if (pdu_buffer != NULL) {
|
||||
memcpy(frameBuffer+frameOffset, (void *)pdu_buffer, pdu_buffer_size);
|
||||
frameOffset += pdu_buffer_size;
|
||||
}
|
||||
|
||||
if ( opt_type == OPT_WIRESHARK )
|
||||
/* Send out the data over the UDP socket */
|
||||
bytesSent = sendto(g_socksd, frameBuffer, frameOffset, 0,
|
||||
(const struct sockaddr *)&g_serv_addr, sizeof(g_serv_addr));
|
||||
else
|
||||
bytesSent = PCAP_WritePDU(frameBuffer, frameOffset);
|
||||
|
||||
if (bytesSent != frameOffset) {
|
||||
LOG_W(OPT, "trace_pdu expected %d bytes, got %ld (errno=%d)\n",
|
||||
@@ -413,20 +476,23 @@ static void SendFrame(guint8 radioType, guint8 direction, guint8 rntiType,
|
||||
extern RAN_CONTEXT_t RC;
|
||||
#include <openair1/PHY/phy_extern_ue.h>
|
||||
/* Remote serveraddress (where Wireshark is running) */
|
||||
void trace_pdu_implementation(int direction, uint8_t *pdu_buffer, unsigned int pdu_buffer_size,
|
||||
void trace_pdu_implementation(int nr, int direction, uint8_t *pdu_buffer, unsigned int pdu_buffer_size,
|
||||
int ueid, int rntiType, int rnti, uint16_t sysFrameNumber, uint8_t subFrameNumber, int oob_event,
|
||||
int oob_event_value) {
|
||||
int radioType=FDD_RADIO;
|
||||
LOG_D(OPT,"sending packet to wireshark: direction=%s, size: %d, ueid: %d, rnti: %x, frame/sf: %d.%d\n",
|
||||
direction?"DL":"UL", pdu_buffer_size, ueid, rnti, sysFrameNumber,subFrameNumber);
|
||||
|
||||
if (RC.eNB && RC.eNB[0][0]!=NULL)
|
||||
radioType=RC.eNB[0][0]->frame_parms.frame_type== FDD ? FDD_RADIO:TDD_RADIO;
|
||||
else if (PHY_vars_UE_g && PHY_vars_UE_g[0][0] != NULL)
|
||||
radioType=PHY_vars_UE_g[0][0]->frame_parms.frame_type== FDD ? FDD_RADIO:TDD_RADIO;
|
||||
else {
|
||||
LOG_E(OPT,"not a eNB neither a UE!!! \n");
|
||||
return;
|
||||
if (nr) {
|
||||
radioType=TDD_RADIO;
|
||||
} else {
|
||||
if (RC.eNB && RC.eNB[0][0]!=NULL)
|
||||
radioType=RC.eNB[0][0]->frame_parms.frame_type== FDD ? FDD_RADIO:TDD_RADIO;
|
||||
else if (PHY_vars_UE_g && PHY_vars_UE_g[0][0] != NULL)
|
||||
radioType=PHY_vars_UE_g[0][0]->frame_parms.frame_type== FDD ? FDD_RADIO:TDD_RADIO;
|
||||
else {
|
||||
LOG_E(OPT,"not a 4G eNB neither a 4G UE!!! \n");
|
||||
}
|
||||
}
|
||||
|
||||
switch (opt_type) {
|
||||
@@ -448,9 +514,17 @@ void trace_pdu_implementation(int direction, uint8_t *pdu_buffer, unsigned int p
|
||||
break;
|
||||
}
|
||||
|
||||
if (nr)
|
||||
SendFrameNR( radioType,
|
||||
(direction == DIRECTION_DOWNLINK) ? DIRECTION_DOWNLINK : DIRECTION_UPLINK,
|
||||
rntiType, rnti, ueid, sysFrameNumber, subFrameNumber,
|
||||
1, 0, 1, //guint8 isPredefinedData, guint8 retx, guint8 crcStatus
|
||||
oob_event,oob_event_value,
|
||||
pdu_buffer, pdu_buffer_size);
|
||||
else
|
||||
SendFrame( radioType,
|
||||
(direction == DIRECTION_DOWNLINK) ? DIRECTION_DOWNLINK : DIRECTION_UPLINK,
|
||||
rntiType, rnti, ueid, (sysFrameNumber<<4) + subFrameNumber,
|
||||
rntiType, rnti, ueid, sysFrameNumber, subFrameNumber,
|
||||
1, 0, 1, //guint8 isPredefinedData, guint8 retx, guint8 crcStatus
|
||||
oob_event,oob_event_value,
|
||||
pdu_buffer, pdu_buffer_size);
|
||||
|
||||
Reference in New Issue
Block a user