Class IpV4Packet.IpV4Header

    • Field Detail

      • logger

        private static final org.slf4j.Logger logger
      • VERSION_AND_IHL_OFFSET

        private static final int VERSION_AND_IHL_OFFSET
        See Also:
        Constant Field Values
      • FLAGS_AND_FRAGMENT_OFFSET_OFFSET

        private static final int FLAGS_AND_FRAGMENT_OFFSET_OFFSET
        See Also:
        Constant Field Values
      • FLAGS_AND_FRAGMENT_OFFSET_SIZE

        private static final int FLAGS_AND_FRAGMENT_OFFSET_SIZE
        See Also:
        Constant Field Values
      • HEADER_CHECKSUM_OFFSET

        private static final int HEADER_CHECKSUM_OFFSET
        See Also:
        Constant Field Values
      • ihl

        private final byte ihl
      • totalLength

        private final short totalLength
      • identification

        private final short identification
      • reservedFlag

        private final boolean reservedFlag
      • dontFragmentFlag

        private final boolean dontFragmentFlag
      • moreFragmentFlag

        private final boolean moreFragmentFlag
      • fragmentOffset

        private final short fragmentOffset
      • ttl

        private final byte ttl
      • protocol

        private final IpNumber protocol
      • headerChecksum

        private final short headerChecksum
      • srcAddr

        private final java.net.Inet4Address srcAddr
      • dstAddr

        private final java.net.Inet4Address dstAddr
      • padding

        private final byte[] padding
    • Method Detail

      • calcHeaderChecksum

        private short calcHeaderChecksum​(boolean zeroInsteadOfChecksum)
      • getIhl

        public byte getIhl()
        Returns:
        ihl
      • getIhlAsInt

        public int getIhlAsInt()
        Returns:
        ihl
      • getTotalLength

        public short getTotalLength()
        Returns:
        totalLength
      • getTotalLengthAsInt

        public int getTotalLengthAsInt()
        Returns:
        totalLength
      • getIdentification

        public short getIdentification()
        Returns:
        identification
      • getIdentificationAsInt

        public int getIdentificationAsInt()
        Returns:
        identification
      • getReservedFlag

        public boolean getReservedFlag()
        Returns:
        reservedFlag
      • getDontFragmentFlag

        public boolean getDontFragmentFlag()
        Returns:
        dontFragmentFlag
      • getMoreFragmentFlag

        public boolean getMoreFragmentFlag()
        Returns:
        moreFragmentFlag
      • getFragmentOffset

        public short getFragmentOffset()
        Returns:
        fragmentOffset
      • getTtl

        public byte getTtl()
        Returns:
        ttl
      • getTtlAsInt

        public int getTtlAsInt()
        Returns:
        ttl
      • getProtocol

        public IpNumber getProtocol()
        Specified by:
        getProtocol in interface IpPacket.IpHeader
        Returns:
        an IpNumber object which indicates the protocol of the following header.
      • getHeaderChecksum

        public short getHeaderChecksum()
        Returns:
        headerChecksum
      • getPadding

        public byte[] getPadding()
        Returns:
        padding
      • hasValidChecksum

        public boolean hasValidChecksum​(boolean acceptZero)
        Parameters:
        acceptZero - acceptZero
        Returns:
        true if the packet represented by this object has a valid checksum; false otherwise.
      • getRawFields

        private java.util.List<byte[]> getRawFields​(boolean zeroInsteadOfChecksum)
      • buildRawData

        private byte[] buildRawData​(boolean zeroInsteadOfChecksum)
      • measureLengthWithoutPadding

        private int measureLengthWithoutPadding()