libzypp  17.38.8
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>
22 
23 namespace zypp
24 {
29 
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 
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:
91  friend std::ostream & operator<<( std::ostream & str, const SigcheckPlugin & obj );
92  };
93 
95 
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:
142  friend std::ostream & operator<<( std::ostream & str, const SigcheckPlugins & obj );
143  };
144 
145 } // namespace zypp
146 #endif // ZYPP_REPO_PLUGINSIGCHECK_H
SigcheckPlugins()
No plugins.
Exception thrown by SigcheckPlugins.
SigcheckPluginException(const std::string &msg_r)
String related utilities and Regular expression matching.
~SigcheckPlugins()=default
void sigcheck(const Pathname &data_r, const Pathname &sig_r=Pathname(), const Pathname &key_r=Pathname()) const
Let plugin do the signature check.
SigcheckPlugin & operator=(const SigcheckPlugin &)=delete
SigcheckPlugin(const SigcheckPlugin &)=delete
const Plugins & plugins()
All plugins (their addresses can be captured).
SigcheckPluginException(const Exception &history_r)
std::vector< std::string > Args
std::string sigExtension() const
Extension of a signature file to retrieve.
std::string keyExtension() const
Extension of a key file to retrieve.
void launch(const Pathname &chroot_r=Pathname())
Launch all plugins (optionally chrooted).
Base class for Exception.
Definition: Exception.h:152
SigcheckPlugins & operator=(const SigcheckPlugins &)=delete
std::vector< SigcheckPlugin > Plugins
friend std::ostream & operator<<(std::ostream &str, const SigcheckPlugins &obj)
RW_pointer< Impl > _pimpl
Easy-to use interface to the ZYPP dependency resolver.
Definition: CodePitfalls.doc:1
RW_pointer< Impl > _pimpl
~SigcheckPlugin()=default
SigcheckPluginException(const std::string &msg_r, const Exception &history_r)
friend std::ostream & operator<<(std::ostream &str, const SigcheckPlugin &obj)
void launch(const Pathname &chroot_r=Pathname())
Launch the plugin.
Handle a bunch of SigcheckPlugins.