samanwita pal | f66ed8a | 2015-07-21 15:45:33 -0700 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright 2014 Open Networking Laboratory |
| 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 | package org.onosproject.dhcpserver; |
| 17 | |
| 18 | import org.onlab.packet.Ip4Address; |
| 19 | import org.onlab.packet.MacAddress; |
| 20 | |
| 21 | import java.util.Map; |
| 22 | |
| 23 | /** |
| 24 | * DHCP Service Interface. |
| 25 | */ |
| 26 | public interface DHCPService { |
| 27 | |
| 28 | /** |
| 29 | * Returns a collection of all the MacAddress to IPAddress mapping. |
| 30 | * |
| 31 | * @return collection of mappings. |
| 32 | */ |
| 33 | public Map<MacAddress, Ip4Address> listMapping(); |
| 34 | |
| 35 | /** |
| 36 | * Returns the default lease time granted by the DHCP Server. |
| 37 | * |
| 38 | * @return lease time |
| 39 | */ |
| 40 | public int getLeaseTime(); |
| 41 | |
| 42 | /** |
| 43 | * Returns the default renewal time granted by the DHCP Server. |
| 44 | * |
| 45 | * @return renewal time |
| 46 | */ |
| 47 | public int getRenewalTime(); |
| 48 | |
| 49 | /** |
| 50 | * Returns the default rebinding time granted by the DHCP Server. |
| 51 | * |
| 52 | * @return rebinding time |
| 53 | */ |
| 54 | public int getRebindingTime(); |
| 55 | |
| 56 | /** |
| 57 | * Registers a static IP mapping with the DHCP Server. |
| 58 | * |
| 59 | * @param macID macID of the client |
| 60 | * @param ipAddress IP Address requested for the client |
| 61 | * @return true if the mapping was successfully registered, false otherwise |
| 62 | */ |
| 63 | public boolean setStaticMapping(MacAddress macID, Ip4Address ipAddress); |
| 64 | |
| 65 | /** |
| 66 | * Removes a static IP mapping with the DHCP Server. |
| 67 | * |
| 68 | * @param macID macID of the client |
| 69 | * @return true if the mapping was successfully removed, false otherwise |
| 70 | */ |
| 71 | public boolean removeStaticMapping(MacAddress macID); |
| 72 | |
| 73 | /** |
| 74 | * Returns the list of all the available IPs with the server. |
| 75 | * |
| 76 | * @return list of available IPs |
| 77 | */ |
| 78 | public Iterable<Ip4Address> getAvailableIPs(); |
| 79 | |
| 80 | } |