2008-12-23 21:00:04 +00:00
|
|
|
/* packet-mac-lte.h
|
|
|
|
*
|
|
|
|
* Martin Mathieson
|
|
|
|
* $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
|
2012-06-28 22:56:06 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2009-05-30 11:57:39 +00:00
|
|
|
*
|
|
|
|
* This header file may also be distributed under
|
|
|
|
* the terms of the BSD Licence as follows:
|
2013-10-13 19:56:52 +00:00
|
|
|
*
|
2009-05-30 11:57:39 +00:00
|
|
|
* Copyright (C) 2009 Martin Mathieson. All rights reserved.
|
2013-10-13 19:56:52 +00:00
|
|
|
*
|
2009-05-30 11:57:39 +00:00
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
2013-10-13 19:56:52 +00:00
|
|
|
*
|
2009-05-30 11:57:39 +00:00
|
|
|
* THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE
|
2008-12-23 21:00:04 +00:00
|
|
|
*/
|
|
|
|
|
2013-03-01 23:53:11 +00:00
|
|
|
#include "ws_symbol_export.h"
|
|
|
|
|
2009-02-19 22:25:36 +00:00
|
|
|
/* radioType */
|
|
|
|
#define FDD_RADIO 1
|
|
|
|
#define TDD_RADIO 2
|
|
|
|
|
2009-05-13 09:36:42 +00:00
|
|
|
/* Direction */
|
2009-02-12 12:08:05 +00:00
|
|
|
#define DIRECTION_UPLINK 0
|
|
|
|
#define DIRECTION_DOWNLINK 1
|
2008-12-23 21:00:04 +00:00
|
|
|
|
2009-02-19 22:25:36 +00:00
|
|
|
/* rntiType */
|
2009-09-02 16:39:39 +00:00
|
|
|
#define NO_RNTI 0
|
|
|
|
#define P_RNTI 1
|
|
|
|
#define RA_RNTI 2
|
|
|
|
#define C_RNTI 3
|
|
|
|
#define SI_RNTI 4
|
|
|
|
#define SPS_RNTI 5
|
2011-12-22 18:45:15 +00:00
|
|
|
#define M_RNTI 6
|
2009-02-12 12:08:05 +00:00
|
|
|
|
|
|
|
|
2009-10-26 15:39:00 +00:00
|
|
|
typedef enum mac_lte_oob_event {
|
|
|
|
ltemac_send_preamble,
|
|
|
|
ltemac_send_sr,
|
|
|
|
ltemac_sr_failure
|
|
|
|
} mac_lte_oob_event;
|
|
|
|
|
2010-07-05 10:35:17 +00:00
|
|
|
typedef enum mac_lte_dl_retx {
|
|
|
|
dl_retx_no,
|
|
|
|
dl_retx_yes,
|
|
|
|
dl_retx_unknown
|
|
|
|
} mac_lte_dl_retx;
|
|
|
|
|
2010-10-07 14:44:00 +00:00
|
|
|
typedef enum mac_lte_crc_status {
|
|
|
|
crc_fail = 0,
|
|
|
|
crc_success = 1,
|
|
|
|
crc_high_code_rate = 2,
|
2010-12-05 23:34:11 +00:00
|
|
|
crc_pdsch_lost = 3,
|
2012-11-10 23:23:25 +00:00
|
|
|
crc_duplicate_nonzero_rv = 4,
|
|
|
|
crc_false_dci = 5
|
2010-10-07 14:44:00 +00:00
|
|
|
} mac_lte_crc_status;
|
|
|
|
|
2013-04-15 20:56:49 +00:00
|
|
|
typedef enum mac_lte_carrier_id {
|
|
|
|
carrier_id_primary,
|
|
|
|
carrier_id_secondary_1,
|
|
|
|
carrier_id_secondary_2,
|
|
|
|
carrier_id_secondary_3,
|
2013-06-16 15:11:21 +00:00
|
|
|
carrier_id_secondary_4
|
2013-04-15 20:56:49 +00:00
|
|
|
} mac_lte_carrier_id;
|
|
|
|
|
2009-02-12 12:08:05 +00:00
|
|
|
/* Context info attached to each LTE MAC frame */
|
2008-12-23 21:00:04 +00:00
|
|
|
typedef struct mac_lte_info
|
|
|
|
{
|
|
|
|
/* Needed for decode */
|
|
|
|
guint8 radioType;
|
|
|
|
guint8 direction;
|
|
|
|
guint8 rntiType;
|
|
|
|
|
|
|
|
/* Extra info to display */
|
|
|
|
guint16 rnti;
|
|
|
|
guint16 ueid;
|
2011-01-31 00:28:22 +00:00
|
|
|
|
2011-11-21 16:18:33 +00:00
|
|
|
/* Timing info */
|
|
|
|
guint16 sysframeNumber;
|
2010-07-05 17:28:28 +00:00
|
|
|
guint16 subframeNumber;
|
2011-01-31 00:28:22 +00:00
|
|
|
|
|
|
|
/* Optional field. More interesting for TDD (FDD is always -4 subframeNumber) */
|
2010-07-05 16:45:36 +00:00
|
|
|
gboolean subframeNumberOfGrantPresent;
|
2010-07-05 17:28:28 +00:00
|
|
|
guint16 subframeNumberOfGrant;
|
2011-01-31 00:28:22 +00:00
|
|
|
|
|
|
|
/* Flag set only if doing PHY-level data test - i.e. there may not be a
|
|
|
|
well-formed MAC PDU so just show as raw data */
|
2010-07-05 17:28:28 +00:00
|
|
|
gboolean isPredefinedData;
|
2011-01-31 00:28:22 +00:00
|
|
|
|
|
|
|
/* Length of DL PDU or UL grant size in bytes */
|
2008-12-23 21:00:04 +00:00
|
|
|
guint16 length;
|
2011-01-31 00:28:22 +00:00
|
|
|
|
|
|
|
/* UL only. 0=newTx, 1=first-retx, etc */
|
|
|
|
guint8 reTxCount;
|
2011-11-25 11:19:03 +00:00
|
|
|
guint8 isPHICHNACK; /* FALSE=PDCCH retx grant, TRUE=PHICH NACK */
|
2011-01-31 00:28:22 +00:00
|
|
|
|
2012-04-25 20:02:12 +00:00
|
|
|
/* UL only. Indicates if the R10 extendedBSR-Sizes parameter is set */
|
|
|
|
gboolean isExtendedBSRSizes;
|
2012-12-16 00:02:50 +00:00
|
|
|
|
2011-01-31 00:28:22 +00:00
|
|
|
/* DL only. Status of CRC check */
|
2010-10-07 14:44:00 +00:00
|
|
|
mac_lte_crc_status crcStatusValid;
|
2009-10-26 15:39:00 +00:00
|
|
|
|
2013-04-15 20:56:49 +00:00
|
|
|
/* Carrier ID */
|
|
|
|
mac_lte_carrier_id carrierId;
|
2013-10-13 19:56:52 +00:00
|
|
|
|
2011-01-31 00:28:22 +00:00
|
|
|
/* DL only. Is this known to be a retransmission? */
|
2010-07-05 10:35:17 +00:00
|
|
|
mac_lte_dl_retx dl_retx;
|
|
|
|
|
2011-01-31 00:28:22 +00:00
|
|
|
/* More Physical layer info (see direction above for which side of union to use) */
|
2010-03-14 17:56:37 +00:00
|
|
|
union {
|
|
|
|
struct mac_lte_ul_phy_info
|
|
|
|
{
|
2011-01-31 00:28:22 +00:00
|
|
|
guint8 present; /* Remaining UL fields are present and should be displayed */
|
2010-03-14 17:56:37 +00:00
|
|
|
guint8 modulation_type;
|
|
|
|
guint8 tbs_index;
|
|
|
|
guint8 resource_block_length;
|
|
|
|
guint8 resource_block_start;
|
2010-12-05 23:34:11 +00:00
|
|
|
guint8 harq_id;
|
|
|
|
gboolean ndi;
|
2010-03-14 17:56:37 +00:00
|
|
|
} ul_info;
|
|
|
|
struct mac_lte_dl_phy_info
|
|
|
|
{
|
2011-01-31 00:28:22 +00:00
|
|
|
guint8 present; /* Remaining UL fields are present and should be displayed */
|
2010-03-14 17:56:37 +00:00
|
|
|
guint8 dci_format;
|
|
|
|
guint8 resource_allocation_type;
|
|
|
|
guint8 aggregation_level;
|
|
|
|
guint8 mcs_index;
|
|
|
|
guint8 redundancy_version_index;
|
2010-10-07 14:44:00 +00:00
|
|
|
guint8 resource_block_length;
|
|
|
|
mac_lte_crc_status crc_status;
|
2010-11-02 15:20:38 +00:00
|
|
|
guint8 harq_id;
|
|
|
|
gboolean ndi;
|
2013-06-16 15:11:21 +00:00
|
|
|
guint8 transport_block; /* 0..1 */
|
2010-03-14 17:56:37 +00:00
|
|
|
} dl_info;
|
|
|
|
} detailed_phy_info;
|
2011-01-31 00:28:22 +00:00
|
|
|
|
2009-10-26 15:39:00 +00:00
|
|
|
/* Relating to out-of-band events */
|
2011-01-31 00:28:22 +00:00
|
|
|
/* N.B. dissector will only look to these fields if length is 0... */
|
2009-10-26 15:39:00 +00:00
|
|
|
mac_lte_oob_event oob_event;
|
|
|
|
guint8 rapid;
|
|
|
|
guint8 rach_attempt_number;
|
2011-05-11 11:10:30 +00:00
|
|
|
#define MAX_SRs 20
|
|
|
|
guint16 number_of_srs;
|
|
|
|
guint16 oob_ueid[MAX_SRs];
|
|
|
|
guint16 oob_rnti[MAX_SRs];
|
2008-12-23 21:00:04 +00:00
|
|
|
} mac_lte_info;
|
|
|
|
|
2009-02-12 12:08:05 +00:00
|
|
|
|
|
|
|
typedef struct mac_lte_tap_info {
|
|
|
|
/* Info from context */
|
|
|
|
guint16 rnti;
|
2010-02-04 16:30:43 +00:00
|
|
|
guint16 ueid;
|
2009-03-24 17:28:30 +00:00
|
|
|
guint8 rntiType;
|
|
|
|
guint8 isPredefinedData;
|
|
|
|
guint8 crcStatusValid;
|
2010-10-07 14:44:00 +00:00
|
|
|
mac_lte_crc_status crcStatus;
|
2009-02-12 12:08:05 +00:00
|
|
|
guint8 direction;
|
|
|
|
|
2010-07-05 10:35:17 +00:00
|
|
|
guint8 isPHYRetx;
|
2011-04-16 10:56:18 +00:00
|
|
|
guint16 ueInTTI;
|
2010-02-20 16:58:48 +00:00
|
|
|
|
2010-09-03 16:45:05 +00:00
|
|
|
nstime_t time;
|
|
|
|
|
2009-02-12 12:08:05 +00:00
|
|
|
/* Number of bytes (which part is used depends upon context settings) */
|
|
|
|
guint32 single_number_of_bytes;
|
|
|
|
guint32 bytes_for_lcid[11];
|
2009-02-25 18:02:09 +00:00
|
|
|
guint32 sdus_for_lcid[11];
|
2009-04-21 12:35:50 +00:00
|
|
|
guint8 number_of_rars;
|
2013-08-08 14:45:45 +00:00
|
|
|
guint8 number_of_paging_ids;
|
2009-12-29 22:55:39 +00:00
|
|
|
|
|
|
|
/* Number of padding bytes includes padding subheaders and trailing padding */
|
|
|
|
guint16 padding_bytes;
|
|
|
|
guint16 raw_length;
|
2009-02-12 12:08:05 +00:00
|
|
|
} mac_lte_tap_info;
|
|
|
|
|
2009-05-28 02:24:27 +00:00
|
|
|
|
2010-03-01 22:52:34 +00:00
|
|
|
/* Accessor function to check if a frame was considered to be ReTx */
|
|
|
|
int is_mac_lte_frame_retx(packet_info *pinfo, guint8 direction);
|
2009-05-28 02:24:27 +00:00
|
|
|
|
|
|
|
/*****************************************************************/
|
|
|
|
/* UDP framing format */
|
|
|
|
/* ----------------------- */
|
|
|
|
/* Several people have asked about dissecting MAC by framing */
|
2010-07-05 10:35:17 +00:00
|
|
|
/* PDUs over IP. A suggested format over UDP has been created */
|
2009-05-28 02:24:27 +00:00
|
|
|
/* and implemented by this dissector, using the definitions */
|
2009-05-30 12:54:08 +00:00
|
|
|
/* 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 http://wiki.wireshark.org/MAC-LTE */
|
2009-05-28 02:24:27 +00:00
|
|
|
/* */
|
2009-05-30 12:54:08 +00:00
|
|
|
/* A heuristic dissecter (enabled by a preference) will */
|
2009-05-28 02:24:27 +00:00
|
|
|
/* recognise a signature at the beginning of these frames . */
|
2009-05-30 12:54:08 +00:00
|
|
|
/* Until someone is using this format, suggestions for changes */
|
2009-05-28 02:24:27 +00:00
|
|
|
/* 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 MAC_LTE_START_STRING "mac-lte"
|
|
|
|
|
|
|
|
/* Fixed fields. This is followed by the following 3 mandatory fields:
|
|
|
|
- radioType (1 byte)
|
2013-10-13 19:56:52 +00:00
|
|
|
- direction (1 byte)
|
2009-05-28 02:24:27 +00:00
|
|
|
- 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,
|
2013-02-26 01:06:19 +00:00
|
|
|
it's implicit from the tag) */
|
2009-05-28 02:24:27 +00:00
|
|
|
|
|
|
|
#define MAC_LTE_RNTI_TAG 0x02
|
|
|
|
/* 2 bytes, network order */
|
|
|
|
|
|
|
|
#define MAC_LTE_UEID_TAG 0x03
|
|
|
|
/* 2 bytes, network order */
|
|
|
|
|
|
|
|
#define MAC_LTE_SUBFRAME_TAG 0x04
|
|
|
|
/* 2 bytes, network order */
|
|
|
|
|
2012-04-25 20:02:12 +00:00
|
|
|
#define MAC_LTE_PREDEFINED_DATA_TAG 0x05
|
2009-05-28 02:24:27 +00:00
|
|
|
/* 1 byte */
|
|
|
|
|
|
|
|
#define MAC_LTE_RETX_TAG 0x06
|
|
|
|
/* 1 byte */
|
|
|
|
|
|
|
|
#define MAC_LTE_CRC_STATUS_TAG 0x07
|
|
|
|
/* 1 byte */
|
|
|
|
|
2012-04-25 20:02:12 +00:00
|
|
|
#define MAC_LTE_EXT_BSR_SIZES_TAG 0x08
|
|
|
|
/* 0 byte */
|
2009-05-28 02:24:27 +00:00
|
|
|
|
|
|
|
/* 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_LTE_PAYLOAD_TAG 0x01
|
|
|
|
|
2011-02-02 23:21:16 +00:00
|
|
|
|
2013-06-18 21:02:00 +00:00
|
|
|
/* 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 um_sn_length_present;
|
|
|
|
guint8 um_sn_length; /* Part of RLC config - optional */
|
|
|
|
gboolean ul_priority_present;
|
|
|
|
guint8 ul_priority; /* Part of LogicalChannelConfig - optional */
|
2013-06-18 21:44:48 +00:00
|
|
|
gboolean pdcp_sn_size_present;
|
|
|
|
guint8 pdcp_sn_size; /* Part of pdcp-Config - optional */
|
2013-06-18 21:02:00 +00:00
|
|
|
} drb_mapping_t;
|
|
|
|
|
|
|
|
|
2011-04-17 11:22:03 +00:00
|
|
|
/* Set details of an LCID -> drb channel mapping. To be called from
|
|
|
|
configuration protocol (e.g. RRC) */
|
2013-06-18 21:02:00 +00:00
|
|
|
void set_mac_lte_channel_mapping(drb_mapping_t *drb_mapping);
|
2011-04-17 11:22:03 +00:00
|
|
|
|
2013-08-30 04:08:57 +00:00
|
|
|
|
|
|
|
/* 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! */
|
2013-08-30 04:33:36 +00:00
|
|
|
typedef struct drx_config_t {
|
2013-08-30 04:08:57 +00:00
|
|
|
gboolean configured;
|
|
|
|
guint32 frameNum;
|
2013-09-23 17:34:18 +00:00
|
|
|
guint32 previousFrameNum;
|
|
|
|
|
2013-08-30 04:08:57 +00:00
|
|
|
guint32 onDurationTimer;
|
|
|
|
guint32 inactivityTimer;
|
|
|
|
guint32 retransmissionTimer;
|
|
|
|
guint32 longCycle;
|
|
|
|
guint32 cycleOffset;
|
|
|
|
/* Optional Short cycle */
|
|
|
|
gboolean shortCycleConfigured;
|
|
|
|
guint32 shortCycle;
|
|
|
|
guint32 shortCycleTimer;
|
|
|
|
} drx_config_t;
|
|
|
|
|
|
|
|
/* Functions to set/release up dedicated DRX config */
|
|
|
|
void set_mac_lte_drx_config(guint16 ueid, drx_config_t *drx_config, packet_info *pinfo);
|
|
|
|
void set_mac_lte_drx_config_release(guint16 ueid, packet_info *pinfo);
|
|
|
|
|
|
|
|
|
2011-02-02 23:21:16 +00:00
|
|
|
/* Functions to be called from outside this module (e.g. in a plugin, where mac_lte_info
|
|
|
|
isn't available) to get/set per-packet data */
|
2013-03-01 23:53:11 +00:00
|
|
|
WS_DLL_PUBLIC
|
2011-02-02 23:21:16 +00:00
|
|
|
mac_lte_info *get_mac_lte_proto_data(packet_info *pinfo);
|
2013-03-01 23:53:11 +00:00
|
|
|
WS_DLL_PUBLIC
|
2011-02-02 23:21:16 +00:00
|
|
|
void set_mac_lte_proto_data(packet_info *pinfo, mac_lte_info *p_mac_lte_info);
|
|
|
|
|
2012-01-19 02:58:53 +00:00
|
|
|
/* Function to attempt to populate p_mac_lte_info using framing definition above */
|
|
|
|
gboolean dissect_mac_lte_context_fields(struct mac_lte_info *p_mac_lte_info, tvbuff_t *tvb,
|
|
|
|
gint *p_offset);
|
|
|
|
|