Exemplo n.º 1
0
            private void _parse()
            {
                _nextHeaderType = m_io.ReadU1();
                _hdrExtLen      = m_io.ReadU1();
                _body           = m_io.ReadBytes((HdrExtLen - 1));
                switch (NextHeaderType)
                {
                case 0:
                {
                    _nextHeader = new OptionHopByHop(m_io, this, m_root);
                    break;
                }

                case 6:
                {
                    _nextHeader = new TcpSegment(m_io);
                    break;
                }

                case 59:
                {
                    _nextHeader = new NoNextHeader(m_io, this, m_root);
                    break;
                }
                }
            }
Exemplo n.º 2
0
        private void _parse()
        {
            _version      = m_io.ReadBitsInt(4);
            _trafficClass = m_io.ReadBitsInt(8);
            _flowLabel    = m_io.ReadBitsInt(20);
            m_io.AlignToByte();
            _payloadLength  = m_io.ReadU2be();
            _nextHeaderType = m_io.ReadU1();
            _hopLimit       = m_io.ReadU1();
            _srcIpv6Addr    = m_io.ReadBytes(16);
            _dstIpv6Addr    = m_io.ReadBytes(16);
            switch (NextHeaderType)
            {
            case 17:
            {
                _nextHeader = new UdpDatagram(m_io);
                break;
            }

            case 0:
            {
                _nextHeader = new OptionHopByHop(m_io, this, m_root);
                break;
            }

            case 4:
            {
                _nextHeader = new Ipv4Packet(m_io);
                break;
            }

            case 6:
            {
                _nextHeader = new TcpSegment(m_io);
                break;
            }

            case 59:
            {
                _nextHeader = new NoNextHeader(m_io, this, m_root);
                break;
            }
            }
            _rest = m_io.ReadBytesFull();
        }
Exemplo n.º 3
0
        private void _read()
        {
            switch (Protocol)
            {
            case ProtocolEnum.Ipv6Nonxt: {
                _body = new NoNextHeader(m_io, this, m_root);
                break;
            }

            case ProtocolEnum.Ipv4: {
                _body = new Ipv4Packet(m_io);
                break;
            }

            case ProtocolEnum.Udp: {
                _body = new UdpDatagram(m_io);
                break;
            }

            case ProtocolEnum.Icmp: {
                _body = new IcmpPacket(m_io);
                break;
            }

            case ProtocolEnum.Hopopt: {
                _body = new OptionHopByHop(m_io, this, m_root);
                break;
            }

            case ProtocolEnum.Ipv6: {
                _body = new Ipv6Packet(m_io);
                break;
            }

            case ProtocolEnum.Tcp: {
                _body = new TcpSegment(m_io);
                break;
            }
            }
        }