blob: 2217109c154629c1cec8c7a674552b1ff6dac7fe [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
19#include <stdint.h>
20
21#include "netconf.h"
22
Michal Vaskof0537d82016-01-29 14:42:38 +010023/**
Radek Krejci6799a052017-05-19 14:23:23 +020024 * @defgroup client_msg Client Messages
25 * @ingroup client
26 *
27 * @brief Functions to create NETCONF RPCs (or actions) and process replies received from the server.
28 * @{
29 */
30
31/**
Michal Vaskof0537d82016-01-29 14:42:38 +010032 * @brief Enumeration of RPC types
Radek Krejci6799a052017-05-19 14:23:23 +020033 *
34 * 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 +010035 */
Michal Vasko7bcb48e2016-01-15 10:28:54 +010036typedef enum {
Michal Vasko7f1c78b2016-01-19 09:52:14 +010037 NC_RPC_UNKNOWN = 0, /**< invalid RPC. */
Michal Vasko90e8e692016-07-13 12:27:57 +020038 NC_RPC_ACT_GENERIC, /**< user-defined generic RPC/action. */
Michal Vasko7bcb48e2016-01-15 10:28:54 +010039
40 /* ietf-netconf */
41 NC_RPC_GETCONFIG, /**< \<get-config\> RPC. */
42 NC_RPC_EDIT, /**< \<edit-config\> RPC. */
43 NC_RPC_COPY, /**< \<copy-config\> RPC. */
44 NC_RPC_DELETE, /**< \<delete-config\> RPC. */
45 NC_RPC_LOCK, /**< \<lock\> RPC. */
46 NC_RPC_UNLOCK, /**< \<unlock\> RPC. */
47 NC_RPC_GET, /**< \<get\> RPC. */
Michal Vasko7bcb48e2016-01-15 10:28:54 +010048 NC_RPC_KILL, /**< \<kill-session\> RPC. */
49 NC_RPC_COMMIT, /**< \<commit\> RPC. */
50 NC_RPC_DISCARD, /**< \<discard-changes\> RPC. */
51 NC_RPC_CANCEL, /**< \<cancel-commit\> RPC. */
52 NC_RPC_VALIDATE, /**< \<validate\> RPC. */
53
54 /* ietf-netconf-monitoring */
55 NC_RPC_GETSCHEMA, /**< \<get-schema\> RPC. */
56
57 /* notifications */
58 NC_RPC_SUBSCRIBE /**< \<create-subscription\> RPC. */
59} NC_RPC_TYPE;
60
Michal Vaskof0537d82016-01-29 14:42:38 +010061/**
62 * @brief Enumeration of \<edit-config\> default operation
63 */
Michal Vasko7bcb48e2016-01-15 10:28:54 +010064typedef enum {
Michal Vaskof0537d82016-01-29 14:42:38 +010065 NC_RPC_EDIT_DFLTOP_UNKNOWN = 0, /**< unknown default operation */
66 NC_RPC_EDIT_DFLTOP_MERGE, /**< default operation merge */
67 NC_RPC_EDIT_DFLTOP_REPLACE, /**< default operation replace */
68 NC_RPC_EDIT_DFLTOP_NONE /**< default operation none */
Michal Vasko7bcb48e2016-01-15 10:28:54 +010069} NC_RPC_EDIT_DFLTOP;
70
Michal Vaskof0537d82016-01-29 14:42:38 +010071/**
72 * @brief Enumeration of \<edit-config\> test option
73 */
Michal Vasko7bcb48e2016-01-15 10:28:54 +010074typedef enum {
Michal Vaskof0537d82016-01-29 14:42:38 +010075 NC_RPC_EDIT_TESTOPT_UNKNOWN = 0, /**< unknown test option */
76 NC_RPC_EDIT_TESTOPT_TESTSET, /**< test-then-set option */
77 NC_RPC_EDIT_TESTOPT_SET, /**< set option */
78 NC_RPC_EDIT_TESTOPT_TEST /**< test-only option */
Michal Vasko7bcb48e2016-01-15 10:28:54 +010079} NC_RPC_EDIT_TESTOPT;
80
Michal Vaskof0537d82016-01-29 14:42:38 +010081/**
82 * @brief Enumeration of \<edit-config\> error option
83 */
Michal Vasko7bcb48e2016-01-15 10:28:54 +010084typedef enum {
Michal Vaskof0537d82016-01-29 14:42:38 +010085 NC_RPC_EDIT_ERROPT_UNKNOWN = 0, /**< unknown error option */
86 NC_RPC_EDIT_ERROPT_STOP, /**< stop-on-error option */
87 NC_RPC_EDIT_ERROPT_CONTINUE, /**< continue-on-error option */
88 NC_RPC_EDIT_ERROPT_ROLLBACK /**< rollback-on-error option */
Michal Vasko7bcb48e2016-01-15 10:28:54 +010089} NC_RPC_EDIT_ERROPT;
90
91/**
92 * @brief NETCONF error structure representation
93 */
94struct nc_err {
Radek Krejci6799a052017-05-19 14:23:23 +020095 /** @brief \<error-type\>, error layer where the error occurred. */
Michal Vasko7bcb48e2016-01-15 10:28:54 +010096 const char *type;
Radek Krejci6799a052017-05-19 14:23:23 +020097 /** @brief \<error-tag\>. */
Michal Vasko7bcb48e2016-01-15 10:28:54 +010098 const char *tag;
Radek Krejci6799a052017-05-19 14:23:23 +020099 /** @brief \<error-severity\>. */
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100100 const char *severity;
Radek Krejci6799a052017-05-19 14:23:23 +0200101 /** @brief \<error-app-tag\>, the data-model-specific or implementation-specific error condition, if one exists. */
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100102 const char *apptag;
Radek Krejci6799a052017-05-19 14:23:23 +0200103 /** @brief \<error-path\>, XPATH expression identifying the element with the error. */
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100104 const char *path;
Radek Krejci6799a052017-05-19 14:23:23 +0200105 /** @brief \<error-message\>, Human-readable description of the error. */
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100106 const char *message;
Radek Krejci6799a052017-05-19 14:23:23 +0200107 /** @brief xml:lang attribute of the error-message. */
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100108 const char *message_lang;
109
110 /* <error-info> */
111
Radek Krejci6799a052017-05-19 14:23:23 +0200112 /** @brief \<session-id\>, session ID of the session holding the requested lock. Part of \<error-info\>. */
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100113 const char *sid;
Radek Krejci6799a052017-05-19 14:23:23 +0200114 /** @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 +0100115 const char **attr;
Radek Krejci6799a052017-05-19 14:23:23 +0200116 /** @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 +0100117 const char **elem;
Radek Krejci6799a052017-05-19 14:23:23 +0200118 /** @brief \<bad-namespace\>, array of the unexpected XML namespaces that caused the error. Part of \<error-info\>. */
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100119 const char **ns;
Radek Krejci6799a052017-05-19 14:23:23 +0200120 /** @brief Array of the remaining non-standard elements. */
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100121 struct lyxml_elem **other;
Radek Krejci6799a052017-05-19 14:23:23 +0200122
123 /** @brief Number of items in the attr array */
124 uint16_t attr_count;
125 /** @brief Number of items in the elem array */
126 uint16_t elem_count;
127 /** @brief Number of items in the ns array */
128 uint16_t ns_count;
129 /** @brief Number of items in the other array */
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100130 uint16_t other_count;
131};
132
133/**
134 * @brief NETCONF client RPC object
135 */
136struct nc_rpc;
137
Michal Vasko1a38c862016-01-15 15:50:07 +0100138/**
139 * @brief NETCONF client rpc-reply object
140 */
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100141struct nc_reply {
Michal Vaskof0537d82016-01-29 14:42:38 +0100142 NC_RPL type; /**< reply type */
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100143};
144
Michal Vasko1a38c862016-01-15 15:50:07 +0100145/**
146 * @brief NETCONF client data rpc-reply object
147 */
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100148struct nc_reply_data {
Michal Vasko12257e92016-11-22 09:30:37 +0100149 NC_RPL type; /**< NC_RPL_DATA */
Michal Vasko4a73f342016-11-22 09:32:10 +0100150 struct lyd_node *data; /**< libyang RPC reply data tree (output of an RPC),
Michal Vasko12257e92016-11-22 09:30:37 +0100151 \<get\> and \<get-config\> replies are special,
Michal Vasko1c042702018-11-29 08:27:51 +0100152 in those cases there is the configuration itself,
153 it should be validated as such (using \b LYD_OPT_GET or \b LYD_OPT_GETCONFIG),
154 and it can be NULL in a valid reply. */
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100155};
156
Michal Vasko1a38c862016-01-15 15:50:07 +0100157/**
158 * @brief NETCONF client error rpc-reply object
159 */
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100160struct nc_reply_error {
Michal Vasko1a38c862016-01-15 15:50:07 +0100161 NC_RPL type; /**< NC_RPL_ERROR */
162 const struct nc_err *err; /**< errors, any of the values inside can be NULL */
163 uint32_t count; /**< number of error structures */
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100164};
165
Michal Vasko1a38c862016-01-15 15:50:07 +0100166/**
167 * @brief NETCONF client notification object
168 */
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100169struct nc_notif {
170 NC_RPL type; /**< NC_RPL_NOTIF */
171 const char *datetime; /**< eventTime of the notification */
172 struct lyd_node *tree; /**< libyang data tree of the message */
173};
174
175/**
176 * @brief Get the type of the RPC
177 *
178 * @param[in] rpc RPC to check the type of.
179 * @return Type of \p rpc.
180 */
181NC_RPC_TYPE nc_rpc_get_type(const struct nc_rpc *rpc);
182
183/**
Michal Vasko90e8e692016-07-13 12:27:57 +0200184 * @brief Create a generic NETCONF RPC or action
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100185 *
186 * Note that created object can be sent via any NETCONF session that shares the context
187 * of the \p data.
188 *
189 * @param[in] data NETCONF RPC data as a data tree.
190 * @param[in] paramtype How to further manage data parameters.
191 * @return Created RPC object to send via a NETCONF session or NULL in case of (memory allocation) error.
192 */
Michal Vasko90e8e692016-07-13 12:27:57 +0200193struct nc_rpc *nc_rpc_act_generic(const struct lyd_node *data, NC_PARAMTYPE paramtype);
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100194
195/**
Michal Vasko90e8e692016-07-13 12:27:57 +0200196 * @brief Create a generic NETCONF RPC or action from an XML string
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100197 *
198 * Note that functions to create any RPC object do not check validity of the provided
199 * parameters. It is checked later while sending the RPC via a specific NETCONF session
Michal Vaskof0537d82016-01-29 14:42:38 +0100200 * (#nc_send_rpc()) since the NETCONF capabilities of the session are needed for such a
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100201 * check. Created object can be sent via any NETCONF session which supports all the
202 * needed NETCONF capabilities for the RPC.
203 *
204 * @param[in] xml_str NETCONF RPC data as an XML string.
205 * @param[in] paramtype How to further manage data parameters.
206 * @return Created RPC object to send via a NETCONF session or NULL in case of (memory allocation) error.
207 */
Michal Vasko90e8e692016-07-13 12:27:57 +0200208struct nc_rpc *nc_rpc_act_generic_xml(const char *xml_str, NC_PARAMTYPE paramtype);
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100209
210/**
211 * @brief Create NETCONF RPC \<get-config\>
212 *
213 * Note that functions to create any RPC object do not check validity of the provided
214 * parameters. It is checked later while sending the RPC via a specific NETCONF session
Michal Vaskof0537d82016-01-29 14:42:38 +0100215 * (#nc_send_rpc()) since the NETCONF capabilities of the session are needed for such a
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100216 * check. Created object can be sent via any NETCONF session which supports all the
217 * needed NETCONF capabilities for the RPC.
218 *
219 * @param[in] source Source datastore being queried.
Michal Vaskoc2389702017-08-09 10:16:49 +0200220 * @param[in] filter Optional filter data, an XML subtree or XPath expression (with JSON prefixes).
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100221 * @param[in] wd_mode Optional with-defaults capability mode.
222 * @param[in] paramtype How to further manage data parameters.
223 * @return Created RPC object to send via a NETCONF session or NULL in case of (memory allocation) error.
224 */
225struct nc_rpc *nc_rpc_getconfig(NC_DATASTORE source, const char *filter, NC_WD_MODE wd_mode,
226 NC_PARAMTYPE paramtype);
227
228/**
229 * @brief Create NETCONF RPC \<edit-config\>
230 *
231 * Note that functions to create any RPC object do not check validity of the provided
232 * parameters. It is checked later while sending the RPC via a specific NETCONF session
Michal Vaskof0537d82016-01-29 14:42:38 +0100233 * (#nc_send_rpc()) since the NETCONF capabilities of the session are needed for such a
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100234 * check. Created object can be sent via any NETCONF session which supports all the
235 * needed NETCONF capabilities for the RPC.
236 *
237 * @param[in] target Target datastore being edited.
238 * @param[in] default_op Optional default operation.
239 * @param[in] test_opt Optional test option.
240 * @param[in] error_opt Optional error option.
241 * @param[in] edit_content Config or URL where the config to perform is to be found.
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_edit(NC_DATASTORE target, NC_RPC_EDIT_DFLTOP default_op, NC_RPC_EDIT_TESTOPT test_opt,
246 NC_RPC_EDIT_ERROPT error_opt, const char *edit_content, NC_PARAMTYPE paramtype);
247
248/**
249 * @brief Create NETCONF RPC \<copy-config\>
250 *
251 * Note that functions to create any RPC object do not check validity of the provided
252 * parameters. It is checked later while sending the RPC via a specific NETCONF session
Michal Vaskof0537d82016-01-29 14:42:38 +0100253 * (#nc_send_rpc()) since the NETCONF capabilities of the session are needed for such a
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100254 * check. Created object can be sent via any NETCONF session which supports all the
255 * needed NETCONF capabilities for the RPC.
256 *
257 * @param[in] target Target datastore.
258 * @param[in] url_trg Used instead \p target if the target is an URL.
259 * @param[in] source Source datastore.
260 * @param[in] url_or_config_src Used instead \p source if the source is an URL or a config.
261 * @param[in] wd_mode Optional with-defaults capability mode.
262 * @param[in] paramtype How to further manage data parameters.
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_copy(NC_DATASTORE target, const char *url_trg, NC_DATASTORE source,
266 const char *url_or_config_src, NC_WD_MODE wd_mode, NC_PARAMTYPE paramtype);
267
268/**
269 * @brief Create NETCONF RPC \<delete-config\>
270 *
271 * Note that functions to create any RPC object do not check validity of the provided
272 * parameters. It is checked later while sending the RPC via a specific NETCONF session
Michal Vaskof0537d82016-01-29 14:42:38 +0100273 * (#nc_send_rpc()) since the NETCONF capabilities of the session are needed for such a
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100274 * check. Created object can be sent via any NETCONF session which supports all the
275 * needed NETCONF capabilities for the RPC.
276 *
277 * @param[in] target Target datastore to delete.
278 * @param[in] url Used instead \p target if the target is an URL.
279 * @param[in] paramtype How to further manage data parameters.
280 * @return Created RPC object to send via a NETCONF session or NULL in case of (memory allocation) error.
281 */
282struct nc_rpc *nc_rpc_delete(NC_DATASTORE target, const char *url, NC_PARAMTYPE paramtype);
283
284/**
285 * @brief Create NETCONF RPC \<lock\>
286 *
287 * Note that functions to create any RPC object do not check validity of the provided
288 * parameters. It is checked later while sending the RPC via a specific NETCONF session
Michal Vaskof0537d82016-01-29 14:42:38 +0100289 * (#nc_send_rpc()) since the NETCONF capabilities of the session are needed for such a
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100290 * check. Created object can be sent via any NETCONF session which supports all the
291 * needed NETCONF capabilities for the RPC.
292 *
293 * @param[in] target Target datastore of the operation.
294 * @return Created RPC object to send via a NETCONF session or NULL in case of (memory allocation) error.
295 */
296struct nc_rpc *nc_rpc_lock(NC_DATASTORE target);
297
298/**
299 * @brief Create NETCONF RPC \<unlock\>
300 *
301 * Note that functions to create any RPC object do not check validity of the provided
302 * parameters. It is checked later while sending the RPC via a specific NETCONF session
Michal Vaskof0537d82016-01-29 14:42:38 +0100303 * (#nc_send_rpc()) since the NETCONF capabilities of the session are needed for such a
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100304 * check. Created object can be sent via any NETCONF session which supports all the
305 * needed NETCONF capabilities for the RPC.
306 *
307 * @param[in] target Target datastore of the operation.
308 * @return Created RPC object to send via a NETCONF session or NULL in case of (memory allocation) error.
309 */
310struct nc_rpc *nc_rpc_unlock(NC_DATASTORE target);
311
312/**
313 * @brief Create NETCONF RPC \<get\>
314 *
315 * Note that functions to create any RPC object do not check validity of the provided
316 * parameters. It is checked later while sending the RPC via a specific NETCONF session
Michal Vaskof0537d82016-01-29 14:42:38 +0100317 * (#nc_send_rpc()) since the NETCONF capabilities of the session are needed for such a
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100318 * check. Created object can be sent via any NETCONF session which supports all the
319 * needed NETCONF capabilities for the RPC.
320 *
Michal Vaskoc2389702017-08-09 10:16:49 +0200321 * @param[in] filter Optional filter data, an XML subtree or XPath expression (with JSON prefixes).
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100322 * @param[in] wd_mode Optional with-defaults capability mode.
323 * @param[in] paramtype How to further manage data parameters.
324 * @return Created RPC object to send via a NETCONF session or NULL in case of (memory allocation) error.
325 */
326struct nc_rpc *nc_rpc_get(const char *filter, NC_WD_MODE wd_mode, NC_PARAMTYPE paramtype);
327
328/**
329 * @brief Create NETCONF RPC \<kill-session\>
330 *
331 * Note that functions to create any RPC object do not check validity of the provided
332 * parameters. It is checked later while sending the RPC via a specific NETCONF session
Michal Vaskof0537d82016-01-29 14:42:38 +0100333 * (#nc_send_rpc()) since the NETCONF capabilities of the session are needed for such a
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100334 * check. Created object can be sent via any NETCONF session which supports all the
335 * needed NETCONF capabilities for the RPC.
336 *
337 * @param[in] session_id Session ID of the session to kill.
338 * @return Created RPC object to send via a NETCONF session or NULL in case of (memory allocation) error.
339 */
340struct nc_rpc *nc_rpc_kill(uint32_t session_id);
341
342/**
343 * @brief Create NETCONF RPC \<commit\>
344 *
345 * Note that functions to create any RPC object do not check validity of the provided
346 * parameters. It is checked later while sending the RPC via a specific NETCONF session
Michal Vaskof0537d82016-01-29 14:42:38 +0100347 * (#nc_send_rpc()) since the NETCONF capabilities of the session are needed for such a
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100348 * check. Created object can be sent via any NETCONF session which supports all the
349 * needed NETCONF capabilities for the RPC.
350 *
351 * @param[in] confirmed Whether the commit is to be confirmed.
352 * @param[in] confirm_timeout Optional confirm timeout.
353 * @param[in] persist Optional identification string of a new persistent confirmed commit.
354 * @param[in] persist_id Optional identification string of a persistent confirmed commit to be commited.
355 * @param[in] paramtype How to further manage data parameters.
356 * @return Created RPC object to send via a NETCONF session or NULL in case of (memory allocation) error.
357 */
358struct nc_rpc *nc_rpc_commit(int confirmed, uint32_t confirm_timeout, const char *persist, const char *persist_id,
359 NC_PARAMTYPE paramtype);
360
361/**
362 * @brief Create NETCONF RPC \<discard-changes\>
363 *
364 * Note that functions to create any RPC object do not check validity of the provided
365 * parameters. It is checked later while sending the RPC via a specific NETCONF session
Michal Vaskof0537d82016-01-29 14:42:38 +0100366 * (#nc_send_rpc()) since the NETCONF capabilities of the session are needed for such a
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100367 * check. Created object can be sent via any NETCONF session which supports all the
368 * needed NETCONF capabilities for the RPC.
369 *
370 * @return Created RPC object to send via a NETCONF session or NULL in case of (memory allocation) error.
371 */
372struct nc_rpc *nc_rpc_discard(void);
373
374/**
375 * @brief Create NETCONF RPC \<cancel-commit\>
376 *
377 * Note that functions to create any RPC object do not check validity of the provided
378 * parameters. It is checked later while sending the RPC via a specific NETCONF session
Michal Vaskof0537d82016-01-29 14:42:38 +0100379 * (#nc_send_rpc()) since the NETCONF capabilities of the session are needed for such a
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100380 * check. Created object can be sent via any NETCONF session which supports all the
381 * needed NETCONF capabilities for the RPC.
382 *
383 * @param[in] persist_id Optional identification string of a persistent confirmed commit.
384 * @param[in] paramtype How to further manage data parameters.
385 * @return Created RPC object to send via a NETCONF session or NULL in case of (memory allocation) error.
386 */
387struct nc_rpc *nc_rpc_cancel(const char *persist_id, NC_PARAMTYPE paramtype);
388
389/**
390 * @brief Create NETCONF RPC \<validate\>
391 *
392 * Note that functions to create any RPC object do not check validity of the provided
393 * parameters. It is checked later while sending the RPC via a specific NETCONF session
Michal Vaskof0537d82016-01-29 14:42:38 +0100394 * (#nc_send_rpc()) since the NETCONF capabilities of the session are needed for such a
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100395 * check. Created object can be sent via any NETCONF session which supports all the
396 * needed NETCONF capabilities for the RPC.
397 *
398 * @param[in] source Source datastore being validated.
Michal Vasko4aade752016-02-18 13:24:38 +0100399 * @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 +0100400 * @param[in] paramtype How to further manage data parameters.
401 * @return Created RPC object to send via a NETCONF session or NULL in case of (memory allocation) error.
402 */
403struct nc_rpc *nc_rpc_validate(NC_DATASTORE source, const char *url_or_config, NC_PARAMTYPE paramtype);
404
405/**
406 * @brief Create NETCONF RPC \<get-schema\>
407 *
408 * Note that functions to create any RPC object do not check validity of the provided
409 * parameters. It is checked later while sending the RPC via a specific NETCONF session
Michal Vaskof0537d82016-01-29 14:42:38 +0100410 * (#nc_send_rpc()) since the NETCONF capabilities of the session are needed for such a
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100411 * check. Created object can be sent via any NETCONF session which supports all the
412 * needed NETCONF capabilities for the RPC.
413 *
414 * @param[in] identifier Requested model identifier.
415 * @param[in] version Optional model version, either YANG version (1.0/1.1) or revision date.
416 * @param[in] format Optional format of the model (default is YANG).
417 * @param[in] paramtype How to further manage data parameters.
418 * @return Created RPC object to send via a NETCONF session or NULL in case of (memory allocation) error.
419 */
420struct nc_rpc *nc_rpc_getschema(const char *identifier, const char *version, const char *format, NC_PARAMTYPE paramtype);
421
422/**
423 * @brief Create NETCONF RPC \<create-subscription\>
424 *
425 * Note that functions to create any RPC object do not check validity of the provided
426 * parameters. It is checked later while sending the RPC via a specific NETCONF session
Michal Vaskof0537d82016-01-29 14:42:38 +0100427 * (#nc_send_rpc()) since the NETCONF capabilities of the session are needed for such a
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100428 * check. Created object can be sent via any NETCONF session which supports all the
429 * needed NETCONF capabilities for the RPC.
430 *
431 * @param[in] stream_name Optional name of a NETCONF stream to subscribe to.
Michal Vaskoc2389702017-08-09 10:16:49 +0200432 * @param[in] filter Optional filter data, an XML subtree or XPath expression (with JSON prefixes).
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100433 * @param[in] start_time Optional YANG datetime identifying the start of the subscription.
434 * @param[in] stop_time Optional YANG datetime identifying the end of the subscription.
435 * @param[in] paramtype How to further manage data parameters.
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_subscribe(const char *stream_name, const char *filter, const char *start_time,
Michal Vasko12257e92016-11-22 09:30:37 +0100439 const char *stop_time, NC_PARAMTYPE paramtype);
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100440
441/**
442 * @brief Free the NETCONF RPC object.
Michal Vaskof0537d82016-01-29 14:42:38 +0100443 *
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100444 * @param[in] rpc Object to free.
445 */
446void nc_rpc_free(struct nc_rpc *rpc);
447
448/**
449 * @brief Free the NETCONF RPC reply object.
Michal Vaskof0537d82016-01-29 14:42:38 +0100450 *
451 * @param[in] reply Object to free.
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100452 */
453void nc_reply_free(struct nc_reply *reply);
454
Michal Vasko1a38c862016-01-15 15:50:07 +0100455/**
456 * @brief Free the NETCONF Notification object.
Michal Vaskof0537d82016-01-29 14:42:38 +0100457 *
458 * @param[in] notif Object to free.
Michal Vasko1a38c862016-01-15 15:50:07 +0100459 */
460void nc_notif_free(struct nc_notif *notif);
461
Radek Krejci6799a052017-05-19 14:23:23 +0200462/**@} Client Messages */
463
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100464#endif /* NC_MESSAGES_CLIENT_H_ */