libzypp: zypp/repo/PluginSigcheck.h Source File

libzypp 17.38.11

PluginSigcheck.h
Go to the documentation of this file.
1/*---------------------------------------------------------------------\
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8\---------------------------------------------------------------------*/
11#ifndef ZYPP_REPO_PLUGINSIGCHECK_H
12#define ZYPP_REPO_PLUGINSIGCHECK_H
13
14#include <iosfwd>
15#include <string>
16#include <vector>
17#include <map>
18
19#include <zypp-core/Pathname.h>
20#include <zypp-core/base/PtrTypes.h>
21#include <zypp-core/base/Exception.h>
22
23namespace zypp
24{
28
30
34 struct SigcheckPluginException : public Exception
35 {
36 SigcheckPluginException( const Exception & history_r )
37 : Exception( "SigcheckPlugin:", history_r )
38 {}
39 SigcheckPluginException( const std::string & msg_r )
40 : Exception( "SigcheckPlugin: "+msg_r )
41 {}
42 SigcheckPluginException( const std::string & msg_r, const Exception & history_r )
43 : Exception( "SigcheckPlugin: "+msg_r, history_r )
44 {}
45 };
46
48
52 class SigcheckPlugin
53 {
54 public:
55 SigcheckPlugin( const SigcheckPlugin & ) = delete;
56 SigcheckPlugin & operator=( const SigcheckPlugin & ) = delete;
57 SigcheckPlugin( SigcheckPlugin && ) noexcept = default;
58 SigcheckPlugin & operator=( SigcheckPlugin && ) noexcept = default;
59 ~SigcheckPlugin() = default;
60
61 public:
62 using Args = std::vector<std::string>;
63
65 SigcheckPlugin( Pathname script_r );
66 SigcheckPlugin( Pathname script_r, Args args_r );
67
71 void launch( const Pathname & chroot_r = Pathname() );
72
74 std::string sigExtension() const;
75
77 std::string keyExtension() const;
78
85 void sigcheck( const Pathname & data_r, const Pathname & sig_r = Pathname(), const Pathname & key_r = Pathname() ) const;
86
87 public:
88 struct Impl;
89 private:
90 RW_pointer<Impl> _pimpl;
91 friend std::ostream & operator<<( std::ostream & str, const SigcheckPlugin & obj );
92 };
93
95
104 class SigcheckPlugins
105 {
106 public:
107 SigcheckPlugins( const SigcheckPlugins & ) = delete;
108 SigcheckPlugins & operator=( const SigcheckPlugins & ) = delete;
109 SigcheckPlugins( SigcheckPlugins && ) noexcept = default;
110 SigcheckPlugins & operator=( SigcheckPlugins && ) noexcept = default;
111 ~SigcheckPlugins() = default;
112
113 public:
114 using Plugins = std::vector<SigcheckPlugin>;
115
117 SigcheckPlugins();
118
127 SigcheckPlugins( const std::string & cmdline_r, const Pathname & plugindir_r = Pathname() );
128
130 explicit operator bool() const;
131
133 const Plugins & plugins();
134
136 void launch( const Pathname & chroot_r = Pathname() );
137
138 public:
139 struct Impl;
140 private:
141 RW_pointer<Impl> _pimpl;
142 friend std::ostream & operator<<( std::ostream & str, const SigcheckPlugins & obj );
143 };
144
145} // namespace zypp
146#endif // ZYPP_REPO_PLUGINSIGCHECK_H
Exception.h
Pathname.h
PtrTypes.h
zypp::Exception::Exception
Exception()
Default ctor.
Definition Exception.cc:94
zypp::SigcheckPlugin
Definition PluginSigcheck.h:53
zypp::SigcheckPlugin::sigExtension
std::string sigExtension() const
Extension of a signature file to retrieve.
Definition PluginSigcheck.cc:136
zypp::SigcheckPlugin::_pimpl
RW_pointer< Impl > _pimpl
Definition PluginSigcheck.h:90
zypp::SigcheckPlugin::SigcheckPlugin
SigcheckPlugin(const SigcheckPlugin &)=delete
zypp::SigcheckPlugin::launch
void launch(const Pathname &chroot_r=Pathname())
Launch the plugin.
Definition PluginSigcheck.cc:133
zypp::SigcheckPlugin::sigcheck
void sigcheck(const Pathname &data_r, const Pathname &sig_r=Pathname(), const Pathname &key_r=Pathname()) const
Let plugin do the signature check.
Definition PluginSigcheck.cc:142
zypp::SigcheckPlugin::keyExtension
std::string keyExtension() const
Extension of a key file to retrieve.
Definition PluginSigcheck.cc:139
zypp::SigcheckPlugin::Args
std::vector< std::string > Args
Definition PluginSigcheck.h:62
zypp::SigcheckPlugin::SigcheckPlugin
SigcheckPlugin(SigcheckPlugin &&) noexcept=default
zypp::SigcheckPlugin::operator=
SigcheckPlugin & operator=(const SigcheckPlugin &)=delete
zypp::SigcheckPlugins::SigcheckPlugins
SigcheckPlugins(SigcheckPlugins &&) noexcept=default
zypp::SigcheckPlugins::plugins
const Plugins & plugins()
All plugins (their addresses can be captured).
Definition PluginSigcheck.cc:204
zypp::SigcheckPlugins::SigcheckPlugins
SigcheckPlugins(const SigcheckPlugins &)=delete
zypp::SigcheckPlugins::launch
void launch(const Pathname &chroot_r=Pathname())
Launch all plugins (optionally chrooted).
Definition PluginSigcheck.cc:207
zypp::SigcheckPlugins::operator=
SigcheckPlugins & operator=(const SigcheckPlugins &)=delete
zypp::SigcheckPlugins::_pimpl
RW_pointer< Impl > _pimpl
Definition PluginSigcheck.h:141
zypp::SigcheckPlugins::Plugins
std::vector< SigcheckPlugin > Plugins
Definition PluginSigcheck.h:114
zypp::filesystem::Pathname
Pathname.
Definition Pathname.h:48
std
Definition ansi.h:855
str
String related utilities and Regular expression matching.
zypp
Easy-to use interface to the ZYPP dependency resolver.
Definition CodePitfalls.doc:2
zypp::RW_pointer
Wrapper for const correct access via Smart pointer types.
Definition PtrTypes.h:293
zypp::SigcheckPluginException::SigcheckPluginException
SigcheckPluginException(const std::string &msg_r)
Definition PluginSigcheck.h:39
zypp::SigcheckPluginException::SigcheckPluginException
SigcheckPluginException(const std::string &msg_r, const Exception &history_r)
Definition PluginSigcheck.h:42
zypp::SigcheckPluginException::SigcheckPluginException
SigcheckPluginException(const Exception &history_r)
Definition PluginSigcheck.h:36
zypp::SigcheckPlugin::Impl
Definition PluginSigcheck.cc:42
zypp::SigcheckPlugins::Impl
Definition PluginSigcheck.cc:151