F´ Flight Software - C/C++ Documentation
NASA-v1.5.0
A framework for building embedded system applications to NASA flight quality standards.
|
Go to the documentation of this file.
34 while( cnt <= max_itr ) {
36 size =
sizeof(buffer);
37 status = file.
read(&buffer, size,
false);
46 hash.
update(&buffer, size);
57 hash.
final(computedHashBuffer);
58 hashBuffer = computedHashBuffer;
77 status = hashFile.
read(&savedHash[0], size);
88 hashBuffer = savedHashBuffer;
174 return validate(fileName, hashFileName, hashBuffer);
183 status =
readHash(hashFileName, savedHash);
196 if( savedHash != computedHash ){
200 hashBuffer = savedHash;
215 status =
writeHash(hashFileName, hashBuffer);
@ BAD_SIZE
Invalid size parameter.
@ VALIDATION_FILE_BAD_SIZE
Invalid size parameter.
@ NO_PERMISSION
No permission to read/write file.
File::Status readHash(const char *hashFileName, Utils::HashBuffer &hashBuffer)
@ VALIDATION_OK
The validation of the file passed.
void close(void)
close file
NATIVE_UINT_TYPE getBuffCapacity(void) const
Status read(void *buffer, NATIVE_INT_TYPE &size, bool waitForFull=true)
waitForFull = true to wait for all bytes to be read
uint8_t U8
8-bit unsigned integer
@ FILE_DOESNT_EXIST
File doesn't exist (for read)
@ OTHER_ERROR
A catch-all for other errors. Have to look in implementation-specific code.
@ OTHER_ERROR
A catch-all for other errors. Have to look in implementation-specific code.
File::Status writeHash(const char *hashFileName, Utils::HashBuffer hashBuffer)
@ NOT_OPENED
file hasn't been opened yet
@ VALIDATION_FILE_DOESNT_EXIST
Validation file doesn't exist (for read)
Status createValidation(const char *fileName, const char *hash, Utils::HashBuffer &hashBuffer)
@ FILE_BAD_SIZE
Invalid size parameter.
Defines a file class to validate files or generate a file validator file.
void final(HashBuffer &buffer)
File::Status computeHash(const char *fileName, Utils::HashBuffer &hashBuffer)
An container class for holding a hash buffer.
#define HASH_DIGEST_LENGTH
Status write(const void *buffer, NATIVE_INT_TYPE &size, bool waitForDone=true)
write size; will return amount written or errno
@ DOESNT_EXIST
File doesn't exist (for read)
@ NO_SPACE
No space left on the device for writing.
@ OP_OK
Operation was successful.
ValidateFile::Status translateStatus(File::Status status, StatusFileType type)
#define VFILE_HASH_CHUNK_SIZE
@ OPEN_WRITE
Open file for writing.
Status open(const char *fileName, Mode mode)
open file. Writing creates file if it doesn't exist
NATIVE_UINT_TYPE getBuffLength() const
returns current buffer size
A generic interface for creating and comparing hash values.
@ VALIDATION_FILE_NO_PERMISSION
No permission to read/write file.
void update(const void *const data, const NATIVE_INT_TYPE len)
Status validate(const char *fileName, const char *hashFileName, Utils::HashBuffer &hashBuffer)
Validate the contents of a file 'fileName' against its hash.
@ OP_OK
Operation was successful.
Status getFileSize(const char *path, U64 &size)
append file origin to destination file. If boolean true, creates a brand new file if the destination ...
@ VALIDATION_FAIL
The validation of the file did not pass.
int NATIVE_INT_TYPE
native integer type declaration
@ OPEN_READ
Open file for reading.
@ FILE_NO_PERMISSION
No permission to read/write file.