VirtualBox

Changeset 69775 in vbox for trunk/src/VBox/Main/include


Ignore:
Timestamp:
Nov 20, 2017 4:36:34 PM (7 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
119177
Message:

VBoxSDS/Plan/B: More complete code.

File:
1 edited

Legend:

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

    r69741 r69775  
    7272};
    7373
     74#ifdef VBOX_WITH_SDS_PLAN_B
     75/**
     76 * Per user data.
     77 */
     78class VBoxSDSPerUserData
     79{
     80public:
     81    /** The SID (secure identifier) for the user.  This is the key. */
     82    com::Utf8Str                 m_strUserSid;
     83    /** The user name (if we could get it). */
     84    com::Utf8Str                 m_strUsername;
     85    /** The VBoxSVC chosen to instantiate CLSID_VirtualBox.
     86     * This is NULL if not set. */
     87    ComPtr<IVBoxSVCRegistration> m_ptrTheChosenOne;
     88    /** Critical section protecting everything here. */
     89    RTCRITSECT                   m_Lock;
     90
     91
     92public:
     93    VBoxSDSPerUserData(com::Utf8Str const &a_rStrUserSid, com::Utf8Str const &a_rStrUsername)
     94        : m_strUserSid(a_rStrUserSid), m_strUsername(a_rStrUsername)
     95    {
     96        RTCritSectInit(&m_Lock);
     97    }
     98
     99    ~VBoxSDSPerUserData()
     100    {
     101        RTCritSectDelete(&m_Lock);
     102    }
     103
     104    void i_lock()
     105    {
     106        RTCritSectEnter(&m_Lock);
     107    }
     108
     109    void i_unlock()
     110    {
     111        RTCritSectLeave(&m_Lock);
     112    }
     113};
     114#endif
     115
     116
    74117class ATL_NO_VTABLE VirtualBoxSDS :
    75118    public VirtualBoxSDSWrap
     
    78121#endif
    79122{
     123#ifdef VBOX_WITH_SDS_PLAN_B
     124private:
     125    typedef std::map<com::Utf8Str, VBoxSDSPerUserData *> UserDataMap_T;
     126    /** Per user data map (key is SID string). */
     127    UserDataMap_T       m_UserDataMap;
     128    /** Lock protecting m_UserDataMap.*/
     129    RTCRITSECTRW        m_MapCritSect;
     130#endif
     131
    80132public:
    81133
     
    111163
    112164    /* SDS plan B interfaces: */
    113     HRESULT registerVBoxSVC(const ComPtr<IVBoxSVC> &aVBoxSVC, LONG aPid, ComPtr<IUnknown> &aExistingVirtualBox);
    114     HRESULT deregisterVBoxSVC(const ComPtr<IVBoxSVC> &aVBoxSVC, LONG aPid);
     165    HRESULT registerVBoxSVC(const ComPtr<IVBoxSVCRegistration> &aVBoxSVC, LONG aPid, ComPtr<IUnknown> &aExistingVirtualBox);
     166    HRESULT deregisterVBoxSVC(const ComPtr<IVBoxSVCRegistration> &aVBoxSVC, LONG aPid);
    115167
    116168    // Wrapped IVirtualBoxSDS methods
    117169
    118     // Inner methods
    119 
     170    // Private methods
     171
     172    /**
     173     * Gets the cliedt user SID of the
     174     */
     175    static bool i_getClientUserSID(com::Utf8Str *a_pStrSid, com::Utf8Str *a_pStrUsername);
     176
     177#ifdef VBOX_WITH_SDS_PLAN_B
     178    /**
     179     * Looks up the given user.
     180     *
     181     * @returns Pointer to the LOCKED per user data.  NULL if not found.
     182     * @param   a_rStrUserSid   The user SID.
     183     */
     184    VBoxSDSPerUserData *i_lookupPerUserData(com::Utf8Str const &a_rUserSid);
     185
     186    /**
     187     * Looks up the given user, creating it if not found
     188     *
     189     * @returns Pointer to the LOCKED per user data.  NULL on allocation error.
     190     * @param   a_rStrUserSid   The user SID.
     191     * @param   a_rStrUsername  The user name if available.
     192     */
     193    VBoxSDSPerUserData *i_lookupOrCreatePerUserData(com::Utf8Str const &a_rStrUserSid, com::Utf8Str const &a_rStrUsername);
     194
     195#else
    120196    /**
    121197    *  Gets the current user name of current thread
     
    131207
    132208    /**
    133     * Thread that periodically checks items in cache and cleans obsolete items
    134     */
     209     * Thread that periodically checks items in cache and cleans obsolete items
     210     */
    135211    static DWORD WINAPI CheckCacheThread(LPVOID);
    136212
     
    139215    static VirtualBoxCache m_cache;
    140216    friend VirtualBoxToken;
    141 
    142 #ifdef VBOX_WITH_SDS_PLAN_B
    143     // quick and dirty for checking the concept.
    144     ComPtr<IVBoxSVC> m_ptrVBoxSVC;
    145     ComPtr<IVBoxSVC> m_ptrOtherVBoxSVC;
    146217#endif
    147218};
Note: See TracChangeset for help on using the changeset viewer.

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