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