libzypp  17.31.31
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>
17 #include <zypp-core/base/DefaultIntegral>
18 #include <zypp-media/FileCheckException>
19 #include <zypp/base/Exception.h>
20 #include <zypp/base/Function.h>
21 #include <zypp/PathInfo.h>
22 #include <zypp/CheckSum.h>
23 #include <zypp/KeyRingContexts.h>
24 
26 namespace zypp
27 {
28 
29  class PublicKey;
30 
38  typedef function<void ( const Pathname &file )> FileChecker;
39 
48  {
49  public:
62  void operator()( const Pathname &file ) const;
63  private:
65  };
66 
71  {
72  public:
74 
75  public:
82 
84  SignatureFileChecker( Pathname signature_r );
85 
87  void addPublicKey( const PublicKey & publickey_r );
89  void addPublicKey( const Pathname & publickey_r );
90 
102  void operator()( const Pathname & file_r ) const;
103  };
104 
110  {
111  public:
112  void operator()( const Pathname &file ) const;
113  };
114 
130  {
131  public:
132  void add( const FileChecker &checker );
136  void operator()( const Pathname &file ) const;
137 
138  int checkersSize() const { return _checkers.size(); }
139  private:
140  std::list<FileChecker> _checkers;
141  };
142 
144  std::ostream & operator<<( std::ostream & str, const FileChecker & obj );
145 
147 } // namespace zypp
149 #endif // ZYPP_FILECHECKER_H
void operator()(const Pathname &file) const
Definition: FileChecker.cc:85
Checks for nothing Used as the default checker.
Definition: FileChecker.h:109
Checks for the validity of a signature.
Definition: FileChecker.h:70
void addPublicKey(const PublicKey &publickey_r)
Add a public key to the list of known keys.
Definition: FileChecker.cc:121
void operator()(const Pathname &file_r) const
Call KeyRing::verifyFileSignatureWorkflow to verify the file.
Definition: FileChecker.cc:124
String related utilities and Regular expression matching.
SignatureFileChecker()
Default Ctor for unsigned files.
Definition: FileChecker.cc:112
std::ostream & operator<<(std::ostream &str, const SerialNumber &obj)
Definition: SerialNumber.cc:52
I/O context for KeyRing::verifyFileSignatureWorkflow.
std::list< FileChecker > _checkers
Definition: FileChecker.h:140
void operator()(const Pathname &file) const
Try to validate the file.
Definition: FileChecker.cc:32
void operator()(const Pathname &file) const
Definition: FileChecker.cc:91
void add(const FileChecker &checker)
Definition: FileChecker.cc:108
SignatureCheckException ExceptionType
Definition: FileChecker.h:73
Checker composed of more checkers.
Definition: FileChecker.h:129
Class representing one GPG Public Key (PublicKeyData + ASCII armored in a tempfile).
Definition: PublicKey.h:358
Built in file checkers.
Definition: FileChecker.h:47
std::string checksum(const Pathname &file, const std::string &algorithm)
Compute a files checksum.
Definition: PathInfo.cc:1051
function< void(const Pathname &file)> FileChecker
Functor signature used to check files.
Definition: FileChecker.h:29
Easy-to use interface to the ZYPP dependency resolver.
Definition: CodePitfalls.doc:1
CheckSumCheckException ExceptionType
Definition: FileChecker.h:50
ChecksumFileChecker(const CheckSum &checksum)
Constructor.
Definition: FileChecker.cc:28