报文分析 - 抓包
界面演示








核心接口

public interface I项目{M项目 获取项目();void 保存当前映射(List<M设备映射> 当前通信);}
public class M项目{[DBKey]public Int64 Id { get; set; }public string 名称 { get; set; }public List<M设备映射> 设备通信模板 { get; set; }public List<M设备映射> 当前通信设备 { get; set; }public List<string> 业务类型列表 { get; set; }public List<string> 设备类型列表 { get; set; }public Func<M解码前报文, M解码后报文> 解码器 { get; set; }/// <summary>/// 参数依次为: 发送方设备类型, 接收方设备类型, 功能码/// </summary>public Func<string, string, string, M功能> 功能码查询 { get; set; }public List<string> 默认内容过滤 { get; set; }public List<string> 默认业务过滤 { get; set; }public M项目(){this.默认内容过滤 = new List<string>();this.默认业务过滤 = new List<string>();}public override string ToString(){return 名称;}}
public class M设备映射{[DBKey]public Int64 Id { get; set; }public bool 启用 { get; set; }public bool TCP { get; set; }public IPAddress IP1 { get; set; }/// <summary>/// 0表示任意端口/// </summary>public int 端口1 { get; set; }public string 设备类型1 { get; set; }public IPAddress IP2 { get; set; }/// <summary>/// 0表示任意端口/// </summary>public int 端口2 { get; set; }public string 设备类型2 { get; set; }public string 协议版本号 { get; set; }}
public class M解码后报文{public DateTime 时间 { get; set; }public string 业务 { get; set; }public string 发送方 { get; set; }public string 发送方设备类型 { get; set; }public string 接收方 { get; set; }public string 接收方设备类型 { get; set; }public string 概述 { get; set; }public List<M信息> 详述 { get; set; }/// <summary>/// 传输层/// </summary>public byte[] 码流 { get; set; }public bool TCP { get; set; }public string 功能码 { get; set; }}
public class M解码前报文{public bool TCP { get; set; }public string 发送方设备类型 { get; set; }public IPAddress 发送方IP { get; set; }public int 发送方端口号 { get; set; }public string 接收方设备类型 { get; set; }public IPAddress 接收方IP { get; set; }public int 接收方端口号 { get; set; }/// <summary>/// 传输层/// </summary>public byte[] 码流 { get; set; }public DateTime 时间 { get; set; }}
public class M信息{public string 键 { get; set; }public string 值 { get; set; }public string 描述 { get; set; }public M信息 父节点 { get; set; }public List<M信息> 子节点 { get; set; }public M信息(){子节点 = new List<M信息>();}public override string ToString(){var __详述内容 = new StringBuilder();__详述内容.AppendFormat("{0} : {1}{2}", 键, 值, Environment.NewLine);递归详述(子节点, __详述内容, "--------");return __详述内容.ToString();}public static void 递归详述(List<M信息> 子节点, StringBuilder __详述内容, string __缩进){子节点.ForEach(q =>{__详述内容.AppendFormat("{0}{1} : {2}{3}", __缩进, q.键, q.值, Environment.NewLine);if (q.子节点 != null && q.子节点.Count > 0){递归详述(q.子节点, __详述内容, __缩进 + __缩进);}});}}


浙公网安备 33010602011771号