|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.floodlightcontroller.packet.BasePacket
net.floodlightcontroller.packet.IPv4
public class IPv4
Field Summary | |
---|---|
protected short |
checksum
|
protected int |
destinationAddress
|
protected byte |
diffServ
|
protected byte |
flags
|
protected short |
fragmentOffset
|
protected byte |
headerLength
|
protected short |
identification
|
static byte |
IPV4_FLAGS_DONTFRAG
|
static byte |
IPV4_FLAGS_MASK
|
static byte |
IPV4_FLAGS_MOREFRAG
|
static byte |
IPV4_FLAGS_SHIFT
|
static short |
IPV4_OFFSET_MASK
|
protected boolean |
isFragment
|
protected boolean |
isTruncated
|
protected byte[] |
options
|
protected byte |
protocol
|
static byte |
PROTOCOL_ICMP
|
static byte |
PROTOCOL_TCP
|
static byte |
PROTOCOL_UDP
|
static java.util.Map<java.lang.Byte,java.lang.Class<? extends IPacket>> |
protocolClassMap
|
protected int |
sourceAddress
|
protected short |
totalLength
|
protected byte |
ttl
|
protected byte |
version
|
Fields inherited from class net.floodlightcontroller.packet.BasePacket |
---|
log, parent, payload |
Constructor Summary | |
---|---|
IPv4()
Default constructor that sets the version to 4. |
Method Summary | |
---|---|
IPacket |
deserialize(byte[] data,
int offset,
int length)
Deserializes this packet layer and all possible payloads |
boolean |
equals(java.lang.Object obj)
|
static java.lang.String |
fromIPv4Address(int ipAddress)
Accepts an IPv4 address and returns of string of the form xxx.xxx.xxx.xxx ie 192.168.0.1 |
static java.lang.String |
fromIPv4AddressCollection(java.util.Collection<java.lang.Integer> ipAddresses)
Accepts a collection of IPv4 addresses as integers and returns a single String useful in toString method's containing collections of IP addresses. |
short |
getChecksum()
|
int |
getDestinationAddress()
|
byte |
getDiffServ()
|
byte |
getFlags()
|
short |
getFragmentOffset()
|
byte |
getHeaderLength()
|
short |
getIdentification()
|
byte[] |
getOptions()
|
byte |
getProtocol()
|
int |
getSourceAddress()
|
short |
getTotalLength()
|
byte |
getTtl()
|
byte |
getVersion()
|
int |
hashCode()
|
boolean |
isFragment()
|
boolean |
isTruncated()
|
void |
resetChecksum()
Reset any checksums as needed, and call resetChecksum on all parents |
byte[] |
serialize()
Serializes the packet. |
IPv4 |
setChecksum(short checksum)
|
IPv4 |
setDestinationAddress(int destinationAddress)
|
IPv4 |
setDestinationAddress(java.lang.String destinationAddress)
|
IPv4 |
setDiffServ(byte diffServ)
|
IPv4 |
setFlags(byte flags)
|
void |
setFragment(boolean isFrag)
|
IPv4 |
setFragmentOffset(short fragmentOffset)
|
IPv4 |
setIdentification(short identification)
|
IPv4 |
setOptions(byte[] options)
|
IPv4 |
setProtocol(byte protocol)
|
IPv4 |
setSourceAddress(int sourceAddress)
|
IPv4 |
setSourceAddress(java.lang.String sourceAddress)
|
void |
setTruncated(boolean isTruncated)
|
IPv4 |
setTtl(byte ttl)
|
IPv4 |
setVersion(byte version)
|
static int |
toIPv4Address(byte[] ipAddress)
Accepts an IPv4 address in a byte array and returns the corresponding 32-bit integer value. |
static int |
toIPv4Address(java.lang.String ipAddress)
Accepts an IPv4 address of the form xxx.xxx.xxx.xxx, ie 192.168.0.1 and returns the corresponding 32 bit integer. |
static byte[] |
toIPv4AddressBytes(int ipAddress)
Accepts an IPv4 address in the form of an integer and returns the corresponding byte array. |
static byte[] |
toIPv4AddressBytes(java.lang.String ipAddress)
Accepts an IPv4 address of the form xxx.xxx.xxx.xxx, ie 192.168.0.1 and returns the corresponding byte array. |
Methods inherited from class net.floodlightcontroller.packet.BasePacket |
---|
clone, getParent, getPayload, setParent, setPayload |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final byte PROTOCOL_ICMP
public static final byte PROTOCOL_TCP
public static final byte PROTOCOL_UDP
public static java.util.Map<java.lang.Byte,java.lang.Class<? extends IPacket>> protocolClassMap
public static final byte IPV4_FLAGS_MOREFRAG
public static final byte IPV4_FLAGS_DONTFRAG
public static final byte IPV4_FLAGS_MASK
public static final byte IPV4_FLAGS_SHIFT
public static final short IPV4_OFFSET_MASK
protected byte version
protected byte headerLength
protected byte diffServ
protected short totalLength
protected short identification
protected byte flags
protected short fragmentOffset
protected byte ttl
protected byte protocol
protected short checksum
protected int sourceAddress
protected int destinationAddress
protected byte[] options
protected boolean isTruncated
protected boolean isFragment
Constructor Detail |
---|
public IPv4()
Method Detail |
---|
public byte getVersion()
public IPv4 setVersion(byte version)
version
- the version to setpublic byte getHeaderLength()
public byte getDiffServ()
public IPv4 setDiffServ(byte diffServ)
diffServ
- the diffServ to setpublic short getTotalLength()
public short getIdentification()
public boolean isTruncated()
public void setTruncated(boolean isTruncated)
public boolean isFragment()
public void setFragment(boolean isFrag)
public IPv4 setIdentification(short identification)
identification
- the identification to setpublic byte getFlags()
public IPv4 setFlags(byte flags)
flags
- the flags to setpublic short getFragmentOffset()
public IPv4 setFragmentOffset(short fragmentOffset)
fragmentOffset
- the fragmentOffset to setpublic byte getTtl()
public IPv4 setTtl(byte ttl)
ttl
- the ttl to setpublic byte getProtocol()
public IPv4 setProtocol(byte protocol)
protocol
- the protocol to setpublic short getChecksum()
public IPv4 setChecksum(short checksum)
checksum
- the checksum to setpublic void resetChecksum()
IPacket
resetChecksum
in interface IPacket
resetChecksum
in class BasePacket
public int getSourceAddress()
public IPv4 setSourceAddress(int sourceAddress)
sourceAddress
- the sourceAddress to setpublic IPv4 setSourceAddress(java.lang.String sourceAddress)
sourceAddress
- the sourceAddress to setpublic int getDestinationAddress()
public IPv4 setDestinationAddress(int destinationAddress)
destinationAddress
- the destinationAddress to setpublic IPv4 setDestinationAddress(java.lang.String destinationAddress)
destinationAddress
- the destinationAddress to setpublic byte[] getOptions()
public IPv4 setOptions(byte[] options)
options
- the options to setpublic byte[] serialize()
public IPacket deserialize(byte[] data, int offset, int length) throws PacketParsingException
IPacket
offset
- offset to start deserializing fromlength
- length of the data to deserialize
PacketParsingException
public static int toIPv4Address(java.lang.String ipAddress)
ipAddress
-
public static int toIPv4Address(byte[] ipAddress)
ipAddress
-
public static java.lang.String fromIPv4Address(int ipAddress)
ipAddress
-
public static java.lang.String fromIPv4AddressCollection(java.util.Collection<java.lang.Integer> ipAddresses)
ipAddresses
- collection
public static byte[] toIPv4AddressBytes(java.lang.String ipAddress)
ipAddress
- The IP address in the form xx.xxx.xxx.xxx.
public static byte[] toIPv4AddressBytes(int ipAddress)
ipAddress
- The IP address as an integer.
public int hashCode()
hashCode
in class BasePacket
public boolean equals(java.lang.Object obj)
equals
in class BasePacket
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |