tom | 613d814 | 2014-09-11 15:09:37 -0700 | [diff] [blame] | 1 | package org.onlab.onos.net.packet; |
| 2 | |
| 3 | /** |
| 4 | * Represents context for processing an inbound packet, and (optionally) |
| 5 | * emitting a corresponding outbound packet. |
| 6 | */ |
| 7 | public interface PacketContext { |
| 8 | |
| 9 | /** |
| 10 | * Returns the time when the packet was received. |
| 11 | * |
| 12 | * @return the time in millis since start of epoch |
| 13 | */ |
| 14 | long time(); |
| 15 | |
| 16 | /** |
| 17 | * Returns the inbound packet being processed. |
| 18 | * |
| 19 | * @return inbound packet |
| 20 | */ |
| 21 | InboundPacket inPacket(); |
| 22 | |
| 23 | /** |
| 24 | * Returns the view of the outbound packet. |
| 25 | * |
| 26 | * @return outbound packet |
| 27 | */ |
| 28 | OutboundPacket outPacket(); |
| 29 | |
| 30 | /** |
| 31 | * Appends a new treatment to be applied to the outbound packet. |
| 32 | * |
| 33 | * @param treatment output treatment |
| 34 | */ |
| 35 | void appendTreatment(Treatment treatment); |
| 36 | |
| 37 | /** |
| 38 | * Triggers the outbound packet to be sent. |
| 39 | */ |
| 40 | void send(); |
| 41 | |
| 42 | /** |
| 43 | * Blocks the outbound packet from being sent from this point onward. |
| 44 | */ |
| 45 | void block(); |
| 46 | |
| 47 | /** |
| 48 | * Indicates whether the packet has already been handled, i.e. sent or |
| 49 | * blocked. |
| 50 | * |
| 51 | * @return true if sent or blocked |
| 52 | */ |
| 53 | boolean isHandled(); |
| 54 | |
| 55 | } |