Changeset 25966 in vbox for trunk/src/VBox/Devices/Network
- Timestamp:
- Jan 22, 2010 11:15:43 AM (15 years ago)
- Location:
- trunk/src/VBox/Devices/Network
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/DevE1000.cpp
r25876 r25966 51 51 #include <iprt/semaphore.h> 52 52 #include <iprt/string.h> 53 #include <iprt/uuid.h> 53 54 #include <VBox/pdmdev.h> 54 55 #include <VBox/tm.h> … … 832 833 /** 833 834 * Device state structure. Holds the current state of device. 835 * 836 * @implements PDMINETWORKPORT 837 * @implements PDMINETWORKCONFIG 838 * @implements PDMILEDPORTS 834 839 */ 835 840 struct E1kState_st … … 4455 4460 4456 4461 /** 4457 * Provides interfaces to the driver. 4458 * 4459 * @returns Pointer to interface. NULL if the interface is not supported. 4460 * @param pInterface Pointer to this interface structure. 4461 * @param enmInterface The requested interface identification. 4462 * @thread EMT 4463 */ 4464 static DECLCALLBACK(void *) e1kQueryInterface(struct PDMIBASE *pInterface, PDMINTERFACE enmInterface) 4465 { 4466 E1KSTATE *pState = IFACE_TO_STATE(pInterface, IBase); 4467 Assert(&pState->IBase == pInterface); 4468 switch (enmInterface) 4469 { 4470 case PDMINTERFACE_BASE: 4471 return &pState->IBase; 4472 case PDMINTERFACE_NETWORK_PORT: 4473 return &pState->INetworkPort; 4474 case PDMINTERFACE_NETWORK_CONFIG: 4475 return &pState->INetworkConfig; 4476 case PDMINTERFACE_LED_PORTS: 4477 return &pState->ILeds; 4478 default: 4479 return NULL; 4480 } 4462 * @interface_method_impl{PDMIBASE,pfnQueryInterface} 4463 */ 4464 static DECLCALLBACK(void *) e1kQueryInterface(struct PDMIBASE *pInterface, const char *pszIID) 4465 { 4466 E1KSTATE *pThis = IFACE_TO_STATE(pInterface, IBase); 4467 Assert(&pThis->IBase == pInterface); 4468 4469 if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0) 4470 return &pThis->IBase; 4471 if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_NETWORK_PORT) == 0) 4472 return &pThis->INetworkPort; 4473 if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_NETWORK_CONFIG) == 0) 4474 return &pThis->INetworkConfig; 4475 if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_LED_PORTS) == 0) 4476 return &pThis->ILeds; 4477 return NULL; 4481 4478 } 4482 4479 -
trunk/src/VBox/Devices/Network/DevINIP.cpp
r25728 r25966 47 47 #include <VBox/pdmdev.h> 48 48 #include <VBox/tm.h> 49 #include <iprt/assert.h> 49 50 #include <iprt/string.h> 50 #include <iprt/ assert.h>51 #include <iprt/uuid.h> 51 52 52 53 #include "../Builtins.h" … … 67 68 /** 68 69 * Internal Network IP stack device instance data. 70 * 71 * @implements PDMIBASE 72 * @implements PDMINETWORKPORT 69 73 */ 70 74 typedef struct DEVINTNETIP 71 75 { 72 /** The base interface . */76 /** The base interface for LUN\#0. */ 73 77 PDMIBASE IBase; 74 /** The network port this device provides . */78 /** The network port this device provides (LUN\#0). */ 75 79 PDMINETWORKPORT INetworkPort; 76 80 /** The base interface of the network driver below us. */ … … 387 391 388 392 /** 389 * Queries an interface to the device. 390 * 391 * @returns Pointer to interface. 392 * @returns NULL if the interface was not supported by the device. 393 * @param pInterface Pointer to this interface structure. 394 * @param enmInterface The requested interface identification. 395 * @thread Any thread. 393 * @interface_method_impl{PDMIBASE,pfnQueryInterface} 396 394 */ 397 395 static DECLCALLBACK(void *) devINIPQueryInterface(PPDMIBASE pInterface, 398 PDMINTERFACE enmInterface) 399 { 400 PDEVINTNETIP pThis = (PDEVINTNETIP)((uintptr_t)pInterface - RT_OFFSETOF(DEVINTNETIP, IBase)); 401 switch (enmInterface) 402 { 403 case PDMINTERFACE_BASE: 404 return &pThis->IBase; 405 case PDMINTERFACE_NETWORK_PORT: 406 return &pThis->INetworkPort; 407 default: 408 return NULL; 409 } 396 const char *pszIID) 397 { 398 PDEVINTNETIP pThis = RT_FROM_MEMBER(pInterface, DEVINTNETIP, IBase); 399 if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0) 400 return &pThis->IBase; 401 if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_NETWORK_PORT) == 0) 402 return &pThis->INetworkPort; 403 return NULL; 410 404 } 411 405 -
trunk/src/VBox/Devices/Network/DevPCNet.cpp
r25780 r25966 68 68 # include <iprt/mem.h> 69 69 # include <iprt/semaphore.h> 70 # include <iprt/uuid.h> 70 71 #endif 71 72 … … 109 110 typedef struct PCNetState_st PCNetState; 110 111 112 /** 113 * PCNET state. 114 * 115 * @extends PCIDEVICE 116 * @implements PDMIBASE 117 * @implements PDMINETWORKPORT 118 * @implements PDMINETWORKCONFIG 119 * @implements PDMILEDPORTS 120 */ 111 121 struct PCNetState_st 112 122 { … … 197 207 /** Pointer to the attached network driver. */ 198 208 R3PTRTYPE(PPDMIBASE) pDrvBase; 199 /** The base interface. */209 /** LUN\#0 + status LUN: The base interface. */ 200 210 PDMIBASE IBase; 201 /** The network port interface. */211 /** LUN\#0: The network port interface. */ 202 212 PDMINETWORKPORT INetworkPort; 203 /** The network config port interface. */213 /** LUN\#0: The network config port interface. */ 204 214 PDMINETWORKCONFIG INetworkConfig; 205 215 /** Base address of the MMIO region. */ … … 221 231 /** The LED. */ 222 232 PDMLED Led; 223 /** The LED ports. */233 /** Status LUN: The LED ports. */ 224 234 PDMILEDPORTS ILeds; 225 235 /** Partner of ILeds. */ … … 4471 4481 4472 4482 /** 4473 * Queries an interface to the driver. 4474 * 4475 * @returns Pointer to interface. 4476 * @returns NULL if the interface was not supported by the driver. 4477 * @param pInterface Pointer to this interface structure. 4478 * @param enmInterface The requested interface identification. 4479 * @thread Any thread. 4480 */ 4481 static DECLCALLBACK(void *) pcnetQueryInterface(struct PDMIBASE *pInterface, PDMINTERFACE enmInterface) 4482 { 4483 PCNetState *pThis = (PCNetState *)((uintptr_t)pInterface - RT_OFFSETOF(PCNetState, IBase)); 4483 * @interface_method_impl{PDMIBASE,pfnQueryInterface} 4484 */ 4485 static DECLCALLBACK(void *) pcnetQueryInterface(struct PDMIBASE *pInterface, const char *pszIID) 4486 { 4487 PCNetState *pThis = RT_FROM_MEMBER(pInterface, PCNetState, IBase); 4484 4488 Assert(&pThis->IBase == pInterface); 4485 switch (enmInterface) 4486 { 4487 case PDMINTERFACE_BASE: 4488 return &pThis->IBase; 4489 case PDMINTERFACE_NETWORK_PORT: 4490 return &pThis->INetworkPort; 4491 case PDMINTERFACE_NETWORK_CONFIG: 4492 return &pThis->INetworkConfig; 4493 case PDMINTERFACE_LED_PORTS: 4494 return &pThis->ILeds; 4495 default: 4496 return NULL; 4497 } 4489 if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0) 4490 return &pThis->IBase; 4491 if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_NETWORK_PORT) == 0) 4492 return &pThis->INetworkPort; 4493 if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_NETWORK_CONFIG) == 0) 4494 return &pThis->INetworkConfig; 4495 if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_LED_PORTS) == 0) 4496 return &pThis->ILeds; 4497 return NULL; 4498 4498 } 4499 4499 -
trunk/src/VBox/Devices/Network/DevVirtioNet.cpp
r25955 r25966 2 2 /** @file 3 3 * DevVirtioNet - Virtio Network Device 4 *5 4 */ 6 5 … … 29 28 #ifdef IN_RING3 30 29 # include <iprt/mem.h> 30 # include <iprt/uuid.h> 31 31 #endif /* IN_RING3 */ 32 32 #include "../Builtins.h" … … 107 107 /** 108 108 * Device state structure. Holds the current state of device. 109 */ 110 109 * 110 * @extends VPCISTATE 111 * @implements PDMINETWORKPORT 112 * @implements PDMINETWORKCONFIG 113 */ 111 114 struct VNetState_st 112 115 { … … 578 581 579 582 /** 580 * Provides interfaces to the driver. 581 * 582 * @returns Pointer to interface. NULL if the interface is not supported. 583 * @param pInterface Pointer to this interface structure. 584 * @param enmInterface The requested interface identification. 585 * @thread EMT 586 */ 587 static DECLCALLBACK(void *) vnetQueryInterface(struct PDMIBASE *pInterface, PDMINTERFACE enmInterface) 588 { 589 VNETSTATE *pState = IFACE_TO_STATE(pInterface, VPCI.IBase); 590 Assert(&pState->VPCI.IBase == pInterface); 591 switch (enmInterface) 592 { 593 case PDMINTERFACE_NETWORK_PORT: 594 return &pState->INetworkPort; 595 case PDMINTERFACE_NETWORK_CONFIG: 596 return &pState->INetworkConfig; 597 default: 598 return vpciQueryInterface(pInterface, enmInterface); 599 } 583 * @interface_method_impl{PDMIBASE,pfnQueryInterface} 584 */ 585 static DECLCALLBACK(void *) vnetQueryInterface(struct PDMIBASE *pInterface, const char *pszIID) 586 { 587 VNETSTATE *pThis = IFACE_TO_STATE(pInterface, VPCI.IBase); 588 Assert(&pThis->VPCI.IBase == pInterface); 589 590 if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_NETWORK_PORT) == 0) 591 return &pThis->INetworkPort; 592 if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_NETWORK_CONFIG) == 0) 593 return &pThis->INetworkConfig; 594 return vpciQueryInterface(pInterface, pszIID); 600 595 } 601 596 … … 858 853 } 859 854 860 Log3(("%s vnetTransmitPendingPackets: About to trasmit %d pending packets\n", INSTANCE(pState), 855 Log3(("%s vnetTransmitPendingPackets: About to trasmit %d pending packets\n", INSTANCE(pState), 861 856 vringReadAvailIndex(&pState->VPCI, &pState->pTxQueue->VRing) - pState->pTxQueue->uNextAvailIndex)); 862 857 … … 965 960 u32MicroDiff, pState->u32AvgDiff, pState->u32MinDiff, pState->u32MaxDiff)); 966 961 967 // Log3(("%s vnetTxTimer: Expired\n", INSTANCE(pState))); 962 // Log3(("%s vnetTxTimer: Expired\n", INSTANCE(pState))); 968 963 vnetTransmitPendingPackets(pState, pState->pTxQueue); 969 964 if (RT_FAILURE(vnetCsEnter(pState, VERR_SEM_BUSY))) … … 1461 1456 1462 1457 /* Initialize PCI part first. */ 1463 pState->VPCI.IBase.pfnQueryInterface 1458 pState->VPCI.IBase.pfnQueryInterface = vnetQueryInterface; 1464 1459 rc = vpciConstruct(pDevIns, &pState->VPCI, iInstance, 1465 1460 VNET_NAME_FMT, VNET_PCI_SUBSYSTEM_ID, -
trunk/src/VBox/Devices/Network/DrvIntNet.cpp
r25893 r25966 39 39 #include <iprt/time.h> 40 40 #include <iprt/thread.h> 41 #include <iprt/uuid.h> 41 42 42 43 #include "../Builtins.h" … … 63 64 /** 64 65 * Block driver instance data. 66 * 67 * @implements PDMINETWORKCONNECTOR 65 68 */ 66 69 typedef struct DRVINTNET … … 576 579 577 580 /** 578 * Queries an interface to the driver. 579 * 580 * @returns Pointer to interface. 581 * @returns NULL if the interface was not supported by the driver. 582 * @param pInterface Pointer to this interface structure. 583 * @param enmInterface The requested interface identification. 584 * @thread Any thread. 585 */ 586 static DECLCALLBACK(void *) drvIntNetQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface) 581 * @interface_method_impl{PDMIBASE,pfnQueryInterface} 582 */ 583 static DECLCALLBACK(void *) drvIntNetQueryInterface(PPDMIBASE pInterface, const char *pszIID) 587 584 { 588 585 PPDMDRVINS pDrvIns = PDMIBASE_2_PDMDRV(pInterface); 589 PDRVINTNET pThis = PDMINS_2_DATA(pDrvIns, PDRVINTNET); 590 switch (enmInterface) 591 { 592 case PDMINTERFACE_BASE: 593 return &pDrvIns->IBase; 594 case PDMINTERFACE_NETWORK_CONNECTOR: 595 return &pThis->INetworkConnector; 596 default: 597 return NULL; 598 } 586 PDRVINTNET pThis = PDMINS_2_DATA(pDrvIns, PDRVINTNET); 587 588 if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0) 589 return &pDrvIns->IBase; 590 if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_NETWORK_CONNECTOR) == 0) 591 return &pThis->INetworkConnector; 592 return NULL; 599 593 } 600 594 -
trunk/src/VBox/Devices/Network/DrvNAT.cpp
r25893 r25966 5 5 6 6 /* 7 * Copyright (C) 2006-20 09Sun Microsystems, Inc.7 * Copyright (C) 2006-2010 Sun Microsystems, Inc. 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 37 37 #include <iprt/cidr.h> 38 38 #include <iprt/stream.h> 39 #include <iprt/uuid.h> 39 40 40 41 #include "Builtins.h" … … 118 119 /** 119 120 * NAT network transport driver instance data. 121 * 122 * @implements PDMINETWORKCONNECTOR 120 123 */ 121 124 typedef struct DRVNAT … … 803 806 804 807 /** 805 * Queries an interface to the driver. 806 * 807 * @returns Pointer to interface. 808 * @returns NULL if the interface was not supported by the driver. 809 * @param pInterface Pointer to this interface structure. 810 * @param enmInterface The requested interface identification. 811 * @thread Any thread. 812 */ 813 static DECLCALLBACK(void *) drvNATQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface) 814 { 815 PPDMDRVINS pDrvIns = PDMIBASE_2_PDMDRV(pInterface); 816 PDRVNAT pThis = PDMINS_2_DATA(pDrvIns, PDRVNAT); 817 switch (enmInterface) 818 { 819 case PDMINTERFACE_BASE: 820 return &pDrvIns->IBase; 821 case PDMINTERFACE_NETWORK_CONNECTOR: 822 return &pThis->INetworkConnector; 823 default: 824 return NULL; 825 } 808 * @interface_method_impl{PDMIBASE,pfnQueryInterface} 809 */ 810 static DECLCALLBACK(void *) drvNATQueryInterface(PPDMIBASE pInterface, const char *pszIID) 811 { 812 PPDMDRVINS pDrvIns = PDMIBASE_2_PDMDRV(pInterface); 813 PDRVNAT pThis = PDMINS_2_DATA(pDrvIns, PDRVNAT); 814 815 if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0) 816 return &pDrvIns->IBase; 817 if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_NETWORK_CONNECTOR) == 0) 818 return &pThis->INetworkConnector; 819 return NULL; 826 820 } 827 821 … … 1039 1033 N_("Configuration error: the above device/driver didn't " 1040 1034 "export the network port interface")); 1041 pThis->pConfig = 1042 (PPDMINETWORKCONFIG)pDrvIns->pUpBase->pfnQueryInterface(pDrvIns->pUpBase, 1043 PDMINTERFACE_NETWORK_CONFIG); 1035 pThis->pConfig = (PPDMINETWORKCONFIG)pDrvIns->pUpBase->pfnQueryInterface(pDrvIns->pUpBase, 1036 PDMINTERFACE_NETWORK_CONFIG); 1044 1037 if (!pThis->pConfig) 1045 1038 return PDMDRV_SET_ERROR(pDrvIns, VERR_PDM_MISSING_INTERFACE_ABOVE, -
trunk/src/VBox/Devices/Network/DrvNetSniffer.cpp
r25893 r25966 1 /* $Id$ */ 1 2 /** @file 2 * 3 * VBox network devices: 4 * Network sniffer filter driver 3 * DrvNetSniffer - Network sniffer filter driver. 5 4 */ 6 5 7 6 /* 8 * Copyright (C) 2006-20 07Sun Microsystems, Inc.7 * Copyright (C) 2006-2010 Sun Microsystems, Inc. 9 8 * 10 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 30 29 #include <VBox/log.h> 31 30 #include <iprt/assert.h> 31 #include <iprt/critsect.h> 32 32 #include <iprt/file.h> 33 33 #include <iprt/process.h> 34 34 #include <iprt/string.h> 35 35 #include <iprt/time.h> 36 #include <iprt/ critsect.h>36 #include <iprt/uuid.h> 37 37 #include <VBox/param.h> 38 38 … … 46 46 /** 47 47 * Block driver instance data. 48 * 49 * @implements PDMINETWORKCONNECTOR 50 * @implements PDMINETWORKPORT 51 * @implements PDMINETWORKCONFIG 48 52 */ 49 53 typedef struct DRVNETSNIFFER … … 248 252 249 253 /** 250 * Queries an interface to the driver. 251 * 252 * @returns Pointer to interface. 253 * @returns NULL if the interface was not supported by the driver. 254 * @param pInterface Pointer to this interface structure. 255 * @param enmInterface The requested interface identification. 256 * @thread Any thread. 257 */ 258 static DECLCALLBACK(void *) drvNetSnifferQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface) 259 { 260 PPDMDRVINS pDrvIns = PDMIBASE_2_PDMDRV(pInterface); 261 PDRVNETSNIFFER pThis = PDMINS_2_DATA(pDrvIns, PDRVNETSNIFFER); 262 switch (enmInterface) 263 { 264 case PDMINTERFACE_BASE: 265 return &pDrvIns->IBase; 266 case PDMINTERFACE_NETWORK_CONNECTOR: 267 return &pThis->INetworkConnector; 268 case PDMINTERFACE_NETWORK_PORT: 269 return &pThis->INetworkPort; 270 case PDMINTERFACE_NETWORK_CONFIG: 271 return &pThis->INetworkConfig; 272 default: 273 return NULL; 274 } 254 * @interface_method_impl{PDMIBASE,pfnQueryInterface} 255 */ 256 static DECLCALLBACK(void *) drvNetSnifferQueryInterface(PPDMIBASE pInterface, const char *pszIID) 257 { 258 PPDMDRVINS pDrvIns = PDMIBASE_2_PDMDRV(pInterface); 259 PDRVNETSNIFFER pThis = PDMINS_2_DATA(pDrvIns, PDRVNETSNIFFER); 260 if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0) 261 return &pDrvIns->IBase; 262 if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_NETWORK_CONNECTOR) == 0) 263 return &pThis->INetworkConnector; 264 if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_NETWORK_PORT) == 0) 265 return &pThis->INetworkPort; 266 if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_NETWORK_CONFIG) == 0) 267 return &pThis->INetworkConfig; 268 return NULL; 275 269 } 276 270 -
trunk/src/VBox/Devices/Network/DrvTAP.cpp
r25893 r25966 1 /* *$Id$ */1 /* $Id$ */ 2 2 /** @file 3 * Universial TAP network transport driver.3 * DrvTAP - Universial TAP network transport driver. 4 4 */ 5 5 6 6 /* 7 * Copyright (C) 2006-20 07Sun Microsystems, Inc.7 * Copyright (C) 2006-2010 Sun Microsystems, Inc. 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 27 27 #include <VBox/pdmdrv.h> 28 28 29 #include <iprt/asm.h> 29 30 #include <iprt/assert.h> 30 31 #include <iprt/ctype.h> 31 32 #include <iprt/file.h> 33 #include <iprt/path.h> 34 #include <iprt/semaphore.h> 32 35 #include <iprt/string.h> 33 #include <iprt/path.h>34 36 #include <iprt/thread.h> 35 #include <iprt/asm.h> 36 #include <iprt/semaphore.h> 37 #include <iprt/uuid.h> 37 38 #ifdef RT_OS_SOLARIS 38 39 # include <iprt/process.h> … … 80 81 *******************************************************************************/ 81 82 /** 82 * Block driver instance data. 83 * TAP driver instance data. 84 * 85 * @implements PDMINETWORKCONNECTOR 83 86 */ 84 87 typedef struct DRVTAP … … 774 777 775 778 /** 776 * Queries an interface to the driver. 777 * 778 * @returns Pointer to interface. 779 * @returns NULL if the interface was not supported by the driver. 780 * @param pInterface Pointer to this interface structure. 781 * @param enmInterface The requested interface identification. 782 * @thread Any thread. 783 */ 784 static DECLCALLBACK(void *) drvTAPQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface) 785 { 786 PPDMDRVINS pDrvIns = PDMIBASE_2_PDMDRV(pInterface); 787 PDRVTAP pThis = PDMINS_2_DATA(pDrvIns, PDRVTAP); 788 switch (enmInterface) 789 { 790 case PDMINTERFACE_BASE: 791 return &pDrvIns->IBase; 792 case PDMINTERFACE_NETWORK_CONNECTOR: 793 return &pThis->INetworkConnector; 794 default: 795 return NULL; 796 } 779 * @interface_method_impl{PDMIBASE,pfnQueryInterface} 780 */ 781 static DECLCALLBACK(void *) drvTAPQueryInterface(PPDMIBASE pInterface, const char *pszIID) 782 { 783 PPDMDRVINS pDrvIns = PDMIBASE_2_PDMDRV(pInterface); 784 PDRVTAP pThis = PDMINS_2_DATA(pDrvIns, PDRVTAP); 785 786 if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0) 787 return &pDrvIns->IBase; 788 if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_NETWORK_CONNECTOR) == 0) 789 return &pThis->INetworkConnector; 790 return NULL; 797 791 } 798 792
Note:
See TracChangeset
for help on using the changeset viewer.