VirtualBox

source: vbox/trunk/src/VBox/Main/include/ClientTokenHolder.h@ 94173

Last change on this file since 94173 was 93115, checked in by vboxsync, 3 years ago

scm --update-copyright-year

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.6 KB
Line 
1/* $Id: ClientTokenHolder.h 93115 2022-01-01 11:31:46Z vboxsync $ */
2
3/** @file
4 *
5 * VirtualBox API client session token holder (in the client process)
6 */
7
8/*
9 * Copyright (C) 2013-2022 Oracle Corporation
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
20#ifndef MAIN_INCLUDED_ClientTokenHolder_h
21#define MAIN_INCLUDED_ClientTokenHolder_h
22#ifndef RT_WITHOUT_PRAGMA_ONCE
23# pragma once
24#endif
25
26#include "SessionImpl.h"
27
28#if defined(RT_OS_WINDOWS)
29# define CTHSEMARG NULL
30# define CTHSEMTYPE HANDLE
31/* this second semaphore is only used on Windows */
32# define CTHTHREADSEMARG NULL
33# define CTHTHREADSEMTYPE HANDLE
34#elif defined(RT_OS_OS2)
35# define CTHSEMARG NIL_RTSEMEVENT
36# define CTHSEMTYPE RTSEMEVENT
37#elif defined(VBOX_WITH_SYS_V_IPC_SESSION_WATCHER)
38# define CTHSEMARG -1
39# define CTHSEMTYPE int
40#elif defined(VBOX_WITH_GENERIC_SESSION_WATCHER)
41/* the token object based implementation needs no semaphores */
42#else
43# error "Port me!"
44#endif
45
46
47/**
48 * Class which holds a client token.
49 */
50class Session::ClientTokenHolder
51{
52public:
53#ifndef VBOX_WITH_GENERIC_SESSION_WATCHER
54 /**
55 * Constructor which creates a usable instance
56 *
57 * @param strTokenId String with identifier of the token
58 */
59 ClientTokenHolder(const Utf8Str &strTokenId);
60#else /* VBOX_WITH_GENERIC_SESSION_WATCHER */
61 /**
62 * Constructor which creates a usable instance
63 *
64 * @param aToken Reference to token object
65 */
66 ClientTokenHolder(IToken *aToken);
67#endif /* VBOX_WITH_GENERIC_SESSION_WATCHER */
68
69 /**
70 * Default destructor. Cleans everything up.
71 */
72 ~ClientTokenHolder();
73
74 /**
75 * Check if object contains a usable token.
76 */
77 bool isReady();
78
79private:
80 /**
81 * Default constructor. Don't use, will not create a sensible instance.
82 */
83 ClientTokenHolder();
84
85#ifndef VBOX_WITH_GENERIC_SESSION_WATCHER
86 Utf8Str mClientTokenId;
87#else /* VBOX_WITH_GENERIC_SESSION_WATCHER */
88 ComPtr<IToken> mToken;
89#endif /* VBOX_WITH_GENERIC_SESSION_WATCHER */
90#ifdef CTHSEMTYPE
91 CTHSEMTYPE mSem;
92#endif
93#if defined(RT_OS_WINDOWS) || defined(RT_OS_OS2)
94 RTTHREAD mThread;
95#endif
96#ifdef RT_OS_WINDOWS
97 CTHTHREADSEMTYPE mThreadSem;
98#endif
99};
100
101#endif /* !MAIN_INCLUDED_ClientTokenHolder_h */
102/* vi: set tabstop=4 shiftwidth=4 expandtab: */
Note: See TracBrowser for help on using the repository browser.

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