diff options
| author | Garrett D'Amore <garrett@damore.org> | 2018-06-12 20:05:34 -0700 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2018-06-13 18:01:52 -0700 |
| commit | da2aac4a6eb10af88e3938068e24c58aea1832b1 (patch) | |
| tree | fb0676be5426ed1510945b7e7fe3d09eb45333a7 /src/core/options.h | |
| parent | 61ffae5e3649897776c26799ccaaa35d578ba816 (diff) | |
| download | nng-da2aac4a6eb10af88e3938068e24c58aea1832b1.tar.gz nng-da2aac4a6eb10af88e3938068e24c58aea1832b1.tar.bz2 nng-da2aac4a6eb10af88e3938068e24c58aea1832b1.zip | |
fixes #540 nni_ep_opttype serves no purpose
fixes #538 setopt should have an explicit chkopt routine
fixes #537 Internal TCP API needs better name separation
fixes #524 Option types should be "typed"
This is a rework of the option management code, to make it both clearer
and to prepare for further work to break up endpoints. This reduces
a certain amount of dead or redundant code, and actually saves cycles
when setting options, as some loops were not terminated that should have
been.
Diffstat (limited to 'src/core/options.h')
| -rw-r--r-- | src/core/options.h | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/src/core/options.h b/src/core/options.h index dfc15d31..2a21a039 100644 --- a/src/core/options.h +++ b/src/core/options.h @@ -24,28 +24,29 @@ // in their own option handling, centralizing the logic for dealing with // variable sized options. -extern int nni_copyin_ms(nni_duration *, const void *, size_t, int); -extern int nni_copyin_bool(bool *, const void *, size_t, int); -extern int nni_copyin_int(int *, const void *, size_t, int, int, int); +extern int nni_copyin_ms(nni_duration *, const void *, size_t, nni_opt_type); +extern int nni_copyin_bool(bool *, const void *, size_t, nni_opt_type); +extern int nni_copyin_int(int *, const void *, size_t, int, int, nni_opt_type); extern int nni_copyin_size( - size_t *, const void *, size_t, size_t, size_t, int); -extern int nni_copyin_str(char *, const void *, size_t, size_t, int); -extern int nni_copyin_ptr(void **, const void *, size_t, int); -extern int nni_copyin_u64(uint64_t *, const void *, size_t, int); + size_t *, const void *, size_t, size_t, size_t, nni_opt_type); +extern int nni_copyin_str(char *, const void *, size_t, size_t, nni_opt_type); +extern int nni_copyin_ptr(void **, const void *, size_t, nni_opt_type); +extern int nni_copyin_u64(uint64_t *, const void *, size_t, nni_opt_type); // nni_copyout_xxx copies out a type of the named value. It assumes that // the type is aligned and the size correct, unless NNI_TYPE_OPAQUE is passed. extern int nni_copyout(const void *, size_t, void *, size_t *); -extern int nni_copyout_bool(bool, void *, size_t *, int); -extern int nni_copyout_int(int, void *, size_t *, int); -extern int nni_copyout_ms(nng_duration, void *, size_t *, int); -extern int nni_copyout_ptr(void *, void *, size_t *, int); -extern int nni_copyout_size(size_t, void *, size_t *, int); -extern int nni_copyout_sockaddr(const nng_sockaddr *, void *, size_t *, int); -extern int nni_copyout_u64(uint64_t, void *, size_t *, int); +extern int nni_copyout_bool(bool, void *, size_t *, nni_opt_type); +extern int nni_copyout_int(int, void *, size_t *, nni_opt_type); +extern int nni_copyout_ms(nng_duration, void *, size_t *, nni_opt_type); +extern int nni_copyout_ptr(void *, void *, size_t *, nni_opt_type); +extern int nni_copyout_size(size_t, void *, size_t *, nni_opt_type); +extern int nni_copyout_sockaddr( + const nng_sockaddr *, void *, size_t *, nni_opt_type); +extern int nni_copyout_u64(uint64_t, void *, size_t *, nni_opt_type); // nni_copyout_str copies out a string. If the type is NNI_TYPE_STRING, // then it passes through a pointer, created by nni_strdup(). -extern int nni_copyout_str(const char *, void *, size_t *, int); +extern int nni_copyout_str(const char *, void *, size_t *, nni_opt_type); #endif // CORE_OPTIONS_H |
