Changeset 10451 in vbox for trunk/src/VBox/Devices/Network/SrvIntNetR0.cpp
- Timestamp:
- Jul 9, 2008 9:57:49 PM (17 years ago)
- svn:sync-xref-src-repo-rev:
- 33118
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/SrvIntNetR0.cpp
r10076 r10451 613 613 { 614 614 AssertReturn(cbFrame < 0x8000, VERR_INVALID_PARAMETER); 615 Assert Return(VALID_PTR(pvFrame), VERR_INVALID_PARAMETER);616 Assert Return(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); 617 617 618 618 /* This is the better place to crash, probe the buffer. */ … … 687 687 if (!pIf) 688 688 return VERR_INVALID_HANDLE; 689 Assert Return(VALID_PTR(ppRing3Buf), VERR_INVALID_PARAMETER);689 AssertPtrReturn(ppRing3Buf, VERR_INVALID_PARAMETER); 690 690 691 691 /* … … 740 740 if (!pIf) 741 741 return VERR_INVALID_HANDLE; 742 Assert Return(VALID_PTR(ppRing0Buf), VERR_INVALID_PARAMETER);742 AssertPtrReturn(ppRing0Buf, VERR_INVALID_PARAMETER); 743 743 744 744 /* … … 776 776 if (!pIf) 777 777 return VERR_INVALID_HANDLE; 778 Assert Return(VALID_PTR(paPages), VERR_INVALID_PARAMETER);779 Assert Return(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); 780 780 781 781 /* … … 933 933 * Get and validate essential handles. 934 934 */ 935 Assert Return(VALID_PTR(pIntNet), VERR_INVALID_PARAMETER);935 AssertPtrReturn(pIntNet, VERR_INVALID_PARAMETER); 936 936 PINTNETIF pIf = INTNETHandle2IFPtr(pIntNet, hIf); 937 937 if (!pIf) … … 1094 1094 * Assert input. 1095 1095 */ 1096 Assert (VALID_PTR(pNetwork));1097 Assert (VALID_PTR(phIf));1096 AssertPtr(pNetwork); 1097 AssertPtr(phIf); 1098 1098 1099 1099 /* … … 1193 1193 { 1194 1194 LogFlow(("INTNETNetworkClose: pNetwork=%p pSession=%p\n", pNetwork, pSession)); 1195 Assert Return(VALID_PTR(pSession), VERR_INVALID_PARAMETER);1196 Assert Return(VALID_PTR(pNetwork), VERR_INVALID_PARAMETER);1195 AssertPtrReturn(pSession, VERR_INVALID_PARAMETER); 1196 AssertPtrReturn(pNetwork, VERR_INVALID_PARAMETER); 1197 1197 PINTNET pIntNet = pNetwork->pIntNet; 1198 1198 RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER; … … 1282 1282 pIntNet, pSession, pszNetwork, pszNetwork, ppNetwork)); 1283 1283 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); 1288 1288 *ppNetwork = NULL; 1289 1289 … … 1354 1354 pIntNet, pSession, pszNetwork, pszNetwork, ppNetwork)); 1355 1355 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); 1360 1360 *ppNetwork = NULL; 1361 1361 … … 1443 1443 * @param pSession The session handle. 1444 1444 * @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. 1445 1449 * @param cbSend The send buffer size. 1446 1450 * @param cbRecv The receive buffer size. 1447 * @param fRestrictAccess Whether new participants should be subjected to access check or not.1448 1451 * @param phIf Where to store the handle to the network interface. 1449 1452 */ 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)); 1453 INTNETR0DECL(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)); 1454 1459 1455 1460 /* 1456 1461 * Validate input. 1457 1462 */ 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); 1460 1466 const char *pszNetworkEnd = (const char *)memchr(pszNetwork, '\0', INTNET_MAX_NETWORK_NAME); 1461 1467 AssertReturn(pszNetworkEnd, VERR_INVALID_PARAMETER); 1462 1468 size_t cchNetwork = pszNetworkEnd - pszNetwork; 1463 1469 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); 1465 1498 1466 1499 /* … … 1477 1510 rc = INTNETOpenNetwork(pIntNet, pSession, pszNetwork, &pNetwork); 1478 1511 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); 1480 1513 if (VBOX_SUCCESS(rc)) 1481 1514 { … … 1509 1542 if (RT_UNLIKELY(pReq->Hdr.cbReq != sizeof(*pReq))) 1510 1543 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); 1512 1546 } 1513 1547
Note:
See TracChangeset
for help on using the changeset viewer.