Kea: option6_auth.h Source File

| Kea 3.0.2-git

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
22 typedef boost::shared_ptr<Option6Auth> Option6AuthPtr;
23
27 class 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
59 void packHashInput(isc::util::OutputBuffer& buf) const;
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
isc::dhcp::Option6Auth
This class represents Authentication (11) DHCPv6 option.
Definition option6_auth.h:27
isc::dhcp::Option6Auth::getHashAlgo
uint8_t getHashAlgo() const
Returns hash algorithm type.
Definition option6_auth.h:110
isc::dhcp::Option6Auth::setHashAlgo
void setHashAlgo(uint8_t algo)
Set hash algorithm type.
Definition option6_auth.h:85
isc::dhcp::Option6Auth::OPTION6_HASH_MSG_LEN
static const uint8_t OPTION6_HASH_MSG_LEN
Definition option6_auth.h:31
isc::dhcp::Option6Auth::getAuthInfo
std::vector< uint8_t > getAuthInfo() const
Return authentication information.
Definition option6_auth.h:125
isc::dhcp::Option6Auth::setAuthInfo
void setAuthInfo(const std::vector< uint8_t > &auth_info)
Set authentication information.
Definition option6_auth.h:100
isc::dhcp::Option6Auth::protocol_
uint8_t protocol_
keeps protocol type
Definition option6_auth.h:129
isc::dhcp::Option6Auth::OPTION6_AUTH_MIN_LEN
static const uint8_t OPTION6_AUTH_MIN_LEN
Definition option6_auth.h:30
isc::dhcp::Option6Auth::OPTION6_HDR
static const uint8_t OPTION6_HDR
Definition option6_auth.h:32
isc::dhcp::Option6Auth::getReplyDetectionMethod
uint8_t getReplyDetectionMethod() const
Returns replay detection method type.
Definition option6_auth.h:115
isc::dhcp::Option6Auth::rdm_value_
uint64_t rdm_value_
keeps replay detection method value
Definition option6_auth.h:138
isc::dhcp::Option6Auth::rdm_method_
uint8_t rdm_method_
keeps replay detection method type
Definition option6_auth.h:135
isc::dhcp::Option6Auth::toText
virtual std::string toText(int indent=0) const
Provides human readable text representation.
Definition option6_auth.cc:118
isc::dhcp::Option6Auth::setReplyDetectionValue
void setReplyDetectionValue(uint64_t value)
Set replay detection method value.
Definition option6_auth.h:95
isc::dhcp::Option6Auth::algorithm_
uint8_t algorithm_
keeps hash algorithm value
Definition option6_auth.h:132
isc::dhcp::Option6Auth::setReplyDetectionMethod
void setReplyDetectionMethod(uint8_t method)
Set replay detection method type.
Definition option6_auth.h:90
isc::dhcp::Option6Auth::clone
virtual OptionPtr clone() const
Copies this option and returns a pointer to the copy.
Definition option6_auth.cc:35
isc::dhcp::Option6Auth::auth_info_
std::vector< uint8_t > auth_info_
keeps authentication information
Definition option6_auth.h:141
isc::dhcp::Option6Auth::packHashInput
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...
Definition option6_auth.cc:67
isc::dhcp::Option6Auth::getReplyDetectionValue
uint64_t getReplyDetectionValue() const
Return replay detection mechanism.
Definition option6_auth.h:120
isc::dhcp::Option6Auth::pack
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.
Definition option6_auth.cc:40
isc::dhcp::Option6Auth::setProtocol
void setProtocol(uint8_t proto)
Set protocol type.
Definition option6_auth.h:80
isc::dhcp::Option6Auth::getProtocol
uint8_t getProtocol() const
Returns protocol type.
Definition option6_auth.h:105
isc::dhcp::Option6Auth::Option6Auth
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.
Definition option6_auth.cc:25
isc::dhcp::Option6Auth::unpack
virtual void unpack(OptionBufferConstIter begin, OptionBufferConstIter end)
Parses received buffer.
Definition option6_auth.cc:93
isc::dhcp::Option::Option
Option(Universe u, uint16_t type)
ctor, used for options constructed, usually during transmission
Definition option.cc:39
isc::dhcp::Option::check
void check() const
A protected method used for option correctness.
Definition option.cc:90
isc::util::OutputBuffer
The OutputBuffer class is a buffer abstraction for manipulating mutable data.
Definition buffer.h:346
isc::db::info
@ info
Definition db_log.h:120
isc::dhcp
Definition dhcp4/client_handler.cc:20
isc::dhcp::OptionBufferConstIter
OptionBuffer::const_iterator OptionBufferConstIter
const_iterator for walking over OptionBuffer
Definition option.h:30
isc::dhcp::Option6AuthPtr
boost::shared_ptr< Option6Auth > Option6AuthPtr
A pointer to the isc::dhcp::Option6Auth object.
Definition option6_auth.h:22
isc::dhcp::OptionPtr
boost::shared_ptr< Option > OptionPtr
Definition option.h:37
isc
Defines the logger used by the top-level component of kea-lfc.
Definition agent_parser.cc:148
option.h