Changeset 54700 in vbox for trunk/src/VBox/NetworkServices/NetLib
- Timestamp:
- Mar 9, 2015 4:14:52 PM (10 years ago)
- Location:
- trunk/src/VBox/NetworkServices/NetLib
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/NetworkServices/NetLib/ComHostUtils.cpp
r54696 r54700 214 214 return VINF_SUCCESS; 215 215 } 216 217 int destroyNatListener(ComNatListenerPtr& listener, const ComVirtualBoxPtr& vboxptr) 218 { 219 if (listener) 220 { 221 ComPtr<IEventSource> esVBox; 222 HRESULT hrc = vboxptr->COMGETTER(EventSource)(esVBox.asOutParam()); 223 AssertComRCReturn(hrc, VERR_INTERNAL_ERROR); 224 if (!esVBox.isNull()) 225 { 226 hrc = esVBox->UnregisterListener(listener); 227 AssertComRCReturn(hrc, VERR_INTERNAL_ERROR); 228 } 229 listener.setNull(); 230 } 231 return VINF_SUCCESS; 232 } 233 234 int createClientListener(ComNatListenerPtr& listener, const ComVirtualBoxClientPtr& vboxclientptr, 235 NATNetworkEventAdapter *adapter, /* const */ ComEventTypeArray& events) 236 { 237 ComObjPtr<NATNetworkListenerImpl> obj; 238 HRESULT hrc = obj.createObject(); 239 AssertComRCReturn(hrc, VERR_INTERNAL_ERROR); 240 241 hrc = obj->init(new NATNetworkListener(), adapter); 242 AssertComRCReturn(hrc, VERR_INTERNAL_ERROR); 243 244 ComPtr<IEventSource> esVBox; 245 hrc = vboxclientptr->COMGETTER(EventSource)(esVBox.asOutParam()); 246 AssertComRCReturn(hrc, VERR_INTERNAL_ERROR); 247 248 listener = obj; 249 250 hrc = esVBox->RegisterListener(listener, ComSafeArrayAsInParam(events), true); 251 AssertComRCReturn(hrc, VERR_INTERNAL_ERROR); 252 253 return VINF_SUCCESS; 254 } 255 256 int destroyClientListener(ComNatListenerPtr& listener, const ComVirtualBoxClientPtr& vboxclientptr) 257 { 258 if (listener) 259 { 260 ComPtr<IEventSource> esVBox; 261 HRESULT hrc = vboxclientptr->COMGETTER(EventSource)(esVBox.asOutParam()); 262 AssertComRCReturn(hrc, VERR_INTERNAL_ERROR); 263 if (!esVBox.isNull()) 264 { 265 hrc = esVBox->UnregisterListener(listener); 266 AssertComRCReturn(hrc, VERR_INTERNAL_ERROR); 267 } 268 listener.setNull(); 269 } 270 return VINF_SUCCESS; 271 } -
trunk/src/VBox/NetworkServices/NetLib/VBoxNetBaseService.cpp
r53502 r54700 208 208 AssertComRCReturn(hrc, VERR_INTERNAL_ERROR); 209 209 210 hrc = virtualbox.createLocalObject(CLSID_VirtualBox); 210 hrc = virtualboxClient.createInprocObject(CLSID_VirtualBoxClient); 211 AssertComRCReturn(hrc, VERR_INTERNAL_ERROR); 212 213 hrc = virtualboxClient->COMGETTER(VirtualBox)(virtualbox.asOutParam()); 211 214 AssertComRCReturn(hrc, VERR_INTERNAL_ERROR); 212 215 } -
trunk/src/VBox/NetworkServices/NetLib/VBoxNetBaseService.h
r50213 r54700 132 132 /* VirtualBox instance */ 133 133 ComPtr<IVirtualBox> virtualbox; 134 ComPtr<IVirtualBoxClient> virtualboxClient; 134 135 135 136 private: -
trunk/src/VBox/NetworkServices/NetLib/utils.h
r54696 r54700 25 25 26 26 typedef ComPtr<IVirtualBox> ComVirtualBoxPtr; 27 typedef ComPtr<IVirtualBoxClient> ComVirtualBoxClientPtr; 27 28 typedef ComPtr<IDHCPServer> ComDhcpServerPtr; 28 29 typedef ComPtr<IHost> ComHostPtr; … … 131 132 int createNatListener(ComNatListenerPtr& listener, const ComVirtualBoxPtr& vboxptr, 132 133 NATNetworkEventAdapter *adapter, /* const */ ComEventTypeArray& events); 134 int destroyNatListener(ComNatListenerPtr& listener, const ComVirtualBoxPtr& vboxptr); 135 int createClientListener(ComNatListenerPtr& listener, const ComVirtualBoxClientPtr& vboxclientptr, 136 NATNetworkEventAdapter *adapter, /* const */ ComEventTypeArray& events); 137 int destroyClientListener(ComNatListenerPtr& listener, const ComVirtualBoxClientPtr& vboxclientptr); 138 133 139 #endif
Note:
See TracChangeset
for help on using the changeset viewer.