@@ -310,21 +310,29 @@ LIBYANG_API_DECL LY_ERR lyd_parse_ext_data(const struct lysc_ext_instance *ext,
310310 * @{
311311 */
312312enum lyd_type {
313- LYD_TYPE_DATA_YANG = 0 , /* generic YANG instance data */
314- LYD_TYPE_RPC_YANG , /* instance of a YANG RPC/action request with only "input" data children,
315- including all parents in case of an action */
316- LYD_TYPE_NOTIF_YANG , /* instance of a YANG notification, including all parents in case of a nested one */
317- LYD_TYPE_REPLY_YANG , /* instance of a YANG RPC/action reply with only "output" data children,
318- including all parents in case of an action */
313+ LYD_TYPE_DATA_YANG = 0 , /* generic YANG instance data */
314+ LYD_TYPE_RPC_YANG , /* instance of a YANG RPC/action request with only "input" data children,
315+ including all parents in case of an action */
316+ LYD_TYPE_NOTIF_YANG , /* instance of a YANG notification, including all parents in case of a nested one */
317+ LYD_TYPE_REPLY_YANG , /* instance of a YANG RPC/action reply with only "output" data children,
318+ including all parents in case of an action */
319319
320- LYD_TYPE_RPC_NETCONF , /* complete NETCONF RPC invocation as defined for
321- [RPC](https://tools.ietf.org/html/rfc7950#section-7.14.4) and
322- [action](https://tools.ietf.org/html/rfc7950#section-7.15.2) */
323- LYD_TYPE_NOTIF_NETCONF , /* complete NETCONF notification message as defined for
324- [notification](https://tools.ietf.org/html/rfc7950#section-7.16.2) */
325- LYD_TYPE_REPLY_NETCONF /* complete NETCONF RPC reply as defined for
326- [RPC](https://tools.ietf.org/html/rfc7950#section-7.14.4) and
327- [action](https://tools.ietf.org/html/rfc7950#section-7.15.2) */
320+ LYD_TYPE_RPC_NETCONF , /* complete NETCONF RPC invocation as defined for
321+ [RPC](https://tools.ietf.org/html/rfc7950#section-7.14.4) and
322+ [action](https://tools.ietf.org/html/rfc7950#section-7.15.2) */
323+ LYD_TYPE_NOTIF_NETCONF , /* complete NETCONF notification message as defined for
324+ [notification](https://tools.ietf.org/html/rfc7950#section-7.16.2) */
325+ LYD_TYPE_REPLY_NETCONF , /* complete NETCONF RPC reply as defined for
326+ [RPC](https://tools.ietf.org/html/rfc7950#section-7.14.4) and
327+ [action](https://tools.ietf.org/html/rfc7950#section-7.15.2) */
328+
329+ LYD_TYPE_RPC_RESTCONF , /* message-body of a RESTCONF operation input parameters
330+ ([ref](https://www.rfc-editor.org/rfc/rfc8040.html#section-3.6.1)) */
331+ LYD_TYPE_NOTIF_RESTCONF , /* RESTCONF JSON notification data
332+ ([ref](https://www.rfc-editor.org/rfc/rfc8040.html#section-6.4)), to parse
333+ a notification in XML, use ::LYD_TYPE_NOTIF_NETCONF */
334+ LYD_TYPE_REPLY_RESTCONF /* message-body of a RESTCONF operation output parameters
335+ ([ref](https://www.rfc-editor.org/rfc/rfc8040.html#section-3.6.2)) */
328336};
329337/** @} datatype */
330338
@@ -357,6 +365,28 @@ enum lyd_type {
357365 * - @p op - must be NULL, the reply is appended to the RPC;
358366 * Note that there are 3 kinds of NETCONF replies - ok, error, and data. Only data reply appends any nodes to the RPC.
359367 *
368+ * - ::LYD_TYPE_RPC_RESTCONF:
369+ * - @p parent - must be set, pointing to the invoked RPC operation (RPC or action) node;
370+ * - @p format - can be both ::LYD_JSON and ::LYD_XML;
371+ * - @p tree - must be provided, all the RESTCONF-specific JSON objects will be returned here as
372+ * a separate opaque data tree, even if the function fails, this may be returned;
373+ * - @p op - must be NULL, @p parent points to the operation;
374+ *
375+ * - ::LYD_TYPE_NOTIF_RESTCONF:
376+ * - @p parent - must be NULL, the whole notification is expected;
377+ * - @p format - must be ::LYD_JSON, XML-formatted notifications are parsed using ::LYD_TYPE_NOTIF_NETCONF;
378+ * - @p tree - must be provided, all the RESTCONF-specific JSON objects will be returned here as
379+ * a separate opaque data tree, even if the function fails, this may be returned;
380+ * - @p op - must be provided, the notification data tree itself will be returned here, pointing to the operation;
381+ *
382+ * - ::LYD_TYPE_REPLY_RESTCONF:
383+ * - @p parent - must be set, pointing to the invoked RPC operation (RPC or action) node;
384+ * - @p format - can be both ::LYD_JSON and ::LYD_XML;
385+ * - @p tree - must be provided, all the RESTCONF-specific JSON objects will be returned here as
386+ * a separate opaque data tree, even if the function fails, this may be returned;
387+ * - @p op - must be NULL, @p parent points to the operation;
388+ * Note that error reply should be parsed as 'yang-data' extension data.
389+ *
360390 * @param[in] ctx libyang context.
361391 * @param[in] parent Optional parent to connect the parsed nodes to.
362392 * @param[in] in Input handle to read the input from.
0 commit comments