blob: ee40d857d472f744d2a3a12f53db53c686d66acb [file] [log] [blame]
Radek Krejci206fcd62015-10-07 15:42:48 +02001/**
2 * \file messages_p.h
3 * \author Radek Krejci <rkrejci@cesnet.cz>
4 * \brief libnetconf2's private functions and structures of NETCONF messages.
5 *
6 * Copyright (c) 2015 CESNET, z.s.p.o.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in
15 * the documentation and/or other materials provided with the
16 * distribution.
17 * 3. Neither the name of the Company nor the names of its contributors
18 * may be used to endorse or promote products derived from this
19 * software without specific prior written permission.
20 *
21 */
22
23#ifndef NC_MESSAGES_P_H_
24#define NC_MESSAGES_P_H_
25
26#include <libyang/libyang.h>
27
Radek Krejci43390242015-10-08 15:34:04 +020028#include "messages.h"
29
Radek Krejci695d4fa2015-10-22 13:23:54 +020030typedef enum {
31 NC_RPC_SERVER, /**< server-side RPC object, see #nc_rpc_server. All other values define client-side RPC object. */
32 NC_RPC_GETCONFIG, /**< \<get-config\> RPC, see #nc_rpc_getconfig. */
33 NC_RPC_EDIT, /**< \<edit-config\> RPC, see #nc_rpc_edit. */
34 NC_RPC_COPY, /**< \<copy-config\> RPC, see #nc_rpc_copy. */
35 NC_RPC_DELETE, /**< \<delete-config\> RPC, see #nc_rpc_delete. */
36 NC_RPC_LOCK, /**< \<lock\> RPC, see #nc_rpc_lock. */
37 NC_RPC_UNLOCK, /**< \<unlock\> RPC, see #nc_rpc_lock. */
38 NC_RPC_GET, /**< \<get\> RPC, see #nc_rpc_get. */
39 /* NC_RPC_CLOSE is not defined since sending \<close-session\> is done by nc_session_free() */
40 NC_RPC_KILL, /**< \<kill-session\> RPC, see #nc_rpc_kill. */
41 NC_RPC_GENERIC /**< user-defined generic RPC */
42} NC_RPC_TYPE;
43
44struct nc_filter {
45 NC_FILTER type; /**< filter type */
46 int refs; /**< number of references */
47 char *data; /**< filter data according to type */
48};
49
Radek Krejci206fcd62015-10-07 15:42:48 +020050struct nc_rpc {
Radek Krejci695d4fa2015-10-22 13:23:54 +020051 NC_RPC_TYPE type;
52};
53
54struct nc_rpc_server {
55 NC_RPC_TYPE type; /**< NC_RPC_SERVER */
56 struct ly_ctx *ctx; /**< context of the received RPC data */
57 struct lyxml_elem *root; /**< RPC element of the received XML message */
58 struct lyd_node *tree; /**< libyang data tree of the message (NETCONF operation) */
59};
60
Radek Krejci926a5742015-10-31 17:50:49 +010061struct nc_rpc_get {
62 NC_RPC_TYPE type; /**< NC_RPC_GET */
63 struct nc_filter *filter;/**< data filter */
64};
65
Radek Krejci695d4fa2015-10-22 13:23:54 +020066struct nc_rpc_getconfig {
67 NC_RPC_TYPE type; /**< NC_RPC_GETCONFIG */
68 NC_DATASTORE source; /**< NETCONF datastore being queried */
69 struct nc_filter *filter;/**< data filter */
70};
71
72struct nc_rpc_lock {
73 NC_RPC_TYPE type; /**< NC_RPC_LOCK or NC_RPC_UNLOCK */
74 NC_DATASTORE target;
Radek Krejci206fcd62015-10-07 15:42:48 +020075};
76
Radek Krejci5686ff72015-10-09 13:33:56 +020077struct nc_reply {
Radek Krejcia53b3fe2015-10-19 17:25:04 +020078 struct ly_ctx *ctx;
Radek Krejci5686ff72015-10-09 13:33:56 +020079 struct lyxml_elem *root;
80 struct lyd_node *tree; /**< libyang data tree of the message */
81};
82
83struct nc_notif {
Radek Krejcia53b3fe2015-10-19 17:25:04 +020084 struct ly_ctx *ctx;
Radek Krejci5686ff72015-10-09 13:33:56 +020085 struct lyxml_elem *root;
86 struct lyd_node *tree; /**< libyang data tree of the message */
87};
88
Radek Krejci206fcd62015-10-07 15:42:48 +020089#endif /* NC_MESSAGES_P_H_ */