Changeset 25966 in vbox for trunk/src/VBox/Devices/Serial/DrvNamedPipe.cpp
- Timestamp:
- Jan 22, 2010 11:15:43 AM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 56818
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Serial/DrvNamedPipe.cpp
r25893 r25966 1 /* $Id$ */ 1 2 /** @file 2 * 3 * VBox stream devices: 4 * Named pipe stream 3 * VBox stream drivers: Named pipe stream 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 … … 33 32 #include <iprt/string.h> 34 33 #include <iprt/semaphore.h> 34 #include <iprt/uuid.h> 35 35 36 36 #include "Builtins.h" 37 37 38 38 #ifdef RT_OS_WINDOWS 39 #include <windows.h> 40 #else /* !RT_OS_WINDOWS */ 41 #include <errno.h> 42 #include <unistd.h> 43 #include <sys/types.h> 44 #include <sys/socket.h> 45 #include <sys/un.h> 46 #endif /* !RT_OS_WINDOWS */ 39 # include <windows.h> 40 #else /* !RT_OS_WINDOWS */ 41 # include <errno.h> 42 # include <unistd.h> 43 # include <sys/types.h> 44 # include <sys/socket.h> 45 # include <sys/un.h> 46 #endif /* !RT_OS_WINDOWS */ 47 47 48 48 49 /******************************************************************************* 49 50 * Defined Constants And Macros * 50 51 *******************************************************************************/ 51 52 52 /** Converts a pointer to DRVNAMEDPIPE::IMedia to a PDRVNAMEDPIPE. */ 53 53 #define PDMISTREAM_2_DRVNAMEDPIPE(pInterface) ( (PDRVNAMEDPIPE)((uintptr_t)pInterface - RT_OFFSETOF(DRVNAMEDPIPE, IStream)) ) … … 55 55 /** Converts a pointer to PDMDRVINS::IBase to a PPDMDRVINS. */ 56 56 #define PDMIBASE_2_DRVINS(pInterface) ( (PPDMDRVINS)((uintptr_t)pInterface - RT_OFFSETOF(PDMDRVINS, IBase)) ) 57 57 58 58 59 /******************************************************************************* … … 61 62 /** 62 63 * Named pipe driver instance data. 64 * 65 * @implements PDMISTREAM 63 66 */ 64 67 typedef struct DRVNAMEDPIPE … … 278 281 279 282 /** 280 * Queries an interface to the driver. 281 * 282 * @returns Pointer to interface. 283 * @returns NULL if the interface was not supported by the driver. 284 * @param pInterface Pointer to this interface structure. 285 * @param enmInterface The requested interface identification. 286 * @thread Any thread. 287 */ 288 static DECLCALLBACK(void *) drvNamedPipeQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface) 289 { 290 PPDMDRVINS pDrvIns = PDMIBASE_2_DRVINS(pInterface); 291 PDRVNAMEDPIPE pDrv = PDMINS_2_DATA(pDrvIns, PDRVNAMEDPIPE); 292 switch (enmInterface) 293 { 294 case PDMINTERFACE_BASE: 295 return &pDrvIns->IBase; 296 case PDMINTERFACE_STREAM: 297 return &pDrv->IStream; 298 default: 299 return NULL; 300 } 283 * @interface_method_impl{PDMIBASE,pfnQueryInterface} 284 */ 285 static DECLCALLBACK(void *) drvNamedPipeQueryInterface(PPDMIBASE pInterface, const char *pszIID) 286 { 287 PPDMDRVINS pDrvIns = PDMIBASE_2_DRVINS(pInterface); 288 PDRVNAMEDPIPE pThis = PDMINS_2_DATA(pDrvIns, PDRVNAMEDPIPE); 289 if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0) 290 return &pDrvIns->IBase; 291 if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_STREAM) == 0) 292 return &pThis->IStream; 293 return NULL; 301 294 } 302 295
Note:
See TracChangeset
for help on using the changeset viewer.