3 #include "berstream.hpp"
8 namespace dangerous {
namespace snmp {
namespace encoding {
34 static constexpr
const char* NAME =
"Message";
35 static const int TYPE = asn1::helper::SEQUENCE::TYPE;
38 static unsigned int length(
const value_type& message ) {
39 unsigned int size = 0;
41 size += asn1::encodedSize<encoding::INTEGER>( message.
version );
43 size += asn1::encodedSize<encoding::OCTET_STRING>( message.
communityString );
50 static bool write(
const value_type& message,
char* buffer,
unsigned int bufferSize ) {
66 unsigned int bytesWritten = 0;
75 static bool read(
value_type& message,
char* buffer,
unsigned int bufferSize ) {
int version
This is the version number.
Definition: message.hpp:20
bool write(const typename EncodingClass::value_type &value)
This performs a full, logical write of a kind of encoded data.
Definition: berstream.hpp:207
std::string communityString
This is the "community string" for the message.
Definition: message.hpp:23
A ByteStream is an object that is basically a big wrapper around a character buffer.
Definition: bytestream.hpp:30
Definition: encoding.hpp:20
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 "Message" class.
Definition: message.hpp:32
std::vector< char > pduBytes
This is the actual payload of the message.
Definition: message.hpp:26
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.
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
This class is the version-1 and version-2c encapsulation for a message.
Definition: message.hpp:15