Commit a9566567 authored by Marcin Siodelski's avatar Marcin Siodelski
Browse files

[3688] Rename DHCPv4Exchange to Dhcpv4Exchange as a result of the review.

parent d3892424
......@@ -84,7 +84,7 @@ Dhcp4Hooks Hooks;
namespace isc {
namespace dhcp {
DHCPv4Exchange::DHCPv4Exchange(const AllocEnginePtr& alloc_engine,
Dhcpv4Exchange::Dhcpv4Exchange(const AllocEnginePtr& alloc_engine,
const Pkt4Ptr& query)
: alloc_engine_(alloc_engine), query_(query), resp_(),
context_(new AllocEngine::ClientContext4()) {
......@@ -104,7 +104,7 @@ DHCPv4Exchange::DHCPv4Exchange(const AllocEnginePtr& alloc_engine,
};
void
DHCPv4Exchange::initResponse() {
Dhcpv4Exchange::initResponse() {
uint8_t resp_type = 0;
switch (getQuery()->getType()) {
case DHCPDISCOVER:
......@@ -123,12 +123,12 @@ DHCPv4Exchange::initResponse() {
}
void
DHCPv4Exchange::selectSubnet() {
Dhcpv4Exchange::selectSubnet() {
context_->subnet_ = selectSubnet(query_);
}
Subnet4Ptr
DHCPv4Exchange::selectSubnet(const Pkt4Ptr& query) {
Dhcpv4Exchange::selectSubnet(const Pkt4Ptr& query) {
Subnet4Ptr subnet;
......@@ -233,7 +233,7 @@ Dhcpv4Srv::shutdown() {
isc::dhcp::Subnet4Ptr
Dhcpv4Srv::selectSubnet(const Pkt4Ptr& question) {
return (DHCPv4Exchange::selectSubnet(question));
return (Dhcpv4Exchange::selectSubnet(question));
}
Pkt4Ptr
......@@ -617,7 +617,7 @@ Dhcpv4Srv::computeDhcid(const Lease4Ptr& lease) {
}
void
Dhcpv4Srv::copyDefaultFields(DHCPv4Exchange& ex) {
Dhcpv4Srv::copyDefaultFields(Dhcpv4Exchange& ex) {
ex.getResponse()->setIface(ex.getQuery()->getIface());
ex.getResponse()->setIndex(ex.getQuery()->getIndex());
......@@ -665,12 +665,12 @@ Dhcpv4Srv::copyDefaultFields(DHCPv4Exchange& ex) {
}
void
Dhcpv4Srv::appendDefaultOptions(DHCPv4Exchange& ex) {
Dhcpv4Srv::appendDefaultOptions(Dhcpv4Exchange& ex) {
// no-op at this time
}
void
Dhcpv4Srv::appendServerID(DHCPv4Exchange& ex) {
Dhcpv4Srv::appendServerID(Dhcpv4Exchange& ex) {
// The source address for the outbound message should have been set already.
// This is the address that to the best of the server's knowledge will be
// available from the client.
......@@ -681,7 +681,7 @@ Dhcpv4Srv::appendServerID(DHCPv4Exchange& ex) {
}
void
Dhcpv4Srv::appendRequestedOptions(DHCPv4Exchange& ex) {
Dhcpv4Srv::appendRequestedOptions(Dhcpv4Exchange& ex) {
// Get the subnet relevant for the client. We will need it
// to get the options associated with it.
Subnet4Ptr subnet = ex.getContext()->subnet_;
......@@ -719,7 +719,7 @@ Dhcpv4Srv::appendRequestedOptions(DHCPv4Exchange& ex) {
}
void
Dhcpv4Srv::appendRequestedVendorOptions(DHCPv4Exchange& ex) {
Dhcpv4Srv::appendRequestedVendorOptions(Dhcpv4Exchange& ex) {
// Get the configured subnet suitable for the incoming packet.
Subnet4Ptr subnet = ex.getContext()->subnet_;
// Leave if there is no subnet matching the incoming packet.
......@@ -776,7 +776,7 @@ Dhcpv4Srv::appendRequestedVendorOptions(DHCPv4Exchange& ex) {
void
Dhcpv4Srv::appendBasicOptions(DHCPv4Exchange& ex) {
Dhcpv4Srv::appendBasicOptions(Dhcpv4Exchange& ex) {
// Identify options that we always want to send to the
// client (if they are configured).
static const uint16_t required_options[] = {
......@@ -809,7 +809,7 @@ Dhcpv4Srv::appendBasicOptions(DHCPv4Exchange& ex) {
}
void
Dhcpv4Srv::processClientName(DHCPv4Exchange& ex) {
Dhcpv4Srv::processClientName(Dhcpv4Exchange& ex) {
// It is possible that client has sent both Client FQDN and Hostname
// option. In such case, server should prefer Client FQDN option and
// ignore the Hostname option.
......@@ -842,7 +842,7 @@ Dhcpv4Srv::processClientName(DHCPv4Exchange& ex) {
}
void
Dhcpv4Srv::processClientFqdnOption(DHCPv4Exchange& ex) {
Dhcpv4Srv::processClientFqdnOption(Dhcpv4Exchange& ex) {
// Obtain the FQDN option from the client's message.
Option4ClientFqdnPtr fqdn = boost::dynamic_pointer_cast<
Option4ClientFqdn>(ex.getQuery()->getOption(DHO_FQDN));
......@@ -887,7 +887,7 @@ Dhcpv4Srv::processClientFqdnOption(DHCPv4Exchange& ex) {
}
void
Dhcpv4Srv::processHostnameOption(DHCPv4Exchange& ex) {
Dhcpv4Srv::processHostnameOption(Dhcpv4Exchange& ex) {
// Obtain the Hostname option from the client's message.
OptionStringPtr opt_hostname = boost::dynamic_pointer_cast<OptionString>
(ex.getQuery()->getOption(DHO_HOST_NAME));
......@@ -1041,7 +1041,7 @@ queueNameChangeRequest(const isc::dhcp_ddns::NameChangeType chg_type,
}
void
Dhcpv4Srv::assignLease(DHCPv4Exchange& ex) {
Dhcpv4Srv::assignLease(Dhcpv4Exchange& ex) {
// Get the pointers to the query and the response messages.
Pkt4Ptr query = ex.getQuery();
Pkt4Ptr resp = ex.getResponse();
......@@ -1313,7 +1313,7 @@ Dhcpv4Srv::assignLease(DHCPv4Exchange& ex) {
}
void
Dhcpv4Srv::adjustIfaceData(DHCPv4Exchange& ex) {
Dhcpv4Srv::adjustIfaceData(Dhcpv4Exchange& ex) {
adjustRemoteAddr(ex);
// Initialize the pointers to the client's message and the server's
......@@ -1365,7 +1365,7 @@ Dhcpv4Srv::adjustIfaceData(DHCPv4Exchange& ex) {
}
void
Dhcpv4Srv::adjustRemoteAddr(DHCPv4Exchange& ex) {
Dhcpv4Srv::adjustRemoteAddr(Dhcpv4Exchange& ex) {
// Initialize the pointers to the client's message and the server's
// response.
Pkt4Ptr query = ex.getQuery();
......@@ -1468,7 +1468,7 @@ Dhcpv4Srv::getNetmaskOption(const Subnet4Ptr& subnet) {
Pkt4Ptr
Dhcpv4Srv::processDiscover(Pkt4Ptr& discover) {
DHCPv4Exchange ex(alloc_engine_, discover);
Dhcpv4Exchange ex(alloc_engine_, discover);
sanityCheck(ex, FORBIDDEN);
......@@ -1514,7 +1514,7 @@ Dhcpv4Srv::processDiscover(Pkt4Ptr& discover) {
Pkt4Ptr
Dhcpv4Srv::processRequest(Pkt4Ptr& request) {
DHCPv4Exchange ex(alloc_engine_, request);
Dhcpv4Exchange ex(alloc_engine_, request);
/// @todo Uncomment this (see ticket #3116)
/// sanityCheck(ex, MANDATORY);
......@@ -1675,7 +1675,7 @@ Dhcpv4Srv::processDecline(Pkt4Ptr&) {
Pkt4Ptr
Dhcpv4Srv::processInform(Pkt4Ptr& inform) {
DHCPv4Exchange ex(alloc_engine_, inform);
Dhcpv4Exchange ex(alloc_engine_, inform);
// DHCPINFORM MUST not include server identifier.
sanityCheck(ex, FORBIDDEN);
......@@ -1800,7 +1800,7 @@ Dhcpv4Srv::acceptDirectRequest(const Pkt4Ptr& pkt) const {
return (false);
}
return ((pkt->getLocalAddr() != IOAddress::IPV4_BCAST_ADDRESS()
|| DHCPv4Exchange::selectSubnet(pkt)));
|| Dhcpv4Exchange::selectSubnet(pkt)));
}
bool
......@@ -1899,7 +1899,7 @@ Dhcpv4Srv::acceptServerId(const Pkt4Ptr& query) const {
}
void
Dhcpv4Srv::sanityCheck(const DHCPv4Exchange& ex, RequirementLevel serverid) {
Dhcpv4Srv::sanityCheck(const Dhcpv4Exchange& ex, RequirementLevel serverid) {
OptionPtr server_id = ex.getQuery()->getOption(DHO_DHCP_SERVER_IDENTIFIER);
switch (serverid) {
case FORBIDDEN:
......@@ -2088,7 +2088,7 @@ void Dhcpv4Srv::classifyPacket(const Pkt4Ptr& pkt) {
bool Dhcpv4Srv::classSpecificProcessing(const Pkt4Ptr& query, const Pkt4Ptr& rsp) {
Subnet4Ptr subnet = DHCPv4Exchange::selectSubnet(query);
Subnet4Ptr subnet = Dhcpv4Exchange::selectSubnet(query);
if (!subnet) {
return (true);
}
......
......@@ -48,10 +48,10 @@ public:
/// This class represents the DHCPv4 message exchange. The message exchange
/// consists of the single client message, server response to this message
/// and the mechanisms to generate the server's response. The server creates
/// the instance of the @c DHCPv4Exchange for each inbound message that it
/// the instance of the @c Dhcpv4Exchange for each inbound message that it
/// accepts for processing.
///
/// The use of the @c DHCPv4Exchange object as a central repository of
/// The use of the @c Dhcpv4Exchange object as a central repository of
/// information about the message exchange simplifies the API of the
/// @c Dhcpv4Srv class.
///
......@@ -62,7 +62,7 @@ public:
///
/// @todo This is the initial version of this class. In the future a lot of
/// code from the @c Dhcpv4Srv class will be migrated here.
class DHCPv4Exchange {
class Dhcpv4Exchange {
public:
/// @brief Constructor.
///
......@@ -75,7 +75,7 @@ public:
/// @param alloc_engine Pointer to the instance of the Allocation Engine
/// used by the server.
/// @param query Pointer to the client message.
DHCPv4Exchange(const AllocEnginePtr& alloc_engine, const Pkt4Ptr& query);
Dhcpv4Exchange(const AllocEnginePtr& alloc_engine, const Pkt4Ptr& query);
/// @brief Initializes the instance of the response message.
///
......@@ -137,8 +137,8 @@ private:
AllocEngine::ClientContext4Ptr context_;
};
/// @brief Type representing the pointer to the @c DHCPv4Exchange.
typedef boost::shared_ptr<DHCPv4Exchange> DHCPv4ExchangePtr;
/// @brief Type representing the pointer to the @c Dhcpv4Exchange.
typedef boost::shared_ptr<Dhcpv4Exchange> Dhcpv4ExchangePtr;
/// @brief DHCPv4 server service.
......@@ -375,7 +375,7 @@ protected:
/// @param ex DHCPv4 exchange holding the client's message to be checked.
/// @param serverid expectation regarding server-id option
/// @throw RFCViolation if any issues are detected
static void sanityCheck(const DHCPv4Exchange& ex, RequirementLevel serverid);
static void sanityCheck(const Dhcpv4Exchange& ex, RequirementLevel serverid);
/// @brief Processes incoming DISCOVER and returns response.
///
......@@ -427,7 +427,7 @@ protected:
///
/// @param ex The exchange holding both the client's message and the
/// server's response.
void copyDefaultFields(DHCPv4Exchange& ex);
void copyDefaultFields(Dhcpv4Exchange& ex);
/// @brief Appends options requested by client.
///
......@@ -436,7 +436,7 @@ protected:
///
/// @param ex The exchange holding both the client's message and the
/// server's response.
void appendRequestedOptions(DHCPv4Exchange& ex);
void appendRequestedOptions(Dhcpv4Exchange& ex);
/// @brief Appends requested vendor options as requested by client.
///
......@@ -448,7 +448,7 @@ protected:
///
/// @param ex The exchange holding both the client's message and the
/// server's response.
void appendRequestedVendorOptions(DHCPv4Exchange& ex);
void appendRequestedVendorOptions(Dhcpv4Exchange& ex);
/// @brief Assigns a lease and appends corresponding options
///
......@@ -464,7 +464,7 @@ protected:
/// The response type in the @c ex object may be set to DHCPACK or DHCPNAK.
///
/// @param ex DHCPv4 exchange holding the client's message to be checked.
void assignLease(DHCPv4Exchange& ex);
void assignLease(Dhcpv4Exchange& ex);
/// @brief Append basic options if they are not present.
///
......@@ -476,7 +476,7 @@ protected:
/// - Domain Name.
///
/// @param ex DHCPv4 exchange holding the client's message to be checked.
void appendBasicOptions(DHCPv4Exchange& ex);
void appendBasicOptions(Dhcpv4Exchange& ex);
/// @brief Processes Client FQDN and Hostname Options sent by a client.
///
......@@ -515,7 +515,7 @@ protected:
///
/// @param ex The exchange holding both the client's message and the
/// server's response.
void processClientName(DHCPv4Exchange& ex);
void processClientName(Dhcpv4Exchange& ex);
/// @brief this is a prefix added to the contend of vendor-class option
///
......@@ -536,7 +536,7 @@ private:
///
/// @param ex The exchange holding both the client's message and the
/// server's response.
void processClientFqdnOption(DHCPv4Exchange& ex);
void processClientFqdnOption(Dhcpv4Exchange& ex);
/// @brief Process Hostname %Option sent by a client.
///
......@@ -548,7 +548,7 @@ private:
///
/// @param ex The exchange holding both the client's message and the
/// server's response.
void processHostnameOption(DHCPv4Exchange& ex);
void processHostnameOption(Dhcpv4Exchange& ex);
protected:
......@@ -599,7 +599,7 @@ protected:
///
/// @param ex The exchange holding both the client's message and the
/// server's response.
void appendDefaultOptions(DHCPv4Exchange& ex);
void appendDefaultOptions(Dhcpv4Exchange& ex);
/// @brief Adds server identifier option to the server's response.
///
......@@ -620,7 +620,7 @@ protected:
///
/// @param ex The exchange holding both the client's message and the
/// server's response.
static void appendServerID(DHCPv4Exchange& ex);
static void appendServerID(Dhcpv4Exchange& ex);
/// @brief Set IP/UDP and interface parameters for the DHCPv4 response.
///
......@@ -655,7 +655,7 @@ protected:
///
/// @param ex The exchange holding both the client's message and the
/// server's response.
static void adjustIfaceData(DHCPv4Exchange& ex);
static void adjustIfaceData(Dhcpv4Exchange& ex);
/// @brief Sets remote addresses for outgoing packet.
///
......@@ -675,7 +675,7 @@ protected:
///
/// @param ex The exchange holding both the client's message and the
/// server's response.
static void adjustRemoteAddr(DHCPv4Exchange& ex);
static void adjustRemoteAddr(Dhcpv4Exchange& ex);
/// @brief converts server-id to text
/// Converts content of server-id option to a text representation, e.g.
......
......@@ -87,7 +87,7 @@ TEST_F(Dhcpv4SrvTest, adjustIfaceDataRelay) {
req->setIndex(1);
// Create the exchange using the req.
DHCPv4Exchange ex = createExchange(req);
Dhcpv4Exchange ex = createExchange(req);
Pkt4Ptr resp = ex.getResponse();
resp->setYiaddr(IOAddress("192.0.1.100"));
......@@ -164,7 +164,7 @@ TEST_F(Dhcpv4SrvTest, adjustIfaceDataRenew) {
req->setIndex(1);
// Create the exchange using the req.
DHCPv4Exchange ex = createExchange(req);
Dhcpv4Exchange ex = createExchange(req);
Pkt4Ptr resp = ex.getResponse();
// Let's extend the lease for the client in such a way that
......@@ -228,7 +228,7 @@ TEST_F(Dhcpv4SrvTest, adjustIfaceDataSelect) {
req->setIndex(1);
// Create the exchange using the req.
DHCPv4Exchange ex = createExchange(req);
Dhcpv4Exchange ex = createExchange(req);
Pkt4Ptr resp = ex.getResponse();
// Assign some new address for this client.
resp->setYiaddr(IOAddress("192.0.1.13"));
......@@ -312,7 +312,7 @@ TEST_F(Dhcpv4SrvTest, adjustIfaceDataBroadcast) {
req->setFlags(Pkt4::FLAG_BROADCAST_MASK);
// Create the exchange using the req.
DHCPv4Exchange ex = createExchange(req);
Dhcpv4Exchange ex = createExchange(req);
Pkt4Ptr resp = ex.getResponse();
// Assign some new address for this client.
......@@ -369,7 +369,7 @@ TEST_F(Dhcpv4SrvTest, adjustIfaceDataInvalid) {
req->setIndex(1);
// Create the exchange using the req.
DHCPv4Exchange ex = createExchange(req);
Dhcpv4Exchange ex = createExchange(req);
Pkt4Ptr resp = ex.getResponse();
// Assign some new address for this client.
......@@ -385,7 +385,7 @@ TEST_F(Dhcpv4SrvTest, adjustIfaceDataInvalid) {
// a specified DHCPv4 message and the server identifier is correct.
TEST_F(Dhcpv4SrvTest, appendServerID) {
Pkt4Ptr query(new Pkt4(DHCPDISCOVER, 1234));
DHCPv4Exchange ex = createExchange(query);
Dhcpv4Exchange ex = createExchange(query);
Pkt4Ptr response = ex.getResponse();
// Set a local address. It is required by the function under test
......
......@@ -587,9 +587,9 @@ Dhcpv4SrvTest::configure(const std::string& config, NakedDhcpv4Srv& srv,
}
}
DHCPv4Exchange
Dhcpv4Exchange
Dhcpv4SrvTest::createExchange(const Pkt4Ptr& query) {
return (DHCPv4Exchange(srv_.alloc_engine_, query));
return (Dhcpv4Exchange(srv_.alloc_engine_, query));
}
......
......@@ -391,8 +391,8 @@ public:
void configure(const std::string& config, NakedDhcpv4Srv& srv,
const bool commit = true);
/// @brief Create @c DHCPv4Exchange from client's query.
DHCPv4Exchange createExchange(const Pkt4Ptr& query);
/// @brief Create @c Dhcpv4Exchange from client's query.
Dhcpv4Exchange createExchange(const Pkt4Ptr& query);
/// @brief This function cleans up after the test.
virtual void TearDown();
......
......@@ -307,7 +307,7 @@ public:
answer.reset(new Pkt4(DHCPACK, 1234));
}
DHCPv4Exchange ex = createExchange(query);
Dhcpv4Exchange ex = createExchange(query);
ASSERT_NO_THROW(srv_->processClientName(ex));
Option4ClientFqdnPtr fqdn = getClientFqdnOption(ex.getResponse());
......@@ -357,7 +357,7 @@ public:
answer.reset(new Pkt4(DHCPACK, 1234));
}
DHCPv4Exchange ex = createExchange(query);
Dhcpv4Exchange ex = createExchange(query);
srv_->processClientName(ex);
OptionStringPtr hostname = getHostnameOption(ex.getResponse());
......
{}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment