diff options
| author | Garrett D'Amore <garrett@damore.org> | 2017-10-31 00:47:21 -0700 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2017-10-31 00:47:21 -0700 |
| commit | 475f4c8abfdd9c88b585105c48839f51d7523d57 (patch) | |
| tree | f6fa693cd20d1f419ec5a1af0b60ffb798b68b4c | |
| parent | b92320b9afe3771465514286db6ee6746ba512d8 (diff) | |
| download | nng-475f4c8abfdd9c88b585105c48839f51d7523d57.tar.gz nng-475f4c8abfdd9c88b585105c48839f51d7523d57.tar.bz2 nng-475f4c8abfdd9c88b585105c48839f51d7523d57.zip | |
fixes #137 Remove public access to numeric protocols
| -rw-r--r-- | docs/libnng.adoc | 2 | ||||
| -rw-r--r-- | docs/nng_pub.adoc | 3 | ||||
| -rw-r--r-- | docs/nng_sub.adoc | 3 | ||||
| -rw-r--r-- | src/core/protocol.h | 25 | ||||
| -rw-r--r-- | src/nng.c | 30 | ||||
| -rw-r--r-- | src/nng.h | 51 | ||||
| -rw-r--r-- | src/nng_compat.c | 27 | ||||
| -rw-r--r-- | src/protocol/bus/bus.c | 4 | ||||
| -rw-r--r-- | src/protocol/pair/pair_v0.c | 4 | ||||
| -rw-r--r-- | src/protocol/pair/pair_v1.c | 4 | ||||
| -rw-r--r-- | src/protocol/pipeline/pull.c | 4 | ||||
| -rw-r--r-- | src/protocol/pipeline/push.c | 6 | ||||
| -rw-r--r-- | src/protocol/pubsub/pub.c | 6 | ||||
| -rw-r--r-- | src/protocol/pubsub/sub.c | 4 | ||||
| -rw-r--r-- | src/protocol/reqrep/rep.c | 4 | ||||
| -rw-r--r-- | src/protocol/reqrep/req.c | 6 | ||||
| -rw-r--r-- | src/protocol/survey/respond.c | 4 | ||||
| -rw-r--r-- | src/protocol/survey/survey.c | 4 | ||||
| -rw-r--r-- | tests/bus.c | 5 | ||||
| -rw-r--r-- | tests/pipeline.c | 10 | ||||
| -rw-r--r-- | tests/pubsub.c | 10 | ||||
| -rw-r--r-- | tests/reqrep.c | 10 | ||||
| -rw-r--r-- | tests/sock.c | 5 | ||||
| -rw-r--r-- | tests/survey.c | 10 |
24 files changed, 64 insertions, 177 deletions
diff --git a/docs/libnng.adoc b/docs/libnng.adoc index 108cbad6..da38cb42 100644 --- a/docs/libnng.adoc +++ b/docs/libnng.adoc @@ -52,8 +52,6 @@ The following functions operate on sockets. |<<nng_dial.adoc#,nng_dial(3)>>|create and start a dialer |<<nng_getopt.adoc#,nng_getopt(3)>>|get a socket option |<<nng_listen.adoc#,nng_listen(3)>>|create and start a listener -|<<nng_protocol.adoc#,nng_protocol(3)>>|return the protocol number for socket -|<<nng_peer.adoc#,nng_peer(3)>>|return peer protocol number for socket |<<nng_recv.adoc#,nng_recv(3)>>|receive data |<<nng_send.adoc#,nng_send(3)>>|send data |<<nng_setopt.adoc#,nng_setopt(3)>>|set a socket option diff --git a/docs/nng_pub.adoc b/docs/nng_pub.adoc index a0a603b8..d4db45ae 100644 --- a/docs/nng_pub.adoc +++ b/docs/nng_pub.adoc @@ -23,9 +23,6 @@ SYNOPSIS ---------- #include <nng/protocol/pubsub/pubsub.h> -#define NNG_PROTO_PUB_V0 32 -#define NNG_PROTO_PUB NNG_PROTO_PUB_V0 - int nng_pub_open(nng_socket *s); int nng_pub0_open(nng_socket *s); diff --git a/docs/nng_sub.adoc b/docs/nng_sub.adoc index c7037634..0b409904 100644 --- a/docs/nng_sub.adoc +++ b/docs/nng_sub.adoc @@ -23,9 +23,6 @@ SYNOPSIS ---------- #include <nng/protocol/pubsub/pubsub.h> -#define NNG_PROTO_SUB_V0 33 -#define NNG_PROTO_SUB NNG_PROTO_SUB_V0 - int nng_sub_open(nng_socket *s); int nng_sub0_open(nng_socket *s); diff --git a/src/core/protocol.h b/src/core/protocol.h index 253452d8..5db259f0 100644 --- a/src/core/protocol.h +++ b/src/core/protocol.h @@ -138,6 +138,31 @@ struct nni_proto { // not been initialized yet, this routine will do so. extern int nni_proto_open(nng_socket *, const nni_proto *); +// Protocol numbers. These are to be used with nng_socket_create(). +// These values are used on the wire, so must not be changed. The major +// number of the protocol is shifted left by 4 bits, and a subprotocol is +// assigned in the lower 4 bits. +// +// There are gaps in the list, which are obsolete or unsupported protocols. +// Protocol numbers are never more than 16 bits. Also, there will never be +// a valid protocol numbered 0 (NNG_PROTO_NONE). +#define NNI_PROTO(major, minor) (((major) *16) + (minor)) +enum nng_proto_enum { + NNI_PROTO_NONE = NNI_PROTO(0, 0), + NNI_PROTO_PAIR_V0 = NNI_PROTO(1, 0), + NNI_PROTO_PAIR_V1 = NNI_PROTO(1, 1), + NNI_PROTO_PUB_V0 = NNI_PROTO(2, 0), + NNI_PROTO_SUB_V0 = NNI_PROTO(2, 1), + NNI_PROTO_REQ_V0 = NNI_PROTO(3, 0), + NNI_PROTO_REP_V0 = NNI_PROTO(3, 1), + NNI_PROTO_PUSH_V0 = NNI_PROTO(5, 0), + NNI_PROTO_PULL_V0 = NNI_PROTO(5, 1), + NNI_PROTO_SURVEYOR_V0 = NNI_PROTO(6, 2), + NNI_PROTO_RESPONDENT_V0 = NNI_PROTO(6, 3), + NNI_PROTO_BUS_V0 = NNI_PROTO(7, 0), + NNI_PROTO_STAR_V0 = NNI_PROTO(100, 0), +}; + extern int nni_proto_sys_init(void); extern void nni_proto_sys_fini(void); @@ -51,36 +51,6 @@ nng_closeall(void) nni_sock_closeall(); } -uint16_t -nng_protocol(nng_socket sid) -{ - int rv; - uint16_t pnum; - nni_sock *sock; - - if ((rv = nni_sock_find(&sock, sid)) != 0) { - return (rv); - } - pnum = nni_sock_proto(sock); - nni_sock_rele(sock); - return (pnum); -} - -uint16_t -nng_peer(nng_socket sid) -{ - int rv; - uint16_t pnum; - nni_sock *sock; - - if ((rv = nni_sock_find(&sock, sid)) != 0) { - return (rv); - } - pnum = nni_sock_peer(sock); - nni_sock_rele(sock); - return (pnum); -} - void * nng_alloc(size_t sz) { @@ -77,12 +77,6 @@ NNG_DECL int nng_close(nng_socket); // a library; it will affect all sockets. NNG_DECL void nng_closeall(void); -// nng_protocol returns the protocol number of the socket. -NNG_DECL uint16_t nng_protocol(nng_socket); - -// nng_peer returns the protocol number for the socket's peer. -NNG_DECL uint16_t nng_peer(nng_socket); - // nng_setopt sets an option for a specific socket. NNG_DECL int nng_setopt(nng_socket, const char *, const void *, size_t); NNG_DECL int nng_setopt_int(nng_socket, const char *, int); @@ -326,13 +320,6 @@ NNG_DECL void nng_msg_set_pipe(nng_msg *, nng_pipe); NNG_DECL nng_pipe nng_msg_get_pipe(const nng_msg *); NNG_DECL int nng_msg_getopt(nng_msg *, int, void *, size_t *); -// Lookup an option by name. This returns either the option value, -// or -1 if the option name is unknown. -NNG_DECL int nng_option_lookup(const char *); - -// Lookup an option name by id. Returns NULL if not known. -NNG_DECL const char *nng_option_name(int); - // Pipe API. Generally pipes are only "observable" to applications, but // we do permit an application to close a pipe. This can be useful, for // example during a connection notification, to disconnect a pipe that @@ -350,44 +337,6 @@ enum nng_flag_enum { NNG_FLAG_NONBLOCK = 2, // Non-blocking operations. }; -// Protocol numbers. These are to be used with nng_socket_create(). -// These values are used on the wire, so must not be changed. The major -// number of the protocol is shifted left by 4 bits, and a subprotocol is -// assigned in the lower 4 bits. -// -// There are gaps in the list, which are obsolete or unsupported protocols. -// Protocol numbers are never more than 16 bits. Also, there will never be -// a valid protocol numbered 0 (NNG_PROTO_NONE). -#define NNG_PROTO(major, minor) (((major) *16) + (minor)) -enum nng_proto_enum { - NNG_PROTO_NONE = NNG_PROTO(0, 0), - NNG_PROTO_PAIR_V0 = NNG_PROTO(1, 0), - NNG_PROTO_PAIR_V1 = NNG_PROTO(1, 1), - NNG_PROTO_PUB_V0 = NNG_PROTO(2, 0), - NNG_PROTO_SUB_V0 = NNG_PROTO(2, 1), - NNG_PROTO_REQ_V0 = NNG_PROTO(3, 0), - NNG_PROTO_REP_V0 = NNG_PROTO(3, 1), - NNG_PROTO_PUSH_V0 = NNG_PROTO(5, 0), - NNG_PROTO_PULL_V0 = NNG_PROTO(5, 1), - NNG_PROTO_SURVEYOR_V0 = NNG_PROTO(6, 2), - NNG_PROTO_RESPONDENT_V0 = NNG_PROTO(6, 3), - NNG_PROTO_BUS_V0 = NNG_PROTO(7, 0), - NNG_PROTO_STAR_V0 = NNG_PROTO(100, 0), - - // "Default" names. Use the explicit version to guarantee - // backwards compatibility. - NNG_PROTO_BUS = NNG_PROTO_BUS_V0, - NNG_PROTO_PAIR = NNG_PROTO_PAIR_V1, - NNG_PROTO_SUB = NNG_PROTO_SUB_V0, - NNG_PROTO_PUB = NNG_PROTO_PUB_V0, - NNG_PROTO_REQ = NNG_PROTO_REQ_V0, - NNG_PROTO_REP = NNG_PROTO_REP_V0, - NNG_PROTO_PUSH = NNG_PROTO_PUSH_V0, - NNG_PROTO_PULL = NNG_PROTO_PULL_V0, - NNG_PROTO_SURVEYOR = NNG_PROTO_SURVEYOR_V0, - NNG_PROTO_RESPONDENT = NNG_PROTO_RESPONDENT_V0, -}; - // Builtin protocol socket constructors. NNG_DECL int nng_bus0_open(nng_socket *); NNG_DECL int nng_pair0_open(nng_socket *); diff --git a/src/nng_compat.c b/src/nng_compat.c index e9a3e3a3..f8a7ceb0 100644 --- a/src/nng_compat.c +++ b/src/nng_compat.c @@ -92,18 +92,19 @@ static const struct { uint16_t p_id; int (*p_open)(nng_socket *); } nn_protocols[] = { - { NNG_PROTO_BUS_V0, nng_bus0_open }, - { NNG_PROTO_PAIR_V0, nng_pair0_open }, - { NNG_PROTO_PAIR_V0, nng_pair1_open }, - { NNG_PROTO_PUSH_V0, nng_push0_open }, - { NNG_PROTO_PULL_V0, nng_pull0_open }, - { NNG_PROTO_PUB_V0, nng_pub0_open }, - { NNG_PROTO_SUB_V0, nng_sub0_open }, - { NNG_PROTO_REQ_V0, nng_req0_open }, - { NNG_PROTO_REP_V0, nng_rep0_open }, - { NNG_PROTO_SURVEYOR_V0, nng_surveyor0_open }, - { NNG_PROTO_RESPONDENT_V0, nng_respondent0_open }, - { NNG_PROTO_NONE, NULL }, + // clang-format off + { NN_BUS, nng_bus0_open }, + { NN_PAIR, nng_pair0_open }, + { NN_PUSH, nng_push0_open }, + { NN_PULL, nng_pull0_open }, + { NN_PUB, nng_pub0_open }, + { NN_SUB, nng_sub0_open }, + { NN_REQ, nng_req0_open }, + { NN_REP, nng_rep0_open }, + { NN_SURVEYOR, nng_surveyor0_open }, + { NN_RESPONDENT, nng_respondent0_open }, + { 0, NULL }, + // clang-format on }; int @@ -118,7 +119,7 @@ nn_socket(int domain, int protocol) return (-1); } - for (i = 0; nn_protocols[i].p_id != NNG_PROTO_NONE; i++) { + for (i = 0; nn_protocols[i].p_id != 0; i++) { if (nn_protocols[i].p_id == protocol) { break; } diff --git a/src/protocol/bus/bus.c b/src/protocol/bus/bus.c index 07f91602..6ec0066b 100644 --- a/src/protocol/bus/bus.c +++ b/src/protocol/bus/bus.c @@ -387,8 +387,8 @@ static nni_proto_sock_ops bus_sock_ops = { static nni_proto bus_proto = { .proto_version = NNI_PROTOCOL_VERSION, - .proto_self = { NNG_PROTO_BUS_V0, "bus" }, - .proto_peer = { NNG_PROTO_BUS_V0, "bus" }, + .proto_self = { NNI_PROTO_BUS_V0, "bus" }, + .proto_peer = { NNI_PROTO_BUS_V0, "bus" }, .proto_flags = NNI_PROTO_FLAG_SNDRCV, .proto_sock_ops = &bus_sock_ops, .proto_pipe_ops = &bus_pipe_ops, diff --git a/src/protocol/pair/pair_v0.c b/src/protocol/pair/pair_v0.c index 29f3b59c..93cd1497 100644 --- a/src/protocol/pair/pair_v0.c +++ b/src/protocol/pair/pair_v0.c @@ -287,8 +287,8 @@ static nni_proto_sock_ops pair0_sock_ops = { // Legacy protocol (v0) static nni_proto pair0_proto = { .proto_version = NNI_PROTOCOL_VERSION, - .proto_self = { NNG_PROTO_PAIR_V0, "pair" }, - .proto_peer = { NNG_PROTO_PAIR_V0, "pair" }, + .proto_self = { NNI_PROTO_PAIR_V0, "pair" }, + .proto_peer = { NNI_PROTO_PAIR_V0, "pair" }, .proto_flags = NNI_PROTO_FLAG_SNDRCV, .proto_sock_ops = &pair0_sock_ops, .proto_pipe_ops = &pair0_pipe_ops, diff --git a/src/protocol/pair/pair_v1.c b/src/protocol/pair/pair_v1.c index 86ee97eb..e14d06d5 100644 --- a/src/protocol/pair/pair_v1.c +++ b/src/protocol/pair/pair_v1.c @@ -499,8 +499,8 @@ static nni_proto_sock_ops pair1_sock_ops = { static nni_proto pair1_proto = { .proto_version = NNI_PROTOCOL_VERSION, - .proto_self = { NNG_PROTO_PAIR_V1, "pair1" }, - .proto_peer = { NNG_PROTO_PAIR_V1, "pair1" }, + .proto_self = { NNI_PROTO_PAIR_V1, "pair1" }, + .proto_peer = { NNI_PROTO_PAIR_V1, "pair1" }, .proto_flags = NNI_PROTO_FLAG_SNDRCV, .proto_sock_ops = &pair1_sock_ops, .proto_pipe_ops = &pair1_pipe_ops, diff --git a/src/protocol/pipeline/pull.c b/src/protocol/pipeline/pull.c index 267352c5..9685f0a1 100644 --- a/src/protocol/pipeline/pull.c +++ b/src/protocol/pipeline/pull.c @@ -228,8 +228,8 @@ static nni_proto_sock_ops pull_sock_ops = { static nni_proto pull_proto = { .proto_version = NNI_PROTOCOL_VERSION, - .proto_self = { NNG_PROTO_PULL_V0, "pull" }, - .proto_peer = { NNG_PROTO_PUSH_V0, "push" }, + .proto_self = { NNI_PROTO_PULL_V0, "pull" }, + .proto_peer = { NNI_PROTO_PUSH_V0, "push" }, .proto_flags = NNI_PROTO_FLAG_RCV, .proto_pipe_ops = &pull_pipe_ops, .proto_sock_ops = &pull_sock_ops, diff --git a/src/protocol/pipeline/push.c b/src/protocol/pipeline/push.c index 995ac56d..9ff74558 100644 --- a/src/protocol/pipeline/push.c +++ b/src/protocol/pipeline/push.c @@ -114,7 +114,7 @@ push_pipe_start(void *arg) push_pipe *p = arg; push_sock *s = p->push; - if (nni_pipe_peer(p->pipe) != NNG_PROTO_PULL) { + if (nni_pipe_peer(p->pipe) != NNI_PROTO_PULL_V0) { return (NNG_EPROTO); } @@ -245,8 +245,8 @@ static nni_proto_sock_ops push_sock_ops = { static nni_proto push_proto = { .proto_version = NNI_PROTOCOL_VERSION, - .proto_self = { NNG_PROTO_PUSH_V0, "push" }, - .proto_peer = { NNG_PROTO_PULL_V0, "pull" }, + .proto_self = { NNI_PROTO_PUSH_V0, "push" }, + .proto_peer = { NNI_PROTO_PULL_V0, "pull" }, .proto_flags = NNI_PROTO_FLAG_SND, .proto_pipe_ops = &push_pipe_ops, .proto_sock_ops = &push_sock_ops, diff --git a/src/protocol/pubsub/pub.c b/src/protocol/pubsub/pub.c index 29863322..9e5cd67f 100644 --- a/src/protocol/pubsub/pub.c +++ b/src/protocol/pubsub/pub.c @@ -142,7 +142,7 @@ pub_pipe_start(void *arg) pub_pipe *p = arg; pub_sock *s = p->pub; - if (nni_pipe_peer(p->pipe) != NNG_PROTO_SUB) { + if (nni_pipe_peer(p->pipe) != NNI_PROTO_SUB_V0) { return (NNG_EPROTO); } nni_mtx_lock(&s->mtx); @@ -321,8 +321,8 @@ static nni_proto_sock_ops pub_sock_ops = { static nni_proto pub_proto = { .proto_version = NNI_PROTOCOL_VERSION, - .proto_self = { NNG_PROTO_PUB_V0, "pub" }, - .proto_peer = { NNG_PROTO_SUB_V0, "sub" }, + .proto_self = { NNI_PROTO_PUB_V0, "pub" }, + .proto_peer = { NNI_PROTO_SUB_V0, "sub" }, .proto_flags = NNI_PROTO_FLAG_SND, .proto_sock_ops = &pub_sock_ops, .proto_pipe_ops = &pub_pipe_ops, diff --git a/src/protocol/pubsub/sub.c b/src/protocol/pubsub/sub.c index d87b42ec..555d528e 100644 --- a/src/protocol/pubsub/sub.c +++ b/src/protocol/pubsub/sub.c @@ -384,8 +384,8 @@ static nni_proto_sock_ops sub_sock_ops = { static nni_proto sub_proto = { .proto_version = NNI_PROTOCOL_VERSION, - .proto_self = { NNG_PROTO_SUB_V0, "sub" }, - .proto_peer = { NNG_PROTO_PUB_V0, "pub" }, + .proto_self = { NNI_PROTO_SUB_V0, "sub" }, + .proto_peer = { NNI_PROTO_PUB_V0, "pub" }, .proto_flags = NNI_PROTO_FLAG_RCV, .proto_sock_ops = &sub_sock_ops, .proto_pipe_ops = &sub_pipe_ops, diff --git a/src/protocol/reqrep/rep.c b/src/protocol/reqrep/rep.c index 5d924e32..100e739d 100644 --- a/src/protocol/reqrep/rep.c +++ b/src/protocol/reqrep/rep.c @@ -492,8 +492,8 @@ static nni_proto_sock_ops rep_sock_ops = { static nni_proto nni_rep_proto = { .proto_version = NNI_PROTOCOL_VERSION, - .proto_self = { NNG_PROTO_REP_V0, "rep" }, - .proto_peer = { NNG_PROTO_REQ_V0, "req" }, + .proto_self = { NNI_PROTO_REP_V0, "rep" }, + .proto_peer = { NNI_PROTO_REQ_V0, "req" }, .proto_flags = NNI_PROTO_FLAG_SNDRCV, .proto_sock_ops = &rep_sock_ops, .proto_pipe_ops = &rep_pipe_ops, diff --git a/src/protocol/reqrep/req.c b/src/protocol/reqrep/req.c index 1ab49f3e..bead1ec4 100644 --- a/src/protocol/reqrep/req.c +++ b/src/protocol/reqrep/req.c @@ -185,7 +185,7 @@ req_pipe_start(void *arg) req_pipe *p = arg; req_sock *s = p->req; - if (nni_pipe_peer(p->pipe) != NNG_PROTO_REP) { + if (nni_pipe_peer(p->pipe) != NNI_PROTO_REP_V0) { return (NNG_EPROTO); } @@ -654,8 +654,8 @@ static nni_proto_sock_ops req_sock_ops = { static nni_proto req_proto = { .proto_version = NNI_PROTOCOL_VERSION, - .proto_self = { NNG_PROTO_REQ_V0, "req" }, - .proto_peer = { NNG_PROTO_REP_V0, "rep" }, + .proto_self = { NNI_PROTO_REQ_V0, "req" }, + .proto_peer = { NNI_PROTO_REP_V0, "rep" }, .proto_flags = NNI_PROTO_FLAG_SNDRCV, .proto_sock_ops = &req_sock_ops, .proto_pipe_ops = &req_pipe_ops, diff --git a/src/protocol/survey/respond.c b/src/protocol/survey/respond.c index dbce0751..94730be6 100644 --- a/src/protocol/survey/respond.c +++ b/src/protocol/survey/respond.c @@ -486,8 +486,8 @@ static nni_proto_sock_ops resp_sock_ops = { static nni_proto resp_proto = { .proto_version = NNI_PROTOCOL_VERSION, - .proto_self = { NNG_PROTO_RESPONDENT_V0, "respondent" }, - .proto_peer = { NNG_PROTO_SURVEYOR_V0, "surveyor" }, + .proto_self = { NNI_PROTO_RESPONDENT_V0, "respondent" }, + .proto_peer = { NNI_PROTO_SURVEYOR_V0, "surveyor" }, .proto_flags = NNI_PROTO_FLAG_SNDRCV, .proto_sock_ops = &resp_sock_ops, .proto_pipe_ops = &resp_pipe_ops, diff --git a/src/protocol/survey/survey.c b/src/protocol/survey/survey.c index f44cd63a..9dcd6664 100644 --- a/src/protocol/survey/survey.c +++ b/src/protocol/survey/survey.c @@ -461,8 +461,8 @@ static nni_proto_sock_ops surv_sock_ops = { static nni_proto surv_proto = { .proto_version = NNI_PROTOCOL_VERSION, - .proto_self = { NNG_PROTO_SURVEYOR_V0, "surveyor" }, - .proto_peer = { NNG_PROTO_RESPONDENT_V0, "respondent" }, + .proto_self = { NNI_PROTO_SURVEYOR_V0, "surveyor" }, + .proto_peer = { NNI_PROTO_RESPONDENT_V0, "respondent" }, .proto_flags = NNI_PROTO_FLAG_SNDRCV, .proto_sock_ops = &surv_sock_ops, .proto_pipe_ops = &surv_pipe_ops, diff --git a/tests/bus.c b/tests/bus.c index dd36d5a5..8283bf21 100644 --- a/tests/bus.c +++ b/tests/bus.c @@ -29,11 +29,6 @@ TestMain("BUS pattern", { So(nng_bus_open(&bus) == 0); Reset({ nng_close(bus); }); - - Convey("Protocols match", { - So(nng_protocol(bus) == NNG_PROTO_BUS); - So(nng_peer(bus) == NNG_PROTO_BUS); - }); }); Convey("We can create a linked BUS topology", { diff --git a/tests/pipeline.c b/tests/pipeline.c index 31f02798..67be57c6 100644 --- a/tests/pipeline.c +++ b/tests/pipeline.c @@ -28,11 +28,6 @@ TestMain("PIPELINE (PUSH/PULL) pattern", { Reset({ nng_close(push); }); - Convey("Protocols match", { - So(nng_protocol(push) == NNG_PROTO_PUSH); - So(nng_peer(push) == NNG_PROTO_PULL); - }); - Convey("Recv fails", { nng_msg *msg; So(nng_recvmsg(push, &msg, 0) == NNG_ENOTSUP); @@ -45,11 +40,6 @@ TestMain("PIPELINE (PUSH/PULL) pattern", { Reset({ nng_close(pull); }); - Convey("Protocols match", { - So(nng_protocol(pull) == NNG_PROTO_PULL); - So(nng_peer(pull) == NNG_PROTO_PUSH); - }); - Convey("Send fails", { nng_msg *msg; So(nng_msg_alloc(&msg, 0) == 0); diff --git a/tests/pubsub.c b/tests/pubsub.c index e79c3f1d..a8209a7d 100644 --- a/tests/pubsub.c +++ b/tests/pubsub.c @@ -30,11 +30,6 @@ TestMain("PUB/SUB pattern", { Reset({ nng_close(pub); }); - Convey("Protocols match", { - So(nng_protocol(pub) == NNG_PROTO_PUB); - So(nng_peer(pub) == NNG_PROTO_SUB); - }); - Convey("Recv fails", { nng_msg *msg; So(nng_recvmsg(pub, &msg, 0) == NNG_ENOTSUP); @@ -47,11 +42,6 @@ TestMain("PUB/SUB pattern", { Reset({ nng_close(sub); }); - Convey("Protocols match", { - So(nng_protocol(sub) == NNG_PROTO_SUB); - So(nng_peer(sub) == NNG_PROTO_PUB); - }); - Convey("Send fails", { nng_msg *msg; So(nng_msg_alloc(&msg, 0) == 0); diff --git a/tests/reqrep.c b/tests/reqrep.c index ada21875..df0621bc 100644 --- a/tests/reqrep.c +++ b/tests/reqrep.c @@ -23,11 +23,6 @@ TestMain("REQ/REP pattern", { Reset({ nng_close(req); }); - Convey("Protocols match", { - So(nng_protocol(req) == NNG_PROTO_REQ); - So(nng_peer(req) == NNG_PROTO_REP); - }); - Convey("Resend time option id works", { // Set timeout. @@ -51,11 +46,6 @@ TestMain("REQ/REP pattern", { Reset({ nng_close(rep); }); - Convey("Protocols match", { - So(nng_protocol(rep) == NNG_PROTO_REP); - So(nng_peer(rep) == NNG_PROTO_REQ); - }); - Convey("Send with no recv fails", { nng_msg *msg; rv = nng_msg_alloc(&msg, 0); diff --git a/tests/sock.c b/tests/sock.c index cbe3d012..1c277b46 100644 --- a/tests/sock.c +++ b/tests/sock.c @@ -32,11 +32,6 @@ TestMain("Socket Operations", { Reset({ nng_close(s1); }); - Convey("It's type & peer are still PAIR", { - So(nng_protocol(s1) == NNG_PROTO_PAIR); - So(nng_peer(s1) == NNG_PROTO_PAIR); - }); - Convey("Recv with no pipes times out correctly", { nng_msg * msg = NULL; nng_duration to = 100; diff --git a/tests/survey.c b/tests/survey.c index d73ae987..f4fab009 100644 --- a/tests/survey.c +++ b/tests/survey.c @@ -30,11 +30,6 @@ TestMain("SURVEY pattern", { Reset({ nng_close(surv); }); - Convey("Protocols match", { - So(nng_protocol(surv) == NNG_PROTO_SURVEYOR); - So(nng_peer(surv) == NNG_PROTO_RESPONDENT); - }); - Convey("Recv with no survey fails", { nng_msg *msg; So(nng_recvmsg(surv, &msg, 0) == NNG_ESTATE); @@ -57,11 +52,6 @@ TestMain("SURVEY pattern", { Reset({ nng_close(resp); }); - Convey("Protocols match", { - So(nng_protocol(resp) == NNG_PROTO_RESPONDENT); - So(nng_peer(resp) == NNG_PROTO_SURVEYOR); - }); - Convey("Send fails with no survey", { nng_msg *msg; So(nng_msg_alloc(&msg, 0) == 0); |
