src: convert all code to use virsocket.h

There are a large number of different header files that
are related to the sockets APIs. The virsocket.h header
includes all of the relevant headers for Windows and UNIX
in one convenient place. If virsocketaddr.h is already
included, then there's no need for virsocket.h

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
Daniel P. Berrangé
2020-01-14 17:38:59 +00:00
parent a464220430
commit fc920f704c
41 changed files with 43 additions and 130 deletions

View File

@@ -27,9 +27,9 @@
# include <libxl.h>
# include <xenstore.h>
# include <xenctrl.h>
# include <sys/socket.h>
# include "virfile.h"
# include "virsocket.h"
VIR_MOCK_IMPL_RET_VOID(xs_daemon_open,
struct xs_handle *)

View File

@@ -22,9 +22,8 @@
#ifdef NSS
# include <arpa/inet.h>
# include "libvirt_nss.h"
# include "virsocketaddr.h"
# include "virsocket.h"
# define VIR_FROM_THIS VIR_FROM_NONE

View File

@@ -22,7 +22,6 @@
#ifdef HAVE_IFADDRS_H
# include <ifaddrs.h>
#endif
#include <netdb.h>
#include "testutils.h"
#include "virutil.h"

View File

@@ -19,7 +19,6 @@
#include <config.h>
#include <fcntl.h>
#include <sys/socket.h>
#include "testutils.h"
#include "virnettlshelpers.h"
@@ -29,7 +28,7 @@
#include "virlog.h"
#include "virfile.h"
#include "vircommand.h"
#include "virsocketaddr.h"
#include "virsocket.h"
#if !defined WIN32 && HAVE_LIBTASN1_H && LIBGNUTLS_VERSION_NUMBER >= 0x020600

View File

@@ -19,7 +19,6 @@
#include <config.h>
#include <fcntl.h>
#include <sys/socket.h>
#include "virnettlshelpers.h"
#include "viralloc.h"

View File

@@ -19,7 +19,6 @@
#include <config.h>
#include <fcntl.h>
#include <sys/socket.h>
#include "testutils.h"
#include "virnettlshelpers.h"
@@ -29,7 +28,7 @@
#include "virlog.h"
#include "virfile.h"
#include "vircommand.h"
#include "virsocketaddr.h"
#include "virsocket.h"
#if !defined WIN32 && HAVE_LIBTASN1_H && LIBGNUTLS_VERSION_NUMBER >= 0x020600

View File

@@ -23,10 +23,7 @@
#endif
#if defined(__linux__) && defined(RTLD_NEXT)
# include "internal.h"
# include <sys/socket.h>
# include <arpa/inet.h>
# include <netinet/in.h>
# include "virsocket.h"
# include <unistd.h>
static bool host_has_ipv6;

View File

@@ -20,16 +20,11 @@
#include "virmock.h"
#include <unistd.h>
#include <sys/types.h>
#include <fcntl.h>
#include <sys/file.h>
#include <sys/stat.h>
#include <sys/socket.h>
#ifdef HAVE_SYS_UN_H
# include <sys/un.h>
#endif
#include "internal.h"
#include "virsocket.h"
#include "configmake.h"
#include "virstring.h"
#include "viralloc.h"
@@ -202,7 +197,7 @@ int connect(int sockfd, const struct sockaddr *addr, socklen_t addrlen)
{
init_syms();
#ifdef HAVE_SYS_UN_H
#ifndef WIN32
if (addrlen == sizeof(struct sockaddr_un)) {
struct sockaddr_un *tmp = (struct sockaddr_un *) addr;
if (tmp->sun_family == AF_UNIX)