VirtualBox

Ignore:
Timestamp:
Jul 9, 2008 9:57:49 PM (17 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
33118
Message:

Modified the INTNETR0Open interface and PDM driver configuration to take a trunk connection type and name. Also, changed the fRestrictAccess into a generic flag argument (CFGM value unchanged).

File:
1 edited

Legend:

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

    r10076 r10451  
    613613    {
    614614        AssertReturn(cbFrame < 0x8000, VERR_INVALID_PARAMETER);
    615         AssertReturn(VALID_PTR(pvFrame), VERR_INVALID_PARAMETER);
    616         AssertReturn(VALID_PTR((uint8_t *)pvFrame + cbFrame - 1), VERR_INVALID_PARAMETER);
     615        AssertPtrReturn(pvFrame, VERR_INVALID_PARAMETER);
     616        AssertPtrReturn((uint8_t *)pvFrame + cbFrame - 1, VERR_INVALID_PARAMETER);
    617617
    618618        /* This is the better place to crash, probe the buffer. */
     
    687687    if (!pIf)
    688688        return VERR_INVALID_HANDLE;
    689     AssertReturn(VALID_PTR(ppRing3Buf), VERR_INVALID_PARAMETER);
     689    AssertPtrReturn(ppRing3Buf, VERR_INVALID_PARAMETER);
    690690
    691691    /*
     
    740740    if (!pIf)
    741741        return VERR_INVALID_HANDLE;
    742     AssertReturn(VALID_PTR(ppRing0Buf), VERR_INVALID_PARAMETER);
     742    AssertPtrReturn(ppRing0Buf, VERR_INVALID_PARAMETER);
    743743
    744744    /*
     
    776776    if (!pIf)
    777777        return VERR_INVALID_HANDLE;
    778     AssertReturn(VALID_PTR(paPages), VERR_INVALID_PARAMETER);
    779     AssertReturn(VALID_PTR((uint8_t *)&paPages[cPages] - 1), VERR_INVALID_PARAMETER);
     778    AssertPtrReturn(paPages, VERR_INVALID_PARAMETER);
     779    AssertPtrReturn((uint8_t *)&paPages[cPages] - 1, VERR_INVALID_PARAMETER);
    780780
    781781    /*
     
    933933     * Get and validate essential handles.
    934934     */
    935     AssertReturn(VALID_PTR(pIntNet), VERR_INVALID_PARAMETER);
     935    AssertPtrReturn(pIntNet, VERR_INVALID_PARAMETER);
    936936    PINTNETIF pIf = INTNETHandle2IFPtr(pIntNet, hIf);
    937937    if (!pIf)
     
    10941094     * Assert input.
    10951095     */
    1096     Assert(VALID_PTR(pNetwork));
    1097     Assert(VALID_PTR(phIf));
     1096    AssertPtr(pNetwork);
     1097    AssertPtr(phIf);
    10981098
    10991099    /*
     
    11931193{
    11941194    LogFlow(("INTNETNetworkClose: pNetwork=%p pSession=%p\n", pNetwork, pSession));
    1195     AssertReturn(VALID_PTR(pSession), VERR_INVALID_PARAMETER);
    1196     AssertReturn(VALID_PTR(pNetwork), VERR_INVALID_PARAMETER);
     1195    AssertPtrReturn(pSession, VERR_INVALID_PARAMETER);
     1196    AssertPtrReturn(pNetwork, VERR_INVALID_PARAMETER);
    11971197    PINTNET         pIntNet = pNetwork->pIntNet;
    11981198    RTSPINLOCKTMP   Tmp = RTSPINLOCKTMP_INITIALIZER;
     
    12821282             pIntNet, pSession, pszNetwork, pszNetwork, ppNetwork));
    12831283
    1284     Assert(VALID_PTR(pIntNet));
    1285     Assert(VALID_PTR(pSession));
    1286     Assert(VALID_PTR(pszNetwork));
    1287     Assert(VALID_PTR(ppNetwork));
     1284    AssertPtr(pIntNet);
     1285    AssertPtr(pSession);
     1286    AssertPtr(pszNetwork);
     1287    AssertPtr(ppNetwork);
    12881288    *ppNetwork = NULL;
    12891289
     
    13541354             pIntNet, pSession, pszNetwork, pszNetwork, ppNetwork));
    13551355
    1356     Assert(VALID_PTR(pIntNet));
    1357     Assert(VALID_PTR(pSession));
    1358     Assert(VALID_PTR(pszNetwork));
    1359     Assert(VALID_PTR(ppNetwork));
     1356    AssertPtr(pIntNet);
     1357    AssertPtr(pSession);
     1358    AssertPtr(pszNetwork);
     1359    AssertPtr(ppNetwork);
    13601360    *ppNetwork = NULL;
    13611361
     
    14431443 * @param   pSession        The session handle.
    14441444 * @param   pszNetwork      The network name.
     1445 * @param   enmTrunkType    The trunk type.
     1446 * @param   pszTrunk        The trunk name. Its meaning is specfic to the type.
     1447 * @param   fFlags          Flags, see INTNET_OPEN_FLAGS_*.
     1448 * @param   fRestrictAccess Whether new participants should be subjected to access check or not.
    14451449 * @param   cbSend          The send buffer size.
    14461450 * @param   cbRecv          The receive buffer size.
    1447  * @param   fRestrictAccess Whether new participants should be subjected to access check or not.
    14481451 * @param   phIf            Where to store the handle to the network interface.
    14491452 */
    1450 INTNETR0DECL(int) INTNETR0Open(PINTNET pIntNet, PSUPDRVSESSION pSession, const char *pszNetwork, unsigned cbSend, unsigned cbRecv, bool fRestrictAccess, PINTNETIFHANDLE phIf)
    1451 {
    1452     LogFlow(("INTNETR0Open: pIntNet=%p pSession=%p pszNetwork=%p:{%s} cbSend=%u cbRecv=%u phIf=%p\n",
    1453              pIntNet, pSession, pszNetwork, pszNetwork, cbSend, cbRecv, phIf));
     1453INTNETR0DECL(int) INTNETR0Open(PINTNET pIntNet, PSUPDRVSESSION pSession, const char *pszNetwork,
     1454                               INTNETTRUNKTYPE enmTrunkType, const char *pszTrunk, uint32_t fFlags,
     1455                               unsigned cbSend, unsigned cbRecv, PINTNETIFHANDLE phIf)
     1456{
     1457    LogFlow(("INTNETR0Open: pIntNet=%p pSession=%p pszNetwork=%p:{%s} enmTrunkType=%d pszTrunk=%p:{%s} fFlags=%#x cbSend=%u cbRecv=%u phIf=%p\n",
     1458             pIntNet, pSession, pszNetwork, pszNetwork, pszTrunk, pszTrunk, enmTrunkType, fFlags, cbSend, cbRecv, phIf));
    14541459
    14551460    /*
    14561461     * Validate input.
    14571462     */
    1458     AssertReturn(VALID_PTR(pIntNet), VERR_INVALID_PARAMETER);
    1459     AssertReturn(VALID_PTR(pszNetwork), VERR_INVALID_PARAMETER);
     1463    AssertPtrReturn(pIntNet, VERR_INVALID_PARAMETER);
     1464
     1465    AssertPtrReturn(pszNetwork, VERR_INVALID_PARAMETER);
    14601466    const char *pszNetworkEnd = (const char *)memchr(pszNetwork, '\0', INTNET_MAX_NETWORK_NAME);
    14611467    AssertReturn(pszNetworkEnd, VERR_INVALID_PARAMETER);
    14621468    size_t cchNetwork = pszNetworkEnd - pszNetwork;
    14631469    AssertReturn(cchNetwork, VERR_INVALID_PARAMETER);
    1464     AssertReturn(VALID_PTR(phIf), VERR_INVALID_PARAMETER);
     1470
     1471    if (pszTrunk)
     1472    {
     1473        AssertPtrReturn(pszTrunk, VERR_INVALID_PARAMETER);
     1474        const char *pszTrunkEnd = (const char *)memchr(pszTrunk, '\0', INTNET_MAX_TRUNK_NAME);
     1475        AssertReturn(pszTrunkEnd, VERR_INVALID_PARAMETER);
     1476        if (pszTrunkEnd == pszTrunk)
     1477            pszTrunk = NULL;
     1478    }
     1479    AssertMsgReturn(enmTrunkType > kIntNetTrunkType_Invalid && enmTrunkType < kIntNetTrunkType_End,
     1480                    ("%d\n", enmTrunkType), VERR_INVALID_PARAMETER);
     1481    switch (enmTrunkType)
     1482    {
     1483        case kIntNetTrunkType_None:
     1484        case kIntNetTrunkType_WhateverNone:
     1485            AssertReturn(!pszTrunk, VERR_INVALID_PARAMETER);
     1486            break;
     1487
     1488        case kIntNetTrunkType_NetFlt:
     1489            AssertReturn(pszTrunk, VERR_INVALID_PARAMETER);
     1490            break;
     1491
     1492        default:
     1493            return VERR_NOT_IMPLEMENTED;
     1494    }
     1495
     1496    AssertMsgReturn(fFlags & ~(INTNET_OPEN_FLAGS_PUBLIC), ("%#x\n", fFlags), VERR_INVALID_PARAMETER);
     1497    AssertPtrReturn(phIf, VERR_INVALID_PARAMETER);
    14651498
    14661499    /*
     
    14771510    rc = INTNETOpenNetwork(pIntNet, pSession, pszNetwork, &pNetwork);
    14781511    if (rc == VERR_FILE_NOT_FOUND)
    1479         rc = INTNETCreateNetwork(pIntNet, pSession, pszNetwork, fRestrictAccess, &pNetwork);
     1512        rc = INTNETCreateNetwork(pIntNet, pSession, pszNetwork, !(fFlags & INTNET_OPEN_FLAGS_PUBLIC), &pNetwork);
    14801513    if (VBOX_SUCCESS(rc))
    14811514    {
     
    15091542    if (RT_UNLIKELY(pReq->Hdr.cbReq != sizeof(*pReq)))
    15101543        return VERR_INVALID_PARAMETER;
    1511     return INTNETR0Open(pIntNet, pSession, &pReq->szNetwork[0], pReq->cbSend, pReq->cbRecv, pReq->fRestrictAccess, &pReq->hIf);
     1544    return INTNETR0Open(pIntNet, pSession, &pReq->szNetwork[0], pReq->enmTrunkType, pReq->szTrunk,
     1545                        pReq->fFlags, pReq->cbSend, pReq->cbRecv, &pReq->hIf);
    15121546}
    15131547
Note: See TracChangeset for help on using the changeset viewer.

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