fuzzing.h 945 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #ifndef FUZZING_H
  2. #define FUZZING_H
  3. #include <stdint.h>
  4. #include <stdlib.h>
  5. #include "defines.h"
  6. #include "tcpedit/tcpedit_types.h"
  7. enum {
  8. FUZZING_DROP_PACKET,
  9. FUZZING_REDUCE_SIZE,
  10. FUZZING_CHANGE_START_ZERO,
  11. FUZZING_CHANGE_START_RANDOM,
  12. FUZZING_CHANGE_START_FF,
  13. FUZZING_CHANGE_MID_ZERO,
  14. FUZZING_CHANGE_MID_RANDOM, /* the default case */
  15. FUZZING_CHANGE_MID_FF,
  16. FUZZING_CHANGE_END_ZERO,
  17. FUZZING_CHANGE_END_RANDOM,
  18. FUZZING_CHANGE_END_FF,
  19. FUZZING_TOTAL_ACTION_NUMBER /* always last */
  20. };
  21. /**
  22. * init fuzz seed and allocate buffer.
  23. */
  24. void
  25. fuzzing_init(uint32_t _fuzz_seed, uint32_t _fuzz_factor);
  26. /*
  27. * fuzz packet data.
  28. * only one out of 8 packets are fuzzed.
  29. * fuzzed packets get one random modification from the enum above.
  30. * Returns whether the packet has been modified (1, or 0)
  31. */
  32. int
  33. fuzzing(tcpedit_t *tcpedit, struct pcap_pkthdr *pkthdr, u_char **pktdata);
  34. #endif /* FUZZING_H */