RTWinSocketPair.cpp revision 23bcfa32fddbe29a8c4c40d3bcfa4693a555c177
/* $Id$ */
/** @file
* NAT Network - socketpair(2) emulation for winsock.
*/
/*
* Copyright (C) 2013-2014 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*/
#include <Winsock2.h>
#include <Windows.h>
#include <stdio.h>
{
LogFlowFunc(("ENTER: domain:%d, type:%d, protocol:%d, socket_vector:%p\n",
switch (domain)
{
case AF_INET:
break;
case AF_INET6: /* I dobt we really need it. */
default:
}
switch(type)
{
case SOCK_STREAM:
case SOCK_DGRAM:
break;
default:
}
if (!socket_vector)
return VERR_INVALID_PARAMETER;
union {
struct sockaddr_in in_addr;
} sa[2];
if (type == SOCK_STREAM)
{
if (listener == INVALID_SOCKET)
{
return VERR_INTERNAL_ERROR;
}
int reuse = 1;
cb = sizeof(int);
if (rc)
{
goto close_socket;
}
if(rc)
{
goto close_socket;
}
if (rc)
{
goto close_socket;
}
if (rc)
{
goto close_socket;
}
if (socket_vector[0] == INVALID_SOCKET)
{
goto close_socket;
}
if (rc)
goto close_socket;
{
goto close_socket;
}
}
else
{
if (rc == SOCKET_ERROR)
{
goto close_socket;
}
if (rc == SOCKET_ERROR)
{
goto close_socket;
}
{
("ioctl error: %d\n", WSAGetLastError()),
("ioctl error: %d\n", WSAGetLastError()),
}
if (rc == SOCKET_ERROR)
{
goto close_socket;
}
if (rc == SOCKET_ERROR)
{
goto close_socket;
}
if (rc == SOCKET_ERROR)
{
goto close_socket;
}
if (rc == SOCKET_ERROR)
{
goto close_socket;
}
}
return VINF_SUCCESS;
if (listener != INVALID_SOCKET)
if (socket_vector[0] != INVALID_SOCKET)
closesocket(socket_vector[0]);
return VERR_INTERNAL_ERROR;
}