Kea  2.3.5-git
qid_gen.cc
Go to the documentation of this file.
1 // Copyright (C) 2011-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 // qid_gen defines a generator for query id's
8 //
9 // We probably want to merge this with the weighted random in the nsas
10 // (and other parts where we need randomness, perhaps another thing
11 // for a general libutil?)
12 
13 #include <config.h>
14 
15 #include <cryptolink/crypto_rng.h>
16 #include <dns/qid_gen.h>
17 #include <cstring>
18 
19 namespace isc {
20 namespace dns {
21 
23 
26  return (qid_generator_instance);
27 }
28 
30 {
31 }
32 
33 uint16_t
35  uint16_t val;
36  std::vector<uint8_t> rnd = isc::cryptolink::random(sizeof(uint16_t));
37  memmove(&val, &rnd[0], sizeof(uint16_t));
38  return (val);
39 }
40 
41 } // namespace dns
42 } // namespace isc
uint16_t generateQid()
Generate a Qid.
Definition: qid_gen.cc:34
QidGenerator()
Default constructor.
Definition: qid_gen.cc:29
QidGenerator qid_generator_instance
Definition: qid_gen.cc:22
static QidGenerator & getInstance()
Returns the singleton instance of the QidGenerator.
Definition: qid_gen.cc:25
Defines the logger used by the top-level component of kea-lfc.
This class generates Qids for outgoing queries.
Definition: qid_gen.h:29