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 protected
DefaultPacketContext(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 boolean
block()
Blocks the outbound packet from being sent from this point onward.InboundPacket
inPacket()
Returns the inbound packet being processed.boolean
isHandled()
Indicates whether the outbound packet is handled, i.e.OutboundPacket
outPacket()
Returns the view of the outbound packet.abstract void
send()
Triggers the outbound packet to be sent.long
time()
Returns the time when the packet was received.TrafficTreatment.Builder
treatmentBuilder()
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:PacketContext
Returns the time when the packet was received.- Specified by:
time
in interfacePacketContext
- Returns:
- the time in millis since start of epoch
-
inPacket
public InboundPacket inPacket()
Description copied from interface:PacketContext
Returns the inbound packet being processed.- Specified by:
inPacket
in interfacePacketContext
- Returns:
- inbound packet
-
outPacket
public OutboundPacket outPacket()
Description copied from interface:PacketContext
Returns the view of the outbound packet.- Specified by:
outPacket
in interfacePacketContext
- Returns:
- outbound packet
-
treatmentBuilder
public TrafficTreatment.Builder treatmentBuilder()
Description copied from interface:PacketContext
Returns a builder for constructing traffic treatment.- Specified by:
treatmentBuilder
in interfacePacketContext
- Returns:
- traffic treatment builder
-
send
public abstract void send()
Description copied from interface:PacketContext
Triggers the outbound packet to be sent.- Specified by:
send
in interfacePacketContext
-
block
public boolean block()
Description copied from interface:PacketContext
Blocks the outbound packet from being sent from this point onward.- Specified by:
block
in interfacePacketContext
- Returns:
- whether the outbound packet is blocked.
-
isHandled
public boolean isHandled()
Description copied from interface:PacketContext
Indicates whether the outbound packet is handled, i.e. sent or blocked.- Specified by:
isHandled
in interfacePacketContext
- Returns:
- true uf the packed is handled
-
-