diff options
53 files changed, 205 insertions, 205 deletions
diff --git a/src/core/aio.c b/src/core/aio.c index 76ca7726..510e568a 100644 --- a/src/core/aio.c +++ b/src/core/aio.c @@ -1,5 +1,5 @@ // -// Copyright 2024 Staysail Systems, Inc. <info@staysail.tech> +// Copyright 2025 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 @@ -8,9 +8,9 @@ // found online at https://opensource.org/licenses/MIT. // -#include "core/aio.h" -#include "core/nng_impl.h" -#include "core/taskq.h" +#include "aio.h" +#include "nng_impl.h" +#include "taskq.h" #include <string.h> struct nni_aio_expire_q { diff --git a/src/core/aio.h b/src/core/aio.h index 5884e253..6b806bf6 100644 --- a/src/core/aio.h +++ b/src/core/aio.h @@ -11,11 +11,11 @@ #ifndef CORE_AIO_H #define CORE_AIO_H -#include "core/defs.h" -#include "core/list.h" -#include "core/reap.h" -#include "core/taskq.h" -#include "core/thread.h" +#include "defs.h" +#include "list.h" +#include "reap.h" +#include "taskq.h" +#include "thread.h" typedef void (*nni_aio_cancel_fn)(nni_aio *, void *, nng_err); diff --git a/src/core/defs.h b/src/core/defs.h index 1cfeeaa4..64a43a04 100644 --- a/src/core/defs.h +++ b/src/core/defs.h @@ -22,6 +22,8 @@ #define NNI_ARG_UNUSED(x) ((void) x) #ifndef NDEBUG +extern void nni_panic(const char *fmt, ...); + #define NNI_ASSERT(x) \ if (!(x)) \ nni_panic("%s: %d: assert err: %s", __FILE__, __LINE__, #x) @@ -125,30 +127,30 @@ typedef void (*nni_cb)(void *); // Modern CPUs are all little endian. Let's stop paying the endian tax. -#define NNI_PUT16LE(ptr, u) \ - do { \ - ((uint8_t *)ptr)[1] = (uint8_t) (((uint16_t) (u)) >> 8u); \ - ((uint8_t *)ptr)[0] = (uint8_t) ((uint16_t) (u)); \ +#define NNI_PUT16LE(ptr, u) \ + do { \ + ((uint8_t *) ptr)[1] = (uint8_t) (((uint16_t) (u)) >> 8u); \ + ((uint8_t *) ptr)[0] = (uint8_t) ((uint16_t) (u)); \ } while (0) -#define NNI_PUT32LE(ptr, u) \ - do { \ - ((uint8_t *)ptr)[3] = (uint8_t) (((uint32_t) (u)) >> 24u); \ - ((uint8_t *)ptr)[2] = (uint8_t) (((uint32_t) (u)) >> 16u); \ - ((uint8_t *)ptr)[1] = (uint8_t) (((uint32_t) (u)) >> 8u); \ - ((uint8_t *)ptr)[0] = (uint8_t) ((uint32_t) (u)); \ +#define NNI_PUT32LE(ptr, u) \ + do { \ + ((uint8_t *) ptr)[3] = (uint8_t) (((uint32_t) (u)) >> 24u); \ + ((uint8_t *) ptr)[2] = (uint8_t) (((uint32_t) (u)) >> 16u); \ + ((uint8_t *) ptr)[1] = (uint8_t) (((uint32_t) (u)) >> 8u); \ + ((uint8_t *) ptr)[0] = (uint8_t) ((uint32_t) (u)); \ } while (0) -#define NNI_PUT64LE(ptr, u) \ - do { \ - ((uint8_t *)ptr)[7] = (uint8_t) (((uint64_t) (u)) >> 56u); \ - ((uint8_t *)ptr)[6] = (uint8_t) (((uint64_t) (u)) >> 48u); \ - ((uint8_t *)ptr)[5] = (uint8_t) (((uint64_t) (u)) >> 40u); \ - ((uint8_t *)ptr)[4] = (uint8_t) (((uint64_t) (u)) >> 32u); \ - ((uint8_t *)ptr)[3] = (uint8_t) (((uint64_t) (u)) >> 24u); \ - ((uint8_t *)ptr)[2] = (uint8_t) (((uint64_t) (u)) >> 16u); \ - ((uint8_t *)ptr)[1] = (uint8_t) (((uint64_t) (u)) >> 8u); \ - ((uint8_t *)ptr)[0] = (uint8_t) ((uint64_t) (u)); \ +#define NNI_PUT64LE(ptr, u) \ + do { \ + ((uint8_t *) ptr)[7] = (uint8_t) (((uint64_t) (u)) >> 56u); \ + ((uint8_t *) ptr)[6] = (uint8_t) (((uint64_t) (u)) >> 48u); \ + ((uint8_t *) ptr)[5] = (uint8_t) (((uint64_t) (u)) >> 40u); \ + ((uint8_t *) ptr)[4] = (uint8_t) (((uint64_t) (u)) >> 32u); \ + ((uint8_t *) ptr)[3] = (uint8_t) (((uint64_t) (u)) >> 24u); \ + ((uint8_t *) ptr)[2] = (uint8_t) (((uint64_t) (u)) >> 16u); \ + ((uint8_t *) ptr)[1] = (uint8_t) (((uint64_t) (u)) >> 8u); \ + ((uint8_t *) ptr)[0] = (uint8_t) ((uint64_t) (u)); \ } while (0) #define NNI_GET16LE(ptr, v) \ diff --git a/src/core/dialer.c b/src/core/dialer.c index 9b868224..50f9e072 100644 --- a/src/core/dialer.c +++ b/src/core/dialer.c @@ -9,9 +9,9 @@ // found online at https://opensource.org/licenses/MIT. // -#include "core/defs.h" -#include "core/nng_impl.h" +#include "defs.h" #include "nng/nng.h" +#include "nng_impl.h" #include "sockimpl.h" #include <stdio.h> diff --git a/src/core/list.h b/src/core/list.h index 28720564..b8feaa36 100644 --- a/src/core/list.h +++ b/src/core/list.h @@ -1,5 +1,5 @@ // -// Copyright 2024 Garrett D'Amore <garrett@damore.org> +// Copyright 2025 Garrett D'Amore <garrett@damore.org> // // This software is supplied under the terms of the MIT License, a // copy of which should be located in the distribution where this @@ -10,7 +10,7 @@ #ifndef CORE_LIST_H #define CORE_LIST_H -#include "core/defs.h" +#include "defs.h" // In order to make life easy, we just define the list structures // directly, and let consumers directly inline structures. @@ -32,12 +32,10 @@ extern void nni_list_init_offset(nni_list *list, size_t offset); // NNI_LIST_INITIALIZER is used to initialize structures at declaration time. // The list argument is the structure being initialized and the type and // offset determine where the node lives within each item. -#define NNI_LIST_INITIALIZER(list, type, field) \ - { \ - .ll_head.ln_next = &(list).ll_head, \ - .ll_head.ln_prev = &(list).ll_head, \ - .ll_offset = offsetof(type, field) \ - } +#define NNI_LIST_INITIALIZER(list, type, field) \ + { .ll_head.ln_next = &(list).ll_head, \ + .ll_head.ln_prev = &(list).ll_head, \ + .ll_offset = offsetof(type, field) } #define NNI_LIST_NODE_INIT(node) \ do { \ @@ -60,6 +58,6 @@ extern void nni_list_node_remove(nni_list_node *); #define NNI_LIST_FOREACH(l, it) \ for (it = nni_list_first(l); it != NULL; \ - it = nni_list_next(l, (void *) it)) + it = nni_list_next(l, (void *) it)) #endif // CORE_LIST_H diff --git a/src/core/listener.c b/src/core/listener.c index b8efd487..e9a853ed 100644 --- a/src/core/listener.c +++ b/src/core/listener.c @@ -9,9 +9,10 @@ // found online at https://opensource.org/licenses/MIT. // -#include "core/defs.h" -#include "core/nng_impl.h" -#include "core/strs.h" +#include "defs.h" +#include "nng_impl.h" +#include "strs.h" + #include "nng/nng.h" #include "sockimpl.h" diff --git a/src/core/listener.h b/src/core/listener.h index 8b9a4c03..3eae99e9 100644 --- a/src/core/listener.h +++ b/src/core/listener.h @@ -12,8 +12,8 @@ #ifndef CORE_LISTENER_H #define CORE_LISTENER_H -#include "core/defs.h" -#include "core/stats.h" +#include "defs.h" +#include "stats.h" extern int nni_listener_find(nni_listener **, uint32_t); extern int nni_listener_hold(nni_listener *); diff --git a/src/core/lmq.h b/src/core/lmq.h index c44ca24c..eb687082 100644 --- a/src/core/lmq.h +++ b/src/core/lmq.h @@ -10,7 +10,7 @@ #ifndef CORE_LMQ_H #define CORE_LMQ_H -#include "core/defs.h" +#include "defs.h" // nni_lmq is a very lightweight message queue. Defining it this way allows // us to share some common code. Locking must be supplied by the caller. diff --git a/src/core/message.h b/src/core/message.h index 9940dc9e..2da66ea8 100644 --- a/src/core/message.h +++ b/src/core/message.h @@ -11,7 +11,7 @@ #ifndef CORE_MESSAGE_H #define CORE_MESSAGE_H -#include "core/defs.h" +#include "defs.h" // Internally used message API. Again, this is not part of our public API. // "trim" operations work from the front, and "chop" work from the end. diff --git a/src/core/nng_impl.h b/src/core/nng_impl.h index 4fe80e63..ef15ee45 100644 --- a/src/core/nng_impl.h +++ b/src/core/nng_impl.h @@ -1,5 +1,5 @@ // -// Copyright 2023 Staysail Systems, Inc. <info@staysail.tech> +// Copyright 2025 Staysail Systems, Inc. <info@staysail.tech> // Copyright 2017 Capitar IT Group BV <info@capitar.com> // // This software is supplied under the terms of the MIT License, a @@ -24,38 +24,39 @@ // symbols should be found in the toplevel nng.h header. #include "defs.h" -#include "core/platform.h" - -#include "core/aio.h" -#include "core/device.h" -#include "core/file.h" -#include "core/idhash.h" -#include "core/init.h" -#include "core/list.h" -#include "core/lmq.h" -#include "core/message.h" -#include "core/msgqueue.h" -#include "core/options.h" -#include "core/panic.h" -#include "core/pollable.h" -#include "core/protocol.h" -#include "core/reap.h" -#include "core/refcnt.h" -#include "core/stats.h" -#include "core/stream.h" -#include "core/strs.h" -#include "core/taskq.h" -#include "core/thread.h" -#include "core/url.h" +#include "platform.h" + +#include "aio.h" +#include "device.h" +#include "file.h" +#include "idhash.h" +#include "init.h" +#include "list.h" +#include "lmq.h" +#include "message.h" +#include "msgqueue.h" +#include "options.h" +#include "panic.h" +#include "pollable.h" +#include "protocol.h" +#include "reap.h" +#include "refcnt.h" +#include "stats.h" + +#include "stream.h" +#include "strs.h" +#include "taskq.h" +#include "thread.h" +#include "url.h" // transport needs to come after url -#include "sp/transport.h" +#include "../sp/transport.h" // These have to come after the others - particularly transport.h -#include "core/dialer.h" -#include "core/listener.h" -#include "core/pipe.h" -#include "core/socket.h" +#include "dialer.h" +#include "listener.h" +#include "pipe.h" +#include "socket.h" #endif // CORE_NNG_IMPL_H diff --git a/src/core/pipe.h b/src/core/pipe.h index fc7b7a1a..b9a13a68 100644 --- a/src/core/pipe.h +++ b/src/core/pipe.h @@ -19,7 +19,7 @@ #include "stats.h" #include "thread.h" -#include "sp/transport.h" +#include "../sp/transport.h" // AIO extern void nni_pipe_recv(nni_pipe *, nni_aio *); diff --git a/src/core/platform.h b/src/core/platform.h index cdb0d887..6fe0c7eb 100644 --- a/src/core/platform.h +++ b/src/core/platform.h @@ -540,9 +540,9 @@ extern const char *nni_plat_file_basename(const char *); // Actual platforms we support. This is included up front so that we can // get the specific types that are supplied by the platform. #if defined(NNG_PLATFORM_POSIX) -#include "platform/posix/posix_impl.h" +#include "../platform/posix/posix_impl.h" #elif defined(NNG_PLATFORM_WINDOWS) -#include "platform/windows/win_impl.h" +#include "../platform/windows/win_impl.h" #else #error "unknown platform" #endif diff --git a/src/core/protocol.h b/src/core/protocol.h index 109ec5ef..c128e676 100644 --- a/src/core/protocol.h +++ b/src/core/protocol.h @@ -1,5 +1,5 @@ // -// Copyright 2021 Staysail Systems, Inc. <info@staysail.tech> +// Copyright 2025 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 @@ -11,7 +11,7 @@ #ifndef CORE_PROTOCOL_H #define CORE_PROTOCOL_H -#include "core/options.h" +#include "options.h" // Protocol implementation details. Protocols must implement the // interfaces in this file. Note that implementing new protocols is @@ -168,7 +168,7 @@ extern int nni_proto_open(nng_socket *, const nni_proto *); // There are gaps in the list, which are obsolete or unsupported protocols. // Protocol numbers are never more than 16 bits. Also, there will never be // a valid protocol numbered 0 (NNG_PROTO_NONE). -#define NNI_PROTO(major, minor) (((major) *16) + (minor)) +#define NNI_PROTO(major, minor) (((major) * 16) + (minor)) // Protocol major numbers. This is here for documentation only, and // to serve as a "registry" for managing new protocol numbers. Consider diff --git a/src/core/reap.c b/src/core/reap.c index 61c6bdb9..c236e9ce 100644 --- a/src/core/reap.c +++ b/src/core/reap.c @@ -8,7 +8,7 @@ // found online at https://opensource.org/licenses/MIT. // -#include "core/nng_impl.h" +#include "nng_impl.h" #include "reap.h" diff --git a/src/core/reap.h b/src/core/reap.h index 221fd17f..f6da27ce 100644 --- a/src/core/reap.h +++ b/src/core/reap.h @@ -11,8 +11,8 @@ #ifndef CORE_REAP_H #define CORE_REAP_H -#include "core/defs.h" -#include "core/list.h" +#include "defs.h" +#include "list.h" // nni_reap_node is to be inserted inline into structures // for subsystems that wish to support deferred reaping. diff --git a/src/core/socket.c b/src/core/socket.c index 12373a6a..2ef27dbc 100644 --- a/src/core/socket.c +++ b/src/core/socket.c @@ -1,5 +1,5 @@ // -// Copyright 2024 Staysail Systems, Inc. <info@staysail.tech> +// Copyright 2025 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 @@ -8,12 +8,12 @@ // found online at https://opensource.org/licenses/MIT. // -#include "core/defs.h" -#include "core/nng_impl.h" -#include "core/options.h" -#include "core/pipe.h" +#include "defs.h" #include "list.h" #include "nng/nng.h" +#include "nng_impl.h" +#include "options.h" +#include "pipe.h" #include "sockimpl.h" #include <stdio.h> diff --git a/src/core/sockimpl.h b/src/core/sockimpl.h index 5d41e8d7..dc8500fe 100644 --- a/src/core/sockimpl.h +++ b/src/core/sockimpl.h @@ -23,7 +23,7 @@ #include "stats.h" #include "url.h" -#include "sp/transport.h" +#include "../sp/transport.h" // This file contains stuff shared within the core between sockets, endpoints, // and pipes. This must not be exposed to other subsystems -- these internals diff --git a/src/core/stats.h b/src/core/stats.h index ddd8a886..dd871c09 100644 --- a/src/core/stats.h +++ b/src/core/stats.h @@ -1,5 +1,5 @@ // -// Copyright 2024 Staysail Systems, Inc. <info@staysail.tech> +// Copyright 2025 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 @@ -11,9 +11,9 @@ #ifndef CORE_STATS_H #define CORE_STATS_H -#include "core/defs.h" -#include "core/list.h" -#include "core/platform.h" +#include "defs.h" +#include "list.h" +#include "platform.h" // Statistics support. This is inspired in part by the Solaris // kernel stats framework, but we've simplified and tuned it for our use. diff --git a/src/core/taskq.h b/src/core/taskq.h index 356ef725..cd27408c 100644 --- a/src/core/taskq.h +++ b/src/core/taskq.h @@ -1,5 +1,5 @@ // -// Copyright 2024 Staysail Systems, Inc. <info@staysail.tech> +// Copyright 2025 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 @@ -11,9 +11,10 @@ #ifndef CORE_TASKQ_H #define CORE_TASKQ_H -#include "core/defs.h" -#include "core/list.h" -#include "core/platform.h" +#include "defs.h" +#include "list.h" +#include "platform.h" + #include "nng/nng.h" typedef struct nni_taskq nni_taskq; diff --git a/src/core/thread.h b/src/core/thread.h index 316acdc2..bc9a7411 100644 --- a/src/core/thread.h +++ b/src/core/thread.h @@ -1,5 +1,5 @@ // -// Copyright 2020 Staysail Systems, Inc. <info@staysail.tech> +// Copyright 2025 Staysail Systems, Inc. <info@staysail.tech> // Copyright 2017 Capitar IT Group BV <info@capitar.com> // // This software is supplied under the terms of the MIT License, a @@ -11,15 +11,15 @@ #ifndef CORE_THREAD_H #define CORE_THREAD_H -#include "core/defs.h" -#include "core/platform.h" +#include "defs.h" +#include "platform.h" struct nni_thr { nni_plat_thr thr; nni_plat_mtx mtx; nni_plat_cv cv; nni_thr_func fn; - void * arg; + void *arg; int start; int stop; int done; diff --git a/src/core/url.h b/src/core/url.h index 4f387c5d..46e8ca5e 100644 --- a/src/core/url.h +++ b/src/core/url.h @@ -1,5 +1,5 @@ // -// Copyright 2024 Staysail Systems, Inc. <info@staysail.tech> +// Copyright 2025 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 @@ -11,7 +11,7 @@ #ifndef CORE_URL_H #define CORE_URL_H -#include "core/defs.h" +#include "defs.h" struct nng_url { const char *u_scheme; // never NULL diff --git a/src/platform/posix/posix_debug.c b/src/platform/posix/posix_debug.c index 3c0a6604..974c3d02 100644 --- a/src/platform/posix/posix_debug.c +++ b/src/platform/posix/posix_debug.c @@ -7,7 +7,7 @@ // found online at https://opensource.org/licenses/MIT. // -#include "core/nng_impl.h" +#include "../../core/nng_impl.h" #ifdef NNG_PLATFORM_POSIX diff --git a/src/platform/posix/posix_impl.h b/src/platform/posix/posix_impl.h index 2229f17c..316cc3e6 100644 --- a/src/platform/posix/posix_impl.h +++ b/src/platform/posix/posix_impl.h @@ -32,7 +32,7 @@ #define NNG_PLATFORM_POSIX_SOCKADDR #define NNG_PLATFORM_POSIX_UDP -#include "core/defs.h" +#include "../../core/defs.h" #include "posix_config.h" #endif @@ -60,10 +60,7 @@ struct nni_plat_mtx { pthread_mutex_t mtx; }; -#define NNI_MTX_INITIALIZER \ - { \ - PTHREAD_MUTEX_INITIALIZER \ - } +#define NNI_MTX_INITIALIZER { PTHREAD_MUTEX_INITIALIZER } // No static form of CV initialization because of the need to use // attributes to set the clock type. diff --git a/src/sp/protocol/pair1/pair.c b/src/sp/protocol/pair1/pair.c index 3aa9b4c7..486b2a37 100644 --- a/src/sp/protocol/pair1/pair.c +++ b/src/sp/protocol/pair1/pair.c @@ -10,7 +10,7 @@ #include <stdlib.h> -#include "core/nng_impl.h" +#include "../../../core/nng_impl.h" // Pair protocol. The PAIRv1 protocol is a simple 1:1 messaging pattern. diff --git a/src/sp/protocol/pubsub0/pub.c b/src/sp/protocol/pubsub0/pub.c index abc52205..c753b8af 100644 --- a/src/sp/protocol/pubsub0/pub.c +++ b/src/sp/protocol/pubsub0/pub.c @@ -10,7 +10,7 @@ #include <string.h> -#include "core/nng_impl.h" +#include "../../../core/nng_impl.h" // Publish protocol. The PUB protocol simply sends messages out, as // a broadcast. It has nothing more sophisticated because it does not diff --git a/src/sp/transport.h b/src/sp/transport.h index 72ce18d7..36ade021 100644 --- a/src/sp/transport.h +++ b/src/sp/transport.h @@ -1,5 +1,5 @@ // -// Copyright 2024 Staysail Systems, Inc. <info@staysail.tech> +// Copyright 2025 Staysail Systems, Inc. <info@staysail.tech> // Copyright 2018 Capitar IT Group BV <info@capitar.com> // Copyright 2018 Devolutions <info@devolutions.net> // @@ -12,9 +12,9 @@ #ifndef PROTOCOL_SP_TRANSPORT_H #define PROTOCOL_SP_TRANSPORT_H -#include "core/defs.h" -#include "core/list.h" -#include "core/options.h" +#include "../core/defs.h" +#include "../core/list.h" +#include "../core/options.h" // Endpoint operations are called by the socket in a // protocol-independent fashion. The socket makes individual calls, diff --git a/src/sp/transport/dtls/dtls_tran_test.c b/src/sp/transport/dtls/dtls_tran_test.c index e31b7909..774c967a 100644 --- a/src/sp/transport/dtls/dtls_tran_test.c +++ b/src/sp/transport/dtls/dtls_tran_test.c @@ -11,7 +11,8 @@ // #include "nng/nng.h" -#include <nuts.h> + +#include "../../../testing/nuts.h" // TLS tests. diff --git a/src/sp/transport/tls/tls.c b/src/sp/transport/tls/tls.c index fd983c67..0bd4c284 100644 --- a/src/sp/transport/tls/tls.c +++ b/src/sp/transport/tls/tls.c @@ -12,7 +12,7 @@ #include <stdbool.h> #include <string.h> -#include "core/nng_impl.h" +#include "../../../core/nng_impl.h" #include "nng/nng.h" @@ -43,9 +43,9 @@ struct tlstran_pipe { size_t gotrxhead; size_t wanttxhead; size_t wantrxhead; - nni_aio txaio; - nni_aio rxaio; - nni_aio negoaio; + nng_aio txaio; + nng_aio rxaio; + nng_aio negoaio; nni_msg *rxmsg; nni_mtx mtx; }; @@ -63,9 +63,9 @@ struct tlstran_ep { nng_stream_listener *listener; nni_dialer *ndialer; nni_listener *nlistener; - nni_aio *useraio; - nni_aio connaio; - nni_aio timeaio; + nng_aio *useraio; + nng_aio connaio; + nng_aio timeaio; nni_list waitpipes; // pipes waiting to match to socket nni_list negopipes; // pipes busy negotiating const char *host; diff --git a/src/sp/transport/tls/tls_tran_test.c b/src/sp/transport/tls/tls_tran_test.c index 8f541e68..73c299c8 100644 --- a/src/sp/transport/tls/tls_tran_test.c +++ b/src/sp/transport/tls/tls_tran_test.c @@ -11,7 +11,8 @@ // #include "nng/nng.h" -#include <nuts.h> + +#include "../../../testing/nuts.h" // TLS tests. @@ -226,8 +227,7 @@ test_tls_pipe_details(void) p = nng_msg_get_pipe(msg); NUTS_TRUE(nng_pipe_id(p) >= 0); #if !defined(NNG_TLS_ENGINE_WOLFSSL) || defined(NNG_WOLFSSL_HAVE_PEER_CERT) - char *cn; - char **alts; + char *cn; NUTS_PASS(nng_pipe_get_string(p, NNG_OPT_TLS_PEER_CN, &cn)); NUTS_ASSERT(cn != NULL); NUTS_MATCH(cn, "127.0.0.1"); diff --git a/src/supplemental/http/http_api.h b/src/supplemental/http/http_api.h index 61c6e45f..a8f648dc 100644 --- a/src/supplemental/http/http_api.h +++ b/src/supplemental/http/http_api.h @@ -12,10 +12,9 @@ #ifndef NNG_SUPPLEMENTAL_HTTP_HTTP_API_H #define NNG_SUPPLEMENTAL_HTTP_HTTP_API_H -#include "core/nng_impl.h" -#include "nng/http.h" - +#include "../../core/defs.h" #include "http_msg.h" +#include "nng/http.h" // This represents the "internal" HTTP API. It should not be used // or exposed to applications directly. @@ -68,7 +67,7 @@ extern nng_err nni_http_chunks_parse( nni_http_chunks *, void *, size_t, size_t *); extern void nni_http_read_chunks( - nni_http_conn *, nni_http_chunks *, nni_aio *); + nni_http_conn *, nni_http_chunks *, nng_aio *); extern nni_http_req *nni_http_conn_req(nni_http_conn *); extern nni_http_res *nni_http_conn_res(nni_http_conn *); @@ -106,21 +105,21 @@ extern int nni_http_conn_getopt( // Note that the iovs of the aio's are clobbered by these methods -- callers // must not use them for any other purpose. -extern void nni_http_write_req(nni_http_conn *, nni_aio *); -extern void nni_http_read_res(nni_http_conn *, nni_aio *); -extern void nni_http_read_req(nni_http_conn *, nni_aio *); -extern void nni_http_write_res(nni_http_conn *, nni_aio *); -extern void nni_http_read_discard(nni_http_conn *, size_t, nni_aio *); +extern void nni_http_write_req(nni_http_conn *, nng_aio *); +extern void nni_http_read_res(nni_http_conn *, nng_aio *); +extern void nni_http_read_req(nni_http_conn *, nng_aio *); +extern void nni_http_write_res(nni_http_conn *, nng_aio *); +extern void nni_http_read_discard(nni_http_conn *, size_t, nng_aio *); extern nng_err nni_http_req_alloc_data(nni_http_req *, size_t); extern nng_err nni_http_res_alloc_data(nni_http_res *, size_t); extern bool nni_http_is_error(nng_http *); -extern void nni_http_read(nni_http_conn *, nni_aio *); -extern void nni_http_read_full(nni_http_conn *, nni_aio *); -extern void nni_http_write(nni_http_conn *, nni_aio *); -extern void nni_http_write_full(nni_http_conn *, nni_aio *); +extern void nni_http_read(nni_http_conn *, nng_aio *); +extern void nni_http_read_full(nni_http_conn *, nng_aio *); +extern void nni_http_write(nni_http_conn *, nng_aio *); +extern void nni_http_write_full(nni_http_conn *, nng_aio *); extern nng_err nni_http_add_header(nng_http *, const char *, const char *); extern nng_err nni_http_set_header(nng_http *, const char *, const char *); @@ -324,7 +323,7 @@ extern int nni_http_client_set( extern int nni_http_client_get( nni_http_client *, const char *, void *, size_t *, nni_type); -extern void nni_http_client_connect(nni_http_client *, nni_aio *); +extern void nni_http_client_connect(nni_http_client *, nng_aio *); // nni_http_transact_conn is used to perform a round-trip exchange (i.e. a // single HTTP transaction). It will not automatically close the connection, @@ -333,14 +332,14 @@ extern void nni_http_client_connect(nni_http_client *, nni_aio *); // Note that this will fail with NNG_ENOTSUP if the server attempts to reply // with a chunked transfer encoding. The request and response used are the // ones associated with the connection. -extern void nni_http_transact_conn(nni_http_conn *, nni_aio *); +extern void nni_http_transact_conn(nni_http_conn *, nng_aio *); // nni_http_transact is used to execute a single transaction to a server. // The connection is opened, and will be closed when the transaction is // complete. Note that this will fail with NNG_ENOTSUP if the server attempts // to reply with a chunked transfer encoding. extern void nni_http_transact( - nni_http_client *, nni_http_req *, nni_http_res *, nni_aio *); + nni_http_client *, nni_http_req *, nni_http_res *, nng_aio *); // nni_http_stream_scheme returns the underlying stream scheme for a given // upper layer scheme. diff --git a/src/supplemental/http/http_chunk.c b/src/supplemental/http/http_chunk.c index 1d4335db..99f29800 100644 --- a/src/supplemental/http/http_chunk.c +++ b/src/supplemental/http/http_chunk.c @@ -12,7 +12,7 @@ #include <stdbool.h> #include <string.h> -#include "core/nng_impl.h" +#include "../../core/defs.h" #include "http_api.h" diff --git a/src/supplemental/http/http_client.c b/src/supplemental/http/http_client.c index 06215ca0..5cacb39c 100644 --- a/src/supplemental/http/http_client.c +++ b/src/supplemental/http/http_client.c @@ -14,7 +14,7 @@ #include <stdlib.h> #include <string.h> -#include "core/nng_impl.h" +#include "../../core/nng_impl.h" #include "http_api.h" #include "http_msg.h" diff --git a/src/supplemental/http/http_conn.c b/src/supplemental/http/http_conn.c index 5baa3136..21087474 100644 --- a/src/supplemental/http/http_conn.c +++ b/src/supplemental/http/http_conn.c @@ -15,10 +15,10 @@ #include <stdio.h> #include <string.h> -#include "core/list.h" -#include "core/nng_impl.h" +#include "../../core/list.h" +#include "../../core/nng_impl.h" +#include "../../supplemental/tls/tls_api.h" #include "nng/http.h" -#include "supplemental/tls/tls_api.h" #include "http_api.h" #include "http_msg.h" @@ -52,10 +52,10 @@ struct nng_http_conn { nni_list rdq; // high level http read requests nni_list wrq; // high level http write requests - nni_aio *rd_uaio; // user aio for read - nni_aio *wr_uaio; // user aio for write - nni_aio rd_aio; // bottom half read operations - nni_aio wr_aio; // bottom half write operations + nng_aio *rd_uaio; // user aio for read + nng_aio *wr_uaio; // user aio for write + nng_aio rd_aio; // bottom half read operations + nng_aio wr_aio; // bottom half write operations nni_mtx mtx; diff --git a/src/supplemental/http/http_msg.c b/src/supplemental/http/http_msg.c index 09470e31..e6b2a0ab 100644 --- a/src/supplemental/http/http_msg.c +++ b/src/supplemental/http/http_msg.c @@ -14,9 +14,9 @@ #include <stdlib.h> #include <string.h> -#include "core/list.h" -#include "core/nng_impl.h" -#include "core/url.h" +#include "../../core/list.h" +#include "../../core/nng_impl.h" +#include "../../core/url.h" #include "http_api.h" #include "http_msg.h" #include "nng/http.h" diff --git a/src/supplemental/http/http_msg.h b/src/supplemental/http/http_msg.h index 4b4e03a6..02e0db07 100644 --- a/src/supplemental/http/http_msg.h +++ b/src/supplemental/http/http_msg.h @@ -11,8 +11,8 @@ #ifndef NNG_SUPPLEMENTAL_HTTP_HTTP_MSG #define NNG_SUPPLEMENTAL_HTTP_HTTP_MSG -#include "core/defs.h" -#include "core/list.h" +#include "../../core/defs.h" +#include "../../core/list.h" // Note that as we parse headers, the rule is that if a header is already // present, then we can append it to the existing header, separated by diff --git a/src/supplemental/http/http_public.c b/src/supplemental/http/http_public.c index 42b7a1ab..9c8ded2d 100644 --- a/src/supplemental/http/http_public.c +++ b/src/supplemental/http/http_public.c @@ -8,7 +8,7 @@ // found online at https://opensource.org/licenses/MIT. // -#include "core/nng_impl.h" +#include "../../core/nng_impl.h" #include "http_api.h" #include "nng/http.h" @@ -73,7 +73,7 @@ nng_http_set_body(nng_http *conn, void *data, size_t sz) NNI_ARG_UNUSED(conn); NNI_ARG_UNUSED(data); NNI_ARG_UNUSED(sz); - return (NNG_ENOTSUP); + return; #endif } @@ -108,7 +108,7 @@ nng_http_get_uri(nng_http *conn) #ifdef NNG_SUPP_HTTP return (nni_http_get_uri(conn)); #else - NNI_ARG_UNUSED(req); + NNI_ARG_UNUSED(conn); return (NULL); #endif } @@ -132,7 +132,7 @@ nng_http_get_version(nng_http *conn) #ifdef NNG_SUPP_HTTP return (nni_http_get_version(conn)); #else - NNI_ARG_UNUSED(res); + NNI_ARG_UNUSED(conn); return (NULL); #endif } @@ -143,7 +143,7 @@ nng_http_set_status(nng_http *conn, nng_http_status status, const char *reason) #ifdef NNG_SUPP_HTTP nni_http_set_status(conn, status, reason); #else - NNI_ARG_UNUSED(res); + NNI_ARG_UNUSED(conn); NNI_ARG_UNUSED(status); NNI_ARG_UNUSED(reason); #endif @@ -155,8 +155,7 @@ nng_http_get_status(nng_http *conn) #ifdef NNG_SUPP_HTTP return (nni_http_get_status(conn)); #else - NNI_ARG_UNUSED(res); - NNI_ARG_UNUSED(status); + NNI_ARG_UNUSED(conn); return (0); #endif } @@ -167,8 +166,7 @@ nng_http_get_reason(nng_http *conn) #ifdef NNG_SUPP_HTTP return (nni_http_get_reason(conn)); #else - NNI_ARG_UNUSED(res); - NNI_ARG_UNUSED(status); + NNI_ARG_UNUSED(conn); return (0); #endif } @@ -560,7 +558,7 @@ nng_http_server_error(nng_http_server *srv, nng_http *conn) return (nni_http_server_error(srv, conn)); #else NNI_ARG_UNUSED(srv); - NNI_ARG_UNUSED(res); + NNI_ARG_UNUSED(conn); return (NNG_ENOTSUP); #endif } @@ -650,6 +648,6 @@ nng_http_reset(nng_http *conn) #ifdef NNG_SUPP_HTTP nni_http_conn_reset(conn); #else - NNI_ARG_UNUSED(req); + NNI_ARG_UNUSED(conn); #endif } diff --git a/src/supplemental/http/http_schemes.c b/src/supplemental/http/http_schemes.c index df8b9208..1e56cdc5 100644 --- a/src/supplemental/http/http_schemes.c +++ b/src/supplemental/http/http_schemes.c @@ -1,5 +1,5 @@ // -// Copyright 2020 Staysail Systems, Inc. <info@staysail.tech> +// Copyright 2025 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 @@ -11,7 +11,7 @@ #include <stdbool.h> #include <string.h> -#include "core/nng_impl.h" +#include "../../core/nng_impl.h" #include "http_api.h" @@ -82,4 +82,4 @@ nni_http_stream_scheme(const char *upper) } } return (NULL); -}
\ No newline at end of file +} diff --git a/src/supplemental/http/http_server.c b/src/supplemental/http/http_server.c index fc7a3075..d1e8a5e7 100644 --- a/src/supplemental/http/http_server.c +++ b/src/supplemental/http/http_server.c @@ -17,7 +17,7 @@ #include <stdlib.h> #include <string.h> -#include "core/nng_impl.h" +#include "../../core/nng_impl.h" #include "http_api.h" #include "http_msg.h" diff --git a/src/supplemental/http/http_server_test.c b/src/supplemental/http/http_server_test.c index fdc38950..ed63e136 100644 --- a/src/supplemental/http/http_server_test.c +++ b/src/supplemental/http/http_server_test.c @@ -10,12 +10,12 @@ // // Basic HTTP server tests. -#include "core/defs.h" +#include "../../core/defs.h" #include <complex.h> #include <nng/http.h> #include <nng/nng.h> -#include <nuts.h> +#include "../../testing/nuts.h" const char *doc1 = "<html><body>Someone <b>is</b> home!</body></html>"; const char *doc2 = "This is a text file."; diff --git a/src/supplemental/tls/mbedtls/mbedtls.c b/src/supplemental/tls/mbedtls/mbedtls.c index 71393360..bbfc5763 100644 --- a/src/supplemental/tls/mbedtls/mbedtls.c +++ b/src/supplemental/tls/mbedtls/mbedtls.c @@ -14,31 +14,31 @@ #include <stdlib.h> #include <string.h> -#include "mbedtls/version.h" // Must be first in order to pick up version +#include "nng/nng.h" + +#include "../../../core/nng_impl.h" + +#include "../tls_engine.h" + +#include <mbedtls/version.h> // Must be first in order to pick up version -#include "mbedtls/error.h" +#include <mbedtls/error.h> #ifdef MBEDTLS_PSA_CRYPTO_C -#include "psa/crypto.h" +#include <psa/crypto.h> #endif -#include "nng/nng.h" - // We use a common cookie for our application. -#include "mbedtls/ssl_cookie.h" - -#include "../tls_engine.h" +#include <mbedtls/ssl_cookie.h> // mbedTLS renamed this header for 2.4.0. #if MBEDTLS_VERSION_MAJOR > 2 || MBEDTLS_VERSION_MINOR >= 4 -#include "mbedtls/net_sockets.h" +#include <mbedtls/net_sockets.h> #else -#include "mbedtls/net.h" +#include <mbedtls/net.h> #endif -#include "mbedtls/debug.h" -#include "mbedtls/ssl.h" - -#include "core/nng_impl.h" +#include <mbedtls/debug.h> +#include <mbedtls/ssl.h> // pair holds a private key and the associated certificate. typedef struct { diff --git a/src/supplemental/tls/tls_api.h b/src/supplemental/tls/tls_api.h index 1cea7914..4f8264a3 100644 --- a/src/supplemental/tls/tls_api.h +++ b/src/supplemental/tls/tls_api.h @@ -12,7 +12,7 @@ #ifndef NNG_SUPPLEMENTAL_TLS_TLS_API_H #define NNG_SUPPLEMENTAL_TLS_TLS_API_H -#include "core/stream.h" +#include "../../core/stream.h" // The implementation supplies this function to create the TLS connection // object. All fields will be zeroed. diff --git a/src/supplemental/tls/tls_common.c b/src/supplemental/tls/tls_common.c index a293b283..543b7563 100644 --- a/src/supplemental/tls/tls_common.c +++ b/src/supplemental/tls/tls_common.c @@ -13,7 +13,7 @@ #include <stdlib.h> #include <string.h> -#include "core/nng_impl.h" +#include "../../core/nng_impl.h" #include "tls_common.h" #include "tls_engine.h" diff --git a/src/supplemental/tls/tls_common.h b/src/supplemental/tls/tls_common.h index 79d7cc90..693948c2 100644 --- a/src/supplemental/tls/tls_common.h +++ b/src/supplemental/tls/tls_common.h @@ -13,7 +13,7 @@ #include <stdlib.h> #include <string.h> -#include "core/nng_impl.h" +#include "../../core/nng_impl.h" #include "tls_engine.h" diff --git a/src/supplemental/tls/tls_engine.h b/src/supplemental/tls/tls_engine.h index 65488907..048e35a7 100644 --- a/src/supplemental/tls/tls_engine.h +++ b/src/supplemental/tls/tls_engine.h @@ -13,7 +13,7 @@ #ifndef NNG_SUPPLEMENTAL_TLS_TLS_ENGINE_H #define NNG_SUPPLEMENTAL_TLS_TLS_ENGINE_H -#include "core/defs.h" +#include "../../core/defs.h" // Locking theory statement for TLS engines. The engine is assumed // operate only from the context of threads called by the common diff --git a/src/supplemental/tls/tls_stream.c b/src/supplemental/tls/tls_stream.c index cd248686..4a033887 100644 --- a/src/supplemental/tls/tls_stream.c +++ b/src/supplemental/tls/tls_stream.c @@ -13,7 +13,7 @@ #include <stdlib.h> #include <string.h> -#include "core/nng_impl.h" +#include "../../core/nng_impl.h" #include "tls_common.h" #include "tls_engine.h" diff --git a/src/supplemental/tls/tls_stream.h b/src/supplemental/tls/tls_stream.h index dca439af..4ea4912b 100644 --- a/src/supplemental/tls/tls_stream.h +++ b/src/supplemental/tls/tls_stream.h @@ -12,15 +12,15 @@ #ifndef NNG_TLS_TLS_STREAM_H #define NNG_TLS_TLS_STREAM_H -#include "core/nng_impl.h" +#include "../../core/nng_impl.h" #include "tls_common.h" typedef struct tls_stream_s { nng_stream stream; size_t size; nni_reap_node reap; - nni_aio conn_aio; - nni_aio *user_aio; + nng_aio conn_aio; + nng_aio *user_aio; nni_tls_conn conn; // NB: must be last! } tls_stream; diff --git a/src/supplemental/tls/tls_stubs.c b/src/supplemental/tls/tls_stubs.c index fc16afb5..5e21aca6 100644 --- a/src/supplemental/tls/tls_stubs.c +++ b/src/supplemental/tls/tls_stubs.c @@ -9,7 +9,7 @@ // found online at https://opensource.org/licenses/MIT. // -#include "core/nng_impl.h" +#include "../../core/nng_impl.h" #include "tls_engine.h" // Provide stubs for the case where TLS is not enabled. diff --git a/src/supplemental/tls/tls_test.c b/src/supplemental/tls/tls_test.c index 494c748c..cbe9c0b9 100644 --- a/src/supplemental/tls/tls_test.c +++ b/src/supplemental/tls/tls_test.c @@ -8,7 +8,8 @@ // #include "nng/nng.h" -#include <nuts.h> + +#include "../../testing/nuts.h" void test_tls_config_version(void) diff --git a/src/supplemental/tls/wolfssl/wolfssl.c b/src/supplemental/tls/wolfssl/wolfssl.c index a009ed38..a18c1605 100644 --- a/src/supplemental/tls/wolfssl/wolfssl.c +++ b/src/supplemental/tls/wolfssl/wolfssl.c @@ -31,7 +31,7 @@ #include <wolfssl/ssl.h> -#include "core/nng_impl.h" +#include "../../../core/nng_impl.h" #include "nng/nng.h" #include "../tls_engine.h" @@ -490,6 +490,7 @@ wolf_config_psk(nng_tls_engine_config *cfg, const char *identity, NNI_ARG_UNUSED(identity); NNI_ARG_UNUSED(key); NNI_ARG_UNUSED(key_len); + return (NNG_ENOTSUP); #else psk *psk, *srch; diff --git a/src/supplemental/websocket/sha1.h b/src/supplemental/websocket/sha1.h index b061e884..1e666977 100644 --- a/src/supplemental/websocket/sha1.h +++ b/src/supplemental/websocket/sha1.h @@ -11,7 +11,7 @@ #ifndef NNG_SUPPLEMENTAL_WEBSOCKET_SHA1_H #define NNG_SUPPLEMENTAL_WEBSOCKET_SHA1_H -#include "core/defs.h" +#include "../../core/defs.h" typedef struct { uint32_t digest[5]; // resulting digest diff --git a/src/supplemental/websocket/websocket.c b/src/supplemental/websocket/websocket.c index 4ddf8918..597efb76 100644 --- a/src/supplemental/websocket/websocket.c +++ b/src/supplemental/websocket/websocket.c @@ -13,9 +13,9 @@ #include <stdlib.h> #include <string.h> -#include "core/nng_impl.h" +#include "../../core/nng_impl.h" +#include "../../supplemental/http/http_api.h" #include "nng/http.h" -#include "supplemental/http/http_api.h" #include "base64.h" #include "sha1.h" diff --git a/src/supplemental/websocket/websocket.h b/src/supplemental/websocket/websocket.h index 0fa045d5..70652923 100644 --- a/src/supplemental/websocket/websocket.h +++ b/src/supplemental/websocket/websocket.h @@ -14,7 +14,7 @@ #include <stdbool.h> -#include "core/stream.h" +#include "../../core/stream.h" typedef struct nni_ws nni_ws; typedef struct nni_ws_listener nni_ws_listener; diff --git a/src/testing/util.c b/src/testing/util.c index e1543933..29bb411b 100644 --- a/src/testing/util.c +++ b/src/testing/util.c @@ -42,7 +42,7 @@ #include <poll.h> #endif -#include <nuts.h> +#include "nuts.h" uint64_t nuts_clock(void) |
