samanwita pal | f28207b | 2015-09-04 10:41:56 -0700 | [diff] [blame] | 1 | /* |
Thomas Vachuska | 54dc352 | 2015-09-09 00:11:45 -0700 | [diff] [blame] | 2 | * Copyright 2015 Open Networking Laboratory |
samanwita pal | f28207b | 2015-09-04 10:41:56 -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 | */ |
| 16 | package org.onosproject.dhcp; |
| 17 | |
| 18 | import org.onlab.packet.Ip4Address; |
| 19 | import org.onlab.packet.MacAddress; |
samanwita pal | 2a31340 | 2015-09-14 16:03:22 -0700 | [diff] [blame] | 20 | import org.onosproject.net.HostId; |
samanwita pal | f28207b | 2015-09-04 10:41:56 -0700 | [diff] [blame] | 21 | |
daniel | cd9deed | 2015-10-30 17:16:16 +0900 | [diff] [blame] | 22 | import java.util.List; |
samanwita pal | f28207b | 2015-09-04 10:41:56 -0700 | [diff] [blame] | 23 | import java.util.Map; |
| 24 | |
daniel | cd9deed | 2015-10-30 17:16:16 +0900 | [diff] [blame] | 25 | |
samanwita pal | f28207b | 2015-09-04 10:41:56 -0700 | [diff] [blame] | 26 | /** |
| 27 | * DHCP Service Interface. |
| 28 | */ |
Thomas Vachuska | a1da42e | 2015-09-09 00:45:22 -0700 | [diff] [blame] | 29 | public interface DhcpService { |
samanwita pal | f28207b | 2015-09-04 10:41:56 -0700 | [diff] [blame] | 30 | |
| 31 | /** |
| 32 | * Returns a collection of all the MacAddress to IPAddress mapping. |
| 33 | * |
| 34 | * @return collection of mappings. |
| 35 | */ |
samanwita pal | 2a31340 | 2015-09-14 16:03:22 -0700 | [diff] [blame] | 36 | Map<HostId, IpAssignment> listMapping(); |
samanwita pal | f28207b | 2015-09-04 10:41:56 -0700 | [diff] [blame] | 37 | |
| 38 | /** |
| 39 | * Returns the default lease time granted by the DHCP Server. |
| 40 | * |
| 41 | * @return lease time |
| 42 | */ |
| 43 | int getLeaseTime(); |
| 44 | |
| 45 | /** |
| 46 | * Returns the default renewal time granted by the DHCP Server. |
| 47 | * |
| 48 | * @return renewal time |
| 49 | */ |
| 50 | int getRenewalTime(); |
| 51 | |
| 52 | /** |
| 53 | * Returns the default rebinding time granted by the DHCP Server. |
| 54 | * |
| 55 | * @return rebinding time |
| 56 | */ |
| 57 | int getRebindingTime(); |
| 58 | |
| 59 | /** |
| 60 | * Registers a static IP mapping with the DHCP Server. |
daniel | 877bb2f | 2015-11-12 21:33:05 +0900 | [diff] [blame] | 61 | * Supports rangeNotEnforced option |
samanwita pal | f28207b | 2015-09-04 10:41:56 -0700 | [diff] [blame] | 62 | * |
daniel | cd9deed | 2015-10-30 17:16:16 +0900 | [diff] [blame] | 63 | * @param macID macID of the client |
samanwita pal | f28207b | 2015-09-04 10:41:56 -0700 | [diff] [blame] | 64 | * @param ipAddress IP Address requested for the client |
daniel | 877bb2f | 2015-11-12 21:33:05 +0900 | [diff] [blame] | 65 | * @param rangeNotEnforced true if rangeNotEnforced was set and the mapping will be eternal |
| 66 | * @param addressList subnetMask, DHCP/Router/DNS IP Addresses if rangeNotEnforced was set |
daniel | cd9deed | 2015-10-30 17:16:16 +0900 | [diff] [blame] | 67 | * @return true if the mapping was successfully added, false otherwise |
samanwita pal | f28207b | 2015-09-04 10:41:56 -0700 | [diff] [blame] | 68 | */ |
daniel | 877bb2f | 2015-11-12 21:33:05 +0900 | [diff] [blame] | 69 | boolean setStaticMapping(MacAddress macID, Ip4Address ipAddress, boolean rangeNotEnforced, |
daniel | cd9deed | 2015-10-30 17:16:16 +0900 | [diff] [blame] | 70 | List<Ip4Address> addressList); |
samanwita pal | f28207b | 2015-09-04 10:41:56 -0700 | [diff] [blame] | 71 | |
| 72 | /** |
| 73 | * Removes a static IP mapping with the DHCP Server. |
| 74 | * |
| 75 | * @param macID macID of the client |
| 76 | * @return true if the mapping was successfully removed, false otherwise |
| 77 | */ |
| 78 | boolean removeStaticMapping(MacAddress macID); |
| 79 | |
| 80 | /** |
| 81 | * Returns the list of all the available IPs with the server. |
| 82 | * |
| 83 | * @return list of available IPs |
| 84 | */ |
| 85 | Iterable<Ip4Address> getAvailableIPs(); |
samanwita pal | f28207b | 2015-09-04 10:41:56 -0700 | [diff] [blame] | 86 | } |