blob: 0a20794423d0c7c6187a7054c871b34c152e1b5c [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
Ayaka Koshibeab3374b2014-09-19 11:41:25 -07008 * to view a packet in event, but may block the response to the
9 * event if blocked has been called. This packet context can be used
10 * to react to the packet in event with a packet out.
tom7ef8ff92014-09-17 13:08:06 -070011 */
12public interface OpenFlowPacketContext {
13
14 //TODO: may want to support sending packet out other switches than
15 // the one it came in on.
16 /**
17 * Blocks further responses (ie. send() calls) on this
18 * packet in event.
19 */
20 public boolean block();
21
22 /**
23 * Checks whether the packet has been handled.
24 * @return true if handled, false otherwise.
25 */
26 public boolean isHandled();
27
28 /**
29 * Provided build has been called send the packet
30 * out the switch it came in on.
31 */
32 public void send();
33
34 /**
35 * Build the packet out in response to this packet in event.
36 * @param outPort the out port to send to packet out of.
37 */
38 public void build(OFPort outPort);
39
40 /**
41 * Build the packet out in response to this packet in event.
42 * @param ethFrame the actual packet to send out.
43 * @param outPort the out port to send to packet out of.
44 */
45 public void build(Ethernet ethFrame, OFPort outPort);
46
47 /**
48 * Provided a handle onto the parsed payload.
49 * @return the parsed form of the payload.
50 */
51 public Ethernet parsed();
52
53 /**
54 * Provide an unparsed copy of the data.
55 * @return the unparsed form of the payload.
56 */
57 public byte[] unparsed();
58
59 /**
60 * Provide the dpid of the switch where the packet in arrived.
61 * @return the dpid of the switch.
62 */
63 public Dpid dpid();
64
65 /**
66 * Provide the port on which the packet arrived.
67 * @return the port
68 */
69 public Integer inPort();
alshabibe9d3a322014-09-23 15:18:33 -070070
71 /**
72 * Indicates that this packet is buffered at the switch.
73 * @return buffer indication
74 */
75 boolean isBuffered();
tom7ef8ff92014-09-17 13:08:06 -070076}