samanwita pal | f28207b | 2015-09-04 10:41:56 -0700 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2015-present Open Networking Foundation |
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 | |
| 22 | import java.util.Map; |
| 23 | |
daniel | cd9deed | 2015-10-30 17:16:16 +0900 | [diff] [blame] | 24 | |
samanwita pal | f28207b | 2015-09-04 10:41:56 -0700 | [diff] [blame] | 25 | /** |
| 26 | * DHCP Service Interface. |
| 27 | */ |
Thomas Vachuska | a1da42e | 2015-09-09 00:45:22 -0700 | [diff] [blame] | 28 | public interface DhcpService { |
samanwita pal | f28207b | 2015-09-04 10:41:56 -0700 | [diff] [blame] | 29 | |
| 30 | /** |
| 31 | * Returns a collection of all the MacAddress to IPAddress mapping. |
| 32 | * |
| 33 | * @return collection of mappings. |
| 34 | */ |
samanwita pal | 2a31340 | 2015-09-14 16:03:22 -0700 | [diff] [blame] | 35 | Map<HostId, IpAssignment> listMapping(); |
samanwita pal | f28207b | 2015-09-04 10:41:56 -0700 | [diff] [blame] | 36 | |
| 37 | /** |
| 38 | * Returns the default lease time granted by the DHCP Server. |
| 39 | * |
| 40 | * @return lease time |
| 41 | */ |
| 42 | int getLeaseTime(); |
| 43 | |
| 44 | /** |
| 45 | * Returns the default renewal time granted by the DHCP Server. |
| 46 | * |
| 47 | * @return renewal time |
| 48 | */ |
| 49 | int getRenewalTime(); |
| 50 | |
| 51 | /** |
| 52 | * Returns the default rebinding time granted by the DHCP Server. |
| 53 | * |
| 54 | * @return rebinding time |
| 55 | */ |
| 56 | int getRebindingTime(); |
| 57 | |
| 58 | /** |
| 59 | * Registers a static IP mapping with the DHCP Server. |
| 60 | * |
Hyunsun Moon | 04b1fe9 | 2016-05-18 21:28:06 -0700 | [diff] [blame] | 61 | * @param macAddress mac address to have a given ip assignment |
| 62 | * @param ipRequest ip address and dhcp options |
daniel | cd9deed | 2015-10-30 17:16:16 +0900 | [diff] [blame] | 63 | * @return true if the mapping was successfully added, false otherwise |
samanwita pal | f28207b | 2015-09-04 10:41:56 -0700 | [diff] [blame] | 64 | */ |
Hyunsun Moon | 04b1fe9 | 2016-05-18 21:28:06 -0700 | [diff] [blame] | 65 | boolean setStaticMapping(MacAddress macAddress, IpAssignment ipRequest); |
samanwita pal | f28207b | 2015-09-04 10:41:56 -0700 | [diff] [blame] | 66 | |
| 67 | /** |
| 68 | * Removes a static IP mapping with the DHCP Server. |
| 69 | * |
| 70 | * @param macID macID of the client |
| 71 | * @return true if the mapping was successfully removed, false otherwise |
| 72 | */ |
| 73 | boolean removeStaticMapping(MacAddress macID); |
| 74 | |
| 75 | /** |
| 76 | * Returns the list of all the available IPs with the server. |
| 77 | * |
| 78 | * @return list of available IPs |
| 79 | */ |
| 80 | Iterable<Ip4Address> getAvailableIPs(); |
samanwita pal | f28207b | 2015-09-04 10:41:56 -0700 | [diff] [blame] | 81 | } |