T - Type of packet.public abstract class PortProtoPacket<T extends PortPacket<T>> extends Object implements L4Packet, Layer4PortHeader
PortProtoPacket class implements a cache for layer 4 protocol
header, which identifies the service using 16-bit port number.| Modifier | Constructor and Description |
|---|---|
protected |
PortProtoPacket(T pkt)
Construct a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
PortProtoPacket<T> |
clone()
Return a deep copy of this instance.
|
boolean |
commit(CachedPacketContext pctx)
Finalize modification to the packet.
|
protected static short |
computeChecksum(Inet4Packet ipv4,
PortPacket<?> packet,
int sumOff)
Compute the checksum of the given packet.
|
VTNLayer4PortMatch |
createMatch(Set<FlowMatchType> fields)
Construct match fields to test layer 4 protocol header in this packet.
|
protected abstract VTNLayer4PortMatch |
createMatch(VTNPortRange src,
VTNPortRange dst)
Construct flow match fields.
|
abstract FlowMatchType |
getDestinationMatchType()
Return a flow match type corresponding to the destination port.
|
int |
getDestinationPort()
Return the destination port number.
|
T |
getPacket()
Return a
Packet instance. |
protected T |
getPacketForWrite()
Return a
PortPacket instance to set modified values. |
abstract FlowMatchType |
getSourceMatchType()
Return a flow match type corresponding to the source port.
|
int |
getSourcePort()
Return the source port number.
|
void |
setDescription(StringBuilder builder)
Set a brief description into the given string builder.
|
void |
setDestinationPort(int port)
Set the destination port number.
|
void |
setSourcePort(int port)
Set the source port number.
|
protected static boolean |
verifyChecksum(Inet4Packet ipv4,
PortPacket<?> packet)
Verify the packet using the checksum.
|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitupdateChecksumprotected PortProtoPacket(T pkt)
pkt - A raw packet instance.protected static final short computeChecksum(Inet4Packet ipv4, PortPacket<?> packet, int sumOff) throws VTNException
ipv4 - An Inet4Packet instance that contains the given
packet.packet - A PortPacket instance.sumOff - Offset in bytes to the checksum field.VTNException - An error occurred.protected static final boolean verifyChecksum(Inet4Packet ipv4, PortPacket<?> packet) throws VTNException
ipv4 - An Inet4Packet instance that contains the given
packet.packet - A PortPacket to be verified.true is returned only if the verification succeeded.VTNException - An error occurred.protected final T getPacketForWrite()
PortPacket instance to set modified values.PortPacket instance.protected abstract VTNLayer4PortMatch createMatch(VTNPortRange src, VTNPortRange dst) throws RpcException
src - A VTNPortRange instance which specifies the
source port.dst - A VTNPortRange instance which specifies the
destination port.VTNLayer4PortMatch instance.RpcException - Invalid value is specified.public abstract FlowMatchType getSourceMatchType()
FlowMatchType instance.public abstract FlowMatchType getDestinationMatchType()
FlowMatchType instance.public final T getPacket()
Packet instance.
Note that modification to this instance is not applied to the
returned packet until CachedPacket.commit(CachedPacketContext) is called.
getPacket in interface CachedPacketPacket instance.public final 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 final PortProtoPacket<T> clone()
public final VTNLayer4PortMatch 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.
createMatch in interface L4Packetfields - A set of FlowMatchType instances corresponding to
match fields to be tested.VTNLayer4Match instance.RpcException - This packet is broken.public final int getSourcePort()
getSourcePort in interface Layer4PortHeaderpublic final void setSourcePort(int port)
setSourcePort in interface Layer4PortHeaderport - An integer value which represents the source port number.public final int getDestinationPort()
getDestinationPort in interface Layer4PortHeaderpublic final void setDestinationPort(int port)
setDestinationPort in interface Layer4PortHeaderport - An integer value which represents the destination port
number.public void setDescription(StringBuilder builder)
setDescription in interface ProtocolHeaderbuilder - A StringBuilder instance.Copyright © 2018 OpenDaylight. All rights reserved.