VirtualBox

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

Last change on this file since 48297 was 47561, checked in by vboxsync, 11 years ago

Main/VirtualBox+Machine+Session: separate out the client death detection functionality into separate objects

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 1.9 KB
Line 
1/* $Id: ClientTokenHolder.h 47561 2013-08-06 15:18:17Z vboxsync $ */
2
3/** @file
4 *
5 * VirtualBox API client token holder (in the client process)
6 */
7
8/*
9 * Copyright (C) 2013 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 ____H_CLIENTTOKENHOLDER
21#define ____H_CLIENTTOKENHOLDER
22
23#include "SessionImpl.h"
24
25#if defined(RT_OS_WINDOWS)
26# define CTHSEMARG NULL
27# define CTHSEMTYPE HANDLE
28/* this second semaphore is only used on Windows */
29# define CTHTHREADSEMARG NULL
30# define CTHTHREADSEMTYPE HANDLE
31#elif defined(RT_OS_OS2)
32# define CTHSEMARG NIL_RTSEMEVENT
33# define CTHSEMTYPE RTSEMEVENT
34#elif defined(VBOX_WITH_SYS_V_IPC_SESSION_WATCHER)
35# define CTHSEMARG -1
36# define CTHSEMTYPE int
37#else
38# error "Port me!"
39#endif
40
41
42/**
43 * Class which holds a client token.
44 */
45class Session::ClientTokenHolder
46{
47public:
48 /**
49 * Constructor which creates a usable instance
50 *
51 * @param strTokenId String with identifier of the token
52 */
53 ClientTokenHolder(const Utf8Str &strTokenId);
54
55 /**
56 * Default destructor. Cleans everything up.
57 */
58 ~ClientTokenHolder();
59
60 /**
61 * Check if object contains a usable token.
62 */
63 bool isReady();
64
65private:
66 /**
67 * Default constructor. Don't use, will not create a sensible instance.
68 */
69 ClientTokenHolder();
70
71 Utf8Str mClientTokenId;
72 CTHSEMTYPE mSem;
73 RTTHREAD mThread;
74#ifdef RT_OS_WINDOWS
75 CTHTHREADSEMTYPE mThreadSem;
76#endif
77};
78
79#endif /* !____H_CLIENTTOKENHOLDER */
80/* 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