diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/msgqueue.c | 4 | ||||
| -rw-r--r-- | src/supplemental/tls/CMakeLists.txt | 6 | ||||
| -rw-r--r-- | src/supplemental/tls/mbedtls/tls.c | 4 | ||||
| -rw-r--r-- | src/supplemental/tls/none/tls.c | 177 |
4 files changed, 183 insertions, 8 deletions
diff --git a/src/core/msgqueue.c b/src/core/msgqueue.c index de4708fe..8246279f 100644 --- a/src/core/msgqueue.c +++ b/src/core/msgqueue.c @@ -528,8 +528,6 @@ nni_msgq_resize(nni_msgq *mq, int cap) nni_msg * msg; nni_msg **newq, **oldq; int oldget; - int oldput; - int oldcap; int oldlen; int oldalloc; @@ -564,8 +562,6 @@ nni_msgq_resize(nni_msgq *mq, int cap) oldq = mq->mq_msgs; oldget = mq->mq_get; - oldput = mq->mq_put; - oldcap = mq->mq_cap; oldalloc = mq->mq_alloc; oldlen = mq->mq_len; diff --git a/src/supplemental/tls/CMakeLists.txt b/src/supplemental/tls/CMakeLists.txt index 1d0dd08d..3f77732d 100644 --- a/src/supplemental/tls/CMakeLists.txt +++ b/src/supplemental/tls/CMakeLists.txt @@ -1,6 +1,6 @@ # -# Copyright 2017 Capitar IT Group BV <info@capitar.com> -# Copyright 2017 Staysail Systems, Inc. <info@staysail.tech> +# Copyright 2018 Capitar IT Group BV <info@capitar.com> +# Copyright 2018 Staysail Systems, Inc. <info@staysail.tech> # # This software is supplied under the terms of the MIT License, a # copy of which should be located in the distribution where this @@ -34,6 +34,8 @@ if (NNG_SUPP_TLS_MBEDTLS) set(NNG_REQUIRED_INCLUDES ${NNG_REQUIRED_INCLUDES} PARENT_SCOPE) endif() set(TLS_SOURCES ${TLS_SOURCES} supplemental/tls/mbedtls/tls.c) +else() + set(TLS_SOURCES ${TLS_SOURCES} supplemental/tls/none/tls.c) endif() set(NNG_DEFINES ${NNG_DEFINES} ${TLS_DEFINES} PARENT_SCOPE) diff --git a/src/supplemental/tls/mbedtls/tls.c b/src/supplemental/tls/mbedtls/tls.c index 8d934d61..1e008668 100644 --- a/src/supplemental/tls/mbedtls/tls.c +++ b/src/supplemental/tls/mbedtls/tls.c @@ -497,7 +497,7 @@ nni_tls_recv_cb(void *ctx) // The chunk size we accept is 64k at a time, which prevents // ridiculous over queueing. This is always called with the pipe // lock held, and never blocks. -int +static int nni_tls_net_send(void *ctx, const unsigned char *buf, size_t len) { nni_tls *tp = ctx; @@ -605,7 +605,7 @@ nni_tls_sockname(nni_tls *tp, nni_sockaddr *sa) return (nni_plat_tcp_pipe_sockname(tp->tcp, sa)); } -void +static void nni_tls_do_handshake(nni_tls *tp) { int rv; diff --git a/src/supplemental/tls/none/tls.c b/src/supplemental/tls/none/tls.c new file mode 100644 index 00000000..beaf322c --- /dev/null +++ b/src/supplemental/tls/none/tls.c @@ -0,0 +1,177 @@ +// +// Copyright 2018 Staysail Systems, Inc. <info@staysail.tech> +// Copyright 2018 Capitar IT Group BV <info@capitar.com> +// +// This software is supplied under the terms of the MIT License, a +// copy of which should be located in the distribution where this +// file was obtained (LICENSE.txt). A copy of the license may also be +// found online at https://opensource.org/licenses/MIT. +// + +#include <stdbool.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +// This file is only used when TLS support is not build into the library. +// We provide stub functions only to satisfy linkage. + +#include "core/nng_impl.h" +#include "supplemental/tls/tls.h" + +void +nni_tls_config_fini(nng_tls_config *cfg) +{ + NNI_ARG_UNUSED(cfg); +} + +int +nni_tls_config_init(nng_tls_config **cpp, enum nng_tls_mode mode) +{ + NNI_ARG_UNUSED(cpp); + NNI_ARG_UNUSED(mode); + return (NNG_ENOTSUP); +} + +void +nni_tls_config_hold(nng_tls_config *cfg) +{ + NNI_ARG_UNUSED(cfg); +} + +void +nni_tls_fini(nni_tls *tp) +{ + NNI_ARG_UNUSED(tp); +} + +int +nni_tls_init(nni_tls **tpp, nng_tls_config *cfg, nni_plat_tcp_pipe *tcp) +{ + NNI_ARG_UNUSED(tpp); + NNI_ARG_UNUSED(cfg); + NNI_ARG_UNUSED(tcp); + + return (NNG_ENOTSUP); +} + +// nni_tls_send is the exported send function. It has a similar +// calling convention as the platform TCP pipe. +void +nni_tls_send(nni_tls *tp, nni_aio *aio) +{ + NNI_ARG_UNUSED(tp); + nni_aio_finish_error(aio, NNG_ENOTSUP); +} + +void +nni_tls_recv(nni_tls *tp, nni_aio *aio) +{ + NNI_ARG_UNUSED(tp); + nni_aio_finish_error(aio, NNG_ENOTSUP); +} + +int +nni_tls_peername(nni_tls *tp, nni_sockaddr *sa) +{ + NNI_ARG_UNUSED(tp); + NNI_ARG_UNUSED(sa); + return (NNG_ENOTSUP); +} + +int +nni_tls_sockname(nni_tls *tp, nni_sockaddr *sa) +{ + NNI_ARG_UNUSED(tp); + NNI_ARG_UNUSED(sa); + return (NNG_ENOTSUP); +} + +void +nni_tls_close(nni_tls *tp) +{ + NNI_ARG_UNUSED(tp); +} + +const char * +nni_tls_ciphersuite_name(nni_tls *tp) +{ + NNI_ARG_UNUSED(tp); + return (NULL); +} + +bool +nni_tls_verified(nni_tls *tp) +{ + NNI_ARG_UNUSED(tp); + return (false); +} + +int +nng_tls_config_server_name(nng_tls_config *cfg, const char *name) +{ + NNI_ARG_UNUSED(cfg); + NNI_ARG_UNUSED(name); + return (NNG_ENOTSUP); +} + +int +nng_tls_config_auth_mode(nng_tls_config *cfg, nng_tls_auth_mode mode) +{ + NNI_ARG_UNUSED(cfg); + NNI_ARG_UNUSED(mode); + return (NNG_ENOTSUP); +} + +int +nng_tls_config_ca_chain( + nng_tls_config *cfg, const char *certs, const char *crl) +{ + NNI_ARG_UNUSED(cfg); + NNI_ARG_UNUSED(certs); + NNI_ARG_UNUSED(crl); + return (NNG_ENOTSUP); +} + +int +nng_tls_config_own_cert( + nng_tls_config *cfg, const char *cert, const char *key, const char *pass) +{ + NNI_ARG_UNUSED(cfg); + NNI_ARG_UNUSED(key); + NNI_ARG_UNUSED(pass); + return (NNG_ENOTSUP); +} + +int +nng_tls_config_ca_file(nng_tls_config *cfg, const char *path) +{ + NNI_ARG_UNUSED(cfg); + NNI_ARG_UNUSED(path); + return (NNG_ENOTSUP); +} + +int +nng_tls_config_cert_key_file( + nng_tls_config *cfg, const char *path, const char *pass) +{ + NNI_ARG_UNUSED(cfg); + NNI_ARG_UNUSED(path); + NNI_ARG_UNUSED(pass); + return (NNG_ENOTSUP); +} + +int +nng_tls_config_alloc(nng_tls_config **cfgp, nng_tls_mode mode) +{ + + NNI_ARG_UNUSED(cfgp); + NNI_ARG_UNUSED(mode); + return (NNG_ENOTSUP); +} + +void +nng_tls_config_free(nng_tls_config *cfg) +{ + NNI_ARG_UNUSED(cfg); +}
\ No newline at end of file |
