blob: ce08fdec79705346b44a83eaf14a00a68ca23a38 [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.
alshabib63d5afe2014-09-15 09:40:24 -070046 * @return whether the outbound packet is blocked.
tom613d8142014-09-11 15:09:37 -070047 */
alshabib63d5afe2014-09-15 09:40:24 -070048 boolean blocked();
tom613d8142014-09-11 15:09:37 -070049
50 /**
alshabib63d5afe2014-09-15 09:40:24 -070051 * Check whether the outbound packet is blocked.
52 * @return
tom613d8142014-09-11 15:09:37 -070053 */
54 boolean isHandled();
55
56}