6 namespace dangerous {
namespace snmp {
namespace encoding {
18 static constexpr
const char ENCRYPTION = (char)0b00000010;
21 static constexpr
const char REPORTABLE = (char)0b00000100;
58 static constexpr
const char* NAME =
"SNMPv3Message.HeaderData";
59 static const int TYPE = asn1::helper::SEQUENCE::TYPE;
62 static unsigned int length(
const value_type& headerData ) {
63 unsigned int size = 0;
65 size += asn1::encodedSize<encoding::INTEGER>( headerData.msgID );
67 size += asn1::encodedSize<encoding::INTEGER>( headerData.msgMaxSize );
69 size += asn1::encodedSize<encoding::OCTET_STRING>( headerData.msgFlags );
76 static bool write(
const value_type& headerData,
char* buffer,
unsigned int bufferSize ) {
107 static bool read(
value_type& headerData,
char* buffer,
unsigned int bufferSize ) {
144 static constexpr
const char* NAME =
"SNMPv3Message";
145 static const int TYPE = asn1::helper::SEQUENCE::TYPE;
148 static unsigned int length(
const value_type& message ) {
149 unsigned int size = 0;
151 size += asn1::encodedSize<encoding::INTEGER>( message.
msgVersion );
153 size += asn1::encodedSize<SNMPV3MESSAGE_HEADERDATA>( message.msgHeaderData );
164 static bool write(
const value_type& message,
char* buffer,
unsigned int bufferSize ) {
187 unsigned int bytesWritten = 0;
196 static bool read(
value_type& message,
char* buffer,
unsigned int bufferSize ) {
bool write(const typename EncodingClass::value_type &value)
This performs a full, logical write of a kind of encoded data.
Definition: berstream.hpp:207
static constexpr const char ENCRYPTION
This is set when encryption is enabled.
Definition: message-v3.hpp:18
This class is a container for the message flags.
Definition: message-v3.hpp:11
A ByteStream is an object that is basically a big wrapper around a character buffer.
Definition: bytestream.hpp:30
int msgVersion
This is the version number.
Definition: message-v3.hpp:32
Definition: encoding.hpp:20
static constexpr const char AUTHENTICATION
This is set when authentication is enabled.
Definition: message-v3.hpp:14
Only read operations may be performed.
Definition: bytestream.hpp:38
A BerStream represents a BER-encoded stream of data.
Definition: berstream.hpp:16
Both read and write operations may be performed.
Definition: bytestream.hpp:40
This is the encoder/decoder for the "SNMPv3Message" class.
Definition: message-v3.hpp:142
static constexpr const char REPORTABLE
This is set when a response is requested.
Definition: message-v3.hpp:21
bool copyTo(std::vector< char > &buffer)
TODO.
bool writeBytes(const char *buffer, unsigned int bufferSize, unsigned int &bytesWritten)
This writes the bytes given to the BerStream.
std::vector< char > pduBytes
This is the actual payload of the message.
Definition: message-v3.hpp:50
This class is the version-3 encapsulation for a message.
Definition: message-v3.hpp:28
void linkFrom(char *bytes, unsigned int bytesSize, Access access)
This links the bytes given to the ByteStream's character buffer.
Definition: encoding.hpp:25
bool read(typename EncodingClass::value_type &value)
This performs a full, logical read of a kind of encoded data.
Definition: berstream.hpp:145
std::string msgSecurityParameters
This is the BER-encoded security information.
Definition: message-v3.hpp:47