Radek Krejci | 206fcd6 | 2015-10-07 15:42:48 +0200 | [diff] [blame] | 1 | /** |
| 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 Krejci | 4339024 | 2015-10-08 15:34:04 +0200 | [diff] [blame] | 28 | #include "messages.h" |
| 29 | |
Radek Krejci | 695d4fa | 2015-10-22 13:23:54 +0200 | [diff] [blame] | 30 | typedef 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 | |
| 44 | struct 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 Krejci | 206fcd6 | 2015-10-07 15:42:48 +0200 | [diff] [blame] | 50 | struct nc_rpc { |
Radek Krejci | 695d4fa | 2015-10-22 13:23:54 +0200 | [diff] [blame] | 51 | NC_RPC_TYPE type; |
| 52 | }; |
| 53 | |
| 54 | struct 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 Krejci | 926a574 | 2015-10-31 17:50:49 +0100 | [diff] [blame^] | 61 | struct nc_rpc_get { |
| 62 | NC_RPC_TYPE type; /**< NC_RPC_GET */ |
| 63 | struct nc_filter *filter;/**< data filter */ |
| 64 | }; |
| 65 | |
Radek Krejci | 695d4fa | 2015-10-22 13:23:54 +0200 | [diff] [blame] | 66 | struct 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 | |
| 72 | struct nc_rpc_lock { |
| 73 | NC_RPC_TYPE type; /**< NC_RPC_LOCK or NC_RPC_UNLOCK */ |
| 74 | NC_DATASTORE target; |
Radek Krejci | 206fcd6 | 2015-10-07 15:42:48 +0200 | [diff] [blame] | 75 | }; |
| 76 | |
Radek Krejci | 5686ff7 | 2015-10-09 13:33:56 +0200 | [diff] [blame] | 77 | struct nc_reply { |
Radek Krejci | a53b3fe | 2015-10-19 17:25:04 +0200 | [diff] [blame] | 78 | struct ly_ctx *ctx; |
Radek Krejci | 5686ff7 | 2015-10-09 13:33:56 +0200 | [diff] [blame] | 79 | struct lyxml_elem *root; |
| 80 | struct lyd_node *tree; /**< libyang data tree of the message */ |
| 81 | }; |
| 82 | |
| 83 | struct nc_notif { |
Radek Krejci | a53b3fe | 2015-10-19 17:25:04 +0200 | [diff] [blame] | 84 | struct ly_ctx *ctx; |
Radek Krejci | 5686ff7 | 2015-10-09 13:33:56 +0200 | [diff] [blame] | 85 | struct lyxml_elem *root; |
| 86 | struct lyd_node *tree; /**< libyang data tree of the message */ |
| 87 | }; |
| 88 | |
Radek Krejci | 206fcd6 | 2015-10-07 15:42:48 +0200 | [diff] [blame] | 89 | #endif /* NC_MESSAGES_P_H_ */ |