You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
103 lines
3.6 KiB
103 lines
3.6 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using CoreAgent.ProtocolClient.Context;
|
|
using CoreAgent.ProtocolClient.Enums;
|
|
using CoreAgent.ProtocolClient.Models;
|
|
|
|
namespace CoreAgent.ProtocolClient.BuildProtocolParser
|
|
{
|
|
public class RRCProtocolParser: IGeneralProtocolParser
|
|
{
|
|
private readonly ProtocolClientContext context;
|
|
public RRCProtocolParser(ProtocolClientContext context)
|
|
{
|
|
this.context = context;
|
|
}
|
|
public void GeneralParse(ref BuildProtocolLog log)
|
|
{
|
|
var rrcUeIdMatch = ProtocolLogPatterns.RegExpRRC_UE_ID.Match(log.Message);
|
|
if (rrcUeIdMatch.Success)
|
|
{
|
|
SetSameUe(log, int.Parse(rrcUeIdMatch.Groups[1].Value, System.Globalization.NumberStyles.HexNumber));
|
|
return;
|
|
}
|
|
var rrcInfoMatch = ProtocolLogPatterns.RegExpInfo1.Match(log.Message);
|
|
if (rrcInfoMatch.Success)
|
|
{
|
|
var info = context.UeIdentifier.StringToId(rrcInfoMatch.Groups[1].Value);
|
|
if (info == -1) return;
|
|
log.Message = rrcInfoMatch.Groups[2].Value;
|
|
log.Info = info;
|
|
log.Message = rrcInfoMatch.Groups[2].Value;
|
|
ProcessRrcLog(log);
|
|
}
|
|
|
|
var rrcBcMatch = ProtocolLogPatterns.RegExpRRC_BC.Match(log.Message);
|
|
if (rrcBcMatch.Success)
|
|
{
|
|
//var data = string.Join("\n", lo);
|
|
}
|
|
}
|
|
|
|
private void SetSameUe(BuildProtocolLog log, int ueId)
|
|
{
|
|
log.UeId = ueId;
|
|
if (!context.UeIdentifier.UeList.ContainsKey(ueId))
|
|
{
|
|
context.UeIdentifier.UeList[ueId] = new UEInfo { UeId = ueId };
|
|
}
|
|
}
|
|
|
|
private void ProcessRrcLog(BuildProtocolLog log)
|
|
{
|
|
switch (log.Message.ToLowerInvariant())
|
|
{
|
|
case "sib1":
|
|
LogParseSIB1(log);
|
|
break;
|
|
case "sib":
|
|
LogParseSIB(log);
|
|
break;
|
|
case "rrc connection request":
|
|
var m1 = ProtocolLogPatterns.RegExpRRC_TMSI.FindData(log.Data);
|
|
if (m1?.Success == true)
|
|
context.UeIdentifier.SetTmsi(log.UeId.Value, m1.Groups[2].Value);
|
|
break;
|
|
case "rrc connection reconfiguration":
|
|
var m2 = ProtocolLogPatterns.RegExpRRC_NEW_ID.FindData(log.Data);
|
|
if (m2?.Success == true)
|
|
context.UeIdentifier.SetRnti(log, m2.Groups[1].Value);
|
|
break;
|
|
case "rrc connection reestablishment request":
|
|
var m3 = ProtocolLogPatterns.RegExpRRC_CRNTI.FindData(log.Data);
|
|
if (m3?.Success == true)
|
|
context.UeIdentifier.SetRnti(log, m3.Groups[1].Value);
|
|
break;
|
|
case "ue capability information":
|
|
if (log.UeId is not null)
|
|
{
|
|
context.UeIdentifier.GetUeCaps(log.UeId.Value).Data.Add(log.GetProtocolLogData());
|
|
}
|
|
break;
|
|
}
|
|
if ((int)LogChannelId.BCCH_NR == (log.Info ?? -1))
|
|
{
|
|
// var cell = GetCell(log.Cell);
|
|
// cell?.SetRat("nr");
|
|
}
|
|
}
|
|
|
|
private void LogParseSIB1(BuildProtocolLog log)
|
|
{
|
|
|
|
}
|
|
|
|
private void LogParseSIB(BuildProtocolLog log)
|
|
{
|
|
|
|
}
|
|
}
|
|
}
|
|
|