Thomas Vachuska | 781d18b | 2014-10-27 10:31:25 -0700 | [diff] [blame] | 1 | /* |
Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [diff] [blame] | 2 | * Copyright 2014 Open Networking Laboratory |
Thomas Vachuska | 781d18b | 2014-10-27 10:31:25 -0700 | [diff] [blame] | 3 | * |
Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [diff] [blame] | 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 |
Thomas Vachuska | 781d18b | 2014-10-27 10:31:25 -0700 | [diff] [blame] | 7 | * |
Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [diff] [blame] | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 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. |
Thomas Vachuska | 781d18b | 2014-10-27 10:31:25 -0700 | [diff] [blame] | 15 | */ |
tom | 9c94c5b | 2014-09-17 13:14:42 -0700 | [diff] [blame] | 16 | package org.onlab.onos.openflow.controller; |
tom | 7ef8ff9 | 2014-09-17 13:08:06 -0700 | [diff] [blame] | 17 | |
| 18 | import org.onlab.packet.Ethernet; |
| 19 | import org.projectfloodlight.openflow.types.OFPort; |
| 20 | |
| 21 | /** |
| 22 | * A representation of a packet context which allows any provider |
Ayaka Koshibe | ab3374b | 2014-09-19 11:41:25 -0700 | [diff] [blame] | 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. |
tom | 7ef8ff9 | 2014-09-17 13:08:06 -0700 | [diff] [blame] | 26 | */ |
| 27 | public interface OpenFlowPacketContext { |
| 28 | |
| 29 | //TODO: may want to support sending packet out other switches than |
| 30 | // the one it came in on. |
| 31 | /** |
| 32 | * Blocks further responses (ie. send() calls) on this |
| 33 | * packet in event. |
| 34 | */ |
| 35 | public boolean block(); |
| 36 | |
| 37 | /** |
| 38 | * Checks whether the packet has been handled. |
| 39 | * @return true if handled, false otherwise. |
| 40 | */ |
| 41 | public boolean isHandled(); |
| 42 | |
| 43 | /** |
| 44 | * Provided build has been called send the packet |
| 45 | * out the switch it came in on. |
| 46 | */ |
| 47 | public void send(); |
| 48 | |
| 49 | /** |
| 50 | * Build the packet out in response to this packet in event. |
| 51 | * @param outPort the out port to send to packet out of. |
| 52 | */ |
| 53 | public void build(OFPort outPort); |
| 54 | |
| 55 | /** |
| 56 | * Build the packet out in response to this packet in event. |
| 57 | * @param ethFrame the actual packet to send out. |
| 58 | * @param outPort the out port to send to packet out of. |
| 59 | */ |
| 60 | public void build(Ethernet ethFrame, OFPort outPort); |
| 61 | |
| 62 | /** |
| 63 | * Provided a handle onto the parsed payload. |
| 64 | * @return the parsed form of the payload. |
| 65 | */ |
| 66 | public Ethernet parsed(); |
| 67 | |
| 68 | /** |
| 69 | * Provide an unparsed copy of the data. |
| 70 | * @return the unparsed form of the payload. |
| 71 | */ |
| 72 | public byte[] unparsed(); |
| 73 | |
| 74 | /** |
| 75 | * Provide the dpid of the switch where the packet in arrived. |
| 76 | * @return the dpid of the switch. |
| 77 | */ |
| 78 | public Dpid dpid(); |
| 79 | |
| 80 | /** |
| 81 | * Provide the port on which the packet arrived. |
| 82 | * @return the port |
| 83 | */ |
| 84 | public Integer inPort(); |
alshabib | e9d3a32 | 2014-09-23 15:18:33 -0700 | [diff] [blame] | 85 | |
| 86 | /** |
| 87 | * Indicates that this packet is buffered at the switch. |
| 88 | * @return buffer indication |
| 89 | */ |
| 90 | boolean isBuffered(); |
tom | 7ef8ff9 | 2014-09-17 13:08:06 -0700 | [diff] [blame] | 91 | } |