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