Kea 3.1.1
bulk_lease_query6.h
Go to the documentation of this file.
1// Copyright (C) 2022-2025 Internet Systems Consortium, Inc. ("ISC")
2//
3// This Source Code Form is subject to the terms of the Mozilla Public
4// License, v. 2.0. If a copy of the MPL was not distributed with this
5// file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
7#ifndef BULK_LEASE_QUERY6_H
8#define BULK_LEASE_QUERY6_H
9
10#include <config.h>
11
12#include <lease_query_impl.h>
13#include <bulk_lease_query.h>
14#include <dhcp/option_custom.h>
15#include <dhcp/option6_iaaddr.h>
16#include <dhcpsrv/subnet_id.h>
17
18namespace isc {
19namespace lease_query {
20
22class BulkLeaseQuery6;
23
25typedef boost::shared_ptr<BulkLeaseQuery6> BulkLeaseQuery6Ptr;
26
29public:
30
39 const BlqPostCb& post,
40 const BlqPushToSendCb& push_to_send,
41 const BlqQueryCompleteCb& query_complete)
42 : BulkLeaseQuery(query, post, push_to_send, query_complete),
43 query6_(),
44 link_addr_(asiolink::IOAddress::IPV6_ZERO_ADDRESS()), links_(),
45 start_addr_(asiolink::IOAddress::IPV6_ZERO_ADDRESS()),
46 page_size_(10),
49 init();
50 }
51
53 virtual ~BulkLeaseQuery6() {
54 }
55
59 static std::string leaseQueryLabel(const BlqMsgPtr& msg);
60
66 virtual void init();
67
69 virtual void start();
70
73 return (query6_);
74 }
75
78 return (link_addr_);
79 }
80
82 const dhcp::SubnetIDSet& links() const {
83 return (links_);
84 }
85
88 return (start_addr_);
89 }
90
92 size_t getPageSize() const {
93 return (page_size_);
94 }
95
96protected:
99
101 void bulkQueryByClientId();
102
104 void bulkQueryByRelayId();
105
107 void bulkQueryByRemoteId();
108
111
114
119 if (!ptr) {
120 // Should not happen.
121 return;
122 }
123 ptr->bulkQueryByRelayIdNext();
124 }
125
128
133 if (!ptr) {
134 // Should not happen.
135 return;
136 }
137 ptr->bulkQueryByRemoteIdNext();
138 }
139
142
147 if (!ptr) {
148 // Should not happen.
149 return;
150 }
151 ptr->bulkQueryByLinkAddressNext();
152 }
153
157 virtual void send(dhcp::Pkt6Ptr response) const;
158
162 virtual void sendReply(dhcp::OptionPtr status);
163
168
175
180 return (query_client_id_);
181 }
182
187 return (query_relay_id_);
188 }
189
194 return (query_remote_id_);
195 }
196
199
202
205
208
212
215
218
221
224
227};
228
229} // end of namespace isc::lease_query
230} // end of namespace isc
231
232#endif // BULK_LEASE_QUERY6_H
Provides control flow for processing a bulk query.
asiolink::IOAddress start_addr_
The start address (for paged processing).
dhcp::SubnetIDSet links_
The links the link address (when not ::) belongs to.
dhcp::Option6IAAddrPtr getQueryIpAddress() const
Get the query ip address for a by ip address bulk query.
BulkLeaseQuery6(BlqQueryPtr query, const BlqPostCb &post, const BlqPushToSendCb &push_to_send, const BlqQueryCompleteCb &query_complete)
Constructor.
dhcp::Pkt6Ptr getQuery6() const
Get the DHCPv6 query.
void bulkQueryByRemoteIdNext()
Subsequent processing of a by remote id bulk query.
dhcp::DuidPtr getQueryRelayId() const
Get the query relay id for a by relay id bulk query.
void bulkQueryByRelayIdNext()
Subsequent processing of a by relay id bulk query.
static void doBulkQueryByLinkAddressNext(BulkLeaseQuery6Ptr ptr)
Class/static subsequent processing of a by link address bulk query.
const asiolink::IOAddress & getLinkAddress() const
Get the link address.
static std::string leaseQueryLabel(const BlqMsgPtr &msg)
Convenience method for generating per packet logging info.
dhcp::DuidPtr getQueryClientId() const
Get the query client id for a by client id bulk query.
static void doBulkQueryByRemoteIdNext(BulkLeaseQuery6Ptr ptr)
Class/static subsequent processing of a by remote id bulk query.
void bulkQueryByRemoteId()
Start processing of a by remote id bulk query.
void bulkQueryByRelayId()
Start processing of a by relay id bulk query.
size_t getPageSize() const
Get the page size.
virtual void send(dhcp::Pkt6Ptr response) const
Send a response.
dhcp::OptionPtr query_remote_id_
The remote id (for a by remote id bulk query).
dhcp::OptionCustomPtr lq_option_
The lease query option.
dhcp::OptionPtr getQueryRemoteId() const
Get the query remote id for a by remote id bulk query.
virtual void init()
Initialization.
virtual void sendReply(dhcp::OptionPtr status)
Send a final reply.
void bulkQueryByClientId()
Start processing of a by client id bulk query.
dhcp::DuidPtr query_client_id_
The query client id (for a by client id bulk query).
const dhcp::SubnetIDSet & links() const
Get the links set.
void bulkQueryByIpAddress()
Start processing of a by ip address bulk query.
void bulkQueryByLinkAddress()
Start processing of a by link address bulk query.
dhcp::Option6IAAddrPtr query_iaaddr_
The query ip address (for a by ip address bulk query).
dhcp::DuidPtr query_relay_id_
The query relay id (for a by relay id bulk query).
virtual void start()
Start processing.
dhcp::Pkt6Ptr query6_
The DHCPv6 query.
asiolink::IOAddress getStartAddress() const
Get the current start address.
void bulkQueryByLinkAddressNext()
Subsequent processing of a by link address bulk query.
asiolink::IOAddress link_addr_
The link address.
size_t page_size_
The page size (for paged processing, taken from the MT Lease query manager or defaults to 10).
dhcp::OptionCustomPtr getLeaseQueryOption() const
Get the lease query option.
static void doBulkQueryByRelayIdNext(BulkLeaseQuery6Ptr ptr)
Class/static subsequent processing of a by relay id bulk query.
BulkLeaseQuery(BlqQueryPtr query, const BlqPostCb &post, const BlqPushToSendCb &push_to_send, const BlqQueryCompleteCb &query_complete)
Constructor.
std::set< dhcp::SubnetID > SubnetIDSet
Ordered list aka set of subnetIDs.
Definition subnet_id.h:43
boost::shared_ptr< OptionCustom > OptionCustomPtr
A pointer to the OptionCustom object.
boost::shared_ptr< DUID > DuidPtr
Definition duid.h:136
boost::shared_ptr< Option6IAAddr > Option6IAAddrPtr
A pointer to the isc::dhcp::Option6IAAddr object.
boost::shared_ptr< Pkt6 > Pkt6Ptr
A pointer to Pkt6 packet.
Definition pkt6.h:31
boost::shared_ptr< Option > OptionPtr
Definition option.h:37
std::function< void(const BlqPostCbArg &)> BlqPostCb
Type of BLQ post callback.
std::function< void(Xid)> BlqQueryCompleteCb
Type of BLQ queryComplete callback.
boost::shared_ptr< BlqQuery > BlqQueryPtr
Defines a shared pointer to an BlqQuery.
Definition blq_msg.h:116
boost::shared_ptr< BlqMsg > BlqMsgPtr
Defines a shared pointer to an BlqMsg.
Definition blq_msg.h:93
boost::shared_ptr< BulkLeaseQuery6 > BulkLeaseQuery6Ptr
Defines a shared pointer to a BulkLeaseQuery6 object.
std::function< bool(BlqResponsePtr)> BlqPushToSendCb
Type of BLQ pushToSend callback.
Defines the logger used by the top-level component of kea-lfc.