HostDnsService.h revision 86cfa0622a1e43e622cfe0790190769665cd527f
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;
3f2299591cfeb8a37a3578bef9c44c1790860948vboxsync * This class supposed to be a real DNS monitor object it should be singleton,
3f2299591cfeb8a37a3578bef9c44c1790860948vboxsync * it lifecycle starts and ends together with VBoxSVC.
3f2299591cfeb8a37a3578bef9c44c1790860948vboxsync static void shutdown();
c0b3f8f271f3bc2358c46ed5a99af29a28bd1b66vboxsync void releaseMonitorProxy(PCHostDnsMonitorProxy) const;
dbbd0cae65188dffbd927bdde2d88cbeec2e26davboxsync /* @note: method will wait till client call
dbbd0cae65188dffbd927bdde2d88cbeec2e26davboxsync HostDnsService::monitorThreadInitializationDone() */
3f2299591cfeb8a37a3578bef9c44c1790860948vboxsync void notifyAll() const;
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.
c0b3f8f271f3bc2358c46ed5a99af29a28bd1b66vboxsync void init(const HostDnsMonitor *aMonitor, const VirtualBox *aParent);
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) {}
3f2299591cfeb8a37a3578bef9c44c1790860948vboxsync virtual HRESULT init(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
6c2ae4881e4220cc4bba0738d2b0d158d571ec9bvboxsync HRESULT init(){ return HostDnsServiceResolvConf::init("/etc/resolv.conf");}
c0b3f8f271f3bc2358c46ed5a99af29a28bd1b66vboxsyncclass HostDnsServiceLinux : public HostDnsServiceResolvConf
dbbd0cae65188dffbd927bdde2d88cbeec2e26davboxsync HostDnsServiceLinux():HostDnsServiceResolvConf(true){}
dbbd0cae65188dffbd927bdde2d88cbeec2e26davboxsync virtual HRESULT init(){ return HostDnsServiceResolvConf::init("/etc/resolv.conf");}
d27bf03c13c7a5707386600ef9b0bbb82fb3420dvboxsyncclass HostDnsServiceFreebsd: public HostDnsServiceResolvConf
d27bf03c13c7a5707386600ef9b0bbb82fb3420dvboxsync HRESULT init(){ return HostDnsServiceResolvConf::init("/etc/resolv.conf");}
c0b3f8f271f3bc2358c46ed5a99af29a28bd1b66vboxsyncclass HostDnsServiceOs2 : public HostDnsServiceResolvConf
3f2299591cfeb8a37a3578bef9c44c1790860948vboxsync /* XXX: \\MPTN\\ETC should be taken from environment variable ETC */
3f2299591cfeb8a37a3578bef9c44c1790860948vboxsync HRESULT init(){ return init("\\MPTN\\ETC\\RESOLV2");}
18b1f1bb3429f8bfc1a52cfaeb2445e9fb1f55cdvboxsync#endif /* !___H_DNSHOSTSERVICE */