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. --- include/nng/nng.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/nng/nng.h b/include/nng/nng.h index ac82954a..d0e47829 100644 --- a/include/nng/nng.h +++ b/include/nng/nng.h @@ -264,6 +264,13 @@ NNG_DECL int nng_socket_get_ms(nng_socket, const char *, nng_duration *); NNG_DECL int nng_socket_get_recv_poll_fd(nng_socket id, int *fdp); NNG_DECL int nng_socket_get_send_poll_fd(nng_socket id, int *fdp); +// These functions are used on a socket to get information about it's +// identity, and the identity of the peer. Few applications need these. +NNG_DECL int nng_socket_proto_id(nng_socket id, uint16_t *idp); +NNG_DECL int nng_socket_peer_id(nng_socket id, uint16_t *idp); +NNG_DECL int nng_socket_proto_name(nng_socket id, const char **namep); +NNG_DECL int nng_socket_peer_name(nng_socket id, const char **namep); + // Utility function for getting a printable form of the socket address // for display in logs, etc. It is not intended to be parsed, and the // display format may change without notice. Generally you should alow @@ -723,10 +730,6 @@ NNG_DECL nng_listener nng_pipe_listener(nng_pipe); // Options. #define NNG_OPT_SOCKNAME "socket-name" #define NNG_OPT_RAW "raw" -#define NNG_OPT_PROTO "protocol" -#define NNG_OPT_PROTONAME "protocol-name" -#define NNG_OPT_PEER "peer" -#define NNG_OPT_PEERNAME "peer-name" #define NNG_OPT_RECVBUF "recv-buffer" #define NNG_OPT_SENDBUF "send-buffer" #define NNG_OPT_RECVTIMEO "recv-timeout" -- cgit v1.2.3-70-g09d2