F´ Flight Software - C/C++ Documentation  NASA-v1.5.0
A framework for building embedded system applications to NASA flight quality standards.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ValidateFile.hpp
Go to the documentation of this file.
1 
13 #ifndef _ValidateFile_hpp_
14 #define _ValidateFile_hpp_
15 
16 #define VFILE_HASH_CHUNK_SIZE (256)
17 
19 
20 namespace Os {
21 
22  namespace ValidateFile {
23 
24  // This class encapsulates a very simple file interface for validating files against their hash files
25  // and creating validation files
26 
27  typedef enum {
28  // Did the validation hash match the file hash or not?
31  // Did we have issues reading in the file?
35  // Did we have issues reading in the hash file?
39  // Did something else go wrong?
42  } Status;
43 
44  // also return hash
45  Status validate(const char* fileName, const char* hashFileName,
46  Utils::HashBuffer &hashBuffer);
48 
49  // for backwards compatibility
50  Status validate(const char* fileName, const char* hashFileName);
51 
53  // also return hash
54  Status createValidation(const char* fileName, const char* hash,
55  Utils::HashBuffer &hashBuffer);
56 
57  // for backwards compatibility
58  Status createValidation(const char* fileName, const char* hashFileName);
59 
61  }
62 }
63 
64 #endif
Os
Definition: File.cpp:7
Os::ValidateFile::VALIDATION_FILE_BAD_SIZE
@ VALIDATION_FILE_BAD_SIZE
Invalid size parameter.
Definition: ValidateFile.hpp:38
Os::ValidateFile::VALIDATION_OK
@ VALIDATION_OK
The validation of the file passed.
Definition: ValidateFile.hpp:29
Os::ValidateFile::Status
Status
Definition: ValidateFile.hpp:27
Os::ValidateFile::FILE_DOESNT_EXIST
@ FILE_DOESNT_EXIST
File doesn't exist (for read)
Definition: ValidateFile.hpp:32
Os::ValidateFile::OTHER_ERROR
@ OTHER_ERROR
A catch-all for other errors. Have to look in implementation-specific code.
Definition: ValidateFile.hpp:41
Os::ValidateFile::VALIDATION_FILE_DOESNT_EXIST
@ VALIDATION_FILE_DOESNT_EXIST
Validation file doesn't exist (for read)
Definition: ValidateFile.hpp:36
Os::ValidateFile::createValidation
Status createValidation(const char *fileName, const char *hash, Utils::HashBuffer &hashBuffer)
Definition: ValidateFileCommon.cpp:205
Os::ValidateFile::FILE_BAD_SIZE
@ FILE_BAD_SIZE
Invalid size parameter.
Definition: ValidateFile.hpp:34
Utils::HashBuffer
An container class for holding a hash buffer.
Definition: HashBuffer.hpp:26
Os::ValidateFile::NO_SPACE
@ NO_SPACE
No space left on the device for writing.
Definition: ValidateFile.hpp:40
Os::ValidateFile::VALIDATION_FILE_NO_PERMISSION
@ VALIDATION_FILE_NO_PERMISSION
No permission to read/write file.
Definition: ValidateFile.hpp:37
Os::ValidateFile::validate
Status validate(const char *fileName, const char *hashFileName, Utils::HashBuffer &hashBuffer)
Validate the contents of a file 'fileName' against its hash.
Definition: ValidateFileCommon.cpp:177
Os::ValidateFile::VALIDATION_FAIL
@ VALIDATION_FAIL
The validation of the file did not pass.
Definition: ValidateFile.hpp:30
HashBuffer.hpp
Os::ValidateFile::FILE_NO_PERMISSION
@ FILE_NO_PERMISSION
No permission to read/write file.
Definition: ValidateFile.hpp:33