Package org.onosproject.net.packet
Class DefaultPacketContext
- java.lang.Object
-
- org.onosproject.net.packet.DefaultPacketContext
-
- All Implemented Interfaces:
PacketContext
public abstract class DefaultPacketContext extends java.lang.Object implements PacketContext
Default implementation of a packet context.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedDefaultPacketContext(long time, InboundPacket inPkt, OutboundPacket outPkt, boolean block)Creates a new packet context.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description booleanblock()Blocks the outbound packet from being sent from this point onward.InboundPacketinPacket()Returns the inbound packet being processed.booleanisHandled()Indicates whether the outbound packet is handled, i.e.OutboundPacketoutPacket()Returns the view of the outbound packet.abstract voidsend()Triggers the outbound packet to be sent.longtime()Returns the time when the packet was received.TrafficTreatment.BuildertreatmentBuilder()Returns a builder for constructing traffic treatment.
-
-
-
Constructor Detail
-
DefaultPacketContext
protected DefaultPacketContext(long time, InboundPacket inPkt, OutboundPacket outPkt, boolean block)Creates a new packet context.- Parameters:
time- creation timeinPkt- inbound packetoutPkt- outbound packetblock- whether the context is blocked or not
-
-
Method Detail
-
time
public long time()
Description copied from interface:PacketContextReturns the time when the packet was received.- Specified by:
timein interfacePacketContext- Returns:
- the time in millis since start of epoch
-
inPacket
public InboundPacket inPacket()
Description copied from interface:PacketContextReturns the inbound packet being processed.- Specified by:
inPacketin interfacePacketContext- Returns:
- inbound packet
-
outPacket
public OutboundPacket outPacket()
Description copied from interface:PacketContextReturns the view of the outbound packet.- Specified by:
outPacketin interfacePacketContext- Returns:
- outbound packet
-
treatmentBuilder
public TrafficTreatment.Builder treatmentBuilder()
Description copied from interface:PacketContextReturns a builder for constructing traffic treatment.- Specified by:
treatmentBuilderin interfacePacketContext- Returns:
- traffic treatment builder
-
send
public abstract void send()
Description copied from interface:PacketContextTriggers the outbound packet to be sent.- Specified by:
sendin interfacePacketContext
-
block
public boolean block()
Description copied from interface:PacketContextBlocks the outbound packet from being sent from this point onward.- Specified by:
blockin interfacePacketContext- Returns:
- whether the outbound packet is blocked.
-
isHandled
public boolean isHandled()
Description copied from interface:PacketContextIndicates whether the outbound packet is handled, i.e. sent or blocked.- Specified by:
isHandledin interfacePacketContext- Returns:
- true uf the packed is handled
-
-