blob: 0a3d973e9ff1b88f3adc71290eef787bd8cef321 [file] [log] [blame]
samanwita pal18696f62015-07-17 13:15:43 -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
21/**
22 * DHCPStore Interface.
23 */
24public interface DHCPStore {
25
26 /**
27 * Returns an IP Address for a Mac ID, in response to a DHCP DISCOVER message.
28 *
29 * @param macID Mac ID of the client requesting an IP
30 * @return IP address assigned to the Mac ID
31 */
32 Ip4Address suggestIP(MacAddress macID);
33
34 /**
35 * Assigns the requested IP to the Mac ID, in response to a DHCP REQUEST message.
36 *
37 * @param macID Mac Id of the client requesting an IP
38 * @param ipAddr IP Address being requested
39 * @param leaseTime Lease time offered by the server for this mapping
40 * @return returns true if the assignment was successful, false otherwise
41 */
42 boolean assignIP(MacAddress macID, Ip4Address ipAddr, long leaseTime);
43
44 /**
45 * Sets the default time for which suggested IP mappings are valid.
46 *
47 * @param timeInSeconds default time for IP mappings to be valid
48 */
49 void setDefaultTimeoutForPurge(long timeInSeconds);
50
51 /**
52 * Releases the IP assigned to a Mac ID into the free pool.
53 *
54 * @param macID the macID for which the mapping needs to be changed
55 */
56 void releaseIP(MacAddress macID);
57
58}