1 /*************************************************************************
3 * Copyright 2020 highstreet technologies GmbH and others
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 ***************************************************************************/
20 #define NC_ENABLED_SSH
21 #define NC_ENABLED_TLS
22 #include <libyang/libyang.h>
23 #include <libnetconf2/session.h>
24 #include <libnetconf2/session_client.h>
27 // void nc_client_init(void); --imported from libnetconf2, must be called on app init
28 // void nc_client_destroy(void); --imported from libnetconf2, must be called on app deinit
31 struct nc_session *session;
32 struct lyd_node *edit_batch_root;
37 nc_client_t *nc_client_ssh_connect(const char *host, uint16_t port, const char *username, const char *password);
38 nc_client_t *nc_client_tls_connect(const char *host, uint16_t port);
39 int nc_client_disconnect(nc_client_t *client);
41 struct lyd_node *nc_client_send_rpc(nc_client_t *client, struct lyd_node *data, int timeout);
43 struct lyd_node *nc_client_get_batch(nc_client_t *client, const char *xpath, int timeout);
44 int nc_client_edit_batch(nc_client_t *client, struct lyd_node *data, int timeout);
46 int nc_client_set_item_str(nc_client_t *client, const char *xpath, const char *value);
47 int nc_client_edit_apply_changes(nc_client_t *client, int timeout);
49 int lyd_utils_dup(sr_session_ctx_t *session, const char *xpath_s, const char *xpath_d, struct lyd_node **tree);