blob: 73fe10275d23c945f94b84a8d80e67ef6e61f811 [file] [log] [blame]
tom613d8142014-09-11 15:09:37 -07001package org.onlab.onos.net.packet;
2
tom8bb16062014-09-12 14:47:46 -07003import org.onlab.onos.net.flow.TrafficTreatment;
4
tom613d8142014-09-11 15:09:37 -07005/**
6 * Represents context for processing an inbound packet, and (optionally)
7 * emitting a corresponding outbound packet.
8 */
9public interface PacketContext {
10
11 /**
12 * Returns the time when the packet was received.
13 *
14 * @return the time in millis since start of epoch
15 */
16 long time();
17
18 /**
19 * Returns the inbound packet being processed.
20 *
21 * @return inbound packet
22 */
23 InboundPacket inPacket();
24
25 /**
26 * Returns the view of the outbound packet.
27 *
28 * @return outbound packet
29 */
30 OutboundPacket outPacket();
31
32 /**
tom8bb16062014-09-12 14:47:46 -070033 * Returns a builder for constructing traffic treatment.
tom613d8142014-09-11 15:09:37 -070034 *
tom8bb16062014-09-12 14:47:46 -070035 * @return traffic treatment builder
tom613d8142014-09-11 15:09:37 -070036 */
tom8bb16062014-09-12 14:47:46 -070037 TrafficTreatment.Builder treatmentBuilder();
tom613d8142014-09-11 15:09:37 -070038
39 /**
40 * Triggers the outbound packet to be sent.
41 */
42 void send();
43
44 /**
45 * Blocks the outbound packet from being sent from this point onward.
tom89b63c52014-09-16 09:19:51 -070046 *
alshabib63d5afe2014-09-15 09:40:24 -070047 * @return whether the outbound packet is blocked.
tom613d8142014-09-11 15:09:37 -070048 */
alshabib030111e2014-09-15 15:56:42 -070049 boolean block();
tom613d8142014-09-11 15:09:37 -070050
51 /**
tom89b63c52014-09-16 09:19:51 -070052 * Indicates whether the outbound packet is handled, i.e. sent or blocked.
53 *
54 * @return true uf the packed is handled
tom613d8142014-09-11 15:09:37 -070055 */
56 boolean isHandled();
57
58}