7#ifndef RADIUS_CLIENT_MESSAGE_H
8#define RADIUS_CLIENT_MESSAGE_H
43static constexpr size_t AUTH_HDR_LEN = 20;
46static constexpr size_t PW_MAX_MSG_SIZE = 4095;
49static constexpr size_t AUTH_VECTOR_LEN = 16;
52static constexpr size_t AUTH_PASS_LEN = 128;
61 static std::vector<uint8_t> zero(AUTH_VECTOR_LEN, 0);
74 Message(
const uint8_t code, uint16_t length,
75 const std::vector<uint8_t>& auth,
76 const std::string& secret,
93 Message(
const std::vector<uint8_t>& buffer,
94 const std::vector<uint8_t>& auth,
95 const std::string& secret);
157 void setAuth(
const std::vector<uint8_t>& auth);
174 void setSecret(
const std::string& secret);
208 std::vector<uint8_t>
encode();
std::vector< uint8_t > auth_
Authenticator: header[4] (16 octets).
void setAuth(const std::vector< uint8_t > &auth)
Set authenticator.
std::vector< uint8_t > getAuth() const
Get authenticator.
void setLength(const uint16_t length)
Set length.
ConstAttributePtr encodeUserPassword(const ConstAttributePtr &attr)
Encode User-Password in an Access-Request.
void setIdentifier(const uint8_t identifier)
Set identifier.
static const std::vector< uint8_t > ZERO_AUTH()
Build a zero authenticator.
ConstAttributePtr decodeUserPassword(const ConstAttributePtr &attr)
Decode User-Password in an Access-Request.
uint16_t getLength() const
Get length.
void setCode(const uint8_t code)
Set code.
Message(const uint8_t code, uint16_t length, const std::vector< uint8_t > &auth, const std::string &secret, const AttributesPtr &attributes)
Constructor.
uint8_t identifier_
Identifier (random): header[1].
void randomAuth()
Randomize authenticator.
std::vector< uint8_t > encode()
Encode a message.
uint8_t getCode() const
Get code.
std::vector< uint8_t > buffer_
Buffer (message content).
std::vector< uint8_t > getBuffer() const
Get buffer.
uint8_t code_
Code (useful values in MsgCode): header[0].
uint8_t getIdentifier() const
Get identifier.
void setAttributes(const AttributesPtr &attributes)
Set attributes.
void decode()
Decode a message.
AttributesPtr getAttributes() const
Get attributes.
AttributesPtr attributes_
Attributes: header[20]...
uint16_t length_
Length: header[2] (16 bits, network order).
std::string secret_
Secret (not empty).
void zeroAuth()
Fill authenticator with 0.
std::string getSecret() const
Get secret.
virtual ~Message()
Destructor.
void setBuffer(const std::vector< uint8_t > &buffer)
Set buffer.
void setSecret(const std::string &secret)
Set secret.
void randomIdentifier()
Randomize identifier.
boost::shared_ptr< Attributes > AttributesPtr
Shared pointers to attribute collection.
boost::shared_ptr< const Attribute > ConstAttributePtr
string msgCodeToText(const uint8_t code)
MsgCode value -> name function.
boost::shared_ptr< Message > MessagePtr
Shared pointers to message.
MsgCode
Standard RADIUS message code.
Defines the logger used by the top-level component of kea-lfc.