blob: c4f785ec9d0ca77b5f2fbb9e33b5cd962e6b6bb9 [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 /**
47 * Provide the dpid of the switch where the packet in arrived.
48 * @return the dpid of the switch.
49 */
50 public Dpid dpid();
alshabibdf652ad2014-09-09 11:53:19 -070051
52 /**
53 * Provide the port on which the packet arrived.
54 * @return the port
55 */
56 public Integer inPort();
alshabib54ebd9c2014-08-27 18:38:41 -070057}