diff options
Diffstat (limited to 'src/transport')
| -rw-r--r-- | src/transport/inproc/CMakeLists.txt | 4 | ||||
| -rw-r--r-- | src/transport/inproc/inproc.h | 18 | ||||
| -rw-r--r-- | src/transport/ipc/CMakeLists.txt | 4 | ||||
| -rw-r--r-- | src/transport/ipc/ipc.c | 2 | ||||
| -rw-r--r-- | src/transport/ipc/ipc.h | 50 | ||||
| -rw-r--r-- | src/transport/tcp/CMakeLists.txt | 4 | ||||
| -rw-r--r-- | src/transport/tcp/tcp.h | 18 | ||||
| -rw-r--r-- | src/transport/tls/CMakeLists.txt | 4 | ||||
| -rw-r--r-- | src/transport/tls/tls.c | 4 | ||||
| -rw-r--r-- | src/transport/tls/tls.h | 18 | ||||
| -rw-r--r-- | src/transport/ws/CMakeLists.txt | 4 | ||||
| -rw-r--r-- | src/transport/ws/websocket.c | 4 | ||||
| -rw-r--r-- | src/transport/ws/websocket.h | 32 | ||||
| -rw-r--r-- | src/transport/zerotier/CMakeLists.txt | 4 | ||||
| -rw-r--r-- | src/transport/zerotier/zerotier.c | 3 | ||||
| -rw-r--r-- | src/transport/zerotier/zerotier.h | 149 |
16 files changed, 13 insertions, 309 deletions
diff --git a/src/transport/inproc/CMakeLists.txt b/src/transport/inproc/CMakeLists.txt index 79264253..bab4cd7e 100644 --- a/src/transport/inproc/CMakeLists.txt +++ b/src/transport/inproc/CMakeLists.txt @@ -13,11 +13,9 @@ option (NNG_TRANSPORT_INPROC "Enable inproc transport." ON) mark_as_advanced(NNG_TRANSPORT_INPROC) if (NNG_TRANSPORT_INPROC) - set(_SRCS transport/inproc/inproc.c transport/inproc/inproc.h) - set(_HDRS transport/inproc/inproc.h) + set(_SRCS transport/inproc/inproc.c ${PROJECT_SOURCE_DIR}/include/nng/transport/inproc/inproc.h) set(_DEFS -DNNG_TRANSPORT_INPROC) set(NNG_SRCS ${NNG_SRCS} ${_SRCS} PARENT_SCOPE) - set(NNG_HDRS ${NNG_HDRS} ${_HDRS} PARENT_SCOPE) set(NNG_DEFS ${NNG_DEFS} ${_DEFS} PARENT_SCOPE) endif() diff --git a/src/transport/inproc/inproc.h b/src/transport/inproc/inproc.h deleted file mode 100644 index bfd6e1ca..00000000 --- a/src/transport/inproc/inproc.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// Copyright 2017 Garrett D'Amore <garrett@damore.org> -// Copyright 2017 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. -// - -#ifndef NNG_TRANSPORT_INPROC_INPROC_H -#define NNG_TRANSPORT_INPROC_INPROC_H - -// inproc transport. This is used for intra-process communication. - -NNG_DECL int nng_inproc_register(void); - -#endif // NNG_TRANSPORT_INPROC_INPROC_H diff --git a/src/transport/ipc/CMakeLists.txt b/src/transport/ipc/CMakeLists.txt index 885b62b6..0fd31984 100644 --- a/src/transport/ipc/CMakeLists.txt +++ b/src/transport/ipc/CMakeLists.txt @@ -14,10 +14,8 @@ mark_as_advanced(NNG_TRANSPORT_IPC) if (NNG_TRANSPORT_IPC) set(_DEFS -DNNG_TRANSPORT_IPC) - set(_SRCS transport/ipc/ipc.c transport/ipc/ipc.h) - set(_HDRS transport/ipc/ipc.h) + set(_SRCS transport/ipc/ipc.c ${PROJECT_SOURCE_DIR}/include/nng/transport/ipc/ipc.h) set(NNG_DEFS ${NNG_DEFS} ${_DEFS} PARENT_SCOPE) set(NNG_SRCS ${NNG_SRCS} ${_SRCS} PARENT_SCOPE) - set(NNG_HDRS ${NNG_HDRS} ${_HDRS} PARENT_SCOPE) endif() diff --git a/src/transport/ipc/ipc.c b/src/transport/ipc/ipc.c index 58fff1a7..030d6bfe 100644 --- a/src/transport/ipc/ipc.c +++ b/src/transport/ipc/ipc.c @@ -13,7 +13,7 @@ #include <string.h> #include "core/nng_impl.h" -#include "ipc.h" +#include "nng/transport/ipc/ipc.h" // IPC transport. Platform specific IPC operations must be // supplied as well. Normally the IPC is UNIX domain sockets or diff --git a/src/transport/ipc/ipc.h b/src/transport/ipc/ipc.h deleted file mode 100644 index 497fb2b5..00000000 --- a/src/transport/ipc/ipc.h +++ /dev/null @@ -1,50 +0,0 @@ -// -// 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. -// - -#ifndef NNG_TRANSPORT_IPC_IPC_H -#define NNG_TRANSPORT_IPC_IPC_H - -// ipc transport. This is used for inter-process communication on -// the same host computer. - -NNG_DECL int nng_ipc_register(void); - -// Security Descriptor. This option may only be set on listeners -// on the Windows platform, where the object is a pointer to a -// a Windows SECURITY_DESCRIPTOR. -#define NNG_OPT_IPC_SECURITY_DESCRIPTOR "ipc:security-descriptor" - -// Permissions bits. This option is only valid for listeners on -// POSIX platforms and others that honor UNIX style permission bits. -// Note that some platforms may not honor the permissions here, although -// at least Linux and macOS seem to do so. Check before you rely on -// this for security. -#define NNG_OPT_IPC_PERMISSIONS "ipc:permissions" - -// Peer UID. This is only available on POSIX style systems. -#define NNG_OPT_IPC_PEER_UID "ipc:peer-uid" - -// Peer GID (primary group). This is only available on POSIX style systems. -#define NNG_OPT_IPC_PEER_GID "ipc:peer-gid" - -// Peer process ID. Available on Windows, Linux, and SunOS. -// In theory we could obtain this with the first message sent, -// but we have elected not to do this for now. (Nice RFE for a FreeBSD -// guru though.) -#define NNG_OPT_IPC_PEER_PID "ipc:peer-pid" - -// Peer Zone ID. Only on SunOS systems. (Linux containers have no -// definable kernel identity; they are a user-land fabrication made up -// from various pieces of different namespaces. FreeBSD does have -// something called JailIDs, but it isn't obvious how to determine this, -// or even if processes can use IPC across jail boundaries.) -#define NNG_OPT_IPC_PEER_ZONEID "ipc:peer-zoneid" - -#endif // NNG_TRANSPORT_IPC_IPC_H diff --git a/src/transport/tcp/CMakeLists.txt b/src/transport/tcp/CMakeLists.txt index 9390c048..c36584b5 100644 --- a/src/transport/tcp/CMakeLists.txt +++ b/src/transport/tcp/CMakeLists.txt @@ -14,10 +14,8 @@ mark_as_advanced(NNG_TRANSPORT_TCP) if (NNG_TRANSPORT_TCP) set(_DEFS -DNNG_TRANSPORT_TCP) - set(_SRCS transport/tcp/tcp.c transport/tcp/tcp.h) - set(_HDRS transport/tcp/tcp.h) + set(_SRCS transport/tcp/tcp.c ${PROJECT_SOURCE_DIR}/include/nng/transport/tcp/tcp.h) set(NNG_SRCS ${NNG_SRCS} ${_SRCS} PARENT_SCOPE) - set(NNG_HDRS ${NNG_HDRS} ${_HDRS} PARENT_SCOPE) set(NNG_DEFS ${NNG_DEFS} ${_DEFS} PARENT_SCOPE) endif() diff --git a/src/transport/tcp/tcp.h b/src/transport/tcp/tcp.h deleted file mode 100644 index 6975109f..00000000 --- a/src/transport/tcp/tcp.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// Copyright 2017 Garrett D'Amore <garrett@damore.org> -// Copyright 2017 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. -// - -#ifndef NNG_TRANSPORT_TCP_TCP_H -#define NNG_TRANSPORT_TCP_TCP_H - -// TCP transport. This is used for communication over TCP/IP. - -NNG_DECL int nng_tcp_register(void); - -#endif // NNG_TRANSPORT_TCP_TCP_H diff --git a/src/transport/tls/CMakeLists.txt b/src/transport/tls/CMakeLists.txt index 80bc60af..8668ee4a 100644 --- a/src/transport/tls/CMakeLists.txt +++ b/src/transport/tls/CMakeLists.txt @@ -15,10 +15,8 @@ mark_as_advanced(NNG_TRANSPORT_TLS) if (NNG_TRANSPORT_TLS) set(_DEFS -DNNG_TRANSPORT_TLS) - set(_SRCS transport/tls/tls.c transport/tls/tls.h) - set(_HDRS transport/tls/tls.h) + set(_SRCS transport/tls/tls.c ${PROJECT_SOURCE_DIR}/include/nng/transport/tls/tls.h) set(NNG_DEFS ${NNG_DEFS} ${_DEFS} PARENT_SCOPE) set(NNG_SRCS ${NNG_SRCS} ${_SRCS} PARENT_SCOPE) - set(NNG_HDRS ${NNG_HDRS} ${_HDRS} PARENT_SCOPE) endif() diff --git a/src/transport/tls/tls.c b/src/transport/tls/tls.c index a8f196f7..867be9b8 100644 --- a/src/transport/tls/tls.c +++ b/src/transport/tls/tls.c @@ -14,9 +14,9 @@ #include "core/nng_impl.h" -#include "supplemental/tls/tls.h" +#include "nng/supplemental/tls/tls.h" #include "supplemental/tls/tls_api.h" -#include "tls.h" +#include "nng/transport/tls/tls.h" // TLS over TCP transport. Platform specific TCP operations must be // supplied as well, and uses the supplemental TLS v1.2 code. It is not diff --git a/src/transport/tls/tls.h b/src/transport/tls/tls.h deleted file mode 100644 index a3fa0eb9..00000000 --- a/src/transport/tls/tls.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// 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. -// - -#ifndef NNG_TRANSPORT_TLS_TLS_H -#define NNG_TRANSPORT_TLS_TLS_H - -// TLS transport. This is used for communication via TLS v1.2 over TCP/IP. - -NNG_DECL int nng_tls_register(void); - -#endif // NNG_TRANSPORT_TLS_TLS_H diff --git a/src/transport/ws/CMakeLists.txt b/src/transport/ws/CMakeLists.txt index 8104d83c..6e618010 100644 --- a/src/transport/ws/CMakeLists.txt +++ b/src/transport/ws/CMakeLists.txt @@ -33,9 +33,7 @@ if (NNG_TRANSPORT_WS OR NNG_TRANSPORT_WSS) set(NNG_SUPP_BASE64 ON PARENT_SCOPE) set(NNG_SUPP_SHA1 ON PARENT_SCOPE) - set(_SRCS transport/ws/websocket.c transport/ws/websocket.h) - set(_HDRS transport/ws/websocket.h) + set(_SRCS transport/ws/websocket.c ${PROJECT_SOURCE_DIR}/include/nng/transport/ws/websocket.h) set(NNG_DEFS ${NNG_DEFS} ${_DEFS} PARENT_SCOPE) set(NNG_SRCS ${NNG_SRCS} ${_SRCS} PARENT_SCOPE) - set(NNG_HDRS ${NNG_HDRS} ${_HDRS} PARENT_SCOPE) endif() diff --git a/src/transport/ws/websocket.c b/src/transport/ws/websocket.c index 73dd8234..12a1ef17 100644 --- a/src/transport/ws/websocket.c +++ b/src/transport/ws/websocket.c @@ -15,11 +15,11 @@ #include "core/nng_impl.h" #include "supplemental/http/http_api.h" -#include "supplemental/tls/tls.h" +#include "nng/supplemental/tls/tls.h" #include "supplemental/tls/tls_api.h" #include "supplemental/websocket/websocket.h" -#include "websocket.h" +#include "nng/transport/ws/websocket.h" typedef struct ws_dialer ws_dialer; typedef struct ws_listener ws_listener; diff --git a/src/transport/ws/websocket.h b/src/transport/ws/websocket.h deleted file mode 100644 index 8179beab..00000000 --- a/src/transport/ws/websocket.h +++ /dev/null @@ -1,32 +0,0 @@ -// -// 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. -// - -#ifndef NNG_TRANSPORT_WS_WEBSOCKET_H -#define NNG_TRANSPORT_WS_WEBSOCKET_H - -// WebSocket transport. This is used for communication via WebSocket. - -NNG_DECL int nng_ws_register(void); - -// NNG_OPT_WS_REQUEST_HEADERS is a string containing the -// request headers, formatted as CRLF terminated lines. -#define NNG_OPT_WS_REQUEST_HEADERS "ws:request-headers" - -// NNG_OPT_WS_RESPONSE_HEADERS is a string containing the -// response headers, formatted as CRLF terminated lines. -#define NNG_OPT_WS_RESPONSE_HEADERS "ws:response-headers" - -// These aliases are for WSS naming consistency. -#define NNG_OPT_WSS_REQUEST_HEADERS NNG_OPT_WS_REQUEST_HEADERS -#define NNG_OPT_WSS_RESPONSE_HEADERS NNG_OPT_WS_RESPONSE_HEADERS - -NNG_DECL int nng_wss_register(void); - -#endif // NNG_TRANSPORT_WS_WEBSOCKET_H diff --git a/src/transport/zerotier/CMakeLists.txt b/src/transport/zerotier/CMakeLists.txt index 686a0a8a..5eca54c3 100644 --- a/src/transport/zerotier/CMakeLists.txt +++ b/src/transport/zerotier/CMakeLists.txt @@ -35,13 +35,11 @@ if (NNG_TRANSPORT_ZEROTIER) set(_LIBS zerotiercore::zerotiercore) set(_DEFS -DNNG_TRANSPORT_ZEROTIER) - set(_SRCS transport/zerotier/zerotier.c transport/zerotier/zerotier.h) - set(_HDRS transport/zerotier/zerotier.h) + set(_SRCS transport/zerotier/zerotier.c ${PROJECT_SOURCE_DIR}/include/nng/transport/zerotier/zerotier.h) set(NNG_DEFS ${NNG_DEFS} ${_DEFS} PARENT_SCOPE) set(NNG_LIBS ${NNG_LIBS} ${_LIBS} PARENT_SCOPE) set(NNG_PKGS ${NNG_PKGS} ${_PKGS} PARENT_SCOPE) set(NNG_SRCS ${NNG_SRCS} ${_SRCS} PARENT_SCOPE) - set(NNG_HDRS ${NNG_HDRS} ${_HDRS} PARENT_SCOPE) endif() diff --git a/src/transport/zerotier/zerotier.c b/src/transport/zerotier/zerotier.c index d98171cc..a767e168 100644 --- a/src/transport/zerotier/zerotier.c +++ b/src/transport/zerotier/zerotier.c @@ -14,7 +14,8 @@ #include <string.h> #include "core/nng_impl.h" -#include "zerotier.h" + +#include "nng/transport/zerotier/zerotier.h" #include <zerotiercore/ZeroTierOne.h> diff --git a/src/transport/zerotier/zerotier.h b/src/transport/zerotier/zerotier.h deleted file mode 100644 index ab4d8511..00000000 --- a/src/transport/zerotier/zerotier.h +++ /dev/null @@ -1,149 +0,0 @@ -// -// 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. -// - -#ifndef NNG_TRANSPORT_ZEROTIER_ZEROTIER_H -#define NNG_TRANSPORT_ZEROTIER_ZEROTIER_H - -// ZeroTier Transport. This sits on the ZeroTier L2 network, which itself -// is implemented on top of UDP. This requires the 3rd party -// libzerotiercore library (which is GPLv3!) and platform specific UDP -// functionality to be built in. Note that care must be taken to link -// dynamically if one wishes to avoid making your entire application GPL3. -// (Alternatively ZeroTier offers commercial licenses which may prevent -// this particular problem.) This implementation does not make use of -// certain advanced capabilities in ZeroTier such as more sophisticated -// route management and TCP fallback. You need to have connectivity -// to the Internet to use this. (Or at least to your Planetary root.) -// -// The ZeroTier URL format we support is zt://<ztid>.<nwid>:<port> where -// the <nwid> component represents the 64-bit hexadecimal ZeroTier -// network ID,the <ztid> represents the 40-bit hexadecimal ZeroTier -// node (device) ID, and the <port> is a 24-bit (decimal) port number. -// -// A listener may replace the <ztid> with a wildcard, to just bind to itself, -// in which case the format will be zt://*.<nwid>:<port> -// -// A listener may also use either 0 or * for the <port> to indicate that -// a random local ephemeral port should be used. -// -// Because ZeroTier takes a while to establish connectivity, it is even -// more important that applications using the ZeroTier transport not -// assume that a connection will be immediately available. It can take -// quite a few seconds for peer-to-peer connectivity to be established. -// -// The ZeroTier transport was funded by Capitar IT Group, BV. -// -// The protocol itself is documented online at: -// http://nanomsg.org/rfcs/sp-zerotier-v0.html -// -// This transport is highly experimental. - -// ZeroTier transport-specific options. - -// NNG_OPT_ZT_HOME is a string containing a directory, where persistent -// state (key files, etc.) will be stored. It should be protected from -// unauthorized viewing and modification. This option must be set on an -// endpoint or socket before the endpoint(s) are started. If the unset, -// or an empty string, then no persistence is used and an ephemeral node -// will be created instead. Note that different endpoints may use different -// values for this option, and that will lead to each endpoint having a -// different ZeroTier identity -- however only one ephemeral node will -// be created for the application. -#define NNG_OPT_ZT_HOME "zt:home" - -// NNG_OPT_ZT_NWID is the 64-bit network ID, represented using a uint64_t in -// native byte order. This is a read-only option; it is derived automatically -// from the URL. -#define NNG_OPT_ZT_NWID "zt:nwid" - -// NNG_OPT_ZT_NODE is the 40-bit node ID, stored in native order in the low -// 40-bits of a uint64_t, of the node. This is a read-only option. -#define NNG_OPT_ZT_NODE "zt:node" - -// NNG_OPT_ZT_NETWORK_STATUS represents the status of the ZeroTier virtual -// network. The option is a read-only value, stored as an integer, which -// takes of the nng_zt_network_status_xxx values listed below. -#define NNG_OPT_ZT_NETWORK_STATUS "zt:network-status" - -// NNG_OPT_ZT_NETWORK_NAME is a human-readable name for the ZeroTier virtual -// network. This will only be set once the ZeroTier network has come up -// as the name comes from the network controller. This is read-only, and -// is presented as an ASCIIZ string. -#define NNG_OPT_ZT_NETWORK_NAME "zt:network-name" - -// NNG_OPT_ZT_PING_TIME and NNG_OPT_ZT_PING_TRIES are used to send ping -// requests when a connection appears to be idled. If a logical session -// has not received traffic from it's peer for ping-time, then a ping packet -// is sent. This will be done up to ping-count times. If no traffic from -// the remote peer is seen after all ping requests are sent, then the peer -// is assumed to be dead or offline, and the session is closed. The -// NNG_OPT_ZT_PING_TIME is a duration (msec, stored as an nng_duration, and -// NNG_OPT_ZT_PING_COUNT is an integer.) This ping process can be disabled -// by setting either ping-time or ping-count to zero. -#define NNG_OPT_ZT_PING_TIME "zt:ping-time" -#define NNG_OPT_ZT_PING_TRIES "zt:ping-tries" - -// NNG_OPT_ZT_CONN_TIME and NNG_OPT_ZT_CONN_TRIES are used to control -// the interval between connection attempts, and the maximum number of -// connection attempts to make before assuming that the peer is absent -// (and returning NNG_ETIMEDOUT). The NNG_OPT_ZT_CONN_TIME is a duration, -// the NNG_OPT_ZT_CONN_TRIES is an integer. -#define NNG_OPT_ZT_CONN_TIME "zt:conn-time" -#define NNG_OPT_ZT_CONN_TRIES "zt:conn-tries" - -// NNG_OPT_ZT_MTU is a read-only size_t and contains the ZeroTier virtual -// network MTU (i.e. the L2 payload MTU). Messages that are larger than this -// (including our 20-byte header data) will be fragmented into multiple -// virtual L2 frames. -#define NNG_OPT_ZT_MTU "zt:mtu" - -// NNG_OPT_ZT_ORBIT is a write-only API to add a "moon" -- this affects the -// endpoint, and all other endpoints using the same node. The value is -// a pair of 64-bit integers -- the first is the moon ID, and the second, if -// non-zero, is the node ID of a server. Conventionally this is the same -// as the moon ID. -#define NNG_OPT_ZT_ORBIT "zt:orbit" - -// NNG_OPT_ZT_DEORBIT removes the moon ID from the node, so that it will -// no longer use that moon. The argument is a moon ID to remove. If the -// node is not already orbiting, then this operation does nothing. -#define NNG_OPT_ZT_DEORBIT "zt:deorbit" - -// NNG_OPT_ZT_ADD_LOCAL_ADDR adds the local address (IP address) as -// local interface address. This facilitates the local startup and -// discovery. Note that this can be called multiple times to add -// additional address. This is optional, and usually not needed. -// The value is an nng_sockaddr corresponding to an IP (or IPv6) address. -#define NNG_OPT_ZT_ADD_LOCAL_ADDR "zt:add-local-addr" - -// NNG_OPT_ZT_CLEAR_LOCAL_ADDRS clears ZeroTier's notion of all -// local addresses. This may be useful when used on a mobile node, -// to reset the notion of what the local addresses are. This -// option takes no argument really. -#define NNG_OPT_ZT_CLEAR_LOCAL_ADDRS "zt:clear-local-addrs" - -// Network status values. -// These values are supplied to help folks checking status. They are the -// return values from zt_opt_status. We avoid hard coding them as defines, -// to keep applications from baking in values that may change if the -// underlying ZeroTier transport changes. -enum nng_zt_status { - NNG_ZT_STATUS_UP, - NNG_ZT_STATUS_CONFIG, - NNG_ZT_STATUS_DENIED, - NNG_ZT_STATUS_NOTFOUND, - NNG_ZT_STATUS_ERROR, - NNG_ZT_STATUS_OBSOLETE, - NNG_ZT_STATUS_UNKNOWN, -}; - -NNG_DECL int nng_zt_register(void); - -#endif // NNG_TRANSPORT_ZEROTIER_ZEROTIER_H |
