Kea  1.9.9-git
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 
20 namespace isc {
21 namespace dhcp {
22 
35 public:
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 
88 private:
89 
104  void initColumns();
105 
109 
110  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
Structure that holds a lease for IPv4 address.
Definition: lease.h:294
bool next(Lease4Ptr &lease)
Reads next lease from the CSV file.
Provides methods to access CSV file with DHCPv4 leases.
boost::shared_ptr< Lease4 > Lease4Ptr
Pointer to a Lease4 structure.
Definition: lease.h:283
boost::shared_ptr< const Element > ConstElementPtr
Definition: data.h:23
Represents a single row of the CSV file.
Definition: csv_file.h:51
CSVLeaseFile4(const std::string &filename)
Constructor.
boost::shared_ptr< ClientId > ClientIdPtr
Shared pointer to a Client ID.
Definition: duid.h:103
Defines the logger used by the top-level component of kea-dhcp-ddns.
Provides statistics for leases.
Implements a CSV file that supports multiple versions of the file's "schema".
Hardware type that represents information from DHCPv4 packet.
Definition: hwaddr.h:20
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.
uint32_t SubnetID
Unique identifier for a subnet (both v4 and v6)
Definition: lease.h:24