VirtualBox

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


Ignore:
Timestamp:
Nov 29, 2018 4:16:40 PM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
127022
Message:

Main/DHCPServer: (bugref:9288) Allow removal of DHCP options, show options when listing DHCP servers.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r75817 r75819  
    17911791  <interface
    17921792    name="IDHCPServer" extends="$unknown"
    1793     uuid="197717d2-a742-4966-a529-d1467e903feb"
     1793    uuid="ea2d467f-b6c2-4b9a-8eb5-6e2f275dd72e"
    17941794    wsmap="managed"
    17951795    reservedMethods="2" reservedAttributes="6"
     
    18421842      <param name="option" type="DhcpOpt" dir="in"/>
    18431843      <param name="value" type="wstring" dir="in" />
     1844    </method>
     1845
     1846    <method name="removeGlobalOption">
     1847      <desc>
     1848        removes the specified option
     1849        <result name="E_INVALIDARG">
     1850          invalid option id supplied
     1851        </result>
     1852      </desc>
     1853      <param name="option" type="DhcpOpt" dir="in"/>
     1854    </method>
     1855
     1856    <method name="removeGlobalOptions">
     1857      <desc>
     1858        removes all global options
     1859        <result name="E_FAIL">
     1860          failed to remove global options
     1861        </result>
     1862      </desc>
    18441863    </method>
    18451864
     
    18771896    </method>
    18781897
     1898    <method name="removeVmSlotOption">
     1899      <desc>
     1900        removes the specified option
     1901        <result name="E_INVALIDARG">
     1902          invalid VM, slot, or option id supplied
     1903        </result>
     1904      </desc>
     1905      <param name="vmname" type="wstring" dir="in"/>
     1906      <param name="slot" type="long" dir="in"/>
     1907      <param name="option" type="DhcpOpt" dir="in"/>
     1908    </method>
     1909
    18791910    <method name="removeVmSlotOptions">
     1911      <desc>
     1912        removes all option for the specified adapter
     1913        <result name="E_INVALIDARG">
     1914          invalid VM or slot supplied
     1915        </result>
     1916      </desc>
    18801917      <param name="vmname" type="wstring" dir="in"/>
    18811918      <param name="slot" type="long" dir="in"/>
  • trunk/src/VBox/Main/include/DHCPServerImpl.h

    r75648 r75819  
    116116    HRESULT addGlobalOption(DhcpOpt_T aOption,
    117117                            const com::Utf8Str &aValue);
     118    HRESULT removeGlobalOption(DhcpOpt_T aOption);
     119    HRESULT removeGlobalOptions();
    118120    HRESULT addVmSlotOption(const com::Utf8Str &aVmName,
    119121                            LONG aSlot,
    120122                            DhcpOpt_T aOption,
    121123                            const com::Utf8Str &aValue);
     124    HRESULT removeVmSlotOption(const com::Utf8Str &aVmName,
     125                               LONG aSlot,
     126                               DhcpOpt_T aOption);
    122127    HRESULT removeVmSlotOptions(const com::Utf8Str &aVmName,
    123128                                LONG aSlot);
  • trunk/src/VBox/Main/src-server/DHCPServerImpl.cpp

    r75648 r75819  
    478478
    479479
     480HRESULT DHCPServer::removeGlobalOption(DhcpOpt_T aOption)
     481{
     482    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     483
     484    settings::DhcpOptionMap::size_type cErased = m->GlobalDhcpOptions.erase(aOption);
     485    if (!cErased)
     486        return E_INVALIDARG;
     487
     488    alock.release();
     489
     490    AutoWriteLock vboxLock(mVirtualBox COMMA_LOCKVAL_SRC_POS);
     491    return mVirtualBox->i_saveSettings();
     492}
     493
     494
     495HRESULT DHCPServer::removeGlobalOptions()
     496{
     497    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     498    m->GlobalDhcpOptions.clear();
     499
     500    alock.release();
     501
     502    AutoWriteLock vboxLock(mVirtualBox COMMA_LOCKVAL_SRC_POS);
     503    return mVirtualBox->i_saveSettings();
     504}
     505
     506
    480507HRESULT DHCPServer::getGlobalOptions(std::vector<com::Utf8Str> &aValues)
    481508{
     
    520547    int rc = addOption(map, aOption, aValue);
    521548    if (!RT_SUCCESS(rc))
     549        return E_INVALIDARG;
     550
     551    alock.release();
     552
     553    AutoWriteLock vboxLock(mVirtualBox COMMA_LOCKVAL_SRC_POS);
     554    return mVirtualBox->i_saveSettings();
     555}
     556
     557
     558HRESULT DHCPServer::removeVmSlotOption(const com::Utf8Str &aVmName, LONG aSlot, DhcpOpt_T aOption)
     559{
     560    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     561    settings::DhcpOptionMap &map = i_findOptMapByVmNameSlot(aVmName, aSlot);
     562    settings::DhcpOptionMap::size_type cErased = map.erase(aOption);
     563    if (!cErased)
    522564        return E_INVALIDARG;
    523565
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