CRCChecker.hpp 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. // ======================================================================
  2. // \title CRCChecker.hpp
  3. // \author ortega
  4. // \brief hpp file for a crc32 checker
  5. //
  6. // \copyright
  7. // Copyright 2009-2020, by the California Institute of Technology.
  8. // ALL RIGHTS RESERVED. United States Government Sponsorship
  9. // acknowledged.
  10. // ======================================================================
  11. #ifndef CRC_CHECKER_HPP
  12. #define CRC_CHECKER_HPP
  13. #include <FpConfig.hpp>
  14. namespace Utils {
  15. static const NATIVE_INT_TYPE CRC_FILE_READ_BLOCK = 2048;
  16. static const U32 CRC_MAX_FILENAME_SIZE = 128; // TODO use a config variable
  17. typedef enum
  18. {
  19. PASSED_FILE_CRC_CHECK = 0,
  20. PASSED_FILE_CRC_WRITE,
  21. FAILED_FILE_SIZE,
  22. FAILED_FILE_SIZE_CAST,
  23. FAILED_FILE_OPEN,
  24. FAILED_FILE_READ,
  25. FAILED_FILE_CRC_OPEN,
  26. FAILED_FILE_CRC_READ,
  27. FAILED_FILE_CRC_WRITE,
  28. FAILED_FILE_CRC_CHECK
  29. } crc_stat_t;
  30. crc_stat_t create_checksum_file(const char* const filename);
  31. crc_stat_t read_crc32_from_file(const char* const fname, U32 &checksum_from_file);
  32. crc_stat_t verify_checksum(const char* const filename, U32 &expected, U32 &actual);
  33. }
  34. #endif