From 4998964a435fe0f02a2d81b01fdb837214674e72 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Mon, 30 Apr 2018 21:41:40 -0700 Subject: fixes #381 Want comparators for various types --- docs/man/libnng.3.adoc | 5 ++++ docs/man/nng_ctx.5.adoc | 9 +++++++- docs/man/nng_ctx_id.3.adoc | 50 ++++++++++++++++++++++++++++++++++++++++ docs/man/nng_dialer.5.adoc | 7 ++++++ docs/man/nng_dialer_id.3.adoc | 51 +++++++++++++++++++++++++++++++++++++++++ docs/man/nng_listener.5.adoc | 7 ++++++ docs/man/nng_listener_id.3.adoc | 51 +++++++++++++++++++++++++++++++++++++++++ docs/man/nng_pipe.5.adoc | 14 +++++++++++ docs/man/nng_pipe_close.3.adoc | 2 +- docs/man/nng_pipe_id.3.adoc | 50 ++++++++++++++++++++++++++++++++++++++++ docs/man/nng_socket.5.adoc | 14 +++++++++++ docs/man/nng_socket_id.3.adoc | 50 ++++++++++++++++++++++++++++++++++++++++ 12 files changed, 308 insertions(+), 2 deletions(-) create mode 100644 docs/man/nng_ctx_id.3.adoc create mode 100644 docs/man/nng_dialer_id.3.adoc create mode 100644 docs/man/nng_listener_id.3.adoc create mode 100644 docs/man/nng_pipe_id.3.adoc create mode 100644 docs/man/nng_socket_id.3.adoc (limited to 'docs') diff --git a/docs/man/libnng.3.adoc b/docs/man/libnng.3.adoc index 8df29861..149dc9f4 100644 --- a/docs/man/libnng.3.adoc +++ b/docs/man/libnng.3.adoc @@ -49,6 +49,7 @@ The following functions operate on sockets. |<>|receive data |<>|send data |<>|set socket option +|<>|get numeric socket identifier |=== === Connection Management @@ -61,16 +62,19 @@ Listeners accept incoming connection requets, and dialers make them. |<>|close dialer |<>|create dialer |<>|get dialer option +|<>|get numeric dialer identifier |<>|set dialer option |<>|start dialer |<>|create and start listener |<>|close listener |<>|create listener |<>|get listener option +|<>|get numeric listener identifier |<>|set listener option |<>|start listener |<>|close pipe |<>|get pipe option +|<>|get numeric pipe identifier |=== === Message Handling Functions @@ -205,6 +209,7 @@ concurrent applications. |=== |<>|close context |<>|get context option +|<>|get numeric context identifier |<>|create context |<>|receive message using context asynchronously |<>|send message using context asynchronously diff --git a/docs/man/nng_ctx.5.adoc b/docs/man/nng_ctx.5.adoc index 98402738..ada117c3 100644 --- a/docs/man/nng_ctx.5.adoc +++ b/docs/man/nng_ctx.5.adoc @@ -81,6 +81,12 @@ are in use on the same socket is not supported, and may lead to unpredictable behavior. These asynchronous methods should not be mixed on the same socket. +[[NNG_CTX_INITIALIZER]] +=== Initialization + +A context may be initialized using the macro `NNG_CTX_INITIALIZER` +before it is opened, to prevent confusion with valid open contexts. + == EXAMPLE The following program fragment demonstrates the use of contexts to implement @@ -91,7 +97,7 @@ to the sender. ---- struct echo_context { - nng_ctx *ctx; + nng_ctx ctx; nng_aio *aio; enum { INIT, RECV, SEND } state; }; @@ -156,6 +162,7 @@ start_echo_service(nng_socket rep_socket) <>, <>, <>, +<>, <>, <>, <>, diff --git a/docs/man/nng_ctx_id.3.adoc b/docs/man/nng_ctx_id.3.adoc new file mode 100644 index 00000000..56d9d7bd --- /dev/null +++ b/docs/man/nng_ctx_id.3.adoc @@ -0,0 +1,50 @@ += nng_ctx_id(3) +// +// Copyright 2018 Staysail Systems, Inc. +// Copyright 2018 Capitar IT Group BV +// +// This document is supplied under the terms of the MIT License, a +// copy of which should be located in the distribution where this +// file was obtained (LICENSE.txt). A copy of the license may also be +// found online at https://opensource.org/licenses/MIT. +// + +== NAME + +nng_ctx_id - return numeric context identifier + +== SYNOPSIS + +[source, c] +---- +#include + +int nng_ctx_id(nng_ctx c); +---- + +== DESCRIPTION + +The `nng_ctx_id()` function returns a positive identifier for the context _c_, +if it is valid. +Otherwise it returns `-1`. + +NOTE: A context is considered valid if it was ever opened with +<> function. +Contexts that are allocated on the stack or statically should be +initialized with the macro +<> to ensure that +they cannot be confused with a valid context before they are opened. + +== RETURN VALUES + +This function returns the positive value for the context identifier, or +`-1` if the context is invalid. + +== ERRORS + +None. + +== SEE ALSO + +<>, +<> diff --git a/docs/man/nng_dialer.5.adoc b/docs/man/nng_dialer.5.adoc index 45c60bc9..3f742c21 100644 --- a/docs/man/nng_dialer.5.adoc +++ b/docs/man/nng_dialer.5.adoc @@ -58,12 +58,19 @@ Dialer objects may be destroyed by the <> function. They are also closed when their "`owning`" socket is closed. +[[NNG_DIALER_INITIALIZER]] +=== Initialization + +A dialer may be initialized using the macro `NNG_DIALER_INITIALIZER` +before it is opened, to prevent confusion with valid open dialers. + == SEE ALSO <>, <>, <>, <>, +<>, <>, <>, <>, diff --git a/docs/man/nng_dialer_id.3.adoc b/docs/man/nng_dialer_id.3.adoc new file mode 100644 index 00000000..cf8936b5 --- /dev/null +++ b/docs/man/nng_dialer_id.3.adoc @@ -0,0 +1,51 @@ += nng_dialer_id(3) +// +// Copyright 2018 Staysail Systems, Inc. +// Copyright 2018 Capitar IT Group BV +// +// This document is supplied under the terms of the MIT License, a +// copy of which should be located in the distribution where this +// file was obtained (LICENSE.txt). A copy of the license may also be +// found online at https://opensource.org/licenses/MIT. +// + +== NAME + +nng_dialer_id - return numeric dialer identifier + +== SYNOPSIS + +[source, c] +---- +#include + +int nng_dialer_id(nng_dialer d); +---- + +== DESCRIPTION + +The `nng_dialer_id()` function returns a positive identifier for the dialer _d_, +if it is valid. +Otherwise it returns `-1`. + +NOTE: A dialer is considered valid if it was ever created with the +<> or +<> functions. +Dialers that are allocated on the stack or statically should be +initialized with the macro +<> to ensure that +they cannot be confused with a valid dialer before they are created properly. + +== RETURN VALUES + +This function returns the positive value for the dialer identifier, or +`-1` if the dialer is invalid. + +== ERRORS + +None. + +== SEE ALSO + +<>, +<> diff --git a/docs/man/nng_listener.5.adoc b/docs/man/nng_listener.5.adoc index 558eb920..e7187a61 100644 --- a/docs/man/nng_listener.5.adoc +++ b/docs/man/nng_listener.5.adoc @@ -55,12 +55,19 @@ Listener objects may be destroyed by the <> function. They are also closed when their "`owning`" socket is closed. +[[NNG_LISTENER_INITIALIZER]] +=== Initialization + +A listener may be initialized using the macro `NNG_LISTENER_INITIALIZER` +before it is opened, to prevent confusion with valid open listener. + == SEE ALSO <>, <>, <>, <>, +<>, <>, <>, <>, diff --git a/docs/man/nng_listener_id.3.adoc b/docs/man/nng_listener_id.3.adoc new file mode 100644 index 00000000..44404e14 --- /dev/null +++ b/docs/man/nng_listener_id.3.adoc @@ -0,0 +1,51 @@ += nng_listener_id(3) +// +// Copyright 2018 Staysail Systems, Inc. +// Copyright 2018 Capitar IT Group BV +// +// This document is supplied under the terms of the MIT License, a +// copy of which should be located in the distribution where this +// file was obtained (LICENSE.txt). A copy of the license may also be +// found online at https://opensource.org/licenses/MIT. +// + +== NAME + +nng_listener_id - return numeric listener identifier + +== SYNOPSIS + +[source, c] +---- +#include + +int nng_listener_id(nng_listener l); +---- + +== DESCRIPTION + +The `nng_listener_id()` function returns a positive identifier for the +listener _l_, if it is valid. +Otherwise it returns `-1`. + +NOTE: A listener is considered valid if it was ever created with the +<> or +<> functions. +listeners that are allocated on the stack or statically should be +initialized with the macro +<> to ensure that +they cannot be confused with a valid listener before they are created properly. + +== RETURN VALUES + +This function returns the positive value for the listener identifier, or +`-1` if the listener is invalid. + +== ERRORS + +None. + +== SEE ALSO + +<>, +<> diff --git a/docs/man/nng_pipe.5.adoc b/docs/man/nng_pipe.5.adoc index 39247fbd..a7423884 100644 --- a/docs/man/nng_pipe.5.adoc +++ b/docs/man/nng_pipe.5.adoc @@ -51,11 +51,25 @@ Pipe objects may be destroyed by the They are also closed when their "`owning`" dialer or listener is closed, or when the remote peer closes the underlying connection. +[[NNG_PIPE_INITIALIZER]] +=== Initialization + +A pipe may be initialized using the macro `NNG_PIPE_INITIALIZER` +before it is opened, to prevent confusion with valid open pipes. + +For example: + +[source, c] +---- +nng_pipe p = NNG_PIPE_INITIALIZER; +---- + == SEE ALSO <>, <>, <>, +<>, <>, <>, <>, diff --git a/docs/man/nng_pipe_close.3.adoc b/docs/man/nng_pipe_close.3.adoc index 598e143a..2128caec 100644 --- a/docs/man/nng_pipe_close.3.adoc +++ b/docs/man/nng_pipe_close.3.adoc @@ -19,7 +19,7 @@ nng_pipe_close - close pipe ---- #include -int nng_pipe_close(nng_socket s); +int nng_pipe_close(nng_pipe p); ---- == DESCRIPTION diff --git a/docs/man/nng_pipe_id.3.adoc b/docs/man/nng_pipe_id.3.adoc new file mode 100644 index 00000000..b327dac2 --- /dev/null +++ b/docs/man/nng_pipe_id.3.adoc @@ -0,0 +1,50 @@ += nng_pipe_id(3) +// +// Copyright 2018 Staysail Systems, Inc. +// Copyright 2018 Capitar IT Group BV +// +// This document is supplied under the terms of the MIT License, a +// copy of which should be located in the distribution where this +// file was obtained (LICENSE.txt). A copy of the license may also be +// found online at https://opensource.org/licenses/MIT. +// + +== NAME + +nng_pipe_id - return numeric pipe identifier + +== SYNOPSIS + +[source, c] +---- +#include + +int nng_pipe_id(nng_pipe p); +---- + +== DESCRIPTION + +The `nng_pipe_id()` function returns a positive identifier for the pipe _p_, +if it is valid. +Otherwise it returns `-1`. + +NOTE: A pipe is considered valid if it was ever opened with +<> function. +Pipes that are allocated on the stack or statically should be +initialized with the macro +<> to ensure that +they cannot be confused with a valid pipe before they are opened. + +== RETURN VALUES + +This function returns the positive value for the pipe identifier, or +`-1` if the pipe is invalid. + +== ERRORS + +None. + +== SEE ALSO + +<>, +<> diff --git a/docs/man/nng_socket.5.adoc b/docs/man/nng_socket.5.adoc index 4711495f..2d8d7256 100644 --- a/docs/man/nng_socket.5.adoc +++ b/docs/man/nng_socket.5.adoc @@ -44,12 +44,26 @@ Each `nng_socket` is created by a protocol-specific constructor, such as When the socket is no longer needed, it can be closed with <>. +[[NNG_SOCKET_INITIALIZER]] +=== Initialization + +A socket may be initialized using the macro `NNG_SOCKET_INITIALIZER` +before it is opened, to prevent confusion with valid open sockets. + +For example: + +[source, c] +---- +nng_socket s = NNG_SOCKET_INITIALIZER; +---- + == SEE ALSO <>, <>, <>, <>, +<>, <>, <>, <>, diff --git a/docs/man/nng_socket_id.3.adoc b/docs/man/nng_socket_id.3.adoc new file mode 100644 index 00000000..b5acc98b --- /dev/null +++ b/docs/man/nng_socket_id.3.adoc @@ -0,0 +1,50 @@ += nng_socket_id(3) +// +// Copyright 2018 Staysail Systems, Inc. +// Copyright 2018 Capitar IT Group BV +// +// This document is supplied under the terms of the MIT License, a +// copy of which should be located in the distribution where this +// file was obtained (LICENSE.txt). A copy of the license may also be +// found online at https://opensource.org/licenses/MIT. +// + +== NAME + +nng_socket_id - return numeric socket identifier + +== SYNOPSIS + +[source, c] +---- +#include + +int nng_socket_id(nng_socket s); +---- + +== DESCRIPTION + +The `nng_socket_id()` function returns a positive identifier for the socket _s_, +if it is valid. +Otherwise it returns `-1`. + +NOTE: A socket is considered valid if it was ever opened with a protocol +constructor, such as the <> function. +Sockets that are allocated on the stack or statically should be +initialized with the macro +<> to ensure that +they cannot be confused with a valid socket before they are opened. + +== RETURN VALUES + +This function returns the positive value for the socket identifier, or +`-1` if the socket is invalid. + +== ERRORS + +None. + +== SEE ALSO + +<>, +<> -- cgit v1.2.3-70-g09d2