VirtualBox

Changeset 48332 in vbox for trunk/src/VBox/Main/src-server


Ignore:
Timestamp:
Sep 6, 2013 3:21:07 AM (11 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
88760
Message:

Main/DNS: implementation of DNS related hooks in IHost interface.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-server/HostImpl.cpp

    r47117 r48332  
    2323
    2424#include "HostImpl.h"
     25#include "HostDnsService.h"
    2526
    2627#ifdef VBOX_WITH_USB
     
    222223
    223224    HostPowerService        *pHostPowerService;
    224 
    225     /* Name resolving */
    226     std::list<com::Bstr>     llNameServers;
    227     std::list<com::Bstr>     llSearchStrings;
    228     Bstr                     DomainName;
    229     /* XXX: we need timestamp when these values were set, on repeate in some
    230      *  (~1h?, 5 min?) period, this values should be refetched from host syetem.
    231      */
     225    /** Host's DNS informaton fetching */
     226    HostDnsService          *pHostDnsService;
    232227};
    233228
     
    324319    /* Create the list of network interfaces so their metrics get registered. */
    325320    updateNetIfList();
     321
     322# if defined (RT_OS_DARWIN)
     323    m->pHostDnsService = new HostDnsServiceDarwin();
     324# elif defined(RT_OS_WINDOWS)
     325    m->pHostDnsService = new HostDnsServiceWin();
     326# elif defined(RT_OS_LINUX)
     327    m->pHostDnsService = new HostDnsServiceLinux();
     328# elif defined(RT_OS_SOLARIS)
     329    m->pHostDnsService = new HostDnsServiceSolaris();
     330# elif defined(RT_OS_OS2)
     331    m->pHostDnsService = new HostDnsServiceOs2();
     332# else
     333    m->pHostDnsService = new HostDnsService();
     334# endif
     335
     336    hrc = m->pHostDnsService->init();
     337    AssertComRCReturn(hrc, hrc);
     338
     339    hrc = m->pHostDnsService->start();
     340    AssertComRCReturn(hrc, hrc);
    326341
    327342#if defined (RT_OS_WINDOWS)
     
    526541#endif
    527542
     543    m->pHostDnsService->stop();
     544
     545    delete m->pHostDnsService;
    528546    delete m;
    529547    m = NULL;
     
    854872STDMETHODIMP Host::COMGETTER(NameServers)(ComSafeArrayOut(BSTR, aNameServers))
    855873{
    856     NOREF(aNameServers);
    857 #ifndef RT_OS_WINDOWS
    858     NOREF(aNameServersSize);
    859 #endif
    860     return E_NOTIMPL;
     874    CheckComArgOutSafeArrayPointerValid(aNameServers);
     875
     876    AutoCaller autoCaller(this);
     877    if (FAILED(autoCaller.rc())) return autoCaller.rc();
     878
     879    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     880
     881    return m->pHostDnsService->COMGETTER(NameServers)(ComSafeArrayOutArg(aNameServers));
    861882}
    862883
     
    867888STDMETHODIMP Host::COMGETTER(DomainName)(BSTR *aDomainName)
    868889{
    869     NOREF(aDomainName);
    870     return E_NOTIMPL;
     890    /* XXX: note here should be synchronization with thread polling state
     891     * changes in name resoving system on host */
     892   
     893    AutoCaller autoCaller(this);
     894    if (FAILED(autoCaller.rc())) return autoCaller.rc();
     895
     896    return m->pHostDnsService->COMGETTER(DomainName)(aDomainName);
    871897}
    872898
     
    877903STDMETHODIMP Host::COMGETTER(SearchStrings)(ComSafeArrayOut(BSTR, aSearchStrings))
    878904{
    879     NOREF(aSearchStrings);
    880 #ifndef RT_OS_WINDOWS
    881     NOREF(aSearchStringsSize);
    882 #endif
    883     return E_NOTIMPL;
     905    CheckComArgOutSafeArrayPointerValid(aSearchStrings);
     906
     907    AutoCaller autoCaller(this);
     908    if (FAILED(autoCaller.rc())) return autoCaller.rc();
     909
     910    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     911
     912    return m->pHostDnsService->COMGETTER(SearchStrings)(ComSafeArrayOutArg(aSearchStrings));
    884913}
    885914
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