Commit 5a0aa214 authored by Tomek Mrugalski's avatar Tomek Mrugalski 🛰
Browse files

Merge branch 'master' into trac2238

Conflicts:
	ChangeLog
	src/lib/dhcp/tests/Makefile.am
parents b8f538b9 0187e5f3
......@@ -6,6 +6,17 @@
future.
(Trac #2238, git TBD)
475. [func] naokikambe
Added Xfrout statistics counters: notifyoutv4, notifyoutv6, xfrrej, and
xfrreqdone. These are per-zone type counters. The value of these
counters can be seen with zone name by invoking "Stats show Xfrout" via
bindctl.
(Trac #2158, git e68c127fed52e6034ab5309ddd506da03c37a08a)
474. [func] stephen
DHCP servers now use the BIND 10 logging system for messages.
(Trac #1545, git de69a92613b36bd3944cb061e1b7c611c3c85506)
473. [bug] jelte
TCP connections now time out in b10-auth if no (or not all) query
data is sent by the client. The timeout value defaults to 5000
......
......@@ -30,7 +30,7 @@ endif
check-valgrind-suppress:
if HAVE_VALGRIND
@VALGRIND_COMMAND="$(VALGRIND) -q --gen-suppressions=all --error-exitcode=1 --suppressions=$(abs_top_srcdir)/src/valgrind-suppressions --suppressions=$(abs_top_srcdir)/src/valgrind-suppressions.revisit --num-callers=48 --leak-check=full --fullpath-after=" \
@VALGRIND_COMMAND="$(VALGRIND) -q --gen-suppressions=all --track-origins=yes --error-exitcode=1 --suppressions=$(abs_top_srcdir)/src/valgrind-suppressions --suppressions=$(abs_top_srcdir)/src/valgrind-suppressions.revisit --num-callers=48 --leak-check=full --fullpath-after=" \
make -C $(abs_top_builddir) check
else
@echo "*** Valgrind is required for check-valgrind-suppress ***"; exit 1;
......
......@@ -1188,6 +1188,7 @@ AC_CONFIG_FILES([Makefile
src/lib/datasrc/Makefile
src/lib/datasrc/memory/Makefile
src/lib/datasrc/memory/tests/Makefile
src/lib/datasrc/memory/tests/testdata/Makefile
src/lib/datasrc/memory/benchmarks/Makefile
src/lib/datasrc/tests/Makefile
src/lib/datasrc/tests/testdata/Makefile
......
......@@ -24,6 +24,7 @@
* - @subpage libdhcp
* - @subpage libdhcpIntro
* - @subpage libdhcpIfaceMgr
* - @subpage perfdhcpInternals
*
* @section misc Miscellaneous topics
* - @subpage LoggingApi
......@@ -36,4 +37,4 @@
* @todo: Move this logo to the right (and possibly up). Not sure what
* is the best way to do it in Doxygen, without using CSS hacks.
* @image html isc-logo.png
*/
\ No newline at end of file
*/
/b10-dhcp4
/b10-dhcp4.8
/dhcp4_messages.cc
/dhcp4_messages.h
/spec_config.h
/spec_config.h.pre
/b10-dhcp4.8
......@@ -12,7 +12,7 @@ endif
pkglibexecdir = $(libexecdir)/@PACKAGE@
CLEANFILES = spec_config.h
CLEANFILES = *.gcno *.gcda spec_config.h dhcp4_messages.h dhcp4_messages.cc
man_MANS = b10-dhcp4.8
DISTCLEANFILES = $(man_MANS)
......@@ -35,11 +35,20 @@ endif
spec_config.h: spec_config.h.pre
$(SED) -e "s|@@LOCALSTATEDIR@@|$(localstatedir)|" spec_config.h.pre >$@
BUILT_SOURCES = spec_config.h
dhcp4_messages.h dhcp4_messages.cc: dhcp4_messages.mes
$(top_builddir)/src/lib/log/compiler/message $(top_srcdir)/src/bin/dhcp4/dhcp4_messages.mes
BUILT_SOURCES = spec_config.h dhcp4_messages.h dhcp4_messages.cc
pkglibexec_PROGRAMS = b10-dhcp4
b10_dhcp4_SOURCES = main.cc dhcp4_srv.cc dhcp4_srv.h
b10_dhcp4_SOURCES = main.cc
b10_dhcp4_SOURCES += ctrl_dhcp4_srv.cc ctrl_dhcp4_srv.h
b10_dhcp4_SOURCES += dhcp4_log.cc dhcp4_log.h
b10_dhcp4_SOURCES += dhcp4_srv.cc dhcp4_srv.h
nodist_b10_dhcp4_SOURCES = dhcp4_messages.h dhcp4_messages.cc
EXTRA_DIST += dhcp4_messages.mes
if USE_CLANGPP
# Disable unused parameter warning caused by some of the
......@@ -47,7 +56,7 @@ if USE_CLANGPP
b10_dhcp4_CXXFLAGS = -Wno-unused-parameter
endif
b10_dhcp4_LDADD = $(top_builddir)/src/lib/dhcp/libb10-dhcp++.la
b10_dhcp4_LDADD = $(top_builddir)/src/lib/dhcp/libb10-dhcp++.la
b10_dhcp4_LDADD += $(top_builddir)/src/lib/exceptions/libb10-exceptions.la
b10_dhcp4_LDADD += $(top_builddir)/src/lib/asiolink/libb10-asiolink.la
b10_dhcp4_LDADD += $(top_builddir)/src/lib/log/libb10-log.la
......
......@@ -13,28 +13,30 @@
// PERFORMANCE OF THIS SOFTWARE.
#include <config.h>
#include <cassert>
#include <iostream>
#include <cc/session.h>
#include <asiolink/asiolink.h>
#include <cc/data.h>
#include <exceptions/exceptions.h>
#include <cc/session.h>
#include <cc/session.h>
#include <config/ccsession.h>
#include <util/buffer.h>
#include <dhcp4/spec_config.h>
#include <dhcp4/ctrl_dhcp4_srv.h>
#include <dhcp4/dhcp4_log.h>
#include <dhcp4/spec_config.h>
#include <dhcp/iface_mgr.h>
#include <asiolink/asiolink.h>
#include <exceptions/exceptions.h>
#include <util/buffer.h>
using namespace std;
using namespace isc::util;
using namespace isc::dhcp;
using namespace isc::util;
using namespace isc::data;
using namespace isc::asiolink;
using namespace isc::cc;
using namespace isc::config;
using namespace isc::asiolink;
using namespace isc::data;
using namespace isc::dhcp;
using namespace isc::log;
using namespace isc::util;
using namespace std;
namespace isc {
namespace dhcp {
......@@ -43,7 +45,8 @@ ControlledDhcpv4Srv* ControlledDhcpv4Srv::server_ = NULL;
ConstElementPtr
ControlledDhcpv4Srv::dhcp4ConfigHandler(ConstElementPtr new_config) {
cout << "b10-dhcp4: Received new config:" << new_config->str() << endl;
LOG_DEBUG(dhcp4_logger, DBG_DHCP4_COMMAND, DHCP4_CONFIG_UPDATE)
.arg(new_config->str());
ConstElementPtr answer = isc::config::createAnswer(0,
"Thank you for sending config.");
return (answer);
......@@ -51,13 +54,14 @@ ControlledDhcpv4Srv::dhcp4ConfigHandler(ConstElementPtr new_config) {
ConstElementPtr
ControlledDhcpv4Srv::dhcp4CommandHandler(const string& command, ConstElementPtr args) {
cout << "b10-dhcp4: Received new command: [" << command << "], args="
<< args->str() << endl;
LOG_DEBUG(dhcp4_logger, DBG_DHCP4_COMMAND, DHCP4_COMMAND_RECEIVED)
.arg(command).arg(args->str());
if (command == "shutdown") {
if (ControlledDhcpv4Srv::server_) {
ControlledDhcpv4Srv::server_->shutdown();
} else {
cout << "Server not initialized yet or already shut down." << endl;
LOG_WARN(dhcp4_logger, DHCP4_NOT_RUNNING);
ConstElementPtr answer = isc::config::createAnswer(1,
"Shutdown failure.");
return (answer);
......@@ -93,10 +97,9 @@ void ControlledDhcpv4Srv::establishSession() {
/// @todo: Check if session is not established already. Throw, if it is.
cout << "b10-dhcp4: my specfile is " << specfile << endl;
LOG_DEBUG(dhcp4_logger, DBG_DHCP4_START, DHCP4_CCSESSION_STARTING)
.arg(specfile);
cc_session_ = new Session(io_service_.get_io_service());
config_session_ = new ModuleCCSession(specfile, *cc_session_,
dhcp4ConfigHandler,
dhcp4CommandHandler, false);
......@@ -106,8 +109,8 @@ void ControlledDhcpv4Srv::establishSession() {
/// control with the "select" model of the DHCP server. This is
/// fully explained in \ref dhcpv4Session.
int ctrl_socket = cc_session_->getSocketDesc();
cout << "b10-dhcp4: Control session started, socket="
<< ctrl_socket << endl;
LOG_DEBUG(dhcp4_logger, DBG_DHCP4_START, DHCP4_CCSESSION_STARTED)
.arg(ctrl_socket);
IfaceMgr::instance().set_session_socket(ctrl_socket, sessionReader);
}
......
// Copyright (C) 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
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
// PERFORMANCE OF THIS SOFTWARE.
/// Defines the logger used by the top-level component of b10-dhcp4.
#include "dhcp4_log.h"
namespace isc {
namespace dhcp {
isc::log::Logger dhcp4_logger("dhcp4");
} // namespace dhcp
} // namespace isc
// Copyright (C) 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
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
// PERFORMANCE OF THIS SOFTWARE.
#ifndef __DHCP4_LOG__H
#define __DHCP4_LOG__H
#include <log/macros.h>
#include <log/logger_support.h>
#include <dhcp4/dhcp4_messages.h>
namespace isc {
namespace dhcp {
/// \brief DHCP4 Logging
///
/// Defines the levels used to output debug messages in the non-library part of
/// the b10-dhcp4 program. Higher numbers equate to more verbose (and detailed)
/// output.
// Debug levels used to log information during startup and shutdown.
const int DBG_DHCP4_START = DBGLVL_START_SHUT;
const int DBG_DHCP4_SHUT = DBGLVL_START_SHUT;
// Debug level used to log setting information (such as configuration changes).
const int DBG_DHCP4_COMMAND = DBGLVL_COMMAND;
// Trace basic operations within the code.
const int DBG_DHCP4_BASIC = DBGLVL_TRACE_BASIC;
// Trace detailed operations, including errors raised when processing invalid
// packets. (These are not logged at severities of WARN or higher for fear
// that a set of deliberately invalid packets set to the server could overwhelm
// the logging.)
const int DBG_DHCP4_DETAIL = DBGLVL_TRACE_DETAIL;
// This level is used to log the contents of packets received and sent.
const int DBG_DHCP4_DETAIL_DATA = DBGLVL_TRACE_DETAIL_DATA;
/// Define the logger for the "dhcp4" module part of b10-dhcp4. We could define
/// a logger in each file, but we would want to define a common name to avoid
/// spelling mistakes, so it is just one small step from there to define a
/// module-common logger.
extern isc::log::Logger dhcp4_logger;
} // namespace dhcp4
} // namespace isc
#endif // __DHCP4_LOG__H
# Copyright (C) 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
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
$NAMESPACE isc::dhcp
% DHCP4_CCSESSION_STARTED control channel session started on socket %1
A debug message issued during startup after the IPv4 DHCP server has
successfully established a session with the BIND 10 control channel.
% DHCP4_CCSESSION_STARTING starting control channel session, specfile: %1
This debug message is issued just before the IPv4 DHCP server attempts
to establish a session with the BIND 10 control channel.
% DHCP4_COMMAND_RECEIVED received command %1, arguments: %2
A debug message listing the command (and possible arguments) received
from the BIND 10 control system by the IPv4 DHCP server.
% DHCP4_CONFIG_UPDATE updated configuration received: %1
A debug message indicating that the IPv4 DHCP server has received an
updated configuration from the BIND 10 configuration system.
% DHCP4_NOT_RUNNING IPv4 DHCP server is not running
A warning message is issued when an attempt is made to shut down the
IPv4 DHCP server but it is not running.
% DHCP4_OPEN_SOCKET opening sockets on port %1
A debug message issued during startup, this indicates that the IPv4 DHCP
server is about to open sockets on the specified port.
% DHCP4_PACKET_PARSE_FAIL failed to parse incoming packet: %1
The IPv4 DHCP server has received a packet that it is unable to
interpret. The reason why the packet is invalid is included in the message.
% DHCP4_PACKET_RECEIVED %1 (type %2) packet received on interface %3
A debug message noting that the server has received the specified type of
packet on the specified interface. Note that a packet marked as UNKNOWN
may well be a valid DHCP packet, just a type not expected by the server
(e.g. it will report a received OFFER packet as UNKNOWN).
% DHCP4_PACK_FAIL failed to assemble response correctly
This error is output if the server failed to assemble the data to be
returned to the client into a valid packet. The cause is most likely
to be a programming error: please raise a bug report.
% DHCP4_QUERY_DATA received packet type %1, data is <%2>
A debug message listing the data received from the client.
% DHCP4_RESPONSE_DATA responding with packet type %1, data is <%2>
A debug message listing the data returned to the client.
% DHCP4_SERVER_FAILED server failed: %1
The IPv4 DHCP server has encountered a fatal error and is terminating.
The reason for the failure is included in the message.
% DHCP4_SESSION_FAIL failed to establish BIND 10 session (%1), running stand-alone
The server has failed to establish communication with the rest of BIND
10 and is running in stand-alone mode. (This behavior will change once
the IPv4 DHCP server is properly integrated with the rest of BIND 10.)
% DHCP4_SHUTDOWN server shutdown
The IPv4 DHCP server has terminated normally.
% DHCP4_SHUTDOWN_REQUEST shutdown of server requested
This debug message indicates that a shutdown of the IPv4 server has
been requested via a call to the 'shutdown' method of the core Dhcpv4Srv
object.
% DHCP4_SRV_CONSTRUCT_ERROR error creating Dhcpv4Srv object, reason: %1
This error message indicates that during startup, the construction of a
core component within the IPv4 DHCP server (the Dhcpv4 server object)
has failed. As a result, the server will exit. The reason for the
failure is given within the message.
% DHCP4_STANDALONE skipping message queue, running standalone
This is a debug message indicating that the IPv4 server is running in
standalone mode, not connected to the message queue. Standalone mode
is only useful during program development, and should not be used in a
production environment.
% DHCP4_STARTING server starting
This informational message indicates that the IPv4 DHCP server has
processed any command-line switches and is starting.
% DHCP4_START_INFO pid: %1, port: %2, verbose: %3, standalone: %4
This is a debug message issued during the IPv4 DHCP server startup.
It lists some information about the parameters with which the server
is running.
......@@ -16,13 +16,15 @@
#include <dhcp/pkt4.h>
#include <dhcp/iface_mgr.h>
#include <dhcp4/dhcp4_srv.h>
#include <dhcp4/dhcp4_log.h>
#include <asiolink/io_address.h>
#include <dhcp/option4_addrlst.h>
using namespace std;
using namespace isc;
using namespace isc::dhcp;
using namespace isc::asiolink;
using namespace isc::dhcp;
using namespace isc::log;
using namespace std;
// These are hardcoded parameters. Currently this is a skeleton server that only
// grants those options and a single, fixed, hardcoded lease.
......@@ -35,20 +37,19 @@ const std::string HARDCODED_DOMAIN_NAME = "isc.example.com";
const std::string HARDCODED_SERVER_ID = "192.0.2.1";
Dhcpv4Srv::Dhcpv4Srv(uint16_t port) {
cout << "Initialization: opening sockets on port " << port << endl;
LOG_DEBUG(dhcp4_logger, DBG_DHCP4_START, DHCP4_OPEN_SOCKET).arg(port);
try {
// first call to instance() will create IfaceMgr (it's a singleton)
// First call to instance() will create IfaceMgr (it's a singleton)
// it may throw something if things go wrong
IfaceMgr::instance();
/// @todo: instantiate LeaseMgr here once it is imlpemented.
IfaceMgr::instance().openSockets4(port);
setServerID();
} catch (const std::exception &e) {
cerr << "Error during DHCPv4 server startup: " << e.what() << endl;
LOG_ERROR(dhcp4_logger, DHCP4_SRV_CONSTRUCT_ERROR).arg(e.what());
shutdown_ = true;
return;
}
......@@ -57,12 +58,11 @@ Dhcpv4Srv::Dhcpv4Srv(uint16_t port) {
}
Dhcpv4Srv::~Dhcpv4Srv() {
cout << "b10-dhcp4: DHCPv4 server terminating." << endl;
IfaceMgr::instance().closeSockets();
}
void Dhcpv4Srv::shutdown() {
cout << "b10-dhcp4: DHCPv4 server shutdown." << endl;
LOG_DEBUG(dhcp4_logger, DBG_DHCP4_BASIC, DHCP4_SHUTDOWN_REQUEST);
shutdown_ = true;
}
......@@ -79,39 +79,48 @@ Dhcpv4Srv::run() {
if (query) {
try {
query->unpack();
} catch (const std::exception& e) {
/// TODO: Printout reasons of failed parsing
cout << "Failed to parse incoming packet " << endl;
// Failed to parse the packet.
LOG_DEBUG(dhcp4_logger, DBG_DHCP4_DETAIL,
DHCP4_PACKET_PARSE_FAIL).arg(e.what());
continue;
}
LOG_DEBUG(dhcp4_logger, DBG_DHCP4_DETAIL, DHCP4_PACKET_RECEIVED)
.arg(serverReceivedPacketName(query->getType()))
.arg(query->getType())
.arg(query->getIface());
LOG_DEBUG(dhcp4_logger, DBG_DHCP4_DETAIL_DATA, DHCP4_QUERY_DATA)
.arg(query->toText());
switch (query->getType()) {
case DHCPDISCOVER:
rsp = processDiscover(query);
break;
case DHCPREQUEST:
rsp = processRequest(query);
break;
case DHCPRELEASE:
processRelease(query);
break;
case DHCPDECLINE:
processDecline(query);
break;
case DHCPINFORM:
processInform(query);
break;
default:
cout << "Unknown pkt type received:"
<< query->getType() << endl;
// Only action is to output a message if debug is enabled,
// and that will be covered by the debug statement before
// the "switch" statement.
;
}
cout << "Received message type " << int(query->getType()) << endl;
// TODO: print out received packets only if verbose (or debug)
// mode is enabled
cout << query->toText();
if (rsp) {
if (rsp->getRemoteAddr().toText() == "0.0.0.0") {
rsp->setRemoteAddr(query->getRemoteAddr());
......@@ -127,14 +136,15 @@ Dhcpv4Srv::run() {
rsp->setIface(query->getIface());
rsp->setIndex(query->getIndex());
cout << "Replying with message type "
<< static_cast<int>(rsp->getType()) << ":" << endl;
cout << rsp->toText();
cout << "----" << endl;
LOG_DEBUG(dhcp4_logger, DBG_DHCP4_DETAIL_DATA,
DHCP4_RESPONSE_DATA)
.arg(rsp->getType()).arg(rsp->toText());
if (rsp->pack()) {
cout << "Packet assembled correctly." << endl;
IfaceMgr::instance().send(rsp);
} else {
LOG_ERROR(dhcp4_logger, DHCP4_PACK_FAIL);
}
IfaceMgr::instance().send(rsp);
}
}
......@@ -266,15 +276,44 @@ Pkt4Ptr Dhcpv4Srv::processRequest(Pkt4Ptr& request) {
void Dhcpv4Srv::processRelease(Pkt4Ptr& release) {
/// TODO: Implement this.
cout << "Received RELEASE on " << release->getIface() << " interface." << endl;
}
void Dhcpv4Srv::processDecline(Pkt4Ptr& decline) {
/// TODO: Implement this.
cout << "Received DECLINE on " << decline->getIface() << " interface." << endl;
}
Pkt4Ptr Dhcpv4Srv::processInform(Pkt4Ptr& inform) {
/// TODO: Currently implemented echo mode. Implement this for real
return (inform);
}
const char*
Dhcpv4Srv::serverReceivedPacketName(uint8_t type) {
static const char* DISCOVER = "DISCOVER";
static const char* REQUEST = "REQUEST";
static const char* RELEASE = "RELEASE";
static const char* DECLINE = "DECLINE";
static const char* INFORM = "INFORM";
static const char* UNKNOWN = "UNKNOWN";
switch (type) {
case DHCPDISCOVER:
return (DISCOVER);
case DHCPREQUEST:
return (REQUEST);
case DHCPRELEASE:
return (RELEASE);
case DHCPDECLINE:
return (DECLINE);
case DHCPINFORM:
return (INFORM);
default:
;
}
return (UNKNOWN);
}
......@@ -44,7 +44,7 @@ class Dhcpv4Srv : public boost::noncopyable {
public:
/// @brief Default constructor.
///
/// Instantiates necessary services, required to run DHCPv6 server.
/// Instantiates necessary services, required to run DHCPv4 server.
/// In particular, creates IfaceMgr that will be responsible for
/// network interaction. Will instantiate lease manager, and load
/// old or create new DUID. It is possible to specify alternate
......@@ -54,7 +54,7 @@ class Dhcpv4Srv : public boost::noncopyable {
/// @param port specifies port number to listen on
Dhcpv4Srv(uint16_t port = DHCP4_SERVER_PORT);
/// @brief Destructor. Used during DHCPv6 service shutdown.
/// @brief Destructor. Used during DHCPv4 service shutdown.
~Dhcpv4Srv();
/// @brief Main server processing loop.
......@@ -70,6 +70,23 @@ class Dhcpv4Srv : public boost::noncopyable {
/// @brief Instructs the server to shut down.
void shutdown();
/// @brief Return textual type of packet received by server
///
/// Returns the name of valid packet received by the server (e.g. DISCOVER).
/// If the packet is unknown - or if it is a valid DHCP packet but not one
/// expected to be received by the server (such as an OFFER), the string
/// "UNKNOWN" is returned. This method is used in debug messages.
///
/// As the operation of the method does not depend on any server state, it
/// is declared static.
///
/// @param type DHCPv4 packet type
///
/// @return Pointer to "const" string containing the packet name.
/// Note that this string is statically allocated and MUST NOT
/// be freed by the caller.
static const char* serverReceivedPacketName(uint8_t type);
protected:
/// @brief Processes incoming DISCOVER and returns response.
///
......@@ -89,11 +106,11 @@ protected:
/// is valid, not expired, not reserved, not used by other client and
/// that requesting client is allowed to use it.
///
/// Returns ACK message, NACK message, or NULL
/// Returns ACK message, NAK message, or NULL
///
/// @param request a message received from client
///
/// @return ACK or NACK message
/// @return ACK or NAK message
Pkt4Ptr processRequest(Pkt4Ptr& request);
/// @brief Stub function that will handle incoming RELEASE messages.
......
......@@ -14,13 +14,15 @@
#include <config.h>
#include <iostream>
#include <log/dummylog.h>
#include <log/logger_support.h>
#include <dhcp4/ctrl_dhcp4_srv.h>
#include <boost/lexical_cast.hpp>