From c2aa8c12e705ba77f3d2d28c5ba0a9ec7efb7632 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Sat, 25 Oct 2025 20:28:43 -0700 Subject: Drop the protocol version for internal implementations. The ops vector / protocol API/ABI were meant to support external implementations, but we have moved away from having pluggable protocols, and we aren't likely to support it any time soon. --- src/core/protocol.h | 12 ------------ src/core/socket.c | 5 ----- src/sp/protocol/bus0/bus.c | 2 -- src/sp/protocol/pair0/pair.c | 2 -- src/sp/protocol/pair1/pair.c | 2 -- src/sp/protocol/pair1/pair1_poly.c | 1 - src/sp/protocol/pipeline0/pull.c | 2 -- src/sp/protocol/pipeline0/push.c | 2 -- src/sp/protocol/pubsub0/pub.c | 2 -- src/sp/protocol/pubsub0/sub.c | 1 - src/sp/protocol/pubsub0/xsub.c | 1 - src/sp/protocol/reqrep0/rep.c | 1 - src/sp/protocol/reqrep0/req.c | 1 - src/sp/protocol/reqrep0/xrep.c | 1 - src/sp/protocol/reqrep0/xreq.c | 1 - src/sp/protocol/survey0/respond.c | 1 - src/sp/protocol/survey0/survey.c | 1 - src/sp/protocol/survey0/xrespond.c | 1 - src/sp/protocol/survey0/xsurvey.c | 1 - 19 files changed, 40 deletions(-) (limited to 'src') diff --git a/src/core/protocol.h b/src/core/protocol.h index c128e676..8f7e9e39 100644 --- a/src/core/protocol.h +++ b/src/core/protocol.h @@ -124,7 +124,6 @@ typedef struct nni_proto_id { } nni_proto_id; struct nni_proto { - uint32_t proto_version; // Ops vector version nni_proto_id proto_self; // Our identity nni_proto_id proto_peer; // Peer identity uint32_t proto_flags; // Protocol flags @@ -133,17 +132,6 @@ struct nni_proto { const nni_proto_ctx_ops *proto_ctx_ops; // Context operations }; -// We quite intentionally use a signature where the upper word is nonzero, -// which ensures that if we get garbage we will reject it. This is more -// likely to mismatch than all zero bytes would. The actual version is -// stored in the lower word; this is not semver -- the numbers are just -// increasing - we doubt it will increase more than a handful of times -// during the life of the project. If we add a new version, please keep -// the old version around -- it may be possible to automatically convert -// older versions in the future. -#define NNI_PROTOCOL_V3 0x50520003u // "pr\0\3" -#define NNI_PROTOCOL_VERSION NNI_PROTOCOL_V3 - // These flags determine which operations make sense. We use them so that // we can reject attempts to create notification fds for operations that make // no sense. Also, we can detect raw mode, thereby providing handling for diff --git a/src/core/socket.c b/src/core/socket.c index a7633c9e..a79955b3 100644 --- a/src/core/socket.c +++ b/src/core/socket.c @@ -577,11 +577,6 @@ nni_sock_open(nni_sock **sockp, const nni_proto *proto) nni_sock *s = NULL; int rv; - if (proto->proto_version != NNI_PROTOCOL_VERSION) { - // unsupported protocol version - return (NNG_ENOTSUP); - } - if ((rv = nni_sock_create(&s, proto)) != 0) { return (rv); } diff --git a/src/sp/protocol/bus0/bus.c b/src/sp/protocol/bus0/bus.c index 0bbfb031..b69e31b9 100644 --- a/src/sp/protocol/bus0/bus.c +++ b/src/sp/protocol/bus0/bus.c @@ -503,7 +503,6 @@ static nni_proto_sock_ops bus0_sock_ops_raw = { }; static nni_proto bus0_proto = { - .proto_version = NNI_PROTOCOL_VERSION, .proto_self = { NNI_PROTO_BUS_V0, "bus" }, .proto_peer = { NNI_PROTO_BUS_V0, "bus" }, .proto_flags = NNI_PROTO_FLAG_SNDRCV, @@ -512,7 +511,6 @@ static nni_proto bus0_proto = { }; static nni_proto bus0_proto_raw = { - .proto_version = NNI_PROTOCOL_VERSION, .proto_self = { NNI_PROTO_BUS_V0, "bus" }, .proto_peer = { NNI_PROTO_BUS_V0, "bus" }, .proto_flags = NNI_PROTO_FLAG_SNDRCV | NNI_PROTO_FLAG_RAW, diff --git a/src/sp/protocol/pair0/pair.c b/src/sp/protocol/pair0/pair.c index bf895858..9cd910e9 100644 --- a/src/sp/protocol/pair0/pair.c +++ b/src/sp/protocol/pair0/pair.c @@ -560,7 +560,6 @@ static nni_proto_sock_ops pair0_sock_ops = { // Legacy protocol (v0) static nni_proto pair0_proto = { - .proto_version = NNI_PROTOCOL_VERSION, .proto_self = { NNI_PROTO_PAIR_V0, "pair" }, .proto_peer = { NNI_PROTO_PAIR_V0, "pair" }, .proto_flags = NNI_PROTO_FLAG_SNDRCV, @@ -569,7 +568,6 @@ static nni_proto pair0_proto = { }; static nni_proto pair0_proto_raw = { - .proto_version = NNI_PROTOCOL_VERSION, .proto_self = { NNI_PROTO_PAIR_V0, "pair" }, .proto_peer = { NNI_PROTO_PAIR_V0, "pair" }, .proto_flags = NNI_PROTO_FLAG_SNDRCV | NNI_PROTO_FLAG_RAW, diff --git a/src/sp/protocol/pair1/pair.c b/src/sp/protocol/pair1/pair.c index bddde6f8..138af845 100644 --- a/src/sp/protocol/pair1/pair.c +++ b/src/sp/protocol/pair1/pair.c @@ -793,7 +793,6 @@ static nni_proto_sock_ops pair1_sock_ops = { }; static nni_proto pair1_proto = { - .proto_version = NNI_PROTOCOL_VERSION, .proto_self = { PAIR1_SELF, PAIR1_SELF_NAME }, .proto_peer = { PAIR1_PEER, PAIR1_PEER_NAME }, .proto_flags = NNI_PROTO_FLAG_SNDRCV, @@ -821,7 +820,6 @@ static nni_proto_sock_ops pair1_sock_ops_raw = { }; static nni_proto pair1_proto_raw = { - .proto_version = NNI_PROTOCOL_VERSION, .proto_self = { PAIR1_SELF, PAIR1_SELF_NAME }, .proto_peer = { PAIR1_PEER, PAIR1_PEER_NAME }, .proto_flags = NNI_PROTO_FLAG_SNDRCV | NNI_PROTO_FLAG_RAW, diff --git a/src/sp/protocol/pair1/pair1_poly.c b/src/sp/protocol/pair1/pair1_poly.c index 9c34cd00..958e6cb9 100644 --- a/src/sp/protocol/pair1/pair1_poly.c +++ b/src/sp/protocol/pair1/pair1_poly.c @@ -532,7 +532,6 @@ static nni_proto_sock_ops pair1poly_sock_ops = { }; static nni_proto pair1poly_proto = { - .proto_version = NNI_PROTOCOL_VERSION, .proto_self = { PAIR1_SELF, PAIR1_SELF_NAME }, .proto_peer = { PAIR1_PEER, PAIR1_PEER_NAME }, .proto_flags = NNI_PROTO_FLAG_SNDRCV, diff --git a/src/sp/protocol/pipeline0/pull.c b/src/sp/protocol/pipeline0/pull.c index f295556d..72e30acc 100644 --- a/src/sp/protocol/pipeline0/pull.c +++ b/src/sp/protocol/pipeline0/pull.c @@ -286,7 +286,6 @@ static nni_proto_sock_ops pull0_sock_ops = { }; static nni_proto pull0_proto = { - .proto_version = NNI_PROTOCOL_VERSION, .proto_self = { NNI_PROTO_PULL_V0, "pull" }, .proto_peer = { NNI_PROTO_PUSH_V0, "push" }, .proto_flags = NNI_PROTO_FLAG_RCV, @@ -295,7 +294,6 @@ static nni_proto pull0_proto = { }; static nni_proto pull0_proto_raw = { - .proto_version = NNI_PROTOCOL_VERSION, .proto_self = { NNI_PROTO_PULL_V0, "pull" }, .proto_peer = { NNI_PROTO_PUSH_V0, "push" }, .proto_flags = NNI_PROTO_FLAG_RCV | NNI_PROTO_FLAG_RAW, diff --git a/src/sp/protocol/pipeline0/push.c b/src/sp/protocol/pipeline0/push.c index 3be746c9..6833504e 100644 --- a/src/sp/protocol/pipeline0/push.c +++ b/src/sp/protocol/pipeline0/push.c @@ -404,7 +404,6 @@ static nni_proto_sock_ops push0_sock_ops = { }; static nni_proto push0_proto = { - .proto_version = NNI_PROTOCOL_VERSION, .proto_self = { NNI_PROTO_PUSH_V0, "push" }, .proto_peer = { NNI_PROTO_PULL_V0, "pull" }, .proto_flags = NNI_PROTO_FLAG_SND, @@ -413,7 +412,6 @@ static nni_proto push0_proto = { }; static nni_proto push0_proto_raw = { - .proto_version = NNI_PROTOCOL_VERSION, .proto_self = { NNI_PROTO_PUSH_V0, "push" }, .proto_peer = { NNI_PROTO_PULL_V0, "pull" }, .proto_flags = NNI_PROTO_FLAG_SND | NNI_PROTO_FLAG_RAW, diff --git a/src/sp/protocol/pubsub0/pub.c b/src/sp/protocol/pubsub0/pub.c index bc0e5d66..97566a11 100644 --- a/src/sp/protocol/pubsub0/pub.c +++ b/src/sp/protocol/pubsub0/pub.c @@ -410,7 +410,6 @@ static nni_proto_sock_ops pub0_sock_ops = { }; static nni_proto pub0_proto = { - .proto_version = NNI_PROTOCOL_VERSION, .proto_self = { NNI_PROTO_PUB_V0, "pub" }, .proto_peer = { NNI_PROTO_SUB_V0, "sub" }, .proto_flags = NNI_PROTO_FLAG_SND, @@ -419,7 +418,6 @@ static nni_proto pub0_proto = { }; static nni_proto pub0_proto_raw = { - .proto_version = NNI_PROTOCOL_VERSION, .proto_self = { NNI_PROTO_PUB_V0, "pub" }, .proto_peer = { NNI_PROTO_SUB_V0, "sub" }, .proto_flags = NNI_PROTO_FLAG_SND | NNI_PROTO_FLAG_RAW, diff --git a/src/sp/protocol/pubsub0/sub.c b/src/sp/protocol/pubsub0/sub.c index 487d82c8..9176ad1c 100644 --- a/src/sp/protocol/pubsub0/sub.c +++ b/src/sp/protocol/pubsub0/sub.c @@ -683,7 +683,6 @@ static nni_proto_sock_ops sub0_sock_ops = { }; static nni_proto sub0_proto = { - .proto_version = NNI_PROTOCOL_VERSION, .proto_self = { NNI_PROTO_SUB_V0, "sub" }, .proto_peer = { NNI_PROTO_PUB_V0, "pub" }, .proto_flags = NNI_PROTO_FLAG_RCV, diff --git a/src/sp/protocol/pubsub0/xsub.c b/src/sp/protocol/pubsub0/xsub.c index 7fdcf341..785c0ae9 100644 --- a/src/sp/protocol/pubsub0/xsub.c +++ b/src/sp/protocol/pubsub0/xsub.c @@ -203,7 +203,6 @@ static nni_proto_sock_ops xsub0_sock_ops = { }; static nni_proto xsub0_proto = { - .proto_version = NNI_PROTOCOL_VERSION, .proto_self = { NNI_PROTO_SUB_V0, "sub" }, .proto_peer = { NNI_PROTO_PUB_V0, "pub" }, .proto_flags = NNI_PROTO_FLAG_RCV | NNI_PROTO_FLAG_RAW, diff --git a/src/sp/protocol/reqrep0/rep.c b/src/sp/protocol/reqrep0/rep.c index ea3e9558..940a79a0 100644 --- a/src/sp/protocol/reqrep0/rep.c +++ b/src/sp/protocol/reqrep0/rep.c @@ -673,7 +673,6 @@ static nni_proto_sock_ops rep0_sock_ops = { }; static nni_proto rep0_proto = { - .proto_version = NNI_PROTOCOL_VERSION, .proto_self = { REP0_SELF, REP0_SELF_NAME }, .proto_peer = { REP0_PEER, REP0_PEER_NAME }, .proto_flags = NNI_PROTO_FLAG_SNDRCV, diff --git a/src/sp/protocol/reqrep0/req.c b/src/sp/protocol/reqrep0/req.c index 451253bd..cc2875ce 100644 --- a/src/sp/protocol/reqrep0/req.c +++ b/src/sp/protocol/reqrep0/req.c @@ -933,7 +933,6 @@ static nni_proto_sock_ops req0_sock_ops = { }; static nni_proto req0_proto = { - .proto_version = NNI_PROTOCOL_VERSION, .proto_self = { REQ0_SELF, REQ0_SELF_NAME }, .proto_peer = { REQ0_PEER, REQ0_PEER_NAME }, .proto_flags = NNI_PROTO_FLAG_SNDRCV, diff --git a/src/sp/protocol/reqrep0/xrep.c b/src/sp/protocol/reqrep0/xrep.c index e0b5fece..2422da0d 100644 --- a/src/sp/protocol/reqrep0/xrep.c +++ b/src/sp/protocol/reqrep0/xrep.c @@ -430,7 +430,6 @@ static nni_proto_sock_ops xrep0_sock_ops = { }; static nni_proto xrep0_proto = { - .proto_version = NNI_PROTOCOL_VERSION, .proto_self = { REP0_SELF, REP0_SELF_NAME }, .proto_peer = { REP0_PEER, REP0_PEER_NAME }, .proto_flags = NNI_PROTO_FLAG_SNDRCV | NNI_PROTO_FLAG_RAW, diff --git a/src/sp/protocol/reqrep0/xreq.c b/src/sp/protocol/reqrep0/xreq.c index 8939d8f4..e99623ea 100644 --- a/src/sp/protocol/reqrep0/xreq.c +++ b/src/sp/protocol/reqrep0/xreq.c @@ -313,7 +313,6 @@ static nni_proto_sock_ops xreq0_sock_ops = { }; static nni_proto xreq0_proto = { - .proto_version = NNI_PROTOCOL_VERSION, .proto_self = { REQ0_SELF, REQ0_SELF_NAME }, .proto_peer = { REQ0_PEER, REQ0_PEER_NAME }, .proto_flags = NNI_PROTO_FLAG_SNDRCV | NNI_PROTO_FLAG_RAW, diff --git a/src/sp/protocol/survey0/respond.c b/src/sp/protocol/survey0/respond.c index 85c96843..25f2f2b6 100644 --- a/src/sp/protocol/survey0/respond.c +++ b/src/sp/protocol/survey0/respond.c @@ -659,7 +659,6 @@ static nni_proto_sock_ops resp0_sock_ops = { }; static nni_proto resp0_proto = { - .proto_version = NNI_PROTOCOL_VERSION, .proto_self = { NNI_PROTO_RESPONDENT_V0, "respondent" }, .proto_peer = { NNI_PROTO_SURVEYOR_V0, "surveyor" }, .proto_flags = NNI_PROTO_FLAG_SNDRCV, diff --git a/src/sp/protocol/survey0/survey.c b/src/sp/protocol/survey0/survey.c index 1c678d1e..d52e6012 100644 --- a/src/sp/protocol/survey0/survey.c +++ b/src/sp/protocol/survey0/survey.c @@ -608,7 +608,6 @@ static nni_proto_sock_ops surv0_sock_ops = { }; static nni_proto surv0_proto = { - .proto_version = NNI_PROTOCOL_VERSION, .proto_self = { SURVEYOR0_SELF, SURVEYOR0_SELF_NAME }, .proto_peer = { SURVEYOR0_PEER, SURVEYOR0_PEER_NAME }, .proto_flags = NNI_PROTO_FLAG_SNDRCV, diff --git a/src/sp/protocol/survey0/xrespond.c b/src/sp/protocol/survey0/xrespond.c index e9fa209c..3d8267de 100644 --- a/src/sp/protocol/survey0/xrespond.c +++ b/src/sp/protocol/survey0/xrespond.c @@ -408,7 +408,6 @@ static nni_proto_sock_ops xresp0_sock_ops = { }; static nni_proto xresp0_proto = { - .proto_version = NNI_PROTOCOL_VERSION, .proto_self = { NNI_PROTO_RESPONDENT_V0, "respondent" }, .proto_peer = { NNI_PROTO_SURVEYOR_V0, "surveyor" }, .proto_flags = NNI_PROTO_FLAG_SNDRCV | NNI_PROTO_FLAG_RAW, diff --git a/src/sp/protocol/survey0/xsurvey.c b/src/sp/protocol/survey0/xsurvey.c index c01c20c3..abb0246f 100644 --- a/src/sp/protocol/survey0/xsurvey.c +++ b/src/sp/protocol/survey0/xsurvey.c @@ -378,7 +378,6 @@ static nni_proto_sock_ops xsurv0_sock_ops = { }; static nni_proto xsurv0_proto = { - .proto_version = NNI_PROTOCOL_VERSION, .proto_self = { SURVEYOR0_SELF, SURVEYOR0_SELF_NAME }, .proto_peer = { SURVEYOR0_PEER, SURVEYOR0_PEER_NAME }, .proto_flags = NNI_PROTO_FLAG_SNDRCV | NNI_PROTO_FLAG_RAW, -- cgit v1.2.3-70-g09d2