VirtualBox

source: vbox/trunk/src/VBox/Main/src-server/HostDnsService.h@ 49202

Last change on this file since 49202 was 49202, checked in by vboxsync, 11 years ago

Makefile.kmk: adds HostDnsServiceLinux.cpp to build on Linux host
HostDnsService.h: adds declarations of defined functions.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.8 KB
Line 
1/* $Id: HostDnsService.h 49202 2013-10-21 03:01:10Z vboxsync $ */
2/** @file
3 * Host DNS listener.
4 */
5
6/*
7 * Copyright (C) 2005-2012 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18#ifndef ___H_DNSHOSTSERVICE
19#define ___H_DNSHOSTSERVICE
20#include "VirtualBoxBase.h"
21
22#include <iprt/cdefs.h>
23#include <iprt/critsect.h>
24#include <iprt/types.h>
25
26
27#include <list>
28
29typedef std::list<com::Utf8Str> Utf8StrList;
30typedef Utf8StrList::iterator Utf8StrListIterator;
31
32class HostDnsService
33{
34public:
35 HostDnsService();
36 virtual ~HostDnsService();
37 virtual HRESULT init(const VirtualBox *aParent);
38 virtual HRESULT start(void);
39 virtual void stop(void);
40 STDMETHOD(COMGETTER(NameServers))(ComSafeArrayOut(BSTR, aNameServers));
41 STDMETHOD(COMGETTER(DomainName))(BSTR *aDomainName);
42 STDMETHOD(COMGETTER(SearchStrings))(ComSafeArrayOut(BSTR, aSearchStrings));
43protected:
44 virtual HRESULT update(void);
45
46 /* XXX: hide it with struct Data together with <list> */
47 Utf8StrList m_llNameServers;
48 Utf8StrList m_llSearchStrings;
49 com::Utf8Str m_DomainName;
50 RTCRITSECT m_hCritSect;
51
52private:
53 const VirtualBox *mParent;
54 HostDnsService(const HostDnsService&);
55 HostDnsService& operator =(const HostDnsService&);
56};
57
58# ifdef RT_OS_DARWIN
59class HostDnsServiceDarwin: public HostDnsService
60{
61public:
62 HostDnsServiceDarwin();
63 virtual ~HostDnsServiceDarwin();
64
65 virtual HRESULT init(const VirtualBox *aParent);
66 virtual HRESULT start(void);
67 virtual void stop(void);
68 virtual HRESULT update();
69private:
70 static void hostDnsServiceStoreCallback(void *store, void *arrayRef, void *info);
71
72};
73# endif
74
75# ifdef RT_OS_WINDOWS
76class HostDnsServiceWin: public HostDnsService
77{
78public:
79 HostDnsServiceWin();
80 virtual ~HostDnsServiceWin();
81
82 virtual HRESULT init(const VirtualBox *aParent);
83 virtual HRESULT start(void);
84 virtual void stop(void);
85 virtual HRESULT update();
86private:
87 void strList2List(Utf8StrList& lst, char *strLst);
88};
89# endif
90
91#if defined(RT_OS_SOLARIS) || defined(RT_OS_LINUX) || defined(RT_OS_OS2)
92
93class HostDnsServiceResolvConf: public HostDnsService
94{
95public:
96 HostDnsServiceResolvConf(const char *aResolvConfFileName = "/etc/resolv.conf");
97 virtual ~HostDnsServiceResolvConf();
98 virtual HRESULT init(const VirtualBox *aParent);
99 virtual HRESULT update();
100 const com::Utf8Str resolvConf() {return m_ResolvConfFilename; }
101protected:
102 com::Utf8Str m_ResolvConfFilename;
103 RTFILE m_ResolvConfFile;
104};
105
106# if defined(RT_OS_SOLARIS)
107/**
108 * XXX: https://blogs.oracle.com/praks/entry/file_events_notification
109 */
110class HostDnsServiceSolaris: public HostDnsServiceResolvConf
111{
112public:
113 HostDnsServiceSolaris(){}
114 virtual ~HostDnsServiceSolaris(){}
115};
116# elif defined(RT_OS_LINUX)
117class HostDnsServiceLinux: public HostDnsServiceResolvConf
118{
119public:
120 HostDnsServiceLinux(){}
121 virtual ~HostDnsServiceLinux(){}
122 virtual HRESULT init(const VirtualBox *aParent);
123 virtual void stop(void);
124
125 static int hostMonitoringRoutine(RTTHREAD ThreadSelf, void *pvUser);
126};
127
128# elif defined(RT_OS_OS2)
129class HostDnsServiceOs2: public HostDnsServiceResolvConf
130{
131public:
132 HostDnsServiceOs2()
133 {
134 /* XXX: \\MPTN\\ETC should be taken from environment variable ETC */
135 ::HostDnsServiceResolvConf("\\MPTN\\ETC\\RESOLV2");
136 }
137 virtual ~HostDnsServiceOs2(){}
138};
139# endif
140#endif
141
142#endif /* !___H_DNSHOSTSERVICE */
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette