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