Kea 3.1.1
tkey_exchange.h
Go to the documentation of this file.
1// Copyright (C) 2021-2025 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 TKEY_EXCHANGE_H
8#define TKEY_EXCHANGE_H
9
10#include <asiodns/io_fetch.h>
11#include <asiolink/io_service.h>
12#include <gss_tsig_cfg.h>
13#include <gss_tsig_key.h>
14#include <util/buffer.h>
15#include <memory>
16
17namespace isc {
18namespace gss_tsig {
19
20class TKeyExchange;
21typedef boost::shared_ptr<TKeyExchange> TKeyExchangePtr;
22
25
36class TKeyExchange : boost::noncopyable {
37public:
48
50 static std::string statusToText(Status status);
51
58 class Callback {
59 public:
61 virtual ~Callback() { }
62
67 virtual void operator()(TKeyExchange::Status status) = 0;
68 };
69
84 const DnsServerPtr& server, const GssTsigKeyPtr& key,
85 Callback* callback, uint32_t timeout = TKEY_EXCHANGE_IO_TIMEOUT,
86 OM_uint32 flags = TKEY_EXCHANGE_FLAGS);
87
89 virtual ~TKeyExchange();
90
93 void doExchange();
94
96 void cancel();
97
102
106 void setIOService(const isc::asiolink::IOServicePtr io_service);
107
117 static const OM_uint32 TKEY_EXCHANGE_FLAGS;
118
121 static const uint32_t TKEY_EXCHANGE_IO_TIMEOUT;
122
123private:
125 std::unique_ptr<TKeyExchangeImpl> impl_;
126};
127
128} // namespace isc
129} // namespace gss_tsig
130
131#endif // TKEY_EXCHANGE_H
Callback for the TKeyExchange class.
virtual void operator()(TKeyExchange::Status status)=0
Function operator implementing a callback.
virtual ~Callback()
Virtual destructor.
The TKeyExchange class handles communication with the DNS server.
void cancel()
This function cancels the in-flight TKEY exchange.
Status
A status code of the TKeyExchange.
@ SUCCESS
Response received and is ok.
@ BAD_CREDENTIALS
Bad client credentials.
@ IO_STOPPED
IO was stopped.
@ UNSIGNED_RESPONSE
Response received but not signed.
@ INVALID_RESPONSE
Response received but invalid.
@ TIMEOUT
No response, timeout.
@ OTHER
Other, unclassified error.
static std::string statusToText(Status status)
Convert a status to its textual form.
TKeyExchange(const isc::asiolink::IOServicePtr &io_service, const DnsServerPtr &server, const GssTsigKeyPtr &key, Callback *callback, uint32_t timeout=TKEY_EXCHANGE_IO_TIMEOUT, OM_uint32 flags=TKEY_EXCHANGE_FLAGS)
Constructor.
isc::asiolink::IOServicePtr getIOService()
Gets IO service.
void doExchange()
This function handles the repeated communication with the DNS server trying to complete the TKEY exch...
void setIOService(const isc::asiolink::IOServicePtr io_service)
Sets IO service.
static const uint32_t TKEY_EXCHANGE_IO_TIMEOUT
The default IO timeout used for IO operations (in milliseconds) set to 3000 (3 seconds).
static const OM_uint32 TKEY_EXCHANGE_FLAGS
The default TKEY exchange flags.
virtual ~TKeyExchange()
Virtual destructor, does nothing.
boost::shared_ptr< DnsServer > DnsServerPtr
A pointer to a DNS server.
boost::shared_ptr< TKeyExchange > TKeyExchangePtr
boost::shared_ptr< GssTsigKey > GssTsigKeyPtr
Type of pointer to a GSS-TSIG key.
Defines the logger used by the top-level component of kea-lfc.