net.clackrouter.packets
Class LinkStatePacket
java.lang.Object
net.clackrouter.protocol.data.VNSData
net.clackrouter.packets.VNSPacket
net.clackrouter.packets.LinkStatePacket
public class LinkStatePacket
- extends VNSPacket
Packet type for a simple link-state routing protocol.
OSPF packet format
| routerid (4 bytes) | age (4 bytes)| seq num (4 bytes) | num link entries (2 bytes) | num net entries (2 bytes) |
| list of link entries (8 bytes each) | list of net entries (8 bytes each) |
Constructor Summary |
LinkStatePacket(java.nio.ByteBuffer packetBuffer)
Constructs an OSPF packet from the supplied byte buffer. |
LinkStatePacket(long id,
long a,
long seq)
|
Methods inherited from class net.clackrouter.packets.VNSPacket |
addToPath, get16bit, get32bit, getByteBuffer, getInputInterfaceName, getLength, getLevel2Type, getNextHopIPAddress, getNextHopMacAddress, getOutputInterfaceName, getParentHeader, getStringBuffer, isPacket, needsSourceAddress, setByteBuffer, setInputInterfaceName, setLevel2Type, setNeedsSourceAddress, setNextHopIPAddress, setNextHopMacAddress, setOutputInterfaceName, setParentHeader, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
LSA_SIZE_BYTES
public static int LSA_SIZE_BYTES
m_link_entries
protected java.util.ArrayList<LinkStatePacket.Link> m_link_entries
m_net_entries
protected java.util.ArrayList<LinkStatePacket.Net> m_net_entries
LinkStatePacket
public LinkStatePacket(long id,
long a,
long seq)
LinkStatePacket
public LinkStatePacket(java.nio.ByteBuffer packetBuffer)
- Constructs an OSPF packet from the supplied byte buffer.
- Parameters:
packetBuffer
- Byte buffer containing an OSPF packet
addLinkLSA
public void addLinkLSA(long linkID,
int weight)
addNetworkLSA
public void addNetworkLSA(java.net.InetAddress network,
java.net.InetAddress mask)
getLinkLSAs
public java.util.ArrayList getLinkLSAs()
getNetworkLSAs
public java.util.ArrayList getNetworkLSAs()
pack
public void pack()
getRouterID
public long getRouterID()
getAge
public long getAge()
setAge
public void setAge(long l)
getSequenceNumber
public long getSequenceNumber()
LSAContentIsIdentical
public static boolean LSAContentIsIdentical(LinkStatePacket p1,
LinkStatePacket p2)
- Tests to see if the link and network announcement in two packets are identical
This function does not compares routerID, age, or sequence number attributes
- Parameters:
p1
- p2
-
- Returns: