コード例 #1
0
        private void _read()
        {
            _dstMac    = m_io.ReadBytes(6);
            _srcMac    = m_io.ReadBytes(6);
            _etherType = ((EtherTypeEnum)m_io.ReadU2be());
            switch (EtherType)
            {
            case EtherTypeEnum.Ipv4:
            {
                __raw_body = m_io.ReadBytesFull();
                var io___raw_body = new KaitaiStream(__raw_body);
                _body = new Ipv4Packet(io___raw_body);
                break;
            }

            case EtherTypeEnum.Ipv6:
            {
                __raw_body = m_io.ReadBytesFull();
                var io___raw_body = new KaitaiStream(__raw_body);
                _body = new Ipv6Packet(io___raw_body);
                break;
            }

            default:
            {
                _body = m_io.ReadBytesFull();
                break;
            }
            }
        }
コード例 #2
0
        private void _read()
        {
            _b1             = m_io.ReadU1();
            _b2             = m_io.ReadU1();
            _totalLength    = m_io.ReadU2be();
            _identification = m_io.ReadU2be();
            _b67            = m_io.ReadU2be();
            _ttl            = m_io.ReadU1();
            _protocol       = ((ProtocolEnum)m_io.ReadU1());
            _headerChecksum = m_io.ReadU2be();
            _srcIpAddr      = m_io.ReadBytes(4);
            _dstIpAddr      = m_io.ReadBytes(4);
            __raw_options   = m_io.ReadBytes((IhlBytes - 20));
            var io___raw_options = new KaitaiStream(__raw_options);

            _options = new Ipv4Options(io___raw_options, this, m_root);
            switch (Protocol)
            {
            case ProtocolEnum.Tcp:
            {
                __raw_body = m_io.ReadBytes((TotalLength - IhlBytes));
                var io___raw_body = new KaitaiStream(__raw_body);
                _body = new TcpSegment(io___raw_body);
                break;
            }

            case ProtocolEnum.Icmp:
            {
                __raw_body = m_io.ReadBytes((TotalLength - IhlBytes));
                var io___raw_body = new KaitaiStream(__raw_body);
                _body = new IcmpPacket(io___raw_body);
                break;
            }

            case ProtocolEnum.Udp:
            {
                __raw_body = m_io.ReadBytes((TotalLength - IhlBytes));
                var io___raw_body = new KaitaiStream(__raw_body);
                _body = new UdpDatagram(io___raw_body);
                break;
            }

            case ProtocolEnum.Ipv6:
            {
                __raw_body = m_io.ReadBytes((TotalLength - IhlBytes));
                var io___raw_body = new KaitaiStream(__raw_body);
                _body = new Ipv6Packet(io___raw_body);
                break;
            }

            default:
            {
                _body = m_io.ReadBytes((TotalLength - IhlBytes));
                break;
            }
            }
        }
コード例 #3
0
 public NoNextHeader(KaitaiStream p__io, KaitaiStruct p__parent = null, Ipv6Packet p__root = null) : base(p__io)
 {
     m_parent = p__parent;
     m_root   = p__root;
     _read();
 }
コード例 #4
0
 public Ipv6Packet(KaitaiStream p__io, KaitaiStruct p__parent = null, Ipv6Packet p__root = null) : base(p__io)
 {
     m_parent = p__parent;
     m_root   = p__root ?? this;
     _read();
 }
コード例 #5
0
 public OptionHopByHop(KaitaiStream p__io, KaitaiStruct p__parent = null, Ipv6Packet p__root = null) : base(p__io)
 {
     m_parent = p__parent;
     m_root   = p__root;
     _read();
 }