Commit 219324e6 authored by Tomek Mrugalski's avatar Tomek Mrugalski 🛰
Browse files

[1540] Huge (29 files changed) Option6 and Pkt6 refactoring in DHCP.

- Migrated from boost::shared_array to std::vector<uint8>
- Pkt6 now have all fields private, getters/setters implemented
- Many smaller clean-ups
- Tests updated to follow new procedure
- isc::util::OutputBuffer is now used
parent 03effee3
3XX. [func] tomek
libdhcp++: Option6 and Pkt6 now follow the same design as
options and packet for DHCPv4. General code refactoring after
end of 2011 year release.
(Trac #1540, git TBD)
359. [bug] kevin
Corrected SOA serial check in xfrout. It now compares the SOA
serial of an IXFR query with that of the server based serial
......
// Copyright (C) 2011 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2011-2012 Internet Systems Consortium, Inc. ("ISC")
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
......@@ -59,8 +59,8 @@ Dhcpv4Srv::~Dhcpv4Srv() {
bool
Dhcpv4Srv::run() {
while (!shutdown_) {
boost::shared_ptr<Pkt4> query; // client's message
boost::shared_ptr<Pkt4> rsp; // server's response
Pkt4Ptr query; // client's message
Pkt4Ptr rsp; // server's response
query = IfaceMgr::instance().receive4();
......@@ -141,14 +141,13 @@ Dhcpv4Srv::setServerID() {
#if 0
// uncomment this once ticket 1350 is merged.
IOAddress srvId("127.0.0.1");
serverid_ = boost::shared_ptr<Option>(
serverid_ = OptionPtr(
new Option4AddrLst(Option::V4, DHO_DHCP_SERVER_IDENTIFIER, srvId));
#endif
}
void Dhcpv4Srv::copyDefaultFields(const boost::shared_ptr<Pkt4>& question,
boost::shared_ptr<Pkt4>& answer) {
void Dhcpv4Srv::copyDefaultFields(const Pkt4Ptr& question, Pkt4Ptr& answer) {
answer->setIface(question->getIface());
answer->setIndex(question->getIndex());
answer->setCiaddr(question->getCiaddr());
......@@ -174,17 +173,17 @@ void Dhcpv4Srv::copyDefaultFields(const boost::shared_ptr<Pkt4>& question,
}
void Dhcpv4Srv::appendDefaultOptions(boost::shared_ptr<Pkt4>& msg, uint8_t msg_type) {
boost::shared_ptr<Option> opt;
void Dhcpv4Srv::appendDefaultOptions(Pkt4Ptr& msg, uint8_t msg_type) {
OptionPtr opt;
// add Message Type Option (type 53)
std::vector<uint8_t> tmp;
tmp.push_back(static_cast<uint8_t>(msg_type));
opt = boost::shared_ptr<Option>(new Option(Option::V4, DHO_DHCP_MESSAGE_TYPE, tmp));
opt = OptionPtr(new Option(Option::V4, DHO_DHCP_MESSAGE_TYPE, tmp));
msg->addOption(opt);
// DHCP Server Identifier (type 54)
opt = boost::shared_ptr<Option>
opt = OptionPtr
(new Option4AddrLst(DHO_DHCP_SERVER_IDENTIFIER, IOAddress(HARDCODED_SERVER_ID)));
msg->addOption(opt);
......@@ -192,47 +191,43 @@ void Dhcpv4Srv::appendDefaultOptions(boost::shared_ptr<Pkt4>& msg, uint8_t msg_t
}
void Dhcpv4Srv::appendRequestedOptions(boost::shared_ptr<Pkt4>& msg) {
boost::shared_ptr<Option> opt;
void Dhcpv4Srv::appendRequestedOptions(Pkt4Ptr& msg) {
OptionPtr opt;
// Domain name (type 15)
vector<uint8_t> domain(HARDCODED_DOMAIN_NAME.begin(), HARDCODED_DOMAIN_NAME.end());
opt = boost::shared_ptr<Option>(new Option(Option::V4, DHO_DOMAIN_NAME, domain));
opt = OptionPtr(new Option(Option::V4, DHO_DOMAIN_NAME, domain));
msg->addOption(opt);
// TODO: Add Option_String class
// DNS servers (type 6)
opt = boost::shared_ptr<Option>
(new Option4AddrLst(DHO_DOMAIN_NAME_SERVERS, IOAddress(HARDCODED_DNS_SERVER)));
opt = OptionPtr(new Option4AddrLst(DHO_DOMAIN_NAME_SERVERS, IOAddress(HARDCODED_DNS_SERVER)));
msg->addOption(opt);
}
void Dhcpv4Srv::tryAssignLease(boost::shared_ptr<Pkt4>& msg) {
boost::shared_ptr<Option> opt;
void Dhcpv4Srv::tryAssignLease(Pkt4Ptr& msg) {
OptionPtr opt;
// TODO: Implement actual lease assignment here
msg->setYiaddr(IOAddress(HARDCODED_LEASE));
// IP Address Lease time (type 51)
opt = boost::shared_ptr<Option>(new Option(Option::V4, DHO_DHCP_LEASE_TIME));
opt = OptionPtr(new Option(Option::V4, DHO_DHCP_LEASE_TIME));
opt->setUint32(HARDCODED_LEASE_TIME);
msg->addOption(opt);
// TODO: create Option_IntArray that holds list of integers, similar to Option4_AddrLst
// Subnet mask (type 1)
opt = boost::shared_ptr<Option>
(new Option4AddrLst(DHO_SUBNET_MASK, IOAddress(HARDCODED_NETMASK)));
opt = OptionPtr(new Option4AddrLst(DHO_SUBNET_MASK, IOAddress(HARDCODED_NETMASK)));
msg->addOption(opt);
// Router (type 3)
opt = boost::shared_ptr<Option>
(new Option4AddrLst(DHO_ROUTERS, IOAddress(HARDCODED_GATEWAY)));
opt = OptionPtr(new Option4AddrLst(DHO_ROUTERS, IOAddress(HARDCODED_GATEWAY)));
msg->addOption(opt);
}
boost::shared_ptr<Pkt4>
Dhcpv4Srv::processDiscover(boost::shared_ptr<Pkt4>& discover) {
boost::shared_ptr<Pkt4> offer = boost::shared_ptr<Pkt4>
Pkt4Ptr Dhcpv4Srv::processDiscover(Pkt4Ptr& discover) {
Pkt4Ptr offer = Pkt4Ptr
(new Pkt4(DHCPOFFER, discover->getTransid()));
copyDefaultFields(discover, offer);
......@@ -244,9 +239,8 @@ Dhcpv4Srv::processDiscover(boost::shared_ptr<Pkt4>& discover) {
return (offer);
}
boost::shared_ptr<Pkt4>
Dhcpv4Srv::processRequest(boost::shared_ptr<Pkt4>& request) {
boost::shared_ptr<Pkt4> ack = boost::shared_ptr<Pkt4>
Pkt4Ptr Dhcpv4Srv::processRequest(Pkt4Ptr& request) {
Pkt4Ptr ack = Pkt4Ptr
(new Pkt4(DHCPACK, request->getTransid()));
copyDefaultFields(request, ack);
......@@ -258,17 +252,17 @@ Dhcpv4Srv::processRequest(boost::shared_ptr<Pkt4>& request) {
return (ack);
}
void Dhcpv4Srv::processRelease(boost::shared_ptr<Pkt4>& release) {
void Dhcpv4Srv::processRelease(Pkt4Ptr& release) {
/// TODO: Implement this.
cout << "Received RELEASE on " << release->getIface() << " interface." << endl;
}
void Dhcpv4Srv::processDecline(boost::shared_ptr<Pkt4>& decline) {
void Dhcpv4Srv::processDecline(Pkt4Ptr& decline) {
/// TODO: Implement this.
cout << "Received DECLINE on " << decline->getIface() << " interface." << endl;
}
boost::shared_ptr<Pkt4> Dhcpv4Srv::processInform(boost::shared_ptr<Pkt4>& inform) {
Pkt4Ptr Dhcpv4Srv::processInform(Pkt4Ptr& inform) {
/// TODO: Currently implemented echo mode. Implement this for real
return (inform);
}
// Copyright (C) 2011 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2011-2012 Internet Systems Consortium, Inc. ("ISC")
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
......@@ -15,7 +15,6 @@
#ifndef DHCPV4_SRV_H
#define DHCPV4_SRV_H
#include <boost/shared_ptr.hpp>
#include <boost/noncopyable.hpp>
#include <dhcp/dhcp4.h>
#include <dhcp/pkt4.h>
......@@ -71,8 +70,7 @@ protected:
/// @param solicit DISCOVER message received from client
///
/// @return OFFER message or NULL
boost::shared_ptr<Pkt4>
processDiscover(boost::shared_ptr<Pkt4>& discover);
Pkt4Ptr processDiscover(Pkt4Ptr& discover);
/// @brief Processes incoming REQUEST and returns REPLY response.
///
......@@ -86,7 +84,7 @@ protected:
/// @param request a message received from client
///
/// @return ACK or NACK message
boost::shared_ptr<Pkt4> processRequest(boost::shared_ptr<Pkt4>& request);
Pkt4Ptr processRequest(Pkt4Ptr& request);
/// @brief Stub function that will handle incoming RELEASE messages.
///
......@@ -94,17 +92,17 @@ protected:
/// this function does not return anything.
///
/// @param release message received from client
void processRelease(boost::shared_ptr<Pkt4>& release);
void processRelease(Pkt4Ptr& release);
/// @brief Stub function that will handle incoming DHCPDECLINE messages.
///
/// @param decline message received from client
void processDecline(boost::shared_ptr<Pkt4>& decline);
void processDecline(Pkt4Ptr& decline);
/// @brief Stub function that will handle incoming INFORM messages.
///
/// @param infRequest message received from client
boost::shared_ptr<Pkt4> processInform(boost::shared_ptr<Pkt4>& inform);
Pkt4Ptr processInform(Pkt4Ptr& inform);
/// @brief Copies default parameters from client's to server's message
///
......@@ -113,9 +111,7 @@ protected:
///
/// @param question any message sent by client
/// @param answer any message server is going to send as response
void copyDefaultFields(const boost::shared_ptr<Pkt4>& question,
boost::shared_ptr<Pkt4>& answer);
void copyDefaultFields(const Pkt4Ptr& question, Pkt4Ptr& answer);
/// @brief Appends options requested by client.
///
......@@ -123,8 +119,7 @@ protected:
/// (sent in PRL) or are enforced by server.
///
/// @param msg outgoing message (options will be added here)
void appendRequestedOptions(boost::shared_ptr<Pkt4>& msg);
void appendRequestedOptions(Pkt4Ptr& msg);
/// @brief Assigns a lease and appends corresponding options
///
......@@ -136,20 +131,18 @@ protected:
/// used fixed, hardcoded lease.
///
/// @param msg OFFER or ACK message (lease options will be added here)
void tryAssignLease(boost::shared_ptr<Pkt4>& msg);
void tryAssignLease(Pkt4Ptr& msg);
/// @brief Appends default options to a message
///
/// @param msg message object (options will be added to it)
/// @param msg_type specifies message type
void appendDefaultOptions(boost::shared_ptr<Pkt4>& msg, uint8_t msg_type);
void appendDefaultOptions(Pkt4Ptr& msg, uint8_t msg_type);
/// @brief Returns server-intentifier option
///
/// @return server-id option
boost::shared_ptr<isc::dhcp::Option>
getServerID() { return serverid_; }
OptionPtr getServerID() { return serverid_; }
/// @brief Sets server-identifier.
///
......@@ -163,7 +156,7 @@ protected:
void setServerID();
/// server DUID (to be sent in server-identifier option)
boost::shared_ptr<isc::dhcp::Option> serverid_;
OptionPtr serverid_;
/// indicates if shutdown is in progress. Setting it to true will
/// initiate server shutdown procedure.
......
// Copyright (C) 2011 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2011-2012 Internet Systems Consortium, Inc. ("ISC")
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
......@@ -70,8 +70,8 @@ Dhcpv6Srv::~Dhcpv6Srv() {
bool
Dhcpv6Srv::run() {
while (!shutdown) {
boost::shared_ptr<Pkt6> query; // client's message
boost::shared_ptr<Pkt6> rsp; // server's response
Pkt6Ptr query; // client's message
Pkt6Ptr rsp; // server's response
query = IfaceMgr::instance().receive6();
......@@ -110,16 +110,16 @@ Dhcpv6Srv::run() {
<< query->getType() << endl;
}
cout << "Received " << query->data_len_ << " bytes packet type="
cout << "Received " << query->getBuffer().getLength() << " bytes packet type="
<< query->getType() << endl;
cout << query->toText();
if (rsp) {
rsp->remote_addr_ = query->remote_addr_;
rsp->local_addr_ = query->local_addr_;
rsp->remote_port_ = DHCP6_CLIENT_PORT;
rsp->local_port_ = DHCP6_SERVER_PORT;
rsp->ifindex_ = query->ifindex_;
rsp->iface_ = query->iface_;
rsp->setRemoteAddr(query->getRemoteAddr());
rsp->setLocalAddr(query->getLocalAddr());
rsp->setRemotePort(DHCP6_CLIENT_PORT);
rsp->setLocalPort(DHCP6_SERVER_PORT);
rsp->setIndex(query->getIndex());
rsp->setIface(query->getIface());
cout << "Replying with:" << rsp->getType() << endl;
cout << rsp->toText();
cout << "----" << endl;
......@@ -143,7 +143,7 @@ Dhcpv6Srv::setServerID() {
/// TODO implement this for real once interface detection is done.
/// Use hardcoded server-id for now
boost::shared_array<uint8_t> srvid(new uint8_t[14]);
OptionBuffer srvid(14);
srvid[0] = 0;
srvid[1] = 1; // DUID type 1 = DUID-LLT (see section 9.2 of RFC3315)
srvid[2] = 0;
......@@ -154,12 +154,11 @@ Dhcpv6Srv::setServerID() {
}
serverid_ = boost::shared_ptr<Option>(new Option(Option::V6,
D6O_SERVERID,
srvid,
0, 14));
srvid.begin(),
srvid.end()));
}
void Dhcpv6Srv::copyDefaultOptions(const boost::shared_ptr<Pkt6>& question,
boost::shared_ptr<Pkt6>& answer) {
void Dhcpv6Srv::copyDefaultOptions(const Pkt6Ptr& question, Pkt6Ptr& answer) {
// add client-id
boost::shared_ptr<Option> clientid = question->getOption(D6O_CLIENTID);
if (clientid) {
......@@ -169,8 +168,7 @@ void Dhcpv6Srv::copyDefaultOptions(const boost::shared_ptr<Pkt6>& question,
// TODO: Should throw if there is no client-id (except anonymous INF-REQUEST)
}
void Dhcpv6Srv::appendDefaultOptions(const boost::shared_ptr<Pkt6>& /*question*/,
boost::shared_ptr<Pkt6>& answer) {
void Dhcpv6Srv::appendDefaultOptions(const Pkt6Ptr& /*question*/, Pkt6Ptr& answer) {
// TODO: question is currently unused, but we need it at least to know
// message type we are answering
......@@ -179,8 +177,7 @@ void Dhcpv6Srv::appendDefaultOptions(const boost::shared_ptr<Pkt6>& /*question*/
}
void Dhcpv6Srv::appendRequestedOptions(const boost::shared_ptr<Pkt6>& /*question*/,
boost::shared_ptr<Pkt6>& answer) {
void Dhcpv6Srv::appendRequestedOptions(const Pkt6Ptr& /*question*/, Pkt6Ptr& answer) {
// TODO: question is currently unused, but we need to extract ORO from it
// and act on its content. Now we just send DNS-SERVERS option.
......@@ -190,8 +187,7 @@ void Dhcpv6Srv::appendRequestedOptions(const boost::shared_ptr<Pkt6>& /*question
answer->addOption(dnsservers);
}
void Dhcpv6Srv::assignLeases(const boost::shared_ptr<Pkt6>& question,
boost::shared_ptr<Pkt6>& answer) {
void Dhcpv6Srv::assignLeases(const Pkt6Ptr& question, Pkt6Ptr& answer) {
/// TODO Rewrite this once LeaseManager is implemented.
// answer client's IA (this is mostly a dummy,
......@@ -217,11 +213,9 @@ void Dhcpv6Srv::assignLeases(const boost::shared_ptr<Pkt6>& question,
}
}
boost::shared_ptr<Pkt6>
Dhcpv6Srv::processSolicit(const boost::shared_ptr<Pkt6>& solicit) {
Pkt6Ptr Dhcpv6Srv::processSolicit(const Pkt6Ptr& solicit) {
boost::shared_ptr<Pkt6> advertise(new Pkt6(DHCPV6_ADVERTISE,
solicit->getTransid()));
Pkt6Ptr advertise(new Pkt6(DHCPV6_ADVERTISE, solicit->getTransid()));
copyDefaultOptions(solicit, advertise);
appendDefaultOptions(solicit, advertise);
......@@ -232,11 +226,9 @@ Dhcpv6Srv::processSolicit(const boost::shared_ptr<Pkt6>& solicit) {
return (advertise);
}
boost::shared_ptr<Pkt6>
Dhcpv6Srv::processRequest(const boost::shared_ptr<Pkt6>& request) {
Pkt6Ptr Dhcpv6Srv::processRequest(const Pkt6Ptr& request) {
boost::shared_ptr<Pkt6> reply(new Pkt6(DHCPV6_REPLY,
request->getTransid()));
Pkt6Ptr reply(new Pkt6(DHCPV6_REPLY, request->getTransid()));
copyDefaultOptions(request, reply);
appendDefaultOptions(request, reply);
......@@ -247,50 +239,34 @@ Dhcpv6Srv::processRequest(const boost::shared_ptr<Pkt6>& request) {
return (reply);
}
boost::shared_ptr<Pkt6>
Dhcpv6Srv::processRenew(const boost::shared_ptr<Pkt6>& renew) {
boost::shared_ptr<Pkt6> reply(new Pkt6(DHCPV6_REPLY,
renew->getTransid(),
Pkt6::UDP));
Pkt6Ptr Dhcpv6Srv::processRenew(const Pkt6Ptr& renew) {
Pkt6Ptr reply(new Pkt6(DHCPV6_REPLY, renew->getTransid()));
return reply;
}
boost::shared_ptr<Pkt6>
Dhcpv6Srv::processRebind(const boost::shared_ptr<Pkt6>& rebind) {
boost::shared_ptr<Pkt6> reply(new Pkt6(DHCPV6_REPLY,
Pkt6Ptr Dhcpv6Srv::processRebind(const Pkt6Ptr& rebind) {
Pkt6Ptr reply(new Pkt6(DHCPV6_REPLY,
rebind->getTransid(),
Pkt6::UDP));
return reply;
}
boost::shared_ptr<Pkt6>
Dhcpv6Srv::processConfirm(const boost::shared_ptr<Pkt6>& confirm) {
boost::shared_ptr<Pkt6> reply(new Pkt6(DHCPV6_REPLY,
confirm->getTransid(),
Pkt6::UDP));
Pkt6Ptr Dhcpv6Srv::processConfirm(const Pkt6Ptr& confirm) {
Pkt6Ptr reply(new Pkt6(DHCPV6_REPLY, confirm->getTransid()));
return reply;
}
boost::shared_ptr<Pkt6>
Dhcpv6Srv::processRelease(const boost::shared_ptr<Pkt6>& release) {
boost::shared_ptr<Pkt6> reply(new Pkt6(DHCPV6_REPLY,
release->getTransid(),
Pkt6::UDP));
Pkt6Ptr Dhcpv6Srv::processRelease(const Pkt6Ptr& release) {
Pkt6Ptr reply(new Pkt6(DHCPV6_REPLY, release->getTransid()));
return reply;
}
boost::shared_ptr<Pkt6>
Dhcpv6Srv::processDecline(const boost::shared_ptr<Pkt6>& decline) {
boost::shared_ptr<Pkt6> reply(new Pkt6(DHCPV6_REPLY,
decline->getTransid(),
Pkt6::UDP));
Pkt6Ptr Dhcpv6Srv::processDecline(const Pkt6Ptr& decline) {
Pkt6Ptr reply(new Pkt6(DHCPV6_REPLY, decline->getTransid()));
return reply;
}
boost::shared_ptr<Pkt6>
Dhcpv6Srv::processInfRequest(const boost::shared_ptr<Pkt6>& infRequest) {
boost::shared_ptr<Pkt6> reply(new Pkt6(DHCPV6_REPLY,
infRequest->getTransid(),
Pkt6::UDP));
Pkt6Ptr Dhcpv6Srv::processInfRequest(const Pkt6Ptr& infRequest) {
Pkt6Ptr reply(new Pkt6(DHCPV6_REPLY, infRequest->getTransid()));
return reply;
}
// Copyright (C) 2011 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2011-2012 Internet Systems Consortium, Inc. ("ISC")
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
......@@ -15,7 +15,6 @@
#ifndef DHCPV6_SRV_H
#define DHCPV6_SRV_H
#include <boost/shared_ptr.hpp>
#include <boost/noncopyable.hpp>
#include <dhcp/dhcp6.h>
#include <dhcp/pkt6.h>
......@@ -52,8 +51,7 @@ public:
/// @brief Returns server-intentifier option
///
/// @return server-id option
boost::shared_ptr<isc::dhcp::Option>
getServerID() { return serverid_; }
OptionPtr getServerID() { return serverid_; }
/// @brief Main server processing loop.
///
......@@ -80,8 +78,7 @@ protected:
/// @param solicit SOLICIT message received from client
///
/// @return ADVERTISE, REPLY message or NULL
boost::shared_ptr<Pkt6>
processSolicit(const boost::shared_ptr<Pkt6>& solicit);
Pkt6Ptr processSolicit(const Pkt6Ptr& solicit);
/// @brief Processes incoming REQUEST and returns REPLY response.
///
......@@ -94,44 +91,37 @@ protected:
/// @param request a message received from client
///
/// @return REPLY message or NULL
boost::shared_ptr<Pkt6>
processRequest(const boost::shared_ptr<Pkt6>& request);
Pkt6Ptr processRequest(const Pkt6Ptr& request);
/// @brief Stub function that will handle incoming RENEW messages.
///
/// @param renew message received from client
boost::shared_ptr<Pkt6>
processRenew(const boost::shared_ptr<Pkt6>& renew);
Pkt6Ptr processRenew(const Pkt6Ptr& renew);
/// @brief Stub function that will handle incoming REBIND messages.
///
/// @param rebind message received from client
boost::shared_ptr<Pkt6>
processRebind(const boost::shared_ptr<Pkt6>& rebind);
Pkt6Ptr processRebind(const Pkt6Ptr& rebind);
/// @brief Stub function that will handle incoming CONFIRM messages.
///
/// @param confirm message received from client
boost::shared_ptr<Pkt6>
processConfirm(const boost::shared_ptr<Pkt6>& confirm);
Pkt6Ptr processConfirm(const Pkt6Ptr& confirm);
/// @brief Stub function that will handle incoming RELEASE messages.
///
/// @param release message received from client
boost::shared_ptr<Pkt6>
processRelease(const boost::shared_ptr<Pkt6>& release);
Pkt6Ptr processRelease(const Pkt6Ptr& release);
/// @brief Stub function that will handle incoming DECLINE messages.
///
/// @param decline message received from client
boost::shared_ptr<Pkt6>
processDecline(const boost::shared_ptr<Pkt6>& decline);
Pkt6Ptr processDecline(const Pkt6Ptr& decline);
/// @brief Stub function that will handle incoming INF-REQUEST messages.
///
/// @param infRequest message received from client
boost::shared_ptr<Pkt6>
processInfRequest(const boost::shared_ptr<Pkt6>& infRequest);
Pkt6Ptr processInfRequest(const Pkt6Ptr& infRequest);
/// @brief Copies required options from client message to server answer
///
......@@ -141,8 +131,7 @@ protected:
///
/// @param question client's message (options will be copied from here)
/// @param answer server's message (options will be copied here)
void copyDefaultOptions(const boost::shared_ptr<Pkt6>& question,
boost::shared_ptr<Pkt6>& answer);
void copyDefaultOptions(const Pkt6Ptr& question, Pkt6Ptr& answer);
/// @brief Appends default options to server's answer.
///
......@@ -152,8 +141,7 @@ protected:
///
/// @param question client's message
/// @param answer server's message (options will be added here)
void appendDefaultOptions(const boost::shared_ptr<Pkt6>& question,
boost::shared_ptr<Pkt6>& answer);
void appendDefaultOptions(const Pkt6Ptr& question, Pkt6Ptr& answer);
/// @brief Appends requested options to server's answer.
///
......@@ -163,8 +151,7 @@ protected:
///
/// @param question client's message
/// @param answer server's message (options will be added here)
void appendRequestedOptions(const boost::shared_ptr<Pkt6>& question,
boost::shared_ptr<Pkt6>& answer);
void appendRequestedOptions(const Pkt6Ptr& question, Pkt6Ptr& answer);
/// @brief Assigns leases.
///
......@@ -174,8 +161,7 @@ protected:
///
/// @param question client's message (with requested IA_NA)
/// @param answer server's message (IA_NA options will be added here)
void assignLeases(const boost::shared_ptr<Pkt6>& question,
boost::shared_ptr<Pkt6>& answer);
void assignLeases(const Pkt6Ptr& question, Pkt6Ptr& answer);
/// @brief Sets server-identifier.
///
......
......@@ -84,13 +84,11 @@ TEST_F(Dhcpv6SrvTest, Solicit_basic) {
ASSERT_NO_THROW( srv = new NakedDhcpv6Srv(); );
// a dummy content for client-id
boost::shared_array<uint8_t> clntDuid(new uint8_t[32]);
OptionBuffer clntDuid(32);
for (int i = 0; i < 32; i++)
clntDuid[i] = 100 + i;
boost::shared_ptr<Pkt6> sol =
boost::shared_ptr<Pkt6>(new Pkt6(DHCPV6_SOLICIT,
1234, Pkt6::UDP));
Pkt6Ptr sol = Pkt6Ptr(new Pkt6(DHCPV6_SOLICIT, 1234, Pkt6::UDP));
boost::shared_ptr<Option6IA> ia =
boost::shared_ptr<Option6IA>(new Option6IA(D6O_IA_NA, 234));
......@@ -113,9 +111,9 @@ TEST_F(Dhcpv6SrvTest, Solicit_basic) {
// - server-id
// - IA that includes IAADDR
boost::shared_ptr<Option> clientid =
boost::shared_ptr<Option>(new Option(Option::V6, D6O_CLIENTID,
clntDuid, 0, 16));
OptionPtr clientid = OptionPtr(new Option(Option::V6, D6O_CLIENTID,
clntDuid.begin(),
clntDuid.begin()+16));
sol->addOption(clientid);
boost::shared_ptr<Pkt6> reply = srv->processSolicit(sol);
......@@ -126,7 +124,7 @@ TEST_F(Dhcpv6SrvTest, Solicit_basic) {
EXPECT_EQ( DHCPV6_ADVERTISE, reply->getType() );
EXPECT_EQ( 1234, reply->getTransid() );
boost::shared_ptr<Option> tmp = reply->getOption(D6O_IA_NA);
OptionPtr tmp = reply->getOption(D6O_IA_NA);
ASSERT_TRUE( tmp );
Option6IA* reply_ia = dynamic_cast<Option6IA*>(tmp.get());
......
......@@ -437,8 +437,8 @@ int IfaceMgr::openSocket6(Iface& iface, const IOAddress& addr, int port) {
isc_throw(Unexpected, "Failed to create UDP6 socket.");
}