blob: c6d6837d9f6118946556a17cab24e598a3e054a0 [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;
19import org.onosproject.net.flow.TrafficSelector;
20
tom613d8142014-09-11 15:09:37 -070021/**
22 * Service for intercepting data plane packets and for emitting synthetic
23 * outbound packets.
24 */
25public interface PacketService {
26
27 // TODO: ponder better ordering scheme that does not require absolute numbers
28
29 /**
30 * Adds the specified processor to the list of packet processors.
31 * It will be added into the list in the order of priority. The higher
32 * numbers will be processing the packets after the lower numbers.
33 *
34 * @param processor processor to be added
35 * @param priority priority in the reverse natural order
36 * @throws java.lang.IllegalArgumentException if a processor with the
37 * given priority already exists
38 */
alshabib369d2942014-09-12 17:59:35 -070039 void addProcessor(PacketProcessor processor, int priority);
tom613d8142014-09-11 15:09:37 -070040
Jonathan Hart3cfce8e2015-01-14 16:43:27 -080041 // TODO allow processors to register for particular types of packets
42
tom613d8142014-09-11 15:09:37 -070043 /**
44 * Removes the specified processor from the processing pipeline.
45 *
46 * @param processor packet processor
47 */
48 void removeProcessor(PacketProcessor processor);
49
50 /**
Jonathan Hart3cfce8e2015-01-14 16:43:27 -080051 * Requests that packets matching the given selector are punted from the
52 * dataplane to the controller.
53 *
54 * @param selector the traffic selector used to match packets
55 * @param priority the priority of the rule
56 * @param appId the application ID of the requester
57 */
58 void requestPackets(TrafficSelector selector, PacketPriority priority,
59 ApplicationId appId);
60
61 // TODO add API to allow applications to revoke requests when they deactivate
62
63 /**
tom613d8142014-09-11 15:09:37 -070064 * Emits the specified outbound packet onto the network.
65 *
66 * @param packet outbound packet
67 */
68 void emit(OutboundPacket packet);
69
70}