6 namespace dangerous {
namespace snmp {
namespace encoding {
10 std::string contextEngineID;
11 std::string contextName;
12 std::vector<char> pduBytes;
17 static constexpr
const char* NAME =
"ScopedPDU";
18 static const int TYPE = asn1::helper::SEQUENCE::TYPE;
21 static unsigned int length(
const value_type& value ) {
22 unsigned int size = 0;
24 size += asn1::encodedSize<encoding::OCTET_STRING>( value.contextEngineID );
25 size += asn1::encodedSize<encoding::OCTET_STRING>( value.contextName );
27 size += value.pduBytes.size();
32 static bool write(
const value_type& value,
char* buffer,
unsigned int bufferSize ) {
50 unsigned int bytesWritten = 0;
51 success = berStream.
writeBytes( value.pduBytes.data(), value.pduBytes.size(), bytesWritten );
59 static bool read(
value_type& value,
char* buffer,
unsigned int bufferSize ) {
77 berStream.
copyTo( value.pduBytes );
bool write(const typename EncodingClass::value_type &value)
This performs a full, logical write of a kind of encoded data.
Definition: berstream.hpp:207
A ByteStream is an object that is basically a big wrapper around a character buffer.
Definition: bytestream.hpp:30
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
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.
Definition: scopedpdu.hpp:15
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
Definition: scopedpdu.hpp:8