Skip to content

Commit

Permalink
server UPDATE remove netconf_server.c/h
Browse files Browse the repository at this point in the history
  • Loading branch information
Roytak committed Nov 2, 2023
1 parent 4ddf286 commit 3eb6e97
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 245 deletions.
5 changes: 0 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -239,11 +239,6 @@ include_directories(${LIBNETCONF2_INCLUDE_DIRS})
list(APPEND CMAKE_REQUIRED_INCLUDES ${LIBNETCONF2_INCLUDE_DIRS})
list(APPEND CMAKE_REQUIRED_LIBRARIES ${LIBNETCONF2_LIBRARIES})

# SSH and TLS enabled
if(LIBNETCONF2_ENABLED_SSH_TLS)
list(APPEND SERVER_SRC src/netconf_server.c)
endif()

# link compat
use_compat()

Expand Down
39 changes: 33 additions & 6 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
#include "netconf_confirmed_commit.h"
#include "netconf_monitoring.h"
#include "netconf_nmda.h"
#include "netconf_server.h"
#include "netconf_subscribed_notifications.h"
#include "yang_push.h"

Expand Down Expand Up @@ -611,11 +610,6 @@ server_init(void)
/* set libnetconf2 global PRC callback */
nc_set_global_rpc_clb(np2srv_rpc_cb);

#ifdef NC_ENABLED_SSH_TLS
/* set libnetconf2 SSH pubkey auth callback */
nc_server_ssh_set_pubkey_auth_clb(np2srv_pubkey_auth_cb, NULL, NULL);
#endif

/* restore a previous confirmed commit if restore file exists */
ncc_try_restore();

Expand Down Expand Up @@ -725,6 +719,39 @@ server_open_pidfile(const char *pidfile)
return 0;
}

/**
* @brief Callback for handling netconf-server, ietf-keystore and ietf-truststore data changes.
*
* The diff is given to libnetconf2, which then handles the changes.
*
* @param session sysrepo session.
* @param[in] sub_id Subscription identifier.
* @param[in] module_name Module's name.
* @param[in] xpath XPath.
* @param[in] event Event.
* @param[in] request_id Request identifier.
* @param private_data Private data.
*
* @return SR_ERR_OK on success, on error any other value.
*/
static int
np2srv_libnetconf2_config_cb(sr_session_ctx_t *session, uint32_t UNUSED(sub_id), const char *UNUSED(module_name),
const char *UNUSED(xpath), sr_event_t UNUSED(event), uint32_t UNUSED(request_id), void *UNUSED(private_data))
{
int rc = 0;
const struct lyd_node *diff = NULL;

/* get diff and apply it */
diff = sr_get_change_diff(session);
rc = nc_server_config_setup_diff(diff);
if (rc) {
ERR("Configuring NETCONF server failed.");
return rc;
}

return SR_ERR_OK;
}

/**
* @brief Subscribe to all the handled RPCs of the server.
*
Expand Down
187 changes: 0 additions & 187 deletions src/netconf_server.c

This file was deleted.

47 changes: 0 additions & 47 deletions src/netconf_server.h

This file was deleted.

0 comments on commit 3eb6e97

Please sign in to comment.