net.clackrouter.packets
Class LinkStatePacket

java.lang.Object
  extended by net.clackrouter.protocol.data.VNSData
      extended by net.clackrouter.packets.VNSPacket
          extended by 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) |


Nested Class Summary
static class LinkStatePacket.Link
           
static class LinkStatePacket.Net
           
 
Field Summary
static int LSA_SIZE_BYTES
           
protected  java.util.ArrayList<LinkStatePacket.Link> m_link_entries
           
protected  java.util.ArrayList<LinkStatePacket.Net> m_net_entries
           
 
Fields inherited from class net.clackrouter.packets.VNSPacket
m_inputInterfaceName, m_length, m_level2Type, m_local_packet, m_nextHopIPAddr, m_nextHopMacAddr, m_outputInterfaceName, m_packetByteBuffer, mParentHeader
 
Constructor Summary
LinkStatePacket(java.nio.ByteBuffer packetBuffer)
          Constructs an OSPF packet from the supplied byte buffer.
LinkStatePacket(long id, long a, long seq)
           
 
Method Summary
 void addLinkLSA(long linkID, int weight)
           
 void addNetworkLSA(java.net.InetAddress network, java.net.InetAddress mask)
           
 long getAge()
           
 java.util.ArrayList getLinkLSAs()
           
 java.util.ArrayList getNetworkLSAs()
           
 long getRouterID()
           
 long getSequenceNumber()
           
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
 void pack()
           
 void setAge(long l)
           
 
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 net.clackrouter.protocol.data.VNSData
isBanner, isClose, isHWInfo
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

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
Constructor Detail

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
Method Detail

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: