using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; using CoreAgent.ProtocolClient.BuildProtocolParser; namespace CoreAgent.ProtocolClient.Models { /// /// 构建协议日志模型 /// public class BuildProtocolLog { #region 基础属性 /// /// 日志唯一标识符 /// public int Id { get; set; } /// /// 时间戳(毫秒) /// public long Timestamp { get; set; } /// /// 协议层(PHY, RRC, NAS, MAC等) /// public string Layer { get; set; } = string.Empty; /// /// 传输方向(UL/DL) /// public int Direction { get; set; } /// /// 消息内容 /// public string Message { get; set; } = string.Empty; /// /// 消息信息类型 /// public int? Info { get; set; } /// /// UE标识符 /// public int? UeId { get; set; } /// /// RNTI(无线网络临时标识符) /// public int? Rnti { get; set; } /// /// 日志数据内容 /// public List Data { get; set; } = new(); /// /// 是否已解码 /// public bool Decoded { get; set; } /// /// 标记信息 /// public string? Marker { get; set; } /// /// SIP原始消息内容 /// public string? Msg0 { get; set; } /// /// 小区标识(所有层通用) /// public int? Cell { get; set; } #endregion #region PHY层相关属性 public PhyLayerFields Phy { get; set; } = new(); #endregion #region 数据相关属性 public DataLayerFields DataInfo { get; set; } = new(); #endregion #region MAC层相关属性 public MacLayerFields Mac { get; set; } = new(); #endregion #region public SIPLayerFields SIP { get; set; } = new (); #endregion } // PHY层分组 public class PhyLayerFields { /// /// 物理信道类型 /// public string? Channel { get; set; } /// /// 帧号 /// public int? Frame { get; set; } /// /// 子帧号 /// public int? Subframe { get; set; } /// /// 时隙号 /// public int? Slot { get; set; } /// /// 符号号 /// public int? Symbol { get; set; } /// /// 天线端口 /// public int? AntennaPort { get; set; } /// /// 资源块起始位置 /// public int? RbStart { get; set; } /// /// 资源块数量 /// public int? RbCount { get; set; } /// /// 调制编码方案 /// public int? Mcs { get; set; } /// /// 传输块大小 /// public int? Tbs { get; set; } /// /// HARQ进程ID /// public int? HarqId { get; set; } /// /// HARQ新数据指示 /// public bool? HarqNdi { get; set; } /// /// HARQ重传次数 /// public int? HarqRedundancyVersion { get; set; } } // 数据相关分组 public class DataLayerFields { /// /// IP长度 /// public int? IpLen { get; set; } /// /// SDU长度 /// public int? SduLen { get; set; } /// /// 链路ID /// public LinkIds? LinkIds { get; set; } /// /// 信号记录 /// public Dictionary? SignalRecord { get; set; } } // MAC层分组 public class MacLayerFields { /// /// 功率余量报告(PHR) /// public int? Phr { get; set; } /// /// 上行缓冲区大小 /// public int? UlBufferSize { get; set; } /// /// MAC填充长度 /// public int? MacPad { get; set; } /// /// MAC数据长度 /// public int? MacLen { get; set; } /// /// 定时提前量(TA) /// public int? Ta { get; set; } } public class LinkIds { /// /// Core链路ID /// public int? Core { get; set; } /// /// Ran链路ID /// public int? Ran { get; set; } } public class SIPLayerFields { /// /// PLMN标识 /// public string? Plmn { get; set; } = string.Empty; /// /// IMSI标识 /// public string? IMSI { get; set; } = string.Empty; } /// /// BuildProtocolLog扩展方法类 /// 提供BuildProtocolLog相关的工具方法和扩展功能 /// public static class BuildProtocolLogExtensions { /// /// 获取协议日志数据的字符串表示 /// /// 协议日志对象 /// 格式化的日志数据字符串 public static string GetProtocolLogData(this BuildProtocolLog log) { return string.Join("\n", log.Data); } } }