Changeset 10009 in vbox for trunk/src/VBox/Devices
- Timestamp:
- Jun 30, 2008 9:05:06 AM (17 years ago)
- svn:sync-xref-src-repo-rev:
- 32477
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/DrvNetSniffer.cpp
r8155 r10009 52 52 /** The network interface. */ 53 53 PDMINETWORKPORT INetworkPort; 54 /** The network config interface. */ 55 PDMINETWORKCONFIG INetworkConfig; 54 56 /** The port we're attached to. */ 55 57 PPDMINETWORKPORT pPort; 58 /** The config port interface we're attached to. */ 59 PPDMINETWORKCONFIG pConfig; 56 60 /** The connector that's attached to us. */ 57 61 PPDMINETWORKCONNECTOR pConnector; … … 72 76 /** Converts a pointer to NAT::INetworkPort to a PDRVNETSNIFFER. */ 73 77 #define PDMINETWORKPORT_2_DRVNETSNIFFER(pInterface) ( (PDRVNETSNIFFER)((uintptr_t)pInterface - RT_OFFSETOF(DRVNETSNIFFER, INetworkPort)) ) 78 79 /** Converts a pointer to NAT::INetworkConfig to a PDRVNETSNIFFER. */ 80 #define PDMINETWORKCONFIG_2_DRVNETSNIFFER(pInterface) ( (PDRVNETSNIFFER)((uintptr_t)pInterface - RT_OFFSETOF(DRVNETSNIFFER, INetworkConfig)) ) 74 81 75 82 … … 240 247 } 241 248 249 250 /** 251 * Gets the current Media Access Control (MAC) address. 252 * 253 * @returns VBox status code. 254 * @param pInterface Pointer to the interface structure containing the called function pointer. 255 * @param pMac Where to store the MAC address. 256 * @thread EMT 257 */ 258 static DECLCALLBACK(int) drvNetSnifferGetMac(PPDMINETWORKCONFIG pInterface, PPDMMAC pMac) 259 { 260 PDRVNETSNIFFER pData = PDMINETWORKCONFIG_2_DRVNETSNIFFER(pInterface); 261 return pData->pConfig->pfnGetMac(pData->pConfig, pMac); 262 } 263 264 /** 265 * Gets the new link state. 266 * 267 * @returns The current link state. 268 * @param pInterface Pointer to the interface structure containing the called function pointer. 269 * @thread EMT 270 */ 271 static DECLCALLBACK(PDMNETWORKLINKSTATE) drvNetSnifferGetLinkState(PPDMINETWORKCONFIG pInterface) 272 { 273 PDRVNETSNIFFER pData = PDMINETWORKCONFIG_2_DRVNETSNIFFER(pInterface); 274 return pData->pConfig->pfnGetLinkState(pData->pConfig); 275 } 276 277 /** 278 * Sets the new link state. 279 * 280 * @returns VBox status code. 281 * @param pInterface Pointer to the interface structure containing the called function pointer. 282 * @param enmState The new link state 283 * @thread EMT 284 */ 285 static DECLCALLBACK(int) drvNetSnifferSetLinkState(PPDMINETWORKCONFIG pInterface, PDMNETWORKLINKSTATE enmState) 286 { 287 PDRVNETSNIFFER pData = PDMINETWORKCONFIG_2_DRVNETSNIFFER(pInterface); 288 return pData->pConfig->pfnSetLinkState(pData->pConfig, enmState); 289 } 290 291 242 292 /** 243 293 * Queries an interface to the driver. … … 261 311 case PDMINTERFACE_NETWORK_PORT: 262 312 return &pData->INetworkPort; 313 case PDMINTERFACE_NETWORK_CONFIG: 314 return &pData->INetworkConfig; 263 315 default: 264 316 return NULL; … … 325 377 pData->INetworkPort.pfnWaitReceiveAvail = drvNetSnifferWaitReceiveAvail; 326 378 pData->INetworkPort.pfnReceive = drvNetSnifferReceive; 379 /* INetworkConfig */ 380 pData->INetworkConfig.pfnGetMac = drvNetSnifferGetMac; 381 pData->INetworkConfig.pfnGetLinkState = drvNetSnifferGetLinkState; 382 pData->INetworkConfig.pfnSetLinkState = drvNetSnifferSetLinkState; 327 383 328 384 /* … … 345 401 { 346 402 AssertMsgFailed(("Configuration error: the above device/driver didn't export the network port interface!\n")); 403 return VERR_PDM_MISSING_INTERFACE_ABOVE; 404 } 405 406 /* 407 * Query the network config interface. 408 */ 409 pData->pConfig = (PPDMINETWORKCONFIG)pDrvIns->pUpBase->pfnQueryInterface(pDrvIns->pUpBase, PDMINTERFACE_NETWORK_CONFIG); 410 if (!pData->pConfig) 411 { 412 AssertMsgFailed(("Configuration error: the above device/driver didn't export the network config interface!\n")); 347 413 return VERR_PDM_MISSING_INTERFACE_ABOVE; 348 414 }
Note:
See TracChangeset
for help on using the changeset viewer.