public abstract class LSA extends Object
All LSAs begin with a common 20 byte header. This header contains enough information to uniquely identify the LSA (LS type, Link State ID, and Advertising Router). Multiple instances of the LSA may exist in the routing domain at the same time. It is then necessary to determine which instance is more recent. This is accomplished by examining the LS age, LS sequence number and LS checksum fields that are also contained in the LSA header.
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | LS age | Options | LS type | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Link State ID | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Advertising Router | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | LS sequence number | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | LS checksum | length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Modifier and Type | Field and Description |
---|---|
protected static org.slf4j.Logger |
log
The logger
|
protected byte[] |
LSAbytes
Bytes of the LSA
|
Constructor and Description |
---|
LSA()
Default constructor
|
LSA(byte[] bytes,
int offset)
Decodes the header of a LSA
|
Modifier and Type | Method and Description |
---|---|
abstract void |
encode() |
void |
encodeLSAHeader() |
boolean |
equals(Object LSAToCompare)
Compare LSA by LStype
|
Inet4Address |
getAdvertisingRouter() |
int |
getChecksum() |
int |
getLength() |
Inet4Address |
getLinkStateId() |
byte[] |
getLSAbytes() |
int |
getLSage() |
static int |
getLSlength(byte[] bytes,
int offset) |
int |
getLSsequenceNumber() |
int |
getLStype() |
static int |
getLStype(byte[] bytes,
int offset) |
int |
getOptions() |
String |
printHeader() |
void |
setAdvertisingRouter(Inet4Address advertisingRouter) |
protected void |
setLength(int length) |
void |
setLinkStateId(Inet4Address linkStateId) |
void |
setLSage(int lSage) |
void |
setLSsequenceNumber(int lSsequenceNumber) |
void |
setLStype(int lStype) |
void |
setOptions(int options) |
protected byte[] LSAbytes
protected static final org.slf4j.Logger log
public LSA()
public LSA(byte[] bytes, int offset) throws MalformedOSPFLSAException
bytes
- offset
- MalformedOSPFLSAException
public void encodeLSAHeader()
public int getLSage()
public void setLSage(int lSage)
public int getOptions()
public void setOptions(int options)
public int getLStype()
public void setLStype(int lStype)
public Inet4Address getLinkStateId()
public void setLinkStateId(Inet4Address linkStateId)
public Inet4Address getAdvertisingRouter()
public void setAdvertisingRouter(Inet4Address advertisingRouter)
public int getLSsequenceNumber()
public void setLSsequenceNumber(int lSsequenceNumber)
public int getLength()
protected void setLength(int length)
public static int getLStype(byte[] bytes, int offset)
public static int getLSlength(byte[] bytes, int offset)
public byte[] getLSAbytes()
public int getChecksum()
public abstract void encode()
public boolean equals(Object LSAToCompare)
public String printHeader()
Copyright © 2016. All rights reserved.