Package org.onlab.packet.ndp
Class RouterAdvertisement
- java.lang.Object
-
- org.onlab.packet.BasePacket
-
- org.onlab.packet.ndp.RouterAdvertisement
-
- All Implemented Interfaces:
IPacket
public class RouterAdvertisement extends BasePacket
Implements ICMPv6 Router Advertisement packet format. (RFC 4861)
-
-
Field Summary
Fields Modifier and Type Field Description protected byte
currentHopLimit
static byte
HEADER_LENGTH
protected byte
mFlag
protected byte
oFlag
protected int
reachableTime
protected int
retransmitTimer
protected short
routerLifetime
-
Fields inherited from class org.onlab.packet.BasePacket
parent, payload
-
-
Constructor Summary
Constructors Constructor Description RouterAdvertisement()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description RouterAdvertisement
addOption(byte type, byte[] data)
Adds a Neighbor Discovery Protocol packet option.static Deserializer<RouterAdvertisement>
deserializer()
Deserializer function for router advertisement packets.boolean
equals(java.lang.Object obj)
byte
getCurrentHopLimit()
Gets current hop limit.byte
getMFlag()
Gets managed address configuration flag.byte
getOFlag()
Gets other configuration flag.java.util.List<NeighborDiscoveryOptions.Option>
getOptions()
Gets the Neighbor Discovery Protocol packet options.int
getReachableTime()
Gets reachable time.int
getRetransmitTimer()
Gets retransmission timer.short
getRouterLifetime()
Gets router lifetime.int
hashCode()
byte[]
serialize()
Sets all payloads parent packet if applicable, then serializes this packet and all payloads.RouterAdvertisement
setCurrentHopLimit(byte currentHopLimit)
Sets current hop limit.RouterAdvertisement
setMFlag(byte mFlag)
Sets managed address configuration flag.RouterAdvertisement
setOFlag(byte oFlag)
Sets other configuration flag.RouterAdvertisement
setReachableTime(int reachableTime)
Sets reachable time.RouterAdvertisement
setRetransmitTimer(int retransmitTimer)
Sets retransmission timer.RouterAdvertisement
setRouterLifetime(short routerLifetime)
Sets router lifetime.java.lang.String
toString()
-
Methods inherited from class org.onlab.packet.BasePacket
clone, getParent, getPayload, resetChecksum, setParent, setPayload
-
-
-
-
Field Detail
-
HEADER_LENGTH
public static final byte HEADER_LENGTH
- See Also:
- Constant Field Values
-
currentHopLimit
protected byte currentHopLimit
-
mFlag
protected byte mFlag
-
oFlag
protected byte oFlag
-
routerLifetime
protected short routerLifetime
-
reachableTime
protected int reachableTime
-
retransmitTimer
protected int retransmitTimer
-
-
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 typedata
- 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
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classBasePacket
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classBasePacket
-
deserializer
public static Deserializer<RouterAdvertisement> deserializer()
Deserializer function for router advertisement packets.- Returns:
- deserializer function
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-