VirtualBox

Ignore:
Timestamp:
May 28, 2010 3:09:23 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
62112
Message:

r=bird: todos

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostServices/GuestControl/service.cpp

    r29797 r29867  
    2828 *           new host commands to perform. There can be multiple clients connected
    2929 *           to a service. A client is represented by its HGCM client ID.
    30  * - Context ID: A (almost) unique ID automatically generated on the host (Main API) 
     30 * - Context ID: A (almost) unique ID automatically generated on the host (Main API)
    3131 *               to not only distinguish clients but individual requests. Because
    3232 *               the host does not know anything about connected clients it needs
    3333 *               an indicator which it can refer to later. This context ID gets
    34  *               internally bound by the service to a client which actually processes 
     34 *               internally bound by the service to a client which actually processes
    3535 *               the command in order to have a relationship between client<->context ID(s).
    3636 *
    3737 * The host can trigger commands which get buffered by the service (with full HGCM
    38  * parameter info). As soon as a client connects (or is ready to do some new work) 
    39  * it gets a buffered host command to process it. This command then will be immediately 
     38 * parameter info). As soon as a client connects (or is ready to do some new work)
     39 * it gets a buffered host command to process it. This command then will be immediately
    4040 * removed from the command list. If there are ready clients but no new commands to be
    4141 * processed, these clients will be set into a deferred state (that is being blocked
    4242 * to return until a new command is available).
    4343 *
    44  * If a client needs to inform the host that something happend, it can send a 
     44 * If a client needs to inform the host that something happend, it can send a
    4545 * message to a low level HGCM callback registered in Main. This callback contains
    46  * the actual data as well as the context ID to let the host do the next necessary 
     46 * the actual data as well as the context ID to let the host do the next necessary
    4747 * steps for this context. This context ID makes it possible to wait for an event
    4848 * inside the host's Main API function (like starting a process on the guest and
    4949 * wait for getting its PID returned by the client) as well as cancelling blocking
    50  * host calls in order the client terminated/crashed (HGCM detects disconnected 
     50 * host calls in order the client terminated/crashed (HGCM detects disconnected
    5151 * clients and reports it to this service's callback).
    5252 */
     
    8080/**
    8181 * Structure for holding all clients with their
    82  * generated host contexts. This is necessary for 
     82 * generated host contexts. This is necessary for
    8383 * mainting the relationship between a client and its context IDs.
    8484 */
     
    135135    GuestCall() : mClientID(0), mHandle(0), mParms(NULL), mNumParms(0) {}
    136136    /** The normal contructor. */
    137     GuestCall(uint32_t aClientID, VBOXHGCMCALLHANDLE aHandle, 
     137    GuestCall(uint32_t aClientID, VBOXHGCMCALLHANDLE aHandle,
    138138              VBOXHGCMSVCPARM aParms[], uint32_t cParms)
    139139              : mClientID(aClientID), mHandle(aHandle), mParms(aParms), mNumParms(cParms) {}
     
    475475    AssertPtr(pCmd);
    476476    int rc;
    477  
     477
    478478    /* Sufficient parameter space? */
    479479    if (pCmd->mParmBuf.uParmCount > cParms)
     
    481481        paParms[0].setUInt32(pCmd->mParmBuf.uMsg);       /* Message ID */
    482482        paParms[1].setUInt32(pCmd->mParmBuf.uParmCount); /* Required parameters for message */
    483        
     483
    484484        /*
    485485        * So this call apparently failed because the guest wanted to peek
     
    500500 * defer the guest call until we have something from the host.
    501501 */
    502 int Service::retrieveNextHostCmd(uint32_t u32ClientID, VBOXHGCMCALLHANDLE callHandle, 
     502int Service::retrieveNextHostCmd(uint32_t u32ClientID, VBOXHGCMCALLHANDLE callHandle,
    503503                                 uint32_t cParms, VBOXHGCMSVCPARM paParms[])
    504504{
    505505    int rc = VINF_SUCCESS;
    506506
    507     /* 
     507    /*
    508508     * Lookup client in our list so that we can assign the context ID of
    509509     * a command to that client.
     
    547547              * later reference & cleanup). */
    548548             Assert(curCmd.mContextID > 0);
     549             /// @todo r=bird: check if already in the list.
    549550             it->mContextList.push_back(curCmd.mContextID);
    550551
     
    568569    {
    569570        if (it->mClientID == u32ClientID)
    570         {       
     571        {
    571572            if (it->mNumParms >= 2)
    572573            {
    573574                it->mParms[0].setUInt32(GETHOSTMSG_EXEC_HOST_CANCEL_WAIT); /* Message ID. */
    574575                it->mParms[1].setUInt32(0);                                /* Required parameters for message. */
    575             }             
     576            }
    576577            if (mpHelpers)
    577                 mpHelpers->pfnCallComplete(it->mHandle, rc);     
     578                mpHelpers->pfnCallComplete(it->mHandle, rc);
    578579            it = mClientList.erase(it);
    579580        }
     
    636637        && newCmd.mParmBuf.uParmCount > 0)
    637638    {
    638         /* 
     639        /*
    639640         * Assume that the context ID *always* is the first parameter,
    640641         * assign the context ID to the command.
     
    651652        {
    652653            GuestCall guest = mClientList.front();
    653             rc = sendHostCmdToGuest(&newCmd, 
     654            rc = sendHostCmdToGuest(&newCmd,
    654655                                    guest.mHandle, guest.mNumParms, guest.mParms);
    655656
     
    657658            AssertPtr(mpHelpers);
    658659            mpHelpers->pfnCallComplete(guest.mHandle, rc);
    659             mClientList.pop_front();                       
    660            
     660            mClientList.pop_front();
     661
    661662            /* If we got VERR_TOO_MUCH_DATA we buffer the host command in the next block
    662              * and return success to the host. */           
     663             * and return success to the host. */
    663664            if (rc == VERR_TOO_MUCH_DATA)
    664665            {
     
    675676        if (!fProcessed)
    676677        {
    677             mHostCmds.push_back(newCmd);   
     678            mHostCmds.push_back(newCmd);
    678679#if 0
    679680            /* Limit list size by deleting oldest element. */
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