blob: 36774d5be10a941d83a9caffb513c8e620297e71 [file] [log] [blame]
Thomas Vachuska781d18b2014-10-27 10:31:25 -07001/*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
tom9c94c5b2014-09-17 13:14:42 -070019package org.onlab.onos.openflow.controller;
tom7ef8ff92014-09-17 13:08:06 -070020
21import org.onlab.packet.Ethernet;
22import org.projectfloodlight.openflow.types.OFPort;
23
24/**
25 * A representation of a packet context which allows any provider
Ayaka Koshibeab3374b2014-09-19 11:41:25 -070026 * to view a packet in event, but may block the response to the
27 * event if blocked has been called. This packet context can be used
28 * to react to the packet in event with a packet out.
tom7ef8ff92014-09-17 13:08:06 -070029 */
30public interface OpenFlowPacketContext {
31
32 //TODO: may want to support sending packet out other switches than
33 // the one it came in on.
34 /**
35 * Blocks further responses (ie. send() calls) on this
36 * packet in event.
37 */
38 public boolean block();
39
40 /**
41 * Checks whether the packet has been handled.
42 * @return true if handled, false otherwise.
43 */
44 public boolean isHandled();
45
46 /**
47 * Provided build has been called send the packet
48 * out the switch it came in on.
49 */
50 public void send();
51
52 /**
53 * Build the packet out in response to this packet in event.
54 * @param outPort the out port to send to packet out of.
55 */
56 public void build(OFPort outPort);
57
58 /**
59 * Build the packet out in response to this packet in event.
60 * @param ethFrame the actual packet to send out.
61 * @param outPort the out port to send to packet out of.
62 */
63 public void build(Ethernet ethFrame, OFPort outPort);
64
65 /**
66 * Provided a handle onto the parsed payload.
67 * @return the parsed form of the payload.
68 */
69 public Ethernet parsed();
70
71 /**
72 * Provide an unparsed copy of the data.
73 * @return the unparsed form of the payload.
74 */
75 public byte[] unparsed();
76
77 /**
78 * Provide the dpid of the switch where the packet in arrived.
79 * @return the dpid of the switch.
80 */
81 public Dpid dpid();
82
83 /**
84 * Provide the port on which the packet arrived.
85 * @return the port
86 */
87 public Integer inPort();
alshabibe9d3a322014-09-23 15:18:33 -070088
89 /**
90 * Indicates that this packet is buffered at the switch.
91 * @return buffer indication
92 */
93 boolean isBuffered();
tom7ef8ff92014-09-17 13:08:06 -070094}