aboutsummaryrefslogtreecommitdiff
path: root/docs
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 /docs
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 'docs')
-rw-r--r--docs/ref/migrate/nanomsg.md36
-rw-r--r--docs/ref/migrate/nng1.md9
2 files changed, 27 insertions, 18 deletions
diff --git a/docs/ref/migrate/nanomsg.md b/docs/ref/migrate/nanomsg.md
index 8094c942..695f771b 100644
--- a/docs/ref/migrate/nanomsg.md
+++ b/docs/ref/migrate/nanomsg.md
@@ -66,24 +66,24 @@ NNG approach to messages. Likewise there is no `struct nn_cmsghdr` equivalent.
The following options are changed.
-| Nanomsg Option | NNG Eqvaivalent | Notes |
-| ---------------------- | ------------------------------ | ------------------------------------------------------- |
-| `NN_LINGER` | None | NNG does not support tuning this. |
-| `NN_SNDBUF` | `NNG_OPT_SENDBUF` | NNG value is given in messages, not bytes. |
-| `NN_RCVBUF` | `NNG_OPT_RECVBUF` | NNG value is given in messages, not bytes. |
-| `NN_SNDTIMEO` | `NNG_OPT_SENDTIMEO` |
-| `NN_RCVTIMEO` | `NNG_OPT_RECVTIMEO` |
-| `NN_RECONNECT_IVL` | `NNG_OPT_RECONNMINT` |
-| `NN_RECONNECT_IVL_MAX` | `NNG_OPT_RECONNMAXT` |
-| `NN_SNDPRIO` | None | Not supported in NNG yet. |
-| `NN_RCVPRIO` | None | Not supported in NNG yet. |
-| `NN_RCVFD` | `+nng_socket_get_recv_poll_fd` | No longer an option, use a function call. |
-| `NN_SNDFD` | `+nng_socket_get_send_poll_fd` | No longer an option, use a function call. |
-| `NN_DOMAIN` | None | NNG options are not divided by domain or protocol. |
-| `NN_PROTOCOL` | `NNG_OPT_PROTO` | See also `NNG_OPT_PROTONAME`. |
-| `NN_IPV4ONLY` | None | Use URL such as `tcp4://` to obtain this functionality. |
-| `NN_SOCKET_NAME` | `NNG_OPT_SOCKNAME` |
-| `NN_MAXTTL` | `NNG_OPT_MAXTTL` |
+| Nanomsg Option | NNG Eqvaivalent | Notes |
+| ---------------------- | ----------------------------- | ------------------------------------------------------- |
+| `NN_LINGER` | None | NNG does not support tuning this. |
+| `NN_SNDBUF` | `NNG_OPT_SENDBUF` | NNG value is given in messages, not bytes. |
+| `NN_RCVBUF` | `NNG_OPT_RECVBUF` | NNG value is given in messages, not bytes. |
+| `NN_SNDTIMEO` | `NNG_OPT_SENDTIMEO` |
+| `NN_RCVTIMEO` | `NNG_OPT_RECVTIMEO` |
+| `NN_RECONNECT_IVL` | `NNG_OPT_RECONNMINT` |
+| `NN_RECONNECT_IVL_MAX` | `NNG_OPT_RECONNMAXT` |
+| `NN_SNDPRIO` | None | Not supported in NNG yet. |
+| `NN_RCVPRIO` | None | Not supported in NNG yet. |
+| `NN_RCVFD` | `nng_socket_get_recv_poll_fd` | No longer an option, use a function call. |
+| `NN_SNDFD` | `nng_socket_get_send_poll_fd` | No longer an option, use a function call. |
+| `NN_DOMAIN` | None | NNG options are not divided by domain or protocol. |
+| `NN_PROTOCOL` | `nng_socket_proto_id` | No longer an option. See also `nng_socket_proto_name`. |
+| `NN_IPV4ONLY` | None | Use URL such as `tcp4://` to obtain this functionality. |
+| `NN_SOCKET_NAME` | `NNG_OPT_SOCKNAME` |
+| `NN_MAXTTL` | `NNG_OPT_MAXTTL` |
## Error Codes
diff --git a/docs/ref/migrate/nng1.md b/docs/ref/migrate/nng1.md
index 0e2c9a48..39968277 100644
--- a/docs/ref/migrate/nng1.md
+++ b/docs/ref/migrate/nng1.md
@@ -69,6 +69,15 @@ options must be set on the endpoint (dialer or listener) using the appropriate
to allocate and configure the endpoint before attaching it to the socket. This will
also afford a much more fine-grained level of control over transport options.
+## Socket Options
+
+The `NNG_OPT_PROTO`, `NNG_OPT_PROTONAME`, `NNG_OPT_PEER`, and `NNG_OPT_PEERNAME` options
+have been replaced by functions instead of options.
+Use `nng_socket_proto_id`, `nng_socket_peer_id`, `nng_socket_proto_name`, and `nng_socket_peer_name` instead.
+Note that the new functions provide a reference to a static string, and thus do not require
+allocation, and the returned strings should not be freed. Also the IDs are provided as `uint16_t`,
+matching the actual wire protocol values, instead of `int`.
+
## Statistics Use Constified Pointers
A number of the statistics functions take, or return, `const nng_stat *` instead