libzypp 17.28.8
FileChecker.h
Go to the documentation of this file.
1/*---------------------------------------------------------------------\
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8\---------------------------------------------------------------------*/
12#ifndef ZYPP_FILECHECKER_H
13#define ZYPP_FILECHECKER_H
14
15#include <iosfwd>
16#include <list>
18#include <zypp/base/Exception.h>
19#include <zypp/base/Function.h>
20#include <zypp/PathInfo.h>
21#include <zypp/CheckSum.h>
23
25namespace zypp
26{
27
28 class PublicKey;
29
37 typedef function<void ( const Pathname &file )> FileChecker;
38
40 {
41 public:
42 FileCheckException(const std::string &msg)
43 : Exception(msg)
44 {}
45 };
46
48 {
49 public:
50 CheckSumCheckException(const std::string &msg)
52 {}
53 };
54
56 {
57 public:
58 SignatureCheckException(const std::string &msg)
60 {}
61 };
62
71 {
72 public:
85 void operator()( const Pathname &file ) const;
86 private:
88 };
89
94 {
95 public:
97
98 public:
105
107 SignatureFileChecker( Pathname signature_r );
108
110 void addPublicKey( const PublicKey & publickey_r );
112 void addPublicKey( const Pathname & publickey_r );
113
125 void operator()( const Pathname & file_r ) const;
126 };
127
133 {
134 public:
135 void operator()( const Pathname &file ) const;
136 };
137
153 {
154 public:
155 void add( const FileChecker &checker );
159 void operator()( const Pathname &file ) const;
160
161 int checkersSize() const { return _checkers.size(); }
162 private:
163 std::list<FileChecker> _checkers;
164 };
165
167 std::ostream & operator<<( std::ostream & str, const FileChecker & obj );
168
170} // namespace zypp
172#endif // ZYPP_FILECHECKER_H
CheckSumCheckException(const std::string &msg)
Definition: FileChecker.h:50
Built in file checkers.
Definition: FileChecker.h:71
void operator()(const Pathname &file) const
Try to validate the file.
Definition: FileChecker.cc:32
ChecksumFileChecker(const CheckSum &checksum)
Constructor.
Definition: FileChecker.cc:28
CheckSumCheckException ExceptionType
Definition: FileChecker.h:73
Checker composed of more checkers.
Definition: FileChecker.h:153
std::list< FileChecker > _checkers
Definition: FileChecker.h:163
void add(const FileChecker &checker)
Definition: FileChecker.cc:108
void operator()(const Pathname &file) const
Definition: FileChecker.cc:91
Base class for Exception.
Definition: Exception.h:146
const std::string & msg() const
Return the message string provided to the ctor.
Definition: Exception.h:195
FileCheckException(const std::string &msg)
Definition: FileChecker.h:42
Checks for nothing Used as the default checker.
Definition: FileChecker.h:133
void operator()(const Pathname &file) const
Definition: FileChecker.cc:85
Class representing one GPG Public Key (PublicKeyData + ASCII armored in a tempfile).
Definition: PublicKey.h:284
SignatureCheckException(const std::string &msg)
Definition: FileChecker.h:58
Checks for the validity of a signature.
Definition: FileChecker.h:94
void operator()(const Pathname &file_r) const
Call KeyRing::verifyFileSignatureWorkflow to verify the file.
Definition: FileChecker.cc:124
void addPublicKey(const PublicKey &publickey_r)
Add a public key to the list of known keys.
Definition: FileChecker.cc:121
SignatureCheckException ExceptionType
Definition: FileChecker.h:96
SignatureFileChecker()
Default Ctor for unsigned files.
Definition: FileChecker.cc:112
I/O context for KeyRing::verifyFileSignatureWorkflow.
String related utilities and Regular expression matching.
std::string checksum(const Pathname &file, const std::string &algorithm)
Compute a files checksum.
Definition: PathInfo.cc:1051
Easy-to use interface to the ZYPP dependency resolver.
Definition: CodePitfalls.doc:2
std::ostream & operator<<(std::ostream &str, const Exception &obj)
Definition: Exception.cc:147
function< void(const Pathname &file)> FileChecker
Functor signature used to check files.
Definition: FileChecker.h:28