public final class Inet4Packet extends Object implements CachedPacket, InetHeader
Inet4Packet class implements a cache for an IPv4 instance.| Constructor and Description |
|---|
Inet4Packet(IPv4 ipv4)
Construct a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
Inet4Packet |
clone()
Return a deep copy of this instance.
|
boolean |
commit(CachedPacketContext pctx)
Finalize modification to the packet.
|
VTNInet4Match |
createMatch(Set<FlowMatchType> fields)
Construct match fields to test IP header in this packet.
|
Ip4Network |
getDestinationAddress()
Return the destination IP address.
|
short |
getDscp()
Return the DSCP field value.
|
byte[] |
getHeaderForChecksum(byte proto,
short len)
Create a pseudo IPv4 header used for computing TCP/UDP checksum.
|
IPv4 |
getPacket()
Return an
IPv4 instance configured in this instance. |
short |
getProtocol()
Return the IP protocol number.
|
Ip4Network |
getSourceAddress()
Return the source IP address.
|
boolean |
isAddressModified()
Determine whether the source or destination address is modified or not.
|
void |
setDescription(StringBuilder builder)
Set a brief description into the given string builder.
|
boolean |
setDestinationAddress(IpNetwork ipn)
Set the destination IP address.
|
void |
setDscp(short dscp)
Set the DSCP field value.
|
boolean |
setSourceAddress(IpNetwork ipn)
Set the source IP address.
|
public boolean isAddressModified()
true only if the source or destination address is
modified.public byte[] getHeaderForChecksum(byte proto,
short len)
proto - An IP protocol number.len - The number of octets in a payload.public VTNInet4Match createMatch(Set<FlowMatchType> fields) throws RpcException
Note that this method creates match fields that matches the original packet. Any modification to the packet is ignored.
fields - A set of FlowMatchType instances corresponding to
match fields to be tested.VTNInet4Match instance.RpcException - This packet is broken.public IPv4 getPacket()
IPv4 instance configured in this instance.
Note that modification to the IPv4 header is not applied to the
returned until commit(CachedPacketContext) is called.
getPacket in interface CachedPacketIPv4 instance.public boolean commit(CachedPacketContext pctx) throws VTNException
commit in interface CachedPacketpctx - The runtime context for modifying packet.true only if this packet is modified.VTNException - Failed to copy the packet.public Inet4Packet clone()
clone in interface CachedPacketclone in class Objectpublic Ip4Network getSourceAddress()
getSourceAddress in interface InetHeaderIpNetwork instance which represents the source
IP address.public boolean setSourceAddress(IpNetwork ipn)
setSourceAddress in interface InetHeaderipn - An IpNetwork instance which represents the source
IP address.true if the given address has been successfully set.
false if the given address has been rejected.public Ip4Network getDestinationAddress()
getDestinationAddress in interface InetHeaderIpNetwork instance which represents the destination
IP address.public boolean setDestinationAddress(IpNetwork ipn)
setDestinationAddress in interface InetHeaderipn - An IpNetwork instance which represents the
destination IP address.true if the given address has been successfully set.
false if the given address has been rejected.public short getProtocol()
getProtocol in interface InetHeaderpublic short getDscp()
getDscp in interface InetHeaderpublic void setDscp(short dscp)
setDscp in interface InetHeaderdscp - A short value which indicates the DSCP field value.public void setDescription(StringBuilder builder)
setDescription in interface ProtocolHeaderbuilder - A StringBuilder instance.Copyright © 2018 OpenDaylight. All rights reserved.