Class ICMP6

  • All Implemented Interfaces:
    IPacket

    public class ICMP6
    extends BasePacket
    Implements ICMPv6 packet format. (RFC 4443)
    • Field Detail

      • DEST_UNREACH

        public static final byte DEST_UNREACH
        Destination Unreachable.
        See Also:
        Constant Field Values
      • MCAST_QUERY

        public static final byte MCAST_QUERY
        Multicast Listener Query.
        See Also:
        Constant Field Values
      • MCAST_REPORT

        public static final byte MCAST_REPORT
        Multicast Listener Report.
        See Also:
        Constant Field Values
      • MCAST_DONE

        public static final byte MCAST_DONE
        Multicast Listener Done.
        See Also:
        Constant Field Values
      • ROUTER_SOLICITATION

        public static final byte ROUTER_SOLICITATION
        Router Solicitation.
        See Also:
        Constant Field Values
      • ROUTER_ADVERTISEMENT

        public static final byte ROUTER_ADVERTISEMENT
        Router Advertisement.
        See Also:
        Constant Field Values
      • NEIGHBOR_SOLICITATION

        public static final byte NEIGHBOR_SOLICITATION
        Neighbor Solicitation.
        See Also:
        Constant Field Values
      • NEIGHBOR_ADVERTISEMENT

        public static final byte NEIGHBOR_ADVERTISEMENT
        Neighbor Advertisement.
        See Also:
        Constant Field Values
      • COMM_PROHIBIT

        public static final byte COMM_PROHIBIT
        Communication with destination administratively prohibited.
        See Also:
        Constant Field Values
      • BEYOND_SCOPE

        public static final byte BEYOND_SCOPE
        Beyond scope of source address.
        See Also:
        Constant Field Values
      • ADDR_UNREACH

        public static final byte ADDR_UNREACH
        Address unreachable.
        See Also:
        Constant Field Values
      • FAIL_POLICY

        public static final byte FAIL_POLICY
        Source address failed ingress/egress policy.
        See Also:
        Constant Field Values
      • REJECT_ROUTE

        public static final byte REJECT_ROUTE
        Reject route to destination.
        See Also:
        Constant Field Values
      • SRC_ROUTING_HEADER_ERR

        public static final byte SRC_ROUTING_HEADER_ERR
        Error in Source Routing Header.
        See Also:
        Constant Field Values
      • HOP_LIMIT_EXCEED

        public static final byte HOP_LIMIT_EXCEED
        Hop limit exceeded in transit.
        See Also:
        Constant Field Values
      • DEFRAG_TIME_EXCEED

        public static final byte DEFRAG_TIME_EXCEED
        Fragment reassembly time exceeded.
        See Also:
        Constant Field Values
      • HDR_FIELD_ERR

        public static final byte HDR_FIELD_ERR
        Erroneous header field encountered.
        See Also:
        Constant Field Values
      • NEXT_HEADER_ERR

        public static final byte NEXT_HEADER_ERR
        Unrecognized Next Header type encountered.
        See Also:
        Constant Field Values
      • IPV6_OPT_ERR

        public static final byte IPV6_OPT_ERR
        Unrecognized IPv6 option encountered.
        See Also:
        Constant Field Values
      • TYPE_DESERIALIZER_MAP

        public static final java.util.Map<java.lang.Byte,​Deserializer<? extends IPacket>> TYPE_DESERIALIZER_MAP
      • icmpType

        protected byte icmpType
      • icmpCode

        protected byte icmpCode
      • checksum

        protected short checksum
    • Constructor Detail

      • ICMP6

        public ICMP6()
    • Method Detail

      • getIcmpType

        public byte getIcmpType()
        Gets ICMP6 type.
        Returns:
        the ICMP6 type
      • setIcmpType

        public ICMP6 setIcmpType​(byte icmpType)
        Sets ICMP6 type.
        Parameters:
        icmpType - the ICMP type to set
        Returns:
        this
      • getIcmpCode

        public byte getIcmpCode()
        Gets ICMP6 code.
        Returns:
        the ICMP6 code
      • setIcmpCode

        public ICMP6 setIcmpCode​(byte icmpCode)
        Sets ICMP6 code.
        Parameters:
        icmpCode - the ICMP6 code to set
        Returns:
        this
      • getChecksum

        public short getChecksum()
        Gets checksum.
        Returns:
        the checksum
      • setChecksum

        public ICMP6 setChecksum​(short checksum)
        Sets checksum.
        Parameters:
        checksum - the checksum to set
        Returns:
        this
      • serialize

        public byte[] serialize()
        Description copied from interface: IPacket
        Sets all payloads parent packet if applicable, then serializes this packet and all payloads.
        Returns:
        a byte[] containing this packet and payloads
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class BasePacket
      • deserializer

        public static Deserializer<ICMP6> deserializer()
        Deserializer function for ICMPv6 packets.
        Returns:
        deserializer function
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • buildIcmp6Reply

        public static Ethernet buildIcmp6Reply​(Ethernet ethRequest)
        Builds an ICMPv6 reply using the supplied ICMPv6 request.
        Parameters:
        ethRequest - the Ethernet packet containing the ICMPv6 ECHO request
        Returns:
        the Ethernet packet containing the ICMPv6 ECHO reply