diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/compat/nanomsg/nn.c | 2 | ||||
| -rw-r--r-- | src/core/clock.c | 2 | ||||
| -rw-r--r-- | src/core/defs.h | 1 | ||||
| -rw-r--r-- | src/core/file.c | 2 | ||||
| -rw-r--r-- | src/core/idhash.c | 15 | ||||
| -rw-r--r-- | src/core/idhash.h | 4 | ||||
| -rw-r--r-- | src/core/message.c | 2 | ||||
| -rw-r--r-- | src/core/protocol.c | 2 | ||||
| -rw-r--r-- | src/core/strs.c | 2 | ||||
| -rw-r--r-- | src/nng.h | 17 | ||||
| -rw-r--r-- | src/platform/posix/posix_aio.h | 2 | ||||
| -rw-r--r-- | src/platform/posix/posix_epdesc.c | 4 | ||||
| -rw-r--r-- | src/platform/posix/posix_pipedesc.c | 7 | ||||
| -rw-r--r-- | src/platform/posix/posix_tcp.c | 4 | ||||
| -rw-r--r-- | src/platform/posix/posix_udp.c | 46 | ||||
| -rw-r--r-- | src/supplemental/http/http.h | 14 | ||||
| -rw-r--r-- | src/supplemental/http/http_api.h | 13 | ||||
| -rw-r--r-- | src/supplemental/http/http_client.c | 18 | ||||
| -rw-r--r-- | src/supplemental/http/http_conn.c | 81 | ||||
| -rw-r--r-- | src/supplemental/http/http_public.c | 8 | ||||
| -rw-r--r-- | src/supplemental/util/options.h | 2 | ||||
| -rw-r--r-- | src/supplemental/util/platform.c | 6 |
22 files changed, 125 insertions, 129 deletions
diff --git a/src/compat/nanomsg/nn.c b/src/compat/nanomsg/nn.c index 03df279b..6d23106c 100644 --- a/src/compat/nanomsg/nn.c +++ b/src/compat/nanomsg/nn.c @@ -1166,4 +1166,4 @@ nn_get_statistic(int x, int y) (void) y; return (0); -}
\ No newline at end of file +} diff --git a/src/core/clock.c b/src/core/clock.c index f114daa1..49b972e7 100644 --- a/src/core/clock.c +++ b/src/core/clock.c @@ -19,4 +19,4 @@ void nni_msleep(nni_duration msec) { nni_plat_sleep(msec); -}
\ No newline at end of file +} diff --git a/src/core/defs.h b/src/core/defs.h index 1d656bb2..b9c9b7e5 100644 --- a/src/core/defs.h +++ b/src/core/defs.h @@ -59,7 +59,6 @@ typedef struct nni_proto nni_proto; typedef struct nni_plat_mtx nni_mtx; typedef struct nni_plat_cv nni_cv; -typedef struct nni_idhash nni_idhash; typedef struct nni_thr nni_thr; typedef void (*nni_thr_func)(void *); diff --git a/src/core/file.c b/src/core/file.c index b76fdcda..173a864d 100644 --- a/src/core/file.c +++ b/src/core/file.c @@ -156,4 +156,4 @@ nni_file_unlock(nni_file_lockh *h) { nni_plat_file_unlock(&h->lk); NNI_FREE_STRUCT(h); -}
\ No newline at end of file +} diff --git a/src/core/idhash.c b/src/core/idhash.c index 2bf01d6b..0de83eb1 100644 --- a/src/core/idhash.c +++ b/src/core/idhash.c @@ -1,6 +1,6 @@ // -// Copyright 2017 Garrett D'Amore <garrett@damore.org> -// Copyright 2017 Capitar IT Group BV <info@capitar.com> +// 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 @@ -306,14 +306,3 @@ nni_idhash_alloc(nni_idhash *h, uint64_t *idp, void *val) return (rv); } - -size_t -nni_idhash_count(nni_idhash *h) -{ - size_t num; - nni_mtx_lock(&h->ih_mtx); - num = h->ih_count; - nni_mtx_unlock(&h->ih_mtx); - - return (num); -} diff --git a/src/core/idhash.h b/src/core/idhash.h index 9dbdd45e..36797a76 100644 --- a/src/core/idhash.h +++ b/src/core/idhash.h @@ -1,6 +1,6 @@ // -// Copyright 2017 Garrett D'Amore <garrett@damore.org> -// Copyright 2017 Capitar IT Group BV <info@capitar.com> +// 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 diff --git a/src/core/message.c b/src/core/message.c index 5c396f21..ba3c0e84 100644 --- a/src/core/message.c +++ b/src/core/message.c @@ -627,4 +627,4 @@ uint32_t nni_msg_get_pipe(const nni_msg *m) { return (m->m_pipe); -}
\ No newline at end of file +} diff --git a/src/core/protocol.c b/src/core/protocol.c index 52b9b7fb..ea28ad0a 100644 --- a/src/core/protocol.c +++ b/src/core/protocol.c @@ -95,4 +95,4 @@ nni_proto_sys_fini(void) } nni_proto_inited = 0; nni_mtx_fini(&nni_proto_lk); -}
\ No newline at end of file +} diff --git a/src/core/strs.c b/src/core/strs.c index 66a385d0..98c1a5fa 100644 --- a/src/core/strs.c +++ b/src/core/strs.c @@ -201,4 +201,4 @@ nni_asprintf(char **sp, const char *fmt, ...) va_end(ap); *sp = s; return (0); -}
\ No newline at end of file +} @@ -160,7 +160,7 @@ enum nng_sockaddr_family { NNG_AF_IPC = 2, NNG_AF_INET = 3, NNG_AF_INET6 = 4, - NNG_AF_ZT = 5, // ZeroTier + NNG_AF_ZT = 5 // ZeroTier }; // Scatter/gather I/O. @@ -223,9 +223,10 @@ NNG_DECL int nng_getopt_ptr(nng_socket, const char *, void **); // Only one callback can be set on a given socket, and there is no way // to retrieve the old value. typedef enum { - NNG_PIPE_ADD, - NNG_PIPE_REM, + NNG_PIPE_ADD, // Pipe added to socket + NNG_PIPE_REM // Pipe removed from socket } nng_pipe_action; + typedef void (*nng_pipe_cb)(nng_pipe, nng_pipe_action, void *); NNG_DECL int nng_pipe_notify(nng_socket, nng_pipe_cb, void *); @@ -619,7 +620,7 @@ NNG_DECL nng_listener nng_pipe_listener(nng_pipe); // Flags. enum nng_flag_enum { NNG_FLAG_ALLOC = 1, // Recv to allocate receive buffer. - NNG_FLAG_NONBLOCK = 2, // Non-blocking operations. + NNG_FLAG_NONBLOCK = 2 // Non-blocking operations. }; // Options. @@ -758,8 +759,8 @@ enum nng_flag_enum { // NNG_DECL int nng_stat_type(nng_stat *); enum nng_stat_type_enum { - NNG_STAT_LEVEL = 0, - NNG_STAT_COUNTER = 1, + NNG_STAT_LEVEL = 0, // Numeric "absolute" value, diffs meaningless + NNG_STAT_COUNTER = 1 // Incrementing value (diffs are meaningful) }; // nng_stat_unit provides information about the unit for the statistic, @@ -774,7 +775,7 @@ enum nng_unit_enum { NNG_UNIT_MESSAGES = 2, NNG_UNIT_BOOLEAN = 3, NNG_UNIT_MILLIS = 4, - NNG_UNIT_EVENTS = 5, + NNG_UNIT_EVENTS = 5 }; // nng_stat_value returns returns the actual value of the statistic. @@ -845,7 +846,7 @@ enum nng_errno_enum { NNG_EBADTYPE = 30, NNG_EINTERNAL = 1000, NNG_ESYSERR = 0x10000000, - NNG_ETRANERR = 0x20000000, + NNG_ETRANERR = 0x20000000 }; // URL support. We frequently want to process a URL, and these methods diff --git a/src/platform/posix/posix_aio.h b/src/platform/posix/posix_aio.h index 7d6a7231..15d91db2 100644 --- a/src/platform/posix/posix_aio.h +++ b/src/platform/posix/posix_aio.h @@ -19,8 +19,6 @@ #include "core/nng_impl.h" -typedef struct nni_posix_pollq nni_posix_pollq; - typedef struct nni_posix_pipedesc nni_posix_pipedesc; typedef struct nni_posix_epdesc nni_posix_epdesc; diff --git a/src/platform/posix/posix_epdesc.c b/src/platform/posix/posix_epdesc.c index 0f63304f..7431dedf 100644 --- a/src/platform/posix/posix_epdesc.c +++ b/src/platform/posix/posix_epdesc.c @@ -28,6 +28,10 @@ #include <sys/un.h> #include <unistd.h> +#ifdef sun +#undef sun +#endif + #ifdef SOCK_CLOEXEC #define NNI_STREAM_SOCKTYPE (SOCK_STREAM | SOCK_CLOEXEC) #else diff --git a/src/platform/posix/posix_pipedesc.c b/src/platform/posix/posix_pipedesc.c index 61005ca8..3745f11f 100644 --- a/src/platform/posix/posix_pipedesc.c +++ b/src/platform/posix/posix_pipedesc.c @@ -32,6 +32,9 @@ #include <sys/ucred.h> #include <sys/un.h> #endif +#ifdef NNG_HAVE_ALLOCA +#include <alloca.h> +#endif // nni_posix_pipedesc is a descriptor kept one per transport pipe (i.e. open // file descriptor for TCP socket, etc.) This contains the list of pending @@ -426,12 +429,12 @@ nni_posix_pipedesc_get_peerid(nni_posix_pipedesc *pd, uint64_t *euid, *znid = (uint64_t) -1; return (0); #elif defined(NNG_HAVE_GETPEERUCRED) - ucred *ucp; + ucred_t *ucp = NULL; if (getpeerucred(fd, &ucp) != 0) { return (nni_plat_errno(errno)); } *euid = ucred_geteuid(ucp); - *egid = ucred_geteuid(ucp); + *egid = ucred_getegid(ucp); *prid = ucred_getpid(ucp); *znid = ucred_getzoneid(ucp); ucred_free(ucp); diff --git a/src/platform/posix/posix_tcp.c b/src/platform/posix/posix_tcp.c index c00f9433..ace1f6bd 100644 --- a/src/platform/posix/posix_tcp.c +++ b/src/platform/posix/posix_tcp.c @@ -79,13 +79,13 @@ nni_plat_tcp_ep_listen(nni_plat_tcp_ep *ep, nng_sockaddr *bsa) void nni_plat_tcp_ep_connect(nni_plat_tcp_ep *ep, nni_aio *aio) { - return (nni_posix_epdesc_connect((void *) ep, aio)); + nni_posix_epdesc_connect((void *) ep, aio); } void nni_plat_tcp_ep_accept(nni_plat_tcp_ep *ep, nni_aio *aio) { - return (nni_posix_epdesc_accept((void *) ep, aio)); + nni_posix_epdesc_accept((void *) ep, aio); } void diff --git a/src/platform/posix/posix_udp.c b/src/platform/posix/posix_udp.c index 37f79431..654d31e3 100644 --- a/src/platform/posix/posix_udp.c +++ b/src/platform/posix/posix_udp.c @@ -24,14 +24,15 @@ #include <sys/types.h> #include <sys/uio.h> #include <unistd.h> +#ifdef NNG_HAVE_ALLOCA +#include <alloca.h> +#endif // UDP support. // If we can suppress SIGPIPE on send, please do so. -#ifdef MSG_NOSIGNAL -#define NNI_MSG_NOSIGNAL MSG_NOSIGNAL -#else -#define NNI_MSG_NOSIGNAL 0 +#ifndef MSG_NOSIGNAL +#define MSG_NOSIGNAL 0 #endif struct nni_plat_udp { @@ -67,7 +68,7 @@ nni_posix_udp_dorecv(nni_plat_udp *udp) nni_iov * aiov; struct sockaddr_storage ss; nng_sockaddr * sa; - struct msghdr hdr; + struct msghdr hdr = { .msg_name = NULL }; int rv = 0; int cnt = 0; @@ -77,13 +78,10 @@ nni_posix_udp_dorecv(nni_plat_udp *udp) iov[i].iov_base = aiov[i].iov_buf; iov[i].iov_len = aiov[i].iov_len; } - hdr.msg_iov = iov; - hdr.msg_iovlen = niov; - hdr.msg_name = &ss; - hdr.msg_namelen = sizeof(ss); - hdr.msg_flags = 0; - hdr.msg_control = NULL; - hdr.msg_controllen = 0; + hdr.msg_iov = iov; + hdr.msg_iovlen = niov; + hdr.msg_name = &ss; + hdr.msg_namelen = sizeof(ss); if ((cnt = recvmsg(udp->udp_fd, &hdr, 0)) < 0) { if ((errno == EAGAIN) || (errno == EWOULDBLOCK)) { @@ -121,9 +119,8 @@ nni_posix_udp_dosend(nni_plat_udp *udp) if (len < 1) { rv = NNG_EADDRINVAL; } else { - struct msghdr hdr; - unsigned niov; - nni_iov * aiov; + unsigned niov; + nni_iov *aiov; #ifdef NNG_HAVE_ALLOCA struct iovec *iov; #else @@ -142,22 +139,19 @@ nni_posix_udp_dosend(nni_plat_udp *udp) rv = NNG_EINVAL; } #endif - if (rv == 0) { + struct msghdr hdr = { .msg_name = NULL }; for (unsigned i = 0; i < niov; i++) { iov[i].iov_base = aiov[i].iov_buf; iov[i].iov_len = aiov[i].iov_len; } - hdr.msg_iov = iov; - hdr.msg_iovlen = niov; - hdr.msg_name = &ss; - hdr.msg_namelen = len; - hdr.msg_flags = NNI_MSG_NOSIGNAL; - hdr.msg_control = NULL; - hdr.msg_controllen = 0; - - if ((cnt = sendmsg(udp->udp_fd, &hdr, 0)) < - 0) { + hdr.msg_iov = iov; + hdr.msg_iovlen = niov; + hdr.msg_name = &ss; + hdr.msg_namelen = len; + + cnt = sendmsg(udp->udp_fd, &hdr, MSG_NOSIGNAL); + if (cnt < 0) { if ((errno == EAGAIN) || (errno == EWOULDBLOCK)) { // Cannot send now, leave. diff --git a/src/supplemental/http/http.h b/src/supplemental/http/http.h index 470ffbfa..f6a45df7 100644 --- a/src/supplemental/http/http.h +++ b/src/supplemental/http/http.h @@ -21,7 +21,7 @@ extern "C" { #include <stdint.h> -typedef struct nng_tls_config nng_tls_config; +struct nng_tls_config; // HTTP status codes. This list is not exhaustive. enum nng_http_status { @@ -398,12 +398,14 @@ NNG_DECL int nng_http_server_del_handler( // server client, so the caller must have configured it reasonably. // This API is not recommended unless the caller needs complete control // over the TLS configuration. -NNG_DECL int nng_http_server_set_tls(nng_http_server *, nng_tls_config *); +NNG_DECL int nng_http_server_set_tls( + nng_http_server *, struct nng_tls_config *); // nng_http_server_get_tls obtains the TLS configuration if one is present, // or returns NNG_EINVAL. The TLS configuration is invalidated if the // nng_http_server_set_tls function is called, so be careful. -NNG_DECL int nng_http_server_get_tls(nng_http_server *, nng_tls_config **); +NNG_DECL int nng_http_server_get_tls( + nng_http_server *, struct nng_tls_config **); // nng_http_hijack is intended to be called by a handler that wishes to // take over the processing of the HTTP session -- usually to change protocols @@ -435,12 +437,14 @@ NNG_DECL void nng_http_client_free(nng_http_client *); // the entire TLS configuration on the client, so the caller must have // configured it reasonably. This API is not recommended unless the // caller needs complete control over the TLS configuration. -NNG_DECL int nng_http_client_set_tls(nng_http_client *, nng_tls_config *); +NNG_DECL int nng_http_client_set_tls( + nng_http_client *, struct nng_tls_config *); // nng_http_client_get_tls obtains the TLS configuration if one is present, // or returns NNG_EINVAL. The supplied TLS configuration object may // be invalidated by any future calls to nni_http_client_set_tls. -NNG_DECL int nng_http_client_get_tls(nng_http_client *, nng_tls_config **); +NNG_DECL int nng_http_client_get_tls( + nng_http_client *, struct nng_tls_config **); // nng_http_client_connect establishes a new connection with the server // named in the URL used when the client was created. Once the connection diff --git a/src/supplemental/http/http_api.h b/src/supplemental/http/http_api.h index 8de859b4..f1a5c0fa 100644 --- a/src/supplemental/http/http_api.h +++ b/src/supplemental/http/http_api.h @@ -65,7 +65,8 @@ extern void *nni_http_conn_get_ctx(nni_http_conn *); // They should only be used by the server or client HTTP implementations, // and are not for use by other code. extern int nni_http_conn_init_tcp(nni_http_conn **, void *); -extern int nni_http_conn_init_tls(nni_http_conn **, nng_tls_config *, void *); +extern int nni_http_conn_init_tls( + nni_http_conn **, struct nng_tls_config *, void *); extern void nni_http_conn_close(nni_http_conn *); extern void nni_http_conn_fini(nni_http_conn *); @@ -153,12 +154,13 @@ extern int nni_http_server_del_handler(nni_http_server *, nni_http_handler *); // server client, so the caller must have configured it reasonably. // This API is not recommended unless the caller needs complete control // over the TLS configuration. -extern int nni_http_server_set_tls(nni_http_server *, nng_tls_config *); +extern int nni_http_server_set_tls(nni_http_server *, struct nng_tls_config *); // nni_http_server_get_tls obtains the TLS configuration if one is present, // or returns NNG_EINVAL. The TLS configuration is invalidated if the // nni_http_server_set_tls function is called, so be careful. -extern int nni_http_server_get_tls(nni_http_server *, nng_tls_config **); +extern int nni_http_server_get_tls( + nni_http_server *, struct nng_tls_config **); // nni_http_server_start starts listening on the supplied port. extern int nni_http_server_start(nni_http_server *); @@ -273,12 +275,13 @@ extern void nni_http_client_fini(nni_http_client *); // the entire TLS configuration on the client, so the caller must have // configured it reasonably. This API is not recommended unless the // caller needs complete control over the TLS configuration. -extern int nni_http_client_set_tls(nni_http_client *, nng_tls_config *); +extern int nni_http_client_set_tls(nni_http_client *, struct nng_tls_config *); // nni_http_client_get_tls obtains the TLS configuration if one is present, // or returns NNG_EINVAL. The supplied TLS configuration object may // be invalidated by any future calls to nni_http_client_set_tls. -extern int nni_http_client_get_tls(nni_http_client *, nng_tls_config **); +extern int nni_http_client_get_tls( + nni_http_client *, struct nng_tls_config **); extern void nni_http_client_connect(nni_http_client *, nni_aio *); diff --git a/src/supplemental/http/http_client.c b/src/supplemental/http/http_client.c index 2a9be4bb..a2427009 100644 --- a/src/supplemental/http/http_client.c +++ b/src/supplemental/http/http_client.c @@ -20,12 +20,12 @@ #include "http_api.h" struct nng_http_client { - nni_list aios; - nni_mtx mtx; - bool closed; - nng_tls_config * tls; - nni_aio * connaio; - nni_plat_tcp_ep *tep; + nni_list aios; + nni_mtx mtx; + bool closed; + struct nng_tls_config *tls; + nni_aio * connaio; + nni_plat_tcp_ep * tep; }; static void @@ -182,10 +182,10 @@ nni_http_client_init(nni_http_client **cp, const nni_url *url) } int -nni_http_client_set_tls(nni_http_client *c, nng_tls_config *tls) +nni_http_client_set_tls(nni_http_client *c, struct nng_tls_config *tls) { #ifdef NNG_SUPP_TLS - nng_tls_config *old; + struct nng_tls_config *old; nni_mtx_lock(&c->mtx); old = c->tls; c->tls = tls; @@ -205,7 +205,7 @@ nni_http_client_set_tls(nni_http_client *c, nng_tls_config *tls) } int -nni_http_client_get_tls(nni_http_client *c, nng_tls_config **tlsp) +nni_http_client_get_tls(nni_http_client *c, struct nng_tls_config **tlsp) { #ifdef NNG_SUPP_TLS nni_mtx_lock(&c->mtx); diff --git a/src/supplemental/http/http_conn.c b/src/supplemental/http/http_conn.c index a3039d0d..0de40e10 100644 --- a/src/supplemental/http/http_conn.c +++ b/src/supplemental/http/http_conn.c @@ -36,14 +36,21 @@ enum write_flavor { HTTP_WR_RES, }; +typedef void (*http_read_fn)(void *, nni_aio *); +typedef void (*http_write_fn)(void *, nni_aio *); +typedef void (*http_close_fn)(void *); +typedef void (*http_fini_fn)(void *); +typedef bool (*http_verified_fn)(void *); +typedef int (*http_addr_fn)(void *, nni_sockaddr *); + typedef struct nni_http_tran { - void (*h_read)(void *, nni_aio *); - void (*h_write)(void *, nni_aio *); - int (*h_sock_addr)(void *, nni_sockaddr *); - int (*h_peer_addr)(void *, nni_sockaddr *); - bool (*h_verified)(void *); - void (*h_close)(void *); - void (*h_fini)(void *); + http_read_fn h_read; + http_write_fn h_write; + http_addr_fn h_sock_addr; + http_addr_fn h_peer_addr; + http_verified_fn h_verified; + http_close_fn h_close; + http_fini_fn h_fini; } nni_http_tran; #define SET_RD_FLAVOR(aio, f) \ @@ -54,20 +61,18 @@ typedef struct nni_http_tran { #define GET_WR_FLAVOR(aio) (int) ((intptr_t) nni_aio_get_prov_extra(aio, 0)) struct nng_http_conn { - void *sock; - void (*rd)(void *, nni_aio *); - void (*wr)(void *, nni_aio *); - int (*sock_addr)(void *, nni_sockaddr *); - int (*peer_addr)(void *, nni_sockaddr *); - bool (*verified)(void *); - void (*close)(void *); - void (*fini)(void *); - - void *ctx; - bool closed; - - nni_list rdq; // high level http read requests - nni_list wrq; // high level http write requests + void * sock; + http_read_fn rd; + http_write_fn wr; + http_addr_fn sock_addr; + http_addr_fn peer_addr; + http_verified_fn verified; + http_close_fn close; + http_fini_fn fini; + void * ctx; + bool closed; + 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 @@ -715,13 +720,13 @@ nni_http_verified_tcp(void *arg) } static nni_http_tran http_tcp_ops = { - .h_read = (void *) nni_plat_tcp_pipe_recv, - .h_write = (void *) nni_plat_tcp_pipe_send, - .h_close = (void *) nni_plat_tcp_pipe_close, - .h_fini = (void *) nni_plat_tcp_pipe_fini, - .h_sock_addr = (void *) nni_plat_tcp_pipe_sockname, - .h_peer_addr = (void *) nni_plat_tcp_pipe_peername, - .h_verified = nni_http_verified_tcp, + .h_read = (http_read_fn) nni_plat_tcp_pipe_recv, + .h_write = (http_write_fn) nni_plat_tcp_pipe_send, + .h_close = (http_close_fn) nni_plat_tcp_pipe_close, + .h_fini = (http_fini_fn) nni_plat_tcp_pipe_fini, + .h_sock_addr = (http_addr_fn) nni_plat_tcp_pipe_sockname, + .h_peer_addr = (http_addr_fn) nni_plat_tcp_pipe_peername, + .h_verified = (http_verified_fn) nni_http_verified_tcp, }; int @@ -732,17 +737,18 @@ nni_http_conn_init_tcp(nni_http_conn **connp, void *tcp) #ifdef NNG_SUPP_TLS static nni_http_tran http_tls_ops = { - .h_read = (void *) nni_tls_recv, - .h_write = (void *) nni_tls_send, - .h_close = (void *) nni_tls_close, - .h_fini = (void *) nni_tls_fini, - .h_sock_addr = (void *) nni_tls_sockname, - .h_peer_addr = (void *) nni_tls_peername, - .h_verified = (void *) nni_tls_verified, + .h_read = (http_read_fn) nni_tls_recv, + .h_write = (http_write_fn) nni_tls_send, + .h_close = (http_close_fn) nni_tls_close, + .h_fini = (http_fini_fn) nni_tls_fini, + .h_sock_addr = (http_addr_fn) nni_tls_sockname, + .h_peer_addr = (http_addr_fn) nni_tls_peername, + .h_verified = (http_verified_fn) nni_tls_verified, }; int -nni_http_conn_init_tls(nni_http_conn **connp, nng_tls_config *cfg, void *tcp) +nni_http_conn_init_tls( + nni_http_conn **connp, struct nng_tls_config *cfg, void *tcp) { nni_tls *tls; int rv; @@ -756,7 +762,8 @@ nni_http_conn_init_tls(nni_http_conn **connp, nng_tls_config *cfg, void *tcp) } #else int -nni_http_conn_init_tls(nni_http_conn **connp, nng_tls_config *cfg, void *tcp) +nni_http_conn_init_tls( + nni_http_conn **connp, struct nng_tls_config *cfg, void *tcp) { NNI_ARG_UNUSED(connp); NNI_ARG_UNUSED(cfg); diff --git a/src/supplemental/http/http_public.c b/src/supplemental/http/http_public.c index 7aae45b2..40d4a19c 100644 --- a/src/supplemental/http/http_public.c +++ b/src/supplemental/http/http_public.c @@ -676,7 +676,7 @@ nng_http_server_del_handler(nng_http_server *srv, nng_http_handler *h) } int -nng_http_server_set_tls(nng_http_server *srv, nng_tls_config *cfg) +nng_http_server_set_tls(nng_http_server *srv, struct nng_tls_config *cfg) { #if defined(NNG_SUPP_HTTP) && defined(NNG_SUPP_TLS) return (nni_http_server_set_tls(srv, cfg)); @@ -688,7 +688,7 @@ nng_http_server_set_tls(nng_http_server *srv, nng_tls_config *cfg) } int -nng_http_server_get_tls(nng_http_server *srv, nng_tls_config **cfgp) +nng_http_server_get_tls(nng_http_server *srv, struct nng_tls_config **cfgp) { #if defined(NNG_SUPP_HTTP) && defined(NNG_SUPP_TLS) return (nni_http_server_get_tls(srv, cfgp)); @@ -734,7 +734,7 @@ nng_http_client_free(nng_http_client *cli) } int -nng_http_client_set_tls(nng_http_client *cli, nng_tls_config *cfg) +nng_http_client_set_tls(nng_http_client *cli, struct nng_tls_config *cfg) { #if defined(NNG_SUPP_HTTP) && defined(NNG_SUPP_TLS) return (nni_http_client_set_tls(cli, cfg)); @@ -746,7 +746,7 @@ nng_http_client_set_tls(nng_http_client *cli, nng_tls_config *cfg) } int -nng_http_client_get_tls(nng_http_client *cli, nng_tls_config **cfgp) +nng_http_client_get_tls(nng_http_client *cli, struct nng_tls_config **cfgp) { #if defined(NNG_SUPP_HTTP) && defined(NNG_SUPP_TLS) return (nni_http_client_get_tls(cli, cfgp)); diff --git a/src/supplemental/util/options.h b/src/supplemental/util/options.h index 02b3a9d4..00cf1351 100644 --- a/src/supplemental/util/options.h +++ b/src/supplemental/util/options.h @@ -45,4 +45,4 @@ NNG_DECL int nng_opts_parse(int argc, const char **argv, } #endif -#endif // NNG_SUPPLEMENTAL_UTIL_OPTIONS_H
\ No newline at end of file +#endif // NNG_SUPPLEMENTAL_UTIL_OPTIONS_H diff --git a/src/supplemental/util/platform.c b/src/supplemental/util/platform.c index ce52491a..fc0f839e 100644 --- a/src/supplemental/util/platform.c +++ b/src/supplemental/util/platform.c @@ -29,10 +29,6 @@ nng_msleep(nng_duration dur) nni_msleep(dur); } -// nng_thread is a handle to a "thread", which may be a real system -// thread, or a coroutine on some platforms. -typedef struct nng_thread nng_thread; - // Create and start a thread. Note that on some platforms, this might // actually be a coroutine, with limitations about what system APIs // you can call. Therefore, these threads should only be used with the @@ -111,8 +107,6 @@ struct nng_cv { nni_cv c; }; -typedef struct nng_cv nng_cv; - int nng_cv_alloc(nng_cv **cvp, nng_mtx *mx) { |
