libstorage-ng
Loading...
Searching...
No Matches
Remote.h
1/*
2 * Copyright (c) 2015 Novell, Inc.
3 * Copyright (c) [2019-2023] SUSE LLC
4 *
5 * All Rights Reserved.
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of version 2 of the GNU General Public License as published
9 * by the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 * more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, contact Novell, Inc.
18 *
19 * To contact Novell about this file by physical or electronic mail, you may
20 * find current contact information at www.novell.com.
21 */
22
23
24#ifndef STORAGE_REMOTE_H
25#define STORAGE_REMOTE_H
26
27
28#include <string>
29#include <vector>
30
31
32// TODO the classnames are bad since the classes for also used in Mockup
33// TODO swig does not support nested classes so here are currently ugly names
34
35namespace storage
36{
37
42 {
43 RemoteCommand() = default;
44 RemoteCommand(const std::vector<std::string>& stdout)
45 : stdout(stdout) {}
46 RemoteCommand(const std::vector<std::string>& stdout,
47 const std::vector<std::string>& stderr, int exit_code)
48 : stdout(stdout), stderr(stderr), exit_code(exit_code) {}
49
50 std::vector<std::string> stdout;
51 std::vector<std::string> stderr;
52 int exit_code = 0;
53
57 bool operator==(const RemoteCommand& rhs) const;
58 };
59
60
65 {
66 RemoteFile() = default;
67 RemoteFile(const std::vector<std::string>& content) : content(content) {}
68
69 std::vector<std::string> content;
70
74 bool operator==(const RemoteFile& rhs) const;
75 };
76
77
79 {
80 public:
81
82 virtual ~RemoteCallbacks() {}
83
84 virtual RemoteCommand get_command(const std::string& name) const = 0;
85 virtual RemoteFile get_file(const std::string& name) const = 0;
86
87 };
88
89
91 {
92 public:
93
94 virtual ~RemoteCallbacksV2() {}
95
96 virtual RemoteCommand get_command_v2(const std::vector<std::string>& args) const = 0;
97
98 };
99
100 const RemoteCallbacks* get_remote_callbacks();
101 void set_remote_callbacks(const RemoteCallbacks* remote_callbacks);
102
103}
104
105
106#endif
Definition Remote.h:91
Definition Remote.h:79
The storage namespace.
Definition Actiongraph.h:40
A result of an unnamed command: stdout + stderr + exit_code.
Definition Remote.h:42
bool operator==(const RemoteCommand &rhs) const
Compare stdout, stderr and exit_code of two RemoteCommands.
Contents of an unnamed file (vector of lines)
Definition Remote.h:65
bool operator==(const RemoteFile &rhs) const
Compare content of two Remotefiles.