ETISS 0.8.0
Extendable Translating Instruction Set Simulator (version 0.8.0)
Public Member Functions | Private Member Functions | Private Attributes | List of all members
FuzzedDataProvider Class Reference

#include <FuzzedDataProvider.h>

Collaboration diagram for FuzzedDataProvider:
Collaboration graph
[legend]

Public Member Functions

 FuzzedDataProvider (const uint8_t *data, size_t size)
 
 ~FuzzedDataProvider ()=default
 
template<typename T >
std::vector< T > ConsumeBytes (size_t num_bytes)
 
template<typename T >
std::vector< T > ConsumeBytesWithTerminator (size_t num_bytes, T terminator=0)
 
template<typename T >
std::vector< T > ConsumeRemainingBytes ()
 
std::string ConsumeBytesAsString (size_t num_bytes)
 
std::string ConsumeRandomLengthString (size_t max_length)
 
std::string ConsumeRandomLengthString ()
 
std::string ConsumeRemainingBytesAsString ()
 
template<typename T >
ConsumeIntegral ()
 
template<typename T >
ConsumeIntegralInRange (T min, T max)
 
template<typename T >
ConsumeFloatingPoint ()
 
template<typename T >
ConsumeFloatingPointInRange (T min, T max)
 
template<typename T >
ConsumeProbability ()
 
bool ConsumeBool ()
 
template<typename T >
ConsumeEnum ()
 
template<typename T , size_t size>
PickValueInArray (const T(&array)[size])
 
template<typename T >
PickValueInArray (std::initializer_list< const T > list)
 
size_t ConsumeData (void *destination, size_t num_bytes)
 
size_t remaining_bytes ()
 

Private Member Functions

 FuzzedDataProvider (const FuzzedDataProvider &)=delete
 
FuzzedDataProvideroperator= (const FuzzedDataProvider &)=delete
 
void CopyAndAdvance (void *destination, size_t num_bytes)
 
void Advance (size_t num_bytes)
 
template<typename T >
std::vector< T > ConsumeBytes (size_t size, size_t num_bytes)
 
template<typename TS , typename TU >
TS ConvertUnsignedToSigned (TU value)
 

Private Attributes

const uint8_tdata_ptr_
 
size_t remaining_bytes_
 

Detailed Description

Definition at line 29 of file FuzzedDataProvider.h.

Constructor & Destructor Documentation

◆ FuzzedDataProvider() [1/2]

FuzzedDataProvider::FuzzedDataProvider ( const uint8_t data,
size_t  size 
)
inline

Definition at line 33 of file FuzzedDataProvider.h.

◆ ~FuzzedDataProvider()

FuzzedDataProvider::~FuzzedDataProvider ( )
default

◆ FuzzedDataProvider() [2/2]

FuzzedDataProvider::FuzzedDataProvider ( const FuzzedDataProvider )
privatedelete

Member Function Documentation

◆ Advance()

void FuzzedDataProvider::Advance ( size_t  num_bytes)
inlineprivate

Definition at line 333 of file FuzzedDataProvider.h.

References data_ptr_, and remaining_bytes_.

Referenced by ConsumeBytesAsString(), ConsumeRandomLengthString(), and CopyAndAdvance().

Here is the caller graph for this function:

◆ ConsumeBool()

bool FuzzedDataProvider::ConsumeBool ( )
inline

Definition at line 284 of file FuzzedDataProvider.h.

Referenced by ConsumeFloatingPointInRange().

Here is the caller graph for this function:

◆ ConsumeBytes() [1/2]

template<typename T >
std::vector< T > FuzzedDataProvider::ConsumeBytes ( size_t  num_bytes)

Definition at line 104 of file FuzzedDataProvider.h.

References min(), and remaining_bytes_.

Here is the call graph for this function:

◆ ConsumeBytes() [2/2]

template<typename T >
std::vector< T > FuzzedDataProvider::ConsumeBytes ( size_t  size,
size_t  num_bytes 
)
private

Definition at line 342 of file FuzzedDataProvider.h.

References CopyAndAdvance(), static_assert, and uint8_t.

Here is the call graph for this function:

◆ ConsumeBytesAsString()

std::string FuzzedDataProvider::ConsumeBytesAsString ( size_t  num_bytes)
inline

Definition at line 132 of file FuzzedDataProvider.h.

References Advance(), data_ptr_, min(), remaining_bytes_, static_assert, and uint8_t.

Referenced by ConsumeRemainingBytesAsString().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ConsumeBytesWithTerminator()

template<typename T >
std::vector< T > FuzzedDataProvider::ConsumeBytesWithTerminator ( size_t  num_bytes,
terminator = 0 
)

