![]() |
Kea 3.1.1
|
Provides control flow for processing a bulk query. More...
#include <bulk_lease_query4.h>
Public Member Functions | |
BulkLeaseQuery4 (BlqQueryPtr query, const BlqPostCb &post, const BlqPushToSendCb &push_to_send, const BlqQueryCompleteCb &query_complete) | |
Constructor. | |
virtual | ~BulkLeaseQuery4 () |
Destructor. | |
size_t | getPageSize () const |
Get the page size. | |
dhcp::Pkt4Ptr | getQuery4 () const |
Get the DHCPv4 query. | |
asiolink::IOAddress | getStartAddress () const |
Get the current start address. | |
virtual void | init () |
Initialization. | |
virtual void | start () |
Start processing. | |
![]() | |
BulkLeaseQuery (BlqQueryPtr query, const BlqPostCb &post, const BlqPushToSendCb &push_to_send, const BlqQueryCompleteCb &query_complete) | |
Constructor. | |
virtual | ~BulkLeaseQuery () |
Destructor. | |
BlqQueryPtr | getQuery () |
Get the query. | |
uint8_t | getQueryType () const |
Get the query type. | |
Xid | getXid () const |
Get the transaction id of the query. | |
bool | isProcessed () const |
Processing finished predicate. | |
bool | isProcessing () const |
Processing in progress predicate. | |
Static Public Member Functions | |
static std::string | leaseQueryLabel (const BlqMsgPtr &msg) |
Convenience method for generating per packet logging info. | |
![]() | |
static void | processStart (BulkLeaseQueryPtr ptr) |
Class/static start processing. | |
Protected Member Functions | |
void | bulkQueryByClientId () |
Start processing of a by client id bulk query. | |
void | bulkQueryByHWAddr () |
Start processing of a by harware address bulk query. | |
void | bulkQueryByRelayId () |
Start processing of a by relay id bulk query. | |
void | bulkQueryByRemoteId () |
Start processing of a by remote id bulk query. | |
dhcp::OptionPtr | getQueryClientId () const |
Get the query client id for a by client id bulk query. | |
dhcp::HWAddrPtr | getQueryHWAddr () const |
Get the query hardware address for a by hardware address bulk query. | |
uint8_t | getQueryMask () const |
Get the query mask. | |
dhcp::OptionPtr | getQueryRelayId () const |
Get the query relay id for a by relay id bulk query. | |
dhcp::OptionPtr | getQueryRemoteId () const |
Get the query remote id for a by remote id bulk query. | |
virtual void | send (dhcp::Pkt4Ptr response) |
Send a response. | |
virtual void | sendActive (const dhcp::Lease4Ptr &lease) |
Send a DHCPLEASEACTIVE message. | |
virtual void | sendDone (BLQStatusCode status, const std::string &message="") |
Send a DHCPLEASEQUERYDONE message. | |
![]() | |
virtual void | setDone () |
Set the done flag. | |
Static Protected Member Functions | |
static void | doBulkQueryByRelayId (BulkLeaseQuery4Ptr ptr) |
Class/static subsequent processing of a by relay id bulk query. | |
static void | doBulkQueryByRemoteId (BulkLeaseQuery4Ptr ptr) |
Class/static subsequent processing of a by remote id bulk query. | |
Protected Attributes | |
size_t | page_size_ |
The page size (for paged processing, taken from the MT Lease query manager or defaults to 10). | |
dhcp::Pkt4Ptr | query4_ |
The DHCPv4 query. | |
dhcp::OptionPtr | query_client_id_ |
The query client id (for a by client id bulk query). | |
time_t | query_end_time_ |
The query end time. | |
dhcp::HWAddrPtr | query_hwaddr_ |
The query hardware address (for a by hardware address bulk query). | |
uint8_t | query_mask_ |
The query mask. | |
dhcp::OptionPtr | query_relay_id_ |
The query relay id (for a by relay id bulk query). | |
dhcp::OptionPtr | query_remote_id_ |
The remote id (for a by remote id bulk query). | |
time_t | query_start_time_ |
The query start time. | |
size_t | sent_ |
Sent response counter. | |
asiolink::IOAddress | start_addr_ |
The start address (for paged processing). | |
![]() | |
bool | done_ |
The processing finished. | |
BlqPostCb | post_ |
The post callback. | |
BlqPushToSendCb | push_to_send_ |
The pushToSend callback. | |
BlqQueryPtr | query_ |
The query. | |
BlqQueryCompleteCb | query_complete_ |
The queryComplete callback. | |
uint8_t | query_type_ |
The query type. | |
bool | started_ |
The processing is in progress. | |
Provides control flow for processing a bulk query.
Definition at line 59 of file bulk_lease_query4.h.
|
inline |
Constructor.
query | The query. |
post | The post callback. |
push_to_send | The pushToSend callback. |
query_complete | The queryComplete callback. |
BadValue | if the query is invalid for a number reasons. |
Definition at line 69 of file bulk_lease_query4.h.
References isc::lease_query::BulkLeaseQuery::BulkLeaseQuery(), init(), page_size_, query4_, query_client_id_, query_end_time_, query_hwaddr_, query_mask_, query_relay_id_, query_remote_id_, query_start_time_, sent_, and start_addr_.
|
inlinevirtual |
Destructor.
Definition at line 86 of file bulk_lease_query4.h.
|
protected |
Start processing of a by client id bulk query.
Definition at line 246 of file bulk_lease_query4.cc.
References isc::lease_query::BLQ_STATUS_Success, isc::dhcp::LeaseMgr::getLease4(), isc::dhcp::LeaseMgrFactory::instance(), isc_throw, query_client_id_, query_end_time_, query_start_time_, sendActive(), sendDone(), and isc::dhcp::Lease::STATE_DEFAULT.
Referenced by start().
|
protected |
Start processing of a by harware address bulk query.
Definition at line 283 of file bulk_lease_query4.cc.
References isc::lease_query::BLQ_STATUS_Success, isc::dhcp::LeaseMgr::getLease4(), isc::dhcp::LeaseMgrFactory::instance(), isc_throw, query_end_time_, query_hwaddr_, query_start_time_, sendActive(), sendDone(), and isc::dhcp::Lease::STATE_DEFAULT.
Referenced by start().
|
protected |
Start processing of a by relay id bulk query.
Definition at line 319 of file bulk_lease_query4.cc.
References isc::lease_query::BLQ_STATUS_Success, CHECK_TERMINATED, doBulkQueryByRelayId(), isc::dhcp::LeaseMgr::getLeases4ByRelayId(), isc::dhcp::LeaseMgrFactory::instance(), isc_throw, page_size_, isc::lease_query::BulkLeaseQuery::post_, query_end_time_, query_relay_id_, query_start_time_, sendActive(), sendDone(), start_addr_, and isc::dhcp::Lease::STATE_DEFAULT.
Referenced by start().
|
protected |
Start processing of a by remote id bulk query.
Definition at line 365 of file bulk_lease_query4.cc.
References isc::lease_query::BLQ_STATUS_Success, CHECK_TERMINATED, doBulkQueryByRemoteId(), isc::dhcp::LeaseMgr::getLeases4ByRemoteId(), isc::dhcp::LeaseMgrFactory::instance(), isc_throw, page_size_, isc::lease_query::BulkLeaseQuery::post_, query_end_time_, query_remote_id_, query_start_time_, sendActive(), sendDone(), start_addr_, and isc::dhcp::Lease::STATE_DEFAULT.
Referenced by start().
|
inlinestaticprotected |
Class/static subsequent processing of a by relay id bulk query.
ptr | Pointer to a BulkLeaseQuery4 object (must not be null). |
Definition at line 135 of file bulk_lease_query4.h.
Referenced by bulkQueryByRelayId().
|
inlinestaticprotected |
Class/static subsequent processing of a by remote id bulk query.
ptr | Pointer to a BulkLeaseQuery4 object (must not be null). |
Definition at line 146 of file bulk_lease_query4.h.
Referenced by bulkQueryByRemoteId().
|
inline |
|
inline |
|
inlineprotected |
Get the query client id for a by client id bulk query.
Definition at line 179 of file bulk_lease_query4.h.
References query_client_id_.
|
inlineprotected |
Get the query hardware address for a by hardware address bulk query.
Definition at line 186 of file bulk_lease_query4.h.
References query_hwaddr_.
|
inlineprotected |
|
inlineprotected |
Get the query relay id for a by relay id bulk query.
Definition at line 193 of file bulk_lease_query4.h.
References query_relay_id_.
|
inlineprotected |
Get the query remote id for a by remote id bulk query.
Definition at line 200 of file bulk_lease_query4.h.
References query_remote_id_.
|
inline |
Get the current start address.
Definition at line 110 of file bulk_lease_query4.h.
References start_addr_.
|
virtual |
Initialization.
Check the query and fill processing context fields.
BadValue | if the query is invalid for a number reasons. |
Implements isc::lease_query::BulkLeaseQuery.
Definition at line 86 of file bulk_lease_query4.cc.
References isc::lease_query::BLQ_STATUS_MalformedQuery, isc::lease_query::BLQ_STATUS_NotAllowed, isc::dhcp::DHO_DHCP_AGENT_OPTIONS, isc::dhcp::DHO_DHCP_CLIENT_IDENTIFIER, isc::dhcp::DHO_QUERY_END_TIME, isc::dhcp::DHO_QUERY_START_TIME, DHO_VSS, isc::lease_query::BulkLeaseQueryService::instance(), isc_throw, page_size_, query4_, isc::lease_query::BulkLeaseQuery::query_, query_client_id_, query_end_time_, query_hwaddr_, query_mask_, query_relay_id_, query_remote_id_, query_start_time_, isc::dhcp::RAI_OPTION_RELAY_ID, isc::dhcp::RAI_OPTION_REMOTE_ID, and sendDone().
Referenced by BulkLeaseQuery4().
|
static |
Convenience method for generating per packet logging info.
msg | Lease query message. |
Definition at line 77 of file bulk_lease_query4.cc.
References isc::lease_query::LeaseQueryImpl4::leaseQueryLabel().
Referenced by isc::lease_query::LeaseQueryConnection::startQuery().
|
protectedvirtual |
Send a response.
response | The response packet. |
Definition at line 411 of file bulk_lease_query4.cc.
References CHECK_TERMINATED, isc::dhcp::LibDHCP::DHO_DHCP_SERVER_IDENTIFIER_DEF(), isc::lease_query::BulkLeaseQueryService::instance(), isc_throw, isc::lease_query::BulkLeaseQuery::push_to_send_, sent_, and isc::dhcp::Option::V4.
Referenced by sendActive(), and sendDone().
|
protectedvirtual |
Send a DHCPLEASEACTIVE message.
lease | The lease. |
Definition at line 459 of file bulk_lease_query4.cc.
References isc::lease_query::LeaseQueryImpl4::addLeaseTimes(), isc::lease_query::LeaseQueryImpl4::addRelayAgentInfo(), isc::dhcp::DHCPLEASEACTIVE, isc::dhcp::DHO_BASE_TIME, isc::dhcp::DHO_DHCP_CLIENT_IDENTIFIER, isc::dhcp::CfgMgr::getCurrentCfg(), isc::dhcp::CfgMgr::instance(), query4_, send(), and isc::dhcp::Option::V4.
Referenced by bulkQueryByClientId(), bulkQueryByHWAddr(), bulkQueryByRelayId(), and bulkQueryByRemoteId().
|
protectedvirtual |
Send a DHCPLEASEQUERYDONE message.
status | The status code. |
message | The optional message. |
Definition at line 435 of file bulk_lease_query4.cc.
References isc::lease_query::BLQ_STATUS_Success, isc::dhcp::DHCPLEASEQUERYDONE, isc::dhcp::LibDHCP::DHO_STATUS_CODE_DEF(), query4_, send(), isc::lease_query::BulkLeaseQuery::setDone(), and isc::dhcp::Option::V4.
Referenced by bulkQueryByClientId(), bulkQueryByHWAddr(), bulkQueryByRelayId(), bulkQueryByRemoteId(), and init().
|
virtual |
Start processing.
Implements isc::lease_query::BulkLeaseQuery.
Definition at line 217 of file bulk_lease_query4.cc.
References bulkQueryByClientId(), bulkQueryByHWAddr(), bulkQueryByRelayId(), bulkQueryByRemoteId(), isc_throw, query_mask_, and isc::lease_query::BulkLeaseQuery::started_.
|
protected |
The page size (for paged processing, taken from the MT Lease query manager or defaults to 10).
Definition at line 212 of file bulk_lease_query4.h.
Referenced by BulkLeaseQuery4(), bulkQueryByRelayId(), bulkQueryByRemoteId(), getPageSize(), and init().
|
protected |
The DHCPv4 query.
Definition at line 205 of file bulk_lease_query4.h.
Referenced by BulkLeaseQuery4(), getQuery4(), init(), sendActive(), and sendDone().
|
protected |
The query client id (for a by client id bulk query).
Definition at line 223 of file bulk_lease_query4.h.
Referenced by BulkLeaseQuery4(), bulkQueryByClientId(), getQueryClientId(), and init().
|
protected |
The query end time.
Definition at line 238 of file bulk_lease_query4.h.
Referenced by BulkLeaseQuery4(), bulkQueryByClientId(), bulkQueryByHWAddr(), bulkQueryByRelayId(), bulkQueryByRemoteId(), and init().
|
protected |
The query hardware address (for a by hardware address bulk query).
Definition at line 226 of file bulk_lease_query4.h.
Referenced by BulkLeaseQuery4(), bulkQueryByHWAddr(), getQueryHWAddr(), and init().
|
protected |
The query mask.
1 - by client id 2 - by hardware address 4 - by relay id 8 - by remote id
Definition at line 220 of file bulk_lease_query4.h.
Referenced by BulkLeaseQuery4(), getQueryMask(), init(), and start().
|
protected |
The query relay id (for a by relay id bulk query).
Definition at line 229 of file bulk_lease_query4.h.
Referenced by BulkLeaseQuery4(), bulkQueryByRelayId(), getQueryRelayId(), and init().
|
protected |
The remote id (for a by remote id bulk query).
Definition at line 232 of file bulk_lease_query4.h.
Referenced by BulkLeaseQuery4(), bulkQueryByRemoteId(), getQueryRemoteId(), and init().
|
protected |
The query start time.
Definition at line 235 of file bulk_lease_query4.h.
Referenced by BulkLeaseQuery4(), bulkQueryByClientId(), bulkQueryByHWAddr(), bulkQueryByRelayId(), bulkQueryByRemoteId(), and init().
|
protected |
Sent response counter.
Definition at line 241 of file bulk_lease_query4.h.
Referenced by BulkLeaseQuery4(), and send().
|
protected |
The start address (for paged processing).
Definition at line 208 of file bulk_lease_query4.h.
Referenced by BulkLeaseQuery4(), bulkQueryByRelayId(), bulkQueryByRemoteId(), and getStartAddress().