public final class EtherPacket extends Object implements CachedPacket, EtherHeader
EtherPacket class implements a cache for a Ethernet
instance including VLAN tag.VLAN_NONE| Constructor and Description |
|---|
EtherPacket(Ethernet ether)
Construct a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
EtherPacket |
clone()
Return a deep copy of this instance.
|
boolean |
commit(CachedPacketContext pctx)
Finalize modification to the packet.
|
VTNEtherMatch |
createMatch(Set<FlowMatchType> fields)
Construct match fields to test Ethernet header in this packet.
|
EtherAddress |
getDestinationAddress()
Return the destination MAC address.
|
int |
getEtherType()
Return the ethernet type.
|
int |
getOriginalVlan()
Return the VLAN ID in the original Ethernet frame.
|
Ethernet |
getPacket()
Return an
Ethernet instance configured in this instance. |
Packet |
getPayload()
Return the payload in the Ethernet frame.
|
byte[] |
getRawPayload()
Return the unparsed payload in the Ethernet frame.
|
EtherAddress |
getSourceAddress()
Return the source MAC address.
|
int |
getVlanId()
Return the VLAN ID in the IEEE 802.1Q VLAN tag.
|
short |
getVlanPriority()
Return the VLAN priority value in the IEEE 802.1Q VLAN tag.
|
IEEE8021Q |
getVlanTag()
Return the VLAN tag in the Ethernet frame.
|
void |
setDescription(StringBuilder builder)
Set a brief description into the given string builder.
|
void |
setDestinationAddress(EtherAddress mac)
Set the destination MAC address.
|
void |
setPayload(Packet packet)
Set the payload of the Ethernet frame.
|
void |
setSourceAddress(EtherAddress mac)
Set the source MAC address.
|
void |
setVlanId(int vid)
Set the VLAN ID to the IEEE 802.1Q VLAN tag.
|
void |
setVlanPriority(short pcp)
Set the VLAN priority value to the IEEE 802.1Q VLAN tag.
|
public int getOriginalVlan()
public IEEE8021Q getVlanTag()
Note that this method returns the VLAN tag in the original Ethernet
frame. Any modification to VLAN tag is never applied to the returned
value even if commit(CachedPacketContext) is called.
IEEE8021Q instance which represents the VLAN tag.
null is returned if no VLAN tag was found in the
Ethernet frame.public Packet getPayload()
Packet instance which represents the payload.public void setPayload(Packet packet)
packet - The payload of the Ethernet frame.public byte[] getRawPayload()
public VTNEtherMatch 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.VTNEtherMatch instance.RpcException - This packet is broken.public Ethernet getPacket()
Ethernet instance configured in this instance.
Note that this method returns the original ethernet frame.
Any modification to Ethernet header field is never applied to the
returned value even if commit(CachedPacketContext) is called.
getPacket in interface CachedPacketEthernet instance.public boolean commit(CachedPacketContext pctx)
commit in interface CachedPacketpctx - The runtime context for modifying packet.true only if this packet is modified.public EtherPacket clone()
Note that this method does not copy the original Ethernet header and VLAN tag because this class never modifies them.
clone in interface CachedPacketclone in class Objectpublic EtherAddress getSourceAddress()
getSourceAddress in interface EtherHeaderEtherAddress instance which represents the source
MAC address.public void setSourceAddress(EtherAddress mac)
setSourceAddress in interface EtherHeadermac - An EtherAddress instance which represents the source
MAC address.public EtherAddress getDestinationAddress()
getDestinationAddress in interface EtherHeaderEtherAddress instance which represents the
destination MAC address.public void setDestinationAddress(EtherAddress mac)
setDestinationAddress in interface EtherHeadermac - An EtherAddress instance which represents the
destination MAC address.public int getEtherType()
getEtherType in interface EtherHeaderpublic int getVlanId()
getVlanId in interface EtherHeaderEtherHeader.VLAN_NONE is returned if this frame does not contain
a VLAN tag.public void setVlanId(int vid)
setVlanId in interface EtherHeadervid - A VLAN ID in the VLAN tag.
If EtherHeader.VLAN_NONE is specified, the VLAN tag will be
removed.public short getVlanPriority()
getVlanPriority in interface EtherHeaderpublic void setVlanPriority(short pcp)
setVlanPriority in interface EtherHeaderpcp - A byte value which represents the VLAN priority.public void setDescription(StringBuilder builder)
setDescription in interface ProtocolHeaderbuilder - A StringBuilder instance.Copyright © 2018 OpenDaylight. All rights reserved.