F´ Flight Software - C/C++ Documentation NASA-v1.6.0
A framework for building embedded system applications to NASA flight quality standards.
Loading...
Searching...
No Matches
ValidatedFile.cpp
Go to the documentation of this file.
1// ======================================================================
2// \title ValidatedFile.cpp
3// \author bocchino
4// \brief Os::ValidatedFile implementation
5//
6// \copyright
7// Copyright (C) 2017 California Institute of Technology.
8// ALL RIGHTS RESERVED. United States Government Sponsorship
9// acknowledged.
10//
11// ======================================================================
12
13#include "Os/ValidatedFile.hpp"
14#include "Utils/Hash/Hash.hpp"
15
16namespace Os {
17
18 ValidatedFile ::
19 ValidatedFile(const char *const fileName) :
20 fileName(fileName),
21 hashFileName(""),
22 hashBuffer()
23 {
24 Utils::Hash::addFileExtension(this->fileName, this->hashFileName);
25 }
26
27 Os::ValidateFile::Status ValidatedFile ::
28 validate()
29 {
30 const Os::ValidateFile::Status status =
32 this->fileName.toChar(),
33 this->hashFileName.toChar(),
34 this->hashBuffer
35 );
36 return status;
37 }
38
39 Os::ValidateFile::Status ValidatedFile ::
40 createHashFile()
41 {
42 const Os::ValidateFile::Status status =
44 this->fileName.toChar(),
45 this->hashFileName.toChar(),
46 this->hashBuffer
47 );
48 return status;
49 }
50
51 const Fw::StringBase& ValidatedFile ::
52 getFileName() const
53 {
54 return this->fileName;
55 }
56
57 const Fw::StringBase& ValidatedFile ::
58 getHashFileName() const
59 {
60 return this->hashFileName;
61 }
62
63 const Utils::HashBuffer& ValidatedFile ::
64 getHashBuffer() const
65 {
66 return this->hashBuffer;
67 }
68
69}
A container class for holding a hash buffer.
static void addFileExtension(const Fw::StringBase &baseName, Fw::StringBase &extendedName)
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