Esempio n. 1
0
        /// <summary>
        /// Reads a packet entry.
        /// </summary>
        /// <param name="state">The parse state.</param>
        private static void ReadPacket(ParseState state)
        {
            XmlReader xmlReader = state.Reader;

            if (!xmlReader.ReadToDescendant("proto"))
            {
                return;
            }

            CapDataRow packetRow = null;

            state.DataRow = null;

            TSharkDataReaderCallback callback = state.Callback;

            int index = 0;

            while (true)
            {
                if (xmlReader.Name != "proto")
                {
                    if (packetRow != null && callback != null)
                    {
                        callback(packetRow);
                    }
                    return;
                }

                CapProtocol capProtocol = new CapProtocol();
                capProtocol.Packet       = state.Packet;
                capProtocol.NestingLevel = index++;

                try
                {
                    state.Protocol = capProtocol;

                    ReadProtocol(state);
                }
                finally
                {
                    state.Protocol = null;
                    if (packetRow == null)
                    {
                        packetRow = state.DataRow;
                    }
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Reads a packet entry.
        /// </summary>
        /// <param name="state">The parse state.</param>
        private static void ReadPacket(ParseState state)
        {
            XmlReader xmlReader = state.Reader;

            if (!xmlReader.ReadToDescendant("proto"))
                return;

            CapDataRow packetRow = null;
            state.DataRow = null;

            TSharkDataReaderCallback callback = state.Callback;

            int index = 0;
            while (true)
            {
                if (xmlReader.Name != "proto")
                {
                    if (packetRow != null && callback != null)
                    {
                        callback(packetRow);
                    }
                    return;
                }

                CapProtocol capProtocol = new CapProtocol();
                capProtocol.Packet = state.Packet;
                capProtocol.NestingLevel = index++;

                try
                {
                    state.Protocol = capProtocol;

                    ReadProtocol(state);
                }
                finally
                {
                    state.Protocol = null;
                    if (packetRow == null)
                    {
                        packetRow = state.DataRow;
                    }
                }
            }
        }