blob: 0afda108c6b91ef1cb45c6d52df0b7a340b989a9 [file] [log] [blame]
samanwita palf66ed8a2015-07-21 15:45:33 -07001/*
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 */
16package org.onosproject.dhcpserver;
17
18import org.onlab.packet.Ip4Address;
19import org.onlab.packet.MacAddress;
20
21import java.util.Map;
22
23/**
24 * DHCP Service Interface.
25 */
26public interface DHCPService {
27
28 /**
29 * Returns a collection of all the MacAddress to IPAddress mapping.
30 *
31 * @return collection of mappings.
32 */
Thomas Vachuskab81c2782015-08-21 14:21:50 -070033 Map<MacAddress, Ip4Address> listMapping();
samanwita palf66ed8a2015-07-21 15:45:33 -070034
35 /**
36 * Returns the default lease time granted by the DHCP Server.
37 *
38 * @return lease time
39 */
Thomas Vachuskab81c2782015-08-21 14:21:50 -070040 int getLeaseTime();
samanwita palf66ed8a2015-07-21 15:45:33 -070041
42 /**
43 * Returns the default renewal time granted by the DHCP Server.
44 *
45 * @return renewal time
46 */
Thomas Vachuskab81c2782015-08-21 14:21:50 -070047 int getRenewalTime();
samanwita palf66ed8a2015-07-21 15:45:33 -070048
49 /**
50 * Returns the default rebinding time granted by the DHCP Server.
51 *
52 * @return rebinding time
53 */
Thomas Vachuskab81c2782015-08-21 14:21:50 -070054 int getRebindingTime();
samanwita palf66ed8a2015-07-21 15:45:33 -070055
56 /**
57 * Registers a static IP mapping with the DHCP Server.
58 *
Thomas Vachuskab81c2782015-08-21 14:21:50 -070059 * @param macID macID of the client
samanwita palf66ed8a2015-07-21 15:45:33 -070060 * @param ipAddress IP Address requested for the client
61 * @return true if the mapping was successfully registered, false otherwise
62 */
Thomas Vachuskab81c2782015-08-21 14:21:50 -070063 boolean setStaticMapping(MacAddress macID, Ip4Address ipAddress);
samanwita palf66ed8a2015-07-21 15:45:33 -070064
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 Vachuskab81c2782015-08-21 14:21:50 -070071 boolean removeStaticMapping(MacAddress macID);
samanwita palf66ed8a2015-07-21 15:45:33 -070072
73 /**
74 * Returns the list of all the available IPs with the server.
75 *
76 * @return list of available IPs
77 */
Thomas Vachuskab81c2782015-08-21 14:21:50 -070078 Iterable<Ip4Address> getAvailableIPs();
samanwita palf66ed8a2015-07-21 15:45:33 -070079
80}