|
libzypp
17.38.8
|
Interface to plugin scripts using a Stomp inspired communication protocol.
More...
#include <zypp/PluginScript.h>
Classes | |
| struct | Impl |
| PluginScript implementation. More... | |
Public Types | |
| using | Arguments = std::vector< std::string > |
| Commandline arguments passed to a script on open. More... | |
Public Member Functions | |
| PluginScript () | |
| Default ctor. More... | |
| PluginScript (Pathname script_r) | |
| Ctor taking script path and no arguments. More... | |
| PluginScript (Pathname script_r, Arguments args_r) | |
| Ctor taking script path and script arguments. More... | |
| const Pathname & | script () const |
| Return the script path if set. More... | |
| const Arguments & | args () const |
| Return the script arguments if set. More... | |
| bool | isOpen () const |
| Whether we are connected to a script. More... | |
| pid_t | getPid () const |
| Return a connected scripts pid or NotConnected. More... | |
| Pathname | getChroot () const |
| Return a connected scripts chroot or an empty Pathname. More... | |
| int | lastReturn () const |
| Remembers a scripts return value after close until next open. More... | |
| const std::string & | lastExecError () const |
| Remembers a scripts execError string after close until next open. More... | |
| void | open () |
| Setup connection and execute script. More... | |
| void | open (const Pathname &script_r) |
| void | open (const Pathname &script_r, const Arguments &args_r) |
| void | open (const Pathname &script_r, const Pathname &chroot_r) |
| void | open (const Pathname &script_r, const Arguments &args_r, const Pathname &chroot_r) |
| void | openChrooted (const Pathname &chroot_r) |
| Like open() but runs the script chrooted into chroot_r. More... | |
| int | close () |
| Close any open connection. More... | |
| void | send (const PluginFrame &frame_r) const |
| Send a PluginFrame. More... | |
| PluginFrame | receive () const |
| Receive a PluginFrame. More... | |
Get/set local timeout settings. | |
| long | sendTimeout () const |
| Local default timeout (sec.) when sending data. More... | |
| long | receiveTimeout () const |
| Local default timeout (sec.) when receiving data. More... | |
| void | sendTimeout (long newval_r) |
| Set local default timeout (sec.) when sending data. More... | |
| void | receiveTimeout (long newval_r) |
| Set local default timeout (sec.) when receiving data. More... | |
| void | timeout (long newval_r) |
| Set local default timeout (sec.) (both: send and receive). More... | |
Static Public Member Functions | |
Get/set the global timeout settings. | |
Timeout when sending/receiving data to/from a plugin default to 30 sec. The value (in seconds) my be changed via the environment variables | |
| static long | defaultSendTimeout () |
| Global default timeout (sec.) when sending data. More... | |
| static long | defaultReceiveTimeout () |
| Global default timeout (sec.) when receiving data. More... | |
| static void | defaultSendTimeout (long newval_r) |
| Set global default timeout (sec.) when sending data. More... | |
| static void | defaultReceiveTimeout (long newval_r) |
| Set global default timeout (sec.) when receiving data. More... | |
| static void | defaultTimeout (long newval_r) |
| Set global default timeout (sec.) (both: send and receive). More... | |
Static Public Attributes | |
| static const pid_t | NotConnected |
pid_t(-1) constant indicating no connection. More... | |
Private Attributes | |
| RW_pointer< Impl > | _pimpl |
| Pointer to implementation. More... | |
Friends | |
| std::ostream & | operator<< (std::ostream &str, const PluginScript &obj) |
| relates: PluginScript Stream output More... | |
Interface to plugin scripts using a Stomp inspired communication protocol.
Timeout when sending/receiving data to/from a plugin default to 30 sec. The value (in seconds) my be changed via the environment variables ZYPP_PLUGIN_SEND_TIMEOUT, ZYPP_PLUGIN_RECEIVE_TIMEOUT or ZYPP_PLUGIN_TIMEOUT (both: send and receive).
Definition at line 62 of file PluginScript.h.
| using zypp::PluginScript::Arguments = std::vector<std::string> |
Commandline arguments passed to a script on open.
Definition at line 68 of file PluginScript.h.
| zypp::PluginScript::PluginScript | ( | ) |
Default ctor.
Definition at line 499 of file PluginScript.cc.
| zypp::PluginScript::PluginScript | ( | Pathname | script_r | ) |
Ctor taking script path and no arguments.
Definition at line 503 of file PluginScript.cc.
Ctor taking script path and script arguments.
Definition at line 507 of file PluginScript.cc.
|
static |
Global default timeout (sec.) when sending data.
Definition at line 475 of file PluginScript.cc.
|
static |
Global default timeout (sec.) when receiving data.
Definition at line 478 of file PluginScript.cc.
|
static |
Set global default timeout (sec.) when sending data.
Definition at line 481 of file PluginScript.cc.
|
static |
Set global default timeout (sec.) when receiving data.
Definition at line 484 of file PluginScript.cc.
|
inlinestatic |
Set global default timeout (sec.) (both: send and receive).
Definition at line 93 of file PluginScript.h.
| const Pathname & zypp::PluginScript::script | ( | ) | const |
Return the script path if set.
Definition at line 511 of file PluginScript.cc.
| const PluginScript::Arguments & zypp::PluginScript::args | ( | ) | const |
Return the script arguments if set.
Definition at line 514 of file PluginScript.cc.
| bool zypp::PluginScript::isOpen | ( | ) | const |
Whether we are connected to a script.
Definition at line 517 of file PluginScript.cc.
| pid_t zypp::PluginScript::getPid | ( | ) | const |
Return a connected scripts pid or NotConnected.
Definition at line 520 of file PluginScript.cc.
| Pathname zypp::PluginScript::getChroot | ( | ) | const |
Return a connected scripts chroot or an empty Pathname.
Definition at line 523 of file PluginScript.cc.
| int zypp::PluginScript::lastReturn | ( | ) | const |
Remembers a scripts return value after close until next open.
Definition at line 526 of file PluginScript.cc.
| const std::string & zypp::PluginScript::lastExecError | ( | ) | const |
Remembers a scripts execError string after close until next open.
Definition at line 529 of file PluginScript.cc.
| long zypp::PluginScript::sendTimeout | ( | ) | const |
Local default timeout (sec.) when sending data.
Definition at line 487 of file PluginScript.cc.
| long zypp::PluginScript::receiveTimeout | ( | ) | const |
Local default timeout (sec.) when receiving data.
Definition at line 490 of file PluginScript.cc.
| void zypp::PluginScript::sendTimeout | ( | long | newval_r | ) |
Set local default timeout (sec.) when sending data.
Definition at line 493 of file PluginScript.cc.
| void zypp::PluginScript::receiveTimeout | ( | long | newval_r | ) |
Set local default timeout (sec.) when receiving data.
Definition at line 496 of file PluginScript.cc.
|
inline |
Set local default timeout (sec.) (both: send and receive).
Definition at line 147 of file PluginScript.h.
| void zypp::PluginScript::open | ( | ) |
Setup connection and execute script.
| PluginScriptException | if already connected to a script |
| PluginScriptException | if script does not exist or is not executable |
| PluginScriptException | on error |
Definition at line 532 of file PluginScript.cc.
| void zypp::PluginScript::open | ( | const Pathname & | script_r | ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 535 of file PluginScript.cc.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 538 of file PluginScript.cc.
Definition at line 541 of file PluginScript.cc.
| void zypp::PluginScript::open | ( | const Pathname & | script_r, |
| const Arguments & | args_r, | ||
| const Pathname & | chroot_r | ||
| ) |
Definition at line 544 of file PluginScript.cc.
| void zypp::PluginScript::openChrooted | ( | const Pathname & | chroot_r | ) |
Like open() but runs the script chrooted into chroot_r.
Uses the script path and arguments stored via setScript() and previous open() calls (the same values that plain open() uses).
| PluginScriptException | if already connected to a script |
| PluginScriptException | if script does not exist or is not executable |
| PluginScriptException | on error |
Definition at line 547 of file PluginScript.cc.
| int zypp::PluginScript::close | ( | ) |
Close any open connection.
Definition at line 550 of file PluginScript.cc.
| void zypp::PluginScript::send | ( | const PluginFrame & | frame_r | ) | const |
Send a PluginFrame.
| PluginScriptNotConnected | |
| PluginScriptSendTimeout | |
| PluginScriptDiedUnexpectedly | (does not close) |
| PluginScriptException | on error |
Definition at line 553 of file PluginScript.cc.
| PluginFrame zypp::PluginScript::receive | ( | ) | const |
Receive a PluginFrame.
| PluginScriptNotConnected | |
| PluginScriptReceiveTimeout | |
| PluginScriptDiedUnexpectedly | (does not close) |
| PluginScriptException | on error |
Definition at line 556 of file PluginScript.cc.
|
friend |
relates: PluginScript Stream output
Definition at line 561 of file PluginScript.cc.
|
static |
pid_t(-1) constant indicating no connection.
Definition at line 71 of file PluginScript.h.
|
private |
Pointer to implementation.
Definition at line 207 of file PluginScript.h.