1 | /** @file
|
---|
2 | *
|
---|
3 | * VirtualBox COM class implementation
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006 InnoTek Systemberatung GmbH
|
---|
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 as published by the Free Software Foundation,
|
---|
13 | * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
|
---|
14 | * distribution. VirtualBox OSE is distributed in the hope that it will
|
---|
15 | * be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | *
|
---|
17 | * If you received this file as part of a commercial VirtualBox
|
---|
18 | * distribution, then only the terms of your commercial VirtualBox
|
---|
19 | * license agreement apply instead of the previous paragraph.
|
---|
20 | */
|
---|
21 |
|
---|
22 | #include "HostNetworkInterfaceImpl.h"
|
---|
23 |
|
---|
24 | // constructor / destructor
|
---|
25 | /////////////////////////////////////////////////////////////////////////////
|
---|
26 |
|
---|
27 | HostNetworkInterface::HostNetworkInterface()
|
---|
28 | {
|
---|
29 | }
|
---|
30 |
|
---|
31 | HostNetworkInterface::~HostNetworkInterface()
|
---|
32 | {
|
---|
33 | }
|
---|
34 |
|
---|
35 | // public initializer/uninitializer for internal purposes only
|
---|
36 | /////////////////////////////////////////////////////////////////////////////
|
---|
37 |
|
---|
38 | /**
|
---|
39 | * Initializes the host object.
|
---|
40 | *
|
---|
41 | * @returns COM result indicator
|
---|
42 | * @param interfaceName name of the network interface
|
---|
43 | */
|
---|
44 | HRESULT HostNetworkInterface::init (Bstr interfaceName, Guid guid)
|
---|
45 | {
|
---|
46 | ComAssertRet (interfaceName, E_INVALIDARG);
|
---|
47 | ComAssertRet (!guid.isEmpty(), E_INVALIDARG);
|
---|
48 |
|
---|
49 | AutoLock lock(this);
|
---|
50 | mInterfaceName = interfaceName;
|
---|
51 | mGuid = guid;
|
---|
52 | setReady(true);
|
---|
53 | return S_OK;
|
---|
54 | }
|
---|
55 |
|
---|
56 | // IHostNetworkInterface properties
|
---|
57 | /////////////////////////////////////////////////////////////////////////////
|
---|
58 |
|
---|
59 | /**
|
---|
60 | * Returns the name of the host network interface.
|
---|
61 | *
|
---|
62 | * @returns COM status code
|
---|
63 | * @param interfaceName address of result pointer
|
---|
64 | */
|
---|
65 | STDMETHODIMP HostNetworkInterface::COMGETTER(Name) (BSTR *interfaceName)
|
---|
66 | {
|
---|
67 | if (!interfaceName)
|
---|
68 | return E_POINTER;
|
---|
69 | AutoLock lock(this);
|
---|
70 | CHECK_READY();
|
---|
71 | mInterfaceName.cloneTo(interfaceName);
|
---|
72 | return S_OK;
|
---|
73 | }
|
---|
74 |
|
---|
75 | /**
|
---|
76 | * Returns the GUID of the host network interface.
|
---|
77 | *
|
---|
78 | * @returns COM status code
|
---|
79 | * @param guid address of result pointer
|
---|
80 | */
|
---|
81 | STDMETHODIMP HostNetworkInterface::COMGETTER(Id) (GUIDPARAMOUT guid)
|
---|
82 | {
|
---|
83 | if (!guid)
|
---|
84 | return E_POINTER;
|
---|
85 | AutoLock lock(this);
|
---|
86 | CHECK_READY();
|
---|
87 | mGuid.cloneTo(guid);
|
---|
88 | return S_OK;
|
---|
89 | }
|
---|