VirtualBox

Changeset 82852 in vbox for trunk/src/VBox/HostServices


Ignore:
Timestamp:
Jan 24, 2020 3:12:23 PM (5 years ago)
Author:
vboxsync
Message:

Shared Clipboard: Added missing / disabled code for negotiating transfer chunk sizes. bugref:9437

Location:
trunk/src/VBox/HostServices/SharedClipboard
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc-internal.h

    r82848 r82852  
    116116    /** Guest feature flags, VBOX_SHCL_GF_1_XXX. */
    117117    uint64_t                fGuestFeatures1;
    118     /** Maximum chunk size to use for data transfers. Set to _64K by default. */
     118    /** Chunk size to use for data transfers. */
    119119    uint32_t                cbChunkSize;
    120120    /** Where the transfer sources its data from. */
  • trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc-transfers.cpp

    r82848 r82852  
    737737
    738738        case VBOX_SHCL_GUEST_FN_CONNECT:
     739            RT_FALL_THROUGH();
     740        case VBOX_SHCL_GUEST_FN_NEGOTIATE_CHUNK_SIZE:
    739741            RT_FALL_THROUGH();
    740742        case VBOX_SHCL_GUEST_FN_MSG_PEEK_WAIT:
  • trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc.cpp

    r82851 r82852  
    663663}
    664664
     665static int shClSvcClientNegogiateChunkSize(PSHCLCLIENT pClient, VBOXHGCMCALLHANDLE hCall,
     666                                           uint32_t cParms, VBOXHGCMSVCPARM paParms[])
     667{
     668    /*
     669     * Validate the request.
     670     */
     671    ASSERT_GUEST_RETURN(cParms == VBOX_SHCL_CPARMS_NEGOTIATE_CHUNK_SIZE, VERR_WRONG_PARAMETER_COUNT);
     672    ASSERT_GUEST_RETURN(paParms[0].type == VBOX_HGCM_SVC_PARM_32BIT, VERR_WRONG_PARAMETER_TYPE);
     673    uint32_t const cbClientMaxChunkSize = paParms[0].u.uint32;
     674    ASSERT_GUEST_RETURN(paParms[1].type == VBOX_HGCM_SVC_PARM_32BIT, VERR_WRONG_PARAMETER_TYPE);
     675    uint32_t const cbClientChunkSize    = paParms[1].u.uint32;
     676
     677    uint32_t const cbHostMaxChunkSize = VBOX_SHCL_MAX_CHUNK_SIZE; /** @todo Make this configurable. */
     678
     679    /*
     680     * Do the work.
     681     */
     682    if (cbClientChunkSize == 0) /* Does the client want us to choose? */
     683    {
     684        paParms[0].u.uint32 = cbHostMaxChunkSize;                                     /* Maximum */
     685        paParms[1].u.uint32 = RT_MIN(pClient->State.cbChunkSize, cbHostMaxChunkSize); /* Preferred */
     686
     687    }
     688    else /* The client told us what it supports, so update and report back. */
     689    {
     690        paParms[0].u.uint32 = RT_MIN(cbClientMaxChunkSize, cbHostMaxChunkSize);         /* Maximum */
     691        paParms[1].u.uint32 = RT_MIN(cbClientMaxChunkSize, pClient->State.cbChunkSize); /* Preferred */
     692    }
     693
     694    int rc = g_pHelpers->pfnCallComplete(hCall, VINF_SUCCESS);
     695    if (RT_SUCCESS(rc))
     696    {
     697        Log(("[Client %RU32] chunk size: %#RU32, max: %#RU32\n", paParms[1].u.uint32, paParms[0].u.uint32));
     698    }
     699    else
     700        LogFunc(("pfnCallComplete -> %Rrc\n", rc));
     701
     702    return VINF_HGCM_ASYNC_EXECUTE;
     703}
     704
    665705/**
    666706 * Implements VBOX_SHCL_GUEST_FN_REPORT_FEATURES.
     
    677717 * @param   paParms     Array of parameters.
    678718 */
    679 int shClSvcClientReportFeatures(PSHCLCLIENT pClient, VBOXHGCMCALLHANDLE hCall,
    680                                 uint32_t cParms, VBOXHGCMSVCPARM paParms[])
     719static int shClSvcClientReportFeatures(PSHCLCLIENT pClient, VBOXHGCMCALLHANDLE hCall,
     720                                       uint32_t cParms, VBOXHGCMSVCPARM paParms[])
    681721{
    682722    /*
     
    720760 * @param   paParms     Array of parameters.
    721761 */
    722 int shClSvcClientQueryFeatures(VBOXHGCMCALLHANDLE hCall, uint32_t cParms, VBOXHGCMSVCPARM paParms[])
     762static int shClSvcClientQueryFeatures(VBOXHGCMCALLHANDLE hCall, uint32_t cParms, VBOXHGCMSVCPARM paParms[])
    723763{
    724764    /*
     
    15181558        /* Read clipboard data from the extension. */
    15191559        rc = g_ExtState.pfnExtension(g_ExtState.pvExtension, VBOX_CLIPBOARD_EXT_FN_DATA_READ, &parms, sizeof(parms));
    1520         LogRelFlowFunc(("DATA/Ext: fDelayedAnnouncement=%RTbool fDelayedFormats=%#x cbData=%RU32->%RU32 rc=%Rrc\n",
     1560        LogRelFlowFunc(("Shared Clipboard: DATA/Ext: fDelayedAnnouncement=%RTbool fDelayedFormats=%#x cbData=%RU32->%RU32 rc=%Rrc\n",
    15211561                        g_ExtState.fDelayedAnnouncement, g_ExtState.fDelayedFormats, dataBlock.cbData, parms.cbData, rc));
    15221562
     
    15401580    {
    15411581        rc = ShClSvcImplReadData(pClient, &cmdCtx, &dataBlock, &cbActual);
    1542         LogRelFlowFunc(("DATA/Host: cbData=%RU32->%RU32 rc=%Rrc\n", dataBlock.cbData, cbActual, rc));
     1582        LogRelFlowFunc(("Shared Clipboard: DATA/Host: cbData=%RU32->%RU32 rc=%Rrc\n", dataBlock.cbData, cbActual, rc));
    15431583    }
    15441584
     
    18711911
    18721912        case VBOX_SHCL_GUEST_FN_CONNECT:
    1873             LogRel(("6.1.0 beta or rc additions detected. Please upgrade!\n"));
     1913            LogRel(("Shared Clipboard: 6.1.0 beta or rc Guest Additions detected. Please upgrade!\n"));
    18741914            rc = VERR_NOT_IMPLEMENTED;
     1915            break;
     1916
     1917        case VBOX_SHCL_GUEST_FN_NEGOTIATE_CHUNK_SIZE:
     1918            rc = shClSvcClientNegogiateChunkSize(pClient, callHandle, cParms, paParms);
    18751919            break;
    18761920
     
    20122056    pClientState->fGuestFeatures1 = VBOX_SHCL_GF_NONE;
    20132057
    2014     pClientState->cbChunkSize        = _64K; /** Make this configurable. */
    2015     pClientState->enmSource          = SHCLSOURCE_INVALID;
    2016     pClientState->fFlags             = SHCLCLIENTSTATE_FLAGS_NONE;
     2058    pClientState->cbChunkSize     = VBOX_SHCL_DEFAULT_CHUNK_SIZE; /** @todo Make this configurable. */
     2059    pClientState->enmSource       = SHCLSOURCE_INVALID;
     2060    pClientState->fFlags          = SHCLCLIENTSTATE_FLAGS_NONE;
    20172061
    20182062    pClientState->POD.enmDir             = SHCLTRANSFERDIR_UNKNOWN;
Note: See TracChangeset for help on using the changeset viewer.

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