diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/nng/nng.h | 156 | ||||
| -rw-r--r-- | include/nng/supplemental/ipc/ipc.h | 133 | ||||
| -rw-r--r-- | include/nng/supplemental/tcp/tcp.h | 154 | ||||
| -rw-r--r-- | include/nng/supplemental/tls/tls.h | 68 | ||||
| -rw-r--r-- | include/nng/transport/tcp/tcp.h | 2 | ||||
| -rw-r--r-- | include/nng/transport/ws/websocket.h | 8 |
6 files changed, 158 insertions, 363 deletions
diff --git a/include/nng/nng.h b/include/nng/nng.h index 3063a652..eb50599a 100644 --- a/include/nng/nng.h +++ b/include/nng/nng.h @@ -788,6 +788,48 @@ enum nng_flag_enum { // or even if processes can use IPC across jail boundaries.) #define NNG_OPT_IPC_PEER_ZONEID "ipc:peer-zoneid" +// WebSocket Options. + +// 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" + +// NNG_OPT_WS_REQUEST_HEADER is a prefix, for a dynamic +// property name. This allows direct access to any named header. +// Concatenate this with the name of the property (case is not sensitive). +// Only the first such header is returned. +#define NNG_OPT_WS_RESPONSE_HEADER "ws:response-header:" + +// NNG_OPT_WS_RESPONSE_HEADER is like NNG_OPT_REQUEST_HEADER, but used for +// accessing the request headers. +#define NNG_OPT_WS_REQUEST_HEADER "ws:request-header:" + +// NNG_OPT_WS_REQUEST_URI is used to obtain the URI sent by the client. +// This can be useful when a handler supports an entire directory tree. +#define NNG_OPT_WS_REQUEST_URI "ws:request-uri" + +// NNG_OPT_WS_TXFRAMESZ is used to configure the fragmentation size +// used for frames. This has a default value of 64k. Large values +// are good for throughput, but penalize latency. They also require +// additional buffering on the peer. This value must not be larger +// than what the peer will accept, and unfortunately there is no way +// to negotiate this. +#define NNG_OPT_WS_SENDMAXFRAME "ws:txframe-max" + +// NNG_OPT_WS_RXFRAMESZ is the largest frame we will accept. This should +// probably not be larger than NNG_OPT_RECVMAXSZ. If the sender attempts +// to send more data than this in a single message, it will be dropped. +#define NNG_OPT_WS_RECVMAXFRAME "ws:rxframe-max" + +// NNG_OPT_WS_PROTOCOL is the "websocket subprotocol" -- it's a string. +// This is also known as the Sec-WebSocket-Protocol header. It is treated +// specially. This is part of the websocket handshake. +#define NNG_OPT_WS_PROTOCOL "ws:protocol" + // XXX: TBD: priorities, ipv4only // Statistics. These are for informational purposes only, and subject @@ -973,6 +1015,120 @@ NNG_DECL int nng_url_clone(nng_url **, const nng_url *); // nng_version returns the library version as a human readable string. NNG_DECL const char *nng_version(void); + +// nng_stream operations permit direct access to low level streams, +// which can have a variety of uses. Internally most of the transports +// are built on top of these. Streams are created by other dialers or +// listeners. The API for creating dialers and listeners varies. + +typedef struct nng_stream nng_stream; +typedef struct nng_stream_dialer nng_stream_dialer; +typedef struct nng_stream_listener nng_stream_listener; + +NNG_DECL void nng_stream_free(nng_stream *); +NNG_DECL void nng_stream_close(nng_stream *); +NNG_DECL void nng_stream_send(nng_stream *, nng_aio *); +NNG_DECL void nng_stream_recv(nng_stream *, nng_aio *); +NNG_DECL int nng_stream_get(nng_stream *, const char *, void *, size_t *); +NNG_DECL int nng_stream_get_bool(nng_stream *, const char *, bool *); +NNG_DECL int nng_stream_get_int(nng_stream *, const char *, int *); +NNG_DECL int nng_stream_get_ms(nng_stream *, const char *, nng_duration *); +NNG_DECL int nng_stream_get_size(nng_stream *, const char *, size_t *); +NNG_DECL int nng_stream_get_uint64(nng_stream *, const char *, uint64_t *); +NNG_DECL int nng_stream_get_ptr(nng_stream *, const char *, void **); +NNG_DECL int nng_stream_get_addr(nng_stream *, const char *, nng_sockaddr *); +NNG_DECL int nng_stream_set(nng_stream *, const char *, const void *, size_t); +NNG_DECL int nng_stream_set_bool(nng_stream *, const char *, bool); +NNG_DECL int nng_stream_set_int(nng_stream *, const char *, int); +NNG_DECL int nng_stream_set_ms(nng_stream *, const char *, nng_duration); +NNG_DECL int nng_stream_set_size(nng_stream *, const char *, size_t); +NNG_DECL int nng_stream_set_uint64(nng_stream *, const char *, uint64_t); +NNG_DECL int nng_stream_set_string(nng_stream *, const char *, const char *); +NNG_DECL int nng_stream_set_ptr(nng_stream *, const char *, void *); +NNG_DECL int nng_stream_set_addr( + nng_stream *, const char *, const nng_sockaddr *); + +NNG_DECL int nng_stream_dialer_alloc(nng_stream_dialer **, const char *); +NNG_DECL int nng_stream_dialer_alloc_url( + nng_stream_dialer **, const nng_url *); +NNG_DECL void nng_stream_dialer_free(nng_stream_dialer *); +NNG_DECL void nng_stream_dialer_close(nng_stream_dialer *); +NNG_DECL void nng_stream_dialer_dial(nng_stream_dialer *, nng_aio *); +NNG_DECL int nng_stream_dialer_set( + nng_stream_dialer *, const char *, const void *, size_t); +NNG_DECL int nng_stream_dialer_get( + nng_stream_dialer *, const char *, void *, size_t *); +NNG_DECL int nng_stream_dialer_get_bool( + nng_stream_dialer *, const char *, bool *); +NNG_DECL int nng_stream_dialer_get_int( + nng_stream_dialer *, const char *, int *); +NNG_DECL int nng_stream_dialer_get_ms( + nng_stream_dialer *, const char *, nng_duration *); +NNG_DECL int nng_stream_dialer_get_size( + nng_stream_dialer *, const char *, size_t *); +NNG_DECL int nng_stream_dialer_get_uint64( + nng_stream_dialer *, const char *, uint64_t *); +NNG_DECL int nng_stream_dialer_get_ptr( + nng_stream_dialer *, const char *, void **); +NNG_DECL int nng_stream_dialer_get_addr( + nng_stream_dialer *, const char *, nng_sockaddr *); +NNG_DECL int nng_stream_dialer_set_bool( + nng_stream_dialer *, const char *, bool); +NNG_DECL int nng_stream_dialer_set_int(nng_stream_dialer *, const char *, int); +NNG_DECL int nng_stream_dialer_set_ms( + nng_stream_dialer *, const char *, nng_duration); +NNG_DECL int nng_stream_dialer_set_size( + nng_stream_dialer *, const char *, size_t); +NNG_DECL int nng_stream_dialer_set_uint64( + nng_stream_dialer *, const char *, uint64_t); +NNG_DECL int nng_stream_dialer_set_string( + nng_stream_dialer *, const char *, const char *); +NNG_DECL int nng_stream_dialer_set_ptr( + nng_stream_dialer *, const char *, void *); +NNG_DECL int nng_stream_dialer_set_addr( + nng_stream_dialer *, const char *, const nng_sockaddr *); + +NNG_DECL int nng_stream_listener_alloc(nng_stream_listener **, const char *); +NNG_DECL int nng_stream_listener_alloc_url( + nng_stream_listener **, const nng_url *); +NNG_DECL void nng_stream_listener_free(nng_stream_listener *); +NNG_DECL void nng_stream_listener_close(nng_stream_listener *); +NNG_DECL int nng_stream_listener_listen(nng_stream_listener *); +NNG_DECL void nng_stream_listener_accept(nng_stream_listener *, nng_aio *); +NNG_DECL int nng_stream_listener_set( + nng_stream_listener *, const char *, const void *, size_t); +NNG_DECL int nng_stream_listener_get( + nng_stream_listener *, const char *, void *, size_t *); +NNG_DECL int nng_stream_listener_get_bool( + nng_stream_listener *, const char *, bool *); +NNG_DECL int nng_stream_listener_get_int( + nng_stream_listener *, const char *, int *); +NNG_DECL int nng_stream_listener_get_ms( + nng_stream_listener *, const char *, nng_duration *); +NNG_DECL int nng_stream_listener_get_size( + nng_stream_listener *, const char *, size_t *); +NNG_DECL int nng_stream_listener_get_uint64( + nng_stream_listener *, const char *, uint64_t *); +NNG_DECL int nng_stream_listener_get_ptr( + nng_stream_listener *, const char *, void **); +NNG_DECL int nng_stream_listener_get_addr( + nng_stream_listener *, const char *, nng_sockaddr *); +NNG_DECL int nng_stream_listener_set_bool( + nng_stream_listener *, const char *, bool); +NNG_DECL int nng_stream_listener_set_int(nng_stream_listener *, const char *, int); +NNG_DECL int nng_stream_listener_set_ms( + nng_stream_listener *, const char *, nng_duration); +NNG_DECL int nng_stream_listener_set_size( + nng_stream_listener *, const char *, size_t); +NNG_DECL int nng_stream_listener_set_uint64( + nng_stream_listener *, const char *, uint64_t); +NNG_DECL int nng_stream_listener_set_string( + nng_stream_listener *, const char *, const char *); +NNG_DECL int nng_stream_listener_set_ptr( + nng_stream_listener *, const char *, void *); +NNG_DECL int nng_stream_listener_set_addr( + nng_stream_listener *, const char *, const nng_sockaddr *); + #ifdef __cplusplus } #endif diff --git a/include/nng/supplemental/ipc/ipc.h b/include/nng/supplemental/ipc/ipc.h deleted file mode 100644 index 372b384e..00000000 --- a/include/nng/supplemental/ipc/ipc.h +++ /dev/null @@ -1,133 +0,0 @@ -// -// Copyright 2018 Staysail Systems, Inc. <info@staysail.tech> -// Copyright 2018 Capitar IT Group BV <info@capitar.com> -// Copyright 2018 Devolutions <info@devolutions.net> -// -// 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_SUPPLEMENTAL_IPC_IPC_H -#define NNG_SUPPLEMENTAL_IPC_IPC_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include <stddef.h> -#include <stdint.h> - -#include <nng/nng.h> -#include <nng/transport/ipc/ipc.h> // For IPC option names. - -// This is our "public" IPC API. This allows applications to access -// basic IPC functions, using our AIO framework. Most applications will -// not need this. This supports both UNIX domain sockets (AF_LOCAL), -// and Windows Named Pipes, depending on the underlying platform. - -// nng_ipc represents a single IPC connection. This is generally -// a connected stream. -typedef struct nng_ipc_s nng_ipc; - -// nng_ipc_dialer is a dialer object used to create outgoing connections. -// This is a bit different than a typical BSD socket API, but doing it -// helps keep the API orthogonal to the listener API. -typedef struct nng_ipc_dialer_s nng_ipc_dialer; - -// nng_ipc_listener is a listener object. This is used to accept incoming -// connections. -typedef struct nng_ipc_listener_s nng_ipc_listener; - -// nng_ipc_close closes the connection, but does not release the -// underlying object. Operations that may be pending on the connect, -// as well as further operations, will result in NNG_ECLOSED. -NNG_DECL void nng_ipc_close(nng_ipc *); - -// nng_ipc_free frees the IPC connection, closing it if it is open. -// This is necessary to release the resources of the IPC object. -// (It is an error to refer to the IPC object after this is called.) -NNG_DECL void nng_ipc_free(nng_ipc *); - -// nng_ipc_send sends the data in the aio, which should be stored in -// an iov for the message. Note that the iov in the aio may be modified, -// so applications should not assume otherwise. -NNG_DECL void nng_ipc_send(nng_ipc *, nng_aio *); - -// nng_ipc_recv receives data into the iov supplied. It is possible for -// the callback to be executed with less data read than requested. (This -// is actually pretty likely for bulk transfers.) The caller should update -// the iov's and resubmit as needed. -NNG_DECL void nng_ipc_recv(nng_ipc *, nng_aio *); - -// nng_ipc_getopt is used to get options. The options available are: -// -// NNG_OPT_REMADDR - nng_sockaddr for the connection. -// NNG_OPT_LOCADD - nng_sockaddr for the connection. -// NNG_OPT_IPC_PEER_UID - peer user ID (if available), uint64_t -// NNG_OPT_IPC_PEER_GID - peer group ID (if available), uint64_t -// NNG_OPT_IPC_PEER_ZONEID - peer zone ID (illumos/Solaris only), uint64_t -NNG_DECL int nng_ipc_getopt(nng_ipc *, const char *, void *, size_t *); - -// nng_ipc_setopt is used to set options. There are presently no such -// options defined for connections. -NNG_DECL int nng_ipc_setopt(nng_ipc *, const char *, const void *, size_t); - -// nng_ipc_dialer_alloc is used to allocate an IPC dialer. -NNG_DECL int nng_ipc_dialer_alloc(nng_ipc_dialer **); - -// nng_ipc_dialer_close closes the dialer, aborting any pending outbound -// connection attempts (and preventing any new ones) with NNG_ECLOSED. -// This does not free the resources associated with the dialer, so the -// application should still call nng_ipc_dialer_free. Connections already -// established by the dialer are unaffected by this call. -NNG_DECL void nng_ipc_dialer_close(nng_ipc_dialer *); - -// nng_ipc_dialer_free is used to free the dialer. This implicitly calls -// nng_ipc_dialer_close, then releases the resources associated with the -// dialer. It is therefore an error for the application to attempt to use -// the dialer after this call. -NNG_DECL void nng_ipc_dialer_free(nng_ipc_dialer *); - -// nng_ipc_dialer_dial attempts to create a new connection (nng_ipc *) -// may making an outbound connect call. If this succeeds, the aio -// will return a suitable nng_ipc * in the first output of the aio. -// (I.e. nng_aio_get_output(aio, 0).) The destination address to dial -// is stored in the 2nd argument. -NNG_DECL void nng_ipc_dialer_dial( - nng_ipc_dialer *, const nng_sockaddr *, nng_aio *); - -// nng_ipc_listener_alloc creates a listener. -NNG_DECL int nng_ipc_listener_alloc(nng_ipc_listener **); - -// nng_ipc_listener_close closes the listener, unbinding it from -// any active path if it was previously bound with nng_ipc_listener_listen. -// This does not completely release the resources associated with the -// listener, so nng_ipc_listener_free should still be called. -// Any pending accept calls will be aborted with NNG_ECLOSED, and any -// future attempts will also result in NNG_ECLOSED. Connections already -// established by this listener are unaffected by this call. -NNG_DECL void nng_ipc_listener_close(nng_ipc_listener *); - -// nng_ipc_listener_free frees the listener. This causes any other -// outstanding accept calls to return NNG_ECLOSED. The listener cannot -// be used by the application after this is called. This implictly -// includes a call to nng_ipc_listener_close(). -NNG_DECL void nng_ipc_listener_free(nng_ipc_listener *); - -// nng_ipc_listener_listen binds to the IPC address and arranges for -// the IPC path to be created and bound. It does not accept any new -// incoming connections. This operation is synchronous. -NNG_DECL int nng_ipc_listener_listen(nng_ipc_listener *, const nng_sockaddr *); - -// nng_ipc_listener_accept accepts an incoming connection (creating an -// nng_ipc * object), and returns it in the nng_aio as the first output -// on success. -NNG_DECL void nng_ipc_listener_accept(nng_ipc_listener *, nng_aio *); - -#ifdef __cplusplus -} -#endif - -#endif // NNG_SUPPLEMENTAL_IPC_IPC_H diff --git a/include/nng/supplemental/tcp/tcp.h b/include/nng/supplemental/tcp/tcp.h deleted file mode 100644 index 295006c7..00000000 --- a/include/nng/supplemental/tcp/tcp.h +++ /dev/null @@ -1,154 +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_SUPPLEMENTAL_TCP_TCP_H -#define NNG_SUPPLEMENTAL_TCP_TCP_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include <stddef.h> -#include <stdint.h> - -#include <nng/nng.h> - -// This is our "public" TCP API. This allows applications to access -// basic TCP functions, using our AIO framework. Most applications will -// not need this. - -// nng_tcp represents a single TCP connection. This is generally -// a connected stream. -typedef struct nng_tcp_s nng_tcp; - -// nng_tcp_dialer is a dialer object used to create outgoing connections. -// This is a bit different than a typical BSD socket API, but doing it -// helps keep the API orthogonal to the listener API. -typedef struct nng_tcp_dialer_s nng_tcp_dialer; - -// nng_tcp_listener is a listener object. This is used to accept incoming -// connections. -typedef struct nng_tcp_listener_s nng_tcp_listener; - -// nng_tcp_close closes the connection, but does not release the -// underlying object. Operations that may be pending on the connect, -// as well as further operations, will result in NNG_ECLOSED. -NNG_DECL void nng_tcp_close(nng_tcp *); - -// nng_tcp_free frees the TCP connection, closing it if it is open. -// This is necessary to release the resources of the TCP object. -// (It is an error to refer to the TCP object after this is called.) -NNG_DECL void nng_tcp_free(nng_tcp *); - -// nng_tcp_send sends the data in the aio, which should be stored in -// an iov for the message. Note that the iov in the aio may be modified, -// so applications should not assume otherwise. -NNG_DECL void nng_tcp_send(nng_tcp *, nng_aio *); - -// nng_tcp_recv receives data into the iov supplied. It is possible for -// the callback to be executed with less data read than requested. (This -// is actually pretty likely for bulk transfers.) The caller should update -// the iov's and resubmit as needed. -NNG_DECL void nng_tcp_recv(nng_tcp *, nng_aio *); - -// nng_tcp_getopt is used to retrieve socket options, using the named -// option values, like NNG_OPT_TCP_NODELAY or NNG_OPT_REMADDR. -NNG_DECL int nng_tcp_getopt(nng_tcp *, const char *, void *, size_t *); - -// nng_tcp_setopt is used to set socket options, using the named -// option values, like NNG_OPT_TCP_KEEPALIVE. -NNG_DECL int nng_tcp_setopt(nng_tcp *, const char *, const void *, size_t); - -// nng_tcp_dialer_alloc is used to allocate a TCP dialer. -NNG_DECL int nng_tcp_dialer_alloc(nng_tcp_dialer **); - -// nng_tcp_dialer_close closes the dialer, aborting any pending outbound -// connection attempts (and preventing any new ones) with NNG_ECLOSED. -// This does not free the resources associated with the dialer, so the -// application should still call nng_tcp_dialer_free. Connections already -// established by the dialer are unaffected by this call. -NNG_DECL void nng_tcp_dialer_close(nng_tcp_dialer *); - -// nng_tcp_dialer_free is used to free the dialer. This implicitly calls -// nng_tcp_dialer_close, then releases the resources associated with the -// dialer. It is therefore an error for the application to attempt to use -// the dialer after this call. -NNG_DECL void nng_tcp_dialer_free(nng_tcp_dialer *); - -// nng_tcp_dialer_dial attempts to create a new connection (nng_tcp *) -// may making an outbound connect call. If this succeeds, the aio -// will return a suitable nng_tcp * in the first output of the aio. -// (I.e. nng_aio_get_output(aio, 0).) The destination address to dial -// is stored in the 2nd argument. -NNG_DECL void nng_tcp_dialer_dial( - nng_tcp_dialer *, const nng_sockaddr *, nng_aio *); - -// nng_tcp_dialer_getopt gets an option. -NNG_DECL int nng_tcp_dialer_getopt( - nng_tcp_dialer *, const char *, void *, size_t *); - -// nng_tcp_dialer_setopt sets an option. This can be done to set the -// initial values of NNG_OPT_TCP_NODELAY or NNG_OPT_TCP_KEEPALIVE for -// created connections, for example. Also, the NNG_OPT_LOCADDR can -// be set, which sets the source address new connections will be -// established from -- except that the port is ignored as it is always -// randomly chosen. -NNG_DECL int nng_tcp_dialer_setopt( - nng_tcp_dialer *, const char *, const void *, size_t); - -// nng_tcp_listener_alloc creates a listener. -NNG_DECL int nng_tcp_listener_alloc(nng_tcp_listener **); - -// nng_tcp_listener_close closes the listener, unbinding it from -// any active ports if it was previously bound with nng_tcp_listener_listen. -// This does not completely release the resources associated with the -// listener, so nng_tcp_listener_free should still be called. -// Any pending accept calls will be aborted with NNG_ECLOSED, and any -// future attempts will also result in NNG_ECLOSED. Connections already -// established by this listener are unaffected by this call. -NNG_DECL void nng_tcp_listener_close(nng_tcp_listener *); - -// nng_tcp_listener_free frees the listener. This causes any other -// outstanding accept calls to return NNG_ECLOSED. The listener cannot -// be used by the application after this is called. This implictly -// includes a call to nng_tcp_listener_close(). -NNG_DECL void nng_tcp_listener_free(nng_tcp_listener *); - -// nng_tcp_listener_listen binds to the TCP address and arranges for -// the TCP port / address to be allocated. It does not accept any new -// incoming connections. (The listenq depth is configured to some reasonable -// default -- typically around 128.) This operation is synchronous. -// A zero valued port may be supplied in the sockaddr, in which case -// a follow up call to get the NNG_OPT_LOCADDR can be used to determine the -// bound address. -NNG_DECL int nng_tcp_listener_listen(nng_tcp_listener *, const nng_sockaddr *); - -// nng_tcp_listener_accept accepts an incoming connection (creating an -// nng_tcp * object), and returns it in the nng_aio as the first output -// on success. -NNG_DECL void nng_tcp_listener_accept(nng_tcp_listener *, nng_aio *); - -// nng_tcp_listener_getopt gets an option. A good example of this is to -// obtain the NNG_OPT_LOCADDR local address after starting the listener -// on a wild card port (0). -NNG_DECL int nng_tcp_listener_getopt( - nng_tcp_listener *, const char *, void *, size_t *); - -// nng_tcp_listener_setopt sets an option. This can be done to set the -// initial values of NNG_OPT_TCP_NODELAY or NNG_OPT_TCP_KEEPALIVE for -// created connections, for example. -NNG_DECL int nng_tcp_listener_setopt( - nng_tcp_listener *, const char *, const void *, size_t); - -#ifdef __cplusplus -} -#endif - -#endif // NNG_SUPPLEMENTAL_TCP_TCP_H diff --git a/include/nng/supplemental/tls/tls.h b/include/nng/supplemental/tls/tls.h index 496f02e2..5983f3b6 100644 --- a/include/nng/supplemental/tls/tls.h +++ b/include/nng/supplemental/tls/tls.h @@ -105,74 +105,6 @@ NNG_DECL int nng_tls_config_ca_file(nng_tls_config *, const char *); NNG_DECL int nng_tls_config_cert_key_file( nng_tls_config *, const char *, const char *); -// The rest of the definitions in this file rely upon having support for the -// TLS supplemental API enabled. If you don't have this configured in your -// library, then your programs will not link. - -// nng_tls represents a TLS connection over TCP. -typedef struct nng_tls_s nng_tls; - -// nng_tls_dialer is a dialer that creates TLS connections (nng_tls objects) -// by establishing outgoing connections. -typedef struct nng_tls_dialer_s nng_tls_dialer; - -// nng_tls_listener is a listener that creates TLS connections (nng_tls -// objects) by accepting incoming connections. -typedef struct nng_tls_listener_s nng_tls_listener; - -// nng_tls_close closes a TLS connection, without releasing the underlying -// resources. Use nng_tls_free to release the resources. -NNG_DECL void nng_tls_close(nng_tls *); - -// nng_tls_free frees a TLS connection, and will implicity also close the -// connection if not already done so. -NNG_DECL void nng_tls_free(nng_tls *); - -NNG_DECL void nng_tls_send(nng_tls *, nng_aio *); -NNG_DECL void nng_tls_recv(nng_tls *, nng_aio *); - -NNG_DECL int nng_tls_getopt(nng_tls *, const char *, void *, size_t *); - -// nng_tls_dialer_alloc allocates a dialer that creates TLS connections -// (nng_tls structures) by connecting to remote servers. -NNG_DECL int nng_tls_dialer_alloc(nng_tls_dialer **); - -// nng_tls_dialer_close closes the dialer, but does not free it's resources. -NNG_DECL void nng_tls_dialer_close(nng_tls_dialer *); - -// nng_tls_dialer_free frees the dialer, implicitly closing it as well. -NNG_DECL void nng_tls_dialer_free(nng_tls_dialer *); - -// nng_tls_dialer_dial attempts to create a new connection (nng_tls object) -// by dialing to the remote server specified in the aio. Note that the -// TLS connection may be returned before the TLS handshake is complete. -// The remote server will only be verified if a server name has been configured -// with the NNG_OPT_TLS_SERVER_NAME option (using nng_tls_dialer_setopt). -NNG_DECL void nng_tls_dialer_dial( - nng_tls_dialer *, const nng_sockaddr *, nng_aio *); - -// nng_tls_dialer_getopt returns options from the dialer. -NNG_DECL int nng_tls_dialer_getopt( - nng_tls_dialer *, const char *, void *, size_t *); - -// nng_tls_dialer_setopt sets options on the dialer. Options may include -// NNG_OPT_TLS_CONFIG, as well as various other NNG_OPT_TLS_ options and -// the TCP options that are valid for TCP dialers as well. -NNG_DECL int nng_tls_dialer_setopt( - nng_tls_dialer *, const char *, const void *, size_t); - -NNG_DECL int nng_tls_listener_alloc(nng_tls_listener **); -NNG_DECL void nng_tls_listener_close(nng_tls_listener *); -NNG_DECL void nng_tls_listener_free(nng_tls_listener *); -NNG_DECL int nng_tls_listener_listen(nng_tls_listener *, const nng_sockaddr *); -NNG_DECL void nng_tls_listener_accept(nng_tls_listener *, nng_aio *); - -NNG_DECL int nng_tls_listener_getopt( - nng_tls_listener *, const char *, void *, size_t *); - -NNG_DECL int nng_tls_listener_setopt( - nng_tls_listener *, const char *, const void *, size_t); - #ifdef __cplusplus } #endif diff --git a/include/nng/transport/tcp/tcp.h b/include/nng/transport/tcp/tcp.h index 6975109f..c2277e4b 100644 --- a/include/nng/transport/tcp/tcp.h +++ b/include/nng/transport/tcp/tcp.h @@ -13,6 +13,8 @@ // TCP transport. This is used for communication over TCP/IP. +#include <nng/nng.h> + NNG_DECL int nng_tcp_register(void); #endif // NNG_TRANSPORT_TCP_TCP_H diff --git a/include/nng/transport/ws/websocket.h b/include/nng/transport/ws/websocket.h index 8179beab..3d0d4fee 100644 --- a/include/nng/transport/ws/websocket.h +++ b/include/nng/transport/ws/websocket.h @@ -15,14 +15,6 @@ 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 |
