Skip to content

Commit

Permalink
fixes nanomsg#381 Want comparators for various types
Browse files Browse the repository at this point in the history
  • Loading branch information
gdamore committed May 1, 2018
1 parent 63bdb2c commit 4998964
Show file tree
Hide file tree
Showing 28 changed files with 494 additions and 99 deletions.
5 changes: 5 additions & 0 deletions docs/man/libnng.3.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ The following functions operate on sockets.
|<<nng_recv.3#,nng_recv()>>|receive data
|<<nng_send.3#,nng_send()>>|send data
|<<nng_setopt.3#,nng_setopt()>>|set socket option
|<<nng_socket_id.3#,nng_socket_id()>>|get numeric socket identifier
|===

=== Connection Management
Expand All @@ -61,16 +62,19 @@ Listeners accept incoming connection requets, and dialers make them.
|<<nng_dialer_close.3#,nng_dialer_close()>>|close dialer
|<<nng_dialer_create.3#,nng_dialer_create()>>|create dialer
|<<nng_dialer_getopt.3#,nng_dialer_getopt()>>|get dialer option
|<<nng_dialer_id.3#,nng_dialer_id()>>|get numeric dialer identifier
|<<nng_dialer_setopt.3#,nng_dialer_setopt()>>|set dialer option
|<<nng_dialer_start.3#,nng_dialer_start()>>|start dialer
|<<nng_listen.3#,nng_listen()>>|create and start listener
|<<nng_listener_close.3#,nng_listener_close()>>|close listener
|<<nng_listener_create.3#,nng_listener_create()>>|create listener
|<<nng_listener_getopt.3#,nng_listener_getopt()>>|get listener option
|<<nng_listener_id.3#,nng_listener_id()>>|get numeric listener identifier
|<<nng_listener_setopt.3#,nng_listener_setopt()>>|set listener option
|<<nng_listener_start.3#,nng_listener_start()>>|start listener
|<<nng_pipe_close.3#,nng_pipe_close()>>|close pipe
|<<nng_pipe_getopt.3#,nng_pipe_getopt()>>|get pipe option
|<<nng_pipe_id.3#,nng_pipe_id()>>|get numeric pipe identifier
|===

=== Message Handling Functions
Expand Down Expand Up @@ -205,6 +209,7 @@ concurrent applications.
|===
|<<nng_ctx_close.3#,nng_ctx_close()>>|close context
|<<nng_ctx_getopt.3#,nng_ctx_getopt()>>|get context option
|<<nng_ctx_id.3#,nng_ctx_id()>>|get numeric context identifier
|<<nng_ctx_open.3#,nng_ctx_open()>>|create context
|<<nng_ctx_recv.3#,nng_ctx_recv()>>|receive message using context asynchronously
|<<nng_ctx_send.3#,nng_ctx_send()>>|send message using context asynchronously
Expand Down
9 changes: 8 additions & 1 deletion docs/man/nng_ctx.5.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -91,7 +97,7 @@ to the sender.
----
struct echo_context {
nng_ctx *ctx;
nng_ctx ctx;
nng_aio *aio;
enum { INIT, RECV, SEND } state;
};
Expand Down Expand Up @@ -156,6 +162,7 @@ start_echo_service(nng_socket rep_socket)
<<nng_ctx_close.3#,nng_ctx_close(3)>>,
<<nng_ctx_open.3#,nng_ctx_open(3)>>,
<<nng_ctx_getopt.3#,nng_ctx_getopt(3)>>,
<<nng_ctx_id.3#,nng_ctx_id(3)>>,
<<nng_ctx_recv.3#,nng_ctx_recv(3)>>,
<<nng_ctx_send.3#,nng_ctx_send(3)>>,
<<nng_ctx_setopt.3#,nng_ctx_setopt(3)>>,
Expand Down
50 changes: 50 additions & 0 deletions docs/man/nng_ctx_id.3.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
= nng_ctx_id(3)
//
// Copyright 2018 Staysail Systems, Inc. <[email protected]>
// Copyright 2018 Capitar IT Group BV <[email protected]>
//
// 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 <nng/nng.h>
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
<<nng_ctx_open.3#,`nng_ctx_open`>> function.
Contexts that are allocated on the stack or statically should be
initialized with the macro
<<nng_ctx.5#NNG_CTX_INITIALIZER,`NNG_CTX_INITIALIZER`>> 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

<<nng_ctx.5#,nng_ctx(5)>>,
<<nng.7#,nng(7)>>
7 changes: 7 additions & 0 deletions docs/man/nng_dialer.5.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,19 @@ Dialer objects may be destroyed by the
<<nng_dialer_close.3#,`nng_pipe_close()`>> 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

