xref: /openbmc/qemu/tests/unit/socket-helpers.h (revision 9fd704da6809f3e01d0283f0d6d619022d481fb9)
1da668aa1SThomas Huth /*
2da668aa1SThomas Huth  * Helper functions for tests using sockets
3da668aa1SThomas Huth  *
4da668aa1SThomas Huth  * Copyright 2015-2018 Red Hat, Inc.
5da668aa1SThomas Huth  *
6da668aa1SThomas Huth  * This program is free software; you can redistribute it and/or
7da668aa1SThomas Huth  * modify it under the terms of the GNU General Public License as
8da668aa1SThomas Huth  * published by the Free Software Foundation; either version 2 or
9da668aa1SThomas Huth  * (at your option) version 3 of the License.
10da668aa1SThomas Huth  *
11da668aa1SThomas Huth  * This program is distributed in the hope that it will be useful,
12da668aa1SThomas Huth  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13da668aa1SThomas Huth  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14da668aa1SThomas Huth  * GNU General Public License for more details.
15da668aa1SThomas Huth  *
16da668aa1SThomas Huth  * You should have received a copy of the GNU General Public License
17da668aa1SThomas Huth  * along with this program; if not, see <http://www.gnu.org/licenses/>.
18da668aa1SThomas Huth  */
19da668aa1SThomas Huth 
20da668aa1SThomas Huth #ifndef TESTS_SOCKET_HELPERS_H
21da668aa1SThomas Huth #define TESTS_SOCKET_HELPERS_H
22da668aa1SThomas Huth 
23da668aa1SThomas Huth /*
24da668aa1SThomas Huth  * @has_ipv4: set to true on return if IPv4 is available
25da668aa1SThomas Huth  * @has_ipv6: set to true on return if IPv6 is available
26da668aa1SThomas Huth  *
27da668aa1SThomas Huth  * Check whether IPv4 and/or IPv6 are available for use.
28da668aa1SThomas Huth  * On success, @has_ipv4 and @has_ipv6 will be set to
29da668aa1SThomas Huth  * indicate whether the respective protocols are available.
30da668aa1SThomas Huth  *
31da668aa1SThomas Huth  * Returns 0 on success, -1 on fatal error
32da668aa1SThomas Huth  */
33da668aa1SThomas Huth int socket_check_protocol_support(bool *has_ipv4, bool *has_ipv6);
34da668aa1SThomas Huth 
35*0370f239SBin Meng /*
36*0370f239SBin Meng  * @has_afunix: set to true on return if unix socket support is available
37*0370f239SBin Meng  *
38*0370f239SBin Meng  * Check whether unix domain socket support is available for use.
39*0370f239SBin Meng  * On success, @has_afunix will be set to indicate whether AF_UNIX protocol
40*0370f239SBin Meng  * is available.
41*0370f239SBin Meng  */
42*0370f239SBin Meng void socket_check_afunix_support(bool *has_afunix);
43*0370f239SBin Meng 
44da668aa1SThomas Huth #endif
45