1nbd_get_uri(3) LIBNBD nbd_get_uri(3)
2
3
4
6 nbd_get_uri - construct an NBD URI for a connection
7
9 #include <libnbd.h>
10
11 char * nbd_get_uri (
12 struct nbd_handle *h
13 );
14
16 This makes a best effort attempt to construct an NBD URI which could be
17 used to connect back to the same server (using nbd_connect_uri(3)).
18
19 In some cases there is not enough information in the handle to
20 successfully create a URI (eg. if you connected with
21 nbd_connect_socket(3)). In such cases the call returns "NULL" and
22 further diagnostic information is available via nbd_get_errno(3) and
23 nbd_get_error(3) as usual.
24
25 Even if a URI is returned it is not guaranteed to work, and it may not
26 be optimal.
27
29 This call returns a string. The caller must free the returned string
30 to avoid a memory leak.
31
33 On error "NULL" is returned.
34
35 Refer to "ERROR HANDLING" in libnbd(3) for how to get further details
36 of the error.
37
38 The following parameters must not be NULL: "h". For more information
39 see "Non-NULL parameters" in libnbd(3).
40
42 The handle must be connecting, or negotiating, or connected with the
43 server, or shut down, or dead, otherwise this call will return an
44 error.
45
47 This function first appeared in libnbd 1.8.
48
49 If you need to test if this function is available at compile time check
50 if the following macro is defined:
51
52 #define LIBNBD_HAVE_NBD_GET_URI 1
53
55 nbd_aio_connect_uri(3), nbd_connect_socket(3), nbd_connect_uri(3),
56 nbd_create(3), nbd_get_errno(3), nbd_get_error(3), nbd_supports_uri(3),
57 libnbd(3).
58
60 Eric Blake
61
62 Richard W.M. Jones
63
65 Copyright Red Hat
66
68 This library is free software; you can redistribute it and/or modify it
69 under the terms of the GNU Lesser General Public License as published
70 by the Free Software Foundation; either version 2 of the License, or
71 (at your option) any later version.
72
73 This library is distributed in the hope that it will be useful, but
74 WITHOUT ANY WARRANTY; without even the implied warranty of
75 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
76 Lesser General Public License for more details.
77
78 You should have received a copy of the GNU Lesser General Public
79 License along with this library; if not, write to the Free Software
80 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
81 02110-1301 USA
82
83
84
85libnbd-1.16.5 2023-09-26 nbd_get_uri(3)