aboutsummaryrefslogtreecommitdiff
path: root/src/platform
diff options
context:
space:
mode:
Diffstat (limited to 'src/platform')
-rw-r--r--src/platform/posix/posix_aio.h3
-rw-r--r--src/platform/posix/posix_pollq.h8
-rw-r--r--src/platform/posix/posix_pollq_epoll.h6
-rw-r--r--src/platform/posix/posix_pollq_kqueue.h7
-rw-r--r--src/platform/posix/posix_pollq_port.h7
-rw-r--r--src/platform/posix/posix_pollq_select.h7
-rw-r--r--src/platform/posix/posix_resolv_gai.c2
-rw-r--r--src/platform/posix/posix_sockaddr.c2
-rw-r--r--src/platform/posix/posix_tcp.h6
-rw-r--r--src/platform/posix/posix_tcpconn.c11
-rw-r--r--src/platform/posix/posix_tcpdial.c16
-rw-r--r--src/platform/posix/posix_tcplisten.c14
-rw-r--r--src/platform/posix/posix_udp.c2
-rw-r--r--src/platform/tcp_stream_test.c5
-rw-r--r--src/platform/windows/win_tcplisten.c2
15 files changed, 65 insertions, 33 deletions
diff --git a/src/platform/posix/posix_aio.h b/src/platform/posix/posix_aio.h
index 3b1ce751..67b60a12 100644
--- a/src/platform/posix/posix_aio.h
+++ b/src/platform/posix/posix_aio.h
@@ -1,5 +1,5 @@
//
-// Copyright 2018 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
@@ -17,7 +17,6 @@
// that is not very performant on many systems. So we emulate this using
// one of several possible different backends.
-#include "core/nng_impl.h"
#include "posix_pollq.h"
#include <sys/stat.h> // needed for musl build
diff --git a/src/platform/posix/posix_pollq.h b/src/platform/posix/posix_pollq.h
index a6306643..a1b5f605 100644
--- a/src/platform/posix/posix_pollq.h
+++ b/src/platform/posix/posix_pollq.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
@@ -19,10 +19,8 @@
// that is not very performant on many systems. So we emulate this using
// one of several possible different backends.
-#include "core/nng_impl.h"
-
-typedef struct nni_posix_pfd nni_posix_pfd;
-typedef void (*nni_posix_pfd_cb)(void *, unsigned);
+// #include "core/nng_impl.h"
+#include "../../core/defs.h"
#if defined(NNG_POLLQ_KQUEUE)
#include "posix_pollq_kqueue.h"
diff --git a/src/platform/posix/posix_pollq_epoll.h b/src/platform/posix/posix_pollq_epoll.h
index a6ef5ad8..05755c52 100644
--- a/src/platform/posix/posix_pollq_epoll.h
+++ b/src/platform/posix/posix_pollq_epoll.h
@@ -13,6 +13,12 @@
#include <poll.h>
+#include "../../core/list.h"
+#include "../../core/platform.h"
+
+typedef struct nni_posix_pfd nni_posix_pfd;
+typedef void (*nni_posix_pfd_cb)(void *, unsigned);
+
// nni_posix_pfd is the handle used by the poller. It's internals are private
// to the poller.
struct nni_posix_pfd {
diff --git a/src/platform/posix/posix_pollq_kqueue.h b/src/platform/posix/posix_pollq_kqueue.h
index 69cf6dae..3959b5e6 100644
--- a/src/platform/posix/posix_pollq_kqueue.h
+++ b/src/platform/posix/posix_pollq_kqueue.h
@@ -11,6 +11,13 @@
#ifndef PLATFORM_POSIX_POLLQ_KQUEUE_H
#define PLATFORM_POSIX_POLLQ_KQUEUE_H
+#include "../../core/defs.h"
+#include "../../core/list.h"
+#include "../../core/platform.h"
+
+typedef struct nni_posix_pfd nni_posix_pfd;
+typedef void (*nni_posix_pfd_cb)(void *, unsigned);
+
// nni_posix_pfd is the handle used by the poller. It's internals are private
// to the poller.
struct nni_posix_pfd {
diff --git a/src/platform/posix/posix_pollq_port.h b/src/platform/posix/posix_pollq_port.h
index d8771527..377e3620 100644
--- a/src/platform/posix/posix_pollq_port.h
+++ b/src/platform/posix/posix_pollq_port.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
@@ -13,6 +13,11 @@
#include <poll.h>
+#include "../../core/platform.h"
+
+typedef struct nni_posix_pfd nni_posix_pfd;
+typedef void (*nni_posix_pfd_cb)(void *, unsigned);
+
typedef struct nni_posix_pollq nni_posix_pollq;
// nni_posix_pfd is the handle used by the poller. It's internals are private
diff --git a/src/platform/posix/posix_pollq_select.h b/src/platform/posix/posix_pollq_select.h
index 012f10a0..4f59c007 100644
--- a/src/platform/posix/posix_pollq_select.h
+++ b/src/platform/posix/posix_pollq_select.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,6 +11,11 @@
#ifndef PLATFORM_POSIX_POLLQ_SELECT_H
#define PLATFORM_POSIX_POLLQ_SELECT_H
+#include "../../core/platform.h"
+
+typedef struct nni_posix_pfd nni_posix_pfd;
+typedef void (*nni_posix_pfd_cb)(void *, unsigned);
+
// nni_posix_pfd is the handle used by the poller. It's internals are private
// to the poller.
struct nni_posix_pfd {
diff --git a/src/platform/posix/posix_resolv_gai.c b/src/platform/posix/posix_resolv_gai.c
index fe6ee2d7..3696cef1 100644
--- a/src/platform/posix/posix_resolv_gai.c
+++ b/src/platform/posix/posix_resolv_gai.c
@@ -37,7 +37,7 @@
#endif
#ifndef NNG_HAVE_INET6
-#ifdef HAVE_NNG_HAVE_INET6_BSD
+#ifdef NNG_HAVE_INET6_BSD
#define NNG_HAVE_INET6
#include <netinet6/in6.h>
#else
diff --git a/src/platform/posix/posix_sockaddr.c b/src/platform/posix/posix_sockaddr.c
index c86b6fb5..29d8b8f4 100644
--- a/src/platform/posix/posix_sockaddr.c
+++ b/src/platform/posix/posix_sockaddr.c
@@ -23,7 +23,7 @@
#include <sys/un.h>
#ifndef NNG_HAVE_INET6
-#ifdef HAVE_NNG_HAVE_INET6_BSD
+#ifdef NNG_HAVE_INET6_BSD
#define NNG_HAVE_INET6
#include <netinet6/in6.h>
#else
diff --git a/src/platform/posix/posix_tcp.h b/src/platform/posix/posix_tcp.h
index 20325841..d8743063 100644
--- a/src/platform/posix/posix_tcp.h
+++ b/src/platform/posix/posix_tcp.h
@@ -12,9 +12,11 @@
#ifndef PLATFORM_POSIX_TCP_H
#define PLATFORM_POSIX_TCP_H
-#include "core/nng_impl.h"
+#include "../../core/defs.h"
+#include "../../core/reap.h"
+#include "../../core/stream.h"
-#include "platform/posix/posix_aio.h"
+#include "posix_aio.h"
struct nni_tcp_conn {
nng_stream stream;
diff --git a/src/platform/posix/posix_tcpconn.c b/src/platform/posix/posix_tcpconn.c
index c04c27c1..833cd560 100644
--- a/src/platform/posix/posix_tcpconn.c
+++ b/src/platform/posix/posix_tcpconn.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>
// Copyright 2019 Devolutions <info@devolutions.net>
//
@@ -9,9 +9,6 @@
// found online at https://opensource.org/licenses/MIT.
//
-#include "core/nng_impl.h"
-#include "platform/posix/posix_pollq.h"
-
#include <errno.h>
#include <fcntl.h>
#include <netinet/in.h>
@@ -26,6 +23,12 @@
#define MSG_NOSIGNAL 0
#endif
+#include "../../core/aio.h"
+#include "../../core/defs.h"
+#include "../../core/options.h"
+#include "../../core/platform.h"
+
+#include "posix_pollq.h"
#include "posix_tcp.h"
static void
diff --git a/src/platform/posix/posix_tcpdial.c b/src/platform/posix/posix_tcpdial.c
index 181a667f..12fa990f 100644
--- a/src/platform/posix/posix_tcpdial.c
+++ b/src/platform/posix/posix_tcpdial.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>
// Copyright 2018 Devolutions <info@devolutions.net>
//
@@ -9,8 +9,6 @@
// found online at https://opensource.org/licenses/MIT.
//
-#include "core/nng_impl.h"
-
#include <errno.h>
#include <netinet/in.h>
#include <string.h>
@@ -21,10 +19,8 @@
#define SOCK_CLOEXEC 0
#endif
-#include "posix_tcp.h"
-
#ifndef NNG_HAVE_INET6
-#ifdef HAVE_NNG_HAVE_INET6_BSD
+#ifdef NNG_HAVE_INET6_BSD
#define NNG_HAVE_INET6
#include <netinet6/in6.h>
#else
@@ -32,6 +28,14 @@
#endif
#endif
+#include "../../core/aio.h"
+#include "../../core/defs.h"
+#include "../../core/options.h"
+#include "../../core/platform.h"
+#include "../../core/refcnt.h"
+
+#include "posix_tcp.h"
+
struct nni_tcp_dialer {
nni_list connq; // pending connections
bool closed;
diff --git a/src/platform/posix/posix_tcplisten.c b/src/platform/posix/posix_tcplisten.c
index 700af4c5..b158508c 100644
--- a/src/platform/posix/posix_tcplisten.c
+++ b/src/platform/posix/posix_tcplisten.c
@@ -9,9 +9,6 @@
// found online at https://opensource.org/licenses/MIT.
//
-#include "core/nng_impl.h"
-#include "nng/nng.h"
-
#include <arpa/inet.h>
#include <errno.h>
#include <fcntl.h>
@@ -29,7 +26,7 @@
#endif
#ifndef NNG_HAVE_INET6
-#ifdef HAVE_NNG_HAVE_INET6_BSD
+#ifdef NNG_HAVE_INET6_BSD
#define NNG_HAVE_INET6
#include <netinet6/in6.h>
#else
@@ -37,6 +34,13 @@
#endif
#endif
+#include "../../core/aio.h"
+#include "../../core/defs.h"
+#include "../../core/list.h"
+#include "../../core/options.h"
+#include "../../core/platform.h"
+#include "../../core/url.h"
+
#include "posix_tcp.h"
typedef struct tcp_listener {
@@ -480,7 +484,7 @@ static const nni_option tcp_listener_options[] = {
.o_get = tcp_listener_get_keepalive,
},
{
- .o_name = NNG_OPT_TCP_BOUND_PORT,
+ .o_name = NNG_OPT_BOUND_PORT,
.o_get = tcp_listener_get_port,
},
{
diff --git a/src/platform/posix/posix_udp.c b/src/platform/posix/posix_udp.c
index 99460721..7188b427 100644
--- a/src/platform/posix/posix_udp.c
+++ b/src/platform/posix/posix_udp.c
@@ -32,7 +32,7 @@
#endif
#ifndef NNG_HAVE_INET6
-#ifdef HAVE_NNG_HAVE_INET6_BSD
+#ifdef NNG_HAVE_INET6_BSD
#define NNG_HAVE_INET6
#include <netinet6/in6.h>
#else
diff --git a/src/platform/tcp_stream_test.c b/src/platform/tcp_stream_test.c
index 1ed415c7..a0943e6c 100644
--- a/src/platform/tcp_stream_test.c
+++ b/src/platform/tcp_stream_test.c
@@ -164,7 +164,7 @@ test_tcp_listen_port_zero_not_bound(void)
// start a listening stream listener but do not call accept
NUTS_PASS(nng_stream_listener_alloc(&l, addr));
- NUTS_FAIL(nng_stream_listener_get_int(l, NNG_OPT_TCP_BOUND_PORT, &p),
+ NUTS_FAIL(nng_stream_listener_get_int(l, NNG_OPT_BOUND_PORT, &p),
NNG_ESTATE);
nng_stream_listener_free(l);
}
@@ -204,8 +204,7 @@ test_tcp_listen_activation(void)
NUTS_PASS(nng_stream_listener_alloc(&l1, addr));
NUTS_PASS(nng_stream_listener_listen(l1));
- NUTS_PASS(
- nng_stream_listener_get_int(l1, NNG_OPT_TCP_BOUND_PORT, &port));
+ NUTS_PASS(nng_stream_listener_get_int(l1, NNG_OPT_BOUND_PORT, &port));
snprintf(url, sizeof(url), "tcp4://127.0.0.1:%u", port);
NUTS_PASS(nng_stream_dialer_alloc(&d, url));
diff --git a/src/platform/windows/win_tcplisten.c b/src/platform/windows/win_tcplisten.c
index 0b11104d..b32c1fbb 100644
--- a/src/platform/windows/win_tcplisten.c
+++ b/src/platform/windows/win_tcplisten.c
@@ -517,7 +517,7 @@ static const nni_option tcp_listener_options[] = {
.o_get = tcp_listener_get_keepalive,
},
{
- .o_name = NNG_OPT_TCP_BOUND_PORT,
+ .o_name = NNG_OPT_BOUND_PORT,
.o_get = tcp_listener_get_port,
},
{