aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVincent Nonnenmacher <vincent.nonnenmacher@gmail.com>2018-03-16 15:06:34 +0100
committerGarrett D'Amore <garrett@damore.org>2018-03-19 14:27:57 -0700
commit9b886a9999247d87c9f6d389c3e65a4bd39be010 (patch)
tree5616f0a44748b6f10deb202bbddfabb618d1545e /src
parent8d8494ad6b2a10e5439b7a4bd621465c57ca9a27 (diff)
downloadnng-9b886a9999247d87c9f6d389c3e65a4bd39be010.tar.gz
nng-9b886a9999247d87c9f6d389c3e65a4bd39be010.tar.bz2
nng-9b886a9999247d87c9f6d389c3e65a4bd39be010.zip
Fixes issues found by (and submitted by) @nonnenmacher when working
on a python wrapper (cffi). Mostly this is fixing inconsistencies in our public API and the actual implementation.
Diffstat (limited to 'src')
-rw-r--r--src/nng.c25
-rw-r--r--src/nng.h16
-rw-r--r--src/supplemental/http/http_public.c22
-rw-r--r--src/supplemental/tls/none/tls.c16
-rw-r--r--src/transport/ws/websocket.c6
5 files changed, 75 insertions, 10 deletions
diff --git a/src/nng.c b/src/nng.c
index ad255d16..62c7de7b 100644
--- a/src/nng.c
+++ b/src/nng.c
@@ -1128,6 +1128,12 @@ nng_aio_wait(nng_aio *aio)
}
void
+nng_aio_abort(nng_aio *aio, int err_code)
+{
+ nni_aio_abort(aio, err_code);
+}
+
+void
nng_aio_cancel(nng_aio *aio)
{
nni_aio_abort(aio, NNG_ECANCELED);
@@ -1214,18 +1220,22 @@ int
nng_snapshot_create(nng_socket sock, nng_snapshot **snapp)
{
// Stats TBD.
+ NNI_ARG_UNUSED(sock)
+ NNI_ARG_UNUSED(snapp)
return (NNG_ENOTSUP);
}
void
-nng_snapshot_destroy(nng_snapshot *snap)
+nng_snapshot_free(nng_snapshot *snap)
{
+ NNI_ARG_UNUSED(snap)
// Stats TBD.
}
int
nng_snapshot_update(nng_snapshot *snap)
{
+ NNI_ARG_UNUSED(snap)
// Stats TBD.
return (NNG_ENOTSUP);
}
@@ -1233,6 +1243,8 @@ nng_snapshot_update(nng_snapshot *snap)
int
nng_snapshot_next(nng_snapshot *snap, nng_stat **statp)
{
+ NNI_ARG_UNUSED(snap)
+ NNI_ARG_UNUSED(statp)
// Stats TBD.
*statp = NULL;
return (NNG_ENOTSUP);
@@ -1241,6 +1253,7 @@ nng_snapshot_next(nng_snapshot *snap, nng_stat **statp)
const char *
nng_stat_name(nng_stat *stat)
{
+ NNI_ARG_UNUSED(stat)
// Stats TBD.
return (NULL);
}
@@ -1248,13 +1261,23 @@ nng_stat_name(nng_stat *stat)
int
nng_stat_type(nng_stat *stat)
{
+ NNI_ARG_UNUSED(stat)
// Stats TBD.
return (0);
}
+int
+nng_stat_unit(nng_stat *stat)
+{
+ NNI_ARG_UNUSED(stat)
+ // Stats TBD.
+ return (0);
+}
+
int64_t
nng_stat_value(nng_stat *stat)
{
+ NNI_ARG_UNUSED(stat)
// Stats TBD.
return (0);
}
diff --git a/src/nng.h b/src/nng.h
index 84223bdc..22d3e552 100644
--- a/src/nng.h
+++ b/src/nng.h
@@ -492,15 +492,15 @@ enum nng_flag_enum {
// object must be deallocated expressly by the user, and may persist beyond
// the lifetime of any socket object used to update it. Note that the
// values of the statistics are initially unset.
-NNG_DECL int nng_snapshot_create(nng_socket, nng_snapshot **);
+//NNG_DECL int nng_snapshot_create(nng_socket, nng_snapshot **);
// nng_snapshot_free frees a snapshot object. All statistic objects
// contained therein are destroyed as well.
-NNG_DECL void nng_snapshot_free(nng_snapshot *);
+//NNG_DECL void nng_snapshot_free(nng_snapshot *);
// nng_snapshot_update updates a snapshot of all the statistics
// relevant to a particular socket. All prior values are overwritten.
-NNG_DECL int nng_snapshot_update(nng_snapshot *);
+//NNG_DECL int nng_snapshot_update(nng_snapshot *);
// nng_snapshot_next is used to iterate over the individual statistic
// objects inside the snapshot. Note that the statistic object, and the
@@ -511,13 +511,13 @@ NNG_DECL int nng_snapshot_update(nng_snapshot *);
// Iteration begins by providing NULL in the value referenced. Successive
// calls will update this value, returning NULL when no more statistics
// are available in the snapshot.
-NNG_DECL int nng_snapshot_next(nng_snapshot *, nng_stat **);
+//NNG_DECL int nng_snapshot_next(nng_snapshot *, nng_stat **);
// nng_stat_name is used to determine the name of the statistic.
// This is a human readable name. Statistic names, as well as the presence
// or absence or semantic of any particular statistic are not part of any
// stable API, and may be changed without notice in future updates.
-NNG_DECL const char *nng_stat_name(nng_stat *);
+//NNG_DECL const char *nng_stat_name(nng_stat *);
// nng_stat_type is used to determine the type of the statistic.
// At present, only NNG_STAT_TYPE_LEVEL and and NNG_STAT_TYPE_COUNTER
@@ -525,7 +525,7 @@ NNG_DECL const char *nng_stat_name(nng_stat *);
// value over time are likely more interesting than the actual level. Level
// values reflect some absolute state however, and should be presented to the
// user as is.
-NNG_DECL int nng_stat_type(nng_stat *);
+//NNG_DECL int nng_stat_type(nng_stat *);
enum nng_stat_type_enum {
NNG_STAT_LEVEL = 0,
@@ -536,7 +536,7 @@ enum nng_stat_type_enum {
// such as NNG_UNIT_BYTES or NNG_UNIT_BYTES. If no specific unit is
// applicable, such as a relative priority, then NN_UNIT_NONE is
// returned.
-NNG_DECL int nng_stat_unit(nng_stat *);
+//NNG_DECL int nng_stat_unit(nng_stat *);
enum nng_unit_enum {
NNG_UNIT_NONE = 0,
@@ -550,7 +550,7 @@ enum nng_unit_enum {
// nng_stat_value returns returns the actual value of the statistic.
// Statistic values reflect their value at the time that the corresponding
// snapshot was updated, and are undefined until an update is performed.
-NNG_DECL int64_t nng_stat_value(nng_stat *);
+//NNG_DECL int64_t nng_stat_value(nng_stat *);
// Device functionality. This connects two sockets together in a device,
// which means that messages from one side are forwarded to the other.
diff --git a/src/supplemental/http/http_public.c b/src/supplemental/http/http_public.c
index 2d879807..7107c029 100644
--- a/src/supplemental/http/http_public.c
+++ b/src/supplemental/http/http_public.c
@@ -574,6 +574,16 @@ nng_http_handler_set_host(nng_http_handler *h, const char *host)
#endif
}
+int nng_http_handler_set_tree(nng_http_handler *h)
+{
+#ifdef NNG_SUPP_HTTP
+ return (nni_http_handler_set_tree(h));
+#else
+ NNI_ARG_UNUSED(h);
+ return (NNG_ENOTSUP);
+#endif
+}
+
int
nng_http_handler_set_data(nng_http_handler *h, void *dat, void (*dtor)(void *))
{
@@ -588,7 +598,7 @@ nng_http_handler_set_data(nng_http_handler *h, void *dat, void (*dtor)(void *))
}
void *
-nng_handler_get_data(nng_http_handler *h)
+nng_http_handler_get_data(nng_http_handler *h)
{
#ifdef NNG_SUPP_HTTP
return (nni_http_handler_get_data(h));
@@ -688,6 +698,16 @@ nng_http_server_get_tls(nng_http_server *srv, nng_tls_config **cfgp)
#endif
}
+int nng_http_hijack(nng_http_conn * conn)
+{
+#ifdef NNG_SUPP_HTTP
+ return (nni_http_hijack(conn));
+#else
+ NNI_ARG_UNUSED(conn);
+ return (NNG_ENOTSUP);
+#endif
+}
+
int
nng_http_client_alloc(nng_http_client **clip, const nng_url *url)
{
diff --git a/src/supplemental/tls/none/tls.c b/src/supplemental/tls/none/tls.c
index a11bd3fa..2fdc0c93 100644
--- a/src/supplemental/tls/none/tls.c
+++ b/src/supplemental/tls/none/tls.c
@@ -163,6 +163,22 @@ nng_tls_config_cert_key_file(
return (NNG_ENOTSUP);
}
+int nng_tls_config_key(nng_tls_config *cfg, const uint8_t * key, size_t size)
+{
+ NNI_ARG_UNUSED(cfg);
+ NNI_ARG_UNUSED(key);
+ NNI_ARG_UNUSED(size);
+ return (NNG_ENOTSUP);
+}
+
+int nng_tls_config_pass(nng_tls_config *cfg, const char *pass)
+{
+ NNI_ARG_UNUSED(cfg);
+ NNI_ARG_UNUSED(pass);
+ return (NNG_ENOTSUP);
+}
+
+
int
nng_tls_config_alloc(nng_tls_config **cfgp, nng_tls_mode mode)
{
diff --git a/src/transport/ws/websocket.c b/src/transport/ws/websocket.c
index f0172385..2aeb6e29 100644
--- a/src/transport/ws/websocket.c
+++ b/src/transport/ws/websocket.c
@@ -976,5 +976,11 @@ nng_wss_register(void)
{
return (nni_tran_register(&wss_tran));
}
+#else
+int
+nng_wss_register(void)
+{
+ return (0);
+}
#endif // NNG_TRANSPORT_WSS