blob: 5a958e3bd9cba153223fc73b6ac977f63f54f67b [file] [log] [blame]
E. Scott Daniels117030c2020-04-10 17:17:02 -04001
2
3.. This work is licensed under a Creative Commons Attribution 4.0 International License.
4.. SPDX-License-Identifier: CC-BY-4.0
5.. CAUTION: this document is generated from source in doc/src/rtd.
6.. To make changes edit the source and recompile the document.
7.. Do NOT make changes directly to .rst or .md files.
8
9
10============================================================================================
11Man Page: rmr_wh_open
12============================================================================================
13
14RMR Library Functions
15============================================================================================
16
17
18NAME
19--------------------------------------------------------------------------------------------
20
21rmr_wh_open
22
23SYNOPSIS
24--------------------------------------------------------------------------------------------
25
26
27::
28
29 #include <rmr/rmr.h>
30 void* rmr_wh_open( void* vctx, char* target )
31
32
33
34DESCRIPTION
35--------------------------------------------------------------------------------------------
36
37The rmr_wh_open function creates a direct link for sending, a
38wormhole, to another RMr based process. Sending messages
39through a wormhole requires that the connection be
40established overtly by the user application (via this
41function), and that the ID returned by rmr_wh_open be passed
42to the rmr_wh_send_msg function.
43
44*Target* is the *name* or *IP-address* combination of the
45processess that the wormhole should be connected to. *Vctx*
46is the RMr void context pointer that was returned by the
47rmr_init function.
48
49When invoked, this function immediatly attempts to connect to
50the target process. If the connection cannot be established,
51an error is returned to the caller, and no direct messages
52can be sent to the target. Once a wormhole is connected, the
53underlying transport mechanism (e.g. NNG) will provide
54reconnects should the connection be lost, however the
55handling of messages sent when a connection is broken is
56undetermined as each underlying transport mechanism may
57handle buffering and retries differently.
58
59RETURN VALUE
60--------------------------------------------------------------------------------------------
61
62The rmr_wh_open function returns a type rmr_whid_t which must
63be passed to the rmr_wh_send_msg function when sending a
64message. The id may also be tested to determine success or
65failure of the connection by using the RMR_WH_CONNECTED macro
66and passing the ID as the parameter; a result of 1 indicates
67that the connection was esablished and that the ID is valid.
68
69ERRORS
70--------------------------------------------------------------------------------------------
71
72The following error values are specifically set by this RMR
73function. In some cases the error message of a system call is
74propagated up, and thus this list might be incomplete.
75
76
77EINVAL
78
79 A parameter passed was not valid.
80
81EACCESS
82
83 The user application does not have the ability to
84 establish a wormhole to the indicated target (or maybe any
85 target).
86
87ECONNREFUSED
88
89 The connection was refused.
90
91
92EXAMPLE
93--------------------------------------------------------------------------------------------
94
95
96::
97
98 void* rmc;
99 rmr_whid_t wh;
100 rmc = rmr_init( "43086", 4096, 0 ); // init context
101 wh = rmr_wh_open( rmc, "localhost:6123" );
102 if( !RMR_WH_CONNECTED( wh ) ) {
103 fprintf( stderr, "unable to connect wormhole: %s\\n",
104 strerror( errno ) );
105 }
106
107
108
109SEE ALSO
110--------------------------------------------------------------------------------------------
111
112rmr_alloc_msg(3), rmr_call(3), rmr_free_msg(3),
113rmr_get_rcvfd(3), rmr_payload_size(3), rmr_send_msg(3),
114rmr_rcv_msg(3), rmr_rcv_specific(3), rmr_rts_msg(3),
115rmr_ready(3), rmr_fib(3), rmr_has_str(3), rmr_tokenise(3),
116rmr_mk_ring(3), rmr_ring_free(3), rmr_wh_close(3),
117rmr_wh_send_msg(3), rmr_wh_state(3)