2 * This file is open source software, licensed to you under the terms
3 * of the Apache License, Version 2.0 (the "License"). See the NOTICE file
4 * distributed with this work for additional information regarding copyright
5 * ownership. You may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing,
12 * software distributed under the License is distributed on an
13 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 * KIND, either express or implied. See the License for the
15 * specific language governing permissions and limitations
19 * Copyright 2014 Cloudius Systems
24 #include <seastar/net/ip.hh>
25 #include <seastar/core/reactor.hh>
26 #include <seastar/util/std-compat.hh>
33 * Simplistic DHCP query class.
34 * Due to the nature of the native stack,
35 * it operates on an "ipv4" object instead of,
36 * for example, an interface.
44 static const steady_clock_type::duration default_timeout;
49 ipv4_address broadcast;
52 ipv4_address dhcp_server;
54 std::vector<ipv4_address> name_servers;
56 std::chrono::seconds lease_time;
57 std::chrono::seconds renew_time;
58 std::chrono::seconds rebind_time;
63 typedef future<compat::optional<lease>> result_type;
66 * Runs a discover/request sequence on the ipv4 "stack".
67 * During this execution the ipv4 will be "hijacked"
68 * more or less (through packet filter), and while not
69 * inoperable, most likely quite less efficient.
71 * Please note that this does _not_ modify the ipv4 object bound.
72 * It only makes queries and records replys for the related NIC.
73 * It is up to caller to use the returned information as he se fit.
75 result_type discover(const steady_clock_type::duration & = default_timeout);
76 result_type renew(const lease &, const steady_clock_type::duration & = default_timeout);
77 ip_packet_filter* get_ipv4_filter();
80 std::unique_ptr<impl> _impl;