Definition at line 114 of file FuzzedDataProvider.h.

References min(), and remaining_bytes_.

Here is the call graph for this function:

◆ ConsumeData()

size_t FuzzedDataProvider::ConsumeData ( void *  destination,
size_t  num_bytes 
)
inline

Definition at line 319 of file FuzzedDataProvider.h.

References CopyAndAdvance(), min(), and remaining_bytes_.

Here is the call graph for this function:

◆ ConsumeEnum()

template<typename T >
T FuzzedDataProvider::ConsumeEnum

Definition at line 291 of file FuzzedDataProvider.h.

References static_assert, and uint32_t.

◆ ConsumeFloatingPoint()

template<typename T >
T FuzzedDataProvider::ConsumeFloatingPoint

Definition at line 235 of file FuzzedDataProvider.h.

References max().

Here is the call graph for this function:

◆ ConsumeFloatingPointInRange()

template<typename T >
T FuzzedDataProvider::ConsumeFloatingPointInRange ( min,
max 
)

Definition at line 244 of file FuzzedDataProvider.h.

References ConsumeBool(), max(), and min().

Here is the call graph for this function:

◆ ConsumeIntegral()

template<typename T >
T FuzzedDataProvider::ConsumeIntegral

Definition at line 190 of file FuzzedDataProvider.h.

References ConsumeIntegralInRange(), max(), and min().

Here is the call graph for this function:

◆ ConsumeIntegralInRange()

template<typename T >
T FuzzedDataProvider::ConsumeIntegralInRange ( min,
max 
)

Definition at line 200 of file FuzzedDataProvider.h.

References CHAR_BIT, data_ptr_, max(), min(), remaining_bytes_, static_assert, and uint64_t.

Referenced by ConsumeIntegral().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ConsumeProbability()

template<typename T >
T FuzzedDataProvider::ConsumeProbability

Definition at line 268 of file FuzzedDataProvider.h.

References max(), static_assert, get_metrics::type, uint32_t, and uint64_t.

Here is the call graph for this function:

◆ ConsumeRandomLengthString() [1/2]

std::string FuzzedDataProvider::ConsumeRandomLengthString ( )
inline

Definition at line 176 of file FuzzedDataProvider.h.

References remaining_bytes_.

◆ ConsumeRandomLengthString() [2/2]

std::string FuzzedDataProvider::ConsumeRandomLengthString ( size_t  max_length)
inline

Definition at line 148 of file FuzzedDataProvider.h.

References Advance(), data_ptr_, min(), and remaining_bytes_.

Here is the call graph for this function:

◆ ConsumeRemainingBytes()

template<typename T >
std::vector< T > FuzzedDataProvider::ConsumeRemainingBytes

Definition at line 124 of file FuzzedDataProvider.h.

References remaining_bytes_.

◆ ConsumeRemainingBytesAsString()

std::string FuzzedDataProvider::ConsumeRemainingBytesAsString ( )
inline

Definition at line 183 of file FuzzedDataProvider.h.

References ConsumeBytesAsString(), and remaining_bytes_.

Here is the call graph for this function:

◆ ConvertUnsignedToSigned()

template<typename TS , typename TU >
TS FuzzedDataProvider::ConvertUnsignedToSigned ( TU  value)
private

Definition at line 368 of file FuzzedDataProvider.h.

References max(), min(), static_assert, and TS.

Here is the call graph for this function:

◆ CopyAndAdvance()

void FuzzedDataProvider::CopyAndAdvance ( void *  destination,
size_t  num_bytes 
)
inlineprivate

Definition at line 327 of file FuzzedDataProvider.h.

References Advance(), data_ptr_, and memcpy().

Referenced by ConsumeBytes(), and ConsumeData().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator=()

FuzzedDataProvider& FuzzedDataProvider::operator= ( const FuzzedDataProvider )
privatedelete

◆ PickValueInArray() [1/2]

template<typename T , size_t size>
T FuzzedDataProvider::PickValueInArray ( const T(&)  array[size])

Definition at line 299 of file FuzzedDataProvider.h.

References static_assert.

◆ PickValueInArray() [2/2]

template<typename T >
T FuzzedDataProvider::PickValueInArray ( std::initializer_list< const T >  list)

Definition at line 305 of file FuzzedDataProvider.h.

◆ remaining_bytes()

size_t FuzzedDataProvider::remaining_bytes ( )
inline

Definition at line 80 of file FuzzedDataProvider.h.

References remaining_bytes_.

Member Data Documentation

◆ data_ptr_

const uint8_t* FuzzedDataProvider::data_ptr_
private

◆ remaining_bytes_

size_t FuzzedDataProvider::remaining_bytes_
private

The documentation for this class was generated from the following file: