blob: ff45cc0c00c8cec12bfac90c359cc00489c2d2df [file] [log] [blame]
Jonathan Hart4f60f982014-10-27 08:11:17 -07001/*
Ray Milkey34c95902015-04-15 09:47:53 -07002 * Copyright 2014-2015 Open Networking Laboratory
Jonathan Hart4f60f982014-10-27 08:11:17 -07003 *
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;
Jonathan Hart4f60f982014-10-27 08:11:17 -070017
Brian O'Connorabafb502014-12-02 22:26:20 -080018import org.onosproject.store.Store;
Jonathan Hart4f60f982014-10-27 08:11:17 -070019
alshabib42947782015-03-31 14:59:06 -070020import java.util.Set;
21
Jonathan Hart4f60f982014-10-27 08:11:17 -070022/**
23 * Manages routing of outbound packets.
24 */
25public interface PacketStore extends Store<PacketEvent, PacketStoreDelegate> {
26
27 /**
28 * Decides which instance should emit the packet and forwards the packet to
29 * that instance. The relevant PacketManager is notified via the
30 * PacketStoreDelegate that it should emit the packet.
31 *
32 * @param packet the packet to emit
33 */
34 void emit(OutboundPacket packet);
35
alshabib42947782015-03-31 14:59:06 -070036 /**
Thomas Vachuska27bee092015-06-23 19:03:10 -070037 * Requests intercept of packets that match the given selector.
alshabib42947782015-03-31 14:59:06 -070038 *
39 * @param request a packet request
Thomas Vachuska27bee092015-06-23 19:03:10 -070040 * @return true if the first time the given selector was requested
alshabib42947782015-03-31 14:59:06 -070041 */
42 boolean requestPackets(PacketRequest request);
43
44 /**
Thomas Vachuska27bee092015-06-23 19:03:10 -070045 * Cancels intercept of packets that match the given selector.
46 *
47 * @param request a packet request
48 * @return true if there is no other application requesting the given selector
49 */
50 boolean cancelPackets(PacketRequest request);
51
52 /**
alshabib42947782015-03-31 14:59:06 -070053 * Obtains all existing requests in the system.
54 *
55 * @return a set of packet requests
56 */
57 Set<PacketRequest> existingRequests();
58
Jonathan Hart4f60f982014-10-27 08:11:17 -070059}