- Timestamp:
- Jul 2, 2007 12:44:39 PM (18 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/AudioAdapterImpl.cpp
r3191 r3348 24 24 #include "Logging.h" 25 25 26 #include <iprt/cpputils.h> 27 26 28 // constructor / destructor 27 29 ///////////////////////////////////////////////////////////////////////////// 28 30 31 DEFINE_EMPTY_CTOR_DTOR (AudioAdapter) 32 29 33 HRESULT AudioAdapter::FinalConstruct() 30 34 { … … 34 38 void AudioAdapter::FinalRelease() 35 39 { 36 if (isReady()) 37 uninit (); 40 uninit (); 38 41 } 39 42 … … 42 45 43 46 /** 44 * Initializes the audio adapter object. 45 * 46 * @returns COM result indicator 47 */ 48 HRESULT AudioAdapter::init (Machine *parent) 49 { 50 LogFlowMember (("AudioAdapter::init (%p)\n", parent)); 51 52 ComAssertRet (parent, E_INVALIDARG); 53 54 AutoLock alock (this); 55 ComAssertRet (!isReady(), E_UNEXPECTED); 56 57 mParent = parent; 58 // mPeer is left null 47 * Initializes the audio adapter object. 48 * 49 * @param aParent Handle of the parent object. 50 */ 51 HRESULT AudioAdapter::init (Machine *aParent) 52 { 53 LogFlowThisFunc (("aParent=%p\n", aParent)); 54 55 ComAssertRet (aParent, E_INVALIDARG); 56 57 /* Enclose the state transition NotReady->InInit->Ready */ 58 AutoInitSpan autoInitSpan (this); 59 AssertReturn (autoInitSpan.isOk(), E_UNEXPECTED); 60 61 unconst (mParent) = aParent; 62 /* mPeer is left null */ 59 63 60 64 mData.allocate(); 61 65 62 setReady (true); 66 /* Confirm a successful initialization */ 67 autoInitSpan.setSucceeded(); 68 63 69 return S_OK; 64 70 } … … 71 77 * @note This object must be destroyed before the original object 72 78 * it shares data with is destroyed. 73 */ 74 HRESULT AudioAdapter::init (Machine *parent, AudioAdapter *that) 75 { 76 LogFlowMember (("AudioAdapter::init (%p, %p)\n", parent, that)); 77 78 ComAssertRet (parent && that, E_INVALIDARG); 79 80 AutoLock alock (this); 81 ComAssertRet (!isReady(), E_UNEXPECTED); 82 83 mParent = parent; 84 mPeer = that; 85 86 AutoLock thatlock (that); 87 mData.share (that->mData); 88 89 setReady (true); 79 * 80 * @note Locks @a aThat object for reading. 81 */ 82 HRESULT AudioAdapter::init (Machine *aParent, AudioAdapter *aThat) 83 { 84 LogFlowThisFunc (("aParent=%p, aThat=%p\n", aParent, aThat)); 85 86 ComAssertRet (aParent && aThat, E_INVALIDARG); 87 88 /* Enclose the state transition NotReady->InInit->Ready */ 89 AutoInitSpan autoInitSpan (this); 90 AssertReturn (autoInitSpan.isOk(), E_UNEXPECTED); 91 92 unconst (mParent) = aParent; 93 unconst (mPeer) = aThat; 94 95 AutoCaller thatCaller (aThat); 96 AssertComRCReturnRC (thatCaller.rc()); 97 98 AutoReaderLock thatLock (aThat); 99 mData.share (aThat->mData); 100 101 /* Confirm a successful initialization */ 102 autoInitSpan.setSucceeded(); 103 90 104 return S_OK; 91 105 } … … 95 109 * (a kind of copy constructor). This object makes a private copy of data 96 110 * of the original object passed as an argument. 97 */ 98 HRESULT AudioAdapter::initCopy (Machine *parent, AudioAdapter *that) 99 { 100 LogFlowMember (("AudioAdapter::initCopy (%p, %p)\n", parent, that)); 101 102 ComAssertRet (parent && that, E_INVALIDARG); 103 104 AutoLock alock (this); 105 ComAssertRet (!isReady(), E_UNEXPECTED); 106 107 mParent = parent; 108 // mPeer is left null 109 110 AutoLock thatlock (that); 111 mData.attachCopy (that->mData); 112 113 setReady (true); 111 * 112 * @note Locks @a aThat object for reading. 113 */ 114 HRESULT AudioAdapter::initCopy (Machine *aParent, AudioAdapter *aThat) 115 { 116 LogFlowThisFunc (("aParent=%p, aThat=%p\n", aParent, aThat)); 117 118 ComAssertRet (aParent && aThat, E_INVALIDARG); 119 120 /* Enclose the state transition NotReady->InInit->Ready */ 121 AutoInitSpan autoInitSpan (this); 122 AssertReturn (autoInitSpan.isOk(), E_UNEXPECTED); 123 124 unconst (mParent) = aParent; 125 /* mPeer is left null */ 126 127 AutoCaller thatCaller (aThat); 128 AssertComRCReturnRC (thatCaller.rc()); 129 130 AutoReaderLock thatLock (aThat); 131 mData.attachCopy (aThat->mData); 132 133 /* Confirm a successful initialization */ 134 autoInitSpan.setSucceeded(); 135 114 136 return S_OK; 115 137 } … … 121 143 void AudioAdapter::uninit() 122 144 { 123 LogFlowMember (("AudioAdapter::uninit()\n")); 145 LogFlowThisFunc (("\n")); 146 147 /* Enclose the state transition Ready->InUninit->NotReady */ 148 AutoUninitSpan autoUninitSpan (this); 149 if (autoUninitSpan.uninitDone()) 150 return; 151 152 mData.free(); 153 154 unconst (mPeer).setNull(); 155 unconst (mParent).setNull(); 156 } 157 158 // IAudioAdapter properties 159 ///////////////////////////////////////////////////////////////////////////// 160 161 STDMETHODIMP AudioAdapter::COMGETTER(Enabled)(BOOL *aEnabled) 162 { 163 if (!aEnabled) 164 return E_POINTER; 165 166 AutoCaller autoCaller (this); 167 CheckComRCReturnRC (autoCaller.rc()); 168 169 AutoReaderLock alock (this); 170 171 *aEnabled = mData->mEnabled; 172 173 return S_OK; 174 } 175 176 STDMETHODIMP AudioAdapter::COMSETTER(Enabled)(BOOL aEnabled) 177 { 178 AutoCaller autoCaller (this); 179 CheckComRCReturnRC (autoCaller.rc()); 180 181 /* the machine needs to be mutable */ 182 Machine::AutoMutableStateDependency adep (mParent); 183 CheckComRCReturnRC (adep.rc()); 124 184 125 185 AutoLock alock (this); 126 AssertReturn (isReady(), (void) 0); 127 128 mData.free(); 129 130 mPeer.setNull(); 131 mParent.setNull(); 132 133 setReady(false); 134 } 135 136 // IAudioAdapter properties 137 ///////////////////////////////////////////////////////////////////////////// 138 139 /** 140 * Returns the enabled status 141 * 142 * @returns COM status code 143 * @param enabled address of result variable 144 */ 145 STDMETHODIMP AudioAdapter::COMGETTER(Enabled)(BOOL *enabled) 146 { 147 if (!enabled) 148 return E_POINTER; 149 150 AutoLock lock(this); 151 CHECK_READY(); 152 153 *enabled = mData->mEnabled; 154 return S_OK; 155 } 156 157 /** 158 * Sets the enabled state 159 * 160 * @returns COM status code 161 * @param enabled address of result variable 162 */ 163 STDMETHODIMP AudioAdapter::COMSETTER(Enabled)(BOOL enabled) 164 { 165 AutoLock lock(this); 166 CHECK_READY(); 167 168 CHECK_MACHINE_MUTABILITY (mParent); 169 170 if (mData->mEnabled != enabled) 186 187 if (mData->mEnabled != aEnabled) 171 188 { 172 189 mData.backup(); 173 mData->mEnabled = enabled;190 mData->mEnabled = aEnabled; 174 191 } 175 192 … … 177 194 } 178 195 179 /** 180 * Returns the current audio driver type 181 * 182 * @returns COM status code 183 * @param audioDriver address of result variable 184 */ 185 STDMETHODIMP AudioAdapter::COMGETTER(AudioDriver)(AudioDriverType_T *audioDriver) 186 { 187 if (!audioDriver) 196 STDMETHODIMP AudioAdapter::COMGETTER(AudioDriver)(AudioDriverType_T *aAudioDriver) 197 { 198 if (!aAudioDriver) 188 199 return E_POINTER; 189 200 190 AutoLock lock(this); 191 CHECK_READY(); 192 193 *audioDriver = mData->mAudioDriver; 194 return S_OK; 195 } 196 197 /** 198 * Sets the audio driver type 199 * 200 * @returns COM status code 201 * @param audioDriver audio driver type to use 202 */ 203 STDMETHODIMP AudioAdapter::COMSETTER(AudioDriver)(AudioDriverType_T audioDriver) 204 { 205 AutoLock lock(this); 206 CHECK_READY(); 207 208 CHECK_MACHINE_MUTABILITY (mParent); 201 AutoCaller autoCaller (this); 202 CheckComRCReturnRC (autoCaller.rc()); 203 204 AutoReaderLock alock (this); 205 206 *aAudioDriver = mData->mAudioDriver; 207 208 return S_OK; 209 } 210 211 STDMETHODIMP AudioAdapter::COMSETTER(AudioDriver)(AudioDriverType_T aAudioDriver) 212 { 213 AutoCaller autoCaller (this); 214 CheckComRCReturnRC (autoCaller.rc()); 215 216 /* the machine needs to be mutable */ 217 Machine::AutoMutableStateDependency adep (mParent); 218 CheckComRCReturnRC (adep.rc()); 219 220 AutoLock alock (this); 209 221 210 222 HRESULT rc = S_OK; 211 223 212 if (mData->mAudioDriver != a udioDriver)224 if (mData->mAudioDriver != aAudioDriver) 213 225 { 214 226 /* 215 227 * which audio driver type are we supposed to use? 216 228 */ 217 switch (a udioDriver)229 switch (aAudioDriver) 218 230 { 219 231 case AudioDriverType_NullAudioDriver: … … 238 250 { 239 251 mData.backup(); 240 mData->mAudioDriver = a udioDriver;252 mData->mAudioDriver = aAudioDriver; 241 253 break; 242 254 } … … 244 256 default: 245 257 { 246 Log(("wrong audio driver type specified!\n")); 258 AssertMsgFailed (("Wrong audio driver type %d\n", 259 aAudioDriver)); 247 260 rc = E_FAIL; 248 261 } … … 259 272 ///////////////////////////////////////////////////////////////////////////// 260 273 274 /** 275 * @note Locks this object for writing. 276 */ 277 bool AudioAdapter::rollback() 278 { 279 /* sanity */ 280 AutoCaller autoCaller (this); 281 AssertComRCReturn (autoCaller.rc(), false); 282 283 AutoLock alock (this); 284 285 bool changed = false; 286 287 if (mData.isBackedUp()) 288 { 289 /* we need to check all data to see whether anything will be changed 290 * after rollback */ 291 changed = mData.hasActualChanges(); 292 mData.rollback(); 293 } 294 295 return changed; 296 } 297 298 /** 299 * @note Locks this object for writing, together with the peer object (also 300 * for writing) if there is one. 301 */ 261 302 void AudioAdapter::commit() 262 303 { 263 AutoLock alock (this); 304 /* sanity */ 305 AutoCaller autoCaller (this); 306 AssertComRCReturnVoid (autoCaller.rc()); 307 308 /* sanity too */ 309 AutoCaller thatCaller (mPeer); 310 AssertComRCReturnVoid (thatCaller.rc()); 311 312 /* lock both for writing since we modify both */ 313 AutoMultiLock <2> alock (this->wlock(), AutoLock::maybeWlock (mPeer)); 314 264 315 if (mData.isBackedUp()) 265 316 { … … 267 318 if (mPeer) 268 319 { 269 // attach new data to the peer and reshare it 270 AutoLock peerlock (mPeer); 320 /* attach new data to the peer and reshare it */ 271 321 mPeer->mData.attach (mData); 272 322 } … … 274 324 } 275 325 326 /** 327 * @note Locks this object for writing, together with the peer object 328 * represented by @a aThat (locked for reading). 329 */ 276 330 void AudioAdapter::copyFrom (AudioAdapter *aThat) 277 331 { 278 AutoLock alock (this); 279 280 // this will back up current data 332 AssertReturnVoid (aThat != NULL); 333 334 /* sanity */ 335 AutoCaller autoCaller (this); 336 AssertComRCReturnVoid (autoCaller.rc()); 337 338 /* sanity too */ 339 AutoCaller thatCaller (mPeer); 340 AssertComRCReturnVoid (thatCaller.rc()); 341 342 /* peer is not modified, lock it for reading */ 343 AutoMultiLock <2> alock (this->wlock(), aThat->rlock()); 344 345 /* this will back up current data */ 281 346 mData.assignCopy (aThat->mData); 282 347 } 283 -
trunk/src/VBox/Main/DVDDriveImpl.cpp
r3330 r3348 47 47 48 48 /** 49 * Initializes the DVD drive object. 50 * 51 * @param aParent Handle of our parent object. 52 * @return COM result indicator 49 * Initializes the DVD drive object. 50 * 51 * @param aParent Handle of the parent object. 53 52 */ 54 53 HRESULT DVDDrive::init (Machine *aParent) … … 155 154 mData.free(); 156 155 157 unconst (mP arent).setNull();156 unconst (mPeer).setNull(); 158 157 unconst (mParent).setNull(); 159 158 } … … 249 248 mData->mDriveState = DriveState_ImageMounted; 250 249 251 /* leave the lock before informing callbacks */250 /* leave the lock before informing callbacks */ 252 251 alock.unlock(); 253 252 … … 283 282 mData->mDriveState = DriveState_HostDriveCaptured; 284 283 285 /* leave the lock before informing callbacks */284 /* leave the lock before informing callbacks */ 286 285 alock.unlock(); 287 286 … … 311 310 mData->mDriveState = DriveState_NotMounted; 312 311 313 /* leave the lock before informing callbacks */312 /* leave the lock before informing callbacks */ 314 313 alock.unlock(); 315 314 … … 406 405 407 406 /** 408 * @note Locks this object for writing, together with the peer object (locked409 * for reading) if there is one.407 * @note Locks this object for writing, together with the peer object 408 * represented by @a aThat (locked for reading). 410 409 */ 411 410 void DVDDrive::copyFrom (DVDDrive *aThat) 412 411 { 412 AssertReturnVoid (aThat != NULL); 413 413 414 /* sanity */ 414 415 AutoCaller autoCaller (this); … … 420 421 421 422 /* peer is not modified, lock it for reading */ 422 AutoMultiLock <2> alock (this->wlock(), AutoLock::maybeRlock (mPeer));423 AutoMultiLock <2> alock (this->wlock(), aThat->rlock()); 423 424 424 425 /* this will back up current data */ -
trunk/src/VBox/Main/FloppyDriveImpl.cpp
r3330 r3348 47 47 48 48 /** 49 * Initializes the Floppy drive object. 50 * 51 * @param aParent Handle of our parent object. 52 * @return COM result indicator 49 * Initializes the Floppy drive object. 50 * 51 * @param aParent Handle of the parent object. 53 52 */ 54 53 HRESULT FloppyDrive::init (Machine *aParent) … … 155 154 mData.free(); 156 155 157 unconst (mP arent).setNull();156 unconst (mPeer).setNull(); 158 157 unconst (mParent).setNull(); 159 158 } … … 195 194 mData->mEnabled = aEnabled; 196 195 197 /* leave the lock before informing callbacks */196 /* leave the lock before informing callbacks */ 198 197 alock.unlock(); 199 198 … … 256 255 mData->mDriveState = DriveState_ImageMounted; 257 256 258 /* leave the lock before informing callbacks */257 /* leave the lock before informing callbacks */ 259 258 alock.unlock(); 260 259 … … 290 289 mData->mDriveState = DriveState_HostDriveCaptured; 291 290 292 /* leave the lock before informing callbacks */291 /* leave the lock before informing callbacks */ 293 292 alock.unlock(); 294 293 … … 318 317 mData->mDriveState = DriveState_NotMounted; 319 318 320 /* leave the lock before informing callbacks */319 /* leave the lock before informing callbacks */ 321 320 alock.unlock(); 322 321 -
trunk/src/VBox/Main/NetworkAdapterImpl.cpp
r2981 r3348 24 24 #include "MachineImpl.h" 25 25 26 #include <iprt/string.h> 27 #include <iprt/cpputils.h> 28 26 29 #include <VBox/err.h> 27 #include <iprt/string.h>28 29 // defines30 ////////////////////////////////////////////////////////////////////////////////31 30 32 31 // constructor / destructor 33 32 //////////////////////////////////////////////////////////////////////////////// 34 33 34 DEFINE_EMPTY_CTOR_DTOR (NetworkAdapter) 35 35 36 HRESULT NetworkAdapter::FinalConstruct() 36 37 { … … 40 41 void NetworkAdapter::FinalRelease() 41 42 { 42 if (isReady()) 43 uninit (); 43 uninit (); 44 44 } 45 45 … … 48 48 49 49 /** 50 * Initializes the network adapter object.50 * Initializes the network adapter object. 51 51 * 52 * @param parent handle of our parent object 53 * @return COM result indicator 52 * @param aParent Handle of the parent object. 54 53 */ 55 HRESULT NetworkAdapter::init (Machine *parent, ULONG slot) 56 { 57 LogFlowMember (("NetworkAdapter::init (%p): slot=%d\n", parent, slot)); 58 59 ComAssertRet (parent, E_INVALIDARG); 60 ComAssertRet (slot < SchemaDefs::NetworkAdapterCount, E_INVALIDARG); 61 62 AutoLock alock (this); 63 ComAssertRet (!isReady(), E_UNEXPECTED); 64 65 mParent = parent; 66 // mPeer is left null 54 HRESULT NetworkAdapter::init (Machine *aParent, ULONG aSlot) 55 { 56 LogFlowThisFunc (("aParent=%p, aSlot=%d\n", aParent, aSlot)); 57 58 ComAssertRet (aParent, E_INVALIDARG); 59 ComAssertRet (aSlot < SchemaDefs::NetworkAdapterCount, E_INVALIDARG); 60 61 /* Enclose the state transition NotReady->InInit->Ready */ 62 AutoInitSpan autoInitSpan (this); 63 AssertReturn (autoInitSpan.isOk(), E_UNEXPECTED); 64 65 unconst (mParent) = aParent; 66 /* mPeer is left null */ 67 67 68 68 mData.allocate(); 69 69 70 / / initialize data71 mData->mSlot = slot;72 73 / / default to Am79C97370 /* initialize data */ 71 mData->mSlot = aSlot; 72 73 /* default to Am79C973 */ 74 74 mData->mAdapterType = NetworkAdapterType_NetworkAdapterAm79C973; 75 75 76 / /generate the MAC address early to guarantee it is the same both after77 //changing some other property (i.e. after mData.backup()) and after the78 // subsequent mData.rollback().76 /* generate the MAC address early to guarantee it is the same both after 77 * changing some other property (i.e. after mData.backup()) and after the 78 * subsequent mData.rollback(). */ 79 79 generateMACAddress(); 80 80 81 setReady (true); 81 /* Confirm a successful initialization */ 82 autoInitSpan.setSucceeded(); 83 82 84 return S_OK; 83 85 } … … 90 92 * @note This object must be destroyed before the original object 91 93 * it shares data with is destroyed. 94 * 95 * @note Locks @a aThat object for reading. 92 96 */ 93 HRESULT NetworkAdapter::init (Machine *parent, NetworkAdapter *that) 94 { 95 LogFlowMember (("NetworkAdapter::init (%p, %p)\n", parent, that)); 96 97 ComAssertRet (parent && that, E_INVALIDARG); 98 99 AutoLock alock (this); 100 ComAssertRet (!isReady(), E_UNEXPECTED); 101 102 mParent = parent; 103 mPeer = that; 104 105 AutoLock thatlock (that); 106 mData.share (that->mData); 107 108 setReady (true); 97 HRESULT NetworkAdapter::init (Machine *aParent, NetworkAdapter *aThat) 98 { 99 LogFlowThisFunc (("aParent=%p, aThat=%p\n", aParent, aThat)); 100 101 ComAssertRet (aParent && aThat, E_INVALIDARG); 102 103 /* Enclose the state transition NotReady->InInit->Ready */ 104 AutoInitSpan autoInitSpan (this); 105 AssertReturn (autoInitSpan.isOk(), E_UNEXPECTED); 106 107 unconst (mParent) = aParent; 108 unconst (mPeer) = aThat; 109 110 AutoCaller thatCaller (aThat); 111 AssertComRCReturnRC (thatCaller.rc()); 112 113 AutoReaderLock thatLock (aThat); 114 mData.share (aThat->mData); 115 116 /* Confirm a successful initialization */ 117 autoInitSpan.setSucceeded(); 118 109 119 return S_OK; 110 120 } … … 114 124 * (a kind of copy constructor). This object makes a private copy of data 115 125 * of the original object passed as an argument. 126 * 127 * @note Locks @a aThat object for reading. 116 128 */ 117 HRESULT NetworkAdapter::initCopy (Machine *parent, NetworkAdapter *that) 118 { 119 LogFlowMember (("NetworkAdapter::initCopy (%p, %p)\n", parent, that)); 120 121 ComAssertRet (parent && that, E_INVALIDARG); 122 123 AutoLock alock (this); 124 ComAssertRet (!isReady(), E_UNEXPECTED); 125 126 mParent = parent; 127 // mPeer is left null 128 129 AutoLock thatlock (that); 130 mData.attachCopy (that->mData); 131 132 setReady (true); 129 HRESULT NetworkAdapter::initCopy (Machine *aParent, NetworkAdapter *aThat) 130 { 131 LogFlowThisFunc (("aParent=%p, aThat=%p\n", aParent, aThat)); 132 133 ComAssertRet (aParent && aThat, E_INVALIDARG); 134 135 /* Enclose the state transition NotReady->InInit->Ready */ 136 AutoInitSpan autoInitSpan (this); 137 AssertReturn (autoInitSpan.isOk(), E_UNEXPECTED); 138 139 unconst (mParent) = aParent; 140 /* mPeer is left null */ 141 142 AutoCaller thatCaller (aThat); 143 AssertComRCReturnRC (thatCaller.rc()); 144 145 AutoReaderLock thatLock (aThat); 146 mData.attachCopy (aThat->mData); 147 148 /* Confirm a successful initialization */ 149 autoInitSpan.setSucceeded(); 150 133 151 return S_OK; 134 152 } … … 140 158 void NetworkAdapter::uninit() 141 159 { 142 LogFlowMember (("INetworkAdapter::uninit()\n")); 143 144 AutoLock alock (this); 145 AssertReturn (isReady(), (void) 0); 160 LogFlowThisFunc (("\n")); 161 162 /* Enclose the state transition Ready->InUninit->NotReady */ 163 AutoUninitSpan autoUninitSpan (this); 164 if (autoUninitSpan.uninitDone()) 165 return; 146 166 147 167 mData.free(); 148 168 149 mPeer.setNull(); 150 mParent.setNull(); 151 152 setReady (false); 169 unconst (mPeer).setNull(); 170 unconst (mParent).setNull(); 153 171 } 154 172 … … 156 174 //////////////////////////////////////////////////////////////////////////////// 157 175 158 STDMETHODIMP NetworkAdapter::COMGETTER(AdapterType) (NetworkAdapterType_T *adapterType) 159 { 160 if (!adapterType) 161 return E_POINTER; 162 163 AutoLock alock (this); 164 CHECK_READY(); 165 166 *adapterType = mData->mAdapterType; 167 return S_OK; 168 } 169 170 STDMETHODIMP NetworkAdapter::COMSETTER(AdapterType) (NetworkAdapterType_T adapterType) 171 { 172 AutoLock alock(this); 173 CHECK_READY(); 174 175 CHECK_MACHINE_MUTABILITY (mParent); 176 STDMETHODIMP NetworkAdapter::COMGETTER(AdapterType) (NetworkAdapterType_T *aAdapterType) 177 { 178 if (!aAdapterType) 179 return E_POINTER; 180 181 AutoCaller autoCaller (this); 182 CheckComRCReturnRC (autoCaller.rc()); 183 184 AutoReaderLock alock (this); 185 186 *aAdapterType = mData->mAdapterType; 187 188 return S_OK; 189 } 190 191 STDMETHODIMP NetworkAdapter::COMSETTER(AdapterType) (NetworkAdapterType_T aAdapterType) 192 { 193 AutoCaller autoCaller (this); 194 CheckComRCReturnRC (autoCaller.rc()); 195 196 /* the machine needs to be mutable */ 197 Machine::AutoMutableStateDependency adep (mParent); 198 CheckComRCReturnRC (adep.rc()); 199 200 AutoLock alock (this); 176 201 177 202 /* make sure the value is allowed */ 178 switch (a dapterType)203 switch (aAdapterType) 179 204 { 180 205 case NetworkAdapterType_NetworkAdapterAm79C970A: … … 182 207 break; 183 208 default: 184 return setError(E_FAIL, tr("Invalid network adapter type '%d'"), adapterType); 185 } 186 187 if (mData->mAdapterType != adapterType) 188 { 189 mData.backup(); 190 mData->mAdapterType = adapterType; 191 192 /* notify parent */ 193 alock.unlock(); 194 mParent->onNetworkAdapterChange (this); 195 } 196 197 return S_OK; 198 } 199 200 STDMETHODIMP NetworkAdapter::COMGETTER(Slot) (ULONG *slot) 201 { 202 if (!slot) 203 return E_POINTER; 204 205 AutoLock alock (this); 206 CHECK_READY(); 207 208 *slot = mData->mSlot; 209 return S_OK; 210 } 211 212 STDMETHODIMP NetworkAdapter::COMGETTER(Enabled) (BOOL *enabled) 213 { 214 if (!enabled) 215 return E_POINTER; 216 217 AutoLock alock (this); 218 CHECK_READY(); 219 220 *enabled = mData->mEnabled; 221 return S_OK; 222 } 223 224 STDMETHODIMP NetworkAdapter::COMSETTER(Enabled) (BOOL enabled) 225 { 226 AutoLock alock(this); 227 CHECK_READY(); 228 229 CHECK_MACHINE_MUTABILITY (mParent); 230 231 if (mData->mEnabled != enabled) 232 { 233 mData.backup(); 234 mData->mEnabled = enabled; 235 236 /* notify parent */ 237 alock.unlock(); 238 mParent->onNetworkAdapterChange (this); 239 } 240 241 return S_OK; 242 } 243 244 /** 245 * Returns the MAC address string 246 * 247 * @returns COM status code 248 * @param macAddress address of result variable 249 */ 250 STDMETHODIMP NetworkAdapter::COMGETTER(MACAddress)(BSTR *macAddress) 251 { 252 if (!macAddress) 253 return E_POINTER; 254 255 AutoLock alock(this); 256 CHECK_READY(); 209 return setError (E_FAIL, 210 tr("Invalid network adapter type '%d'"), 211 aAdapterType); 212 } 213 214 if (mData->mAdapterType != aAdapterType) 215 { 216 mData.backup(); 217 mData->mAdapterType = aAdapterType; 218 219 /* leave the lock before informing callbacks */ 220 alock.unlock(); 221 222 mParent->onNetworkAdapterChange (this); 223 } 224 225 return S_OK; 226 } 227 228 STDMETHODIMP NetworkAdapter::COMGETTER(Slot) (ULONG *aSlot) 229 { 230 if (!aSlot) 231 return E_POINTER; 232 233 AutoCaller autoCaller (this); 234 CheckComRCReturnRC (autoCaller.rc()); 235 236 AutoReaderLock alock (this); 237 238 *aSlot = mData->mSlot; 239 240 return S_OK; 241 } 242 243 STDMETHODIMP NetworkAdapter::COMGETTER(Enabled) (BOOL *aEnabled) 244 { 245 if (!aEnabled) 246 return E_POINTER; 247 248 AutoCaller autoCaller (this); 249 CheckComRCReturnRC (autoCaller.rc()); 250 251 AutoReaderLock alock (this); 252 253 *aEnabled = mData->mEnabled; 254 255 return S_OK; 256 } 257 258 STDMETHODIMP NetworkAdapter::COMSETTER(Enabled) (BOOL aEnabled) 259 { 260 AutoCaller autoCaller (this); 261 CheckComRCReturnRC (autoCaller.rc()); 262 263 /* the machine needs to be mutable */ 264 Machine::AutoMutableStateDependency adep (mParent); 265 CheckComRCReturnRC (adep.rc()); 266 267 AutoLock alock (this); 268 269 if (mData->mEnabled != aEnabled) 270 { 271 mData.backup(); 272 mData->mEnabled = aEnabled; 273 274 /* leave the lock before informing callbacks */ 275 alock.unlock(); 276 277 mParent->onNetworkAdapterChange (this); 278 } 279 280 return S_OK; 281 } 282 283 STDMETHODIMP NetworkAdapter::COMGETTER(MACAddress)(BSTR *aMACAddress) 284 { 285 if (!aMACAddress) 286 return E_POINTER; 287 288 AutoCaller autoCaller (this); 289 CheckComRCReturnRC (autoCaller.rc()); 290 291 AutoReaderLock alock (this); 257 292 258 293 ComAssertRet (!!mData->mMACAddress, E_FAIL); 259 294 260 mData->mMACAddress.cloneTo (macAddress); 261 262 return S_OK; 263 } 264 265 /** 266 * Sets the MAC address 267 * 268 * @returns COM status code 269 * @param macAddress 12-digit hexadecimal MAC address string with 270 * capital letters. Can be NULL to generate a MAC 271 */ 272 STDMETHODIMP NetworkAdapter::COMSETTER(MACAddress)(INPTR BSTR macAddress) 273 { 274 AutoLock alock(this); 275 CHECK_READY(); 276 277 CHECK_MACHINE_MUTABILITY (mParent); 295 mData->mMACAddress.cloneTo (aMACAddress); 296 297 return S_OK; 298 } 299 300 STDMETHODIMP NetworkAdapter::COMSETTER(MACAddress)(INPTR BSTR aMACAddress) 301 { 302 AutoCaller autoCaller (this); 303 CheckComRCReturnRC (autoCaller.rc()); 304 305 /* the machine needs to be mutable */ 306 Machine::AutoMutableStateDependency adep (mParent); 307 CheckComRCReturnRC (adep.rc()); 308 309 AutoLock alock (this); 278 310 279 311 HRESULT rc = S_OK; … … 283 315 * Are we supposed to generate a MAC? 284 316 */ 285 if (!macAddress) 286 { 287 mData.backup(); 317 if (!aMACAddress) 318 { 319 mData.backup(); 320 288 321 generateMACAddress(); 289 322 emitChangeEvent = true; … … 291 324 else 292 325 { 293 if (mData->mMACAddress != macAddress)326 if (mData->mMACAddress != aMACAddress) 294 327 { 295 328 /* 296 329 * Verify given MAC address 297 330 */ 298 Utf8Str macAddressUtf = macAddress;331 Utf8Str macAddressUtf = aMACAddress; 299 332 char *macAddressStr = (char*)macAddressUtf.raw(); 300 333 int i = 0; … … 316 349 { 317 350 mData.backup(); 318 mData->mMACAddress = macAddress; 351 352 mData->mMACAddress = aMACAddress; 319 353 emitChangeEvent = true; 320 354 } … … 324 358 if (emitChangeEvent) 325 359 { 326 /* notify parent */ 327 alock.unlock(); 360 /* leave the lock before informing callbacks */ 361 alock.unlock(); 362 328 363 mParent->onNetworkAdapterChange (this); 329 364 } … … 332 367 } 333 368 334 /** 335 * Returns the attachment type 336 * 337 * @returns COM status code 338 * @param attachmentType address of result variable 339 */ 340 STDMETHODIMP NetworkAdapter::COMGETTER(AttachmentType)(NetworkAttachmentType_T *attachmentType) 341 { 342 if (!attachmentType) 343 return E_POINTER; 344 AutoLock alock(this); 345 CHECK_READY(); 346 347 *attachmentType = mData->mAttachmentType; 348 349 return S_OK; 350 } 351 352 /** 353 * Returns the host interface the adapter is attached to 354 * 355 * @returns COM status code 356 * @param hostInterface address of result string 357 */ 358 STDMETHODIMP NetworkAdapter::COMGETTER(HostInterface)(BSTR *hostInterface) 359 { 360 if (!hostInterface) 361 return E_POINTER; 362 AutoLock alock(this); 363 CHECK_READY(); 364 365 mData->mHostInterface.cloneTo(hostInterface); 366 367 return S_OK; 368 } 369 370 /** 371 * Sets the host interface device name. 372 * 373 * @returns COM status code 374 * @param hostInterface name of the host interface device in use 375 */ 376 STDMETHODIMP NetworkAdapter::COMSETTER(HostInterface)(INPTR BSTR hostInterface) 369 STDMETHODIMP NetworkAdapter::COMGETTER(AttachmentType)( 370 NetworkAttachmentType_T *aAttachmentType) 371 { 372 if (!aAttachmentType) 373 return E_POINTER; 374 375 AutoCaller autoCaller (this); 376 CheckComRCReturnRC (autoCaller.rc()); 377 378 AutoReaderLock alock (this); 379 380 *aAttachmentType = mData->mAttachmentType; 381 382 return S_OK; 383 } 384 385 STDMETHODIMP NetworkAdapter::COMGETTER(HostInterface)(BSTR *aHostInterface) 386 { 387 if (!aHostInterface) 388 return E_POINTER; 389 390 AutoCaller autoCaller (this); 391 CheckComRCReturnRC (autoCaller.rc()); 392 393 AutoReaderLock alock (this); 394 395 mData->mHostInterface.cloneTo (aHostInterface); 396 397 return S_OK; 398 } 399 400 STDMETHODIMP NetworkAdapter::COMSETTER(HostInterface)(INPTR BSTR aHostInterface) 377 401 { 378 402 /** @todo Validate input string length. r=dmik: do it in XML schema?*/ … … 382 406 // (because the @name attribute of <HostInerface> must be always present, 383 407 // but can be empty). 384 if (! hostInterface)408 if (!aHostInterface) 385 409 return E_INVALIDARG; 386 410 #endif 387 411 #ifdef VBOX_WITH_UNIXY_TAP_NETWORKING 388 412 // empty strings are not allowed as path names 389 if ( hostInterface && !(*hostInterface))413 if (aHostInterface && !(*aHostInterface)) 390 414 return E_INVALIDARG; 391 415 #endif 392 416 393 AutoLock alock(this); 394 CHECK_READY(); 395 396 CHECK_MACHINE_MUTABILITY (mParent); 397 398 if (mData->mHostInterface != hostInterface) 399 { 400 mData.backup(); 401 mData->mHostInterface = hostInterface; 402 403 /* notify parent */ 404 alock.unlock(); 405 mParent->onNetworkAdapterChange(this); 417 AutoCaller autoCaller (this); 418 CheckComRCReturnRC (autoCaller.rc()); 419 420 /* the machine needs to be mutable */ 421 Machine::AutoMutableStateDependency adep (mParent); 422 CheckComRCReturnRC (adep.rc()); 423 424 AutoLock alock (this); 425 426 if (mData->mHostInterface != aHostInterface) 427 { 428 mData.backup(); 429 mData->mHostInterface = aHostInterface; 430 431 /* leave the lock before informing callbacks */ 432 alock.unlock(); 433 434 mParent->onNetworkAdapterChange (this); 406 435 } 407 436 … … 410 439 411 440 #ifdef VBOX_WITH_UNIXY_TAP_NETWORKING 412 /** 413 * Returns the TAP file descriptor the adapter is attached to 414 * 415 * @returns COM status code 416 * @param tapFileDescriptor address of result string 417 */ 418 STDMETHODIMP NetworkAdapter::COMGETTER(TAPFileDescriptor)(LONG *tapFileDescriptor) 419 { 420 if (!tapFileDescriptor) 421 return E_POINTER; 422 423 AutoLock alock(this); 424 CHECK_READY(); 425 426 *tapFileDescriptor = mData->mTAPFD; 427 428 return S_OK; 429 } 430 431 /** 432 * Sets the TAP file descriptor the adapter is attached to 433 * 434 * @returns COM status code 435 * @param tapFileDescriptor file descriptor of existing TAP interface 436 */ 437 STDMETHODIMP NetworkAdapter::COMSETTER(TAPFileDescriptor)(LONG tapFileDescriptor) 441 442 STDMETHODIMP NetworkAdapter::COMGETTER(TAPFileDescriptor)(LONG *aTAPFileDescriptor) 443 { 444 if (!aTAPFileDescriptor) 445 return E_POINTER; 446 447 AutoCaller autoCaller (this); 448 CheckComRCReturnRC (autoCaller.rc()); 449 450 AutoReaderLock alock (this); 451 452 *aTAPFileDescriptor = mData->mTAPFD; 453 454 return S_OK; 455 } 456 457 STDMETHODIMP NetworkAdapter::COMSETTER(TAPFileDescriptor)(LONG aTAPFileDescriptor) 438 458 { 439 459 /* 440 460 * Validate input. 441 461 */ 442 RTFILE tapFD = tapFileDescriptor;443 if (tapFD != NIL_RTFILE && (LONG)tapFD != tapFileDescriptor)444 { 445 AssertMsgFailed(("Invalid file descriptor: %ld.\n", tapFileDescriptor));462 RTFILE tapFD = aTAPFileDescriptor; 463 if (tapFD != NIL_RTFILE && (LONG)tapFD != aTAPFileDescriptor) 464 { 465 AssertMsgFailed(("Invalid file descriptor: %ld.\n", aTAPFileDescriptor)); 446 466 return setError (E_INVALIDARG, 447 tr ("Invalid file descriptor: %ld"), tapFileDescriptor); 448 } 449 450 AutoLock alock(this); 451 CHECK_READY(); 452 453 CHECK_MACHINE_MUTABILITY (mParent); 454 455 if (mData->mTAPFD != (RTFILE) tapFileDescriptor) 456 { 457 mData.backup(); 458 mData->mTAPFD = tapFileDescriptor; 459 460 /* notify parent */ 461 alock.unlock(); 467 tr ("Invalid file descriptor: %ld"), aTAPFileDescriptor); 468 } 469 470 AutoCaller autoCaller (this); 471 CheckComRCReturnRC (autoCaller.rc()); 472 473 /* the machine needs to be mutable */ 474 Machine::AutoMutableStateDependency adep (mParent); 475 CheckComRCReturnRC (adep.rc()); 476 477 AutoLock alock (this); 478 479 if (mData->mTAPFD != (RTFILE) aTAPFileDescriptor) 480 { 481 mData.backup(); 482 mData->mTAPFD = aTAPFileDescriptor; 483 484 /* leave the lock before informing callbacks */ 485 alock.unlock(); 486 487 mParent->onNetworkAdapterChange (this); 488 } 489 490 return S_OK; 491 } 492 493 STDMETHODIMP NetworkAdapter::COMGETTER(TAPSetupApplication) ( 494 BSTR *aTAPSetupApplication) 495 { 496 if (!aTAPSetupApplication) 497 return E_POINTER; 498 499 AutoCaller autoCaller (this); 500 CheckComRCReturnRC (autoCaller.rc()); 501 502 AutoReaderLock alock (this); 503 504 /* we don't have to be in TAP mode to support this call */ 505 mData->mTAPSetupApplication.cloneTo (aTAPSetupApplication); 506 507 return S_OK; 508 } 509 510 STDMETHODIMP NetworkAdapter::COMSETTER(TAPSetupApplication) ( 511 INPTR BSTR aTAPSetupApplication) 512 { 513 /* empty strings are not allowed as path names */ 514 if (aTAPSetupApplication && !(*aTAPSetupApplication)) 515 return E_INVALIDARG; 516 517 AutoCaller autoCaller (this); 518 CheckComRCReturnRC (autoCaller.rc()); 519 520 /* the machine needs to be mutable */ 521 Machine::AutoMutableStateDependency adep (mParent); 522 CheckComRCReturnRC (adep.rc()); 523 524 AutoLock alock (this); 525 526 if (mData->mTAPSetupApplication != aTAPSetupApplication) 527 { 528 mData.backup(); 529 mData->mTAPSetupApplication = aTAPSetupApplication; 530 531 /* leave the lock before informing callbacks */ 532 alock.unlock(); 533 534 mParent->onNetworkAdapterChange (this); 535 } 536 537 return S_OK; 538 } 539 540 STDMETHODIMP NetworkAdapter::COMGETTER(TAPTerminateApplication) ( 541 BSTR *aTAPTerminateApplication) 542 { 543 if (!aTAPTerminateApplication) 544 return E_POINTER; 545 546 AutoCaller autoCaller (this); 547 CheckComRCReturnRC (autoCaller.rc()); 548 549 AutoReaderLock alock (this); 550 551 /* we don't have to be in TAP mode to support this call */ 552 mData->mTAPTerminateApplication.cloneTo(aTAPTerminateApplication); 553 554 return S_OK; 555 } 556 557 STDMETHODIMP NetworkAdapter::COMSETTER(TAPTerminateApplication) ( 558 INPTR BSTR aTAPTerminateApplication) 559 { 560 /* empty strings are not allowed as path names */ 561 if (aTAPTerminateApplication && !(*aTAPTerminateApplication)) 562 return E_INVALIDARG; 563 564 AutoCaller autoCaller (this); 565 CheckComRCReturnRC (autoCaller.rc()); 566 567 /* the machine needs to be mutable */ 568 Machine::AutoMutableStateDependency adep (mParent); 569 CheckComRCReturnRC (adep.rc()); 570 571 AutoLock alock (this); 572 573 if (mData->mTAPTerminateApplication != aTAPTerminateApplication) 574 { 575 mData.backup(); 576 mData->mTAPTerminateApplication = aTAPTerminateApplication; 577 578 /* leave the lock before informing callbacks */ 579 alock.unlock(); 580 462 581 mParent->onNetworkAdapterChange(this); 463 582 } … … 466 585 } 467 586 468 469 /** 470 * Returns the current TAP setup application path 471 * 472 * @returns COM status code 473 * @param tapSetupApplication address of result buffer 474 */ 475 STDMETHODIMP NetworkAdapter::COMGETTER(TAPSetupApplication)(BSTR *tapSetupApplication) 476 { 477 if (!tapSetupApplication) 478 return E_POINTER; 479 AutoLock alock(this); 480 CHECK_READY(); 481 482 /* we don't have to be in TAP mode to support this call */ 483 mData->mTAPSetupApplication.cloneTo(tapSetupApplication); 484 485 return S_OK; 486 } 487 488 /** 489 * Stores a new TAP setup application 490 * 491 * @returns COM status code 492 * @param tapSetupApplication new TAP setup application path 493 */ 494 STDMETHODIMP NetworkAdapter::COMSETTER(TAPSetupApplication)(INPTR BSTR tapSetupApplication) 495 { 496 // empty strings are not allowed as path names 497 if (tapSetupApplication && !(*tapSetupApplication)) 587 #endif /* VBOX_WITH_UNIXY_TAP_NETWORKING */ 588 589 STDMETHODIMP NetworkAdapter::COMGETTER(InternalNetwork) (BSTR *aInternalNetwork) 590 { 591 /* we don't allow null strings */ 592 if (!aInternalNetwork) 593 return E_POINTER; 594 595 AutoCaller autoCaller (this); 596 CheckComRCReturnRC (autoCaller.rc()); 597 598 AutoReaderLock alock (this); 599 600 mData->mInternalNetwork.cloneTo (aInternalNetwork); 601 602 return S_OK; 603 } 604 605 STDMETHODIMP NetworkAdapter::COMSETTER(InternalNetwork) (INPTR BSTR aInternalNetwork) 606 { 607 if (!aInternalNetwork) 498 608 return E_INVALIDARG; 499 609 500 AutoLock alock(this); 501 CHECK_READY(); 502 503 CHECK_MACHINE_MUTABILITY (mParent); 504 505 if (mData->mTAPSetupApplication != tapSetupApplication) 506 { 507 mData.backup(); 508 mData->mTAPSetupApplication = tapSetupApplication; 509 510 /* notify parent */ 511 alock.unlock(); 512 mParent->onNetworkAdapterChange(this); 513 } 514 515 return S_OK; 516 } 517 518 /** 519 * Returns the current TAP terminate application path 520 * 521 * @returns COM status code 522 * @param tapTerminateApplication address of result buffer 523 */ 524 STDMETHODIMP NetworkAdapter::COMGETTER(TAPTerminateApplication)(BSTR *tapTerminateApplication) 525 { 526 if (!tapTerminateApplication) 527 return E_POINTER; 528 AutoLock alock(this); 529 CHECK_READY(); 530 531 /* we don't have to be in TAP mode to support this call */ 532 mData->mTAPTerminateApplication.cloneTo(tapTerminateApplication); 533 534 return S_OK; 535 } 536 537 /** 538 * Stores a new TAP terminate application 539 * 540 * @returns COM status code 541 * @param tapTerminateApplication new TAP terminate application path 542 */ 543 STDMETHODIMP NetworkAdapter::COMSETTER(TAPTerminateApplication)(INPTR BSTR tapTerminateApplication) 544 { 545 // empty strings are not allowed as path names 546 if (tapTerminateApplication && !(*tapTerminateApplication)) 547 return E_INVALIDARG; 548 549 AutoLock alock(this); 550 CHECK_READY(); 551 552 CHECK_MACHINE_MUTABILITY (mParent); 553 554 if (mData->mTAPTerminateApplication != tapTerminateApplication) 555 { 556 mData.backup(); 557 mData->mTAPTerminateApplication = tapTerminateApplication; 558 559 /* notify parent */ 560 alock.unlock(); 561 mParent->onNetworkAdapterChange(this); 562 } 563 564 return S_OK; 565 } 566 567 #endif /* VBOX_WITH_UNIXY_TAP_NETWORKING */ 568 569 /** 570 * Returns the internal network the adapter is attached to 571 * 572 * @returns COM status code 573 * @param internalNetwork address of result variable 574 */ 575 STDMETHODIMP NetworkAdapter::COMGETTER(InternalNetwork)(BSTR *internalNetwork) 576 { 577 // we don't allow null strings 578 if (!internalNetwork) 579 return E_POINTER; 580 AutoLock alock(this); 581 CHECK_READY(); 582 583 mData->mInternalNetwork.cloneTo(internalNetwork); 584 585 return S_OK; 586 } 587 588 /** 589 * Sets the internal network for attachment. 590 * 591 * @returns COM status code 592 * @param internalNetwork internal network name 593 */ 594 STDMETHODIMP NetworkAdapter::COMSETTER(InternalNetwork)(INPTR BSTR internalNetwork) 595 { 596 if (!internalNetwork) 597 return E_INVALIDARG; 598 599 AutoLock alock(this); 600 CHECK_READY(); 601 602 CHECK_MACHINE_MUTABILITY (mParent); 603 604 if (mData->mInternalNetwork != internalNetwork) 610 AutoCaller autoCaller (this); 611 CheckComRCReturnRC (autoCaller.rc()); 612 613 /* the machine needs to be mutable */ 614 Machine::AutoMutableStateDependency adep (mParent); 615 CheckComRCReturnRC (adep.rc()); 616 617 AutoLock alock (this); 618 619 if (mData->mInternalNetwork != aInternalNetwork) 605 620 { 606 621 /* if an empty string is to be set, internal networking must be turned off */ 607 if ( ( internalNetwork == Bstr(""))622 if ( (aInternalNetwork == Bstr("")) 608 623 && (mData->mAttachmentType = NetworkAttachmentType_InternalNetworkAttachment)) 609 624 { 610 return setError (E_FAIL, tr("A valid internal network name must be set"));625 return setError (E_FAIL, tr ("Empty internal network name is not valid")); 611 626 } 612 627 613 628 mData.backup(); 614 mData->mInternalNetwork = internalNetwork; 615 616 /* notify parent */ 617 alock.unlock(); 618 mParent->onNetworkAdapterChange(this); 619 } 620 621 return S_OK; 622 } 623 624 625 /** 626 * Return the current cable status 627 * 628 * @returns COM status code 629 * @param connected address of result variable 630 */ 631 STDMETHODIMP NetworkAdapter::COMGETTER(CableConnected)(BOOL *connected) 632 { 633 if (!connected) 634 return E_POINTER; 635 636 AutoLock alock(this); 637 CHECK_READY(); 638 639 *connected = mData->mCableConnected; 640 return S_OK; 641 } 642 643 /** 644 * Set the cable status flag. 645 * 646 * @returns COM status code 647 * @param connected new trace flag 648 */ 649 STDMETHODIMP NetworkAdapter::COMSETTER(CableConnected)(BOOL connected) 650 { 651 AutoLock alock(this); 652 CHECK_READY(); 653 654 CHECK_MACHINE_MUTABILITY (mParent); 655 656 if (connected != mData->mCableConnected) 657 { 658 mData.backup(); 659 mData->mCableConnected = connected; 660 661 /* notify parent */ 662 alock.unlock(); 663 mParent->onNetworkAdapterChange(this); 664 } 665 666 return S_OK; 667 } 668 669 /** 670 * Return the current trace status 671 * 672 * @returns COM status code 673 * @param enabled address of result variable 674 */ 675 STDMETHODIMP NetworkAdapter::COMGETTER(TraceEnabled)(BOOL *enabled) 676 { 677 if (!enabled) 678 return E_POINTER; 679 680 AutoLock alock(this); 681 CHECK_READY(); 682 683 *enabled = mData->mTraceEnabled; 684 return S_OK; 685 } 686 687 /** 688 * Set the trace flag. 689 * 690 * @returns COM status code 691 * @param enabled new trace flag 692 */ 693 STDMETHODIMP NetworkAdapter::COMSETTER(TraceEnabled)(BOOL enabled) 694 { 695 AutoLock alock(this); 696 CHECK_READY(); 697 698 CHECK_MACHINE_MUTABILITY (mParent); 699 700 if (enabled != mData->mTraceEnabled) 701 { 702 mData.backup(); 703 mData->mTraceEnabled = enabled; 704 705 /* notify parent */ 706 alock.unlock(); 707 mParent->onNetworkAdapterChange(this); 708 } 709 710 return S_OK; 711 } 712 713 /** 714 * Return the current trace file name 715 * 716 * @returns COM status code 717 * @param address where to store result 718 */ 719 STDMETHODIMP NetworkAdapter::COMGETTER(TraceFile)(BSTR *traceFile) 720 { 721 if (!traceFile) 722 return E_POINTER; 723 724 AutoLock alock(this); 725 CHECK_READY(); 726 727 mData->mTraceFile.cloneTo(traceFile); 728 return S_OK; 729 } 730 731 /** 732 * Set the trace file name 733 * 734 * @returns COM status code 735 * @param New trace file name 736 */ 737 STDMETHODIMP NetworkAdapter::COMSETTER(TraceFile)(INPTR BSTR traceFile) 738 { 739 if (!traceFile) 629 mData->mInternalNetwork = aInternalNetwork; 630 631 /* leave the lock before informing callbacks */ 632 alock.unlock(); 633 634 mParent->onNetworkAdapterChange (this); 635 } 636 637 return S_OK; 638 } 639 640 STDMETHODIMP NetworkAdapter::COMGETTER(CableConnected) (BOOL *aConnected) 641 { 642 if (!aConnected) 643 return E_POINTER; 644 645 AutoCaller autoCaller (this); 646 CheckComRCReturnRC (autoCaller.rc()); 647 648 AutoReaderLock alock (this); 649 650 *aConnected = mData->mCableConnected; 651 652 return S_OK; 653 } 654 655 STDMETHODIMP NetworkAdapter::COMSETTER(CableConnected) (BOOL aConnected) 656 { 657 AutoCaller autoCaller (this); 658 CheckComRCReturnRC (autoCaller.rc()); 659 660 /* the machine needs to be mutable */ 661 Machine::AutoMutableStateDependency adep (mParent); 662 CheckComRCReturnRC (adep.rc()); 663 664 AutoLock alock (this); 665 666 if (aConnected != mData->mCableConnected) 667 { 668 mData.backup(); 669 mData->mCableConnected = aConnected; 670 671 /* leave the lock before informing callbacks */ 672 alock.unlock(); 673 674 mParent->onNetworkAdapterChange (this); 675 } 676 677 return S_OK; 678 } 679 680 STDMETHODIMP NetworkAdapter::COMGETTER(TraceEnabled) (BOOL *aEnabled) 681 { 682 if (!aEnabled) 683 return E_POINTER; 684 685 AutoCaller autoCaller (this); 686 CheckComRCReturnRC (autoCaller.rc()); 687 688 AutoReaderLock alock (this); 689 690 *aEnabled = mData->mTraceEnabled; 691 return S_OK; 692 } 693 694 STDMETHODIMP NetworkAdapter::COMSETTER(TraceEnabled) (BOOL aEnabled) 695 { 696 AutoCaller autoCaller (this); 697 CheckComRCReturnRC (autoCaller.rc()); 698 699 /* the machine needs to be mutable */ 700 Machine::AutoMutableStateDependency adep (mParent); 701 CheckComRCReturnRC (adep.rc()); 702 703 AutoLock alock (this); 704 705 if (aEnabled != mData->mTraceEnabled) 706 { 707 mData.backup(); 708 mData->mTraceEnabled = aEnabled; 709 710 /* leave the lock before informing callbacks */ 711 alock.unlock(); 712 713 mParent->onNetworkAdapterChange (this); 714 } 715 716 return S_OK; 717 } 718 719 STDMETHODIMP NetworkAdapter::COMGETTER(TraceFile) (BSTR *aTraceFile) 720 { 721 if (!aTraceFile) 722 return E_POINTER; 723 724 AutoCaller autoCaller (this); 725 CheckComRCReturnRC (autoCaller.rc()); 726 727 AutoReaderLock alock (this); 728 729 mData->mTraceFile.cloneTo (aTraceFile); 730 731 return S_OK; 732 } 733 734 STDMETHODIMP NetworkAdapter::COMSETTER(TraceFile) (INPTR BSTR aTraceFile) 735 { 736 if (!aTraceFile) 740 737 return E_INVALIDARG; 741 738 742 AutoLock alock(this); 743 CHECK_READY(); 744 745 CHECK_MACHINE_MUTABILITY(mParent); 746 747 mData.backup(); 748 mData->mTraceFile = traceFile; 749 750 /* notify parent */ 751 alock.unlock(); 752 mParent->onNetworkAdapterChange(this); 739 AutoCaller autoCaller (this); 740 CheckComRCReturnRC (autoCaller.rc()); 741 742 /* the machine needs to be mutable */ 743 Machine::AutoMutableStateDependency adep (mParent); 744 CheckComRCReturnRC (adep.rc()); 745 746 AutoLock alock (this); 747 748 if (mData->mTraceFile != aTraceFile) 749 { 750 mData.backup(); 751 mData->mTraceFile = aTraceFile; 752 753 /* leave the lock before informing callbacks */ 754 alock.unlock(); 755 756 mParent->onNetworkAdapterChange (this); 757 } 753 758 754 759 return S_OK; … … 758 763 //////////////////////////////////////////////////////////////////////////////// 759 764 760 /**761 * Attach the network card to the NAT interface.762 *763 * @returns COM status code764 */765 765 STDMETHODIMP NetworkAdapter::AttachToNAT() 766 766 { 767 AutoLock alock(this); 768 CHECK_READY(); 769 770 CHECK_MACHINE_MUTABILITY (mParent); 767 AutoCaller autoCaller (this); 768 CheckComRCReturnRC (autoCaller.rc()); 769 770 /* the machine needs to be mutable */ 771 Machine::AutoMutableStateDependency adep (mParent); 772 CheckComRCReturnRC (adep.rc()); 773 774 AutoLock alock (this); 771 775 772 776 if (mData->mAttachmentType != NetworkAttachmentType_NATNetworkAttachment) 773 777 { 774 778 mData.backup(); 779 775 780 detach(); 781 776 782 mData->mAttachmentType = NetworkAttachmentType_NATNetworkAttachment; 777 783 778 /* notify parent */ 779 alock.unlock(); 780 mParent->onNetworkAdapterChange(this); 781 } 782 783 return S_OK; 784 } 785 786 /** 787 * Attach the network card to the defined host interface. 788 * 789 * @returns COM status code 790 */ 784 /* leave the lock before informing callbacks */ 785 alock.unlock(); 786 787 mParent->onNetworkAdapterChange (this); 788 } 789 790 return S_OK; 791 } 792 791 793 STDMETHODIMP NetworkAdapter::AttachToHostInterface() 792 794 { 793 AutoLock alock(this); 794 CHECK_READY(); 795 796 CHECK_MACHINE_MUTABILITY (mParent); 795 AutoCaller autoCaller (this); 796 CheckComRCReturnRC (autoCaller.rc()); 797 798 /* the machine needs to be mutable */ 799 Machine::AutoMutableStateDependency adep (mParent); 800 CheckComRCReturnRC (adep.rc()); 801 802 AutoLock alock (this); 797 803 798 804 /* don't do anything if we're already host interface attached */ … … 800 806 { 801 807 mData.backup(); 808 802 809 /* first detach the current attachment */ 803 if (mData->mAttachmentType != NetworkAttachmentType_NoNetworkAttachment)804 detach(); 810 detach(); 811 805 812 mData->mAttachmentType = NetworkAttachmentType_HostInterfaceNetworkAttachment; 806 813 807 /* notify parent */ 808 alock.unlock(); 809 mParent->onNetworkAdapterChange(this); 810 } 811 812 return S_OK; 813 } 814 815 /** 816 * Attach the network card to the defined internal network. 817 * 818 * @returns COM status code 819 */ 814 /* leave the lock before informing callbacks */ 815 alock.unlock(); 816 817 mParent->onNetworkAdapterChange (this); 818 } 819 820 return S_OK; 821 } 822 820 823 STDMETHODIMP NetworkAdapter::AttachToInternalNetwork() 821 824 { 822 AutoLock alock(this); 823 CHECK_READY(); 824 825 CHECK_MACHINE_MUTABILITY (mParent); 825 AutoCaller autoCaller (this); 826 CheckComRCReturnRC (autoCaller.rc()); 827 828 /* the machine needs to be mutable */ 829 Machine::AutoMutableStateDependency adep (mParent); 830 CheckComRCReturnRC (adep.rc()); 831 832 AutoLock alock (this); 826 833 827 834 /* don't do anything if we're already internal network attached */ 828 835 if (mData->mAttachmentType != NetworkAttachmentType_InternalNetworkAttachment) 829 836 { 837 mData.backup(); 838 839 /* first detach the current attachment */ 840 detach(); 841 830 842 /* there must an internal network name */ 831 843 if ( !mData->mInternalNetwork 832 || (mData->mInternalNetwork == Bstr ("")))844 || (mData->mInternalNetwork == Bstr (""))) 833 845 { 834 LogRel(("Internal network name not defined, setting to default \"intnet\"\n")); 835 HRESULT rc = COMSETTER(InternalNetwork)(Bstr("intnet")); 836 if (FAILED(rc)) 837 return rc; 846 LogRel (("Internal network name not defined, " 847 "setting to default \"intnet\"\n")); 848 mData->mInternalNetwork = Bstr ("intnet"); 838 849 } 839 850 840 mData.backup(); 841 /* first detach the current attachment */ 851 mData->mAttachmentType = NetworkAttachmentType_InternalNetworkAttachment; 852 853 /* leave the lock before informing callbacks */ 854 alock.unlock(); 855 856 mParent->onNetworkAdapterChange (this); 857 } 858 859 return S_OK; 860 } 861 862 STDMETHODIMP NetworkAdapter::Detach() 863 { 864 AutoCaller autoCaller (this); 865 CheckComRCReturnRC (autoCaller.rc()); 866 867 /* the machine needs to be mutable */ 868 Machine::AutoMutableStateDependency adep (mParent); 869 CheckComRCReturnRC (adep.rc()); 870 871 AutoLock alock (this); 872 873 if (mData->mAttachmentType != NetworkAttachmentType_NoNetworkAttachment) 874 { 875 mData.backup(); 876 842 877 detach(); 843 mData->mAttachmentType = NetworkAttachmentType_InternalNetworkAttachment; 844 845 /* notify parent */ 846 alock.unlock(); 847 mParent->onNetworkAdapterChange(this); 848 } 849 850 return S_OK; 851 } 852 853 /** 854 * Detach the network card from its interface 855 * 856 * @returns COM status code 857 */ 858 STDMETHODIMP NetworkAdapter::Detach() 859 { 860 AutoLock alock(this); 861 CHECK_READY(); 862 863 CHECK_MACHINE_MUTABILITY (mParent); 864 865 if (mData->mAttachmentType != NetworkAttachmentType_NoNetworkAttachment) 866 { 867 mData.backup(); 868 detach(); 869 870 /* notify parent */ 871 alock.unlock(); 872 mParent->onNetworkAdapterChange(this); 878 879 /* leave the lock before informing callbacks */ 880 alock.unlock(); 881 882 mParent->onNetworkAdapterChange (this); 873 883 } 874 884 … … 879 889 //////////////////////////////////////////////////////////////////////////////// 880 890 891 /** 892 * @note Locks this object for writing. 893 */ 881 894 bool NetworkAdapter::rollback() 882 895 { 896 /* sanity */ 897 AutoCaller autoCaller (this); 898 AssertComRCReturn (autoCaller.rc(), false); 899 883 900 AutoLock alock (this); 884 901 … … 887 904 if (mData.isBackedUp()) 888 905 { 889 / /we need to check all data to see whether anything will be changed890 // after rollback906 /* we need to check all data to see whether anything will be changed 907 * after rollback */ 891 908 changed = mData.hasActualChanges(); 892 909 mData.rollback(); … … 896 913 } 897 914 915 /** 916 * @note Locks this object for writing, together with the peer object (also 917 * for writing) if there is one. 918 */ 898 919 void NetworkAdapter::commit() 899 920 { 900 AutoLock alock (this); 921 /* sanity */ 922 AutoCaller autoCaller (this); 923 AssertComRCReturnVoid (autoCaller.rc()); 924 925 /* sanity too */ 926 AutoCaller thatCaller (mPeer); 927 AssertComRCReturnVoid (thatCaller.rc()); 928 929 /* lock both for writing since we modify both */ 930 AutoMultiLock <2> alock (this->wlock(), AutoLock::maybeWlock (mPeer)); 931 901 932 if (mData.isBackedUp()) 902 933 { … … 904 935 if (mPeer) 905 936 { 906 // attach new data to the peer and reshare it 907 AutoLock peerlock (mPeer); 937 /* attach new data to the peer and reshare it */ 908 938 mPeer->mData.attach (mData); 909 939 } … … 911 941 } 912 942 943 /** 944 * @note Locks this object for writing, together with the peer object 945 * represented by @a aThat (locked for reading). 946 */ 913 947 void NetworkAdapter::copyFrom (NetworkAdapter *aThat) 914 948 { 915 AutoLock alock (this); 916 917 // this will back up current data 949 AssertReturnVoid (aThat != NULL); 950 951 /* sanity */ 952 AutoCaller autoCaller (this); 953 AssertComRCReturnVoid (autoCaller.rc()); 954 955 /* sanity too */ 956 AutoCaller thatCaller (mPeer); 957 AssertComRCReturnVoid (thatCaller.rc()); 958 959 /* peer is not modified, lock it for reading */ 960 AutoMultiLock <2> alock (this->wlock(), aThat->rlock()); 961 962 /* this will back up current data */ 918 963 mData.assignCopy (aThat->mData); 919 964 } … … 923 968 924 969 /** 925 * Worker routine for detach handling. No locking, no notifications. 970 * Worker routine for detach handling. No locking, no notifications. 971 972 * @note Must be called from under the object's write lock. 926 973 */ 927 974 void NetworkAdapter::detach() 928 975 { 976 AssertReturnVoid (isLockedOnCurrentThread()); 977 929 978 switch (mData->mAttachmentType) 930 979 { … … 961 1010 962 1011 /** 963 * Generates a new unique MAC address based on our vendor ID and 964 * parts of a GUID 1012 * Generates a new unique MAC address based on our vendor ID and 1013 * parts of a GUID. 1014 * 1015 * @note Must be called from under the object's write lock or within the init 1016 * span. 965 1017 */ 966 1018 void NetworkAdapter::generateMACAddress() … … 974 1026 Guid guid; 975 1027 guid.create(); 976 RTStrPrintf(strMAC, sizeof(strMAC), "080027%02X%02X%02X", guid.ptr()->au8[0], guid.ptr()->au8[1], guid.ptr()->au8[2]); 977 LogFlowThisFunc (("Generated '%s'\n", strMAC)); 1028 RTStrPrintf (strMAC, sizeof(strMAC), "080027%02X%02X%02X", 1029 guid.ptr()->au8[0], guid.ptr()->au8[1], guid.ptr()->au8[2]); 1030 LogFlowThisFunc (("generated MAC: '%s'\n", strMAC)); 978 1031 mData->mMACAddress = strMAC; 979 1032 } -
trunk/src/VBox/Main/include/AudioAdapterImpl.h
r2981 r3348 28 28 29 29 class ATL_NO_VTABLE AudioAdapter : 30 public VirtualBoxBaseNEXT, 30 31 public VirtualBoxSupportErrorInfoImpl <AudioAdapter, IAudioAdapter>, 31 32 public VirtualBoxSupportTranslation <AudioAdapter>, 32 public VirtualBoxBase,33 33 public IAudioAdapter 34 34 { … … 53 53 }; 54 54 55 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT (AudioAdapter) 56 55 57 DECLARE_NOT_AGGREGATABLE(AudioAdapter) 56 58 … … 64 66 NS_DECL_ISUPPORTS 65 67 68 DECLARE_EMPTY_CTOR_DTOR (AudioAdapter) 69 66 70 HRESULT FinalConstruct(); 67 71 void FinalRelease(); 68 72 69 73 // public initializer/uninitializer for internal purposes only 70 HRESULT init (Machine * parent);71 HRESULT init (Machine * parent, AudioAdapter *that);72 HRESULT initCopy (Machine * parent, AudioAdapter *that);74 HRESULT init (Machine *aParent); 75 HRESULT init (Machine *aParent, AudioAdapter *aThat); 76 HRESULT initCopy (Machine *aParent, AudioAdapter *aThat); 73 77 void uninit(); 74 78 75 STDMETHOD(COMGETTER(Enabled))(BOOL * enabled);76 STDMETHOD(COMSETTER(Enabled))(BOOL enabled);77 STDMETHOD(COMGETTER(AudioDriver)) (AudioDriverType_T *a udioDriverType);78 STDMETHOD(COMSETTER(AudioDriver)) (AudioDriverType_T a udioDriverType);79 STDMETHOD(COMGETTER(Enabled))(BOOL *aEnabled); 80 STDMETHOD(COMSETTER(Enabled))(BOOL aEnabled); 81 STDMETHOD(COMGETTER(AudioDriver)) (AudioDriverType_T *aAudioDriverType); 82 STDMETHOD(COMSETTER(AudioDriver)) (AudioDriverType_T aAudioDriverType); 79 83 80 84 // public methods only for internal purposes 81 85 82 const Backupable <Data> &data() const { return mData; }83 84 86 bool isModified() { AutoLock alock (this); return mData.isBackedUp(); } 85 87 bool isReallyModified() { AutoLock alock (this); return mData.hasActualChanges(); } 86 void rollback() { AutoLock alock (this); mData.rollback(); }88 bool rollback(); 87 89 void commit(); 88 90 void copyFrom (AudioAdapter *aThat); 91 92 // public methods for internal purposes only 93 // (ensure there is a caller and a read lock before calling them!) 94 95 const Backupable <Data> &data() const { return mData; } 89 96 90 97 // for VirtualBoxSupportErrorInfoImpl … … 93 100 private: 94 101 95 ComObjPtr <Machine, ComWeakRef> mParent; 96 ComObjPtr <AudioAdapter> mPeer; 102 const ComObjPtr <Machine, ComWeakRef> mParent; 103 const ComObjPtr <AudioAdapter> mPeer; 104 97 105 Backupable <Data> mData; 98 106 }; -
trunk/src/VBox/Main/include/NetworkAdapterImpl.h
r2981 r3348 29 29 30 30 class ATL_NO_VTABLE NetworkAdapter : 31 public VirtualBoxBase ,31 public VirtualBoxBaseNEXT, 32 32 public VirtualBoxSupportErrorInfoImpl <NetworkAdapter, INetworkAdapter>, 33 33 public VirtualBoxSupportTranslation <NetworkAdapter>, … … 86 86 }; 87 87 88 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT (NetworkAdapter) 89 88 90 DECLARE_NOT_AGGREGATABLE(NetworkAdapter) 89 91 … … 97 99 NS_DECL_ISUPPORTS 98 100 101 DECLARE_EMPTY_CTOR_DTOR (NetworkAdapter) 102 99 103 HRESULT FinalConstruct(); 100 104 void FinalRelease(); 101 105 102 106 // public initializer/uninitializer for internal purposes only 103 HRESULT init (Machine * parent, ULONG slot);104 HRESULT init (Machine * parent, NetworkAdapter *that);105 HRESULT initCopy (Machine * parent, NetworkAdapter *that);107 HRESULT init (Machine *aParent, ULONG aSlot); 108 HRESULT init (Machine *aParent, NetworkAdapter *aThat); 109 HRESULT initCopy (Machine *aParent, NetworkAdapter *aThat); 106 110 void uninit(); 107 111 108 112 // INetworkAdapter properties 109 STDMETHOD(COMGETTER(AdapterType))(NetworkAdapterType_T *a dapterType);110 STDMETHOD(COMSETTER(AdapterType))(NetworkAdapterType_T a dapterType);111 STDMETHOD(COMGETTER(Slot)) (ULONG * slot);112 STDMETHOD(COMGETTER(Enabled)) (BOOL * enabled);113 STDMETHOD(COMSETTER(Enabled)) (BOOL enabled);114 STDMETHOD(COMGETTER(MACAddress)) (BSTR *macAddress);115 STDMETHOD(COMSETTER(MACAddress)) (INPTR BSTR macAddress);116 STDMETHOD(COMGETTER(AttachmentType)) (NetworkAttachmentType_T *attachmentType);117 STDMETHOD(COMGETTER(HostInterface)) (BSTR *hostInterface);118 STDMETHOD(COMSETTER(HostInterface)) (INPTR BSTR hostInterface);113 STDMETHOD(COMGETTER(AdapterType))(NetworkAdapterType_T *aAdapterType); 114 STDMETHOD(COMSETTER(AdapterType))(NetworkAdapterType_T aAdapterType); 115 STDMETHOD(COMGETTER(Slot)) (ULONG *aSlot); 116 STDMETHOD(COMGETTER(Enabled)) (BOOL *aEnabled); 117 STDMETHOD(COMSETTER(Enabled)) (BOOL aEnabled); 118 STDMETHOD(COMGETTER(MACAddress)) (BSTR *aMACAddress); 119 STDMETHOD(COMSETTER(MACAddress)) (INPTR BSTR aMACAddress); 120 STDMETHOD(COMGETTER(AttachmentType)) (NetworkAttachmentType_T *aAttachmentType); 121 STDMETHOD(COMGETTER(HostInterface)) (BSTR *aHostInterface); 122 STDMETHOD(COMSETTER(HostInterface)) (INPTR BSTR aHostInterface); 119 123 #ifdef VBOX_WITH_UNIXY_TAP_NETWORKING 120 STDMETHOD(COMGETTER(TAPFileDescriptor)) (LONG *tapFileDescriptor);121 STDMETHOD(COMSETTER(TAPFileDescriptor)) (LONG tapFileDescriptor);122 STDMETHOD(COMGETTER(TAPSetupApplication)) (BSTR *tapSetupApplication);123 STDMETHOD(COMSETTER(TAPSetupApplication)) (INPTR BSTR tapSetupApplication);124 STDMETHOD(COMGETTER(TAPTerminateApplication)) (BSTR *tapTerminateApplication);125 STDMETHOD(COMSETTER(TAPTerminateApplication)) (INPTR BSTR tapTerminateApplication);124 STDMETHOD(COMGETTER(TAPFileDescriptor)) (LONG *aTAPFileDescriptor); 125 STDMETHOD(COMSETTER(TAPFileDescriptor)) (LONG aTAPFileDescriptor); 126 STDMETHOD(COMGETTER(TAPSetupApplication)) (BSTR *aTAPSetupApplication); 127 STDMETHOD(COMSETTER(TAPSetupApplication)) (INPTR BSTR aTAPSetupApplication); 128 STDMETHOD(COMGETTER(TAPTerminateApplication)) (BSTR *aTAPTerminateApplication); 129 STDMETHOD(COMSETTER(TAPTerminateApplication)) (INPTR BSTR aTAPTerminateApplication); 126 130 #endif 127 STDMETHOD(COMGETTER(InternalNetwork)) (BSTR *internalNetwork);128 STDMETHOD(COMSETTER(InternalNetwork)) (INPTR BSTR internalNetwork);129 STDMETHOD(COMGETTER(CableConnected)) (BOOL *connected);130 STDMETHOD(COMSETTER(CableConnected)) (BOOL connected);131 STDMETHOD(COMGETTER(TraceEnabled)) (BOOL *enabled);132 STDMETHOD(COMSETTER(TraceEnabled)) (BOOL enabled);133 STDMETHOD(COMGETTER(TraceFile)) (BSTR *traceFile);134 STDMETHOD(COMSETTER(TraceFile)) (INPTR BSTR traceFile);131 STDMETHOD(COMGETTER(InternalNetwork)) (BSTR *aInternalNetwork); 132 STDMETHOD(COMSETTER(InternalNetwork)) (INPTR BSTR aInternalNetwork); 133 STDMETHOD(COMGETTER(CableConnected)) (BOOL *aConnected); 134 STDMETHOD(COMSETTER(CableConnected)) (BOOL aConnected); 135 STDMETHOD(COMGETTER(TraceEnabled)) (BOOL *aEnabled); 136 STDMETHOD(COMSETTER(TraceEnabled)) (BOOL aEnabled); 137 STDMETHOD(COMGETTER(TraceFile)) (BSTR *aTraceFile); 138 STDMETHOD(COMSETTER(TraceFile)) (INPTR BSTR aTraceFile); 135 139 136 140 // INetworkAdapter methods … … 142 146 // public methods only for internal purposes 143 147 144 const Backupable <Data> &data() const { return mData; }145 146 148 bool isModified() { AutoLock alock (this); return mData.isBackedUp(); } 147 149 bool isReallyModified() { AutoLock alock (this); return mData.hasActualChanges(); } … … 149 151 void commit(); 150 152 void copyFrom (NetworkAdapter *aThat); 153 154 // public methods for internal purposes only 155 // (ensure there is a caller and a read lock before calling them!) 156 157 const Backupable <Data> &data() const { return mData; } 151 158 152 159 // for VirtualBoxSupportErrorInfoImpl … … 158 165 void generateMACAddress(); 159 166 160 ComObjPtr <Machine, ComWeakRef> mParent; 161 ComObjPtr <NetworkAdapter> mPeer; 167 const ComObjPtr <Machine, ComWeakRef> mParent; 168 const ComObjPtr <NetworkAdapter> mPeer; 169 162 170 Backupable <Data> mData; 163 171 };
Note:
See TracChangeset
for help on using the changeset viewer.