Kea 2.5.8
csv_lease_file4.h
Go to the documentation of this file.
1// Copyright (C) 2014-2023 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 CSV_LEASE_FILE4_H
8#define CSV_LEASE_FILE4_H
9
10#include <asiolink/io_address.h>
11#include <dhcp/duid.h>
12#include <dhcpsrv/lease.h>
13#include <dhcpsrv/subnet.h>
16#include <stdint.h>
17#include <string>
18#include <time.h>
19
20namespace isc {
21namespace dhcp {
22
34public:
35
41 CSVLeaseFile4(const std::string& filename);
42
50 virtual void open(const bool seek_to_end = false);
51
62 void append(const Lease4& lease);
63
84 bool next(Lease4Ptr& lease);
85
86private:
87
103 void initColumns();
104
108
109
113 asiolink::IOAddress readAddress(const util::CSVRow& row);
114
118 HWAddr readHWAddr(const util::CSVRow& row);
119
123 ClientIdPtr readClientId(const util::CSVRow& row);
124
128 uint32_t readValid(const util::CSVRow& row);
129
133 time_t readCltt(const util::CSVRow& row);
134
138 SubnetID readSubnetID(const util::CSVRow& row);
139
143 uint32_t readPoolID(const util::CSVRow& row);
144
148 bool readFqdnFwd(const util::CSVRow& row);
149
153 bool readFqdnRev(const util::CSVRow& row);
154
158 std::string readHostname(const util::CSVRow& row);
159
163 uint32_t readState(const util::CSVRow& row);
164
168 data::ConstElementPtr readContext(const util::CSVRow& row);
170};
171
172} // namespace isc::dhcp
173} // namespace isc
174
175#endif // CSV_LEASE_FILE4_H
Provides methods to access CSV file with DHCPv4 leases.
void append(const Lease4 &lease)
Appends the lease record to the CSV file.
virtual void open(const bool seek_to_end=false)
Opens a lease file.
bool next(Lease4Ptr &lease)
Reads next lease from the CSV file.
Provides statistics for leases.
Represents a single row of the CSV file.
Definition: csv_file.h:51
Implements a CSV file that supports multiple versions of the file's "schema".
boost::shared_ptr< const Element > ConstElementPtr
Definition: data.h:29
uint32_t SubnetID
Defines unique IPv4 or IPv6 subnet identifier.
Definition: subnet_id.h:25
boost::shared_ptr< ClientId > ClientIdPtr
Shared pointer to a Client ID.
Definition: duid.h:216
boost::shared_ptr< Lease4 > Lease4Ptr
Pointer to a Lease4 structure.
Definition: lease.h:292
Defines the logger used by the top-level component of kea-lfc.
Hardware type that represents information from DHCPv4 packet.
Definition: hwaddr.h:20
Structure that holds a lease for IPv4 address.
Definition: lease.h:300