-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathnetconf-client.hpp
More file actions
61 lines (51 loc) · 1.95 KB
/
netconf-client.hpp
File metadata and controls
61 lines (51 loc) · 1.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#pragma once
#include <functional>
#include <filesystem>
#include <libyang-cpp/Context.hpp>
#include <libnetconf2-cpp/Enum.hpp>
#include <memory>
#include <optional>
#include <string>
#include <vector>
struct nc_session;
namespace libyang {
class Context;
class DataNode;
}
namespace libnetconf {
std::filesystem::path internalModuleDirectory();
namespace client {
class ReportedError : public std::runtime_error {
public:
ReportedError(const std::string& what);
~ReportedError() override;
};
using LogCb = std::function<void(const nc_session*, LogLevel, const char*)>;
void setLogLevel(LogLevel level);
void setLogCallback(const LogCb& callback);
class Session {
public:
Session(struct nc_session* session);
~Session();
static std::unique_ptr<Session> connectSocket(const std::string& path, std::optional<libyang::Context> ctx = std::nullopt);
static std::unique_ptr<Session> connectFd(const int source, const int sink, std::optional<libyang::Context> ctx = std::nullopt);
[[nodiscard]] std::vector<std::string> capabilities() const;
std::optional<libyang::DataNode> get(const std::optional<std::string>& filter = std::nullopt);
std::optional<libyang::DataNode> getData(const NmdaDatastore datastore, const std::optional<std::string>& filter = std::nullopt);
void editConfig(const Datastore datastore,
const EditDefaultOp defaultOperation,
const EditTestOpt testOption,
const EditErrorOpt errorOption,
const std::string& data);
void editData(const NmdaDatastore datastore, const std::string& data);
void copyConfigFromString(const Datastore target, const std::string& data);
std::optional<libyang::DataNode> rpc_or_action(const std::string& xmlData);
void copyConfig(const Datastore source, const Datastore destination);
void commit();
void discard();
libyang::Context libyangContext();
protected:
struct nc_session* m_session;
};
}
}