libzypp 17.35.14
PluginScript.h
Go to the documentation of this file.
1/*---------------------------------------------------------------------\
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8\---------------------------------------------------------------------*/
12#ifndef ZYPP_PLUGINSCRIPT_H
13#define ZYPP_PLUGINSCRIPT_H
14
15#include <iosfwd>
16#include <string>
17#include <vector>
18
19#include <zypp/base/PtrTypes.h>
20#include <zypp/Pathname.h>
21
24
26namespace zypp
27{
28
63 {
64 friend std::ostream & operator<<( std::ostream & str, const PluginScript & obj );
65
66 public:
68 using Arguments = std::vector<std::string>;
69 using Progress = std::pair<int, int>;
70
72 static const pid_t NotConnected;
73
74 public:
82 static long defaultSendTimeout();
83
85 static long defaultReceiveTimeout();
86
88 static void defaultSendTimeout( long newval_r );
89
91 static void defaultReceiveTimeout( long newval_r );
92
94 static void defaultTimeout( long newval_r )
95 { defaultSendTimeout( newval_r ); defaultReceiveTimeout( newval_r ); }
97
98 public:
100 PluginScript();
101
103 PluginScript( Pathname script_r );
104
106 PluginScript( Pathname script_r, Arguments args_r );
107
108 public:
110 const Pathname & script() const;
111
113 const Arguments & args() const;
114
116 bool isOpen() const;
117
119 pid_t getPid() const;
120
122 int lastReturn() const;
123
127 const std::string & lastExecError() const;
128
129 public:
133 long sendTimeout() const;
134
136 long receiveTimeout() const;
137
139 void sendTimeout( long newval_r );
140
142 void receiveTimeout( long newval_r );
143
145 void timeout( long newval_r )
146 { sendTimeout( newval_r ); receiveTimeout( newval_r ); }
148
149 public:
155 void open();
156
158 void open( const Pathname & script_r );
159
161 void open( const Pathname & script_r, const Arguments & args_r );
162
164 int close();
165
166 public:
174 void send( const PluginFrame & frame_r ) const;
175
183 Progress progress() const;
184
191 PluginFrame receive() const;
192
193 public:
195 struct Impl;
196 private:
199 };
200
202 std::ostream & operator<<( std::ostream & str, const PluginScript & obj );
203
205} // namespace zypp
207#endif // ZYPP_PLUGINSCRIPT_H
Command frame for communication with PluginScript.
Definition PluginFrame.h:42
Interface to plugin scripts using a Stomp inspired communication protocol.
std::vector< std::string > Arguments
Commandline arguments passed to a script on open.
std::pair< int, int > Progress
RW_pointer< Impl > _pimpl
Pointer to implementation.
static const pid_t NotConnected
pid_t(-1) constant indicating no connection.
void timeout(long newval_r)
Set local default timeout (sec.) (both: send and receive).
static void defaultTimeout(long newval_r)
Set global default timeout (sec.) (both: send and receive).
String related utilities and Regular expression matching.
Easy-to use interface to the ZYPP dependency resolver.
std::ostream & operator<<(std::ostream &str, const SerialNumber &obj)
const Arch Arch_armv7hnl Arch_armv7nhl ZYPP_API
Definition Arch.h:247
Wrapper for const correct access via Smart pointer types.
Definition PtrTypes.h:293