VirtualBox

Changeset 85309 in vbox


Ignore:
Timestamp:
Jul 13, 2020 12:56:56 PM (4 years ago)
Author:
vboxsync
Message:

Main: Try harder using the Utf8Str versions of the event stuff where possible. bugref:9790

Location:
trunk/src/VBox/Main
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/include/ConsoleImpl.h

    r85307 r85309  
    291291    static HRESULT i_storageBusPortDeviceToLun(StorageBus_T enmBus, LONG port, LONG device, unsigned &uLun);
    292292    // Called from event listener
    293     HRESULT i_onNATRedirectRuleChange(ULONG ulInstance, BOOL aNatRuleRemove,
    294                                       NATProtocol_T aProto, IN_BSTR aHostIp, LONG aHostPort, IN_BSTR aGuestIp, LONG aGuestPort);
     293    HRESULT i_onNATRedirectRuleChanged(ULONG ulInstance, BOOL aNatRuleRemove,
     294                                       NATProtocol_T aProto, IN_BSTR aHostIp, LONG aHostPort, IN_BSTR aGuestIp, LONG aGuestPort);
    295295    HRESULT i_onNATDnsChanged();
    296296
  • trunk/src/VBox/Main/include/GuestImpl.h

    r84554 r85309  
    9595    void i_setAdditionsStatus(VBoxGuestFacilityType a_enmFacility, VBoxGuestFacilityStatus a_enmStatus,
    9696                              uint32_t a_fFlags, PCRTTIMESPEC a_pTimeSpecTS);
    97     void i_onUserStateChange(Bstr aUser, Bstr aDomain, VBoxGuestUserState enmState, const uint8_t *puDetails, uint32_t cbDetails);
     97    void i_onUserStateChanged(const Utf8Str &aUser, const Utf8Str &aDomain, VBoxGuestUserState enmState,
     98                              const uint8_t *puDetails, uint32_t cbDetails);
    9899    void i_setSupportedFeatures(uint32_t aCaps);
    99100    HRESULT i_setStatistic(ULONG aCpuId, GUESTSTATTYPE enmType, ULONG aVal);
  • trunk/src/VBox/Main/include/MachineImpl.h

    r84618 r85309  
    512512    // callback handlers
    513513    virtual HRESULT i_onNetworkAdapterChange(INetworkAdapter * /* networkAdapter */, BOOL /* changeAdapter */) { return S_OK; }
    514     virtual HRESULT i_onNATRedirectRuleChange(ULONG /* slot */, BOOL /* fRemove */ , IN_BSTR /* name */,
    515                                               NATProtocol_T /* protocol */, IN_BSTR /* host ip */, LONG /* host port */,
    516                                               IN_BSTR /* guest port */, LONG /* guest port */ ) { return S_OK; }
     514    virtual HRESULT i_onNATRedirectRuleChanged(ULONG /* slot */, BOOL /* fRemove */ , const Utf8Str & /* name */,
     515                                               NATProtocol_T /* protocol */, const Utf8Str & /* host ip */, LONG /* host port */,
     516                                               const Utf8Str & /* guest port */, LONG /* guest port */ ) { return S_OK; }
    517517    virtual HRESULT i_onAudioAdapterChange(IAudioAdapter * /* audioAdapter */) { return S_OK; }
    518518    virtual HRESULT i_onSerialPortChange(ISerialPort * /* serialPort */) { return S_OK; }
     
    13191319
    13201320    HRESULT i_onNetworkAdapterChange(INetworkAdapter *networkAdapter, BOOL changeAdapter);
    1321     HRESULT i_onNATRedirectRuleChange(ULONG ulSlot, BOOL aNatRuleRemove, IN_BSTR aRuleName,
    1322                                       NATProtocol_T aProto, IN_BSTR aHostIp, LONG aHostPort,
    1323                                       IN_BSTR aGuestIp, LONG aGuestPort);
     1321    HRESULT i_onNATRedirectRuleChanged(ULONG ulSlot, BOOL aNatRuleRemove, const Utf8Str &aRuleName,
     1322                                       NATProtocol_T aProto, const Utf8Str &aHostIp, LONG aHostPort,
     1323                                       const Utf8Str &aGuestIp, LONG aGuestPort) RT_OVERRIDE;
    13241324    HRESULT i_onStorageControllerChange(const com::Guid &aMachineId, const com::Utf8Str &aControllerName);
    13251325    HRESULT i_onMediumChange(IMediumAttachment *aMediumAttachment, BOOL aForce);
  • trunk/src/VBox/Main/include/VirtualBoxImpl.h

    r85307 r85309  
    192192
    193193    void i_onGuestPropertyChanged(const Guid &aMachineId, const Utf8Str &aName, const Utf8Str &aValue, const Utf8Str &aFlags);
    194     void i_onNatRedirectChanged(const Guid &aMachineId, ULONG ulSlot, bool fRemove, IN_BSTR aName,
    195                                 NATProtocol_T aProto, IN_BSTR aHostIp, uint16_t aHostPort,
    196                                 IN_BSTR aGuestIp, uint16_t aGuestPort);
     194    void i_onNatRedirectChanged(const Guid &aMachineId, ULONG ulSlot, bool fRemove, const Utf8Str &aName,
     195                                NATProtocol_T aProto, const Utf8Str &aHostIp, uint16_t aHostPort,
     196                                const Utf8Str &aGuestIp, uint16_t aGuestPort);
    197197    void i_onNATNetworkChanged(const Utf8Str &aNetworkName);
    198198    void i_onNATNetworkStartStop(const Utf8Str &aNetworkName, BOOL aStart);
  • trunk/src/VBox/Main/src-client/ConsoleImpl.cpp

    r85307 r85309  
    299299            case VBoxEventType_OnNATRedirect:
    300300            {
    301                 Bstr id;
    302301                ComPtr<IMachine> pMachine = mConsole->i_machine();
    303302                ComPtr<INATRedirectEvent> pNREv = aEvent;
     
    305304                Assert(pNREv);
    306305
     306                Bstr id;
    307307                rc = pNREv->COMGETTER(MachineId)(id.asOutParam());
    308308                AssertComRC(rc);
    309309                if (id != mConsole->i_getId())
    310310                    break;
     311
    311312                /* now we can operate with redirects */
    312                 NATProtocol_T proto;
     313                NATProtocol_T proto = (NATProtocol_T)0;
    313314                pNREv->COMGETTER(Proto)(&proto);
    314315                BOOL fRemove;
    315316                pNREv->COMGETTER(Remove)(&fRemove);
    316                 Bstr hostIp, guestIp;
    317                 LONG hostPort, guestPort;
     317                Bstr hostIp;
    318318                pNREv->COMGETTER(HostIP)(hostIp.asOutParam());
     319                LONG hostPort = 0;
    319320                pNREv->COMGETTER(HostPort)(&hostPort);
     321                Bstr guestIp;
    320322                pNREv->COMGETTER(GuestIP)(guestIp.asOutParam());
     323                LONG guestPort = 0;
    321324                pNREv->COMGETTER(GuestPort)(&guestPort);
    322325                ULONG ulSlot;
     
    325328                if (FAILED(rc))
    326329                    break;
    327                 mConsole->i_onNATRedirectRuleChange(ulSlot, fRemove, proto, hostIp.raw(), hostPort, guestIp.raw(), guestPort);
     330                mConsole->i_onNATRedirectRuleChanged(ulSlot, fRemove, proto, hostIp.raw(), hostPort, guestIp.raw(), guestPort);
    328331                break;
    329332            }
     
    40784081 * @note Locks this object for writing.
    40794082 */
    4080 HRESULT Console::i_onNATRedirectRuleChange(ULONG ulInstance, BOOL aNatRuleRemove,
    4081                                            NATProtocol_T aProto, IN_BSTR aHostIP,
    4082                                            LONG aHostPort, IN_BSTR aGuestIP,
    4083                                            LONG aGuestPort)
     4083HRESULT Console::i_onNATRedirectRuleChanged(ULONG ulInstance, BOOL aNatRuleRemove, NATProtocol_T aProto, IN_BSTR aHostIP,
     4084                                            LONG aHostPort, IN_BSTR aGuestIP, LONG aGuestPort)
    40844085{
    40854086    LogFlowThisFunc(("\n"));
  • trunk/src/VBox/Main/src-client/GuestImpl.cpp

    r85300 r85309  
    10731073 * @param   cbDetails           Size (in bytes) of state details. Pass 0 if not used.
    10741074 */
    1075 void Guest::i_onUserStateChange(Bstr aUser, Bstr aDomain, VBoxGuestUserState enmState,
    1076                                 const uint8_t *pbDetails, uint32_t cbDetails)
     1075void Guest::i_onUserStateChanged(const Utf8Str &aUser, const Utf8Str &aDomain, VBoxGuestUserState enmState,
     1076                                 const uint8_t *pbDetails, uint32_t cbDetails)
    10771077{
    10781078    RT_NOREF(pbDetails, cbDetails);
     
    10821082    AssertComRCReturnVoid(autoCaller.rc());
    10831083
    1084     Bstr strDetails; /** @todo Implement state details here. */
    1085 
    1086     ::FireGuestUserStateChangedEvent(mEventSource, aUser.raw(), aDomain.raw(), (GuestUserState_T)enmState, strDetails.raw());
     1084    Utf8Str strDetails; /** @todo Implement state details here. */
     1085
     1086    ::FireGuestUserStateChangedEvent(mEventSource, aUser, aDomain, (GuestUserState_T)enmState, strDetails);
    10871087    LogFlowFuncLeave();
    10881088}
  • trunk/src/VBox/Main/src-client/VMMDevInterface.cpp

    r84564 r85309  
    187187    AssertPtrReturnVoid(pGuest);
    188188
    189     pGuest->i_onUserStateChange(Bstr(pszUser), Bstr(pszDomain), (VBoxGuestUserState)uState,
    190                                 pabDetails, cbDetails);
     189    pGuest->i_onUserStateChanged(Utf8Str(pszUser), Utf8Str(pszDomain), (VBoxGuestUserState)uState, pabDetails, cbDetails);
    191190}
    192191
  • trunk/src/VBox/Main/src-server/MachineImpl.cpp

    r85306 r85309  
    1385313853 *  @note Locks this object for reading.
    1385413854 */
    13855 HRESULT SessionMachine::i_onNATRedirectRuleChange(ULONG ulSlot, BOOL aNatRuleRemove, IN_BSTR aRuleName,
    13856                                                   NATProtocol_T aProto, IN_BSTR aHostIp, LONG aHostPort,
    13857                                                   IN_BSTR aGuestIp, LONG aGuestPort)
     13855HRESULT SessionMachine::i_onNATRedirectRuleChanged(ULONG ulSlot, BOOL aNatRuleRemove, const Utf8Str &aRuleName,
     13856                                                   NATProtocol_T aProto, const Utf8Str &aHostIp, LONG aHostPort,
     13857                                                   const Utf8Str &aGuestIp, LONG aGuestPort)
    1385813858{
    1385913859    LogFlowThisFunc(("\n"));
  • trunk/src/VBox/Main/src-server/NATEngineImpl.cpp

    r82968 r85309  
    326326
    327327    alock.release();
    328     mParent->i_onNATRedirectRuleChange(ulSlot, FALSE, Bstr(name).raw(), aProto, Bstr(r.strHostIP).raw(),
    329                                        r.u16HostPort, Bstr(r.strGuestIP).raw(), r.u16GuestPort);
     328    mParent->i_onNATRedirectRuleChanged(ulSlot, FALSE, name, aProto, r.strHostIP, r.u16HostPort, r.strGuestIP, r.u16GuestPort);
    330329    return S_OK;
    331330}
     
    350349    mParent->i_setModified(Machine::IsModified_NetworkAdapters);
    351350    alock.release();
    352     mParent->i_onNATRedirectRuleChange(ulSlot, TRUE, Bstr(aName).raw(), r.proto, Bstr(r.strHostIP).raw(),
    353                                        r.u16HostPort, Bstr(r.strGuestIP).raw(), r.u16GuestPort);
     351    mParent->i_onNATRedirectRuleChanged(ulSlot, TRUE, aName, r.proto, r.strHostIP, r.u16HostPort, r.strGuestIP, r.u16GuestPort);
    354352    return S_OK;
    355353}
  • trunk/src/VBox/Main/src-server/VirtualBoxImpl.cpp

    r85307 r85309  
    37233723 *  @note Doesn't lock any object.
    37243724 */
    3725 void VirtualBox::i_onNatRedirectChanged(const Guid &aMachineId, ULONG ulSlot, bool fRemove, IN_BSTR aName,
    3726                                         NATProtocol_T aProto, IN_BSTR aHostIp, uint16_t aHostPort,
    3727                                         IN_BSTR aGuestIp, uint16_t aGuestPort)
    3728 {
    3729     ::FireNATRedirectEvent(m->pEventSource, aMachineId.toUtf16().raw(), ulSlot, fRemove, aName, aProto, aHostIp,
     3725void VirtualBox::i_onNatRedirectChanged(const Guid &aMachineId, ULONG ulSlot, bool fRemove, const Utf8Str &aName,
     3726                                        NATProtocol_T aProto, const Utf8Str &aHostIp, uint16_t aHostPort,
     3727                                        const Utf8Str &aGuestIp, uint16_t aGuestPort)
     3728{
     3729    ::FireNATRedirectEvent(m->pEventSource, aMachineId.toString(), ulSlot, fRemove, aName, aProto, aHostIp,
    37303730                           aHostPort, aGuestIp, aGuestPort);
    37313731}
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette