aboutsummaryrefslogtreecommitdiff
path: root/src/supplemental
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2025-10-05 08:25:50 -0700
committerGarrett D'Amore <garrett@damore.org>2025-10-05 08:38:19 -0700
commitd1bd64c8251171ac8e1d4e71ab8726c2a64fd55a (patch)
tree579cc387639a9be8e0b162aeaa0cd55d9c87f725 /src/supplemental
parent883e0289cdab5a81312b0593b098f70114b61f88 (diff)
downloadnng-d1bd64c8251171ac8e1d4e71ab8726c2a64fd55a.tar.gz
nng-d1bd64c8251171ac8e1d4e71ab8726c2a64fd55a.tar.bz2
nng-d1bd64c8251171ac8e1d4e71ab8726c2a64fd55a.zip
Various header file fixes... also fix compilation errors when HTTP is disabled.v2.0.0-alpha.6
Also, some instances nni_aio are changed to nng_aio. We think we want to harmonize some of these types going forward as it will reduce the need to include headers hopefully letting us get away with just "defs.h" in more places.
Diffstat (limited to 'src/supplemental')
-rw-r--r--src/supplemental/http/http_api.h31
-rw-r--r--src/supplemental/http/http_chunk.c2
-rw-r--r--src/supplemental/http/http_client.c2
-rw-r--r--src/supplemental/http/http_conn.c14
-rw-r--r--src/supplemental/http/http_msg.c6
-rw-r--r--src/supplemental/http/http_msg.h4
-rw-r--r--src/supplemental/http/http_public.c20
-rw-r--r--src/supplemental/http/http_schemes.c6
-rw-r--r--src/supplemental/http/http_server.c2
-rw-r--r--src/supplemental/http/http_server_test.c4
-rw-r--r--src/supplemental/tls/mbedtls/mbedtls.c28
-rw-r--r--src/supplemental/tls/tls_api.h2
-rw-r--r--src/supplemental/tls/tls_common.c2
-rw-r--r--src/supplemental/tls/tls_common.h2
-rw-r--r--src/supplemental/tls/tls_engine.h2
-rw-r--r--src/supplemental/tls/tls_stream.c2
-rw-r--r--src/supplemental/tls/tls_stream.h6
-rw-r--r--src/supplemental/tls/tls_stubs.c2
-rw-r--r--src/supplemental/tls/tls_test.c3
-rw-r--r--src/supplemental/tls/wolfssl/wolfssl.c3
-rw-r--r--src/supplemental/websocket/sha1.h2
-rw-r--r--src/supplemental/websocket/websocket.c4
-rw-r--r--src/supplemental/websocket/websocket.h2
23 files changed, 75 insertions, 76 deletions
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;