blob: 9d07c2f864f9bf3f168e2f94b6d597c02286cada [file] [log] [blame]
tom9c94c5b2014-09-17 13:14:42 -07001package org.onlab.onos.openflow.controller;
tom7ef8ff92014-09-17 13:08:06 -07002
3import org.onlab.packet.Ethernet;
4import 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 OpenFlowPacketContext {
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 boolean block();
20
21 /**
22 * Checks whether the packet has been handled.
23 * @return true if handled, false otherwise.
24 */
25 public boolean isHandled();
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 */
44 public void build(Ethernet ethFrame, OFPort outPort);
45
46 /**
47 * Provided a handle onto the parsed payload.
48 * @return the parsed form of the payload.
49 */
50 public Ethernet parsed();
51
52 /**
53 * Provide an unparsed copy of the data.
54 * @return the unparsed form of the payload.
55 */
56 public byte[] unparsed();
57
58 /**
59 * Provide the dpid of the switch where the packet in arrived.
60 * @return the dpid of the switch.
61 */
62 public Dpid dpid();
63
64 /**
65 * Provide the port on which the packet arrived.
66 * @return the port
67 */
68 public Integer inPort();
69}