F´ Flight Software - C/C++ Documentation devel
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
20namespace 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);
52
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);
60
61 }
62}
63
64#endif
A container class for holding a hash buffer.
@ FILE_NO_PERMISSION
No permission to read/write file.
@ VALIDATION_OK
The validation of the file passed.
@ VALIDATION_FILE_DOESNT_EXIST
Validation file doesn't exist (for read)
@ FILE_DOESNT_EXIST
File doesn't exist (for read)
@ VALIDATION_FAIL
The validation of the file did not pass.
@ OTHER_ERROR
A catch-all for other errors. Have to look in implementation-specific code.
@ FILE_BAD_SIZE
Invalid size parameter.
@ NO_SPACE
No space left on the device for writing.
@ VALIDATION_FILE_BAD_SIZE
Invalid size parameter.
@ VALIDATION_FILE_NO_PERMISSION
No permission to read/write file.
Status createValidation(const char *fileName, const char *hash, Utils::HashBuffer &hashBuffer)
Status validate(const char *fileName, const char *hashFileName, Utils::HashBuffer &hashBuffer)
Validate the contents of a file 'fileName' against its hash.
Definition File.cpp:6