blob: 536dd7fa6c0cee799f7074651aa528f74f8679b7 [file] [log] [blame]
alshabib54ebd9c2014-08-27 18:38:41 -07001package org.onlab.onos.of.controller;
2
alshabibc4901cd2014-09-05 16:50:40 -07003import org.onlab.packet.Ethernet;
alshabib54ebd9c2014-08-27 18:38:41 -07004import 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 */
11public 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 */
alshabibc4901cd2014-09-05 16:50:40 -070038 public void build(Ethernet ethFrame, OFPort outPort);
alshabib54ebd9c2014-08-27 18:38:41 -070039
40 /**
41 * Provided a handle onto the parsed payload.
42 * @return the parsed form of the payload.
43 */
alshabibc4901cd2014-09-05 16:50:40 -070044 public Ethernet parsed();
alshabib54ebd9c2014-08-27 18:38:41 -070045
46 /**
alshabib9ee68172014-09-09 14:45:14 -070047 * Provide an unparsed copy of the data.
48 * @return the unparsed form of the payload.
49 */
50 public byte[] unparsed();
51
52 /**
alshabib54ebd9c2014-08-27 18:38:41 -070053 * Provide the dpid of the switch where the packet in arrived.
54 * @return the dpid of the switch.
55 */
56 public Dpid dpid();
alshabibdf652ad2014-09-09 11:53:19 -070057
58 /**
59 * Provide the port on which the packet arrived.
60 * @return the port
61 */
62 public Integer inPort();
alshabib54ebd9c2014-08-27 18:38:41 -070063}