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 | */ |
| 11 | public interface PacketContext { |
| 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 | */ |
| 19 | public void block(); |
| 20 | |
| 21 | /** |
| 22 | * Provided build has been called send the packet |
| 23 | * out the switch it came in on. |
| 24 | */ |
| 25 | public void send(); |
| 26 | |
| 27 | /** |
| 28 | * Build the packet out in response to this packet in event. |
| 29 | * @param outPort the out port to send to packet out of. |
| 30 | */ |
| 31 | public void build(OFPort outPort); |
| 32 | |
| 33 | /** |
| 34 | * Build the packet out in response to this packet in event. |
| 35 | * @param ethFrame the actual packet to send out. |
| 36 | * @param outPort the out port to send to packet out of. |
| 37 | */ |
alshabib | c4901cd | 2014-09-05 16:50:40 -0700 | [diff] [blame] | 38 | public void build(Ethernet ethFrame, OFPort outPort); |
alshabib | 54ebd9c | 2014-08-27 18:38:41 -0700 | [diff] [blame] | 39 | |
| 40 | /** |
| 41 | * Provided a handle onto the parsed payload. |
| 42 | * @return the parsed form of the payload. |
| 43 | */ |
alshabib | c4901cd | 2014-09-05 16:50:40 -0700 | [diff] [blame] | 44 | public Ethernet parsed(); |
alshabib | 54ebd9c | 2014-08-27 18:38:41 -0700 | [diff] [blame] | 45 | |
| 46 | /** |
| 47 | * Provide the dpid of the switch where the packet in arrived. |
| 48 | * @return the dpid of the switch. |
| 49 | */ |
| 50 | public Dpid dpid(); |
alshabib | df652ad | 2014-09-09 11:53:19 -0700 | [diff] [blame^] | 51 | |
| 52 | /** |
| 53 | * Provide the port on which the packet arrived. |
| 54 | * @return the port |
| 55 | */ |
| 56 | public Integer inPort(); |
alshabib | 54ebd9c | 2014-08-27 18:38:41 -0700 | [diff] [blame] | 57 | } |