blob: f9e20a1d472aedb3cb44f651fc1b9accf657f5f0 [file] [log] [blame]
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07001/*
2 * Copyright 2014 Open Networking Laboratory
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
Brian O'Connorabafb502014-12-02 22:26:20 -080016package org.onosproject.net.packet;
tom613d8142014-09-11 15:09:37 -070017
Jonathan Hart3cfce8e2015-01-14 16:43:27 -080018import org.onosproject.core.ApplicationId;
Saurav Dasc313c402015-02-27 10:09:47 -080019import org.onosproject.net.flow.FlowRule;
Jonathan Hart3cfce8e2015-01-14 16:43:27 -080020import org.onosproject.net.flow.TrafficSelector;
21
tom613d8142014-09-11 15:09:37 -070022/**
23 * Service for intercepting data plane packets and for emitting synthetic
24 * outbound packets.
25 */
26public interface PacketService {
27
28 // TODO: ponder better ordering scheme that does not require absolute numbers
29
30 /**
31 * Adds the specified processor to the list of packet processors.
32 * It will be added into the list in the order of priority. The higher
33 * numbers will be processing the packets after the lower numbers.
34 *
35 * @param processor processor to be added
36 * @param priority priority in the reverse natural order
37 * @throws java.lang.IllegalArgumentException if a processor with the
38 * given priority already exists
39 */
alshabib369d2942014-09-12 17:59:35 -070040 void addProcessor(PacketProcessor processor, int priority);
tom613d8142014-09-11 15:09:37 -070041
Jonathan Hart3cfce8e2015-01-14 16:43:27 -080042 // TODO allow processors to register for particular types of packets
43
tom613d8142014-09-11 15:09:37 -070044 /**
45 * Removes the specified processor from the processing pipeline.
46 *
47 * @param processor packet processor
48 */
49 void removeProcessor(PacketProcessor processor);
50
51 /**
Jonathan Hart3cfce8e2015-01-14 16:43:27 -080052 * Requests that packets matching the given selector are punted from the
53 * dataplane to the controller.
54 *
55 * @param selector the traffic selector used to match packets
56 * @param priority the priority of the rule
57 * @param appId the application ID of the requester
58 */
59 void requestPackets(TrafficSelector selector, PacketPriority priority,
60 ApplicationId appId);
61
Saurav Dasc313c402015-02-27 10:09:47 -080062 /**
63 * Requests that packets matching the given selector are punted from the
64 * dataplane to the controller. Clients of the PacketService should use
65 * this call to hint at the tableType in the dataplane valid for the selector.
66 *
67 * @param selector the traffic selector used to match packets
68 * @param priority the priority of the rule
69 * @param appId the application ID of the requester
70 * @param tableType the abstract table Type in the dataplane where flowrules
71 * should be inserted to punt the selector packets to the
72 * control plane
73 */
74 void requestPackets(TrafficSelector selector, PacketPriority priority,
75 ApplicationId appId, FlowRule.Type tableType);
76
77
Jonathan Hart3cfce8e2015-01-14 16:43:27 -080078 // TODO add API to allow applications to revoke requests when they deactivate
79
80 /**
tom613d8142014-09-11 15:09:37 -070081 * Emits the specified outbound packet onto the network.
82 *
83 * @param packet outbound packet
84 */
85 void emit(OutboundPacket packet);
86
87}