namespace isc {
namespace dhcp {
- /// @brief Defines a single statement
+ /// @brief Pair containing major and minor versions
+ typedef std::pair<uint32_t, uint32_t> VersionPair;
+
+ /// @brief Statement index representing the statement name
+ typedef char const* const StatementTag;
+
+ /// @brief Define CQL backend version: 2.3
+ /// @{
+ constexpr uint32_t CQL_DRIVER_VERSION_MAJOR = CASS_VERSION_MAJOR;
+ constexpr uint32_t CQL_DRIVER_VERSION_MINOR = CASS_VERSION_MINOR;
+ /// @}
+
+ /// Define CQL schema version: 2.0
+ /// @{
+ constexpr uint32_t CQL_SCHEMA_VERSION_MAJOR = 2u;
+ constexpr uint32_t CQL_SCHEMA_VERSION_MINOR = 0u;
+ /// @}
+
+ /// @brief Defines a single statement or query
///
- /// @param params_ parameter names
/// @param name_ short description of the query
/// @param text_ text representation of the actual query
+ /// @param prepared_statement_ internal Cassandra object representing the
+ /// prepared statement
+ /// @param is_raw_statement_ shows if statement should be executed rawly or with
+ /// binds
struct CqlTaggedStatement {
- const char** params_;
- const char* name_;
- const char* text_;
+ StatementTag name_;
+ char const* const text_;
+ const CassPrepared* prepared_statement_;
+ bool is_raw_statement_;
+
+ /// @brief Constructor
+ CqlTaggedStatement(StatementTag name, char const* const text)
+ : name_(name), text_(text), prepared_statement_(NULL),
+ is_raw_statement_(false) {
+ }
+
+ /// @brief Constructor
+ CqlTaggedStatement(StatementTag name,
+ char const* const text,
+ bool const& is_raw_statement)
+ : name_(name), text_(text), prepared_statement_(NULL),
+ is_raw_statement_(is_raw_statement) {
+ }
};
- // Define CQL backend version: 2.3
- const uint32_t CQL_DRIVER_VERSION_MAJOR = CASS_VERSION_MAJOR;
- const uint32_t CQL_DRIVER_VERSION_MINOR = CASS_VERSION_MINOR;
+ /// @brief Hash function for StatementMap keys
+ ///
+ /// Delegates to std::hash<std::string>.
+ struct StatementTagHash {
+ size_t operator()(StatementTag const& key) const {
+ return std::hash<std::string>{}(std::string(key));
+ }
+ };
+/// Define CQL schema version: 2.0
+const uint32_t CQL_SCHEMA_VERSION_MAJOR = 2;
+const uint32_t CQL_SCHEMA_VERSION_MINOR = 0;
+
+ /// @brief Equality function for StatementMap keys
+ struct StatementTagEqual {
+ bool operator()(StatementTag const& lhs, StatementTag const& rhs) const {
+ return std::strcmp(lhs, rhs) == 0;
+ }
+ };
+
+ /// @brief Contains all statements.
+ typedef std::unordered_map<StatementTag,
+ CqlTaggedStatement,
+ StatementTagHash,
+ StatementTagEqual>
+ StatementMap;
+
+ typedef std::pair<StatementTag, CqlTaggedStatement> StatementMapEntry;
+
/// @brief Common CQL connector pool
///
/// Provides common operations for the Cassandra database connection used by
A debug message issued when the server is about to add an IPv6 lease
with the specified address to the Cassandra backend database.
+% DHCPSRV_CQL_BEGIN_TRANSACTION committing to Cassandra database.
+The server has issued a begin transaction call.
+
+% DHCPSRV_CQL_COMMIT committing to Cassandra database
+A commit call been issued on the server. For Cassandra, this is a no-op.
+
+% DHCPSRV_CQL_DB opening Cassandra lease database: %1
+This informational message is logged when a DHCP server (either V4 or
+V6) is about to open a Cassandra lease database. The parameters of
+the connection including database name and username needed to access it
+(but not the password if any) are logged.
+
+ % DHCPSRV_CQL_COMMIT committing to Cassandra database.
+ A commit call been issued on the server. For Cassandra, this is a no-op.
+
+ % DHCPSRV_CQL_CONNECTION_COMMIT committing to Cassandra database on current connection.
+ A commit call been issued on the server. For Cassandra, this is a no-op.
+
% DHCPSRV_CQL_DEALLOC_ERROR An error occurred while closing the CQL connection: %1
This is an error message issued when a DHCP server (either V4 or V6) experienced
and error freeing CQL database resources as part of closing its connection to
An informational message logged when a DHCP server is about to retrieve one
host from a CQL database by IPv6 criteria.
-% DHCPSRV_CQL_HOST_LOOKUP_BY_ID_4S Looking up primary key "id" filtering by host identifier.
-
-% DHCPSRV_CQL_HOST_LOOKUP_BY_4S Looking up primary key "id" filtering by host IPv4 address.
-
-% DHCPSRV_CQL_HOST_LOOKUP_BY_6S Looking up primary key "id" filtering by host IPv4 subnet ID.
-
-% DHCPSRV_CQL_HOST_LOOKUP_BY_ID_6S Looking up primary key "id" filtering by host identifier type.
-
-% DHCPSRV_CQL_HOST_LOOKUP_BY_4A Looking up primary key "id" filtering by host IPv4 address.
-
-% DHCPSRV_CQL_HOST_LOOKUP_BY_4S_4A Looking up primary key "id" filtering by host IPv6 subnet ID.
-
-% DHCPSRV_CQL_HOST_LOOKUP_BY_6S_6A Looking up primary key "id" filtering by reserved prefix address.
-
-% DHCPSRV_CQL_HOST_LOOKUP_BY_6A_6L Looking up primary key "id" filtering by reserved prefix length.
-
-% DHCPSRV_CQL_HOST_SYNC_RESERVATIONS Syncing reservations in database with kea.conf.
-
+ % DHCPSRV_CQL_LEASE_EXCEPTION_THROWN Exception thrown during Cassandra operation: %1
+
% DHCPSRV_DHCP4O6_RECEIVED_BAD_PACKET received bad DHCPv4o6 packet: %1
A bad DHCPv4o6 packet was received.