aboutsummaryrefslogtreecommitdiff
path: root/src/sp/protocol/survey0/xsurvey.c
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2025-01-01 12:44:02 -0800
committerGarrett D'Amore <garrett@damore.org>2025-01-01 12:44:02 -0800
commit0d23af92531b7c0dd6d7b74c73c1a8c4811c7d13 (patch)
tree2dc9ded3dfc724df42a360a9f2de359f406e537f /src/sp/protocol/survey0/xsurvey.c
parentf8a2abaf931557030fd6e6683617c6a7877eebf7 (diff)
downloadnng-0d23af92531b7c0dd6d7b74c73c1a8c4811c7d13.tar.gz
nng-0d23af92531b7c0dd6d7b74c73c1a8c4811c7d13.tar.bz2
nng-0d23af92531b7c0dd6d7b74c73c1a8c4811c7d13.zip
protocols: move content from the protocols to nng.h
This should simplify things for developers. Just one header to include in most cases now.
Diffstat (limited to 'src/sp/protocol/survey0/xsurvey.c')
-rw-r--r--src/sp/protocol/survey0/xsurvey.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/sp/protocol/survey0/xsurvey.c b/src/sp/protocol/survey0/xsurvey.c
index 208db051..2891fba5 100644
--- a/src/sp/protocol/survey0/xsurvey.c
+++ b/src/sp/protocol/survey0/xsurvey.c
@@ -1,5 +1,5 @@
//
-// Copyright 2024 Staysail Systems, Inc. <info@staysail.tech>
+// Copyright 2025 Staysail Systems, Inc. <info@staysail.tech>
// Copyright 2018 Capitar IT Group BV <info@capitar.com>
//
// This software is supplied under the terms of the MIT License, a
@@ -9,11 +9,15 @@
//
#include "core/nng_impl.h"
-#include "nng/protocol/survey0/survey.h"
// Surveyor protocol. The SURVEYOR protocol is the "survey" side of the
// survey pattern. This is useful for building service discovery, voting, etc.
+#define SURVEYOR0_SELF 0x62
+#define SURVEYOR0_PEER 0x63
+#define SURVEYOR0_SELF_NAME "surveyor"
+#define SURVEYOR0_PEER_NAME "respondent"
+
typedef struct xsurv0_pipe xsurv0_pipe;
typedef struct xsurv0_sock xsurv0_sock;
@@ -141,10 +145,10 @@ xsurv0_pipe_start(void *arg)
xsurv0_pipe *p = arg;
xsurv0_sock *s = p->psock;
- if (nni_pipe_peer(p->npipe) != NNG_SURVEYOR0_PEER) {
+ if (nni_pipe_peer(p->npipe) != SURVEYOR0_PEER) {
nng_log_warn("NNG-PEER-MISMATCH",
"Peer protocol mismatch: %d != %d, rejected.",
- nni_pipe_peer(p->npipe), NNG_SURVEYOR0_PEER);
+ nni_pipe_peer(p->npipe), SURVEYOR0_PEER);
return (NNG_EPROTO);
}
@@ -366,8 +370,8 @@ static nni_proto_sock_ops xsurv0_sock_ops = {
static nni_proto xsurv0_proto = {
.proto_version = NNI_PROTOCOL_VERSION,
- .proto_self = { NNG_SURVEYOR0_SELF, NNG_SURVEYOR0_SELF_NAME },
- .proto_peer = { NNG_SURVEYOR0_PEER, NNG_SURVEYOR0_PEER_NAME },
+ .proto_self = { SURVEYOR0_SELF, SURVEYOR0_SELF_NAME },
+ .proto_peer = { SURVEYOR0_PEER, SURVEYOR0_PEER_NAME },
.proto_flags = NNI_PROTO_FLAG_SNDRCV | NNI_PROTO_FLAG_RAW,
.proto_sock_ops = &xsurv0_sock_ops,
.proto_pipe_ops = &xsurv0_pipe_ops,