VirtualBox

Changeset 23643 in vbox for trunk/src/VBox/Main


Ignore:
Timestamp:
Oct 9, 2009 12:23:32 PM (15 years ago)
Author:
vboxsync
Message:

VRDP port range API.

Location:
trunk/src/VBox/Main
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/ConsoleImpl.cpp

    r23633 r23643  
    35853585
    35863586/**
     3587 * @note Locks this object for reading.
     3588 */
     3589void Console::onRemoteDisplayInfoChange()
     3590{
     3591    AutoCaller autoCaller(this);
     3592    AssertComRCReturnVoid(autoCaller.rc());
     3593
     3594    AutoReadLock alock(this);
     3595
     3596    CallbackList::iterator it = mCallbacks.begin();
     3597    while (it != mCallbacks.end())
     3598        (*it++)->OnRemoteDisplayInfoChange();
     3599}
     3600
     3601
     3602
     3603/**
    35873604 * Called by IInternalSessionControl::OnUSBControllerChange().
    35883605 *
     
    65816598        {
    65826599            Utf8Str errMsg;
    6583             ULONG port = 0;
    6584             console->mVRDPServer->COMGETTER(Port)(&port);
    6585             errMsg = Utf8StrFmt(tr("VRDP server port %d is already in use"),
    6586                                 port);
     6600            Bstr bstr;
     6601            console->mVRDPServer->COMGETTER(Ports)(bstr.asOutParam());
     6602            Utf8Str ports = bstr;
     6603            errMsg = Utf8StrFmt(tr("VRDP server can't bind to a port: %s"),
     6604                                ports.raw());
    65876605            LogRel(("Warning: failed to launch VRDP server (%Rrc): '%s'\n",
    65886606                    vrc, errMsg.raw()));
  • trunk/src/VBox/Main/ConsoleVRDPServer.cpp

    r23223 r23643  
    143143
    144144    STDMETHOD(OnVRDPServerChange)()
     145    {
     146        return S_OK;
     147    }
     148
     149    STDMETHOD(OnRemoteDisplayInfoChange)()
    145150    {
    146151        return S_OK;
     
    622627        case VRDP_QP_NETWORK_PORT:
    623628        {
     629            /* This is obsolete, the VRDP server uses VRDP_QP_NETWORK_PORT_RANGE instead. */
    624630            ULONG port = 0;
    625             server->mConsole->getVRDPServer ()->COMGETTER(Port) (&port);
    626             if (port == 0)
    627             {
    628                 port = VRDP_DEFAULT_PORT;
    629             }
    630631
    631632            if (cbBuffer >= sizeof (uint32_t))
     
    707708            com::Bstr bstr;
    708709            HRESULT hrc = server->mConsole->machine ()->GetExtraData(Bstr("VBoxInternal2/VRDPPortRange"), bstr.asOutParam());
     710            if (hrc != S_OK || bstr == "")
     711            {
     712                hrc = server->mConsole->getVRDPServer ()->COMGETTER(Ports) (bstr.asOutParam());
     713            }
    709714            if (hrc != S_OK)
    710715            {
    711716                bstr = "";
     717            }
     718
     719            if (bstr == "0")
     720            {
     721                bstr = "3389";
    712722            }
    713723
     
    758768
    759769            ULONG port = *(uint32_t *)pvBuffer;
     770           
     771            server->mVRDPBindPort = port;
    760772
    761773            com::Bstr bstr = Utf8StrFmt("%d", port);
     
    769781                *pcbOut = sizeof (uint32_t);
    770782            }
     783
     784            server->mConsole->onRemoteDisplayInfoChange ();
    771785        } break;
    772786
     
    11301144
    11311145    mConsole->machine ()->SetExtraData(Bstr("VBoxInternal2/VRDPPortRange"), Bstr(""));
     1146    mVRDPBindPort = -1;
    11321147#endif /* VBOX_WITH_VRDP */
    11331148
     
    20192034{
    20202035#ifdef VBOX_WITH_VRDP
    2021     if (mpEntryPoints && mhServer)
     2036    if (index == VRDP_QI_PORT)
     2037    {
     2038        uint32_t cbOut = sizeof (int32_t);
     2039
     2040        if (cbBuffer >= cbOut)
     2041        {
     2042            *pcbOut = cbOut;
     2043            *(int32_t *)pvBuffer = (int32_t)mVRDPBindPort;
     2044        }
     2045    }
     2046    else if (mpEntryPoints && mhServer)
    20222047    {
    20232048        mpEntryPoints->VRDPQueryInfo (mhServer, index, pvBuffer, cbBuffer, pcbOut);
     
    22422267
    22432268IMPL_GETTER_BOOL   (BOOL,    Active,             VRDP_QI_ACTIVE);
     2269IMPL_GETTER_SCALAR (LONG,    Port,               VRDP_QI_PORT);
    22442270IMPL_GETTER_SCALAR (ULONG,   NumberOfClients,    VRDP_QI_NUMBER_OF_CLIENTS);
    22452271IMPL_GETTER_SCALAR (LONG64,  BeginTime,          VRDP_QI_BEGIN_TIME);
  • trunk/src/VBox/Main/VirtualBoxCallbackImpl.cpp

    r23223 r23643  
    230230    return mConsoleCallback->OnParallelPortChange(aParallelPort);
    231231}
     232
     233STDMETHODIMP CallbackWrapper::OnRemoteDisplayInfoChange()
     234{
     235    if (mConsoleCallback.isNull())
     236        return S_OK;
     237
     238    return mConsoleCallback->OnRemoteDisplayInfoChange();
     239}
     240
    232241STDMETHODIMP CallbackWrapper::OnVRDPServerChange()
    233242{
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r23601 r23643  
    54415441  <interface
    54425442     name="IConsoleCallback" extends="$unknown"
    5443      uuid="db67f6e5-799d-474c-8452-b10d7736a412"
     5443     uuid="d6239535-bda2-4ef7-83f4-f4722e4a3b2c"
    54445444     wsmap="suppress"
    54455445     >
     
    56255625        Interested callees should use IVRDPServer methods and attributes to
    56265626        find out what has changed.
     5627      </desc>
     5628    </method>
     5629
     5630    <method name="onRemoteDisplayInfoChange">
     5631      <desc>
     5632        Notification when the status of the VRDP server changes. Interested callees
     5633        should use <link to="IConsole::RemoteDisplayInfo">IRemoteDisplayInfo</link>
     5634        attributes to find out what is the current status.
    56275635      </desc>
    56285636    </method>
     
    58425850  <interface
    58435851     name="IRemoteDisplayInfo" extends="$unknown"
    5844      uuid="550104cd-2dfd-4a6c-857d-f6f8e088e62c"
     5852     uuid="b3741084-806f-4c3b-8c42-ebad1a81e45a"
    58455853     wsmap="struct"
    58465854     >
     
    58535861      <desc>
    58545862        Whether the remote display connection is active.
     5863      </desc>
     5864    </attribute>
     5865
     5866    <attribute name="port" type="long" readonly="yes">
     5867      <desc>
     5868        VRDP server port number. If this property is equal to <tt>0</tt>, then
     5869        the VRDP server failed to start, usually because there are no free TCP
     5870        ports to bind to. If this property is equal to <tt>-1</tt>, then the VRDP
     5871        server has not yet been started.
    58555872      </desc>
    58565873    </attribute>
     
    1178911806  <interface
    1179011807     name="IVRDPServer" extends="$unknown"
    11791      uuid="f4584ae7-6bce-474b-83d6-17d235e6aa89"
     11808     uuid="72e671bc-1712-4052-ad6b-e45e76d9d3e4"
    1179211809     wsmap="managed"
    1179311810     >
     
    1179611813    </attribute>
    1179711814
    11798     <attribute name="port" type="unsigned long">
    11799       <desc>
    11800         VRDP server port number.
     11815    <attribute name="ports" type="wstring">
     11816      <desc>
     11817        VRDP server port numbers.
    1180111818        <note>
    11802           Setting the value of this property to <tt>0</tt> will reset the port
    11803           number to the default value which is
    11804           currently <tt>3389</tt>. Reading this property will always return a
    11805           real port number, even after it has been set to <tt>0</tt> (in which
    11806           case the default port is returned).
     11819          This is a string of comma separated TCP port numbers or port number ranges.
     11820          The server will try to bind to one of ports from the list. Example
     11821          <tt>3000,3010-3012,3015</tt>
    1180711822        </note>
    1180811823      </desc>
  • trunk/src/VBox/Main/include/ConsoleImpl.h

    r23633 r23643  
    214214    void onRuntimeError (BOOL aFatal, IN_BSTR aErrorID, IN_BSTR aMessage);
    215215    HRESULT onShowWindow (BOOL aCheck, BOOL *aCanShow, ULONG64 *aWinId);
     216    void onRemoteDisplayInfoChange();
    216217
    217218    static const PDMDRVREG DrvStatusReg;
  • trunk/src/VBox/Main/include/ConsoleVRDPServer.h

    r23223 r23643  
    185185
    186186    VRDPInputSynch m_InputSynch;
     187
     188    int32_t mVRDPBindPort;
    187189#endif /* VBOX_WITH_VRDP */
    188190
     
    264266    #define DECL_GETTER(_aType, _aName) STDMETHOD(COMGETTER(_aName)) (_aType *a##_aName)
    265267        DECL_GETTER (BOOL,    Active);
     268        DECL_GETTER (LONG,    Port);
    266269        DECL_GETTER (ULONG,   NumberOfClients);
    267270        DECL_GETTER (LONG64,  BeginTime);
  • trunk/src/VBox/Main/include/DisplayImpl.h

    r23223 r23643  
    198198    }
    199199
     200    STDMETHOD(OnRemoteDisplayInfoChange)()
     201    {
     202        return S_OK;
     203    }
     204
    200205    STDMETHOD(OnUSBControllerChange)()
    201206    {
  • trunk/src/VBox/Main/include/VRDPServerImpl.h

    r23223 r23643  
    5050            return this == &that ||
    5151                   (mEnabled == that.mEnabled &&
    52                     mVRDPPort == that.mVRDPPort &&
     52                    mVRDPPorts == that.mVRDPPorts &&
    5353                    mVRDPAddress == that.mVRDPAddress &&
    5454                    mAuthType == that.mAuthType &&
     
    5959
    6060        BOOL mEnabled;
    61         ULONG mVRDPPort;
     61        Bstr mVRDPPorts;
    6262        Bstr mVRDPAddress;
    6363        VRDPAuthType_T mAuthType;
     
    9393    STDMETHOD(COMGETTER(Enabled)) (BOOL *aEnabled);
    9494    STDMETHOD(COMSETTER(Enabled)) (BOOL aEnable);
    95     STDMETHOD(COMGETTER(Port)) (ULONG *aPort);
    96     STDMETHOD(COMSETTER(Port)) (ULONG aPort);
     95    STDMETHOD(COMGETTER(Ports)) (BSTR *aPorts);
     96    STDMETHOD(COMSETTER(Ports)) (IN_BSTR aPorts);
    9797    STDMETHOD(COMGETTER(NetAddress)) (BSTR *aAddress);
    9898    STDMETHOD(COMSETTER(NetAddress)) (IN_BSTR aAddress);
  • trunk/src/VBox/Main/include/VirtualBoxCallbackImpl.h

    r23223 r23643  
    8787    STDMETHOD(OnParallelPortChange) (IParallelPort *aParallelPort);
    8888    STDMETHOD(OnVRDPServerChange)();
     89    STDMETHOD(OnRemoteDisplayInfoChange)();
    8990    STDMETHOD(OnUSBControllerChange)();
    9091    STDMETHOD(OnUSBDeviceStateChange) (IUSBDevice *aDevice, BOOL aAttached,
  • trunk/src/VBox/Main/xml/Settings.cpp

    r23600 r23643  
    15451545        {
    15461546            pelmHwChild->getAttributeValue("enabled", hw.vrdpSettings.fEnabled);
    1547             pelmHwChild->getAttributeValue("port", hw.vrdpSettings.ulPort);
     1547            pelmHwChild->getAttributeValue("port", hw.vrdpSettings.strPort);
    15481548            pelmHwChild->getAttributeValue("netAddress", hw.vrdpSettings.strNetAddress);
    15491549
     
    23572357    xml::ElementNode *pelmVRDP = pelmHardware->createChild("RemoteDisplay");
    23582358    pelmVRDP->setAttribute("enabled", hw.vrdpSettings.fEnabled);
    2359     pelmVRDP->setAttribute("port", hw.vrdpSettings.ulPort);
     2359    pelmVRDP->setAttribute("port", hw.vrdpSettings.strPort);
    23602360    if (hw.vrdpSettings.strNetAddress.length())
    23612361        pelmVRDP->setAttribute("netAddress", hw.vrdpSettings.strNetAddress);
  • trunk/src/VBox/Main/xml/VirtualBox-settings-common.xsd

    r23465 r23643  
    506506<xsd:complexType name="TRemoteDisplay">
    507507  <xsd:attribute name="enabled" type="xsd:boolean" use="required"/>
    508   <xsd:attribute name="port" type="xsd:unsignedInt" default="0"/>
     508  <xsd:attribute name="port" type="xsd:token" default="0"/>
    509509  <xsd:attribute name="netAddress" type="xsd:token" default=""/>
    510510  <xsd:attribute name="authType" type="TVRDPAuthType" default="Null"/>
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