2 * Copyright 2014 Open Networking Laboratory
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package org.onosproject.openflow.controller;
18 import org.onlab.packet.Ethernet;
19 import org.projectfloodlight.openflow.types.OFPort;
22 * A representation of a packet context which allows any provider
23 * to view a packet in event, but may block the response to the
24 * event if blocked has been called. This packet context can be used
25 * to react to the packet in event with a packet out.
27 public interface OpenFlowPacketContext {
30 * Blocks further responses (ie. send() calls) on this
32 * @return true if blocks
37 * Checks whether the packet has been handled.
38 * @return true if handled, false otherwise.
43 * Provided build has been called send the packet
44 * out the switch it came in on.
49 * Build the packet out in response to this packet in event.
50 * @param outPort the out port to send to packet out of.
52 void build(OFPort outPort);
55 * Build the packet out in response to this packet in event.
56 * @param ethFrame the actual packet to send out.
57 * @param outPort the out port to send to packet out of.
59 void build(Ethernet ethFrame, OFPort outPort);
62 * Provided a handle onto the parsed payload.
63 * @return the parsed form of the payload.
68 * Provide an unparsed copy of the data.
69 * @return the unparsed form of the payload.
74 * Provide the dpid of the switch where the packet in arrived.
75 * @return the dpid of the switch.
80 * Provide the port on which the packet arrived.
86 * Indicates that this packet is buffered at the switch.
87 * @return buffer indication