Kea 2.2.0
csv_lease_file4.h
Go to the documentation of this file.
1// Copyright (C) 2014-2021 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
35public:
36
42 CSVLeaseFile4(const std::string& filename);
43
51 virtual void open(const bool seek_to_end = false);
52
63 void append(const Lease4& lease);
64
86 bool next(Lease4Ptr& lease);
87
88private:
89
104 void initColumns();
105
109
110
114 asiolink::IOAddress readAddress(const util::CSVRow& row);
115
119 HWAddr readHWAddr(const util::CSVRow& row);
120
124 ClientIdPtr readClientId(const util::CSVRow& row);
125
129 uint32_t readValid(const util::CSVRow& row);
130
134 time_t readCltt(const util::CSVRow& row);
135
139 SubnetID readSubnetID(const util::CSVRow& row);
140
144 bool readFqdnFwd(const util::CSVRow& row);
145
149 bool readFqdnRev(const util::CSVRow& row);
150
154 std::string readHostname(const util::CSVRow& row);
155
159 uint32_t readState(const util::CSVRow& row);
160
164 data::ConstElementPtr readContext(const util::CSVRow& row);
166
167};
168
169} // namespace isc::dhcp
170} // namespace isc
171
172#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.
CSVLeaseFile4(const std::string &filename)
Constructor.
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:27
uint32_t SubnetID
Defines unique IPv4 or IPv6 subnet identifier.
Definition: subnet_id.h:24
boost::shared_ptr< ClientId > ClientIdPtr
Shared pointer to a Client ID.
Definition: duid.h:103
boost::shared_ptr< Lease4 > Lease4Ptr
Pointer to a Lease4 structure.
Definition: lease.h:284
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:295