summaryrefslogtreecommitdiffstats
path: root/src/bin/dhcp4/tests/dhcp4_client.cc
diff options
context:
space:
mode:
authorTomek Mrugalski <tomasz@isc.org>2015-09-08 14:35:28 +0200
committerTomek Mrugalski <tomasz@isc.org>2015-09-08 16:04:57 +0200
commit348b7382dd9ddfeaffc0bfa45bb862f01e42df36 (patch)
treec141fe27988654c654e24eddd4cd3db8514941ef /src/bin/dhcp4/tests/dhcp4_client.cc
parent[master] ChangeLog updated after 3983 merge. (diff)
downloadkea-348b7382dd9ddfeaffc0bfa45bb862f01e42df36.tar.xz
kea-348b7382dd9ddfeaffc0bfa45bb862f01e42df36.zip
[3981] DHCPDECLINE support implemented.
Diffstat (limited to 'src/bin/dhcp4/tests/dhcp4_client.cc')
-rw-r--r--src/bin/dhcp4/tests/dhcp4_client.cc24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/bin/dhcp4/tests/dhcp4_client.cc b/src/bin/dhcp4/tests/dhcp4_client.cc
index 750e6657b2..6ff104aba8 100644
--- a/src/bin/dhcp4/tests/dhcp4_client.cc
+++ b/src/bin/dhcp4/tests/dhcp4_client.cc
@@ -281,6 +281,30 @@ Dhcp4Client::doRelease() {
}
void
+Dhcp4Client::doDecline() {
+ if (config_.lease_.addr_ == IOAddress::IPV4_ZERO_ADDRESS()) {
+ isc_throw(Dhcp4ClientError, "failed to send the decline"
+ " message because client doesn't have a lease");
+ }
+ context_.query_ = createMsg(DHCPDECLINE);
+
+ // Set ciaddr to 0.
+ context_.query_->setCiaddr(IOAddress("0.0.0.0"));
+
+ // Include Requested IP Address Option
+ addRequestedAddress(config_.lease_.addr_);
+
+ // Include client identifier.
+ appendClientId();
+
+ // Remove configuration.
+ config_.reset();
+
+ // Send the message to the server.
+ sendMsg(context_.query_);
+}
+
+void
Dhcp4Client::doRequest() {
context_.query_ = createMsg(DHCPREQUEST);