From 8bac5ccdf1de7334311459b9e2666e74a2c16c15 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Sat, 2 Nov 2024 23:16:22 -0700 Subject: 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. --- src/sp/protocol/pair0/pair0_test.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'src/sp/protocol/pair0') diff --git a/src/sp/protocol/pair0/pair0_test.c b/src/sp/protocol/pair0/pair0_test.c index e2196479..0cdfb789 100644 --- a/src/sp/protocol/pair0/pair0_test.c +++ b/src/sp/protocol/pair0/pair0_test.c @@ -21,21 +21,19 @@ static void test_identity(void) { - nng_socket s; - int p; - char *n; + nng_socket s; + uint16_t p; + const char *n; NUTS_PASS(nng_pair0_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, 0u)); // 16 - 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, 0u)); // 17 - NUTS_PASS(nng_socket_get_string(s, NNG_OPT_PROTONAME, &n)); + NUTS_PASS(nng_socket_proto_name(s, &n)); NUTS_MATCH(n, "pair"); - 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, "pair"); - nng_strfree(n); NUTS_CLOSE(s); } -- cgit v1.2.3-70-g09d2