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 | */ |
Thomas Vachuska | b81c278 | 2015-08-21 14:21:50 -0700 | [diff] [blame] | 33 | Map<MacAddress, Ip4Address> listMapping(); |
samanwita pal | f66ed8a | 2015-07-21 15:45:33 -0700 | [diff] [blame] | 34 | |
| 35 | /** |
| 36 | * Returns the default lease time granted by the DHCP Server. |
| 37 | * |
| 38 | * @return lease time |
| 39 | */ |
Thomas Vachuska | b81c278 | 2015-08-21 14:21:50 -0700 | [diff] [blame] | 40 | int getLeaseTime(); |
samanwita pal | f66ed8a | 2015-07-21 15:45:33 -0700 | [diff] [blame] | 41 | |
| 42 | /** |
| 43 | * Returns the default renewal time granted by the DHCP Server. |
| 44 | * |
| 45 | * @return renewal time |
| 46 | */ |
Thomas Vachuska | b81c278 | 2015-08-21 14:21:50 -0700 | [diff] [blame] | 47 | int getRenewalTime(); |
samanwita pal | f66ed8a | 2015-07-21 15:45:33 -0700 | [diff] [blame] | 48 | |
| 49 | /** |
| 50 | * Returns the default rebinding time granted by the DHCP Server. |
| 51 | * |
| 52 | * @return rebinding time |
| 53 | */ |
Thomas Vachuska | b81c278 | 2015-08-21 14:21:50 -0700 | [diff] [blame] | 54 | int getRebindingTime(); |
samanwita pal | f66ed8a | 2015-07-21 15:45:33 -0700 | [diff] [blame] | 55 | |
| 56 | /** |
| 57 | * Registers a static IP mapping with the DHCP Server. |
| 58 | * |
Thomas Vachuska | b81c278 | 2015-08-21 14:21:50 -0700 | [diff] [blame] | 59 | * @param macID macID of the client |
samanwita pal | f66ed8a | 2015-07-21 15:45:33 -0700 | [diff] [blame] | 60 | * @param ipAddress IP Address requested for the client |
| 61 | * @return true if the mapping was successfully registered, false otherwise |
| 62 | */ |
Thomas Vachuska | b81c278 | 2015-08-21 14:21:50 -0700 | [diff] [blame] | 63 | boolean setStaticMapping(MacAddress macID, Ip4Address ipAddress); |
samanwita pal | f66ed8a | 2015-07-21 15:45:33 -0700 | [diff] [blame] | 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 | */ |
Thomas Vachuska | b81c278 | 2015-08-21 14:21:50 -0700 | [diff] [blame] | 71 | boolean removeStaticMapping(MacAddress macID); |
samanwita pal | f66ed8a | 2015-07-21 15:45:33 -0700 | [diff] [blame] | 72 | |
| 73 | /** |
| 74 | * Returns the list of all the available IPs with the server. |
| 75 | * |
| 76 | * @return list of available IPs |
| 77 | */ |
Thomas Vachuska | b81c278 | 2015-08-21 14:21:50 -0700 | [diff] [blame] | 78 | Iterable<Ip4Address> getAvailableIPs(); |
samanwita pal | f66ed8a | 2015-07-21 15:45:33 -0700 | [diff] [blame] | 79 | |
| 80 | } |