VirtualBox

Changeset 5060 in vbox


Ignore:
Timestamp:
Sep 26, 2007 5:14:35 PM (17 years ago)
Author:
vboxsync
Message:

Added custom line speed setting to XML/COM/CFGM. Hope I haven't forgotten anything.

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

Legend:

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

    r4505 r5060  
    851851        hrc = networkAdapter->COMGETTER(CableConnected)(&fCableConnected);          H();
    852852        rc = CFGMR3InsertInteger(pCfg, "CableConnected", fCableConnected ? 1 : 0);  RC_CHECK();
     853
     854        /*
     855         * Line speed to report from custom drivers
     856         */
     857        ULONG ulLineSpeed;
     858        hrc = networkAdapter->COMGETTER(LineSpeed)(&ulLineSpeed);                   H();
     859        rc = CFGMR3InsertInteger(pCfg, "LineSpeed", ulLineSpeed);                   RC_CHECK();
    853860
    854861        /*
  • trunk/src/VBox/Main/MachineImpl.cpp

    r4859 r5060  
    43754375            bool cableConnected;
    43764376            CFGLDRQueryBool (adapterNode, "cable", &cableConnected);
     4377            /* line speed (defaults to 100 Mbps) */
     4378            uint32_t lineSpeed = 100000;
     4379            CFGLDRQueryUInt32 (adapterNode, "speed", &lineSpeed);
    43774380            /* tracing (defaults to false) */
    43784381            bool traceEnabled;
     
    43844387            mNetworkAdapters [slot]->COMSETTER(MACAddress) (macAddr);
    43854388            mNetworkAdapters [slot]->COMSETTER(CableConnected) (cableConnected);
     4389            mNetworkAdapters [slot]->COMSETTER(LineSpeed) (lineSpeed);
    43864390            mNetworkAdapters [slot]->COMSETTER(TraceEnabled) (traceEnabled);
    43874391            mNetworkAdapters [slot]->COMSETTER(TraceFile) (traceFile);
     
    62146218            CFGLDRSetBool (networkAdapterNode, "cable",
    62156219                           !!mNetworkAdapters [slot]->data()->mCableConnected);
     6220
     6221            CFGLDRSetUInt32 (networkAdapterNode, "speed",
     6222                             mNetworkAdapters [slot]->data()->mLineSpeed);
    62166223
    62176224            if (mNetworkAdapters [slot]->data()->mTraceEnabled)
  • trunk/src/VBox/Main/NetworkAdapterImpl.cpp

    r4071 r5060  
    664664        mData.backup();
    665665        mData->mCableConnected = aConnected;
     666
     667        /* leave the lock before informing callbacks */
     668        alock.unlock();
     669
     670        mParent->onNetworkAdapterChange (this);
     671    }
     672
     673    return S_OK;
     674}
     675
     676STDMETHODIMP NetworkAdapter::COMGETTER(LineSpeed) (ULONG *aSpeed)
     677{
     678    if (!aSpeed)
     679        return E_POINTER;
     680
     681    AutoCaller autoCaller (this);
     682    CheckComRCReturnRC (autoCaller.rc());
     683
     684    AutoReaderLock alock (this);
     685
     686    *aSpeed = mData->mLineSpeed;
     687
     688    return S_OK;
     689}
     690
     691STDMETHODIMP NetworkAdapter::COMSETTER(LineSpeed) (ULONG aSpeed)
     692{
     693    AutoCaller autoCaller (this);
     694    CheckComRCReturnRC (autoCaller.rc());
     695
     696    /* the machine needs to be mutable */
     697    Machine::AutoMutableStateDependency adep (mParent);
     698    CheckComRCReturnRC (adep.rc());
     699
     700    AutoLock alock (this);
     701
     702    if (aSpeed != mData->mLineSpeed)
     703    {
     704        mData.backup();
     705        mData->mLineSpeed = aSpeed;
    666706
    667707        /* leave the lock before informing callbacks */
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r4685 r5060  
    71067106    </attribute>
    71077107
     7108    <attribute name="lineSpeed" type="unsigned long">
     7109      <desc>
     7110        Line speed reported by custom drivers, in units of 1 kbps.
     7111      </desc>
     7112    </attribute>
     7113
    71087114    <attribute name="traceEnabled" type="boolean">
    71097115      <desc>
  • trunk/src/VBox/Main/include/NetworkAdapterImpl.h

    r4071 r5060  
    3737            : mSlot (0), mEnabled (FALSE)
    3838            , mAttachmentType (NetworkAttachmentType_NoNetworkAttachment)
    39             ,  mCableConnected (TRUE), mTraceEnabled (FALSE)
     39            ,  mCableConnected (TRUE), mLineSpeed (0), mTraceEnabled (FALSE)
    4040#ifdef RT_OS_WINDOWS
    4141            , mHostInterface ("") // cannot be null
     
    5555                    mAttachmentType == that.mAttachmentType &&
    5656                    mCableConnected == that.mCableConnected &&
     57                    mLineSpeed == that.mLineSpeed &&
    5758                    mTraceEnabled == that.mTraceEnabled &&
    5859                    mHostInterface == that.mHostInterface &&
     
    7172        NetworkAttachmentType_T mAttachmentType;
    7273        BOOL mCableConnected;
     74        ULONG mLineSpeed;
    7375        BOOL mTraceEnabled;
    7476        Bstr mTraceFile;
     
    131133    STDMETHOD(COMGETTER(TraceEnabled)) (BOOL *aEnabled);
    132134    STDMETHOD(COMSETTER(TraceEnabled)) (BOOL aEnabled);
     135    STDMETHOD(COMGETTER(LineSpeed)) (ULONG *aSpeed);
     136    STDMETHOD(COMSETTER(LineSpeed)) (ULONG aSpeed);
    133137    STDMETHOD(COMGETTER(TraceFile)) (BSTR *aTraceFile);
    134138    STDMETHOD(COMSETTER(TraceFile)) (INPTR BSTR aTraceFile);
  • trunk/src/VBox/Main/xml/VirtualBox-settings-common.xsd

    r4859 r5060  
    531531  </xsd:attribute>
    532532  <xsd:attribute name="cable" type="xsd:boolean" use="required"/>
     533  <xsd:attribute name="speed" type="xsd:unsignedInt"/>
    533534  <xsd:attribute name="trace" type="xsd:boolean" default="false"/>
    534535  <xsd:attribute name="tracefile" type="xsd:string"/>
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