basic PcapParser

This commit is contained in:
raphaeIl
2025-01-13 01:48:33 -05:00
parent 71f602b7fe
commit fe09261f42
22 changed files with 8753 additions and 42 deletions

View File

@@ -46,7 +46,7 @@ namespace Novaria.SDKServer.Controllers.Api
NetMsgId msgid = (NetMsgId)requestPacket.msgId;
Log.Information("Received protocol msgid: " + msgid);
Type requestType = protocolHandlerFactory.GetRequestPacketTypeByProtocol(msgid);
Type requestType = ProtocolHandlerFactory.GetRequestPacketTypeByProtocol(msgid);
if (requestType is null)
{

View File

@@ -21,7 +21,6 @@ namespace Novaria.SDKServer.Controllers.Api.ProtocolHandlers
{
public object? Invoke(NetMsgId protocol, IMessage? req);
public MethodInfo? GetProtocolHandler(NetMsgId protocol);
public Type? GetRequestPacketTypeByProtocol(NetMsgId protocol);
public void RegisterInstance(Type t, object? inst);
}
@@ -621,8 +620,13 @@ namespace Novaria.SDKServer.Controllers.Api.ProtocolHandlers
return handler;
}
public Type? GetRequestPacketTypeByProtocol(NetMsgId msgId)
public static Type? GetRequestPacketTypeByProtocol(NetMsgId msgId)
{
if (!ProtocolHandlerFactory.NetMsgIdToNameMappings.ContainsKey((short)msgId))
{
return null;
}
string msgIdClassName = ProtocolHandlerFactory.NetMsgIdToNameMappings[(short)msgId];
Type packetClassType = Assembly.GetAssembly(typeof(LoginReq))!.GetTypes().Where(x => x.Name == msgIdClassName).SingleOrDefault();