VirtualBox

Changeset 10559 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Jul 12, 2008 12:57:37 AM (16 years ago)
Author:
vboxsync
Message:

INTNET: sketched out the trunk create & connect code (disabled).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Network/SrvIntNetR0.cpp

    r10557 r10559  
    9292
    9393/**
     94 * A trunk interface.
     95 */
     96typedef struct INTNETTRUNKIF
     97{
     98    /** The port interface we present to the component. */
     99    INTNETTRUNKSWPORT   SwitchPort;
     100    /** The port interface we get from the component. */
     101    PINTNETTRUNKIFPORT  pIfPort;
     102    /** The trunk mutex that serializes all calls <b>to</b> the component. */
     103    RTSEMFASTMUTEX      FastMutex;
     104} INTNETTRUNKIF;
     105/** Pointer to a trunk interface. */
     106typedef INTNETTRUNKIF *PINTNETTRUNKIF;
     107
     108
     109/**
    94110 * Internal representation of a network.
    95111 */
     
    12471263static int intnetNetworkCreateTrunkConnection(PINTNETNETWORK pNetwork, PSUPDRVSESSION pSession)
    12481264{
    1249     const char *pszFactoryUUID;
     1265    const char *pszName;
    12501266    switch (pNetwork->enmTrunkType)
    12511267    {
     
    12601276
    12611277        case kIntNetTrunkType_NetFlt:
    1262             pszFactoryUUID = INTNETTRUNKFACTORY_NETFLT_UUID_STR;
     1278            pszName = "VBoxNetFlt";
    12631279            break;
    12641280        case kIntNetTrunkType_NetTap:
    1265             pszFactoryUUID = INTNETTRUNKFACTORY_NETTAP_UUID_STR;
     1281            pszName = "VBoxNetTap";
    12661282            break;
    12671283        case kIntNetTrunkType_SrvNat:
    1268             pszFactoryUUID = INTNETTRUNKFACTORY_SRVNAT_UUID_STR;
     1284            pszName = "VBoxSrvNat";
    12691285            break;
    12701286    }
    12711287
    1272     /*
    1273      * Query the factory.
    1274      */
    1275 
     1288#if 0
     1289    /*
     1290     * Allocate the trunk interface.
     1291     */
     1292    PINTNETTRUNKIF pTrunkIF = (PINTNETTRUNKIF)RTMemAllocZ(sizeof(*pTrunkIF));
     1293    if (!pTrunkIF)
     1294        return VERR_NO_MEMORY;
     1295    pTrunkIF->SwitchPort.u32Version     = INTNETTRUNKSWPORT_VERSION;
     1296    pTrunkIF->SwitchPort.pfnSetSGPhys   = intnetTrunkIfPortSetSGPhys;
     1297    pTrunkIF->SwitchPort.pfnRecv        = intnetTrunkIfPortRecv;
     1298    pTrunkIF->SwitchPort.pfnSGRetain    = intnetTrunkIfPortSGRetain;
     1299    pTrunkIF->SwitchPort.pfnSGRelease   = intnetTrunkIfPortSGRelease;
     1300    pTrunkIF->SwitchPort.u32VersionEnd  = INTNETTRUNKSWPORT_VERSION;
     1301    //pTrunkIF->pIfPort = NULL;
     1302    int rc = RTSemFastMutexCreate(&pTrunkIF->FastMutex);
     1303    if (RT_SUCCESS(rc))
     1304    {
     1305        /*
     1306         * Query the factory we want, then use it create and connect the trunk.
     1307         */
     1308        PINTNETTRUNKFACTORY pTrunkFactory = NULL;
     1309        rc = SUPR0ComponentQueryFactory(pSession, pszName, INTNETTRUNKFACTORY_UUID_STR, (void **)&pTrunkFactory);
     1310        if (RT_SUCCESS(rc))
     1311        {
     1312            rc = pTrunkFactory->pfnCreateAndConnect(pTrunkFactory, pNetwork->szTrunk, &pTrunkIF->SwitchPort, &pTrunkIF->pIfPort);
     1313            /** @todo pTrunkFactory->pfnRelease(pTrunkFactory); */
     1314            if (RT_SUCCESS(rc))
     1315            {
     1316                Assert(pTrunkIF->pIfPort);
     1317                LogFlow(("intnetNetworkCreateTrunkConnection: VINF_SUCCESS - pszName=%s szTrunk=%s Network=%s\n",
     1318                         rc, pszName, pNetwork->szTrunk, pNetwork->szName));
     1319                return VINF_SUCCESS;
     1320            }
     1321        }
     1322
     1323        RTMemFree(pTrunkIF);
     1324    }
     1325    LogFlow(("intnetNetworkCreateTrunkConnection: %Rrc - pszName=%s szTrunk=%s Network=%s\n",
     1326             rc, pszName, pNetwork->szTrunk, pNetwork->szName));
     1327    return rc;
     1328#else
    12761329    return VERR_NOT_IMPLEMENTED;
     1330#endif
    12771331}
    12781332
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette