|
| 1 | +/* |
| 2 | + * $Id$ |
| 3 | + * |
| 4 | + * Copyright (C) 2003-2015 JNode.org |
| 5 | + * |
| 6 | + * This library is free software; you can redistribute it and/or modify it |
| 7 | + * under the terms of the GNU Lesser General Public License as published |
| 8 | + * by the Free Software Foundation; either version 2.1 of the License, or |
| 9 | + * (at your option) any later version. |
| 10 | + * |
| 11 | + * This library is distributed in the hope that it will be useful, but |
| 12 | + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
| 13 | + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public |
| 14 | + * License for more details. |
| 15 | + * |
| 16 | + * You should have received a copy of the GNU Lesser General Public License |
| 17 | + * along with this library; If not, write to the Free Software Foundation, Inc., |
| 18 | + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 19 | + */ |
| 20 | + |
| 21 | +package org.jnode.net; |
| 22 | + |
| 23 | +import org.jnode.driver.Device; |
| 24 | +import org.jnode.util.TimeoutException; |
| 25 | + |
| 26 | +/** |
| 27 | + * Interface for ARP services that can resolve protocol addresses to hardware addresses. |
| 28 | + * This interface allows IPv4 and other protocols to use ARP without depending on the |
| 29 | + * ARP implementation package. |
| 30 | + * |
| 31 | + * @author epr |
| 32 | + */ |
| 33 | +public interface ARPService { |
| 34 | + |
| 35 | + /** |
| 36 | + * Gets the hardware address for a given protocol address. |
| 37 | + * |
| 38 | + * @param address The protocol address to resolve |
| 39 | + * @param myAddress My protocol address |
| 40 | + * @param device The device to use for the ARP request |
| 41 | + * @param timeout Timeout in milliseconds |
| 42 | + * @return The hardware address |
| 43 | + * @throws TimeoutException If the address could not be resolved within the timeout |
| 44 | + * @throws org.jnode.driver.net.NetworkException If a network error occurs |
| 45 | + */ |
| 46 | + HardwareAddress getHardwareAddress(ProtocolAddress address, ProtocolAddress myAddress, |
| 47 | + Device device, long timeout) throws TimeoutException, org.jnode.driver.net.NetworkException; |
| 48 | + |
| 49 | + /** |
| 50 | + * Sets an entry in the ARP cache. |
| 51 | + * |
| 52 | + * @param hardwareAddress The hardware address |
| 53 | + * @param protocolAddress The protocol address |
| 54 | + * @param permanent If true, the entry is permanent and won't expire |
| 55 | + */ |
| 56 | + void setCacheEntry(HardwareAddress hardwareAddress, ProtocolAddress protocolAddress, boolean permanent); |
| 57 | +} |
0 commit comments