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.
34 lines
1.0 KiB
34 lines
1.0 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using CoreAgent.ProtocolClient.Context;
|
|
|
|
namespace CoreAgent.ProtocolClient.BuildProtocolParser
|
|
{
|
|
public class ProtocolContextParser
|
|
{
|
|
private readonly ProtocolClientContext context;
|
|
private readonly Dictionary<string, IGeneralProtocolParser> parsers = new();
|
|
|
|
public ProtocolContextParser(ProtocolClientContext context)
|
|
{
|
|
this.context = context;
|
|
InitializeParsers();
|
|
}
|
|
|
|
private void InitializeParsers()
|
|
{
|
|
parsers.Add("RRC", new RRCProtocolParser(context));
|
|
parsers.Add("NAS", new NASProtocolParser(context));
|
|
parsers.Add("SIP", new SIPProtocolParser(context));
|
|
}
|
|
|
|
public IGeneralProtocolParser GetParserByKey(string protocolKey)
|
|
{
|
|
parsers.TryGetValue(protocolKey, out var parser);
|
|
return parser ?? new EmptyProtocolParser(context);
|
|
}
|
|
}
|
|
}
|
|
|