<<nng_dial.3#,nng_dial(3)>>,
<<nng_dialer_close.3#,nng_dialer_close(3)>>,
<<nng_dialer_create.3#,nng_dialer_create(3)>>,
<<nng_dialer_getopt.3#,nng_dialer_getopt(3)>>,
<<nng_dialer_id.3#,nng_dialer_id(3)>>,
<<nng_dialer_setopt.3#,nng_dialer_setopt(3)>>,
<<nng_dialer_start.3#,nng_dialer_start(3)>>,
<<nng_listener.5#,nng_listener(5)>>,
Expand Down
51 changes: 51 additions & 0 deletions docs/man/nng_dialer_id.3.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
= nng_dialer_id(3)
//
// Copyright 2018 Staysail Systems, Inc. <[email protected]>
// Copyright 2018 Capitar IT Group BV <[email protected]>
//
// 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 <nng/nng.h>
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
<<nng_dialer_create.3#,`nng_dialer_create`>> or
<<nng_dial.3#,`nng_dial`>> functions.
Dialers that are allocated on the stack or statically should be
initialized with the macro
<<nng_ctx.5#NNG_DIALER_INITIALIZER,`NNG_DIALER_INITIALIZER`>> 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

<<nng_dialer.5#,nng_dialer(5)>>,
<<nng.7#,nng(7)>>
7 changes: 7 additions & 0 deletions docs/man/nng_listener.5.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,19 @@ Listener objects may be destroyed by the
<<nng_listener_close.3#,`nng_listener_close()`>> 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

<<nng_listen.3#,nng_listen(3)>>,
<<nng_listener_close.3#,nng_listener_close(3)>>,
<<nng_listener_create.3#,nng_listener_create(3)>>,
<<nng_listener_getopt.3#,nng_listener_getopt(3)>>,
<<nng_listener_id.3#,nng_listener_id(3)>>,
<<nng_listener_setopt.3#,nng_listener_setopt(3)>>,
<<nng_listener_start.3#,nng_listener_start(3)>>,
<<nng_dialer.5#,nng_dialer(5)>>,
Expand Down
51 changes: 51 additions & 0 deletions docs/man/nng_listener_id.3.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
= nng_listener_id(3)
//
// Copyright 2018 Staysail Systems, Inc. <[email protected]>
// Copyright 2018 Capitar IT Group BV <[email protected]>
//
// 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 <nng/nng.h>
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
<<nng_listener_create.3#,`nng_listener_create`>> or
<<nng_listen.3#,`nng_listen`>> functions.
listeners that are allocated on the stack or statically should be
initialized with the macro
<<nng_ctx.5#NNG_LISTENER_INITIALIZER,`NNG_LISTENER_INITIALIZER`>> 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

<<nng_listener.5#,nng_listener(5)>>,
<<nng.7#,nng(7)>>
14 changes: 14 additions & 0 deletions docs/man/nng_pipe.5.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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

<<nng_msg_get_pipe.3#,nng_msg_get_pipe(3)>>,
<<nng_pipe_close.3#,nng_pipe_close(3)>>,
<<nng_pipe_getopt.3#,nng_pipe_getopt(3)>>,
<<nng_pipe_id.3#,nng_pipe_id(3)>>,
<<nng_dialer.5#,nng_dialer(5)>>,
<<nng_listener.5#,nng_listener(5)>>,
<<nng_options.5#,nng_options(5)>>,
Expand Down
2 changes: 1 addition & 1 deletion docs/man/nng_pipe_close.3.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ nng_pipe_close - close pipe
----
#include <nng/nng.h>
int nng_pipe_close(nng_socket s);
int nng_pipe_close(nng_pipe p);
----

== DESCRIPTION
Expand Down
50 changes: 50 additions & 0 deletions docs/man/nng_pipe_id.3.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
= nng_pipe_id(3)
//
// Copyright 2018 Staysail Systems, Inc. <[email protected]>
// Copyright 2018 Capitar IT Group BV <[email protected]>
//
// 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 <nng/nng.h>
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
<<nng_pipe_open.3#,`nng_pipe_open`>> function.
Pipes that are allocated on the stack or statically should be
initialized with the macro
<<nng_pipe.5#NNG_PIPE_INITIALIZER,`NNG_PIPE_INITIALIZER`>> 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

<<nng_pipe.5#,nng_pipe(5)>>,
<<nng.7#,nng(7)>>
14 changes: 14 additions & 0 deletions docs/man/nng_socket.5.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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_close.3#,`nng_close()`>>.

[[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

<<libnng.3#,libnng(3)>>,
<<nng_close.3#,nng_close(3)>>,
<<nng_getopt.3#,nng_getopt(3)>>,
<<nng_setopt.3#,nng_setopt(3)>>,
<<nng_socket_id.3#,nng_socket_id(3)>>,
<<nng_dialer.5#,nng_dialer(5)>>,
<<nng_listener.5#,nng_listener(5)>>,
<<nng_options.5#,nng_options(5)>>,
Expand Down
Loading

0 comments on commit 4998964

Please sign in to comment.