Kea 2.2.0
nsec3hash.h
Go to the documentation of this file.
1// Copyright (C) 2012-2015 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 NSEC3HASH_H
8#define NSEC3HASH_H 1
9
10#include <string>
11#include <vector>
12#include <stdint.h>
14
15namespace isc {
16namespace dns {
17class Name;
18class LabelSequence;
19
20namespace rdata {
21namespace generic {
22class NSEC3;
23class NSEC3PARAM;
24}
25}
26
34public:
35 UnknownNSEC3HashAlgorithm(const char* file, size_t line,
36 const char* what) :
37 isc::Exception(file, line, what) {}
38};
39
74class NSEC3Hash {
75protected:
82
83public:
104 static NSEC3Hash* create(const rdata::generic::NSEC3PARAM& param);
105
110 static NSEC3Hash* create(const rdata::generic::NSEC3& nsec3);
111
119 static NSEC3Hash* create(uint8_t algorithm, uint16_t iterations,
120 const uint8_t* salt_data, size_t salt_length);
121
123 virtual ~NSEC3Hash() {}
124
136 virtual std::string calculate(const Name& name) const = 0;
137
150 virtual std::string calculate(const LabelSequence& ls) const = 0;
151
166 virtual bool match(const rdata::generic::NSEC3& nsec3) const = 0;
167
172 virtual bool match(const rdata::generic::NSEC3PARAM& nsec3param) const = 0;
173};
174
204protected:
210
211public:
216 virtual ~NSEC3HashCreator() {}
217
222 virtual NSEC3Hash* create(const rdata::generic::NSEC3PARAM& nsec3param)
223 const = 0;
224
230 const = 0;
231
244 virtual NSEC3Hash* create(uint8_t algorithm, uint16_t iterations,
245 const uint8_t* salt_data, size_t salt_length)
246 const = 0;
247};
248
259public:
260 virtual NSEC3Hash* create(const rdata::generic::NSEC3PARAM& param) const;
261 virtual NSEC3Hash* create(const rdata::generic::NSEC3& nsec3) const;
262 virtual NSEC3Hash* create(uint8_t algorithm, uint16_t iterations,
263 const uint8_t* salt_data,
264 size_t salt_length) const;
265};
266
282void setNSEC3HashCreator(const NSEC3HashCreator* new_creator);
283
284}
285}
286#endif // NSEC3HASH_H
287
288// Local Variables:
289// mode: c++
290// End:
This is a base class for exceptions thrown from the DNS library module.
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
The default NSEC3Hash creator.
Definition: nsec3hash.h:258
virtual NSEC3Hash * create(const rdata::generic::NSEC3PARAM &param) const
Factory method of NSECHash from NSEC3PARAM RDATA.
Definition: nsec3hash.cc:238
Light-weight Accessor to Name data.
Definition: labelsequence.h:35
Factory class of NSEC3Hash.
Definition: nsec3hash.h:203
virtual NSEC3Hash * create(uint8_t algorithm, uint16_t iterations, const uint8_t *salt_data, size_t salt_length) const =0
Factory method of NSECHash from args.
virtual ~NSEC3HashCreator()
The destructor.
Definition: nsec3hash.h:216
virtual NSEC3Hash * create(const rdata::generic::NSEC3 &nsec3) const =0
Factory method of NSECHash from NSEC3 RDATA.
NSEC3HashCreator()
The default constructor.
Definition: nsec3hash.h:209
virtual NSEC3Hash * create(const rdata::generic::NSEC3PARAM &nsec3param) const =0
Factory method of NSECHash from NSEC3PARAM RDATA.
A calculator of NSEC3 hashes.
Definition: nsec3hash.h:74
virtual bool match(const rdata::generic::NSEC3 &nsec3) const =0
Match given NSEC3 parameters with that of the hash.
virtual ~NSEC3Hash()
The destructor.
Definition: nsec3hash.h:123
virtual std::string calculate(const LabelSequence &ls) const =0
Calculate the NSEC3 hash (LabelSequence variant).
virtual std::string calculate(const Name &name) const =0
Calculate the NSEC3 hash (Name variant).
static NSEC3Hash * create(const rdata::generic::NSEC3PARAM &param)
Factory method of NSECHash from NSEC3PARAM RDATA.
Definition: nsec3hash.cc:221
virtual bool match(const rdata::generic::NSEC3PARAM &nsec3param) const =0
Match given NSEC3PARAM parameters with that of the hash.
NSEC3Hash()
The default constructor.
Definition: nsec3hash.h:81
The Name class encapsulates DNS names.
Definition: name.h:223
An exception that is thrown for when an NSEC3Hash object is constructed with an unknown hash algorith...
Definition: nsec3hash.h:33
UnknownNSEC3HashAlgorithm(const char *file, size_t line, const char *what)
Definition: nsec3hash.h:35
void setNSEC3HashCreator(const NSEC3HashCreator *new_creator)
The registrar of NSEC3HashCreator.
Definition: nsec3hash.cc:263
Defines the logger used by the top-level component of kea-lfc.