libzypp: zypp/FileChecker.h Source File

libzypp 17.38.10

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-core/base/Exception.h>
20#include <zypp-core/base/Function.h>
21#include <zypp/PathInfo.h>
22#include <zypp/CheckSum.h>
23#include <zypp/KeyRingContexts.h>
24
26namespace zypp
27{
28
29 class PublicKey;
30
38 typedef function<void ( const Pathname &file )> FileChecker;
39
43
47 class ChecksumFileChecker
48 {
49 public:
50 typedef CheckSumCheckException ExceptionType;
55 ChecksumFileChecker( CheckSum checksum );
62 void operator()( const Pathname &file ) const;
63 private:
64 CheckSum _checksum;
65 };
66
70 class SignatureFileChecker
71 {
72 public:
73 typedef SignatureCheckException ExceptionType;
74
75 public:
81 SignatureFileChecker();
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 keyring::VerifyFileContext &verifyContext();
105 const keyring::VerifyFileContext &verifyContext() const;
106
107 private:
108 keyring::VerifyFileContext _verifyContext;
109 };
110
115 class NullFileChecker
116 {
117 public:
118 void operator()( const Pathname &file ) const;
119 };
120
135 class CompositeFileChecker
136 {
137 public:
138 void add( const FileChecker &checker );
142 void operator()( const Pathname &file ) const;
143
144 int checkersSize() const { return _checkers.size(); }
145 private:
146 std::list<FileChecker> _checkers;
147 };
148
150 std::ostream & operator<<( std::ostream & str, const FileChecker & obj );
151
153} // namespace zypp
155#endif // ZYPP_FILECHECKER_H
Exception.h
Function.h
KeyRingContexts.h
zypp::CheckSumCheckException
Definition filecheckexception.h:26
zypp::CheckSum
Definition CheckSum.h:34
zypp::ChecksumFileChecker::operator()
void operator()(const Pathname &file) const
Try to validate the file.
Definition FileChecker.cc:36
zypp::ChecksumFileChecker::ChecksumFileChecker
ChecksumFileChecker(CheckSum checksum)
Constructor.
Definition FileChecker.cc:32
zypp::ChecksumFileChecker::_checksum
CheckSum _checksum
Definition FileChecker.h:64
zypp::ChecksumFileChecker::ExceptionType
CheckSumCheckException ExceptionType
Definition FileChecker.h:50
zypp::CompositeFileChecker
Checker composed of more checkers.
Definition FileChecker.h:136
zypp::CompositeFileChecker::_checkers
std::list< FileChecker > _checkers
Definition FileChecker.h:146
zypp::CompositeFileChecker::add
void add(const FileChecker &checker)
Definition FileChecker.cc:67
zypp::CompositeFileChecker::operator()
void operator()(const Pathname &file) const
Definition FileChecker.cc:50
zypp::CompositeFileChecker::checkersSize
int checkersSize() const
Definition FileChecker.h:144
zypp::NullFileChecker
Checks for nothing Used as the default checker.
Definition FileChecker.h:116
zypp::NullFileChecker::operator()
void operator()(const Pathname &file) const
Definition FileChecker.cc:44
zypp::PublicKey
Class representing one GPG Public Key (PublicKeyData + ASCII armored in a tempfile).
Definition PublicKey.h:375
zypp::SignatureCheckException
Definition filecheckexception.h:34
zypp::SignatureFileChecker::operator()
void operator()(const Pathname &file_r) const
Call KeyRing::verifyFileSignatureWorkflow to verify the file.
Definition FileChecker.cc:83
zypp::SignatureFileChecker::verifyContext
keyring::VerifyFileContext & verifyContext()
Definition FileChecker.cc:96
zypp::SignatureFileChecker::addPublicKey
void addPublicKey(const PublicKey &publickey_r)
Add a public key to the list of known keys.
Definition FileChecker.cc:80
zypp::SignatureFileChecker::_verifyContext
keyring::VerifyFileContext _verifyContext
Definition FileChecker.h:108
zypp::SignatureFileChecker::ExceptionType
SignatureCheckException ExceptionType
Definition FileChecker.h:73
zypp::SignatureFileChecker::SignatureFileChecker
SignatureFileChecker()
Default Ctor for unsigned files.
Definition FileChecker.cc:71
zypp::filesystem::Pathname
Pathname.
Definition Pathname.h:48
zypp::keyring::VerifyFileContext
I/O context for KeyRing::verifyFileSignatureWorkflow.
Definition KeyRingContexts.h:30
str
String related utilities and Regular expression matching.
zypp
Easy-to use interface to the ZYPP dependency resolver.
Definition CodePitfalls.doc:2
zypp::FileChecker
function< void(const Pathname &file)> FileChecker
Functor signature used to check files.
Definition FileChecker.h:38
zypp::operator<<
std::ostream & operator<<(std::ostream &str, const Capabilities &obj)
relates: Capabilities Stream output
Definition Capabilities.cc:65
CheckSum.h
PathInfo.h