VirtualBox

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

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

Main/HostDnsService.h: puvlic -> public.

  • 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 49224 2013-10-22 08:50:57Z 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{
34 public:
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));
43
44 protected:
45 virtual HRESULT update(void);
46
47 /* XXX: hide it with struct Data together with <list> */
48 Utf8StrList m_llNameServers;
49 Utf8StrList m_llSearchStrings;
50 com::Utf8Str m_DomainName;
51 RTCRITSECT m_hCritSect;
52
53 private:
54 const VirtualBox *mParent;
55 HostDnsService(const HostDnsService&);
56 HostDnsService& operator =(const HostDnsService&);
57};
58
59# ifdef RT_OS_DARWIN
60class HostDnsServiceDarwin: public HostDnsService
61{
62 public:
63 HostDnsServiceDarwin();
64 virtual ~HostDnsServiceDarwin();
65
66 virtual HRESULT init(const VirtualBox *aParent);
67 virtual HRESULT start(void);
68 virtual void stop(void);
69 virtual HRESULT update();
70
71 private:
72 static void hostDnsServiceStoreCallback(void *store, void *arrayRef, void *info);
73
74};
75# endif
76
77# ifdef RT_OS_WINDOWS
78class HostDnsServiceWin: public HostDnsService
79{
80 public:
81 HostDnsServiceWin();
82 virtual ~HostDnsServiceWin();
83
84 virtual HRESULT init(const VirtualBox *aParent);
85 virtual HRESULT start(void);
86 virtual void stop(void);
87 virtual HRESULT update();
88 void strList2List(Utf8StrList& lst, char *strLst);
89};
90# endif
91
92#if defined(RT_OS_SOLARIS) || defined(RT_OS_LINUX) || defined(RT_OS_OS2)
93
94class HostDnsServiceResolvConf: public HostDnsService
95{
96public:
97 HostDnsServiceResolvConf(const char *aResolvConfFileName = "/etc/resolv.conf");
98 virtual ~HostDnsServiceResolvConf();
99 virtual HRESULT init(const VirtualBox *aParent);
100 virtual HRESULT update();
101 const com::Utf8Str resolvConf() {return m_ResolvConfFilename; }
102protected:
103 com::Utf8Str m_ResolvConfFilename;
104 RTFILE m_ResolvConfFile;
105};
106
107# if defined(RT_OS_SOLARIS)
108/**
109 * XXX: https://blogs.oracle.com/praks/entry/file_events_notification
110 */
111class HostDnsServiceSolaris: public HostDnsServiceResolvConf
112{
113public:
114 HostDnsServiceSolaris(){}
115 virtual ~HostDnsServiceSolaris(){}
116};
117# elif defined(RT_OS_LINUX)
118class HostDnsServiceLinux: public HostDnsServiceResolvConf
119{
120 public:
121 HostDnsServiceLinux(){}
122 virtual ~HostDnsServiceLinux(){}
123 virtual HRESULT init(const VirtualBox *aParent);
124 virtual void stop(void);
125
126 static int hostMonitoringRoutine(RTTHREAD ThreadSelf, void *pvUser);
127};
128
129# elif defined(RT_OS_OS2)
130class HostDnsServiceOs2: public HostDnsServiceResolvConf
131{
132 public:
133 HostDnsServiceOs2()
134 {
135 /* XXX: \\MPTN\\ETC should be taken from environment variable ETC */
136 ::HostDnsServiceResolvConf("\\MPTN\\ETC\\RESOLV2");
137 }
138 virtual ~HostDnsServiceOs2(){}
139};
140# endif
141#endif
142
143#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