From 0d23af92531b7c0dd6d7b74c73c1a8c4811c7d13 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Wed, 1 Jan 2025 12:44:02 -0800 Subject: protocols: move content from the protocols to nng.h This should simplify things for developers. Just one header to include in most cases now. --- src/sp/protocol/reqrep0/rep_test.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'src/sp/protocol/reqrep0/rep_test.c') diff --git a/src/sp/protocol/reqrep0/rep_test.c b/src/sp/protocol/reqrep0/rep_test.c index 2a07ecbc..29c5ee4c 100644 --- a/src/sp/protocol/reqrep0/rep_test.c +++ b/src/sp/protocol/reqrep0/rep_test.c @@ -1,5 +1,5 @@ // -// Copyright 2024 Staysail Systems, Inc. +// Copyright 2025 Staysail Systems, Inc. // // This software is supplied under the terms of the MIT License, a // copy of which should be located in the distribution where this @@ -10,6 +10,11 @@ #include "nng/nng.h" #include +#define REP0_SELF 0x31 +#define REP0_PEER 0x30 +#define REP0_SELF_NAME "rep" +#define REP0_PEER_NAME "req" + static void test_rep_identity(void) { @@ -24,10 +29,10 @@ test_rep_identity(void) NUTS_PASS(nng_socket_proto_name(s, &n1)); NUTS_PASS(nng_socket_peer_name(s, &n2)); NUTS_CLOSE(s); - NUTS_TRUE(p1 == NNG_REP0_SELF); - NUTS_TRUE(p2 == NNG_REP0_PEER); - NUTS_MATCH(n1, NNG_REP0_SELF_NAME); - NUTS_MATCH(n2, NNG_REP0_PEER_NAME); + NUTS_TRUE(p1 == REP0_SELF); + NUTS_TRUE(p2 == REP0_PEER); + NUTS_MATCH(n1, REP0_SELF_NAME); + NUTS_MATCH(n2, REP0_PEER_NAME); } void @@ -179,8 +184,8 @@ test_rep_huge_send(void) nng_msg *d; nng_aio *aio; - NUTS_PASS(nng_rep_open(&rep)); - NUTS_PASS(nng_req_open(&req)); + NUTS_PASS(nng_rep0_open(&rep)); + NUTS_PASS(nng_req0_open(&req)); NUTS_PASS(nng_socket_set_ms(rep, NNG_OPT_RECVTIMEO, 1000)); NUTS_PASS(nng_socket_set_ms(req, NNG_OPT_RECVTIMEO, 1000)); NUTS_PASS(nng_socket_set_ms(rep, NNG_OPT_SENDTIMEO, 1000)); @@ -234,8 +239,8 @@ test_rep_huge_send_socket(void) nng_msg *d; nng_aio *aio; - NUTS_PASS(nng_rep_open(&rep)); - NUTS_PASS(nng_req_open(&req)); + NUTS_PASS(nng_rep0_open(&rep)); + NUTS_PASS(nng_req0_open(&req)); NUTS_PASS(nng_socket_set_ms(rep, NNG_OPT_RECVTIMEO, 1000)); NUTS_PASS(nng_socket_set_ms(req, NNG_OPT_RECVTIMEO, 1000)); NUTS_PASS(nng_socket_set_ms(rep, NNG_OPT_SENDTIMEO, 1000)); -- cgit v1.2.3-70-g09d2