blob: 0e90f95938b7915a395b3b0714483191574b1602 [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 */
alshabibe7031562014-09-12 18:17:37 -070011public interface OpenFlowPacketContext {
alshabib54ebd9c2014-08-27 18:38:41 -070012
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 */
alshabib7b2748f2014-09-16 20:21:11 -070019 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();
alshabib54ebd9c2014-08-27 18:38:41 -070026
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 */
alshabibc4901cd2014-09-05 16:50:40 -070044 public void build(Ethernet ethFrame, OFPort outPort);
alshabib54ebd9c2014-08-27 18:38:41 -070045
46 /**
47 * Provided a handle onto the parsed payload.
48 * @return the parsed form of the payload.
49 */
alshabibc4901cd2014-09-05 16:50:40 -070050 public Ethernet parsed();
alshabib54ebd9c2014-08-27 18:38:41 -070051
52 /**
alshabib9ee68172014-09-09 14:45:14 -070053 * Provide an unparsed copy of the data.
54 * @return the unparsed form of the payload.
55 */
56 public byte[] unparsed();
57
58 /**
alshabib54ebd9c2014-08-27 18:38:41 -070059 * Provide the dpid of the switch where the packet in arrived.
60 * @return the dpid of the switch.
61 */
62 public Dpid dpid();
alshabibdf652ad2014-09-09 11:53:19 -070063
64 /**
65 * Provide the port on which the packet arrived.
66 * @return the port
67 */
68 public Integer inPort();
alshabib54ebd9c2014-08-27 18:38:41 -070069}