VirtualBox

source: vbox/trunk/src/VBox/Main/src-server/HostDnsService.cpp@ 48330

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

Main/DNS: general host specific DNS and Co handling added.
Darwin implementation has self-update mechanism, for other hosts it's in todo list.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.3 KB
Line 
1/* $Id: HostDnsService.cpp 48330 2013-09-06 03:16:32Z vboxsync $
2/** @file
3 * Base class fo Host DNS & Co services.
4 */
5
6/*
7 * Copyright (C) 2013 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#include <VBox/com/array.h>
19#include <VBox/com/ptr.h>
20#include <VBox/com/string.h>
21
22#include "HostDnsService.h"
23#include <iprt/thread.h>
24#include <iprt/semaphore.h>
25
26HostDnsService::HostDnsService(){}
27
28HostDnsService::~HostDnsService ()
29{
30 int rc = RTCritSectDelete(&m_hCritSect);
31 AssertRC(rc);
32}
33
34
35HRESULT HostDnsService::init (void)
36{
37 int rc = RTCritSectInit(&m_hCritSect);
38 AssertRCReturn(rc, E_FAIL);
39 return S_OK;
40}
41
42HRESULT HostDnsService::start()
43{
44 return S_OK;
45}
46
47void HostDnsService::stop()
48{
49}
50
51HRESULT HostDnsService::update()
52{
53 return S_OK;
54}
55
56STDMETHODIMP HostDnsService::COMGETTER(NameServers)(ComSafeArrayOut(BSTR, aNameServers))
57{
58 RTCritSectEnter(&m_hCritSect);
59 com::SafeArray<BSTR> nameServers(m_llNameServers.size());
60
61 Utf8StrListIterator it;
62 int i = 0;
63 for (it = m_llNameServers.begin(); it != m_llNameServers.end(); ++it, ++i)
64 (*it).cloneTo(&nameServers[i]);
65
66 nameServers.detachTo(ComSafeArrayOutArg(aNameServers));
67
68 RTCritSectLeave(&m_hCritSect);
69
70 return S_OK;
71}
72
73
74STDMETHODIMP HostDnsService::COMGETTER(DomainName)(BSTR *aDomainName)
75{
76 RTCritSectEnter(&m_hCritSect);
77
78 m_DomainName.cloneTo(aDomainName);
79
80 RTCritSectLeave(&m_hCritSect);
81
82 return S_OK;
83}
84
85
86STDMETHODIMP HostDnsService::COMGETTER(SearchStrings)(ComSafeArrayOut(BSTR, aSearchStrings))
87{
88 RTCritSectEnter(&m_hCritSect);
89
90 com::SafeArray<BSTR> searchString(m_llSearchStrings.size());
91
92 Utf8StrListIterator it;
93 int i = 0;
94 for (it = m_llSearchStrings.begin(); it != m_llSearchStrings.end(); ++it, ++i)
95 (*it).cloneTo(&searchString[i]);
96
97
98 searchString.detachTo(ComSafeArrayOutArg(aSearchStrings));
99
100 RTCritSectLeave(&m_hCritSect);
101
102 return S_OK;
103}
104
105
Note: See TracBrowser for help on using the repository browser.

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