Jonathan Hart | 7d7e2f5 | 2016-03-29 16:22:49 -0700 | [diff] [blame] | 1 | /* |
Brian O'Connor | 5ab426f | 2016-04-09 01:19:45 -0700 | [diff] [blame^] | 2 | * Copyright 2016-present Open Networking Laboratory |
Jonathan Hart | 7d7e2f5 | 2016-03-29 16:22:49 -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 | |
| 17 | package org.onosproject.incubator.net.routing; |
| 18 | |
| 19 | import org.onlab.packet.IpAddress; |
| 20 | import org.onosproject.event.ListenerService; |
| 21 | |
| 22 | import java.util.Collection; |
Jonathan Hart | bfc5c48 | 2016-04-05 18:57:00 -0700 | [diff] [blame] | 23 | import java.util.Map; |
Jonathan Hart | 7d7e2f5 | 2016-03-29 16:22:49 -0700 | [diff] [blame] | 24 | |
| 25 | /** |
Jonathan Hart | bfc5c48 | 2016-04-05 18:57:00 -0700 | [diff] [blame] | 26 | * Unicast IP route service. |
Jonathan Hart | 7d7e2f5 | 2016-03-29 16:22:49 -0700 | [diff] [blame] | 27 | */ |
| 28 | public interface RouteService extends ListenerService<RouteEvent, RouteListener> { |
| 29 | |
| 30 | /** |
Jonathan Hart | bfc5c48 | 2016-04-05 18:57:00 -0700 | [diff] [blame] | 31 | * Returns all routes for all route tables in the system. |
Jonathan Hart | 7d7e2f5 | 2016-03-29 16:22:49 -0700 | [diff] [blame] | 32 | * |
Jonathan Hart | bfc5c48 | 2016-04-05 18:57:00 -0700 | [diff] [blame] | 33 | * @return map of route table name to routes in that table |
Jonathan Hart | 7d7e2f5 | 2016-03-29 16:22:49 -0700 | [diff] [blame] | 34 | */ |
Jonathan Hart | bfc5c48 | 2016-04-05 18:57:00 -0700 | [diff] [blame] | 35 | Map<RouteTableId, Collection<Route>> getAllRoutes(); |
Jonathan Hart | 7d7e2f5 | 2016-03-29 16:22:49 -0700 | [diff] [blame] | 36 | |
| 37 | /** |
Jonathan Hart | bfc5c48 | 2016-04-05 18:57:00 -0700 | [diff] [blame] | 38 | * Performs a longest prefix match on the given IP address. The call will |
| 39 | * return the route with the most specific prefix that contains the given |
| 40 | * IP address. |
Jonathan Hart | 7d7e2f5 | 2016-03-29 16:22:49 -0700 | [diff] [blame] | 41 | * |
Jonathan Hart | bfc5c48 | 2016-04-05 18:57:00 -0700 | [diff] [blame] | 42 | * @param ip IP address |
Jonathan Hart | 7d7e2f5 | 2016-03-29 16:22:49 -0700 | [diff] [blame] | 43 | * @return longest prefix matched route |
| 44 | */ |
| 45 | Route longestPrefixMatch(IpAddress ip); |
| 46 | |
Jonathan Hart | 7d7e2f5 | 2016-03-29 16:22:49 -0700 | [diff] [blame] | 47 | } |