Changeset 10806 in vbox for trunk/src/VBox/Devices
- Timestamp:
- Jul 22, 2008 11:07:38 AM (16 years ago)
- Location:
- trunk/src/VBox/Devices/Network
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/SrvIntNetR0.cpp
r10763 r10806 985 985 * @param pIntNet The instance data. 986 986 * @param hIf The interface handle. 987 * @param pSession The caller's session. 987 988 * @param pvFrame Pointer to the frame. Optional, please don't use. 988 989 * @param cbFrame Size of the frame. Optional, please don't use. 989 990 */ 990 INTNETR0DECL(int) INTNETR0IfSend(PINTNET pIntNet, INTNETIFHANDLE hIf, const void *pvFrame, unsigned cbFrame)991 INTNETR0DECL(int) INTNETR0IfSend(PINTNET pIntNet, INTNETIFHANDLE hIf, PSUPDRVSESSION pSession, const void *pvFrame, unsigned cbFrame) 991 992 { 992 993 // LogFlow(("INTNETR0IfSend: pIntNet=%p hIf=%RX32 pvFrame=%p cbFrame=%u\n", pIntNet, hIf, pvFrame, cbFrame)); … … 1095 1096 * @returns see INTNETR0IfSend. 1096 1097 * @param pIntNet The internal networking instance. 1098 * @param pSession The caller's session. 1097 1099 * @param pReq The request packet. 1098 1100 */ 1099 INTNETR0DECL(int) INTNETR0IfSendReq(PINTNET pIntNet, P INTNETIFSENDREQ pReq)1101 INTNETR0DECL(int) INTNETR0IfSendReq(PINTNET pIntNet, PSUPDRVSESSION pSession, PINTNETIFSENDREQ pReq) 1100 1102 { 1101 1103 if (RT_UNLIKELY(pReq->Hdr.cbReq != sizeof(*pReq))) 1102 1104 return VERR_INVALID_PARAMETER; 1103 return INTNETR0IfSend(pIntNet, pReq->hIf, NULL, 0);1105 return INTNETR0IfSend(pIntNet, pReq->hIf, pSession, NULL, 0); 1104 1106 } 1105 1107 … … 1109 1111 * 1110 1112 * @returns VBox status code. 1111 * @param pIntNet The instance data. 1112 * @param hIf The interface handle. 1113 * @param ppRing3Buf Where to store the address of the ring-3 mapping. 1114 */ 1115 INTNETR0DECL(int) INTNETR0IfGetRing3Buffer(PINTNET pIntNet, INTNETIFHANDLE hIf, R3PTRTYPE(PINTNETBUF) *ppRing3Buf) 1113 * @param pIntNet The instance data. 1114 * @param hIf The interface handle. 1115 * @param pSession The caller's session. 1116 * @param ppRing3Buf Where to store the address of the ring-3 mapping. 1117 */ 1118 INTNETR0DECL(int) INTNETR0IfGetRing3Buffer(PINTNET pIntNet, INTNETIFHANDLE hIf, PSUPDRVSESSION pSession, R3PTRTYPE(PINTNETBUF) *ppRing3Buf) 1116 1119 { 1117 1120 LogFlow(("INTNETR0IfGetRing3Buffer: pIntNet=%p hIf=%RX32 ppRing3Buf=%p\n", pIntNet, hIf, ppRing3Buf)); … … 1148 1151 * @returns see INTNETR0IfGetRing3Buffer. 1149 1152 * @param pIntNet The internal networking instance. 1153 * @param pSession The caller's session. 1150 1154 * @param pReq The request packet. 1151 1155 */ 1152 INTNETR0DECL(int) INTNETR0IfGetRing3BufferReq(PINTNET pIntNet, P INTNETIFGETRING3BUFFERREQ pReq)1156 INTNETR0DECL(int) INTNETR0IfGetRing3BufferReq(PINTNET pIntNet, PSUPDRVSESSION pSession, PINTNETIFGETRING3BUFFERREQ pReq) 1153 1157 { 1154 1158 if (RT_UNLIKELY(pReq->Hdr.cbReq != sizeof(*pReq))) 1155 1159 return VERR_INVALID_PARAMETER; 1156 return INTNETR0IfGetRing3Buffer(pIntNet, pReq->hIf, &pReq->pRing3Buf);1160 return INTNETR0IfGetRing3Buffer(pIntNet, pReq->hIf, pSession, &pReq->pRing3Buf); 1157 1161 } 1158 1162 … … 1243 1247 * @param pIntNet The instance handle. 1244 1248 * @param hIf The interface handle. 1249 * @param pSession The caller's session. 1245 1250 * @param fPromiscuous Set if the interface should be in promiscuous mode, clear if not. 1246 1251 */ 1247 INTNETR0DECL(int) INTNETR0IfSetPromiscuousMode(PINTNET pIntNet, INTNETIFHANDLE hIf, bool fPromiscuous)1252 INTNETR0DECL(int) INTNETR0IfSetPromiscuousMode(PINTNET pIntNet, INTNETIFHANDLE hIf, PSUPDRVSESSION pSession, bool fPromiscuous) 1248 1253 { 1249 1254 LogFlow(("INTNETR0IfSetPromiscuousMode: pIntNet=%p hIf=%RX32 fPromiscuous=%d\n", pIntNet, hIf, fPromiscuous)); … … 1287 1292 * @returns see INTNETR0IfSetPromiscuousMode. 1288 1293 * @param pIntNet The internal networking instance. 1294 * @param pSession The caller's session. 1289 1295 * @param pReq The request packet. 1290 1296 */ 1291 INTNETR0DECL(int) INTNETR0IfSetPromiscuousModeReq(PINTNET pIntNet, P INTNETIFSETPROMISCUOUSMODEREQ pReq)1297 INTNETR0DECL(int) INTNETR0IfSetPromiscuousModeReq(PINTNET pIntNet, PSUPDRVSESSION pSession, PINTNETIFSETPROMISCUOUSMODEREQ pReq) 1292 1298 { 1293 1299 if (RT_UNLIKELY(pReq->Hdr.cbReq != sizeof(*pReq))) 1294 1300 return VERR_INVALID_PARAMETER; 1295 return INTNETR0IfSetPromiscuousMode(pIntNet, pReq->hIf, p Req->fPromiscuous);1301 return INTNETR0IfSetPromiscuousMode(pIntNet, pReq->hIf, pSession, pReq->fPromiscuous); 1296 1302 } 1297 1303 … … 1395 1401 * 1396 1402 * @returns VBox status code. 1397 * @param pIntNet The instance handle. 1398 * @param hIf The interface handle. 1399 * @param cMillies Number of milliseconds to wait. RT_INDEFINITE_WAIT should be 1400 * used if indefinite wait is desired. 1401 */ 1402 INTNETR0DECL(int) INTNETR0IfWait(PINTNET pIntNet, INTNETIFHANDLE hIf, uint32_t cMillies) 1403 * @param pIntNet The instance handle. 1404 * @param hIf The interface handle. 1405 * @param pSession The caller's session. 1406 * @param cMillies Number of milliseconds to wait. RT_INDEFINITE_WAIT should be 1407 * used if indefinite wait is desired. 1408 */ 1409 INTNETR0DECL(int) INTNETR0IfWait(PINTNET pIntNet, INTNETIFHANDLE hIf, PSUPDRVSESSION pSession, uint32_t cMillies) 1403 1410 { 1404 1411 // LogFlow(("INTNETR0IfWait: pIntNet=%p hIf=%RX32 cMillies=%u\n", pIntNet, hIf, cMillies)); … … 1455 1462 * @returns see INTNETR0IfWait. 1456 1463 * @param pIntNet The internal networking instance. 1464 * @param pSession The caller's session. 1457 1465 * @param pReq The request packet. 1458 1466 */ 1459 INTNETR0DECL(int) INTNETR0IfWaitReq(PINTNET pIntNet, P INTNETIFWAITREQ pReq)1467 INTNETR0DECL(int) INTNETR0IfWaitReq(PINTNET pIntNet, PSUPDRVSESSION pSession, PINTNETIFWAITREQ pReq) 1460 1468 { 1461 1469 if (RT_UNLIKELY(pReq->Hdr.cbReq != sizeof(*pReq))) 1462 1470 return VERR_INVALID_PARAMETER; 1463 return INTNETR0IfWait(pIntNet, pReq->hIf, p Req->cMillies);1471 return INTNETR0IfWait(pIntNet, pReq->hIf, pSession, pReq->cMillies); 1464 1472 } 1465 1473 … … 1471 1479 * @param pIntNet The instance handle. 1472 1480 * @param hIf The interface handle. 1473 */ 1474 INTNETR0DECL(int) INTNETR0IfClose(PINTNET pIntNet, INTNETIFHANDLE hIf) 1481 * @param pSession The caller's session. 1482 */ 1483 INTNETR0DECL(int) INTNETR0IfClose(PINTNET pIntNet, INTNETIFHANDLE hIf, PSUPDRVSESSION pSession) 1475 1484 { 1476 1485 LogFlow(("INTNETR0IfClose: pIntNet=%p hIf=%RX32\n", pIntNet, hIf)); … … 1499 1508 * @returns see INTNETR0IfClose. 1500 1509 * @param pIntNet The internal networking instance. 1510 * @param pSession The caller's session. 1501 1511 * @param pReq The request packet. 1502 1512 */ 1503 INTNETR0DECL(int) INTNETR0IfCloseReq(PINTNET pIntNet, P INTNETIFCLOSEREQ pReq)1513 INTNETR0DECL(int) INTNETR0IfCloseReq(PINTNET pIntNet, PSUPDRVSESSION pSession, PINTNETIFCLOSEREQ pReq) 1504 1514 { 1505 1515 if (RT_UNLIKELY(pReq->Hdr.cbReq != sizeof(*pReq))) 1506 1516 return VERR_INVALID_PARAMETER; 1507 return INTNETR0IfClose(pIntNet, pReq->hIf );1517 return INTNETR0IfClose(pIntNet, pReq->hIf, pSession); 1508 1518 } 1509 1519 … … 2500 2510 * @returns see GMMR0MapUnmapChunk. 2501 2511 * @param pIntNet The internal networking instance. 2502 * @param pSession The session handle.2512 * @param pSession The caller's session. 2503 2513 * @param pReq The request packet. 2504 2514 */ -
trunk/src/VBox/Devices/Network/testcase/tstIntNet-1.cpp
r10764 r10806 583 583 { "--duration", 'd', RTGETOPT_REQ_UINT32 }, 584 584 { "--file", 'f', RTGETOPT_REQ_STRING }, 585 { "--interface", 'i', RTGETOPT_REQ_STRING }, 585 586 { "--network", 'n', RTGETOPT_REQ_STRING }, 586 587 { "--promiscuous", 'p', RTGETOPT_REQ_NOTHING }, … … 590 591 { "--text-file", 't', RTGETOPT_REQ_STRING }, 591 592 { "--xmit-test", 'x', RTGETOPT_REQ_NOTHING }, 593 { "--help", 'h', RTGETOPT_REQ_NOTHING }, 594 { "--?", '?', RTGETOPT_REQ_NOTHING }, 592 595 }; 593 596 … … 697 700 case '?': 698 701 case 'h': 699 RTPrintf("syntax: tstIntNet-1 [-pSt ] [-d <secs>] [-f <file>] [-r <size>] [-s <size>]\n");702 RTPrintf("syntax: tstIntNet-1 [-pStx-] [-d <secs>] [-f <file>] [-r <size>] [-s <size>]\n"); 700 703 return 1; 701 704 … … 703 706 if (RT_SUCCESS(ch)) 704 707 RTPrintf("tstIntNetR0: invalid argument (%#x): %s\n", ch, Value.psz); 708 else if (Value.pDef) 709 RTPrintf("tstIntNetR0: invalid argument: %Rrc - %s\n", ch, Value.pDef->pszLong); 705 710 else 706 RTPrintf("tstIntNetR0: invalid argument: %Rrc - \n", ch, Value.pDef->pszLong);711 RTPrintf("tstIntNetR0: invalid argument: %Rrc - %s\n", ch, argv[iArg]); 707 712 return 1; 708 713 } -
trunk/src/VBox/Devices/Network/testcase/tstIntNetR0.cpp
r10740 r10806 102 102 struct TESTFRAME 103 103 { 104 uint16_t au16[ 6];105 } g_TestFrame0 = { { /* dst:*/ 0xffff, 0xffff, 0xffff, /*src:*/0x8086, 0, 0 } },106 g_TestFrame1 = { { /* dst:*/ 0, 0, 0, /*src:*/0x8086, 0, 1} };104 uint16_t au16[7]; 105 } g_TestFrame0 = { { /* dst:*/ 0xffff, 0xffff, 0xffff, /*src:*/0x8086, 0, 0, 0x0800 } }, 106 g_TestFrame1 = { { /* dst:*/ 0, 0, 0, /*src:*/0x8086, 0, 1, 0x0800 } }; 107 107 108 108 … … 240 240 *puFrame = iFrame; 241 241 #if 0 242 int rc = INTNETR0IfSend(pArgs->pIntNet, pArgs->hIf, abBuf, cb);242 int rc = INTNETR0IfSend(pArgs->pIntNet, pArgs->hIf, g_pSession, abBuf, cb); 243 243 #else 244 244 INTNETSG Sg; … … 246 246 int rc = intnetR0RingWriteFrame(pArgs->pBuf, &pArgs->pBuf->Send, &Sg); 247 247 if (RT_SUCCESS(rc)) 248 rc = INTNETR0IfSend(pArgs->pIntNet, pArgs->hIf, NULL, 0);248 rc = INTNETR0IfSend(pArgs->pIntNet, pArgs->hIf, g_pSession, NULL, 0); 249 249 #endif 250 250 if (VBOX_FAILURE(rc)) … … 265 265 for (unsigned c = 0; c < 20; c++) 266 266 { 267 int rc = INTNETR0IfSend(pArgs->pIntNet, pArgs->hIf, abBuf, sizeof(PDMMAC) * 2 + sizeof(unsigned) * 4);267 int rc = INTNETR0IfSend(pArgs->pIntNet, pArgs->hIf, g_pSession, abBuf, sizeof(PDMMAC) * 2 + sizeof(unsigned) * 4); 268 268 if (VBOX_FAILURE(rc)) 269 269 { … … 297 297 * Wait for data. 298 298 */ 299 int rc = INTNETR0IfWait(pArgs->pIntNet, pArgs->hIf, RT_INDEFINITE_WAIT);299 int rc = INTNETR0IfWait(pArgs->pIntNet, pArgs->hIf, g_pSession, RT_INDEFINITE_WAIT); 300 300 switch (rc) 301 301 { … … 467 467 * Test basic waiting. 468 468 */ 469 rc = INTNETR0IfWait(pIntNet, hIf0, 1);469 rc = INTNETR0IfWait(pIntNet, hIf0, g_pSession, 1); 470 470 if (rc != VERR_TIMEOUT) 471 471 { … … 473 473 g_cErrors++; 474 474 } 475 rc = INTNETR0IfWait(pIntNet, hIf1, 0);475 rc = INTNETR0IfWait(pIntNet, hIf1, g_pSession, 0); 476 476 if (rc != VERR_TIMEOUT) 477 477 { … … 483 483 * Send and receive. 484 484 */ 485 rc = INTNETR0IfSend(pIntNet, hIf0, &g_TestFrame0, sizeof(g_TestFrame0));485 rc = INTNETR0IfSend(pIntNet, hIf0, g_pSession, &g_TestFrame0, sizeof(g_TestFrame0)); 486 486 if (VBOX_SUCCESS(rc)) 487 487 { 488 rc = INTNETR0IfWait(pIntNet, hIf0, 1);488 rc = INTNETR0IfWait(pIntNet, hIf0, g_pSession, 1); 489 489 if (rc != VERR_TIMEOUT) 490 490 { … … 492 492 g_cErrors++; 493 493 } 494 rc = INTNETR0IfWait(pIntNet, hIf1, 0);494 rc = INTNETR0IfWait(pIntNet, hIf1, g_pSession, 0); 495 495 if (rc == VINF_SUCCESS) 496 496 { … … 521 521 * Send a packet from If1 just to set its MAC address. 522 522 */ 523 rc = INTNETR0IfSend(pIntNet, hIf1, &g_TestFrame1, sizeof(g_TestFrame1));523 rc = INTNETR0IfSend(pIntNet, hIf1, g_pSession, &g_TestFrame1, sizeof(g_TestFrame1)); 524 524 if (VBOX_FAILURE(rc)) 525 525 { … … 627 627 } 628 628 629 rc = INTNETR0IfClose(pIntNet, hIf0 );629 rc = INTNETR0IfClose(pIntNet, hIf0, g_pSession); 630 630 if (VBOX_SUCCESS(rc)) 631 631 { … … 639 639 } 640 640 641 rc = INTNETR0IfClose(pIntNet, hIf1 );641 rc = INTNETR0IfClose(pIntNet, hIf1, g_pSession); 642 642 if (VBOX_SUCCESS(rc)) 643 643 { … … 700 700 701 701 if (hIf1 != INTNET_HANDLE_INVALID) 702 rc = INTNETR0IfClose(pIntNet, hIf1 );702 rc = INTNETR0IfClose(pIntNet, hIf1, g_pSession); 703 703 } 704 704 else … … 709 709 710 710 if (hIf0 != INTNET_HANDLE_INVALID) 711 rc = INTNETR0IfClose(pIntNet, hIf0 );711 rc = INTNETR0IfClose(pIntNet, hIf0, g_pSession); 712 712 } 713 713 else
Note:
See TracChangeset
for help on using the changeset viewer.