Class NeighborSolicitation

  • All Implemented Interfaces:
    IPacket

    public class NeighborSolicitation
    extends BasePacket
    Implements ICMPv6 Neighbor Solicitation packet format. (RFC 4861)
    • Constructor Detail

      • NeighborSolicitation

        public NeighborSolicitation()
    • Method Detail

      • getTargetAddress

        public byte[] getTargetAddress()
        Gets target address.
        Returns:
        the target IPv6 address
      • setTargetAddress

        public NeighborSolicitation setTargetAddress​(byte[] targetAddress)
        Sets target address.
        Parameters:
        targetAddress - the target IPv6 address to set
        Returns:
        this
      • getOptions

        public java.util.List<NeighborDiscoveryOptions.Option> getOptions()
        Gets the Neighbor Discovery Protocol packet options.
        Returns:
        the Neighbor Discovery Protocol packet options
      • addOption

        public NeighborSolicitation addOption​(byte type,
                                              byte[] data)
        Adds a Neighbor Discovery Protocol packet option.
        Parameters:
        type - the option type
        data - the option data
        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<NeighborSolicitation> deserializer()
        Deserializer function for neighbor solicitation packets.
        Returns:
        deserializer function
      • toString

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

        public static Ethernet buildNdpSolicit​(Ip6Address targetIp,
                                               Ip6Address sourceIp,
                                               Ip6Address destinationIp,
                                               MacAddress sourceMac,
                                               MacAddress destinationMac,
                                               VlanId vlan)
        Builds a NDP solicitation using the supplied parameters.
        Parameters:
        targetIp - the target ip
        sourceIp - the source ip
        destinationIp - the destination ip
        sourceMac - the source mac address
        destinationMac - the destination mac address
        vlan - the vlan id
        Returns:
        the ethernet packet containing the ndp solicitation