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