#include <epan/tap.h>
#include "packet-mac-lte.h"
+#include "packet-rlc-lte.h"
/* Described in:
/* Whether should attempt to dissect frames failing CRC check */
static gboolean global_mac_lte_dissect_crc_failures = FALSE;
+/* Whether should attempt to decode lcid 1&2 SDUs as srb1/2 (i.e. AM RLC) */
+static gboolean global_mac_lte_attempt_srb_decode = FALSE;
+extern int proto_rlc_lte;
+
/***************************************************************/
/* Keeping track of Msg3 bodies so they can be compared with */
/* Contention Resolution bodies. */
break;
}
+ /* Work out length */
data_length = (pdu_lengths[n] == -1) ?
tvb_length_remaining(tvb, offset) :
pdu_lengths[n];
ENDTRY
}
+ /* LCID 1 and 2 can be assumed to be srb1&2, so can dissect as RLC AM */
+ if (((lcids[n] == 1) || (lcids[n] == 2)) && global_mac_lte_attempt_srb_decode) {
+ tvbuff_t *srb_tvb = tvb_new_subset(tvb, offset, data_length, data_length);
+ struct rlc_lte_info *p_rlc_lte_info;
+
+ /* Get RLC dissector handle */
+ volatile dissector_handle_t protocol_handle = find_dissector("rlc-lte");
+
+ /* Resuse or create RLC info */
+ p_rlc_lte_info = p_get_proto_data(pinfo->fd, proto_rlc_lte);
+ if (p_rlc_lte_info == NULL) {
+ p_rlc_lte_info = se_alloc0(sizeof(struct rlc_lte_info));
+ }
+
+ /* Fill in struct details for srb channels */
+ p_rlc_lte_info->rlcMode = RLC_AM_MODE;
+ p_rlc_lte_info->direction = p_mac_lte_info->direction;
+ p_rlc_lte_info->priority = 0; /* ?? */
+ p_rlc_lte_info->ueid = p_mac_lte_info->ueid;
+ p_rlc_lte_info->channelType = CHANNEL_TYPE_SRB;
+ p_rlc_lte_info->channelId = lcids[n];
+ p_rlc_lte_info->pduLength = data_length;
+ p_rlc_lte_info->UMSequenceNumberLength = 0;
+
+ /* Store info in packet */
+ p_add_proto_data(pinfo->fd, proto_rlc_lte, p_rlc_lte_info);
+
+ /* Hide raw view of bytes */
+ PROTO_ITEM_SET_HIDDEN(sdu_ti);
+
+ /* Don't want these columns replaced */
+ col_set_writable(pinfo->cinfo, FALSE);
+
+ /* Call it (catch exceptions so that stats will be updated) */
+ TRY {
+ call_dissector_only(protocol_handle, srb_tvb, pinfo, tree);
+ }
+ CATCH_ALL {
+ }
+ ENDTRY
+
+ col_set_writable(pinfo->cinfo, TRUE);
+ }
+
+
offset += data_length;
/* Update tap byte count for this channel */
"UDP framing",
&global_mac_lte_heur);
+ prefs_register_bool_preference(mac_lte_module, "attempt_to_dissect_srb_sdus",
+ "Attempt to dissect LCID 1&2 as srb1&2",
+ "Will call LTE RLC dissector with standard settings as per RRC spec",
+ &global_mac_lte_attempt_srb_decode);
+
+
register_init_routine(&mac_lte_init_protocol);
}
/* Read next extension */
proto_tree_add_bits_ret_val(extension_part_tree, hf_rlc_lte_extension_e, tvb,
- (offset*8) + ((isOdd) ? 4 : 0),
+ (offset*8) + ((isOdd) ? 4 : 0),
1,
&extension, FALSE);
/* Read length field */
proto_tree_add_bits_ret_val(extension_part_tree, hf_rlc_lte_extension_li, tvb,
- (offset*8) + ((isOdd) ? 5 : 1),
+ (offset*8) + ((isOdd) ? 5 : 1),
11,
&length, FALSE);
} else {
offset++;
}
-
+
s_lengths[s_number_of_extensions++] = (guint16)length;
}
void dissect_rlc_lte(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
proto_tree *rlc_lte_tree;
+ proto_item *top_ti;
proto_item *ti;
proto_item *mode_ti;
gint offset = 0;
col_set_str(pinfo->cinfo, COL_PROTOCOL, "RLC-LTE");
/* Create protocol tree. */
- ti = proto_tree_add_item(tree, proto_rlc_lte, tvb, offset, -1, FALSE);
- rlc_lte_tree = proto_item_add_subtree(ti, ett_rlc_lte);
+ top_ti = proto_tree_add_item(tree, proto_rlc_lte, tvb, offset, -1, FALSE);
+ rlc_lte_tree = proto_item_add_subtree(top_ti, ett_rlc_lte);
/* Look for packet info! */
PROTO_ITEM_SET_GENERATED(ti);
}
+ /* Append channel info to top-level item */
+ if (p_rlc_lte_info->channelId == 0) {
+ proto_item_append_text(top_ti, " (%s)",
+ val_to_str(p_rlc_lte_info->channelType, rlc_channel_type_vals, "Unknown"));
+ }
+ else {
+ proto_item_append_text(top_ti, " (%s:%u)",
+ val_to_str(p_rlc_lte_info->channelType, rlc_channel_type_vals, "Unknown"),
+ p_rlc_lte_info->channelId);
+ }
+
/* Append context highlights to info column */
col_add_fstr(pinfo->cinfo, COL_INFO,