public interface MessageContext
srcEvent()),
contains the PacketIn message.
The PacketSequencer will decode the packet to determine the
protocols used. The decoded packet model is
available via decodedPacket().
When the context is created, a mutable PacketOut message is also
constructed and kept in the context. Note that the protocol version,
transaction ID (xid), ingress port, and buffer ID of the
PacketIn message are copied to the PacketOut message.
SequencedPacketListeners can manipulate the PacketOut
message via the PacketOut API.
Packet listeners (in the ADVISOR role)
may add Hints to the message context to help listeners further
downstream make decisions.
Once a packet listener (in the DIRECTOR
role) has determined that the PacketOut message
is ready to send back to the datapath, it indicates this to
the PacketSequencer by returning true from its
event()
callback. The sequencer will then forward the PacketOut message
to the controller for sending.
Packet listeners downstream of the DIRECTOR that caused the PacketOut to be sent, still get to see the message context, and can therefore observe what transpired.
| Modifier and Type | Method and Description |
|---|---|
MessageContext |
addHint(Hint hint)
Adds a hint to the context.
|
Packet |
decodedPacket()
Returns the decoded packet data generated by the Network Packet Library
facility.
|
boolean |
failedToSend()
This flag is set in the unlikely event that the packet sequencer
failed to send the PacketOut message via the controller.
|
OfmPacketOut |
getCompletedPacketOut()
Returns the PacketOut message that was sent back to the
source datapath.
|
List<Hint> |
getHints()
Returns the hints contained in this context, in the order they were
added by the Advisors.
|
OfmPacketIn |
getPacketIn()
Convenience method that returns the PacketIn message from
the message event.
|
List<ProtocolId> |
getProtocols()
Returns an ordered list of
protocols decoded
from the packet. |
ProtocolVersion |
getVersion()
Returns the protocol version of the associated PacketIn
message event.
|
boolean |
isHandled()
Returns true if the associated message event has already been
handled.
|
boolean |
isTestPacket()
Returns true if the associated packet has been determined to be a
diagnostic test packet.
|
PacketOut |
packetOut()
Returns the API for manipulating the PacketOut message.
|
void |
resetHandled() |
MessageEvent |
srcEvent()
Returns the associated PacketIn message event.
|
String |
toDebugString()
Returns a multi-line string representation of this message context,
suitable for debugging.
|
MessageEvent srcEvent()
ProtocolVersion getVersion()
OfmPacketIn getPacketIn()
Packet decodedPacket()
List<ProtocolId> getProtocols()
protocols decoded
from the packet. The protocols are ordered from outermost to innermost
layer. This will be null if there is no packet data associated
with the PacketIn message.PacketOut packetOut()
OfmPacketOut getCompletedPacketOut()
MessageContext addHint(Hint hint)
hint - the hint to be addedNullPointerException - if hint is nullList<Hint> getHints()
boolean isHandled()
boolean isTestPacket()
boolean failedToSend()
String toDebugString()
void resetHandled()
Copyright © 2014. All Rights Reserved.