Parolin 0.7.9 6796
Console (soon DLLs) to do a tar like job
Loading...
Searching...
No Matches
fuzz_data_producer.h
Go to the documentation of this file.
1/*
2 * Copyright (c) Facebook, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under both the BSD-style license (found in the
6 * LICENSE file in the root directory of this source tree) and the GPLv2 (found
7 * in the COPYING file in the root directory of this source tree).
8 * You may select, at your option, one of the above-listed licenses.
9 */
10
19#ifndef FUZZ_DATA_PRODUCER_H
20#define FUZZ_DATA_PRODUCER_H
21
22#include <stddef.h>
23#include <stdint.h>
24#include <stdio.h>
25#include <stdlib.h>
26
27#include "fuzz_helpers.h"
28
29/* Struct used for maintaining the state of the data */
31
32/* Returns a data producer state struct. Use for producer initialization. */
34
35/* Frees the data producer */
37
38/* Returns value between [min, max] */
39uint32_t FUZZ_dataProducer_uint32Range(FUZZ_dataProducer_t *producer, uint32_t min,
40 uint32_t max);
41
42/* Returns a uint32 value */
44
45/* Returns a signed value between [min, max] */
47 int32_t min, int32_t max);
48
49/* Returns the size of the remaining bytes of data in the producer */
51
52/* Rolls back the data producer state to have remainingBytes remaining */
53void FUZZ_dataProducer_rollBack(FUZZ_dataProducer_t *producer, size_t remainingBytes);
54
55/* Returns true if the data producer is out of bytes */
57
58/* Restricts the producer to only the last newSize bytes of data.
59If newSize > current data size, nothing happens. Returns the number of bytes
60the producer won't use anymore, after contracting. */
61size_t FUZZ_dataProducer_contract(FUZZ_dataProducer_t *producer, size_t newSize);
62
63/* Restricts the producer to use only the last X bytes of data, where X is
64 a random number in the interval [0, data_size]. Returns the size of the
65 remaining data the producer won't use anymore (the prefix). */
67#endif // FUZZ_DATA_PRODUCER_H
#define min(a, b)
Definition compress42.c:304
Definition fuzz_data_producer.c:3
Definition poolTests.c:28
uint32_t FUZZ_dataProducer_uint32Range(FUZZ_dataProducer_t *producer, uint32_t min, uint32_t max)
Definition fuzz_data_producer.c:28
void FUZZ_dataProducer_rollBack(FUZZ_dataProducer_t *producer, size_t remainingBytes)
Definition fuzz_data_producer.c:69
uint32_t FUZZ_dataProducer_uint32(FUZZ_dataProducer_t *producer)
Definition fuzz_data_producer.c:50
size_t FUZZ_dataProducer_contract(FUZZ_dataProducer_t *producer, size_t newSize)
Definition fuzz_data_producer.c:79
size_t FUZZ_dataProducer_reserveDataPrefix(FUZZ_dataProducer_t *producer)
Definition fuzz_data_producer.c:89
int32_t FUZZ_dataProducer_int32Range(FUZZ_dataProducer_t *producer, int32_t min, int32_t max)
Definition fuzz_data_producer.c:54
int FUZZ_dataProducer_empty(FUZZ_dataProducer_t *producer)
Definition fuzz_data_producer.c:75
size_t size
Definition platform.h:559
void FUZZ_dataProducer_free(FUZZ_dataProducer_t *producer)
Definition fuzz_data_producer.c:18
FUZZ_dataProducer_t * FUZZ_dataProducer_create(const uint8_t *data, size_t size)
Definition fuzz_data_producer.c:8
size_t FUZZ_dataProducer_remainingBytes(FUZZ_dataProducer_t *producer)
Definition fuzz_data_producer.c:75