Class RouterAdvertisement

  • All Implemented Interfaces:
    IPacket

    public class RouterAdvertisement
    extends BasePacket
    Implements ICMPv6 Router Advertisement packet format. (RFC 4861)
    • Field Detail

      • currentHopLimit

        protected byte currentHopLimit
      • mFlag

        protected byte mFlag
      • oFlag

        protected byte oFlag
      • routerLifetime

        protected short routerLifetime
      • reachableTime

        protected int reachableTime
      • retransmitTimer

        protected int retransmitTimer
    • Constructor Detail

      • RouterAdvertisement

        public RouterAdvertisement()
    • Method Detail

      • getCurrentHopLimit

        public byte getCurrentHopLimit()
        Gets current hop limit.
        Returns:
        the current hop limit
      • setCurrentHopLimit

        public RouterAdvertisement setCurrentHopLimit​(byte currentHopLimit)
        Sets current hop limit.
        Parameters:
        currentHopLimit - the current hop limit to set
        Returns:
        this
      • getMFlag

        public byte getMFlag()
        Gets managed address configuration flag.
        Returns:
        the managed address configuration flag
      • setMFlag

        public RouterAdvertisement setMFlag​(byte mFlag)
        Sets managed address configuration flag.
        Parameters:
        mFlag - the managed address configuration flag to set
        Returns:
        this
      • getOFlag

        public byte getOFlag()
        Gets other configuration flag.
        Returns:
        the other configuration flag
      • setOFlag

        public RouterAdvertisement setOFlag​(byte oFlag)
        Sets other configuration flag.
        Parameters:
        oFlag - the other configuration flag to set
        Returns:
        this
      • getRouterLifetime

        public short getRouterLifetime()
        Gets router lifetime.
        Returns:
        the router lifetime
      • setRouterLifetime

        public RouterAdvertisement setRouterLifetime​(short routerLifetime)
        Sets router lifetime.
        Parameters:
        routerLifetime - the router lifetime to set
        Returns:
        this
      • getReachableTime

        public int getReachableTime()
        Gets reachable time.
        Returns:
        the reachable time
      • setReachableTime

        public RouterAdvertisement setReachableTime​(int reachableTime)
        Sets reachable time.
        Parameters:
        reachableTime - the reachable time to set
        Returns:
        this
      • getRetransmitTimer

        public int getRetransmitTimer()
        Gets retransmission timer.
        Returns:
        the retransmission timer
      • setRetransmitTimer

        public RouterAdvertisement setRetransmitTimer​(int retransmitTimer)
        Sets retransmission timer.
        Parameters:
        retransmitTimer - the retransmission timer 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 RouterAdvertisement 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<RouterAdvertisement> deserializer()
        Deserializer function for router advertisement packets.
        Returns:
        deserializer function
      • toString

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