aboutsummaryrefslogtreecommitdiff
path: root/include
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 /include
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 'include')
-rw-r--r--include/nng/nng.h11
1 files changed, 7 insertions, 4 deletions
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"