Reference Guide

Table Of Contents
Message Context
The MessageContext is the object which maintains the state of processing a PACKET_IN message,
and the formulation of the PACKET_OUT message to be returned to the source datapath. When a
PACKET_IN message is received by the controller, several things happen:
A new MessageContext is created
The PACKET_IN message event is attached
The packet data (if there is any) is decoded and the Packet model attached
A mutable PACKET_OUT message is created and attached (with appropriate fields set)
The MessageContext is passed from listener to listener down the processing chain
The MessageContext provides the following methods:
srcEvent() returns the message event (immutable) containing the PACKET_IN message
received from the datapath.
getVersion()returns the protocol version of the datapath / OpenFlow message.
getPacketIn() returns the PACKET_IN message from the message event.
decodedPacket()returns the network packet model (immutable) of the decoded packet data.
getProtocols() returns an ordered list of protocol IDs for the protocol layers in the decoded
packet.
packetOut() returns the PacketOut API, through which actions may be applied to the
PACKET_OUT message under construction.
getCompletedPacketOut() returns the PACKET_OUT message (immutable) that was sent
back to the datapath.
addHint(Hint)adds a hint to the message context.
getHints()returns the list of hints attached to the context.
isHandled() returns true if a DIRECTOR has already instructed the sequencer to send or
block the PACKET_OUT message.
isBlocked() returns true if a DIRECTOR has already instructed the sequencer to block the
PACKET_OUT message.
isSent() returns true if a DIRECTOR has already instructed the sequencer to send the
PACKET_OUT message.
isTestPacket() returns true if the associated packet has been determined to be a diagnostic
test packet.
requiresProcessing() returns true if the associated packet is not a test packet, and has not
yet been blocked or sent.
failedToSend()returns true if the attempt to send the PACKET_OUT message failed.
toDebugString() returns a detailed, multi-line string representation of the message context.
42