1 | /* $Id: HostNetworkInterfaceImpl.cpp 15051 2008-12-05 17:20:00Z vboxsync $ */
|
---|
2 |
|
---|
3 | /** @file
|
---|
4 | *
|
---|
5 | * VirtualBox COM class implementation
|
---|
6 | */
|
---|
7 |
|
---|
8 | /*
|
---|
9 | * Copyright (C) 2006-2008 Sun Microsystems, Inc.
|
---|
10 | *
|
---|
11 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
12 | * available from http://www.virtualbox.org. This file is free software;
|
---|
13 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
14 | * General Public License (GPL) as published by the Free Software
|
---|
15 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
16 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
17 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
18 | *
|
---|
19 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
|
---|
20 | * Clara, CA 95054 USA or visit http://www.sun.com if you need
|
---|
21 | * additional information or have any questions.
|
---|
22 | */
|
---|
23 |
|
---|
24 | #include "HostNetworkInterfaceImpl.h"
|
---|
25 | #include "Logging.h"
|
---|
26 |
|
---|
27 | // constructor / destructor
|
---|
28 | /////////////////////////////////////////////////////////////////////////////
|
---|
29 |
|
---|
30 | DEFINE_EMPTY_CTOR_DTOR (HostNetworkInterface)
|
---|
31 |
|
---|
32 | HRESULT HostNetworkInterface::FinalConstruct()
|
---|
33 | {
|
---|
34 | return S_OK;
|
---|
35 | }
|
---|
36 |
|
---|
37 | void HostNetworkInterface::FinalRelease()
|
---|
38 | {
|
---|
39 | uninit ();
|
---|
40 | }
|
---|
41 |
|
---|
42 | // public initializer/uninitializer for internal purposes only
|
---|
43 | /////////////////////////////////////////////////////////////////////////////
|
---|
44 |
|
---|
45 | /**
|
---|
46 | * Initializes the host object.
|
---|
47 | *
|
---|
48 | * @returns COM result indicator
|
---|
49 | * @param aInterfaceName name of the network interface
|
---|
50 | * @param aGuid GUID of the host network interface
|
---|
51 | */
|
---|
52 | HRESULT HostNetworkInterface::init (Bstr aInterfaceName, Guid aGuid)
|
---|
53 | {
|
---|
54 | LogFlowThisFunc (("aInterfaceName={%ls}, aGuid={%s}\n",
|
---|
55 | aInterfaceName.raw(), aGuid.toString().raw()));
|
---|
56 |
|
---|
57 | ComAssertRet (aInterfaceName, E_INVALIDARG);
|
---|
58 | ComAssertRet (!aGuid.isEmpty(), E_INVALIDARG);
|
---|
59 |
|
---|
60 | /* Enclose the state transition NotReady->InInit->Ready */
|
---|
61 | AutoInitSpan autoInitSpan (this);
|
---|
62 | AssertReturn (autoInitSpan.isOk(), E_FAIL);
|
---|
63 |
|
---|
64 | unconst (mInterfaceName) = aInterfaceName;
|
---|
65 | unconst (mGuid) = aGuid;
|
---|
66 |
|
---|
67 | /* Confirm a successful initialization */
|
---|
68 | autoInitSpan.setSucceeded();
|
---|
69 |
|
---|
70 | return S_OK;
|
---|
71 | }
|
---|
72 |
|
---|
73 | // IHostNetworkInterface properties
|
---|
74 | /////////////////////////////////////////////////////////////////////////////
|
---|
75 |
|
---|
76 | /**
|
---|
77 | * Returns the name of the host network interface.
|
---|
78 | *
|
---|
79 | * @returns COM status code
|
---|
80 | * @param aInterfaceName address of result pointer
|
---|
81 | */
|
---|
82 | STDMETHODIMP HostNetworkInterface::COMGETTER(Name) (BSTR *aInterfaceName)
|
---|
83 | {
|
---|
84 | CheckComArgOutPointerValid(aInterfaceName);
|
---|
85 |
|
---|
86 | AutoCaller autoCaller (this);
|
---|
87 | CheckComRCReturnRC (autoCaller.rc());
|
---|
88 |
|
---|
89 | mInterfaceName.cloneTo (aInterfaceName);
|
---|
90 |
|
---|
91 | return S_OK;
|
---|
92 | }
|
---|
93 |
|
---|
94 | /**
|
---|
95 | * Returns the GUID of the host network interface.
|
---|
96 | *
|
---|
97 | * @returns COM status code
|
---|
98 | * @param aGuid address of result pointer
|
---|
99 | */
|
---|
100 | STDMETHODIMP HostNetworkInterface::COMGETTER(Id) (OUT_GUID aGuid)
|
---|
101 | {
|
---|
102 | CheckComArgOutPointerValid(aGuid);
|
---|
103 |
|
---|
104 | AutoCaller autoCaller (this);
|
---|
105 | CheckComRCReturnRC (autoCaller.rc());
|
---|
106 |
|
---|
107 | mGuid.cloneTo (aGuid);
|
---|
108 |
|
---|
109 | return S_OK;
|
---|
110 | }
|
---|
111 | /* vi: set tabstop=4 shiftwidth=4 expandtab: */
|
---|