VirtualBox

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

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

Main: Whitespace (including tabs!) and svn:keywords cleanups by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.5 KB
Line 
1/* $Id: HostDnsService.cpp 48955 2013-10-07 21:59:25Z 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 <iprt/cpp/utils.h>
23
24#include "VirtualBoxImpl.h"
25#include "HostDnsService.h"
26#include <iprt/thread.h>
27#include <iprt/semaphore.h>
28
29HostDnsService::HostDnsService(){}
30
31HostDnsService::~HostDnsService ()
32{
33 int rc = RTCritSectDelete(&m_hCritSect);
34 AssertRC(rc);
35}
36
37
38HRESULT HostDnsService::init(const VirtualBox *aParent)
39{
40 mParent = aParent;
41
42 int rc = RTCritSectInit(&m_hCritSect);
43 AssertRCReturn(rc, E_FAIL);
44 return S_OK;
45}
46
47HRESULT HostDnsService::start()
48{
49 return S_OK;
50}
51
52void HostDnsService::stop()
53{
54}
55
56HRESULT HostDnsService::update()
57{
58 unconst(mParent)->onHostNameResolutionConfigurationChange();
59 return S_OK;
60}
61
62STDMETHODIMP HostDnsService::COMGETTER(NameServers)(ComSafeArrayOut(BSTR, aNameServers))
63{
64 RTCritSectEnter(&m_hCritSect);
65 com::SafeArray<BSTR> nameServers(m_llNameServers.size());
66
67 Utf8StrListIterator it;
68 int i = 0;
69 for (it = m_llNameServers.begin(); it != m_llNameServers.end(); ++it, ++i)
70 (*it).cloneTo(&nameServers[i]);
71
72 nameServers.detachTo(ComSafeArrayOutArg(aNameServers));
73
74 RTCritSectLeave(&m_hCritSect);
75
76 return S_OK;
77}
78
79
80STDMETHODIMP HostDnsService::COMGETTER(DomainName)(BSTR *aDomainName)
81{
82 RTCritSectEnter(&m_hCritSect);
83
84 m_DomainName.cloneTo(aDomainName);
85
86 RTCritSectLeave(&m_hCritSect);
87
88 return S_OK;
89}
90
91
92STDMETHODIMP HostDnsService::COMGETTER(SearchStrings)(ComSafeArrayOut(BSTR, aSearchStrings))
93{
94 RTCritSectEnter(&m_hCritSect);
95
96 com::SafeArray<BSTR> searchString(m_llSearchStrings.size());
97
98 Utf8StrListIterator it;
99 int i = 0;
100 for (it = m_llSearchStrings.begin(); it != m_llSearchStrings.end(); ++it, ++i)
101 (*it).cloneTo(&searchString[i]);
102
103
104 searchString.detachTo(ComSafeArrayOutArg(aSearchStrings));
105
106 RTCritSectLeave(&m_hCritSect);
107
108 return S_OK;
109}
110
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