build CHANGE rename too generic macros to libnetconf specific
ENABLE_TLS and ENABLE_SSH are too generic to be used as symbols
exported via header files to the user applications. Therefore the
symbols were renamed to NC_ENABLED_SSH and NC_ENABLED_TLS.
diff --git a/src/session_server.c b/src/session_server.c
index 1fa5fe5..fd260ac 100644
--- a/src/session_server.c
+++ b/src/session_server.c
@@ -359,7 +359,7 @@
{
pthread_spin_destroy(&server_opts.sid_lock);
-#if defined(ENABLE_SSH) || defined(ENABLE_TLS)
+#if defined(NC_ENABLED_SSH) || defined(NC_ENABLED_TLS)
nc_server_del_endpt(NULL, 0);
#endif
}
@@ -481,13 +481,13 @@
ps->pfds[ps->session_count - 1].fd = session->ti.fd.in;
break;
-#ifdef ENABLE_SSH
+#ifdef NC_ENABLED_SSH
case NC_TI_LIBSSH:
ps->pfds[ps->session_count - 1].fd = ssh_get_fd(session->ti.libssh.session);
break;
#endif
-#ifdef ENABLE_TLS
+#ifdef NC_ENABLED_TLS
case NC_TI_OPENSSL:
ps->pfds[ps->session_count - 1].fd = SSL_get_rfd(session->ti.tls);
break;
@@ -665,7 +665,7 @@
}
if (i == ps->session_count) {
-#ifdef ENABLE_SSH
+#ifdef NC_ENABLED_SSH
retry_poll:
#endif
/* no leftover event */
@@ -689,7 +689,7 @@
ps->sessions[i]->term_reason = NC_SESSION_TERM_OTHER;
return 3;
} else if (ps->pfds[i].revents & POLLIN) {
-#ifdef ENABLE_SSH
+#ifdef NC_ENABLED_SSH
if (ps->sessions[i]->ti_type == NC_TI_LIBSSH) {
uint16_t j;
@@ -731,7 +731,7 @@
continue;
}
}
-#endif /* ENABLE_SSH */
+#endif /* NC_ENABLED_SSH */
/* we are going to process it now */
ps->pfds[i].revents = 0;
@@ -821,14 +821,14 @@
}
}
-#if defined(ENABLE_SSH) || defined(ENABLE_TLS)
+#if defined(NC_ENABLED_SSH) || defined(NC_ENABLED_TLS)
int
nc_server_add_endpt_listen(const char *name, const char *address, uint16_t port, NC_TRANSPORT_IMPL ti)
{
int sock;
uint16_t i;
-#ifdef ENABLE_SSH
+#ifdef NC_ENABLED_SSH
struct nc_server_ssh_opts *ssh_opts;
#endif
@@ -867,7 +867,7 @@
server_opts.binds[server_opts.endpt_count - 1].sock = sock;
server_opts.binds[server_opts.endpt_count - 1].ti = ti;
switch (ti) {
-#ifdef ENABLE_SSH
+#ifdef NC_ENABLED_SSH
case NC_TI_LIBSSH:
ssh_opts = calloc(1, sizeof *ssh_opts);
/* set default values */
@@ -878,7 +878,7 @@
server_opts.endpts[server_opts.endpt_count - 1].ti_opts = ssh_opts;
break;
#endif
-#ifdef ENABLE_TLS
+#ifdef NC_ENABLED_TLS
case NC_TI_OPENSSL:
server_opts.endpts[server_opts.endpt_count - 1].ti_opts = calloc(1, sizeof(struct nc_server_tls_opts));
break;
@@ -973,12 +973,12 @@
close(server_opts.binds[i].sock);
pthread_mutex_destroy(&server_opts.endpts[i].endpt_lock);
switch (server_opts.binds[i].ti) {
-#ifdef ENABLE_SSH
+#ifdef NC_ENABLED_SSH
case NC_TI_LIBSSH:
nc_server_ssh_clear_opts(server_opts.endpts[i].ti_opts);
break;
#endif
-#ifdef ENABLE_TLS
+#ifdef NC_ENABLED_TLS
case NC_TI_OPENSSL:
nc_server_tls_clear_opts(server_opts.endpts[i].ti_opts);
break;
@@ -1008,12 +1008,12 @@
close(server_opts.binds[i].sock);
pthread_mutex_destroy(&server_opts.endpts[i].endpt_lock);
switch (server_opts.binds[i].ti) {
-#ifdef ENABLE_SSH
+#ifdef NC_ENABLED_SSH
case NC_TI_LIBSSH:
nc_server_ssh_clear_opts(server_opts.endpts[i].ti_opts);
break;
#endif
-#ifdef ENABLE_TLS
+#ifdef NC_ENABLED_TLS
case NC_TI_OPENSSL:
nc_server_tls_clear_opts(server_opts.endpts[i].ti_opts);
break;
@@ -1113,7 +1113,7 @@
(*session)->ti_opts = server_opts.endpts[idx].ti_opts;
/* sock gets assigned to session or closed */
-#ifdef ENABLE_SSH
+#ifdef NC_ENABLED_SSH
if (server_opts.binds[idx].ti == NC_TI_LIBSSH) {
ret = nc_accept_ssh_session(*session, sock, timeout);
if (ret < 1) {
@@ -1121,7 +1121,7 @@
}
} else
#endif
-#ifdef ENABLE_TLS
+#ifdef NC_ENABLED_TLS
if (server_opts.binds[idx].ti == NC_TI_OPENSSL) {
ret = nc_accept_tls_session(*session, sock, timeout);
if (ret < 1) {
@@ -1204,7 +1204,7 @@
pthread_mutex_init((*session)->ti_lock, NULL);
/* sock gets assigned to session or closed */
-#ifdef ENABLE_SSH
+#ifdef NC_ENABLED_SSH
if (ti == NC_TI_LIBSSH) {
/* OPTS LOCK */
pthread_mutex_lock(&ssh_ch_opts_lock);
@@ -1221,7 +1221,7 @@
}
} else
#endif
-#ifdef ENABLE_TLS
+#ifdef NC_ENABLED_TLS
if (ti == NC_TI_OPENSSL) {
/* OPTS LOCK */
pthread_mutex_lock(&tls_ch_opts_lock);
@@ -1267,4 +1267,4 @@
return ret;
}
-#endif /* ENABLE_SSH || ENABLE_TLS */
+#endif /* NC_ENABLED_SSH || NC_ENABLED_TLS */