alshabib | b7b4063 | 2014-09-28 21:30:00 -0700 | [diff] [blame] | 1 | package org.onlab.onos.net.proxyarp; |
| 2 | |
alshabib | c274c90 | 2014-10-03 14:58:27 -0700 | [diff] [blame] | 3 | import org.onlab.onos.net.packet.PacketContext; |
alshabib | b7b4063 | 2014-09-28 21:30:00 -0700 | [diff] [blame] | 4 | import org.onlab.packet.Ethernet; |
| 5 | import org.onlab.packet.IpPrefix; |
| 6 | |
| 7 | /** |
| 8 | * Service for processing arp requests on behalf of applications. |
| 9 | */ |
tom | f5d85d4 | 2014-10-02 05:27:56 -0700 | [diff] [blame] | 10 | // TODO: move to the peer host package |
alshabib | b7b4063 | 2014-09-28 21:30:00 -0700 | [diff] [blame] | 11 | public interface ProxyArpService { |
| 12 | |
| 13 | /** |
| 14 | * Returns whether this particular ip address is known to the system. |
| 15 | * |
tom | 44179d6 | 2014-10-02 05:31:25 -0700 | [diff] [blame] | 16 | * @param addr a ip address |
alshabib | b7b4063 | 2014-09-28 21:30:00 -0700 | [diff] [blame] | 17 | * @return true if know, false otherwise |
| 18 | */ |
| 19 | boolean known(IpPrefix addr); |
| 20 | |
| 21 | /** |
| 22 | * Sends a reply for a given request. If the host is not known then the arp |
| 23 | * will be flooded at all edge ports. |
| 24 | * |
tom | 44179d6 | 2014-10-02 05:31:25 -0700 | [diff] [blame] | 25 | * @param eth an arp request |
alshabib | b7b4063 | 2014-09-28 21:30:00 -0700 | [diff] [blame] | 26 | */ |
alshabib | b5522ff | 2014-09-29 19:20:00 -0700 | [diff] [blame] | 27 | void reply(Ethernet eth); |
| 28 | |
| 29 | /** |
| 30 | * Forwards an ARP request to its destination. Floods at the edge the ARP request if the |
| 31 | * destination is not known. |
tom | 44179d6 | 2014-10-02 05:31:25 -0700 | [diff] [blame] | 32 | * |
alshabib | b5522ff | 2014-09-29 19:20:00 -0700 | [diff] [blame] | 33 | * @param eth an ethernet frame containing an ARP request. |
| 34 | */ |
| 35 | void forward(Ethernet eth); |
alshabib | b7b4063 | 2014-09-28 21:30:00 -0700 | [diff] [blame] | 36 | |
alshabib | c274c90 | 2014-10-03 14:58:27 -0700 | [diff] [blame] | 37 | /** |
| 38 | * Handles a arp packet. |
| 39 | * Replies to arp requests and forwards request to the right place. |
| 40 | * @param context the packet context to handle |
| 41 | * @return true if handled, false otherwise. |
| 42 | */ |
| 43 | boolean handleArp(PacketContext context); |
| 44 | |
alshabib | b7b4063 | 2014-09-28 21:30:00 -0700 | [diff] [blame] | 45 | } |