VirtualBox

Changeset 49837 in vbox for trunk/src


Ignore:
Timestamp:
Dec 9, 2013 12:14:01 PM (11 years ago)
Author:
vboxsync
Message:

VBoxNetDHCP.cpp: adds listener for host DNS change event.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/NetworkServices/DHCP/VBoxNetDHCP.cpp

    r49827 r49837  
    8686 * DHCP server instance.
    8787 */
    88 class VBoxNetDhcp: public VBoxNetBaseService
     88class VBoxNetDhcp: public VBoxNetBaseService, public NATNetworkEventAdapter
    8989{
    9090public:
     
    109109    int initNoMain();
    110110    int initWithMain();
     111    HRESULT HandleEvent(VBoxEventType_T aEventType, IEvent *pEvent);
    111112    int fetchAndUpdateDnsInfo();
    112113
     
    128129    ComPtr<INATNetwork> m_NATNetwork;
    129130
     131    /** Listener for Host DNS changes */
     132    ComPtr<NATNetworkListenerImpl> m_vboxListener;
    130133    /*
    131134     * We will ignore cmd line parameters IFF there will be some DHCP specific arguments
     
    502505    AssertMsgRCReturn(rc, ("Wasn't able to fetch Dns info"), rc);
    503506
     507    ComEventTypeArray aVBoxEvents;
     508    aVBoxEvents.push_back(VBoxEventType_OnHostNameResolutionConfigurationChange);
     509    rc = createNatListener(m_vboxListener, virtualbox, this, aVBoxEvents);
     510    AssertRCReturn(rc, rc);
     511
    504512    com::Bstr strUpperIp, strLowerIp;
    505513   
     
    510518    AssertComRCReturn(hrc, VERR_INTERNAL_ERROR);
    511519    RTNetStrToIPv4Addr(com::Utf8Str(strUpperIp).c_str(), &UpperAddress);
    512 
    513520
    514521    hrc = m_DhcpServer->COMGETTER(LowerIP)(strLowerIp.asOutParam());
     
    572579   
    573580    return VINF_SUCCESS;
     581}
     582
     583
     584HRESULT VBoxNetDhcp::HandleEvent(VBoxEventType_T aEventType, IEvent *pEvent)
     585{
     586    switch(aEventType)
     587    {
     588        case VBoxEventType_OnHostNameResolutionConfigurationChange:
     589            fetchAndUpdateDnsInfo();
     590            break;
     591    }
     592
     593    return S_OK;
    574594}
    575595
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