xref: /openbmc/qemu/tests/unit/socket-helpers.h (revision ed75658a)
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 #ifndef TESTS_SOCKET_HELPERS_H
21 #define TESTS_SOCKET_HELPERS_H
22 
23 /*
24  * @has_ipv4: set to true on return if IPv4 is available
25  * @has_ipv6: set to true on return if IPv6 is available
26  *
27  * Check whether IPv4 and/or IPv6 are available for use.
28  * On success, @has_ipv4 and @has_ipv6 will be set to
29  * indicate whether the respective protocols are available.
30  *
31  * Returns 0 on success, -1 on fatal error
32  */
33 int socket_check_protocol_support(bool *has_ipv4, bool *has_ipv6);
34 
35 /*
36  * @has_afunix: set to true on return if unix socket support is available
37  *
38  * Check whether unix domain socket support is available for use.
39  * On success, @has_afunix will be set to indicate whether AF_UNIX protocol
40  * is available.
41  */
42 void socket_check_afunix_support(bool *has_afunix);
43 
44 #endif
45