VirtualBox

source: vbox/trunk/src/VBox/Main/include/ClientToken.h@ 48328

Last change on this file since 48328 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: 2.2 KB
Line 
1/* $Id: ClientToken.h 47561 2013-08-06 15:18:17Z vboxsync $ */
2
3/** @file
4 *
5 * VirtualBox API client token abstraction
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_CLIENTTOKEN
21#define ____H_CLIENTTOKEN
22
23#include <VBox/com/ptr.h>
24#include <VBox/com/AutoLock.h>
25
26#include "MachineImpl.h"
27
28#if defined(RT_OS_WINDOWS)
29# define CTTOKENARG NULL
30# define CTTOKENTYPE HANDLE
31#elif defined(RT_OS_OS2)
32# define CTTOKENARG NULLHANDLE
33# define CTTOKENTYPE HMTX
34#elif defined(VBOX_WITH_SYS_V_IPC_SESSION_WATCHER)
35# define CTTOKENARG -1
36# define CTTOKENTYPE int
37#else
38# error "Port me!"
39#endif
40
41/**
42 * Class which represents a token which can be used to check for client
43 * crashes and similar purposes.
44 */
45class Machine::ClientToken
46{
47public:
48 /**
49 * Constructor which creates a usable instance
50 *
51 * @param pMachine Reference to Machine object
52 */
53 ClientToken(const ComObjPtr<Machine> &pMachine);
54
55 /**
56 * Default destructor. Cleans everything up.
57 */
58 ~ClientToken();
59
60 /**
61 * Check if object contains a usable token.
62 */
63 bool isReady();
64
65 /**
66 * Query token ID, which is a unique string value for this token. Do not
67 * assume any specific content/format, it is opaque information.
68 */
69 void getId(Utf8Str &strId);
70
71 /**
72 * Query token, which is platform dependent.
73 */
74 CTTOKENTYPE getToken();
75
76 /**
77 * Release token now. Returns information if the client has terminated.
78 */
79 bool release();
80
81private:
82 /**
83 * Default constructor. Don't use, will not create a sensible instance.
84 */
85 ClientToken();
86
87 Machine *mMachine;
88 CTTOKENTYPE mClientToken;
89 Utf8Str mClientTokenId;
90};
91
92#endif /* !____H_CLIENTTOKEN */
93/* 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