Changeset 22375 in vbox for trunk/src/VBox/Devices/Network/DrvNetSniffer.cpp
- Timestamp:
- Aug 20, 2009 1:42:49 PM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 51307
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/DrvNetSniffer.cpp
r22277 r22375 277 277 278 278 /** 279 * Detach a driver instance. 280 * 281 * @param pDrvIns The driver instance. 282 * @param fFlags Flags, combination of the PDM_TACH_FLAGS_* \#defines. 283 */ 284 static DECLCALLBACK(void) drvNetSnifferDetach(PPDMDRVINS pDrvIns, uint32_t fFlags) 285 { 286 PDRVNETSNIFFER pThis = PDMINS_2_DATA(pDrvIns, PDRVNETSNIFFER); 287 288 LogFlow(("drvNetSnifferDetach: pDrvIns: %p, fFlags: %u\n", pDrvIns, fFlags)); 289 290 pThis->pConnector = NULL; 291 pThis->pPort = NULL; 292 pThis->pConfig = NULL; 293 } 294 295 296 /** 297 * Attach a driver instance. 298 * 299 * @returns VBox status code. 300 * @param pDrvIns The driver instance. 301 * @param fFlags Flags, combination of the PDM_TACH_FLAGS_* \#defines. 302 */ 303 static DECLCALLBACK(int) drvNetSnifferAttach(PPDMDRVINS pDrvIns, uint32_t fFlags) 304 { 305 PDRVNETSNIFFER pThis = PDMINS_2_DATA(pDrvIns, PDRVNETSNIFFER); 306 307 LogFlow(("drvNetSnifferAttach: pDrvIns: %p, fFlags: %u\n", pDrvIns, fFlags)); 308 309 /* 310 * Query the network port interface. 311 */ 312 pThis->pPort = (PPDMINETWORKPORT)pDrvIns->pUpBase->pfnQueryInterface(pDrvIns->pUpBase, PDMINTERFACE_NETWORK_PORT); 313 if (!pThis->pPort) 314 { 315 AssertMsgFailed(("Configuration error: the above device/driver didn't export the network port interface!\n")); 316 return VERR_PDM_MISSING_INTERFACE_ABOVE; 317 } 318 319 /* 320 * Query the network config interface. 321 */ 322 pThis->pConfig = (PPDMINETWORKCONFIG)pDrvIns->pUpBase->pfnQueryInterface(pDrvIns->pUpBase, PDMINTERFACE_NETWORK_CONFIG); 323 if (!pThis->pConfig) 324 { 325 AssertMsgFailed(("Configuration error: the above device/driver didn't export the network config interface!\n")); 326 return VERR_PDM_MISSING_INTERFACE_ABOVE; 327 } 328 329 /* 330 * Query the network connector interface. 331 */ 332 PPDMIBASE pBaseDown; 333 int rc = PDMDrvHlpAttach(pDrvIns, fFlags, &pBaseDown); 334 if (rc == VERR_PDM_NO_ATTACHED_DRIVER) 335 pThis->pConnector = NULL; 336 else if (RT_SUCCESS(rc)) 337 { 338 pThis->pConnector = (PPDMINETWORKCONNECTOR)pBaseDown->pfnQueryInterface(pBaseDown, PDMINTERFACE_NETWORK_CONNECTOR); 339 if (!pThis->pConnector) 340 { 341 AssertMsgFailed(("Configuration error: the driver below didn't export the network connector interface!\n")); 342 return VERR_PDM_MISSING_INTERFACE_BELOW; 343 } 344 } 345 else 346 { 347 AssertMsgFailed(("Failed to attach to driver below! rc=%Rrc\n", rc)); 348 return rc; 349 } 350 351 return VINF_SUCCESS; 352 } 353 354 355 /** 279 356 * Destruct a driver instance. 280 357 * … … 454 531 NULL, 455 532 /* pfnAttach */ 456 NULL,533 drvNetSnifferAttach, 457 534 /* pfnDetach */ 458 NULL,535 drvNetSnifferDetach, 459 536 /* pfnPowerOff */ 460 NULL, 537 NULL, 461 538 /* pfnSoftReset */ 462 539 NULL,
Note:
See TracChangeset
for help on using the changeset viewer.