aboutsummaryrefslogtreecommitdiff
path: root/src/core/options.c
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2019-01-21 22:40:10 -0800
committerGarrett D'Amore <garrett@damore.org>2019-02-16 19:22:27 -0800
commit5cf750697624d4fd63cfe26921209d7c30e1a2d2 (patch)
treebf11695e5f1ec5e400c87da0cc6ff23935a2eeff /src/core/options.c
parentca655b9db689ee0e655248b1a9f166b8db6cc984 (diff)
downloadnng-5cf750697624d4fd63cfe26921209d7c30e1a2d2.tar.gz
nng-5cf750697624d4fd63cfe26921209d7c30e1a2d2.tar.bz2
nng-5cf750697624d4fd63cfe26921209d7c30e1a2d2.zip
fixes #872 create unified nng_stream API
This is a major change, and includes changes to use a polymorphic stream API for all transports. There have been related bugs fixed along the way. Additionally the man pages have changed. The old non-polymorphic APIs are removed now. This is a breaking change, but the old APIs were never part of any released public API.
Diffstat (limited to 'src/core/options.c')
-rw-r--r--src/core/options.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/core/options.c b/src/core/options.c
index 0b15d6e2..82735369 100644
--- a/src/core/options.c
+++ b/src/core/options.c
@@ -398,4 +398,20 @@ nni_setopt(const nni_option *opts, const char *nm, void *arg, const void *buf,
opts++;
}
return (NNG_ENOTSUP);
+}
+
+int
+nni_chkopt(const nni_chkoption *opts, const char *nm, const void *buf,
+ size_t sz, nni_type t)
+{
+ while (opts->o_name != NULL) {
+ if (strcmp(opts->o_name, nm) == 0) {
+ if (opts->o_check == NULL) {
+ return (NNG_EREADONLY);
+ }
+ return (opts->o_check(buf, sz, t));
+ }
+ opts++;
+ }
+ return (NNG_ENOTSUP);
} \ No newline at end of file