]> git.proxmox.com Git - mirror_qemu.git/blame - tests/socket-helpers.h
vmstate: check subsection_found is enough
[mirror_qemu.git] / tests / socket-helpers.h
CommitLineData
9b589ffb
DB
1/*
2 * Helper functions for tests using sockets
3 *
4 * Copyright 2015-2018 Red Hat, Inc.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation; either version 2 or
9 * (at your option) version 3 of the License.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, see <http://www.gnu.org/licenses/>.
18 *
19 */
20
21/*
22 * @hostname: a DNS name or numeric IP address
23 *
abd983c0 24 * Check whether it is possible to bind & connect to ports
9b589ffb
DB
25 * on the DNS name or IP address @hostname. If an IP address
26 * is used, it must not be a wildcard address.
27 *
28 * Returns 0 on success, -1 on error with errno set
29 */
abd983c0 30int socket_can_bind_connect(const char *hostname);
9b589ffb
DB
31
32/*
33 * @has_ipv4: set to true on return if IPv4 is available
34 * @has_ipv6: set to true on return if IPv6 is available
35 *
36 * Check whether IPv4 and/or IPv6 are available for use.
37 * On success, @has_ipv4 and @has_ipv6 will be set to
38 * indicate whether the respective protocols are available.
39 *
40 * Returns 0 on success, -1 on fatal error
41 */
42int socket_check_protocol_support(bool *has_ipv4, bool *has_ipv6);