Jonathan Hart | 06e8908 | 2016-08-08 17:21:01 -0700 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2016-present Open Networking Foundation |
Jonathan Hart | 06e8908 | 2016-08-08 17:21:01 -0700 | [diff] [blame] | 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 | */ |
| 16 | |
Ray Milkey | b65d784 | 2017-08-03 16:28:24 -0700 | [diff] [blame] | 17 | package org.onosproject.net.neighbour; |
Jonathan Hart | 06e8908 | 2016-08-08 17:21:01 -0700 | [diff] [blame] | 18 | |
| 19 | import com.google.common.annotations.Beta; |
Jonathan Hart | c4f681c | 2016-09-09 07:14:25 -0700 | [diff] [blame] | 20 | import org.onosproject.core.ApplicationId; |
Ray Milkey | facf286 | 2017-08-03 11:58:29 -0700 | [diff] [blame] | 21 | import org.onosproject.net.intf.Interface; |
Jonathan Hart | 06e8908 | 2016-08-08 17:21:01 -0700 | [diff] [blame] | 22 | import org.onosproject.net.ConnectPoint; |
| 23 | |
Jonathan Hart | c4f681c | 2016-09-09 07:14:25 -0700 | [diff] [blame] | 24 | import java.util.Collection; |
| 25 | import java.util.Map; |
| 26 | |
Jonathan Hart | 06e8908 | 2016-08-08 17:21:01 -0700 | [diff] [blame] | 27 | /** |
| 28 | * Provides a means of registering logic for handling neighbour messages. |
| 29 | */ |
| 30 | @Beta |
| 31 | public interface NeighbourResolutionService { |
| 32 | |
| 33 | /** |
| 34 | * Registers a neighbour message handler for all neighbour messages |
| 35 | * incoming on the given connect point. |
| 36 | * |
| 37 | * @param connectPoint connect point |
| 38 | * @param handler neighbour message handler |
Jonathan Hart | c4f681c | 2016-09-09 07:14:25 -0700 | [diff] [blame] | 39 | * @param appId application ID |
Jonathan Hart | 06e8908 | 2016-08-08 17:21:01 -0700 | [diff] [blame] | 40 | */ |
Jonathan Hart | c4f681c | 2016-09-09 07:14:25 -0700 | [diff] [blame] | 41 | void registerNeighbourHandler(ConnectPoint connectPoint, NeighbourMessageHandler handler, |
| 42 | ApplicationId appId); |
Jonathan Hart | 06e8908 | 2016-08-08 17:21:01 -0700 | [diff] [blame] | 43 | |
| 44 | /** |
| 45 | * Registers a neighbour message handler for all neighbour messages incoming |
| 46 | * on the given interface. Neighbour packets must match the fields of the |
| 47 | * interface in order to be handled by this message handler. |
| 48 | * |
| 49 | * @param intf interface |
| 50 | * @param handler neighbour message handler |
Jonathan Hart | c4f681c | 2016-09-09 07:14:25 -0700 | [diff] [blame] | 51 | * @param appId application ID |
Jonathan Hart | 06e8908 | 2016-08-08 17:21:01 -0700 | [diff] [blame] | 52 | */ |
Jonathan Hart | c4f681c | 2016-09-09 07:14:25 -0700 | [diff] [blame] | 53 | void registerNeighbourHandler(Interface intf, NeighbourMessageHandler handler, |
| 54 | ApplicationId appId); |
Jonathan Hart | 06e8908 | 2016-08-08 17:21:01 -0700 | [diff] [blame] | 55 | |
Jonathan Hart | 9bdaaec | 2016-08-22 13:33:45 -0700 | [diff] [blame] | 56 | /** |
| 57 | * Unregisters a neighbour message handler that was assigned to a connect |
| 58 | * point. |
| 59 | * |
| 60 | * @param connectPoint connect point |
| 61 | * @param handler neighbour message handler |
Jonathan Hart | c4f681c | 2016-09-09 07:14:25 -0700 | [diff] [blame] | 62 | * @param appId application ID |
Jonathan Hart | 9bdaaec | 2016-08-22 13:33:45 -0700 | [diff] [blame] | 63 | */ |
Jonathan Hart | c4f681c | 2016-09-09 07:14:25 -0700 | [diff] [blame] | 64 | void unregisterNeighbourHandler(ConnectPoint connectPoint, NeighbourMessageHandler handler, |
| 65 | ApplicationId appId); |
Jonathan Hart | 9bdaaec | 2016-08-22 13:33:45 -0700 | [diff] [blame] | 66 | |
| 67 | /** |
| 68 | * Unregisters a neighbour message handler that was assigned to an interface. |
| 69 | * |
| 70 | * @param intf interface |
| 71 | * @param handler neighbour message handler |
Jonathan Hart | c4f681c | 2016-09-09 07:14:25 -0700 | [diff] [blame] | 72 | * @param appId application ID |
Jonathan Hart | 9bdaaec | 2016-08-22 13:33:45 -0700 | [diff] [blame] | 73 | */ |
Jonathan Hart | c4f681c | 2016-09-09 07:14:25 -0700 | [diff] [blame] | 74 | void unregisterNeighbourHandler(Interface intf, NeighbourMessageHandler handler, |
| 75 | ApplicationId appId); |
| 76 | |
| 77 | /** |
| 78 | * Unregisters all neighbour handlers that were registered by the given |
| 79 | * application. |
| 80 | * |
| 81 | * @param appId application ID |
| 82 | */ |
| 83 | void unregisterNeighbourHandlers(ApplicationId appId); |
| 84 | |
| 85 | /** |
| 86 | * Gets the neighbour message handlers that have been registered with the |
| 87 | * service. |
| 88 | * |
| 89 | * @return neighbour message handlers indexed by connect point |
| 90 | */ |
| 91 | Map<ConnectPoint, Collection<NeighbourHandlerRegistration>> getHandlerRegistrations(); |
Jonathan Hart | 06e8908 | 2016-08-08 17:21:01 -0700 | [diff] [blame] | 92 | } |