DrvNAT.cpp revision c14f8e655639b054b064e23d5d8b8fa055054eb0
0N/A * VBox network devices: 0N/A * NAT network transport driver 0N/A * Copyright (C) 2006 InnoTek Systemberatung GmbH 0N/A * This file is part of VirtualBox Open Source Edition (OSE), as 0N/A * you can redistribute it and/or modify it under the terms of the GNU 0N/A * General Public License as published by the Free Software Foundation, 0N/A * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE 0N/A * distribution. VirtualBox OSE is distributed in the hope that it will 0N/A * be useful, but WITHOUT ANY WARRANTY of any kind. 0N/A * If you received this file as part of a commercial VirtualBox 0N/A * distribution, then only the terms of your commercial VirtualBox 0N/A * license agreement apply instead of the previous paragraph. 0N/A/******************************************************************************* 0N/A*******************************************************************************/ 0N/A/******************************************************************************* 0N/A* Structures and Typedefs * 0N/A*******************************************************************************/ 0N/A * Block driver instance data. 0N/A /** The network interface. */ /** The port we're attached to. */ /** Pointer to the driver instance. */ /** Slirp critical section. */ /** NAT state for this instance. */ /** Converts a pointer to NAT::INetworkConnector to a PRDVNAT. */ /******************************************************************************* *******************************************************************************/ /** If set the thread should terminate. */ /** The thread id of the select thread (drvNATSelectThread()). */ * Send data to the network. * @returns VBox status code. * @param pInterface Pointer to the interface structure containing the called function pointer. * @param pvBuf Data to send. * @param cb Number of bytes to send. Log2((
"drvNATSend: pvBuf=%p cb=%#x\n" * This is called when the promiscuous mode is set. This means that there doesn't have * to be a mode change when it's called. * @param pInterface Pointer to the interface structure containing the called function pointer. * @param fPromiscuous Set if the adaptor is now in promiscuous mode. Clear if it is not. * Notification on link status changes. * @param pInterface Pointer to the interface structure containing the called function pointer. * @param enmLinkState The new link state. * More receive buffer has become available. * This is called when the NIC frees up receive buffers. * @param pInterface Pointer to the interface structure containing the called function pointer. LogFlow((
"drvNATNotifyCanReceive:\n"));
/** @todo do something useful here. */ * Function called by slirp to check if it's possible to feed incoming data to the network port. * @returns 1 if possible. * @returns 0 if not possible. /** Happens during termination */ * Function called by slirp to feed incoming data to the network port. Log2((
"slirp_output: pu8Buf=%p cb=%#x (pData=%p)\n" /** Happens during termination */ * Queries an interface to the driver. * @returns Pointer to interface. * @returns NULL if the interface was not supported by the driver. * @param pInterface Pointer to this interface structure. * @param enmInterface The requested interface identification. * Destruct a driver instance. * Most VM resources are freed by the VM. This callback is provided so that any non-VM * resources can be freed correctly. * @param pDrvIns The driver instance data. * Sets up the redirectors. * @returns VBox status code. * @param pCfgHandle The drivers configuration handle. * Enumerate redirections. AssertMsgFailed((
"Configuration error: failed to setup redirection of %d to %s:%d. Probably a conflict with existing services or other rules.\n",
}
/* for each redir rule */ * Construct a NAT network transport driver instance. * @param pDrvIns The driver instance data. * If the registration structure is needed, pDrvIns->pDrvReg points to it. * @param pCfgHandle Configuration node handle for the driver. Use this to obtain the configuration * of the driver instance. It's also found in pDrvIns->pCfgHandle, but like * iInstance it's expected to be used a bit in this function. * Query the network port interface. N_(
"Configuration error: the above device/driver didn't export the network port interface!\n"));
/* Generate a network address for this network card. */ * Start the select thread. (it'll block on the sem) * NAT network transport driver registration record. "NAT Network Transport Driver",