blob: 1aa4fa60b36371c6131ba3aaa02ded07621c5fd7 [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/**
24 * @brief Enumeration of RPC types
25 */
Michal Vasko7bcb48e2016-01-15 10:28:54 +010026typedef enum {
Michal Vasko7f1c78b2016-01-19 09:52:14 +010027 NC_RPC_UNKNOWN = 0, /**< invalid RPC. */
Michal Vasko90e8e692016-07-13 12:27:57 +020028 NC_RPC_ACT_GENERIC, /**< user-defined generic RPC/action. */
Michal Vasko7bcb48e2016-01-15 10:28:54 +010029
30 /* ietf-netconf */
31 NC_RPC_GETCONFIG, /**< \<get-config\> RPC. */
32 NC_RPC_EDIT, /**< \<edit-config\> RPC. */
33 NC_RPC_COPY, /**< \<copy-config\> RPC. */
34 NC_RPC_DELETE, /**< \<delete-config\> RPC. */
35 NC_RPC_LOCK, /**< \<lock\> RPC. */
36 NC_RPC_UNLOCK, /**< \<unlock\> RPC. */
37 NC_RPC_GET, /**< \<get\> RPC. */
38 /* NC_RPC_CLOSE is not defined since sending \<close-session\> is done by nc_session_free() */
39 NC_RPC_KILL, /**< \<kill-session\> RPC. */
40 NC_RPC_COMMIT, /**< \<commit\> RPC. */
41 NC_RPC_DISCARD, /**< \<discard-changes\> RPC. */
42 NC_RPC_CANCEL, /**< \<cancel-commit\> RPC. */
43 NC_RPC_VALIDATE, /**< \<validate\> RPC. */
44
45 /* ietf-netconf-monitoring */
46 NC_RPC_GETSCHEMA, /**< \<get-schema\> RPC. */
47
48 /* notifications */
49 NC_RPC_SUBSCRIBE /**< \<create-subscription\> RPC. */
50} NC_RPC_TYPE;
51
Michal Vaskof0537d82016-01-29 14:42:38 +010052/**
53 * @brief Enumeration of \<edit-config\> default operation
54 */
Michal Vasko7bcb48e2016-01-15 10:28:54 +010055typedef enum {
Michal Vaskof0537d82016-01-29 14:42:38 +010056 NC_RPC_EDIT_DFLTOP_UNKNOWN = 0, /**< unknown default operation */
57 NC_RPC_EDIT_DFLTOP_MERGE, /**< default operation merge */
58 NC_RPC_EDIT_DFLTOP_REPLACE, /**< default operation replace */
59 NC_RPC_EDIT_DFLTOP_NONE /**< default operation none */
Michal Vasko7bcb48e2016-01-15 10:28:54 +010060} NC_RPC_EDIT_DFLTOP;
61
Michal Vaskof0537d82016-01-29 14:42:38 +010062/**
63 * @brief Enumeration of \<edit-config\> test option
64 */
Michal Vasko7bcb48e2016-01-15 10:28:54 +010065typedef enum {
Michal Vaskof0537d82016-01-29 14:42:38 +010066 NC_RPC_EDIT_TESTOPT_UNKNOWN = 0, /**< unknown test option */
67 NC_RPC_EDIT_TESTOPT_TESTSET, /**< test-then-set option */
68 NC_RPC_EDIT_TESTOPT_SET, /**< set option */
69 NC_RPC_EDIT_TESTOPT_TEST /**< test-only option */
Michal Vasko7bcb48e2016-01-15 10:28:54 +010070} NC_RPC_EDIT_TESTOPT;
71
Michal Vaskof0537d82016-01-29 14:42:38 +010072/**
73 * @brief Enumeration of \<edit-config\> error option
74 */
Michal Vasko7bcb48e2016-01-15 10:28:54 +010075typedef enum {
Michal Vaskof0537d82016-01-29 14:42:38 +010076 NC_RPC_EDIT_ERROPT_UNKNOWN = 0, /**< unknown error option */
77 NC_RPC_EDIT_ERROPT_STOP, /**< stop-on-error option */
78 NC_RPC_EDIT_ERROPT_CONTINUE, /**< continue-on-error option */
79 NC_RPC_EDIT_ERROPT_ROLLBACK /**< rollback-on-error option */
Michal Vasko7bcb48e2016-01-15 10:28:54 +010080} NC_RPC_EDIT_ERROPT;
81
82/**
83 * @brief NETCONF error structure representation
84 */
85struct nc_err {
86 /**
87 * @brief \<error-type\>, error layer where the error occurred.
88 */
89 const char *type;
90 /**
91 * @brief \<error-tag\>.
92 */
93 const char *tag;
94 /**
95 * @brief \<error-severity\>.
96 */
97 const char *severity;
98 /**
99 * @brief \<error-app-tag\>, the data-model-specific or implementation-specific error condition, if one exists.
100 */
101 const char *apptag;
102 /**
103 * @brief \<error-path\>, XPATH expression identifying the element with the error.
104 */
105 const char *path;
106 /**
107 * @brief \<error-message\>, Human-readable description of the error.
108 */
109 const char *message;
110 const char *message_lang;
111
112 /* <error-info> */
113
114 /**
115 * @brief \<session-id\>, session ID of the session holding the requested lock.
116 */
117 const char *sid;
118 /**
119 * @brief \<bad-attr\>, the name of the data-model-specific XML attribute that caused the error.
120 */
121 const char **attr;
122 uint16_t attr_count;
123 /**
124 * @brief \<bad-element\>, the name of the data-model-specific XML element that caused the error.
125 */
126 const char **elem;
127 uint16_t elem_count;
128 /**
129 * @brief \<bad-namespace\>, the name of the unexpected XML namespace that caused the error.
130 */
131 const char **ns;
132 uint16_t ns_count;
133 /**
134 * @brief Remaining non-standard elements.
135 */
136 struct lyxml_elem **other;
137 uint16_t other_count;
138};
139
140/**
141 * @brief NETCONF client RPC object
142 */
143struct nc_rpc;
144
Michal Vasko1a38c862016-01-15 15:50:07 +0100145/**
146 * @brief NETCONF client rpc-reply object
147 */
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100148struct nc_reply {
Michal Vaskof0537d82016-01-29 14:42:38 +0100149 NC_RPL type; /**< reply type */
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100150};
151
Michal Vasko1a38c862016-01-15 15:50:07 +0100152/**
153 * @brief NETCONF client data rpc-reply object
154 */
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100155struct nc_reply_data {
Michal Vasko12257e92016-11-22 09:30:37 +0100156 NC_RPL type; /**< NC_RPL_DATA */
157 struct lyd_node *reply; /**< libyang RPC reply data tree (output of an RPC),
158 \<get\> and \<get-config\> replies are special,
159 in those cases there is the configuration itself
160 and it should be validated as such (using #LYD_OPT_GET or #LYD_OPT_GETCONFIG. */
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100161};
162
Michal Vasko1a38c862016-01-15 15:50:07 +0100163/**
164 * @brief NETCONF client error rpc-reply object
165 */
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100166struct nc_reply_error {
Michal Vasko1a38c862016-01-15 15:50:07 +0100167 NC_RPL type; /**< NC_RPL_ERROR */
168 const struct nc_err *err; /**< errors, any of the values inside can be NULL */
169 uint32_t count; /**< number of error structures */
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100170};
171
Michal Vasko1a38c862016-01-15 15:50:07 +0100172/**
173 * @brief NETCONF client notification object
174 */
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100175struct nc_notif {
176 NC_RPL type; /**< NC_RPL_NOTIF */
177 const char *datetime; /**< eventTime of the notification */
178 struct lyd_node *tree; /**< libyang data tree of the message */
179};
180
181/**
182 * @brief Get the type of the RPC
183 *
184 * @param[in] rpc RPC to check the type of.
185 * @return Type of \p rpc.
186 */
187NC_RPC_TYPE nc_rpc_get_type(const struct nc_rpc *rpc);
188
189/**
Michal Vasko90e8e692016-07-13 12:27:57 +0200190 * @brief Create a generic NETCONF RPC or action
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100191 *
192 * Note that created object can be sent via any NETCONF session that shares the context
193 * of the \p data.
194 *
195 * @param[in] data NETCONF RPC data as a data tree.
196 * @param[in] paramtype How to further manage data parameters.
197 * @return Created RPC object to send via a NETCONF session or NULL in case of (memory allocation) error.
198 */
Michal Vasko90e8e692016-07-13 12:27:57 +0200199struct nc_rpc *nc_rpc_act_generic(const struct lyd_node *data, NC_PARAMTYPE paramtype);
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100200
201/**
Michal Vasko90e8e692016-07-13 12:27:57 +0200202 * @brief Create a generic NETCONF RPC or action from an XML string
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100203 *
204 * Note that functions to create any RPC object do not check validity of the provided
205 * parameters. It is checked later while sending the RPC via a specific NETCONF session
Michal Vaskof0537d82016-01-29 14:42:38 +0100206 * (#nc_send_rpc()) since the NETCONF capabilities of the session are needed for such a
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100207 * check. Created object can be sent via any NETCONF session which supports all the
208 * needed NETCONF capabilities for the RPC.
209 *
210 * @param[in] xml_str NETCONF RPC data as an XML string.
211 * @param[in] paramtype How to further manage data parameters.
212 * @return Created RPC object to send via a NETCONF session or NULL in case of (memory allocation) error.
213 */
Michal Vasko90e8e692016-07-13 12:27:57 +0200214struct nc_rpc *nc_rpc_act_generic_xml(const char *xml_str, NC_PARAMTYPE paramtype);
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100215
216/**
217 * @brief Create NETCONF RPC \<get-config\>
218 *
219 * Note that functions to create any RPC object do not check validity of the provided
220 * parameters. It is checked later while sending the RPC via a specific NETCONF session
Michal Vaskof0537d82016-01-29 14:42:38 +0100221 * (#nc_send_rpc()) since the NETCONF capabilities of the session are needed for such a
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100222 * check. Created object can be sent via any NETCONF session which supports all the
223 * needed NETCONF capabilities for the RPC.
224 *
225 * @param[in] source Source datastore being queried.
226 * @param[in] filter Optional filter data, an XML subtree or XPath expression.
227 * @param[in] wd_mode Optional with-defaults capability mode.
228 * @param[in] paramtype How to further manage data parameters.
229 * @return Created RPC object to send via a NETCONF session or NULL in case of (memory allocation) error.
230 */
231struct nc_rpc *nc_rpc_getconfig(NC_DATASTORE source, const char *filter, NC_WD_MODE wd_mode,
232 NC_PARAMTYPE paramtype);
233
234/**
235 * @brief Create NETCONF RPC \<edit-config\>
236 *
237 * Note that functions to create any RPC object do not check validity of the provided
238 * parameters. It is checked later while sending the RPC via a specific NETCONF session
Michal Vaskof0537d82016-01-29 14:42:38 +0100239 * (#nc_send_rpc()) since the NETCONF capabilities of the session are needed for such a
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100240 * check. Created object can be sent via any NETCONF session which supports all the
241 * needed NETCONF capabilities for the RPC.
242 *
243 * @param[in] target Target datastore being edited.
244 * @param[in] default_op Optional default operation.
245 * @param[in] test_opt Optional test option.
246 * @param[in] error_opt Optional error option.
247 * @param[in] edit_content Config or URL where the config to perform is to be found.
248 * @param[in] paramtype How to further manage data parameters.
249 * @return Created RPC object to send via a NETCONF session or NULL in case of (memory allocation) error.
250 */
251struct nc_rpc *nc_rpc_edit(NC_DATASTORE target, NC_RPC_EDIT_DFLTOP default_op, NC_RPC_EDIT_TESTOPT test_opt,
252 NC_RPC_EDIT_ERROPT error_opt, const char *edit_content, NC_PARAMTYPE paramtype);
253
254/**
255 * @brief Create NETCONF RPC \<copy-config\>
256 *
257 * Note that functions to create any RPC object do not check validity of the provided
258 * parameters. It is checked later while sending the RPC via a specific NETCONF session
Michal Vaskof0537d82016-01-29 14:42:38 +0100259 * (#nc_send_rpc()) since the NETCONF capabilities of the session are needed for such a
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100260 * check. Created object can be sent via any NETCONF session which supports all the
261 * needed NETCONF capabilities for the RPC.
262 *
263 * @param[in] target Target datastore.
264 * @param[in] url_trg Used instead \p target if the target is an URL.
265 * @param[in] source Source datastore.
266 * @param[in] url_or_config_src Used instead \p source if the source is an URL or a config.
267 * @param[in] wd_mode Optional with-defaults capability mode.
268 * @param[in] paramtype How to further manage data parameters.
269 * @return Created RPC object to send via a NETCONF session or NULL in case of (memory allocation) error.
270 */
271struct nc_rpc *nc_rpc_copy(NC_DATASTORE target, const char *url_trg, NC_DATASTORE source,
272 const char *url_or_config_src, NC_WD_MODE wd_mode, NC_PARAMTYPE paramtype);
273
274/**
275 * @brief Create NETCONF RPC \<delete-config\>
276 *
277 * Note that functions to create any RPC object do not check validity of the provided
278 * parameters. It is checked later while sending the RPC via a specific NETCONF session
Michal Vaskof0537d82016-01-29 14:42:38 +0100279 * (#nc_send_rpc()) since the NETCONF capabilities of the session are needed for such a
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100280 * check. Created object can be sent via any NETCONF session which supports all the
281 * needed NETCONF capabilities for the RPC.
282 *
283 * @param[in] target Target datastore to delete.
284 * @param[in] url Used instead \p target if the target is an URL.
285 * @param[in] paramtype How to further manage data parameters.
286 * @return Created RPC object to send via a NETCONF session or NULL in case of (memory allocation) error.
287 */
288struct nc_rpc *nc_rpc_delete(NC_DATASTORE target, const char *url, NC_PARAMTYPE paramtype);
289
290/**
291 * @brief Create NETCONF RPC \<lock\>
292 *
293 * Note that functions to create any RPC object do not check validity of the provided
294 * parameters. It is checked later while sending the RPC via a specific NETCONF session
Michal Vaskof0537d82016-01-29 14:42:38 +0100295 * (#nc_send_rpc()) since the NETCONF capabilities of the session are needed for such a
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100296 * check. Created object can be sent via any NETCONF session which supports all the
297 * needed NETCONF capabilities for the RPC.
298 *
299 * @param[in] target Target datastore of the operation.
300 * @return Created RPC object to send via a NETCONF session or NULL in case of (memory allocation) error.
301 */
302struct nc_rpc *nc_rpc_lock(NC_DATASTORE target);
303
304/**
305 * @brief Create NETCONF RPC \<unlock\>
306 *
307 * Note that functions to create any RPC object do not check validity of the provided
308 * parameters. It is checked later while sending the RPC via a specific NETCONF session
Michal Vaskof0537d82016-01-29 14:42:38 +0100309 * (#nc_send_rpc()) since the NETCONF capabilities of the session are needed for such a
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100310 * check. Created object can be sent via any NETCONF session which supports all the
311 * needed NETCONF capabilities for the RPC.
312 *
313 * @param[in] target Target datastore of the operation.
314 * @return Created RPC object to send via a NETCONF session or NULL in case of (memory allocation) error.
315 */
316struct nc_rpc *nc_rpc_unlock(NC_DATASTORE target);
317
318/**
319 * @brief Create NETCONF RPC \<get\>
320 *
321 * Note that functions to create any RPC object do not check validity of the provided
322 * parameters. It is checked later while sending the RPC via a specific NETCONF session
Michal Vaskof0537d82016-01-29 14:42:38 +0100323 * (#nc_send_rpc()) since the NETCONF capabilities of the session are needed for such a
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100324 * check. Created object can be sent via any NETCONF session which supports all the
325 * needed NETCONF capabilities for the RPC.
326 *
327 * @param[in] filter Optional filter data, an XML subtree or XPath expression.
328 * @param[in] wd_mode Optional with-defaults capability mode.
329 * @param[in] paramtype How to further manage data parameters.
330 * @return Created RPC object to send via a NETCONF session or NULL in case of (memory allocation) error.
331 */
332struct nc_rpc *nc_rpc_get(const char *filter, NC_WD_MODE wd_mode, NC_PARAMTYPE paramtype);
333
334/**
335 * @brief Create NETCONF RPC \<kill-session\>
336 *
337 * Note that functions to create any RPC object do not check validity of the provided
338 * parameters. It is checked later while sending the RPC via a specific NETCONF session
Michal Vaskof0537d82016-01-29 14:42:38 +0100339 * (#nc_send_rpc()) since the NETCONF capabilities of the session are needed for such a
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100340 * check. Created object can be sent via any NETCONF session which supports all the
341 * needed NETCONF capabilities for the RPC.
342 *
343 * @param[in] session_id Session ID of the session to kill.
344 * @return Created RPC object to send via a NETCONF session or NULL in case of (memory allocation) error.
345 */
346struct nc_rpc *nc_rpc_kill(uint32_t session_id);
347
348/**
349 * @brief Create NETCONF RPC \<commit\>
350 *
351 * Note that functions to create any RPC object do not check validity of the provided
352 * parameters. It is checked later while sending the RPC via a specific NETCONF session
Michal Vaskof0537d82016-01-29 14:42:38 +0100353 * (#nc_send_rpc()) since the NETCONF capabilities of the session are needed for such a
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100354 * check. Created object can be sent via any NETCONF session which supports all the
355 * needed NETCONF capabilities for the RPC.
356 *
357 * @param[in] confirmed Whether the commit is to be confirmed.
358 * @param[in] confirm_timeout Optional confirm timeout.
359 * @param[in] persist Optional identification string of a new persistent confirmed commit.
360 * @param[in] persist_id Optional identification string of a persistent confirmed commit to be commited.
361 * @param[in] paramtype How to further manage data parameters.
362 * @return Created RPC object to send via a NETCONF session or NULL in case of (memory allocation) error.
363 */
364struct nc_rpc *nc_rpc_commit(int confirmed, uint32_t confirm_timeout, const char *persist, const char *persist_id,
365 NC_PARAMTYPE paramtype);
366
367/**
368 * @brief Create NETCONF RPC \<discard-changes\>
369 *
370 * Note that functions to create any RPC object do not check validity of the provided
371 * parameters. It is checked later while sending the RPC via a specific NETCONF session
Michal Vaskof0537d82016-01-29 14:42:38 +0100372 * (#nc_send_rpc()) since the NETCONF capabilities of the session are needed for such a
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100373 * check. Created object can be sent via any NETCONF session which supports all the
374 * needed NETCONF capabilities for the RPC.
375 *
376 * @return Created RPC object to send via a NETCONF session or NULL in case of (memory allocation) error.
377 */
378struct nc_rpc *nc_rpc_discard(void);
379
380/**
381 * @brief Create NETCONF RPC \<cancel-commit\>
382 *
383 * Note that functions to create any RPC object do not check validity of the provided
384 * parameters. It is checked later while sending the RPC via a specific NETCONF session
Michal Vaskof0537d82016-01-29 14:42:38 +0100385 * (#nc_send_rpc()) since the NETCONF capabilities of the session are needed for such a
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100386 * check. Created object can be sent via any NETCONF session which supports all the
387 * needed NETCONF capabilities for the RPC.
388 *
389 * @param[in] persist_id Optional identification string of a persistent confirmed commit.
390 * @param[in] paramtype How to further manage data parameters.
391 * @return Created RPC object to send via a NETCONF session or NULL in case of (memory allocation) error.
392 */
393struct nc_rpc *nc_rpc_cancel(const char *persist_id, NC_PARAMTYPE paramtype);
394
395/**
396 * @brief Create NETCONF RPC \<validate\>
397 *
398 * Note that functions to create any RPC object do not check validity of the provided
399 * parameters. It is checked later while sending the RPC via a specific NETCONF session
Michal Vaskof0537d82016-01-29 14:42:38 +0100400 * (#nc_send_rpc()) since the NETCONF capabilities of the session are needed for such a
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100401 * check. Created object can be sent via any NETCONF session which supports all the
402 * needed NETCONF capabilities for the RPC.
403 *
404 * @param[in] source Source datastore being validated.
Michal Vasko4aade752016-02-18 13:24:38 +0100405 * @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 +0100406 * @param[in] paramtype How to further manage data parameters.
407 * @return Created RPC object to send via a NETCONF session or NULL in case of (memory allocation) error.
408 */
409struct nc_rpc *nc_rpc_validate(NC_DATASTORE source, const char *url_or_config, NC_PARAMTYPE paramtype);
410
411/**
412 * @brief Create NETCONF RPC \<get-schema\>
413 *
414 * Note that functions to create any RPC object do not check validity of the provided
415 * parameters. It is checked later while sending the RPC via a specific NETCONF session
Michal Vaskof0537d82016-01-29 14:42:38 +0100416 * (#nc_send_rpc()) since the NETCONF capabilities of the session are needed for such a
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100417 * check. Created object can be sent via any NETCONF session which supports all the
418 * needed NETCONF capabilities for the RPC.
419 *
420 * @param[in] identifier Requested model identifier.
421 * @param[in] version Optional model version, either YANG version (1.0/1.1) or revision date.
422 * @param[in] format Optional format of the model (default is YANG).
423 * @param[in] paramtype How to further manage data parameters.
424 * @return Created RPC object to send via a NETCONF session or NULL in case of (memory allocation) error.
425 */
426struct nc_rpc *nc_rpc_getschema(const char *identifier, const char *version, const char *format, NC_PARAMTYPE paramtype);
427
428/**
429 * @brief Create NETCONF RPC \<create-subscription\>
430 *
431 * Note that functions to create any RPC object do not check validity of the provided
432 * parameters. It is checked later while sending the RPC via a specific NETCONF session
Michal Vaskof0537d82016-01-29 14:42:38 +0100433 * (#nc_send_rpc()) since the NETCONF capabilities of the session are needed for such a
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100434 * check. Created object can be sent via any NETCONF session which supports all the
435 * needed NETCONF capabilities for the RPC.
436 *
437 * @param[in] stream_name Optional name of a NETCONF stream to subscribe to.
438 * @param[in] filter Optional filter data, an XML subtree or XPath expression.
439 * @param[in] start_time Optional YANG datetime identifying the start of the subscription.
440 * @param[in] stop_time Optional YANG datetime identifying the end of the subscription.
441 * @param[in] paramtype How to further manage data parameters.
442 * @return Created RPC object to send via a NETCONF session or NULL in case of (memory allocation) error.
443 */
444struct nc_rpc *nc_rpc_subscribe(const char *stream_name, const char *filter, const char *start_time,
Michal Vasko12257e92016-11-22 09:30:37 +0100445 const char *stop_time, NC_PARAMTYPE paramtype);
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100446
447/**
448 * @brief Free the NETCONF RPC object.
Michal Vaskof0537d82016-01-29 14:42:38 +0100449 *
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100450 * @param[in] rpc Object to free.
451 */
452void nc_rpc_free(struct nc_rpc *rpc);
453
454/**
455 * @brief Free the NETCONF RPC reply object.
Michal Vaskof0537d82016-01-29 14:42:38 +0100456 *
457 * @param[in] reply Object to free.
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100458 */
459void nc_reply_free(struct nc_reply *reply);
460
Michal Vasko1a38c862016-01-15 15:50:07 +0100461/**
462 * @brief Free the NETCONF Notification object.
Michal Vaskof0537d82016-01-29 14:42:38 +0100463 *
464 * @param[in] notif Object to free.
Michal Vasko1a38c862016-01-15 15:50:07 +0100465 */
466void nc_notif_free(struct nc_notif *notif);
467
Michal Vasko7bcb48e2016-01-15 10:28:54 +0100468#endif /* NC_MESSAGES_CLIENT_H_ */