![]() |
Kea
1.5.0
|
DHCPv4 message exchange. More...
#include <dhcp4_srv.h>
Public Member Functions | |
| Dhcpv4Exchange (const AllocEnginePtr &alloc_engine, const Pkt4Ptr &query, const Subnet4Ptr &subnet) | |
| Constructor. More... | |
| void | deleteResponse () |
| Removes the response message by resetting the pointer to NULL. More... | |
| CfgOptionList & | getCfgOptionList () |
| Returns the configured option list (non-const version) More... | |
| const CfgOptionList & | getCfgOptionList () const |
| Returns the configured option list (const version) More... | |
| AllocEngine::ClientContext4Ptr | getContext () const |
| Returns the copy of the context for the Allocation engine. More... | |
| Pkt4Ptr | getQuery () const |
| Returns the pointer to the query from the client. More... | |
| Pkt4Ptr | getResponse () const |
| Returns the pointer to the server's response. More... | |
| void | initResponse () |
| Initializes the instance of the response message. More... | |
| void | initResponse4o6 () |
| Initializes the DHCPv6 part of the response message. More... | |
| void | setReservedClientClasses () |
| Assigns classes retrieved from host reservation database. More... | |
| void | setReservedMessageFields () |
| Sets reserved values of siaddr, sname and file in the server's response. More... | |
DHCPv4 message exchange.
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 Dhcpv4Exchange for each inbound message that it accepts for processing.
The use of the Dhcpv4Exchange object as a central repository of information about the message exchange simplifies the API of the Dhcpv4Srv class.
Another benefit of using this class is that different methods of the Dhcpv4Srv may share information. For example, the constructor of this class selects the subnet and multiple methods of Dhcpv4Srv use this subnet, without the need to select it again.
Dhcpv4Srv class will be migrated here. Definition at line 63 of file dhcp4_srv.h.
| isc::dhcp::Dhcpv4Exchange::Dhcpv4Exchange | ( | const AllocEnginePtr & | alloc_engine, |
| const Pkt4Ptr & | query, | ||
| const Subnet4Ptr & | subnet | ||
| ) |
Constructor.
The constructor selects the subnet for the query and checks for the static host reservations for the client which has sent the message. The information about the reservations is stored in the AllocEngine::ClientContext4 object, which can be obtained by calling the getContext.
| alloc_engine | Pointer to the instance of the Allocation Engine used by the server. |
| query | Pointer to the client message. |
| subnet | Pointer to the subnet to which the client belongs. |
Definition at line 123 of file dhcp4_srv.cc.
References isc::dhcp::DBG_DHCP4_BASIC, isc::dhcp::dhcp4_logger, isc::dhcp::DHO_DHCP_CLIENT_IDENTIFIER, isc::dhcp::ClientClasses::empty(), isc::dhcp::Dhcpv4Srv::evaluateClasses(), isc::dhcp::Network::HR_DISABLED, initResponse(), isc_throw, LOG_DEBUG, and isc::dhcp::ClientClasses::toText().
Here is the call graph for this function:
|
inline |
Removes the response message by resetting the pointer to NULL.
Definition at line 106 of file dhcp4_srv.h.
Referenced by isc::dhcp::Dhcpv4Srv::assignLease().
|
inline |
Returns the configured option list (non-const version)
Definition at line 116 of file dhcp4_srv.h.
Referenced by isc::dhcp::Dhcpv4Srv::appendBasicOptions(), isc::dhcp::Dhcpv4Srv::appendRequestedOptions(), isc::dhcp::Dhcpv4Srv::appendRequestedVendorOptions(), and isc::dhcp::Dhcpv4Srv::buildCfgOptionList().
|
inline |
Returns the configured option list (const version)
Definition at line 121 of file dhcp4_srv.h.
|
inline |
Returns the copy of the context for the Allocation engine.
Definition at line 111 of file dhcp4_srv.h.
Referenced by isc::dhcp::Dhcpv4Srv::appendBasicOptions(), isc::dhcp::Dhcpv4Srv::appendRequestedOptions(), isc::dhcp::Dhcpv4Srv::appendRequestedVendorOptions(), isc::dhcp::Dhcpv4Srv::assignLease(), isc::dhcp::Dhcpv4Srv::buildCfgOptionList(), isc::dhcp::Dhcpv4Srv::processRequest(), isc::dhcp::Dhcpv4Srv::requiredClassify(), and isc::dhcp::Dhcpv4Srv::setFixedFields().
|
inline |
Returns the pointer to the query from the client.
Definition at line 94 of file dhcp4_srv.h.
Referenced by isc::dhcp::Dhcpv4Srv::adjustIfaceData(), isc::dhcp::Dhcpv4Srv::adjustRemoteAddr(), isc::dhcp::Dhcpv4Srv::appendRequestedOptions(), isc::dhcp::Dhcpv4Srv::appendRequestedVendorOptions(), isc::dhcp::Dhcpv4Srv::appendServerID(), isc::dhcp::Dhcpv4Srv::assignLease(), isc::dhcp::Dhcpv4Srv::buildCfgOptionList(), isc::dhcp::Dhcpv4Srv::checkRelayPort(), initResponse(), initResponse4o6(), isc::dhcp::Dhcpv4Srv::processClientName(), isc::dhcp::Dhcpv4Srv::requiredClassify(), and isc::dhcp::Dhcpv4Srv::setFixedFields().
|
inline |
Returns the pointer to the server's response.
The returned pointer is NULL if the query type is DHCPRELEASE or DHCPDECLINE.
Definition at line 101 of file dhcp4_srv.h.
Referenced by isc::dhcp::Dhcpv4Srv::adjustIfaceData(), isc::dhcp::Dhcpv4Srv::adjustRemoteAddr(), isc::dhcp::Dhcpv4Srv::appendBasicOptions(), isc::dhcp::Dhcpv4Srv::appendRequestedOptions(), isc::dhcp::Dhcpv4Srv::appendRequestedVendorOptions(), isc::dhcp::Dhcpv4Srv::appendServerID(), isc::dhcp::Dhcpv4Srv::assignLease(), isc::dhcp::Dhcpv4Srv::buildCfgOptionList(), isc::dhcp::Dhcpv4Srv::processClientName(), isc::dhcp::Dhcpv4Srv::processDiscover(), isc::dhcp::Dhcpv4Srv::processInform(), isc::dhcp::Dhcpv4Srv::processRequest(), isc::dhcp::Dhcpv4Srv::requiredClassify(), and isc::dhcp::Dhcpv4Srv::setFixedFields().
| void isc::dhcp::Dhcpv4Exchange::initResponse | ( | ) |
Initializes the instance of the response message.
The type of the response depends on the type of the query message. For the DHCPDISCOVER the DHCPOFFER is created. For the DHCPREQUEST and DHCPINFORM the DHCPACK is created. For the DHCPRELEASE the response is not initialized.
Definition at line 193 of file dhcp4_srv.cc.
References isc::dhcp::DHCPACK, isc::dhcp::DHCPDISCOVER, isc::dhcp::DHCPINFORM, isc::dhcp::DHCPOFFER, isc::dhcp::DHCPREQUEST, getQuery(), and initResponse4o6().
Referenced by Dhcpv4Exchange().
Here is the call graph for this function:| void isc::dhcp::Dhcpv4Exchange::initResponse4o6 | ( | ) |
Initializes the DHCPv6 part of the response message.
Called by initResponse() when the query is a DHCP4o6 message
Definition at line 219 of file dhcp4_srv.cc.
References DHCPV6_DHCPV4_RESPONSE, and getQuery().
Referenced by initResponse().
Here is the call graph for this function:| void isc::dhcp::Dhcpv4Exchange::setReservedClientClasses | ( | ) |
Assigns classes retrieved from host reservation database.
Definition at line 409 of file dhcp4_srv.cc.
References isc::dhcp::ClientClasses::cbegin(), and isc::dhcp::ClientClasses::cend().
Referenced by isc::dhcp::Dhcpv4Srv::processDiscover(), isc::dhcp::Dhcpv4Srv::processInform(), and isc::dhcp::Dhcpv4Srv::processRequest().
Here is the call graph for this function:| void isc::dhcp::Dhcpv4Exchange::setReservedMessageFields | ( | ) |
Sets reserved values of siaddr, sname and file in the server's response.
Definition at line 420 of file dhcp4_srv.cc.
Referenced by isc::dhcp::Dhcpv4Srv::setFixedFields().