Kea 2.7.6
option6_auth.h
Go to the documentation of this file.
1// Copyright (C) 2018-2022 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 OPTION6_AUTH_H
8#define OPTION6_AUTH_H
9#endif
10
11#include <dhcp/option.h>
12#include <boost/shared_ptr.hpp>
13
14#include <vector>
15
16namespace isc {
17namespace dhcp {
18
19class Option6Auth;
20
22typedef boost::shared_ptr<Option6Auth> Option6AuthPtr;
23
27class Option6Auth: public Option {
28
29public:
30 static const uint8_t OPTION6_AUTH_MIN_LEN = 11;
31 static const uint8_t OPTION6_HASH_MSG_LEN = 16;
32 static const uint8_t OPTION6_HDR = 4;
40 Option6Auth(const uint8_t proto, const uint8_t algo, const uint8_t method,
41 const uint64_t rdm, const std::vector<uint8_t>& info);
42
44 virtual OptionPtr clone() const;
45
51 void pack(isc::util::OutputBuffer& buf, bool check = true) const;
52
60
68 virtual void unpack(OptionBufferConstIter begin, OptionBufferConstIter end);
69
75 virtual std::string toText(int indent = 0) const;
76
80 void setProtocol(uint8_t proto) { protocol_ = proto; }
81
85 void setHashAlgo(uint8_t algo) { algorithm_ = algo; }
86
90 void setReplyDetectionMethod(uint8_t method) { rdm_method_ = method; }
91
95 void setReplyDetectionValue(uint64_t value) { rdm_value_ = value; }
96
100 void setAuthInfo(const std::vector<uint8_t>& auth_info) { auth_info_ = auth_info; }
101
105 uint8_t getProtocol() const { return protocol_; }
106
110 uint8_t getHashAlgo() const { return algorithm_; }
111
115 uint8_t getReplyDetectionMethod() const { return rdm_method_; }
116
120 uint64_t getReplyDetectionValue() const { return rdm_value_; }
121
125 std::vector<uint8_t> getAuthInfo() const { return auth_info_; }
126
127protected:
129 uint8_t protocol_;
130
132 uint8_t algorithm_;
133
135 uint8_t rdm_method_;
136
138 uint64_t rdm_value_;
139
141 std::vector<uint8_t> auth_info_;
142};
143
144} // isc::dhcp namespace
145} // isc namespace
This class represents Authentication (11) DHCPv6 option.
uint8_t getHashAlgo() const
Returns hash algorithm type.
void setHashAlgo(uint8_t algo)
Set hash algorithm type.
static const uint8_t OPTION6_HASH_MSG_LEN
std::vector< uint8_t > getAuthInfo() const
Return authentication information.
void setAuthInfo(const std::vector< uint8_t > &auth_info)
Set authentication information.
uint8_t protocol_
keeps protocol type
static const uint8_t OPTION6_AUTH_MIN_LEN
static const uint8_t OPTION6_HDR
uint8_t getReplyDetectionMethod() const
Returns replay detection method type.
uint64_t rdm_value_
keeps replay detection method value
uint8_t rdm_method_
keeps replay detection method type
virtual std::string toText(int indent=0) const
Provides human readable text representation.
void setReplyDetectionValue(uint64_t value)
Set replay detection method value.
uint8_t algorithm_
keeps hash algorithm value
void setReplyDetectionMethod(uint8_t method)
Set replay detection method type.
virtual OptionPtr clone() const
Copies this option and returns a pointer to the copy.
std::vector< uint8_t > auth_info_
keeps authentication information
void packHashInput(isc::util::OutputBuffer &buf) const
Writes option in wire-format to buf, for computing hash auth info filled with 0 for a length of 128 b...
uint64_t getReplyDetectionValue() const
Return replay detection mechanism.
void pack(isc::util::OutputBuffer &buf, bool check=true) const
Writes option in wire-format to buf, returns pointer to first unused byte after stored option.
void setProtocol(uint8_t proto)
Set protocol type.
uint8_t getProtocol() const
Returns protocol type.
Option6Auth(const uint8_t proto, const uint8_t algo, const uint8_t method, const uint64_t rdm, const std::vector< uint8_t > &info)
Constructor, used for auth options while transmitting.
virtual void unpack(OptionBufferConstIter begin, OptionBufferConstIter end)
Parses received buffer.
void check() const
A protected method used for option correctness.
Definition option.cc:90
The OutputBuffer class is a buffer abstraction for manipulating mutable data.
Definition buffer.h:343
@ info
Definition db_log.h:120
OptionBuffer::const_iterator OptionBufferConstIter
const_iterator for walking over OptionBuffer
Definition option.h:30
boost::shared_ptr< Option6Auth > Option6AuthPtr
A pointer to the isc::dhcp::Option6Auth object.
boost::shared_ptr< Option > OptionPtr
Definition option.h:37
Defines the logger used by the top-level component of kea-lfc.