VBoxLwipCore.cpp revision 2e848e79ccf2e4285250a0af98ddb9eb28864878
/* $Id$ */
/** @file
* VBox Lwip Core Initiatetor/Finilizer.
*/
/*
* Copyright (C) 2012-2013 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.
*/
/**
* @todo: this should be somehow shared with with DevINIP, because
* we want that every NAT and DevINIP instance uses a initialized LWIP
* initialization of LWIP should happen on iLWIPInitiatorCounter 0 -> 1.
* see pfnConstruct/Destruct.
*
* @note: see comment to DevINIP.cpp:DevINIPConfigured
* @note: perhaps initilization stuff would be better move out of NAT driver,
* because we have to deal with attaching detaching NAT driver at runtime.
*/
#include "VBoxLwipCore.h"
/* @todo: lwip or nat ? */
#define LOG_GROUP LOG_GROUP_DRV_NAT
#include <iprt/critsect.h>
extern "C" {
#include "lwip/tcp_impl.h"
}
typedef struct {
void *pvUser;
typedef struct LWIPCORE
{
/* semaphore to coordinate 'tcpip' thread initialization */
/* Initalization user defined callback */
/* Finitialization user defined callback */
} LWIPCORE;
static LWIPCORE g_LwipCore;
/* Lwip Core Timer functions */
{
}
{
}
{
}
/**
* @note: this function executed on TCPIP thread.
*/
{
}
/**
* @note: this function executed on TCPIP thread.
*/
{
}
/**
* @note: this function executed on TCPIP thread.
*/
{
}
/**
* This function initialize lwip core once
* further NAT instancies should just add netifs configured according
* their needs.
*
* We're on EMT-n or main thread of the network service, we want execute
* anything on tcpip thread.
*/
{
int rc = VINF_SUCCESS;
{
}
{
/* @todo: VERR_INTERNAL_ERROR perhaps should be replaced with right error code */
{
goto done;
}
} /* end of if (g_LwipCore.iLWIPInitiatorCounter == 1) */
/* tcpip thread launched */
/* _block mean that we might be blocked on post to mailbox and the last 1 is our
* agreement with this fact
*/
{
goto done;
}
/* we're waiting the result here */
{
goto done;
}
done:
return rc;
}
/**
* This function decrement lwip reference counter
* and calls tcpip thread termination function.
*/
{
if (g_LwipCore.iLWIPInitiatorCounter == 0)
{
}
else
}