2019-08-16 17:50:46 +00:00
|
|
|
#include <stddef.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
2019-08-16 23:43:28 +00:00
|
|
|
#include "fuzz_helpers.h"
|
2019-08-30 17:27:42 +00:00
|
|
|
#include "lz4frame.h"
|
|
|
|
#include "lz4hc.h"
|
2019-08-16 23:43:28 +00:00
|
|
|
|
2019-08-17 00:14:47 +00:00
|
|
|
/* Struct used for maintaining the state of the data */
|
|
|
|
typedef struct FUZZ_dataProducer_s FUZZ_dataProducer_t;
|
2019-08-16 21:19:06 +00:00
|
|
|
|
2019-08-17 00:14:47 +00:00
|
|
|
/* Returns a data producer state struct. Use for producer initialization. */
|
2019-08-16 23:43:28 +00:00
|
|
|
FUZZ_dataProducer_t *FUZZ_dataProducer_create(const uint8_t *data, size_t size);
|
2019-08-16 21:19:06 +00:00
|
|
|
|
2019-08-17 00:14:47 +00:00
|
|
|
/* Frees the data producer */
|
2019-08-16 23:43:28 +00:00
|
|
|
void FUZZ_dataProducer_free(FUZZ_dataProducer_t *producer);
|
2019-08-16 21:19:06 +00:00
|
|
|
|
2019-09-14 01:08:58 +00:00
|
|
|
/* Returns 32 bits from the end of data */
|
|
|
|
uint32_t FUZZ_dataProducer_retrieve32(FUZZ_dataProducer_t *producer);
|
2019-09-13 21:07:52 +00:00
|
|
|
|
2019-08-17 00:14:47 +00:00
|
|
|
/* Returns value between [min, max] */
|
2019-09-13 23:04:48 +00:00
|
|
|
uint32_t FUZZ_getRange_from_uint32(uint32_t seed, uint32_t min, uint32_t max);
|
2019-09-13 21:07:52 +00:00
|
|
|
|
|
|
|
/* Combination of above two functions for non adaptive use cases. ie where size is not involved */
|
2019-09-13 23:04:48 +00:00
|
|
|
uint32_t FUZZ_dataProducer_range32(FUZZ_dataProducer_t *producer, uint32_t min,
|
2019-08-16 23:43:28 +00:00
|
|
|
uint32_t max);
|
2019-08-17 00:14:47 +00:00
|
|
|
|
2019-08-30 17:27:42 +00:00
|
|
|
/* Returns lz4 preferences */
|
|
|
|
LZ4F_preferences_t FUZZ_dataProducer_preferences(FUZZ_dataProducer_t* producer);
|
|
|
|
|
|
|
|
/* Returns lz4 frame info */
|
|
|
|
LZ4F_frameInfo_t FUZZ_dataProducer_frameInfo(FUZZ_dataProducer_t* producer);
|
|
|
|
|
2019-08-17 00:14:47 +00:00
|
|
|
/* Returns the size of the remaining bytes of data in the producer */
|
|
|
|
size_t FUZZ_dataProducer_remainingBytes(FUZZ_dataProducer_t *producer);
|