1 | /** @file
|
---|
2 | *
|
---|
3 | * VirtualBox COM class implementation
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2007 Sun Microsystems, Inc.
|
---|
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 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
|
---|
18 | * Clara, CA 95054 USA or visit http://www.sun.com if you need
|
---|
19 | * additional information or have any questions.
|
---|
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 | AutoWriteLock alock (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 | AutoWriteLock alock (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 | AutoWriteLock alock (this);
|
---|
86 | CHECK_READY();
|
---|
87 | mGuid.cloneTo(guid);
|
---|
88 | return S_OK;
|
---|
89 | }
|
---|