Kea 1.5.0
mysql_host_data_source.h
Go to the documentation of this file.
1// Copyright (C) 2015-2018 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 MYSQL_HOST_DATA_SOURCE_H
8#define MYSQL_HOST_DATA_SOURCE_H
9
13
14#include <stdint.h>
15
16#include <utility>
17#include <string>
18
19namespace isc {
20namespace dhcp {
21
23class MySqlHostDataSourceImpl;
24
31public:
32
57
61 virtual ~MySqlHostDataSource();
62
73 virtual void add(const HostPtr& host);
74
83 virtual bool del(const SubnetID& subnet_id, const asiolink::IOAddress& addr);
84
97 virtual bool del4(const SubnetID& subnet_id,
98 const Host::IdentifierType& identifier_type,
99 const uint8_t* identifier_begin, const size_t identifier_len);
100
113 virtual bool del6(const SubnetID& subnet_id,
114 const Host::IdentifierType& identifier_type,
115 const uint8_t* identifier_begin, const size_t identifier_len);
116
130 virtual ConstHostCollection
131 getAll(const Host::IdentifierType& identifier_type,
132 const uint8_t* identifier_begin, const size_t identifier_len) const;
133
142 virtual ConstHostCollection
143 getAll4(const asiolink::IOAddress& address) const;
144
155 virtual ConstHostPtr
156 get4(const SubnetID& subnet_id, const Host::IdentifierType& identifier_type,
157 const uint8_t* identifier_begin, const size_t identifier_len) const;
158
175 virtual ConstHostPtr
176 get4(const SubnetID& subnet_id, const asiolink::IOAddress& address) const;
177
188 virtual ConstHostPtr
189 get6(const SubnetID& subnet_id, const Host::IdentifierType& identifier_type,
190 const uint8_t* identifier_begin, const size_t identifier_len) const;
191
198 virtual ConstHostPtr
199 get6(const asiolink::IOAddress& prefix, const uint8_t prefix_len) const;
200
208 virtual ConstHostPtr
209 get6(const SubnetID& subnet_id, const asiolink::IOAddress& address) const;
210
216 virtual std::string getType() const {
217 return (std::string("mysql"));
218 }
219
225 virtual std::string getName() const;
226
232 virtual std::string getDescription() const;
233
242 virtual std::pair<uint32_t, uint32_t> getVersion() const;
243
247 virtual void commit();
248
252 virtual void rollback();
253
254private:
257};
258
259}
260}
261
262#endif // MYSQL_HOST_DATA_SOURCE_H
std::map< std::string, std::string > ParameterMap
Database configuration parameter map.
Base interface for the classes implementing simple data source for host reservations.
IdentifierType
Type of the host identifier.
Definition: host.h:252
Implementation of the MySqlHostDataSource.
virtual ConstHostCollection getAll(const Host::IdentifierType &identifier_type, const uint8_t *identifier_begin, const size_t identifier_len) const
Return all hosts connected to any subnet for which reservations have been made using a specified iden...
virtual ConstHostPtr get6(const SubnetID &subnet_id, const Host::IdentifierType &identifier_type, const uint8_t *identifier_begin, const size_t identifier_len) const
Returns a host connected to the IPv6 subnet.
virtual void commit()
Commit Transactions.
virtual bool del(const SubnetID &subnet_id, const asiolink::IOAddress &addr)
Attempts to delete a host by (subnet-id, address)
virtual std::pair< uint32_t, uint32_t > getVersion() const
Returns backend version.
virtual std::string getDescription() const
Returns description of the backend.
virtual ~MySqlHostDataSource()
Virtual destructor.
virtual bool del6(const SubnetID &subnet_id, const Host::IdentifierType &identifier_type, const uint8_t *identifier_begin, const size_t identifier_len)
Attempts to delete a host by (subnet6-id, identifier type, identifier)
virtual bool del4(const SubnetID &subnet_id, const Host::IdentifierType &identifier_type, const uint8_t *identifier_begin, const size_t identifier_len)
Attempts to delete a host by (subnet4-id, identifier type, identifier)
virtual void rollback()
Rollback Transactions.
virtual std::string getType() const
Return backend type.
virtual std::string getName() const
Returns backend name.
virtual void add(const HostPtr &host)
Adds a new host to the collection.
virtual ConstHostPtr get4(const SubnetID &subnet_id, const Host::IdentifierType &identifier_type, const uint8_t *identifier_begin, const size_t identifier_len) const
Returns a host connected to the IPv4 subnet.
virtual ConstHostCollection getAll4(const asiolink::IOAddress &address) const
Returns a collection of hosts using the specified IPv4 address.
boost::shared_ptr< Host > HostPtr
Pointer to the Host object.
Definition: host.h:725
std::vector< ConstHostPtr > ConstHostCollection
Collection of the const Host objects.
Definition: host.h:731
uint32_t SubnetID
Unique identifier for a subnet (both v4 and v6)
Definition: lease.h:24
boost::shared_ptr< const Host > ConstHostPtr
Const pointer to the Host object.
Definition: host.h:728
Defines the logger used by the top-level component of kea-dhcp-ddns.