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