A BerStream represents a BER-encoded stream of data.
More...
#include <berstream.hpp>
|
| BerStream (ByteStream *byteStream) |
| TODO.
|
|
bool | copyTo (std::vector< char > &buffer) |
| TODO.
|
|
unsigned int | remainingReadLength () const |
| This returns the number of bytes remaining in the stream. More...
|
|
unsigned int | remainingWriteLength () const |
| This returns the number of bytes remaining in the stream. More...
|
|
bool | peekType (uint8_t &type) |
| This reads an ASN.1 type from the BerStream. More...
|
|
bool | readType (uint8_t &type) |
| This reads an ASN.1 type from the BerStream. More...
|
|
bool | readLength (unsigned int &length) |
| This reads an ASN.1 length from the BerStream. More...
|
|
template<typename EncodingClass > |
bool | read (typename EncodingClass::value_type &value) |
| This performs a full, logical read of a kind of encoded data. More...
|
|
bool | readBytes (char *buffer, unsigned int bufferSize, unsigned int &bytesRead) |
| This reads an arbitrary amount of bytes into the specified character buffer. More...
|
|
bool | readFullTlv (std::vector< char > &buffer) |
| This reads a full TLV set of data and fills out the whole thing (including the type, the length, and the value) exactly as read. More...
|
|
bool | writeType (uint8_t type) |
| This writes the given ASN.1 type to the buffer in BER. More...
|
|
bool | writeLength (unsigned int encodedLength) |
| This writes the length to the buffer in BER. More...
|
|
template<typename EncodingClass > |
bool | write (const typename EncodingClass::value_type &value) |
| This performs a full, logical write of a kind of encoded data. More...
|
|
bool | writeBytes (const char *buffer, unsigned int bufferSize, unsigned int &bytesWritten) |
| This writes the bytes given to the BerStream. More...
|
|
A BerStream represents a BER-encoded stream of data.
It is a wrapper around a ByteStream instance, allowing only BER encoding and decoding operations.
bool peekType |
( |
uint8_t & |
type | ) |
|
This reads an ASN.1 type from the BerStream.
However, this does not advance the read head of the BerStream.
- Parameters
-
type | A reference to the integer to store the type. |
- Returns
- true on success, false on failure.
bool read |
( |
typename EncodingClass::value_type & |
value | ) |
|
This performs a full, logical read of a kind of encoded data.
EncodingClass The encoding class to use.
- Parameters
-
value | A reference to the value in which to store the data. |
- Returns
- true on success, false on failure.
bool readBytes |
( |
char * |
buffer, |
|
|
unsigned int |
bufferSize, |
|
|
unsigned int & |
bytesRead |
|
) |
| |
This reads an arbitrary amount of bytes into the specified character buffer.
- Parameters
-
buffer | The character buffer in which to store the read bytes. |
bufferSize | The number of bytes to read. "buffer" must be at least this size. |
bytesRead | A reference to an integer to hold the number of bytes that were actually read. |
bool readFullTlv |
( |
std::vector< char > & |
buffer | ) |
|
This reads a full TLV set of data and fills out the whole thing (including the type, the length, and the value) exactly as read.
- Parameters
-
buffer | The vector in which to store the data. |
- Returns
- true on success, false on failure.
bool readLength |
( |
unsigned int & |
length | ) |
|
This reads an ASN.1 length from the BerStream.
- Parameters
-
length | A reference to the integer to store the length. |
- Returns
- true on success, false on failure.
bool readType |
( |
uint8_t & |
type | ) |
|
This reads an ASN.1 type from the BerStream.
- Parameters
-
type | A reference to the integer to store the type. |
- Returns
- true on success, false on failure.
unsigned int remainingReadLength |
( |
| ) |
const |
|
inline |
This returns the number of bytes remaining in the stream.
- Returns
- The number of bytes remaining.
unsigned int remainingWriteLength |
( |
| ) |
const |
|
inline |
This returns the number of bytes remaining in the stream.
- Returns
- The number of bytes remaining.
bool write |
( |
const typename EncodingClass::value_type & |
value | ) |
|
This performs a full, logical write of a kind of encoded data.
EncodingClass The encoding class to use.
- Parameters
-
value | A reference to the value in to write. |
- Returns
- true on success, false on failure.
bool writeBytes |
( |
const char * |
buffer, |
|
|
unsigned int |
bufferSize, |
|
|
unsigned int & |
bytesWritten |
|
) |
| |
This writes the bytes given to the BerStream.
- Parameters
-
buffer | The bytes to write. |
bufferSize | The number of bytes to write. "buffer" must be at least this size. |
bytesWritten | A reference to an integer to store the number of bytes actually written. |
- Returns
- true on success, false on failure.
bool writeLength |
( |
unsigned int |
encodedLength | ) |
|
This writes the length to the buffer in BER.
- Parameters
-
encodedLength | The length to write. |
- Returns
- true on success, false on failure.
bool writeType |
( |
uint8_t |
type | ) |
|
This writes the given ASN.1 type to the buffer in BER.
- Parameters
-
- Returns
- true on success, false on failure.
The documentation for this class was generated from the following file: