Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [diff] [blame] | 1 | /* |
Brian O'Connor | 5ab426f | 2016-04-09 01:19:45 -0700 | [diff] [blame] | 2 | * Copyright 2014-present Open Networking Laboratory |
Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -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 | */ |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 16 | package org.onosproject.net.proxyarp; |
alshabib | b7b4063 | 2014-09-28 21:30:00 -0700 | [diff] [blame] | 17 | |
| 18 | import org.onlab.packet.Ethernet; |
Kunihiro Ishiguro | f1bff50 | 2015-01-30 15:47:06 -0800 | [diff] [blame] | 19 | import org.onlab.packet.IpAddress; |
Jonathan Hart | f84591d | 2015-01-16 14:33:43 -0800 | [diff] [blame] | 20 | import org.onosproject.net.ConnectPoint; |
| 21 | import org.onosproject.net.packet.PacketContext; |
alshabib | b7b4063 | 2014-09-28 21:30:00 -0700 | [diff] [blame] | 22 | |
| 23 | /** |
Jonathan Hart | 39ee648 | 2015-08-31 16:00:19 +0200 | [diff] [blame] | 24 | * Service for processing ARP or NDP requests on behalf of applications. |
alshabib | b7b4063 | 2014-09-28 21:30:00 -0700 | [diff] [blame] | 25 | */ |
tom | f5d85d4 | 2014-10-02 05:27:56 -0700 | [diff] [blame] | 26 | // TODO: move to the peer host package |
alshabib | b7b4063 | 2014-09-28 21:30:00 -0700 | [diff] [blame] | 27 | public interface ProxyArpService { |
| 28 | |
| 29 | /** |
Kunihiro Ishiguro | f1bff50 | 2015-01-30 15:47:06 -0800 | [diff] [blame] | 30 | * Returns whether this particular IP address is known to the system. |
alshabib | b7b4063 | 2014-09-28 21:30:00 -0700 | [diff] [blame] | 31 | * |
Kunihiro Ishiguro | f1bff50 | 2015-01-30 15:47:06 -0800 | [diff] [blame] | 32 | * @param addr an IP address |
alshabib | b7b4063 | 2014-09-28 21:30:00 -0700 | [diff] [blame] | 33 | * @return true if know, false otherwise |
| 34 | */ |
Kunihiro Ishiguro | f1bff50 | 2015-01-30 15:47:06 -0800 | [diff] [blame] | 35 | boolean isKnown(IpAddress addr); |
alshabib | b7b4063 | 2014-09-28 21:30:00 -0700 | [diff] [blame] | 36 | |
| 37 | /** |
Kunihiro Ishiguro | f1bff50 | 2015-01-30 15:47:06 -0800 | [diff] [blame] | 38 | * Sends a reply for a given request. If the host is not known then the |
| 39 | * arp or neighbor solicitation will be flooded at all edge ports. |
alshabib | b7b4063 | 2014-09-28 21:30:00 -0700 | [diff] [blame] | 40 | * |
Kunihiro Ishiguro | f1bff50 | 2015-01-30 15:47:06 -0800 | [diff] [blame] | 41 | * @param eth an arp or neighbor solicitation request |
Jonathan Hart | dbdbdbb | 2014-10-06 18:35:30 -0700 | [diff] [blame] | 42 | * @param inPort the port the request was received on |
alshabib | b7b4063 | 2014-09-28 21:30:00 -0700 | [diff] [blame] | 43 | */ |
Jonathan Hart | dbdbdbb | 2014-10-06 18:35:30 -0700 | [diff] [blame] | 44 | void reply(Ethernet eth, ConnectPoint inPort); |
alshabib | b5522ff | 2014-09-29 19:20:00 -0700 | [diff] [blame] | 45 | |
| 46 | /** |
Kunihiro Ishiguro | f1bff50 | 2015-01-30 15:47:06 -0800 | [diff] [blame] | 47 | * Forwards an ARP or neighbor solicitation request to its destination. |
| 48 | * Floods at the edg the request if the destination is not known. |
tom | 44179d6 | 2014-10-02 05:31:25 -0700 | [diff] [blame] | 49 | * |
Kunihiro Ishiguro | f1bff50 | 2015-01-30 15:47:06 -0800 | [diff] [blame] | 50 | * @param eth an ethernet frame containing an ARP or neighbor solicitation |
| 51 | * request. |
Jonathan Hart | f84591d | 2015-01-16 14:33:43 -0800 | [diff] [blame] | 52 | * @param inPort the port the request was received on |
alshabib | b5522ff | 2014-09-29 19:20:00 -0700 | [diff] [blame] | 53 | */ |
Jonathan Hart | f84591d | 2015-01-16 14:33:43 -0800 | [diff] [blame] | 54 | void forward(Ethernet eth, ConnectPoint inPort); |
alshabib | b7b4063 | 2014-09-28 21:30:00 -0700 | [diff] [blame] | 55 | |
alshabib | c274c90 | 2014-10-03 14:58:27 -0700 | [diff] [blame] | 56 | /** |
Kunihiro Ishiguro | f1bff50 | 2015-01-30 15:47:06 -0800 | [diff] [blame] | 57 | * Handles a arp or neighbor solicitation packet. |
| 58 | * Replies to arp or neighbor solicitation requests and forwards request |
| 59 | * to the right place. |
alshabib | c274c90 | 2014-10-03 14:58:27 -0700 | [diff] [blame] | 60 | * @param context the packet context to handle |
| 61 | * @return true if handled, false otherwise. |
| 62 | */ |
Kunihiro Ishiguro | f1bff50 | 2015-01-30 15:47:06 -0800 | [diff] [blame] | 63 | boolean handlePacket(PacketContext context); |
alshabib | b7b4063 | 2014-09-28 21:30:00 -0700 | [diff] [blame] | 64 | } |