diff options
| author | Garrett D'Amore <garrett@damore.org> | 2024-11-03 10:12:28 -0800 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2024-11-03 10:45:51 -0800 |
| commit | 49076237cc0b82e7007535e789f3fadc19a18c45 (patch) | |
| tree | 6336768366f8d8bca987f8742ddcb1df73fd3c98 /src/sp | |
| parent | 11485d2723f22dc60e4cefea3ffb3fd8a378d931 (diff) | |
| download | nng-49076237cc0b82e7007535e789f3fadc19a18c45.tar.gz nng-49076237cc0b82e7007535e789f3fadc19a18c45.tar.bz2 nng-49076237cc0b82e7007535e789f3fadc19a18c45.zip | |
Remove NNI_TYPE_OPAQUE altogether.
This also fixes a couple of minor bugs -- changing the socket name
could be incorrect as the termination was not applied properly,
and the ZeroTier code got a change -- note that it is only possible
in this revised version to pass a single moon ID for ZT orbit.
The ZT code is a bit stale, and untested anyway.
Diffstat (limited to 'src/sp')
| -rw-r--r-- | src/sp/transport/zerotier/zerotier.c | 53 |
1 files changed, 4 insertions, 49 deletions
diff --git a/src/sp/transport/zerotier/zerotier.c b/src/sp/transport/zerotier/zerotier.c index b3e931ef..7b2142b1 100644 --- a/src/sp/transport/zerotier/zerotier.c +++ b/src/sp/transport/zerotier/zerotier.c @@ -1614,36 +1614,11 @@ zt_tran_fini(void) } static int -zt_check_recvmaxsz(const void *v, size_t sz, nni_type t) -{ - return (nni_copyin_size(NULL, v, sz, 0, NNI_MAXSZ, t)); -} - -static int -zt_check_orbit(const void *v, size_t sz, nni_type t) -{ - NNI_ARG_UNUSED(v); - if ((t != NNI_TYPE_UINT64) && (t != NNI_TYPE_OPAQUE)) { - return (NNG_EBADTYPE); - } - if (sz != sizeof(uint64_t) && sz != sizeof(uint64_t) * 2) { - return (NNG_EINVAL); - } - return (0); -} - -static int -zt_check_deorbit(const void *v, size_t sz, nni_type t) -{ - return (nni_copyin_u64(NULL, v, sz, t)); -} - -static int zt_check_string(const void *v, size_t sz, nni_type t) { size_t len; - if ((t != NNI_TYPE_OPAQUE) && (t != NNI_TYPE_STRING)) { + if (t != NNI_TYPE_STRING) { return (NNG_EBADTYPE); } len = nni_strnlen(v, sz); @@ -1653,18 +1628,6 @@ zt_check_string(const void *v, size_t sz, nni_type t) return (0); } -static int -zt_check_time(const void *v, size_t sz, nni_type t) -{ - return (nni_copyin_ms(NULL, v, sz, t)); -} - -static int -zt_check_tries(const void *v, size_t sz, nni_type t) -{ - return (nni_copyin_int(NULL, v, sz, 0, 1000000, t)); -} - static void zt_pipe_close(void *arg) { @@ -2692,19 +2655,11 @@ zt_ep_set_orbit(void *arg, const void *data, size_t sz, nni_type t) int rv; enum ZT_ResultCode zrv; - if ((t != NNI_TYPE_UINT64) && (t != NNI_TYPE_OPAQUE)) { + if (t != NNI_TYPE_UINT64) { return (NNG_EBADTYPE); } - if (sz == sizeof(uint64_t)) { - memcpy(&moonid, data, sizeof(moonid)); - peerid = 0; - } else if (sz == sizeof(uint64_t) * 2) { - memcpy(&moonid, data, sizeof(moonid)); - memcpy(&peerid, ((char *) data) + sizeof(uint64_t), - sizeof(peerid)); - } else { - return (NNG_EINVAL); - } + memcpy(&moonid, data, sizeof(moonid)); + peerid = 0; nni_mtx_lock(&zt_lk); if ((ep->ze_ztn == NULL) && ((rv = zt_node_find(ep)) != 0)) { |
