aboutsummaryrefslogtreecommitdiff
path: root/src/sp/protocol/pair1/pair1_test.c
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2024-11-02 23:16:22 -0700
committerGarrett D'Amore <garrett@damore.org>2024-11-02 23:16:22 -0700
commit8bac5ccdf1de7334311459b9e2666e74a2c16c15 (patch)
tree169ce8229a1a0eb6e810685a9923be1c2bf644a6 /src/sp/protocol/pair1/pair1_test.c
parentd3622c0f6153ce0eccaad9c986d46b07cec91b5d (diff)
downloadnng-8bac5ccdf1de7334311459b9e2666e74a2c16c15.tar.gz
nng-8bac5ccdf1de7334311459b9e2666e74a2c16c15.tar.bz2
nng-8bac5ccdf1de7334311459b9e2666e74a2c16c15.zip
Replace `NNG_OPT_PROTO`, `NNG_OPT_PROTONAME`, and friends with functions.
Socket options were a little awkward, and these are core properties of the socket. Few if any applications need these. This also avoids some dynamic allocations.
Diffstat (limited to 'src/sp/protocol/pair1/pair1_test.c')
-rw-r--r--src/sp/protocol/pair1/pair1_test.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/sp/protocol/pair1/pair1_test.c b/src/sp/protocol/pair1/pair1_test.c
index b6bbee1a..e0e6b3b2 100644
--- a/src/sp/protocol/pair1/pair1_test.c
+++ b/src/sp/protocol/pair1/pair1_test.c
@@ -21,21 +21,19 @@
static void
test_mono_identity(void)
{
- nng_socket s;
- int p;
- char *n;
+ nng_socket s;
+ uint16_t p;
+ const char *n;
NUTS_PASS(nng_pair1_open(&s));
- NUTS_PASS(nng_socket_get_int(s, NNG_OPT_PROTO, &p));
+ NUTS_PASS(nng_socket_proto_id(s, &p));
NUTS_TRUE(p == NUTS_PROTO(1u, 1u)); // 32
- NUTS_PASS(nng_socket_get_int(s, NNG_OPT_PEER, &p));
+ NUTS_PASS(nng_socket_peer_id(s, &p));
NUTS_TRUE(p == NUTS_PROTO(1u, 1u)); // 33
- NUTS_PASS(nng_socket_get_string(s, NNG_OPT_PROTONAME, &n));
+ NUTS_PASS(nng_socket_proto_name(s, &n));
NUTS_MATCH(n, "pair1");
- nng_strfree(n);
- NUTS_PASS(nng_socket_get_string(s, NNG_OPT_PEERNAME, &n));
+ NUTS_PASS(nng_socket_peer_name(s, &n));
NUTS_MATCH(n, "pair1");
- nng_strfree(n);
NUTS_CLOSE(s);
}