aboutsummaryrefslogtreecommitdiffstats
path: root/epan
diff options
context:
space:
mode:
authorMartin Mathieson <martin.r.mathieson@googlemail.com>2009-10-26 15:39:00 +0000
committerMartin Mathieson <martin.r.mathieson@googlemail.com>2009-10-26 15:39:00 +0000
commitafffcffff976a6613a069de11e79a3b55f227fed (patch)
treef7d9614a41f7388d3b9717723947ecfb40b0e228 /epan
parent6d8f1356ba1446eac15b5af3de6dd3209101fba9 (diff)
Add support for displaying/filtering some LTE MAC out-of-band events.
svn path=/trunk/; revision=30711
Diffstat (limited to 'epan')
-rw-r--r--epan/dissectors/packet-catapult-dct2000.c79
-rw-r--r--epan/dissectors/packet-mac-lte.c104
-rw-r--r--epan/dissectors/packet-mac-lte.h11
3 files changed, 193 insertions, 1 deletions
diff --git a/epan/dissectors/packet-catapult-dct2000.c b/epan/dissectors/packet-catapult-dct2000.c
index 0b89ad0c27..3251f57bcd 100644
--- a/epan/dissectors/packet-catapult-dct2000.c
+++ b/epan/dissectors/packet-catapult-dct2000.c
@@ -28,6 +28,7 @@
#include <glib.h>
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
@@ -1415,6 +1416,81 @@ static void dissect_tty_lines(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre
}
+/* Scan the log comment looking for notable out-of-band MAC events that should
+ be sent to the MAC dissector */
+static void check_for_oob_mac_lte_events(packet_info *pinfo, tvbuff_t *tvb, proto_tree *tree,
+ const char *string)
+{
+ guint ueid;
+ guint rnti;
+ guint rapid;
+ guint rach_attempt_number;
+ mac_lte_oob_event oob_event;
+ struct mac_lte_info *p_mac_lte_info;
+ tvbuff_t *mac_lte_tvb = NULL;
+
+ /* Look for strings matching expected formats */
+ if (sscanf(string, ">> RACH Preamble Request[UE = %u] [RAPID = %u] [Attempt = %u]",
+ &ueid, &rapid, &rach_attempt_number) == 3) {
+ oob_event = ltemac_send_preamble;
+ }
+ else
+ if (sscanf(string, ">> Schedule Request[UE = %u] [RNTI = %u]", &ueid, &rnti) == 2) {
+ oob_event = ltemac_send_sr;
+ }
+ else
+ if (sscanf(string, ">> INFO MAC: ProcessSRInd - CRNTI=%u", &rnti) == 1) {
+ oob_event = ltemac_sr_failure;
+ }
+ else {
+ /* No events found */
+ return;
+ }
+
+ /* We have an event */
+ /* Only need to set info once per session. */
+ p_mac_lte_info = p_get_proto_data(pinfo->fd, proto_mac_lte);
+ if (p_mac_lte_info == NULL) {
+
+ /* Allocate & zero struct */
+ p_mac_lte_info = se_alloc0(sizeof(struct mac_lte_info));
+ if (p_mac_lte_info == NULL) {
+ return;
+ }
+
+ /* This indicates to MAC dissector that it has an oob event */
+ p_mac_lte_info->length = 0;
+
+ switch (oob_event) {
+ case ltemac_send_preamble:
+ p_mac_lte_info->ueid = ueid;
+ p_mac_lte_info->rapid = rapid;
+ p_mac_lte_info->rach_attempt_number = rach_attempt_number;
+ p_mac_lte_info->direction = DIRECTION_UPLINK;
+ break;
+ case ltemac_send_sr:
+ p_mac_lte_info->ueid = ueid;
+ p_mac_lte_info->rnti = rnti;
+ p_mac_lte_info->direction = DIRECTION_UPLINK;
+ break;
+ case ltemac_sr_failure:
+ p_mac_lte_info->rnti = rnti;
+ p_mac_lte_info->direction = DIRECTION_DOWNLINK;
+ break;
+ }
+
+ p_mac_lte_info->oob_event = oob_event;
+
+ /* Store info in packet */
+ p_add_proto_data(pinfo->fd, proto_mac_lte, p_mac_lte_info);
+ }
+
+ /* Call MAC dissector */
+ mac_lte_tvb = tvb_new_subset(tvb, 0, 0, 0);
+ call_dissector_only(mac_lte_handle, mac_lte_tvb, pinfo, tree);
+}
+
+
/*****************************************/
/* Main dissection function. */
/*****************************************/
@@ -1695,7 +1771,8 @@ dissect_catapult_dct2000(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
offset, -1, FALSE);
col_append_fstr(pinfo->cinfo, COL_INFO, "%s", string);
- /* TODO: look into string for out-of-band MAC events, such as SRReq, SRInd */
+ /* Look into string for out-of-band MAC events, such as SRReq, SRInd */
+ check_for_oob_mac_lte_events(pinfo, tvb, tree, string);
return;
}
diff --git a/epan/dissectors/packet-mac-lte.c b/epan/dissectors/packet-mac-lte.c
index d4eb4e465c..3804e8ab36 100644
--- a/epan/dissectors/packet-mac-lte.c
+++ b/epan/dissectors/packet-mac-lte.c
@@ -65,6 +65,13 @@ static int hf_mac_lte_context_ul_grant_size = -1;
static int hf_mac_lte_context_bch_transport_channel = -1;
static int hf_mac_lte_context_retx_count = -1;
static int hf_mac_lte_context_crc_status = -1;
+static int hf_mac_lte_context_rapid = -1;
+static int hf_mac_lte_context_rach_attempt_number = -1;
+
+/* Out-of-band events */
+static int hf_mac_lte_oob_send_preamble = -1;
+static int hf_mac_lte_oob_send_sr = -1;
+static int hf_mac_lte_oob_sr_failure = -1;
/* MAC SCH header fields */
static int hf_mac_lte_ulsch_header = -1;
@@ -1923,6 +1930,72 @@ void dissect_mac_lte(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
PROTO_ITEM_SET_GENERATED(ti);
}
+ /* There are several out-of-band MAC events that may be indicated in the context info. */
+ /* Handle them here */
+ if (p_mac_lte_info->length == 0) {
+ switch (p_mac_lte_info->oob_event) {
+ case ltemac_send_preamble:
+ ti = proto_tree_add_uint(mac_lte_tree, hf_mac_lte_context_rapid,
+ tvb, 0, 0, p_mac_lte_info->rapid);
+ PROTO_ITEM_SET_GENERATED(ti);
+ ti = proto_tree_add_uint(mac_lte_tree, hf_mac_lte_context_rach_attempt_number,
+ tvb, 0, 0, p_mac_lte_info->rach_attempt_number);
+ PROTO_ITEM_SET_GENERATED(ti);
+ ti = proto_tree_add_item(mac_lte_tree, hf_mac_lte_oob_send_preamble,
+ tvb, 0, 0, FALSE);
+ PROTO_ITEM_SET_GENERATED(ti);
+
+ /* Info column */
+ col_append_fstr(pinfo->cinfo, COL_INFO, "RACH Preamble sent (RAPID=%u, attempt=%u)",
+ p_mac_lte_info->rapid, p_mac_lte_info->rach_attempt_number);
+
+ /* Add expert info (an note) */
+ expert_add_info_format(pinfo, ti, PI_SEQUENCE, PI_NOTE,
+ "RACH Preamble sent for ueid %u (RAPID=%u, attempt=%u)",
+ p_mac_lte_info->ueid, p_mac_lte_info->rapid,
+ p_mac_lte_info->rach_attempt_number);
+ break;
+ case ltemac_send_sr:
+ ti = proto_tree_add_uint(mac_lte_tree, hf_mac_lte_context_rnti,
+ tvb, 0, 0, p_mac_lte_info->rnti);
+ PROTO_ITEM_SET_GENERATED(ti);
+ ti = proto_tree_add_item(mac_lte_tree, hf_mac_lte_oob_send_sr,
+ tvb, 0, 0, FALSE);
+ PROTO_ITEM_SET_GENERATED(ti);
+
+ /* Info column */
+ col_append_fstr(pinfo->cinfo, COL_INFO, "Scheduling Request sent (C-RNTI=%u)",
+ p_mac_lte_info->rnti);
+
+ /* Add expert info (an note) */
+ expert_add_info_format(pinfo, ti, PI_SEQUENCE, PI_NOTE,
+ "Scheduling Request send to RNTI %u (UEId %u)",
+ p_mac_lte_info->rnti, p_mac_lte_info->ueid);
+ break;
+ case ltemac_sr_failure:
+ ti = proto_tree_add_uint(mac_lte_tree, hf_mac_lte_context_rnti,
+ tvb, 0, 0, p_mac_lte_info->rnti);
+ PROTO_ITEM_SET_GENERATED(ti);
+ ti = proto_tree_add_item(mac_lte_tree, hf_mac_lte_oob_sr_failure,
+ tvb, 0, 0, FALSE);
+ PROTO_ITEM_SET_GENERATED(ti);
+
+ /* Info column */
+ col_append_fstr(pinfo->cinfo, COL_INFO, "Scheduling Request FAILED (C-RNTI=%u)!",
+ p_mac_lte_info->rnti);
+
+ /* Add expert info (an error) */
+ expert_add_info_format(pinfo, ti, PI_SEQUENCE, PI_ERROR,
+ "Scheduling Request failed for RNTI %u",
+ p_mac_lte_info->rnti);
+ break;
+ }
+
+ /* Our work here is done */
+ return;
+ }
+
+
ti = proto_tree_add_uint(mac_lte_tree, hf_mac_lte_context_subframe_number,
tvb, 0, 0, p_mac_lte_info->subframeNumber);
PROTO_ITEM_SET_GENERATED(ti);
@@ -2196,7 +2269,38 @@ void proto_register_mac_lte(void)
"CRC Status as reported by PHY", HFILL
}
},
+ { &hf_mac_lte_context_rapid,
+ { "RAPID",
+ "mac-lte.preamble-sent.rapid", FT_UINT8, BASE_DEC, 0, 0x0,
+ "RAPID sent in RACH preamble", HFILL
+ }
+ },
+ { &hf_mac_lte_context_rach_attempt_number,
+ { "RACH Attempt Number",
+ "mac-lte.preamble-send.attempt", FT_UINT8, BASE_DEC, 0, 0x0,
+ "RACH attempt number", HFILL
+ }
+ },
+ /* Out-of-band events */
+ { &hf_mac_lte_oob_send_preamble,
+ { "RACH Preamble sent",
+ "mac-lte.preamble-sent", FT_NONE, BASE_NONE, NULL, 0x0,
+ NULL, HFILL
+ }
+ },
+ { &hf_mac_lte_oob_send_sr,
+ { "Scheduling Request sent",
+ "mac-lte.sr-req", FT_NONE, BASE_NONE, NULL, 0x0,
+ NULL, HFILL
+ }
+ },
+ { &hf_mac_lte_oob_sr_failure,
+ { "Scheduling Request Failure",
+ "mac-lte.sr-failure", FT_NONE, BASE_NONE, NULL, 0x0,
+ NULL, HFILL
+ }
+ },
/*******************************************/
/* MAC shared channel header fields */
diff --git a/epan/dissectors/packet-mac-lte.h b/epan/dissectors/packet-mac-lte.h
index b431431f1f..99cbf7f260 100644
--- a/epan/dissectors/packet-mac-lte.h
+++ b/epan/dissectors/packet-mac-lte.h
@@ -65,6 +65,12 @@
#define SPS_RNTI 5
+typedef enum mac_lte_oob_event {
+ ltemac_send_preamble,
+ ltemac_send_sr,
+ ltemac_sr_failure
+} mac_lte_oob_event;
+
/* Context info attached to each LTE MAC frame */
typedef struct mac_lte_info
{
@@ -82,6 +88,11 @@ typedef struct mac_lte_info
guint8 reTxCount;
guint8 crcStatusValid;
guint8 crcStatus;
+
+ /* Relating to out-of-band events */
+ mac_lte_oob_event oob_event;
+ guint8 rapid;
+ guint8 rach_attempt_number;
} mac_lte_info;