aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2020-01-18 14:35:36 -0800
committerGarrett D'Amore <garrett@damore.org>2020-01-18 19:50:47 -0800
commit0242199ddc95e8a683304897a3e1bc26c7e74c0f (patch)
tree6b60ee6b9d1d1988c28b42d4af33005a4b8a3ae1 /include
parent10133ca9b5439e67b287703739e23e7d82fb76c4 (diff)
downloadnng-0242199ddc95e8a683304897a3e1bc26c7e74c0f.tar.gz
nng-0242199ddc95e8a683304897a3e1bc26c7e74c0f.tar.bz2
nng-0242199ddc95e8a683304897a3e1bc26c7e74c0f.zip
fixes #1142 raw mode use of message headers is inconsistent
This correctly moves the entire protocol header for XREQ and XRESPONDENT protocols to the message header (not the body). This is where it should always have been. There is some small chance that applications which were coded to parse the header from the body will break. We don't think there are any such applications in use.
Diffstat (limited to 'include')
-rw-r--r--include/nng/nng.h5
-rw-r--r--include/nng/protocol/reqrep0/rep.h7
-rw-r--r--include/nng/protocol/reqrep0/req.h7
-rw-r--r--include/nng/protocol/survey0/respond.h7
-rw-r--r--include/nng/protocol/survey0/survey.h7
5 files changed, 29 insertions, 4 deletions
diff --git a/include/nng/nng.h b/include/nng/nng.h
index a0e565d0..f1813cf1 100644
--- a/include/nng/nng.h
+++ b/include/nng/nng.h
@@ -62,6 +62,11 @@ extern "C" {
// with other implementations.
#define NNG_MAXADDRLEN (128)
+// NNG_PROTOCOL_NUMBER is used by protocol headers to calculate their
+// protocol number from a major and minor number. Applications should
+// probably not need to use this.
+#define NNG_PROTOCOL_NUMBER(maj, min) (((x)*16)+(y))
+
// Types common to nng.
// Identifiers are wrapped in a structure to improve compiler validation
diff --git a/include/nng/protocol/reqrep0/rep.h b/include/nng/protocol/reqrep0/rep.h
index 6322b5df..04fe18bf 100644
--- a/include/nng/protocol/reqrep0/rep.h
+++ b/include/nng/protocol/reqrep0/rep.h
@@ -1,5 +1,5 @@
//
-// Copyright 2018 Staysail Systems, Inc. <info@staysail.tech>
+// Copyright 2020 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
@@ -26,6 +26,11 @@ NNG_DECL int nng_rep0_open_raw(nng_socket *);
#define nng_rep_open_raw nng_rep0_open_raw
#endif
+#define NNG_REP0_SELF 0x31
+#define NNG_REP0_PEER 0x30
+#define NNG_REP0_SELF_NAME "rep"
+#define NNG_REP0_PEER_NAME "req"
+
#ifdef __cplusplus
}
#endif
diff --git a/include/nng/protocol/reqrep0/req.h b/include/nng/protocol/reqrep0/req.h
index 392c7932..3ed80216 100644
--- a/include/nng/protocol/reqrep0/req.h
+++ b/include/nng/protocol/reqrep0/req.h
@@ -1,5 +1,5 @@
//
-// Copyright 2018 Staysail Systems, Inc. <info@staysail.tech>
+// Copyright 2020 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
@@ -25,6 +25,11 @@ NNG_DECL int nng_req0_open_raw(nng_socket *);
#define nng_req_open_raw nng_req0_open_raw
#endif
+#define NNG_REQ0_SELF 0x30
+#define NNG_REQ0_PEER 0x31
+#define NNG_REQ0_SELF_NAME "req"
+#define NNG_REQ0_PEER_NAME "rep"
+
#define NNG_OPT_REQ_RESENDTIME "req:resend-time"
#ifdef __cplusplus
diff --git a/include/nng/protocol/survey0/respond.h b/include/nng/protocol/survey0/respond.h
index b865b2ac..d7dab61d 100644
--- a/include/nng/protocol/survey0/respond.h
+++ b/include/nng/protocol/survey0/respond.h
@@ -1,5 +1,5 @@
//
-// Copyright 2018 Staysail Systems, Inc. <info@staysail.tech>
+// Copyright 2020 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
@@ -26,6 +26,11 @@ NNG_DECL int nng_respondent0_open_raw(nng_socket *);
#define nng_respondent_open_raw nng_respondent0_open_raw
#endif
+#define NNG_RESPONDENT0_SELF 0x63
+#define NNG_RESPONDENT0_PEER 0x62
+#define NNG_RESPONDENT0_SELF_NAME "respondent"
+#define NNG_RESPONDENT0_PEER_NAME "surveyor"
+
#ifdef __cplusplus
}
#endif
diff --git a/include/nng/protocol/survey0/survey.h b/include/nng/protocol/survey0/survey.h
index 37f76fbf..cea4d58b 100644
--- a/include/nng/protocol/survey0/survey.h
+++ b/include/nng/protocol/survey0/survey.h
@@ -1,5 +1,5 @@
//
-// Copyright 2018 Staysail Systems, Inc. <info@staysail.tech>
+// Copyright 2020 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
@@ -26,6 +26,11 @@ NNG_DECL int nng_surveyor0_open_raw(nng_socket *);
#define nng_surveyor_open_raw nng_surveyor0_open_raw
#endif
+#define NNG_SURVEYOR0_SELF 0x62
+#define NNG_SURVEYOR0_PEER 0x63
+#define NNG_SURVEYOR0_SELF_NAME "surveyor"
+#define NNG_SURVEYOR0_PEER_NAME "respondent"
+
#define NNG_OPT_SURVEYOR_SURVEYTIME "surveyor:survey-time"
#ifdef __cplusplus