VirtualBox

Changeset 14526 in vbox for trunk/include


Ignore:
Timestamp:
Nov 24, 2008 3:16:01 PM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
39814
Message:

Devices/Storage: iSCSI stuff, including bringing IntNet support back to life. Should build, but otherwise untested.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/VBoxHDD-new.h

    r13988 r14526  
    216216 * provide the mandatory configuration parts this way. */
    217217#define VD_CAP_CONFIG               RT_BIT(7)
     218/** The backend uses the network stack interface. The caller has to provide
     219 * the appropriate interface. */
     220#define VD_CAP_TCPNET               RT_BIT(8)
    218221/** @}*/
    219222
     
    233236    /** Interface for configuration information. Per-image. */
    234237    VDINTERFACETYPE_CONFIG,
     238    /** Interface for TCP network stack. Per-disk. */
     239    VDINTERFACETYPE_TCPNET,
    235240    /** invalid interface. */
    236241    VDINTERFACETYPE_INVALID
     
    252257    /** Opaque user data which is passed on every call. */
    253258    void               *pvUser;
    254     /** Pointer to the function call table of the interface. 
     259    /** Pointer to the function call table of the interface.
    255260     *  As this is opaque this must be casted to the right interface
    256261     *  struct defined below based on the interface type in enmInterface. */
     
    288293        AssertMsgBreak(pVDIfs->cbSize == sizeof(VDINTERFACE),
    289294                       ("cbSize=%u\n", pVDIfs->cbSize));
    290                        
     295
    291296        if (pVDIfs->enmInterface == enmInterface)
    292297            return pVDIfs;
     
    395400}
    396401
    397 /** 
     402/**
    398403 * Completion callback which is called by the interface owner
    399404 * to inform the backend that a task finished.
     
    455460     * @param   pcbWritten      Where to store how many bytes where actually written.
    456461     */
    457     DECLR3CALLBACKMEMBER(int, pfnWrite, (void *pvUser, void *pStorage, uint64_t uOffset, 
     462    DECLR3CALLBACKMEMBER(int, pfnWrite, (void *pvUser, void *pStorage, uint64_t uOffset,
    458463                                         size_t cbWrite, const void *pvBuf, size_t *pcbWritten));
    459464
     
    469474     * @param   pcbRead         Where to store how many bytes where actually read.
    470475     */
    471     DECLR3CALLBACKMEMBER(int, pfnRead, (void *pvUser, void *pStorage, uint64_t uOffset, 
     476    DECLR3CALLBACKMEMBER(int, pfnRead, (void *pvUser, void *pStorage, uint64_t uOffset,
    472477                                        size_t cbRead, void *pvBuf, size_t *pcbRead));
    473478
     
    492497     * @param   ppTask         Where to store the opaque task handle.
    493498     */
    494     DECLR3CALLBACKMEMBER(int, pfnPrepareRead, (void *pvUser, void *pStorage, uint64_t uOffset, 
     499    DECLR3CALLBACKMEMBER(int, pfnPrepareRead, (void *pvUser, void *pStorage, uint64_t uOffset,
    495500                                               void *pvBuf, size_t cbRead, void **ppTask));
    496501
     
    506511     * @param   ppTask         Where to store the opaque task handle.
    507512     */
    508     DECLR3CALLBACKMEMBER(int, pfnPrepareWrite, (void *pvUser, void *pStorage, uint64_t uOffset, 
     513    DECLR3CALLBACKMEMBER(int, pfnPrepareWrite, (void *pvUser, void *pStorage, uint64_t uOffset,
    509514                                                void *pvBuf, size_t cbWrite, void **ppTask));
    510515
     
    550555/**
    551556 * Progress notification interface
    552  * 
     557 *
    553558 * Per-operation. Optional.
    554559 */
     
    687692DECLINLINE(PVDINTERFACECONFIG) VDGetInterfaceConfig(PVDINTERFACE pInterface)
    688693{
    689     /* Check that the interface descriptor is a progress interface. */
     694    /* Check that the interface descriptor is a config interface. */
    690695    AssertMsgReturn(   (pInterface->enmInterface == VDINTERFACETYPE_CONFIG)
    691696                    && (pInterface->cbSize == sizeof(VDINTERFACE)),
     
    705710 * Query configuration, validates that the values are within a set of valid names.
    706711 *
    707  * @returns true if all names are found in pszzAllowed.
    708  * @returns false if not.
     712 * @return  true if all names are found in pszzAllowed.
     713 * @return  false if not.
    709714 * @param   pCfgIf      Pointer to configuration callback table.
    710715 * @param   pNode       The node which values should be examined.
     
    721726/**
    722727 * Query configuration, unsigned 64-bit integer value with default.
    723  * 
     728 *
    724729 * @return  VBox status code.
    725730 * @param   pCfgIf      Pointer to configuration callback table.
     
    738743/**
    739744 * Query configuration, unsigned 32-bit integer value with default.
    740  * 
     745 *
    741746 * @return  VBox status code.
    742747 * @param   pCfgIf      Pointer to configuration callback table.
     
    764769/**
    765770 * Query configuration, bool value with default.
    766  * 
     771 *
    767772 * @return  VBox status code.
    768773 * @param   pCfgIf      Pointer to configuration callback table.
     
    786791 * Query configuration, dynamically allocated (RTMemAlloc) zero terminated
    787792 * character value.
    788  * 
     793 *
    789794 * @return  VBox status code.
    790795 * @param   pCfgIf      Pointer to configuration callback table.
     
    821826 * Query configuration, dynamically allocated (RTMemAlloc) zero terminated
    822827 * character value with default.
    823  * 
     828 *
    824829 * @return  VBox status code.
    825830 * @param   pCfgIf      Pointer to configuration callback table.
     
    862867/**
    863868 * Query configuration, dynamically allocated (RTMemAlloc) byte string value.
    864  * 
     869 *
    865870 * @return  VBox status code.
    866871 * @param   pCfgIf      Pointer to configuration callback table.
     
    898903
    899904
     905/**
     906 * TCP network stack interface
     907 *
     908 * Per-disk. Mandatory for backends which have the VD_CAP_TCPNET bit set.
     909 */
     910typedef struct VDINTERFACETCPNET
     911{
     912    /**
     913     * Size of the configuration interface.
     914     */
     915    uint32_t    cbSize;
     916
     917    /**
     918     * Interface type.
     919     */
     920    VDINTERFACETYPE enmInterface;
     921
     922    /**
     923     * Connect as a client to a TCP port.
     924     *
     925     * @return  iprt status code.
     926     * @param   pszAddress      The address to connect to.
     927     * @param   uPort           The port to connect to.
     928     * @param   pSock           Where to store the handle to the established connect
     929ion.
     930     */
     931    DECLR3CALLBACKMEMBER(int, pfnClientConnect, (const char *pszAddress, uint32_t uPort, PRTSOCKET pSock));
     932
     933    /**
     934     * Close a TCP connection.
     935     *
     936     * @return  iprt status code.
     937     * @param   Sock            Socket descriptor.
     938ion.
     939     */
     940    DECLR3CALLBACKMEMBER(int, pfnClientClose, (RTSOCKET Sock));
     941
     942    /**
     943     * Socket I/O multiplexing.
     944     * Checks if the socket is ready for reading.
     945     *
     946     * @return  iprt status code.
     947     * @param   Sock        Socket descriptor.
     948     * @param   cMillies    Number of milliseconds to wait for the socket.
     949     *                      Use RT_INDEFINITE_WAIT to wait for ever.
     950     */
     951    DECLR3CALLBACKMEMBER(int, pfnSelectOne, (RTSOCKET Sock, unsigned cMillies));
     952
     953    /**
     954     * Receive data from a socket.
     955     *
     956     * @return  iprt status code.
     957     * @param   Sock        Socket descriptor.
     958     * @param   pvBuffer    Where to put the data we read.
     959     * @param   cbBuffer    Read buffer size.
     960     * @param   pcbRead     Number of bytes read.
     961     *                      If NULL the entire buffer will be filled upon successful return.
     962     *                      If not NULL a partial read can be done successfully.
     963     */
     964    DECLR3CALLBACKMEMBER(int, pfnRead, (RTSOCKET Sock, void *pvBuffer, size_t cbBuffer, size_t *pcbRead));
     965
     966    /**
     967     * Send data from a socket.
     968     *
     969     * @return  iprt status code.
     970     * @param   Sock        Socket descriptor.
     971     * @param   pvBuffer    Buffer to write data to socket.
     972     * @param   cbBuffer    How much to write.
     973     * @param   pcbRead     Number of bytes read.
     974     */
     975    DECLR3CALLBACKMEMBER(int, pfnWrite, (RTSOCKET Sock, const void *pvBuffer, size_t cbBuffer));
     976
     977    /**
     978     * Flush socket write buffers.
     979     *
     980     * @return  iprt status code.
     981     * @param   Sock        Socket descriptor.
     982     */
     983    DECLR3CALLBACKMEMBER(int, pfnFlush, (RTSOCKET Sock));
     984
     985} VDINTERFACETCPNET, *PVDINTERFACETCPNET;
     986
     987/**
     988 * Get TCP network stack interface from opaque callback table.
     989 *
     990 * @return Pointer to the callback table.
     991 * @param  pInterface Pointer to the interface descriptor.
     992 */
     993DECLINLINE(PVDINTERFACETCPNET) VDGetInterfaceTcpNet(PVDINTERFACE pInterface)
     994{
     995    /* Check that the interface descriptor is a TCP network stack interface. */
     996    AssertMsgReturn(   (pInterface->enmInterface == VDINTERFACETYPE_TCPNET)
     997                    && (pInterface->cbSize == sizeof(VDINTERFACE)),
     998                    ("Not a TCP network stack interface"), NULL);
     999
     1000    PVDINTERFACETCPNET pInterfaceTcpNet = (PVDINTERFACETCPNET)pInterface->pCallbacks;
     1001
     1002    /* Do basic checks. */
     1003    AssertMsgReturn(   (pInterfaceTcpNet->cbSize == sizeof(VDINTERFACETCPNET))
     1004                    && (pInterfaceTcpNet->enmInterface == VDINTERFACETYPE_TCPNET),
     1005                    ("A non TCP network stack callback table attached to a TCP network stack interface descriptor\n"), NULL);
     1006
     1007    return pInterfaceTcpNet;
     1008}
     1009
     1010
    9001011/** @name Configuration interface key handling flags.
    9011012 * @{
     
    14951606 * @param   pvUser          User data which is passed on completion
    14961607 */
    1497 VBOXDDU_DECL(int) VDAsyncRead(PVBOXHDD pDisk, uint64_t uOffset, size_t cbRead, 
     1608VBOXDDU_DECL(int) VDAsyncRead(PVBOXHDD pDisk, uint64_t uOffset, size_t cbRead,
    14981609                              PPDMDATASEG paSeg, unsigned cSeg,
    14991610                              void *pvUser);
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette