aboutsummaryrefslogtreecommitdiff
path: root/src/core/defs.h
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2018-03-19 16:02:37 -0700
committerGarrett D'Amore <garrett@damore.org>2018-03-20 09:53:58 -0700
commit9ca901c1b70b17d851426483d9f54611cfa8e395 (patch)
treea26b11e16f505ccdc77b5ac6681e0f9de705ff20 /src/core/defs.h
parent9b886a9999247d87c9f6d389c3e65a4bd39be010 (diff)
downloadnng-9ca901c1b70b17d851426483d9f54611cfa8e395.tar.gz
nng-9ca901c1b70b17d851426483d9f54611cfa8e395.tar.bz2
nng-9ca901c1b70b17d851426483d9f54611cfa8e395.zip
fixes #296 Typed options should validate option type
fixes #302 nng_dialer/listener/pipe_getopt_sockaddr desired This adds plumbing to pass and check the type of options all the way through. NNG_ZT_OPT_ORBIT is type UINT64, but you can use the untyped form to pass two of them if needed. No typed access for retrieving strings yet. I think this should allocate a pointer and copy that out, but that's for later.
Diffstat (limited to 'src/core/defs.h')
-rw-r--r--src/core/defs.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/core/defs.h b/src/core/defs.h
index 0f38b9cf..f64d3df7 100644
--- a/src/core/defs.h
+++ b/src/core/defs.h
@@ -136,4 +136,20 @@ typedef struct {
// A few assorted other items.
#define NNI_FLAG_IPV4ONLY 1
+// Types. These are used to provide more structured access to options
+// (and maybe later statistics). For now these are internal only.
+enum nni_type {
+ NNI_TYPE_OPAQUE,
+ NNI_TYPE_BOOL,
+ NNI_TYPE_INT32,
+ NNI_TYPE_UINT32,
+ NNI_TYPE_INT64,
+ NNI_TYPE_UINT64,
+ NNI_TYPE_SIZE,
+ NNI_TYPE_DURATION,
+ NNI_TYPE_STRING,
+ NNI_TYPE_SOCKADDR,
+ NNI_TYPE_POINTER,
+};
+
#endif // CORE_DEFS_H