LIEF: Library to Instrument Executable Formats Version 0.16.0
|
Class that is used to a read stream of data from different sources. More...
#include <BinaryStream.hpp>
Public Types | |
enum class | STREAM_TYPE { UNKNOWN = 0 , VECTOR , MEMORY , SPAN , FILE , ELF_DATA_HANDLER } |
Public Member Functions | |
BinaryStream (STREAM_TYPE type) | |
virtual | ~BinaryStream ()=default |
virtual uint64_t | size () const =0 |
STREAM_TYPE | type () const |
result< uint64_t > | read_uleb128 () const |
result< uint64_t > | read_sleb128 () const |
result< int64_t > | read_dwarf_encoded (uint8_t encoding) const |
result< std::string > | read_string (size_t maxsize=~static_cast< size_t >(0)) const |
result< std::string > | peek_string (size_t maxsize=~static_cast< size_t >(0)) const |
result< std::string > | peek_string_at (size_t offset, size_t maxsize=~static_cast< size_t >(0)) const |
result< std::u16string > | read_u16string () const |
result< std::u16string > | peek_u16string () const |
result< std::string > | read_mutf8 (size_t maxsize=~static_cast< size_t >(0)) const |
result< std::u16string > | read_u16string (size_t length) const |
result< std::u16string > | peek_u16string (size_t length) const |
result< std::u16string > | peek_u16string_at (size_t offset, size_t length) const |
virtual ok_error_t | peek_data (std::vector< uint8_t > &container, uint64_t offset, uint64_t size, uint64_t virtual_address=0) |
virtual ok_error_t | read_data (std::vector< uint8_t > &container, uint64_t size) |
template<class T > | |
ok_error_t | read_objects (std::vector< T > &container, uint64_t count) |
template<class T > | |
ok_error_t | peek_objects (std::vector< T > &container, uint64_t count) |
template<class T > | |
ok_error_t | peek_objects_at (uint64_t offset, std::vector< T > &container, uint64_t count) |
void | setpos (size_t pos) const |
void | increment_pos (size_t value) const |
void | decrement_pos (size_t value) const |
size_t | pos () const |
operator bool () const | |
template<class T > | |
const T * | read_array (size_t size) const |
template<class T > | |
result< T > | peek () const |
template<class T > | |
result< T > | peek (size_t offset) const |
template<class T > | |
const T * | peek_array (size_t size) const |
template<class T > | |
const T * | peek_array (size_t offset, size_t size) const |
template<class T > | |
result< T > | read () const |
template<typename T > | |
bool | can_read () const |
template<typename T > | |
bool | can_read (size_t offset) const |
bool | can_read (int64_t offset, int64_t size) const |
size_t | align (size_t align_on) const |
void | set_endian_swap (bool swap) |
bool | should_swap () const |
virtual const uint8_t * | p () const |
virtual uint8_t * | start () |
virtual uint8_t * | p () |
virtual uint8_t * | end () |
virtual const uint8_t * | start () const |
virtual const uint8_t * | end () const |
Static Public Member Functions | |
template<class T > | |
static bool | is_all_zero (const T &buffer) |
Class that is used to a read stream of data from different sources.
|
strong |
|
inline |
|
virtualdefault |
size_t LIEF::BinaryStream::align | ( | size_t | align_on | ) | const |
bool LIEF::BinaryStream::can_read | ( | ) | const |
References size().
|
inline |
bool LIEF::BinaryStream::can_read | ( | size_t | offset | ) | const |
References size().
|
inline |
|
inlinevirtual |
Reimplemented in LIEF::MemoryStream, LIEF::SpanStream, and LIEF::VectorStream.
|
inlinevirtual |
Reimplemented in LIEF::MemoryStream, LIEF::SpanStream, and LIEF::VectorStream.
|
inline |
Referenced by read(), and read_array().
|
inlinestatic |
|
inline |
|
inlinevirtual |
Reimplemented in LIEF::MemoryStream, LIEF::SpanStream, and LIEF::VectorStream.
|
inlinevirtual |
Reimplemented in LIEF::MemoryStream, LIEF::SpanStream, and LIEF::VectorStream.
result< T > LIEF::BinaryStream::peek | ( | ) | const |
References make_error_code(), pos(), read_error, setpos(), and LIEF::swap_endian().
result< T > LIEF::BinaryStream::peek | ( | size_t | offset | ) | const |
const T * LIEF::BinaryStream::peek_array | ( | size_t | offset, |
size_t | size ) const |
References peek_array(), pos(), setpos(), and size().
const T * LIEF::BinaryStream::peek_array | ( | size_t | size | ) | const |
Referenced by peek_array(), and read_array().
|
inlinevirtual |
References make_error_code(), LIEF::ok(), and read_error.
|
inline |
|
inline |
References make_error_code(), LIEF::ok(), and read_error.
result< std::string > LIEF::BinaryStream::peek_string | ( | size_t | maxsize = ~static_cast< size_t >(0) | ) | const |
result< std::string > LIEF::BinaryStream::peek_string_at | ( | size_t | offset, |
size_t | maxsize = ~static_cast< size_t >(0) ) const |
result< std::u16string > LIEF::BinaryStream::peek_u16string | ( | ) | const |
result< std::u16string > LIEF::BinaryStream::peek_u16string | ( | size_t | length | ) | const |
result< std::u16string > LIEF::BinaryStream::peek_u16string_at | ( | size_t | offset, |
size_t | length ) const |
|
inline |
Referenced by peek(), peek(), peek_array(), and peek_array().
result< T > LIEF::BinaryStream::read | ( | ) | const |
References increment_pos(), and peek().
const T * LIEF::BinaryStream::read_array | ( | size_t | size | ) | const |
References increment_pos(), peek_array(), and size().
|
inlinevirtual |
References make_error_code(), LIEF::ok(), and read_error.
result< int64_t > LIEF::BinaryStream::read_dwarf_encoded | ( | uint8_t | encoding | ) | const |
result< std::string > LIEF::BinaryStream::read_mutf8 | ( | size_t | maxsize = ~static_cast< size_t >(0) | ) | const |
|
inline |
References make_error_code(), LIEF::ok(), and read_error.
result< uint64_t > LIEF::BinaryStream::read_sleb128 | ( | ) | const |
result< std::string > LIEF::BinaryStream::read_string | ( | size_t | maxsize = ~static_cast< size_t >(0) | ) | const |
result< std::u16string > LIEF::BinaryStream::read_u16string | ( | ) | const |
result< std::u16string > LIEF::BinaryStream::read_u16string | ( | size_t | length | ) | const |
result< uint64_t > LIEF::BinaryStream::read_uleb128 | ( | ) | const |
|
inline |
Referenced by LIEF::ToggleEndianness::ToggleEndianness(), and LIEF::ToggleEndianness::ToggleEndianness().
|
inline |
Referenced by peek(), peek(), peek_array(), and LIEF::ScopedStream::ScopedStream().
|
inline |
|
pure virtual |
Implemented in LIEF::FileStream, LIEF::MemoryStream, LIEF::SpanStream, and LIEF::VectorStream.
Referenced by can_read(), can_read(), peek_array(), peek_array(), and read_array().
|
inlinevirtual |
Reimplemented in LIEF::MemoryStream, LIEF::SpanStream, and LIEF::VectorStream.
|
inlinevirtual |
Reimplemented in LIEF::MemoryStream, LIEF::SpanStream, and LIEF::VectorStream.
|
inline |