T: add a mac pdu -> wireshark replay tracer
This tracer takes the traces ENB_MAC_UE_DL_PDU_WITH_DATA and ENB_MAC_UE_UL_PDU_WITH_DATA from a trace file (as generated by the "record" tracer) and sends them in UDP packets correctly formatted for wireshark to dissect them. One unresolved problem I face with my version of wireshark (1.10.6) is that I don't get the frame number, only subframe. See in the code to change the behavior if you use a more recent version of wireshark. You need to properly configure wireshark for it to work. See $OPENAIR_DIR/openair2/UTIL/OPT/README.txt.
This commit is contained in:
@@ -9,4 +9,5 @@ tracer/record
|
|||||||
tracer/replay
|
tracer/replay
|
||||||
tracer/textlog
|
tracer/textlog
|
||||||
tracer/vcd
|
tracer/vcd
|
||||||
|
tracer/macpdu2wireshark
|
||||||
tracee/tracee
|
tracee/tracee
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ CFLAGS=-Wall -g -pthread -DT_TRACER -I.
|
|||||||
|
|
||||||
LIBS=-lX11 -lm -lpng -lXft
|
LIBS=-lX11 -lm -lpng -lXft
|
||||||
|
|
||||||
all: record replay extract_config textlog enb vcd
|
all: record replay extract_config textlog enb vcd macpdu2wireshark
|
||||||
|
|
||||||
record: utils.o record.o database.o config.o
|
record: utils.o record.o database.o config.o
|
||||||
$(CC) $(CFLAGS) -o record $^ $(LIBS)
|
$(CC) $(CFLAGS) -o record $^ $(LIBS)
|
||||||
@@ -31,6 +31,10 @@ vcd: utils.o vcd.o database.o event.o handler.o config.o \
|
|||||||
filter/filter.a
|
filter/filter.a
|
||||||
$(CC) $(CFLAGS) -o vcd $^ $(LIBS)
|
$(CC) $(CFLAGS) -o vcd $^ $(LIBS)
|
||||||
|
|
||||||
|
macpdu2wireshark: macpdu2wireshark.o database.o utils.o handler.o event.o \
|
||||||
|
config.o
|
||||||
|
$(CC) $(CFLAGS) -o $@ $^ $(LIBS)
|
||||||
|
|
||||||
.PHONY: all gui/gui.a view/view.a logger/logger.a filter/filter.a
|
.PHONY: all gui/gui.a view/view.a logger/logger.a filter/filter.a
|
||||||
|
|
||||||
gui/gui.a:
|
gui/gui.a:
|
||||||
@@ -50,7 +54,7 @@ filter/filter.a:
|
|||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f *.o core tracer_remote textlog enb vcd record replay
|
rm -f *.o core tracer_remote textlog enb vcd record replay
|
||||||
rm -f extract_config
|
rm -f extract_config macpdu2wireshark
|
||||||
cd gui && make clean
|
cd gui && make clean
|
||||||
cd view && make clean
|
cd view && make clean
|
||||||
cd logger && make clean
|
cd logger && make clean
|
||||||
|
|||||||
@@ -0,0 +1,260 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <netinet/in.h>
|
||||||
|
#include <arpa/inet.h>
|
||||||
|
#include "database.h"
|
||||||
|
#include "event.h"
|
||||||
|
#include "handler.h"
|
||||||
|
#include "config.h"
|
||||||
|
#include "utils.h"
|
||||||
|
#include "packet-mac-lte.h"
|
||||||
|
|
||||||
|
#define DEFAULT_IP "127.0.0.1"
|
||||||
|
#define DEFAULT_PORT 9999
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int socket;
|
||||||
|
struct sockaddr_in to;
|
||||||
|
OBUF buf;
|
||||||
|
/* ul */
|
||||||
|
int ul_rnti;
|
||||||
|
int ul_frame;
|
||||||
|
int ul_subframe;
|
||||||
|
int ul_data;
|
||||||
|
/* dl */
|
||||||
|
int dl_rnti;
|
||||||
|
int dl_frame;
|
||||||
|
int dl_subframe;
|
||||||
|
int dl_data;
|
||||||
|
} ev_data;
|
||||||
|
|
||||||
|
void ul(void *_d, event e)
|
||||||
|
{
|
||||||
|
ev_data *d = _d;
|
||||||
|
ssize_t ret;
|
||||||
|
int fsf;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
d->buf.osize = 0;
|
||||||
|
|
||||||
|
PUTS(&d->buf, MAC_LTE_START_STRING);
|
||||||
|
PUTC(&d->buf, FDD_RADIO);
|
||||||
|
PUTC(&d->buf, DIRECTION_UPLINK);
|
||||||
|
PUTC(&d->buf, C_RNTI);
|
||||||
|
|
||||||
|
PUTC(&d->buf, MAC_LTE_RNTI_TAG);
|
||||||
|
PUTC(&d->buf, (e.e[d->ul_rnti].i>>8) & 255);
|
||||||
|
PUTC(&d->buf, e.e[d->ul_rnti].i & 255);
|
||||||
|
|
||||||
|
/* for newer version of wireshark? */
|
||||||
|
fsf = (e.e[d->ul_frame].i << 4) + e.e[d->ul_subframe].i;
|
||||||
|
/* for older version? */
|
||||||
|
fsf = e.e[d->ul_subframe].i;
|
||||||
|
PUTC(&d->buf, MAC_LTE_FRAME_SUBFRAME_TAG);
|
||||||
|
PUTC(&d->buf, (fsf>>8) & 255);
|
||||||
|
PUTC(&d->buf, fsf & 255);
|
||||||
|
|
||||||
|
PUTC(&d->buf, MAC_LTE_PAYLOAD_TAG);
|
||||||
|
for (i = 0; i < e.e[d->ul_data].bsize; i++)
|
||||||
|
PUTC(&d->buf, ((char*)e.e[d->ul_data].b)[i]);
|
||||||
|
|
||||||
|
ret = sendto(d->socket, d->buf.obuf, d->buf.osize, 0,
|
||||||
|
(struct sockaddr *)&d->to, sizeof(struct sockaddr_in));
|
||||||
|
if (ret != d->buf.osize) abort();
|
||||||
|
}
|
||||||
|
|
||||||
|
void dl(void *_d, event e)
|
||||||
|
{
|
||||||
|
ev_data *d = _d;
|
||||||
|
ssize_t ret;
|
||||||
|
int fsf;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
d->buf.osize = 0;
|
||||||
|
|
||||||
|
PUTS(&d->buf, MAC_LTE_START_STRING);
|
||||||
|
PUTC(&d->buf, FDD_RADIO);
|
||||||
|
PUTC(&d->buf, DIRECTION_DOWNLINK);
|
||||||
|
PUTC(&d->buf, C_RNTI);
|
||||||
|
|
||||||
|
PUTC(&d->buf, MAC_LTE_RNTI_TAG);
|
||||||
|
PUTC(&d->buf, (e.e[d->dl_rnti].i>>8) & 255);
|
||||||
|
PUTC(&d->buf, e.e[d->dl_rnti].i & 255);
|
||||||
|
|
||||||
|
/* for newer version of wireshark? */
|
||||||
|
fsf = (e.e[d->dl_frame].i << 4) + e.e[d->dl_subframe].i;
|
||||||
|
/* for older version? */
|
||||||
|
fsf = e.e[d->dl_subframe].i;
|
||||||
|
PUTC(&d->buf, MAC_LTE_FRAME_SUBFRAME_TAG);
|
||||||
|
PUTC(&d->buf, (fsf>>8) & 255);
|
||||||
|
PUTC(&d->buf, fsf & 255);
|
||||||
|
|
||||||
|
PUTC(&d->buf, MAC_LTE_PAYLOAD_TAG);
|
||||||
|
for (i = 0; i < e.e[d->dl_data].bsize; i++)
|
||||||
|
PUTC(&d->buf, ((char*)e.e[d->dl_data].b)[i]);
|
||||||
|
|
||||||
|
ret = sendto(d->socket, d->buf.obuf, d->buf.osize, 0,
|
||||||
|
(struct sockaddr *)&d->to, sizeof(struct sockaddr_in));
|
||||||
|
if (ret != d->buf.osize) abort();
|
||||||
|
}
|
||||||
|
|
||||||
|
void setup_data(ev_data *d, void *database, int ul_id, int dl_id)
|
||||||
|
{
|
||||||
|
database_event_format f;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
d->ul_rnti = -1;
|
||||||
|
d->ul_frame = -1;
|
||||||
|
d->ul_subframe = -1;
|
||||||
|
d->ul_data = -1;
|
||||||
|
|
||||||
|
d->dl_rnti = -1;
|
||||||
|
d->dl_frame = -1;
|
||||||
|
d->dl_subframe = -1;
|
||||||
|
d->dl_data = -1;
|
||||||
|
|
||||||
|
#define G(var_name, var_type, var) \
|
||||||
|
if (!strcmp(f.name[i], var_name)) { \
|
||||||
|
if (strcmp(f.type[i], var_type)) goto error; \
|
||||||
|
var = i; \
|
||||||
|
continue; \
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ul: rnti, frame, subframe, data */
|
||||||
|
f = get_format(database, ul_id);
|
||||||
|
for (i = 0; i < f.count; i++) {
|
||||||
|
G("rnti", "int", d->ul_rnti);
|
||||||
|
G("frame", "int", d->ul_frame);
|
||||||
|
G("subframe", "int", d->ul_subframe);
|
||||||
|
G("data", "buffer", d->ul_data);
|
||||||
|
}
|
||||||
|
if (d->ul_rnti == -1 || d->ul_frame == -1 || d->ul_subframe == -1 ||
|
||||||
|
d->ul_data == -1) goto error;
|
||||||
|
|
||||||
|
/* dl: rnti, frame, subframe, data */
|
||||||
|
f = get_format(database, dl_id);
|
||||||
|
for (i = 0; i < f.count; i++) {
|
||||||
|
G("rnti", "int", d->dl_rnti);
|
||||||
|
G("frame", "int", d->dl_frame);
|
||||||
|
G("subframe", "int", d->dl_subframe);
|
||||||
|
G("data", "buffer", d->dl_data);
|
||||||
|
}
|
||||||
|
if (d->dl_rnti == -1 || d->dl_frame == -1 || d->dl_subframe == -1 ||
|
||||||
|
d->dl_data == -1) goto error;
|
||||||
|
|
||||||
|
#undef G
|
||||||
|
|
||||||
|
return;
|
||||||
|
|
||||||
|
error:
|
||||||
|
printf("bad T_messages.txt\n");
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
|
||||||
|
void *receiver(void *_d)
|
||||||
|
{
|
||||||
|
ev_data *d = _d;
|
||||||
|
int s;
|
||||||
|
char buf[100000];
|
||||||
|
|
||||||
|
s = socket(AF_INET, SOCK_DGRAM, 0);
|
||||||
|
if (s == -1) { perror("socket"); abort(); }
|
||||||
|
|
||||||
|
if (bind(s, (struct sockaddr *)&d->to, sizeof(struct sockaddr_in)) == -1)
|
||||||
|
{ perror("bind"); abort(); }
|
||||||
|
|
||||||
|
while (1) {
|
||||||
|
if (recv(s, buf, 100000, 0) <= 0) abort();
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void usage(void)
|
||||||
|
{
|
||||||
|
printf(
|
||||||
|
"options:\n"
|
||||||
|
" -d <database file> this option is mandatory\n"
|
||||||
|
" -in <dump file> read events from this dump file\n"
|
||||||
|
" -ip <IP address> send packets to this IP address (default %s)\n"
|
||||||
|
" -p <port> send packets to this port (default %d)\n",
|
||||||
|
DEFAULT_IP,
|
||||||
|
DEFAULT_PORT
|
||||||
|
);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int n, char **v)
|
||||||
|
{
|
||||||
|
char *database_filename = NULL;
|
||||||
|
char *input_filename = NULL;
|
||||||
|
void *database;
|
||||||
|
event_handler *h;
|
||||||
|
int in;
|
||||||
|
int i;
|
||||||
|
int ul_id, dl_id;
|
||||||
|
ev_data d;
|
||||||
|
char *ip = DEFAULT_IP;
|
||||||
|
int port = DEFAULT_PORT;
|
||||||
|
|
||||||
|
memset(&d, 0, sizeof(ev_data));
|
||||||
|
|
||||||
|
for (i = 1; i < n; i++) {
|
||||||
|
if (!strcmp(v[i], "-h") || !strcmp(v[i], "--help")) usage();
|
||||||
|
if (!strcmp(v[i], "-d"))
|
||||||
|
{ if (i > n-2) usage(); database_filename = v[++i]; continue; }
|
||||||
|
if (!strcmp(v[i], "-in"))
|
||||||
|
{ if (i > n-2) usage(); input_filename = v[++i]; continue; }
|
||||||
|
if (!strcmp(v[i], "-ip")) { if (i > n-2) usage(); ip = v[++i]; continue; }
|
||||||
|
if (!strcmp(v[i], "-p")) {if(i>n-2)usage(); port=atoi(v[++i]); continue; }
|
||||||
|
usage();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (database_filename == NULL) {
|
||||||
|
printf("ERROR: provide a database file (-d)\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (input_filename == NULL) {
|
||||||
|
printf("ERROR: provide an input file (-i)\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
in = open(input_filename, O_RDONLY);
|
||||||
|
if (in == -1) { perror(input_filename); return 1; }
|
||||||
|
|
||||||
|
database = parse_database(database_filename);
|
||||||
|
load_config_file(database_filename);
|
||||||
|
|
||||||
|
h = new_handler(database);
|
||||||
|
|
||||||
|
ul_id = event_id_from_name(database, "ENB_MAC_UE_UL_PDU_WITH_DATA");
|
||||||
|
dl_id = event_id_from_name(database, "ENB_MAC_UE_DL_PDU_WITH_DATA");
|
||||||
|
setup_data(&d, database, ul_id, dl_id);
|
||||||
|
|
||||||
|
register_handler_function(h, ul_id, ul, &d);
|
||||||
|
register_handler_function(h, dl_id, dl, &d);
|
||||||
|
|
||||||
|
d.socket = socket(AF_INET, SOCK_DGRAM, 0);
|
||||||
|
if (d.socket == -1) { perror("socket"); exit(1); }
|
||||||
|
|
||||||
|
d.to.sin_family = AF_INET;
|
||||||
|
d.to.sin_port = htons(port);
|
||||||
|
d.to.sin_addr.s_addr = inet_addr(ip);
|
||||||
|
|
||||||
|
new_thread(receiver, &d);
|
||||||
|
|
||||||
|
/* read messages */
|
||||||
|
while (1) {
|
||||||
|
char v[T_BUFFER_MAX];
|
||||||
|
event e;
|
||||||
|
e = get_event(in, v, database);
|
||||||
|
if (e.type == -1) break;
|
||||||
|
if (!(e.type == ul_id || e.type == dl_id)) continue;
|
||||||
|
handle_event(h, e);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
@@ -0,0 +1,404 @@
|
|||||||
|
/* packet-mac-lte.h
|
||||||
|
*
|
||||||
|
* Martin Mathieson
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* This header file may also be distributed under
|
||||||
|
* the terms of the BSD Licence as follows:
|
||||||
|
*
|
||||||
|
* Copyright (C) 2009 Martin Mathieson. All rights reserved.
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
//#include "ws_symbol_export.h"
|
||||||
|
|
||||||
|
/* radioType */
|
||||||
|
#define FDD_RADIO 1
|
||||||
|
#define TDD_RADIO 2
|
||||||
|
|
||||||
|
/* Direction */
|
||||||
|
#define DIRECTION_UPLINK 0
|
||||||
|
#define DIRECTION_DOWNLINK 1
|
||||||
|
|
||||||
|
/* rntiType */
|
||||||
|
#define NO_RNTI 0
|
||||||
|
#define P_RNTI 1
|
||||||
|
#define RA_RNTI 2
|
||||||
|
#define C_RNTI 3
|
||||||
|
#define SI_RNTI 4
|
||||||
|
#define SPS_RNTI 5
|
||||||
|
#define M_RNTI 6
|
||||||
|
#define SL_BCH_RNTI 7
|
||||||
|
#define SL_RNTI 8
|
||||||
|
#define SC_RNTI 9
|
||||||
|
#define G_RNTI 10
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
typedef enum mac_lte_oob_event {
|
||||||
|
ltemac_send_preamble,
|
||||||
|
ltemac_send_sr,
|
||||||
|
ltemac_sr_failure
|
||||||
|
} mac_lte_oob_event;
|
||||||
|
|
||||||
|
typedef enum mac_lte_dl_retx {
|
||||||
|
dl_retx_no,
|
||||||
|
dl_retx_yes,
|
||||||
|
dl_retx_unknown
|
||||||
|
} mac_lte_dl_retx;
|
||||||
|
|
||||||
|
typedef enum mac_lte_crc_status {
|
||||||
|
crc_fail = 0,
|
||||||
|
crc_success = 1,
|
||||||
|
crc_high_code_rate = 2,
|
||||||
|
crc_pdsch_lost = 3,
|
||||||
|
crc_duplicate_nonzero_rv = 4,
|
||||||
|
crc_false_dci = 5
|
||||||
|
} mac_lte_crc_status;
|
||||||
|
|
||||||
|
typedef enum mac_lte_carrier_id {
|
||||||
|
carrier_id_primary,
|
||||||
|
carrier_id_secondary_1,
|
||||||
|
carrier_id_secondary_2,
|
||||||
|
carrier_id_secondary_3,
|
||||||
|
carrier_id_secondary_4
|
||||||
|
} mac_lte_carrier_id;
|
||||||
|
|
||||||
|
typedef enum mac_lte_ce_mode {
|
||||||
|
no_ce_mode = 0,
|
||||||
|
ce_mode_a = 1,
|
||||||
|
ce_mode_b = 2
|
||||||
|
} mac_lte_ce_mode;
|
||||||
|
|
||||||
|
typedef enum mac_lte_nb_mode {
|
||||||
|
no_nb_mode = 0,
|
||||||
|
nb_mode = 1
|
||||||
|
} mac_lte_nb_mode;
|
||||||
|
|
||||||
|
/* Context info attached to each LTE MAC frame */
|
||||||
|
typedef struct mac_lte_info
|
||||||
|
{
|
||||||
|
/* Needed for decode */
|
||||||
|
guint8 radioType;
|
||||||
|
guint8 direction;
|
||||||
|
guint8 rntiType;
|
||||||
|
|
||||||
|
/* Extra info to display */
|
||||||
|
guint16 rnti;
|
||||||
|
guint16 ueid;
|
||||||
|
|
||||||
|
/* Timing info */
|
||||||
|
guint16 sysframeNumber;
|
||||||
|
guint16 subframeNumber;
|
||||||
|
|
||||||
|
/* Optional field. More interesting for TDD (FDD is always -4 subframeNumber) */
|
||||||
|
gboolean subframeNumberOfGrantPresent;
|
||||||
|
guint16 subframeNumberOfGrant;
|
||||||
|
|
||||||
|
/* 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 */
|
||||||
|
gboolean isPredefinedData;
|
||||||
|
|
||||||
|
/* Length of DL PDU or UL grant size in bytes */
|
||||||
|
guint16 length;
|
||||||
|
|
||||||
|
/* 0=newTx, 1=first-retx, etc */
|
||||||
|
guint8 reTxCount;
|
||||||
|
guint8 isPHICHNACK; /* FALSE=PDCCH retx grant, TRUE=PHICH NACK */
|
||||||
|
|
||||||
|
/* UL only. Indicates if the R10 extendedBSR-Sizes parameter is set */
|
||||||
|
gboolean isExtendedBSRSizes;
|
||||||
|
|
||||||
|
/* UL only. Indicates if the R10 simultaneousPUCCH-PUSCH parameter is set for PCell */
|
||||||
|
gboolean isSimultPUCCHPUSCHPCell;
|
||||||
|
|
||||||
|
/* UL only. Indicates if the R10 extendedBSR-Sizes parameter is set for PSCell */
|
||||||
|
gboolean isSimultPUCCHPUSCHPSCell;
|
||||||
|
|
||||||
|
/* Status of CRC check. For UE it is DL only. For eNodeB it is UL
|
||||||
|
only. For an analyzer, it is present for both DL and UL. */
|
||||||
|
gboolean crcStatusValid;
|
||||||
|
mac_lte_crc_status crcStatus;
|
||||||
|
|
||||||
|
/* Carrier ID */
|
||||||
|
mac_lte_carrier_id carrierId;
|
||||||
|
|
||||||
|
/* DL only. Is this known to be a retransmission? */
|
||||||
|
mac_lte_dl_retx dl_retx;
|
||||||
|
|
||||||
|
/* DL only. CE mode to be used for RAR decoding */
|
||||||
|
mac_lte_ce_mode ceMode;
|
||||||
|
|
||||||
|
/* DL and UL. NB-IoT mode of the UE */
|
||||||
|
mac_lte_nb_mode nbMode;
|
||||||
|
|
||||||
|
/* More Physical layer info (see direction above for which side of union to use) */
|
||||||
|
union {
|
||||||
|
struct mac_lte_ul_phy_info
|
||||||
|
{
|
||||||
|
guint8 present; /* Remaining UL fields are present and should be displayed */
|
||||||
|
guint8 modulation_type;
|
||||||
|
guint8 tbs_index;
|
||||||
|
guint8 resource_block_length;
|
||||||
|
guint8 resource_block_start;
|
||||||
|
guint8 harq_id;
|
||||||
|
gboolean ndi;
|
||||||
|
} ul_info;
|
||||||
|
struct mac_lte_dl_phy_info
|
||||||
|
{
|
||||||
|
guint8 present; /* Remaining DL fields are present and should be displayed */
|
||||||
|
guint8 dci_format;
|
||||||
|
guint8 resource_allocation_type;
|
||||||
|
guint8 aggregation_level;
|
||||||
|
guint8 mcs_index;
|
||||||
|
guint8 redundancy_version_index;
|
||||||
|
guint8 resource_block_length;
|
||||||
|
guint8 harq_id;
|
||||||
|
gboolean ndi;
|
||||||
|
guint8 transport_block; /* 0..1 */
|
||||||
|
} dl_info;
|
||||||
|
} detailed_phy_info;
|
||||||
|
|
||||||
|
/* Relating to out-of-band events */
|
||||||
|
/* N.B. dissector will only look to these fields if length is 0... */
|
||||||
|
mac_lte_oob_event oob_event;
|
||||||
|
guint8 rapid;
|
||||||
|
guint8 rach_attempt_number;
|
||||||
|
#define MAX_SRs 20
|
||||||
|
guint16 number_of_srs;
|
||||||
|
guint16 oob_ueid[MAX_SRs];
|
||||||
|
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;
|
||||||
|
|
||||||
|
|
||||||
|
/* Accessor function to check if a frame was considered to be ReTx */
|
||||||
|
int is_mac_lte_frame_retx(packet_info *pinfo, guint8 direction);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*****************************************************************/
|
||||||
|
/* 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 dissecter (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_LTE_START_STRING "mac-lte"
|
||||||
|
|
||||||
|
/* 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_LTE_RNTI_TAG 0x02
|
||||||
|
/* 2 bytes, network order */
|
||||||
|
|
||||||
|
#define MAC_LTE_UEID_TAG 0x03
|
||||||
|
/* 2 bytes, network order */
|
||||||
|
|
||||||
|
#define MAC_LTE_FRAME_SUBFRAME_TAG 0x04
|
||||||
|
/* 2 bytes, network order, SFN is stored in 12 MSB and SF in 4 LSB */
|
||||||
|
|
||||||
|
#define MAC_LTE_PREDEFINED_DATA_TAG 0x05
|
||||||
|
/* 1 byte */
|
||||||
|
|
||||||
|
#define MAC_LTE_RETX_TAG 0x06
|
||||||
|
/* 1 byte */
|
||||||
|
|
||||||
|
#define MAC_LTE_CRC_STATUS_TAG 0x07
|
||||||
|
/* 1 byte */
|
||||||
|
|
||||||
|
#define MAC_LTE_EXT_BSR_SIZES_TAG 0x08
|
||||||
|
/* 0 byte */
|
||||||
|
|
||||||
|
#define MAC_LTE_SEND_PREAMBLE_TAG 0x09
|
||||||
|
/* 2 bytes, RAPID value (1 byte) followed by RACH attempt number (1 byte) */
|
||||||
|
|
||||||
|
#define MAC_LTE_CARRIER_ID_TAG 0x0A
|
||||||
|
/* 1 byte */
|
||||||
|
|
||||||
|
#define MAC_LTE_PHY_TAG 0x0B
|
||||||
|
/* variable length, length (1 byte) then depending on direction
|
||||||
|
in UL: modulation type (1 byte), TBS index (1 byte), RB length (1 byte),
|
||||||
|
RB start (1 byte), HARQ id (1 byte), NDI (1 byte)
|
||||||
|
in DL: DCI format (1 byte), resource allocation type (1 byte), aggregation level (1 byte),
|
||||||
|
MCS index (1 byte), redundancy version (1 byte), resource block length (1 byte),
|
||||||
|
HARQ id (1 byte), NDI (1 byte), TB (1 byte), DL reTx (1 byte) */
|
||||||
|
|
||||||
|
#define MAC_LTE_SIMULT_PUCCH_PUSCH_PCELL 0x0C
|
||||||
|
/* 0 byte */
|
||||||
|
|
||||||
|
#define MAC_LTE_SIMULT_PUCCH_PUSCH_PSCELL 0x0D
|
||||||
|
/* 0 byte */
|
||||||
|
|
||||||
|
#define MAC_LTE_CE_MODE 0x0E
|
||||||
|
/* 1 byte containing mac_lte_ce_mode enum value */
|
||||||
|
|
||||||
|
#define MAC_LTE_NB_MODE 0x0F
|
||||||
|
/* 1 byte containing mac_lte_nb_mode enum value */
|
||||||
|
|
||||||
|
/* 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
|
||||||
|
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
|
||||||
|
/* 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;
|
||||||
|
|
||||||
|
|
||||||
|
/* Set details of an LCID -> drb channel mapping. To be called from
|
||||||
|
configuration protocol (e.g. RRC) */
|
||||||
|
void set_mac_lte_channel_mapping(drb_mapping_t *drb_mapping);
|
||||||
|
|
||||||
|
|
||||||
|
/* 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;
|
||||||
|
|
||||||
|
/* 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);
|
||||||
|
|
||||||
|
/* RRC can tell this dissector which RAPIDs are Group A, Group A&B */
|
||||||
|
void set_mac_lte_rapid_ranges(guint groupA, guint all_RA);
|
||||||
|
|
||||||
|
/* RRC can indicate whether extended BSR sizes are used */
|
||||||
|
void set_mac_lte_extended_bsr_sizes(guint16 ueid, gboolean use_ext_bsr_sizes, packet_info *pinfo);
|
||||||
|
|
||||||
|
/* 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;
|
||||||
|
void set_mac_lte_simult_pucch_pusch(guint16 ueid, simult_pucch_pusch_cell_type cell_type, gboolean use_simult_pucch_pusch, packet_info *pinfo);
|
||||||
|
|
||||||
|
/* 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 */
|
||||||
|
WS_DLL_PUBLIC
|
||||||
|
mac_lte_info *get_mac_lte_proto_data(packet_info *pinfo);
|
||||||
|
WS_DLL_PUBLIC
|
||||||
|
void set_mac_lte_proto_data(packet_info *pinfo, mac_lte_info *p_mac_lte_info);
|
||||||
|
|
||||||
|
/* 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);
|
||||||
|
|
||||||
|
#endif
|
||||||
Reference in New Issue
Block a user