01bceecc7f7484a8820c77b884bb91cdefc97390vboxsync * Host DNS listener.
18b1f1bb3429f8bfc1a52cfaeb2445e9fb1f55cdvboxsync * Copyright (C) 2005-2012 Oracle Corporation
18b1f1bb3429f8bfc1a52cfaeb2445e9fb1f55cdvboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
18b1f1bb3429f8bfc1a52cfaeb2445e9fb1f55cdvboxsync * available from http://www.virtualbox.org. This file is free software;
18b1f1bb3429f8bfc1a52cfaeb2445e9fb1f55cdvboxsync * you can redistribute it and/or modify it under the terms of the GNU
18b1f1bb3429f8bfc1a52cfaeb2445e9fb1f55cdvboxsync * General Public License (GPL) as published by the Free Software
18b1f1bb3429f8bfc1a52cfaeb2445e9fb1f55cdvboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
18b1f1bb3429f8bfc1a52cfaeb2445e9fb1f55cdvboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
18b1f1bb3429f8bfc1a52cfaeb2445e9fb1f55cdvboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
c0b3f8f271f3bc2358c46ed5a99af29a28bd1b66vboxsynctypedef const HostDnsMonitorProxy *PCHostDnsMonitorProxy;
b5e51a17f57d4fe07a991fe3622c16742f558099vboxsync bool equals(const HostDnsInformation &, bool fDNSOrderIgnore = false) const;
3f2299591cfeb8a37a3578bef9c44c1790860948vboxsync * This class supposed to be a real DNS monitor object it should be singleton,
3f2299591cfeb8a37a3578bef9c44c1790860948vboxsync * it lifecycle starts and ends together with VBoxSVC.
b5e51a17f57d4fe07a991fe3622c16742f558099vboxsync static const HostDnsMonitor *getHostDnsMonitor(VirtualBox *virtualbox);
3f2299591cfeb8a37a3578bef9c44c1790860948vboxsync static void shutdown();
c0b3f8f271f3bc2358c46ed5a99af29a28bd1b66vboxsync void releaseMonitorProxy(PCHostDnsMonitorProxy) const;
dbbd0cae65188dffbd927bdde2d88cbeec2e26davboxsync /* @note: method will wait till client call
dbbd0cae65188dffbd927bdde2d88cbeec2e26davboxsync HostDnsService::monitorThreadInitializationDone() */
dbbd0cae65188dffbd927bdde2d88cbeec2e26davboxsync /* this function used only if HostDnsMonitor::HostDnsMonitor(true) */
c0b3f8f271f3bc2358c46ed5a99af29a28bd1b66vboxsync HostDnsMonitor& operator= (const HostDnsMonitor &);
dbbd0cae65188dffbd927bdde2d88cbeec2e26davboxsync static int threadMonitoringRoutine(RTTHREAD, void *);
3f2299591cfeb8a37a3578bef9c44c1790860948vboxsync * This class supposed to be a proxy for events on changing Host Name Resolving configurations.
b5e51a17f57d4fe07a991fe3622c16742f558099vboxsync void init(const HostDnsMonitor *aMonitor, VirtualBox *virtualbox);
3f2299591cfeb8a37a3578bef9c44c1790860948vboxsync void notify() const;
70c5cdbebee624ca386867b552ec032374bfaaf8vboxsync HRESULT GetNameServers(std::vector<com::Utf8Str> &aNameServers);
70c5cdbebee624ca386867b552ec032374bfaaf8vboxsync HRESULT GetSearchStrings(std::vector<com::Utf8Str> &aSearchStrings);
18b1f1bb3429f8bfc1a52cfaeb2445e9fb1f55cdvboxsync static void hostDnsServiceStoreCallback(void *store, void *arrayRef, void *info);
d27bf03c13c7a5707386600ef9b0bbb82fb3420dvboxsync# if defined(RT_OS_SOLARIS) || defined(RT_OS_LINUX) || defined(RT_OS_OS2) || defined(RT_OS_FREEBSD)
3f2299591cfeb8a37a3578bef9c44c1790860948vboxsyncclass HostDnsServiceResolvConf: public HostDnsMonitor
dbbd0cae65188dffbd927bdde2d88cbeec2e26davboxsync explicit HostDnsServiceResolvConf(bool fThreaded = false) : HostDnsMonitor(fThreaded), m(NULL) {}
b5e51a17f57d4fe07a991fe3622c16742f558099vboxsync virtual HRESULT init(VirtualBox *virtualbox, const char *aResolvConfFileName);
dbbd0cae65188dffbd927bdde2d88cbeec2e26davboxsync /* While not all hosts supports Hosts DNS change notifiaction
dbbd0cae65188dffbd927bdde2d88cbeec2e26davboxsync * default implementation offers return VERR_IGNORE.
18b1f1bb3429f8bfc1a52cfaeb2445e9fb1f55cdvboxsync * XXX: https://blogs.oracle.com/praks/entry/file_events_notification
c0b3f8f271f3bc2358c46ed5a99af29a28bd1b66vboxsyncclass HostDnsServiceSolaris : public HostDnsServiceResolvConf
b5e51a17f57d4fe07a991fe3622c16742f558099vboxsync return HostDnsServiceResolvConf::init(virtualbox, "/etc/resolv.conf");
c0b3f8f271f3bc2358c46ed5a99af29a28bd1b66vboxsyncclass HostDnsServiceLinux : public HostDnsServiceResolvConf
dbbd0cae65188dffbd927bdde2d88cbeec2e26davboxsync HostDnsServiceLinux():HostDnsServiceResolvConf(true){}
b5e51a17f57d4fe07a991fe3622c16742f558099vboxsync return HostDnsServiceResolvConf::init(virtualbox, "/etc/resolv.conf");
d27bf03c13c7a5707386600ef9b0bbb82fb3420dvboxsyncclass HostDnsServiceFreebsd: public HostDnsServiceResolvConf
b5e51a17f57d4fe07a991fe3622c16742f558099vboxsync return HostDnsServiceResolvConf::init(virtualbox, "/etc/resolv.conf");
c0b3f8f271f3bc2358c46ed5a99af29a28bd1b66vboxsyncclass HostDnsServiceOs2 : public HostDnsServiceResolvConf
3f2299591cfeb8a37a3578bef9c44c1790860948vboxsync /* XXX: \\MPTN\\ETC should be taken from environment variable ETC */
b5e51a17f57d4fe07a991fe3622c16742f558099vboxsync return HostDnsServiceResolvConf::init(virtualbox, "\\MPTN\\ETC\\RESOLV2");
18b1f1bb3429f8bfc1a52cfaeb2445e9fb1f55cdvboxsync#endif /* !___H_DNSHOSTSERVICE */