Пример #1
0
 public PacketSaveDataNG(HexStreamType type, string packetData)
 {
     Type       = type;
     PacketData = packetData;
     Metadata   = new Dictionary <string, string>();
     Details    = new Dictionary <string, string>();
 }
Пример #2
0
 public PacketSaveDataV2(string text, HexStreamType type, string streamId, string ppid)
 {
     _text     = text;
     _type     = type;
     _streamId = streamId;
     _ppid     = ppid;
 }
Пример #3
0
 public PacketSaveDataV3(string text, HexStreamType type, string linkLayerType, string streamId, string payloadProtoId, string extension)
 {
     _text           = text;
     _linkLayerType  = linkLayerType;
     _type           = type;
     _streamId       = streamId;
     _payloadProtoId = payloadProtoId;
     _extension      = extension;
 }
Пример #4
0
        public static PacketSaveDataV2 Parse(string str)
        {
            string[] splitted = str.Split('~');
            string   text     = new string(Convert.FromBase64String(splitted[0]).Select(b => (char)b).ToArray());

            string hexStreamText = splitted[1];

            // HACK: The enum member used to be called Raw Ethernet before it turned into the more generic 'raw' option
            if (hexStreamText == "RawEthernet")
            {
                hexStreamText = "Raw";
            }
            HexStreamType type = (HexStreamType)(Enum.Parse(typeof(HexStreamType), hexStreamText));

            string streamID = new string(Convert.FromBase64String(splitted[2]).Select(b => (char)b).ToArray());
            string ppid     = new string(Convert.FromBase64String(splitted[3]).Select(b => (char)b).ToArray());

            return(new PacketSaveDataV2(text, type, streamID, ppid));
        }
        static PacketsDefinersDictionaries()
        {
            IEnumerable <Type> packetDefiners = typeof(PacketsDefinersDictionaries).Assembly.GetTypes()
                                                .Where(classType => classType.IsSubclassOf(typeof(UserControl)))
                                                .Where(classType => classType.GetInterface(nameof(IPacketDefiner)) != null);


            Dictionary <HexStreamType, int> StreamTypeToFirstOffsetTemp = new Dictionary <HexStreamType, int>();

            StreamTypeToFirstOffset = StreamTypeToFirstOffsetTemp;
            Dictionary <HexStreamType, Func <Control> > StreamTypeToPacketDefineControlFactoryTemp = new Dictionary <HexStreamType, Func <Control> >();

            StreamTypeToPacketDefineControlFactory = StreamTypeToPacketDefineControlFactoryTemp;
            foreach (Type packetDefiner in packetDefiners)
            {
                Func <Control> creationFunc = () => Activator.CreateInstance(packetDefiner) as Control;
                IPacketDefiner prototype    = Activator.CreateInstance(packetDefiner) as IPacketDefiner;
                HexStreamType  hexType      = prototype.StreamType;
                int            headersLen   = prototype.HeadersLength;
                StreamTypeToFirstOffsetTemp[hexType] = headersLen;
                StreamTypeToPacketDefineControlFactoryTemp[hexType] = creationFunc;
            }
        }
 public HexStreamTypeAttribute(HexStreamType streamType)
 {
     StreamType = streamType;
 }
Пример #7
0
        public static PacketSaveData GetPacketSaveData(string hex, HexStreamType streamType, LinkLayerType linkType, string streamId, string ppId, string ext = "")
        {
            string linkTypeStr = ((byte)linkType).ToString();

            return(GetPacketSaveData(hex, streamType, linkTypeStr, streamId, ppId, ext));
        }
Пример #8
0
 public static PacketSaveData GetPacketSaveData(string hex, HexStreamType streamType, string linkType, string streamId, string ppId, string ext = "")
 {
     return(new PacketSaveDataV3(hex, streamType, linkType, streamId, ppId, ext));
 }
Пример #9
0
 public HexTypeWrapper(HexStreamType type)
 {
     Type = type;
 }