blob: 0504bc32b8ac9098652fbace9eb2d68e628b8985 [file] [log] [blame]
Michal Vasko7bcb48e2016-01-15 10:28:54 +01001/**
2 * \file messages_client.h
3 * \author Radek Krejci <rkrejci@cesnet.cz>
4 * \author Michal Vasko <mvasko@cesnet.cz>
5 * \brief libnetconf2's public functions and structures of NETCONF client messages.
6 *
7 * Copyright (c) 2015 CESNET, z.s.p.o.
8 *
Radek Krejci9b81f5b2016-02-24 13:14:49 +01009 * This source code is licensed under BSD 3-Clause License (the "License").
10 * You may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
Michal Vaskoafd416b2016-02-25 14:51:46 +010012 *
Radek Krejci9b81f5b2016-02-24 13:14:49 +010013 * https://opensource.org/licenses/BSD-3-Clause
Michal Vasko7bcb48e2016-01-15 10:28:54 +010014 */
15
16#ifndef NC_MESSAGES_CLIENT_H_
17#define NC_MESSAGES_CLIENT_H_
18
Michal Vaskoc09730e2019-01-17 10:07:26 +010019#ifdef __cplusplus
20extern "C" {
21#endif
22
Michal Vasko7bcb48e2016-01-15 10:28:54 +010023#include <stdint.h>
24
25#include "netconf.h"
26
Michal Vaskof0537d82016-01-29 14:42:38 +010027/**
Radek Krejci6799a052017-05-19 14:23:23 +020028 * @defgroup client_msg Client Messages
29 * @ingroup client
30 *
31 * @brief Functions to create NETCONF RPCs (or actions) and process replies received from the server.
32 * @{
33 */
34
35/**
Michal Vaskof0537d82016-01-29 14:42:38 +010036 * @brief Enumeration of RPC types
Radek Krejci6799a052017-05-19 14:23:23 +020037 *
38 * Note that NC_RPC_CLOSE is not defined since sending \<close-session\> is done implicitly by nc_session_free()
Michal Vaskof0537d82016-01-29 14:42:38 +010039 */
Michal Vasko7bcb48e2016-01-15 10:28:54 +010040typedef enum {
Michal Vasko7f1c78b2016-01-19 09:52:14 +010041 NC_RPC_UNKNOWN = 0, /**< invalid RPC. */
Michal Vasko90e8e692016-07-13 12:27:57 +020042 NC_RPC_ACT_GENERIC, /**< user-defined generic RPC/action. */
Michal Vasko7bcb48e2016-01-15 10:28:54 +010043
44 /* ietf-netconf */
45 NC_RPC_GETCONFIG, /**< \<get-config\> RPC. */
46 NC_RPC_EDIT, /**< \<edit-config\> RPC. */
47 NC_RPC_COPY, /**< \<copy-config\> RPC. */
48 NC_RPC_DELETE, /**< \<delete-config\> RPC. */
49 NC_RPC_LOCK, /**< \<lock\> RPC. */
50 NC_RPC_UNLOCK, /**< \<unlock\> RPC. */
51 NC_RPC_GET, /**< \<get\> RPC. */
Michal Vasko7bcb48e2016-01-15 10:28:54 +010052 NC_RPC_KILL, /**< \<kill-session\> RPC. */
53 NC_RPC_COMMIT, /**< \<commit\> RPC. */
54 NC_RPC_DISCARD, /**< \<discard-changes\> RPC. */
55 NC_RPC_CANCEL, /**< \<cancel-commit\> RPC. */
56 NC_RPC_VALIDATE, /**< \<validate\> RPC. */
57
58 /* ietf-netconf-monitoring */
59 NC_RPC_GETSCHEMA, /**< \<get-schema\> RPC. */
60
61 /* notifications */
Michal Vaskoc1171a42019-11-05 12:06:46 +010062 NC_RPC_SUBSCRIBE, /**< \<create-subscription\> RPC. */
63
64 /* ietf-netconf-nmda */
65 NC_RPC_GETDATA, /**< \<get-data\> RPC. */
66 NC_RPC_EDITDATA, /**< \<edit-data\> RPC. */
Michal Vasko96f247a2021-03-15 13:32:10 +010067
68 /* ietf-subscribed-notifications */
69 NC_RPC_ESTABLISHSUB, /**< \<establish-subscription\> RPC. */
70 NC_RPC_MODIFYSUB, /**< \<modify-subscription\> RPC. */
71 NC_RPC_DELETESUB, /**< \<delete-subscription\> RPC. */
72 NC_RPC_KILLSUB, /**< \<kill-subscription\> RPC. */
Michal Vasko7bcb48e2016-01-15 10:28:54 +010073} NC_RPC_TYPE;
74
Michal Vaskof0537d82016-01-29 14:42:38 +010075/**
76 * @brief Enumeration of \<edit-config\> default operation
77 */
Michal Vasko7bcb48e2016-01-15 10:28:54 +010078typedef enum {
Michal Vaskof0537d82016-01-29 14:42:38 +010079 NC_RPC_EDIT_DFLTOP_UNKNOWN = 0, /**< unknown default operation */
80 NC_RPC_EDIT_DFLTOP_MERGE, /**< default operation merge */
81 NC_RPC_EDIT_DFLTOP_REPLACE, /**< default operation replace */
82 NC_RPC_EDIT_DFLTOP_NONE /**< default operation none */
Michal Vasko7bcb48e2016-01-15 10:28:54 +010083} NC_RPC_EDIT_DFLTOP;
84
Michal Vaskof0537d82016-01-29 14:42:38 +010085/**
86 * @brief Enumeration of \<edit-config\> test option
87 */
Michal Vasko7bcb48e2016-01-15 10:28:54 +010088typedef enum {
Michal Vaskof0537d82016-01-29 14:42:38 +010089 NC_RPC_EDIT_TESTOPT_UNKNOWN = 0, /**< unknown test option */
90 NC_RPC_EDIT_TESTOPT_TESTSET, /**< test-then-set option */
91 NC_RPC_EDIT_TESTOPT_SET, /**< set option */
92 NC_RPC_EDIT_TESTOPT_TEST /**< test-only option */
Michal Vasko7bcb48e2016-01-15 10:28:54 +010093} NC_RPC_EDIT_TESTOPT;
94
Michal Vaskof0537d82016-01-29 14:42:38 +010095/**
96 * @brief Enumeration of \<edit-config\> error option
97 */
Michal Vasko7bcb48e2016-01-15 10:28:54 +010098typedef enum {
Michal Vaskof0537d82016-01-29 14:42:38 +010099 NC_RPC_EDIT_ERROPT_UNKNOWN = 0, /**< unknown error option */
100 NC_RPC_EDIT_ERROPT_STOP, /**< stop-on-error option */
101 NC_RPC_EDIT_ERROPT_CONTINUE, /**< continue-on-error option */
102 NC_RPC_EDIT_ERROPT_ROLLBACK /**< rollback-on-error option */
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100103} NC_RPC_EDIT_ERROPT;
104
105/**
106 * @brief NETCONF error structure representation
107 */
108struct nc_err {
Radek Krejci6799a052017-05-19 14:23:23 +0200109 /** @brief \<error-type\>, error layer where the error occurred. */
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100110 const char *type;
Radek Krejci6799a052017-05-19 14:23:23 +0200111 /** @brief \<error-tag\>. */
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100112 const char *tag;
Radek Krejci6799a052017-05-19 14:23:23 +0200113 /** @brief \<error-severity\>. */
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100114 const char *severity;
Radek Krejci6799a052017-05-19 14:23:23 +0200115 /** @brief \<error-app-tag\>, the data-model-specific or implementation-specific error condition, if one exists. */
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100116 const char *apptag;
Radek Krejci6799a052017-05-19 14:23:23 +0200117 /** @brief \<error-path\>, XPATH expression identifying the element with the error. */
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100118 const char *path;
Radek Krejci6799a052017-05-19 14:23:23 +0200119 /** @brief \<error-message\>, Human-readable description of the error. */
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100120 const char *message;
Radek Krejci6799a052017-05-19 14:23:23 +0200121 /** @brief xml:lang attribute of the error-message. */
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100122 const char *message_lang;
123
124 /* <error-info> */
125
Radek Krejci6799a052017-05-19 14:23:23 +0200126 /** @brief \<session-id\>, session ID of the session holding the requested lock. Part of \<error-info\>. */
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100127 const char *sid;
Radek Krejci6799a052017-05-19 14:23:23 +0200128 /** @brief \<bad-attr\>, array of the names of the data-model-specific XML attributes that caused the error. Part of \<error-info\>. */
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100129 const char **attr;
Radek Krejci6799a052017-05-19 14:23:23 +0200130 /** @brief \<bad-element\>, array of the names of the data-model-specific XML element that caused the error. Part of \<error-info\>. */
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100131 const char **elem;
Radek Krejci6799a052017-05-19 14:23:23 +0200132 /** @brief \<bad-namespace\>, array of the unexpected XML namespaces that caused the error. Part of \<error-info\>. */
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100133 const char **ns;
Michal Vasko77367452021-02-16 16:32:18 +0100134 /** @brief List of the remaining non-standard opaque nodes. */
135 struct lyd_node *other;
Radek Krejci6799a052017-05-19 14:23:23 +0200136
137 /** @brief Number of items in the attr array */
138 uint16_t attr_count;
139 /** @brief Number of items in the elem array */
140 uint16_t elem_count;
141 /** @brief Number of items in the ns array */
142 uint16_t ns_count;
143 /** @brief Number of items in the other array */
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100144 uint16_t other_count;
145};
146
147/**
Michal Vasko96f247a2021-03-15 13:32:10 +0100148 * @struct nc_rpc
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100149 * @brief NETCONF client RPC object
Michal Vasko96f247a2021-03-15 13:32:10 +0100150 *
151 * Note that any stored parameters are not checked for validity because it is performed later,
152 * while sending the RPC via a specific NETCONF session (::nc_send_rpc()) since the NETCONF
153 * capabilities of the session are needed for such a check. An RPC object can be sent via any
154 * NETCONF session which supports all the needed NETCONF capabilities for the RPC.
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100155 */
156struct nc_rpc;
157
Michal Vasko1a38c862016-01-15 15:50:07 +0100158/**
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100159 * @brief Get the type of the RPC
160 *
161 * @param[in] rpc RPC to check the type of.
162 * @return Type of \p rpc.
163 */
164NC_RPC_TYPE nc_rpc_get_type(const struct nc_rpc *rpc);
165
166/**
Michal Vasko90e8e692016-07-13 12:27:57 +0200167 * @brief Create a generic NETCONF RPC or action
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100168 *
169 * Note that created object can be sent via any NETCONF session that shares the context
170 * of the \p data.
171 *
172 * @param[in] data NETCONF RPC data as a data tree.
173 * @param[in] paramtype How to further manage data parameters.
174 * @return Created RPC object to send via a NETCONF session or NULL in case of (memory allocation) error.
175 */
Michal Vasko90e8e692016-07-13 12:27:57 +0200176struct nc_rpc *nc_rpc_act_generic(const struct lyd_node *data, NC_PARAMTYPE paramtype);
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100177
178/**
Michal Vasko90e8e692016-07-13 12:27:57 +0200179 * @brief Create a generic NETCONF RPC or action from an XML string
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100180 *
Michal Vasko96f247a2021-03-15 13:32:10 +0100181 * For details, see ::nc_rpc.
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100182 *
183 * @param[in] xml_str NETCONF RPC data as an XML string.
184 * @param[in] paramtype How to further manage data parameters.
185 * @return Created RPC object to send via a NETCONF session or NULL in case of (memory allocation) error.
186 */
Michal Vasko90e8e692016-07-13 12:27:57 +0200187struct nc_rpc *nc_rpc_act_generic_xml(const char *xml_str, NC_PARAMTYPE paramtype);
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100188
189/**
190 * @brief Create NETCONF RPC \<get-config\>
191 *
Michal Vasko96f247a2021-03-15 13:32:10 +0100192 * For details, see ::nc_rpc.
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100193 *
194 * @param[in] source Source datastore being queried.
Michal Vaskoc2389702017-08-09 10:16:49 +0200195 * @param[in] filter Optional filter data, an XML subtree or XPath expression (with JSON prefixes).
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100196 * @param[in] wd_mode Optional with-defaults capability mode.
197 * @param[in] paramtype How to further manage data parameters.
198 * @return Created RPC object to send via a NETCONF session or NULL in case of (memory allocation) error.
199 */
200struct nc_rpc *nc_rpc_getconfig(NC_DATASTORE source, const char *filter, NC_WD_MODE wd_mode,
Michal Vasko96f247a2021-03-15 13:32:10 +0100201 NC_PARAMTYPE paramtype);
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100202
203/**
204 * @brief Create NETCONF RPC \<edit-config\>
205 *
Michal Vasko96f247a2021-03-15 13:32:10 +0100206 * For details, see ::nc_rpc.
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100207 *
208 * @param[in] target Target datastore being edited.
209 * @param[in] default_op Optional default operation.
210 * @param[in] test_opt Optional test option.
211 * @param[in] error_opt Optional error option.
212 * @param[in] edit_content Config or URL where the config to perform is to be found.
213 * @param[in] paramtype How to further manage data parameters.
214 * @return Created RPC object to send via a NETCONF session or NULL in case of (memory allocation) error.
215 */
216struct nc_rpc *nc_rpc_edit(NC_DATASTORE target, NC_RPC_EDIT_DFLTOP default_op, NC_RPC_EDIT_TESTOPT test_opt,
Michal Vasko96f247a2021-03-15 13:32:10 +0100217 NC_RPC_EDIT_ERROPT error_opt, const char *edit_content, NC_PARAMTYPE paramtype);
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100218
219/**
220 * @brief Create NETCONF RPC \<copy-config\>
221 *
Michal Vasko96f247a2021-03-15 13:32:10 +0100222 * For details, see ::nc_rpc.
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100223 *
224 * @param[in] target Target datastore.
225 * @param[in] url_trg Used instead \p target if the target is an URL.
226 * @param[in] source Source datastore.
227 * @param[in] url_or_config_src Used instead \p source if the source is an URL or a config.
228 * @param[in] wd_mode Optional with-defaults capability mode.
229 * @param[in] paramtype How to further manage data parameters.
230 * @return Created RPC object to send via a NETCONF session or NULL in case of (memory allocation) error.
231 */
232struct nc_rpc *nc_rpc_copy(NC_DATASTORE target, const char *url_trg, NC_DATASTORE source,
Michal Vasko96f247a2021-03-15 13:32:10 +0100233 const char *url_or_config_src, NC_WD_MODE wd_mode, NC_PARAMTYPE paramtype);
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100234
235/**
236 * @brief Create NETCONF RPC \<delete-config\>
237 *
Michal Vasko96f247a2021-03-15 13:32:10 +0100238 * For details, see ::nc_rpc.
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100239 *
240 * @param[in] target Target datastore to delete.
241 * @param[in] url Used instead \p target if the target is an URL.
242 * @param[in] paramtype How to further manage data parameters.
243 * @return Created RPC object to send via a NETCONF session or NULL in case of (memory allocation) error.
244 */
245struct nc_rpc *nc_rpc_delete(NC_DATASTORE target, const char *url, NC_PARAMTYPE paramtype);
246
247/**
248 * @brief Create NETCONF RPC \<lock\>
249 *
Michal Vasko96f247a2021-03-15 13:32:10 +0100250 * For details, see ::nc_rpc.
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100251 *
252 * @param[in] target Target datastore of the operation.
253 * @return Created RPC object to send via a NETCONF session or NULL in case of (memory allocation) error.
254 */
255struct nc_rpc *nc_rpc_lock(NC_DATASTORE target);
256
257/**
258 * @brief Create NETCONF RPC \<unlock\>
259 *
Michal Vasko96f247a2021-03-15 13:32:10 +0100260 * For details, see ::nc_rpc.
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100261 *
262 * @param[in] target Target datastore of the operation.
263 * @return Created RPC object to send via a NETCONF session or NULL in case of (memory allocation) error.
264 */
265struct nc_rpc *nc_rpc_unlock(NC_DATASTORE target);
266
267/**
268 * @brief Create NETCONF RPC \<get\>
269 *
Michal Vasko96f247a2021-03-15 13:32:10 +0100270 * For details, see ::nc_rpc.
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100271 *
Michal Vaskoc2389702017-08-09 10:16:49 +0200272 * @param[in] filter Optional filter data, an XML subtree or XPath expression (with JSON prefixes).
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100273 * @param[in] wd_mode Optional with-defaults capability mode.
274 * @param[in] paramtype How to further manage data parameters.
275 * @return Created RPC object to send via a NETCONF session or NULL in case of (memory allocation) error.
276 */
277struct nc_rpc *nc_rpc_get(const char *filter, NC_WD_MODE wd_mode, NC_PARAMTYPE paramtype);
278
279/**
280 * @brief Create NETCONF RPC \<kill-session\>
281 *
Michal Vasko96f247a2021-03-15 13:32:10 +0100282 * For details, see ::nc_rpc.
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100283 *
284 * @param[in] session_id Session ID of the session to kill.
285 * @return Created RPC object to send via a NETCONF session or NULL in case of (memory allocation) error.
286 */
287struct nc_rpc *nc_rpc_kill(uint32_t session_id);
288
289/**
290 * @brief Create NETCONF RPC \<commit\>
291 *
Michal Vasko96f247a2021-03-15 13:32:10 +0100292 * For details, see ::nc_rpc.
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100293 *
294 * @param[in] confirmed Whether the commit is to be confirmed.
295 * @param[in] confirm_timeout Optional confirm timeout.
296 * @param[in] persist Optional identification string of a new persistent confirmed commit.
297 * @param[in] persist_id Optional identification string of a persistent confirmed commit to be commited.
298 * @param[in] paramtype How to further manage data parameters.
299 * @return Created RPC object to send via a NETCONF session or NULL in case of (memory allocation) error.
300 */
301struct nc_rpc *nc_rpc_commit(int confirmed, uint32_t confirm_timeout, const char *persist, const char *persist_id,
Michal Vasko96f247a2021-03-15 13:32:10 +0100302 NC_PARAMTYPE paramtype);
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100303
304/**
305 * @brief Create NETCONF RPC \<discard-changes\>
306 *
Michal Vasko96f247a2021-03-15 13:32:10 +0100307 * For details, see ::nc_rpc.
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100308 *
309 * @return Created RPC object to send via a NETCONF session or NULL in case of (memory allocation) error.
310 */
311struct nc_rpc *nc_rpc_discard(void);
312
313/**
314 * @brief Create NETCONF RPC \<cancel-commit\>
315 *
Michal Vasko96f247a2021-03-15 13:32:10 +0100316 * For details, see ::nc_rpc.
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100317 *
318 * @param[in] persist_id Optional identification string of a persistent confirmed commit.
319 * @param[in] paramtype How to further manage data parameters.
320 * @return Created RPC object to send via a NETCONF session or NULL in case of (memory allocation) error.
321 */
322struct nc_rpc *nc_rpc_cancel(const char *persist_id, NC_PARAMTYPE paramtype);
323
324/**
325 * @brief Create NETCONF RPC \<validate\>
326 *
Michal Vasko96f247a2021-03-15 13:32:10 +0100327 * For details, see ::nc_rpc.
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100328 *
329 * @param[in] source Source datastore being validated.
Michal Vasko4aade752016-02-18 13:24:38 +0100330 * @param[in] url_or_config Used instead \p source if the source is an URL or a config.
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100331 * @param[in] paramtype How to further manage data parameters.
332 * @return Created RPC object to send via a NETCONF session or NULL in case of (memory allocation) error.
333 */
334struct nc_rpc *nc_rpc_validate(NC_DATASTORE source, const char *url_or_config, NC_PARAMTYPE paramtype);
335
336/**
337 * @brief Create NETCONF RPC \<get-schema\>
338 *
Michal Vasko96f247a2021-03-15 13:32:10 +0100339 * For details, see ::nc_rpc.
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100340 *
341 * @param[in] identifier Requested model identifier.
342 * @param[in] version Optional model version, either YANG version (1.0/1.1) or revision date.
343 * @param[in] format Optional format of the model (default is YANG).
344 * @param[in] paramtype How to further manage data parameters.
345 * @return Created RPC object to send via a NETCONF session or NULL in case of (memory allocation) error.
346 */
347struct nc_rpc *nc_rpc_getschema(const char *identifier, const char *version, const char *format, NC_PARAMTYPE paramtype);
348
349/**
350 * @brief Create NETCONF RPC \<create-subscription\>
351 *
Michal Vasko96f247a2021-03-15 13:32:10 +0100352 * For details, see ::nc_rpc.
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100353 *
354 * @param[in] stream_name Optional name of a NETCONF stream to subscribe to.
Michal Vaskoc2389702017-08-09 10:16:49 +0200355 * @param[in] filter Optional filter data, an XML subtree or XPath expression (with JSON prefixes).
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100356 * @param[in] start_time Optional YANG datetime identifying the start of the subscription.
357 * @param[in] stop_time Optional YANG datetime identifying the end of the subscription.
358 * @param[in] paramtype How to further manage data parameters.
359 * @return Created RPC object to send via a NETCONF session or NULL in case of (memory allocation) error.
360 */
361struct nc_rpc *nc_rpc_subscribe(const char *stream_name, const char *filter, const char *start_time,
Michal Vasko96f247a2021-03-15 13:32:10 +0100362 const char *stop_time, NC_PARAMTYPE paramtype);
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100363
364/**
Michal Vaskoc1171a42019-11-05 12:06:46 +0100365 * @brief Create NETCONF RPC \<get-data\>
366 *
Michal Vasko96f247a2021-03-15 13:32:10 +0100367 * For details, see ::nc_rpc.
Michal Vaskoc1171a42019-11-05 12:06:46 +0100368 *
369 * @param[in] datastore Source datastore, foreign identity so a module name prefix is required.
370 * @param[in] filter Optional filter data, an XML subtree or XPath expression (with JSON prefixes).
371 * @param[in] config_filter Optional config filter, "true" for config-only data, "false" for state-only data.
372 * @param[in] origin_filter Optional origin filter array, selects only nodes of this or derived origin.
373 * @param[in] origin_filter_count Count of filters is \p origin_filter.
374 * @param[in] neg_origin_filter Whether origin filters are negated or not.
375 * @param[in] max_depth Maximum depth of returned subtrees, 0 for unlimited.
376 * @param[in] with_origin Whether return data origin.
377 * @param[in] wd_mode Optional with-defaults capability mode.
378 * @param[in] paramtype How to further manage data parameters.
379 * @return Created RPC object to send via a NETCONF session or NULL in case of (memory allocation) error.
380 */
381struct nc_rpc *nc_rpc_getdata(const char *datastore, const char *filter, const char *config_filter, char **origin_filter,
Michal Vasko96f247a2021-03-15 13:32:10 +0100382 int origin_filter_count, int neg_origin_filter, uint16_t max_depth, int with_origin, NC_WD_MODE wd_mode,
383 NC_PARAMTYPE paramtype);
Michal Vaskoc1171a42019-11-05 12:06:46 +0100384
385/**
386 * @brief Create NETCONF RPC \<get-data\>
387 *
Michal Vasko96f247a2021-03-15 13:32:10 +0100388 * For details, see ::nc_rpc.
Michal Vaskoc1171a42019-11-05 12:06:46 +0100389 *
390 * @param[in] datastore Source datastore, foreign identity so a module name prefix is required.
391 * @param[in] default_op Optional default operation.
392 * @param[in] edit_content Config or URL where the config to perform is to be found.
393 * @param[in] paramtype How to further manage data parameters.
394 * @return Created RPC object to send via a NETCONF session or NULL in case of (memory allocation) error.
395 */
396struct nc_rpc *nc_rpc_editdata(const char *datastore, NC_RPC_EDIT_DFLTOP default_op, const char *edit_content,
Michal Vasko96f247a2021-03-15 13:32:10 +0100397 NC_PARAMTYPE paramtype);
398
399/**
400 * @brief Create NETCONF RPC \<establish-subscription\>
401 *
402 * For details, see ::nc_rpc.
403 *
404 * @param[in] filter Optional filter data, an XML subtree, XPath expression (with JSON prefixes),
405 * or filter reference, selected based on the first character.
406 * @param[in] stream_name Name of a NETCONF stream to subscribe to.
407 * @param[in] start_time Optional YANG datetime identifying the start of the subscription.
408 * @param[in] stop_time Optional YANG datetime identifying the end of the subscription.
409 * @param[in] encoding Optional specific encoding to use.
410 * @param[in] paramtype How to further manage data parameters.
411 * @return Created RPC object to send via a NETCONF session or NULL in case of (memory allocation) error.
412 */
413struct nc_rpc *nc_rpc_establishsub(const char *filter, const char *stream_name, const char *start_time,
414 const char *stop_time, const char *encoding, NC_PARAMTYPE paramtype);
415
416/**
417 * @brief Create NETCONF RPC \<modify-subscription\>
418 *
419 * For details, see ::nc_rpc.
420 *
421 * @param[in] id Subscription ID to modify.
422 * @param[in] filter Optional new filter data, an XML subtree, XPath expression (with JSON prefixes),
423 * or filter reference, selected based on the first character.
424 * @param[in] stop_time Optional new YANG datetime identifying the end of the subscription.
425 * @param[in] paramtype How to further manage data parameters.
426 * @return Created RPC object to send via a NETCONF session or NULL in case of (memory allocation) error.
427 */
428struct nc_rpc *nc_rpc_modifysub(uint32_t id, const char *filter, const char *stop_time, NC_PARAMTYPE paramtype);
429
430/**
431 * @brief Create NETCONF RPC \<delete-subscription\>
432 *
433 * For details, see ::nc_rpc.
434 *
435 * @param[in] id Subscription ID to delete.
436 * @return Created RPC object to send via a NETCONF session or NULL in case of (memory allocation) error.
437 */
438struct nc_rpc *nc_rpc_deletesub(uint32_t id);
439
440/**
441 * @brief Create NETCONF RPC \<kill-subscription\>
442 *
443 * For details, see ::nc_rpc.
444 *
445 * @param[in] id Subscription ID to kill.
446 * @return Created RPC object to send via a NETCONF session or NULL in case of (memory allocation) error.
447 */
448struct nc_rpc *nc_rpc_killsub(uint32_t id);
Michal Vaskoc1171a42019-11-05 12:06:46 +0100449
450/**
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100451 * @brief Free the NETCONF RPC object.
Michal Vaskof0537d82016-01-29 14:42:38 +0100452 *
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100453 * @param[in] rpc Object to free.
454 */
455void nc_rpc_free(struct nc_rpc *rpc);
456
Michal Vasko77367452021-02-16 16:32:18 +0100457/** @} Client Messages */
Radek Krejci6799a052017-05-19 14:23:23 +0200458
Michal Vaskoc09730e2019-01-17 10:07:26 +0100459#ifdef __cplusplus
460}
461#endif
462
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100463#endif /* NC_MESSAGES_CLIENT_H_ */