1 |
|
---|
2 | /* $Id: GuestFileImpl.h 43162 2012-09-04 13:53:59Z vboxsync $ */
|
---|
3 | /** @file
|
---|
4 | * VirtualBox Main - XXX.
|
---|
5 | */
|
---|
6 |
|
---|
7 | /*
|
---|
8 | * Copyright (C) 2012 Oracle Corporation
|
---|
9 | *
|
---|
10 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
11 | * available from http://www.virtualbox.org. This file is free software;
|
---|
12 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
13 | * General Public License (GPL) as published by the Free Software
|
---|
14 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
15 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
16 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
17 | */
|
---|
18 |
|
---|
19 | #ifndef ____H_GUESTFILEIMPL
|
---|
20 | #define ____H_GUESTFILEIMPL
|
---|
21 |
|
---|
22 | #include "VirtualBoxBase.h"
|
---|
23 |
|
---|
24 | #include "GuestFsObjInfoImpl.h"
|
---|
25 |
|
---|
26 | class GuestSession;
|
---|
27 | class GuestProcess;
|
---|
28 |
|
---|
29 | /**
|
---|
30 | * TODO
|
---|
31 | */
|
---|
32 | class ATL_NO_VTABLE GuestFile :
|
---|
33 | public VirtualBoxBase,
|
---|
34 | VBOX_SCRIPTABLE_IMPL(IGuestFile)
|
---|
35 | {
|
---|
36 | public:
|
---|
37 | /** @name COM and internal init/term/mapping cruft.
|
---|
38 | * @{ */
|
---|
39 | VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(GuestFile, IGuestFile)
|
---|
40 | DECLARE_NOT_AGGREGATABLE(GuestFile)
|
---|
41 | DECLARE_PROTECT_FINAL_CONSTRUCT()
|
---|
42 | BEGIN_COM_MAP(GuestFile)
|
---|
43 | VBOX_DEFAULT_INTERFACE_ENTRIES(IGuestFile)
|
---|
44 | COM_INTERFACE_ENTRY(IFile)
|
---|
45 | END_COM_MAP()
|
---|
46 | DECLARE_EMPTY_CTOR_DTOR(GuestFile)
|
---|
47 |
|
---|
48 | int init(GuestSession *pSession, const Utf8Str &strPath, const Utf8Str &strOpenMode, const Utf8Str &strDisposition, uint32_t uCreationMode, int64_t iOffset, int *pGuestRc);
|
---|
49 | void uninit(void);
|
---|
50 | HRESULT FinalConstruct(void);
|
---|
51 | void FinalRelease(void);
|
---|
52 | /** @} */
|
---|
53 |
|
---|
54 | /** @name IFile interface.
|
---|
55 | * @{ */
|
---|
56 | STDMETHOD(COMGETTER(CreationMode))(ULONG *aCreationMode);
|
---|
57 | STDMETHOD(COMGETTER(Disposition))(ULONG *aDisposition);
|
---|
58 | STDMETHOD(COMGETTER(FileName))(BSTR *aFileName);
|
---|
59 | STDMETHOD(COMGETTER(InitialSize))(LONG64 *aInitialSize);
|
---|
60 | STDMETHOD(COMGETTER(Offset))(LONG64 *aOffset);
|
---|
61 | STDMETHOD(COMGETTER(OpenMode))(ULONG *aOpenMode);
|
---|
62 |
|
---|
63 | STDMETHOD(Close)(void);
|
---|
64 | STDMETHOD(QueryInfo)(IFsObjInfo **aInfo);
|
---|
65 | STDMETHOD(Read)(ULONG aToRead, ULONG aTimeoutMS, ComSafeArrayOut(BYTE, aData));
|
---|
66 | STDMETHOD(ReadAt)(LONG64 aOffset, ULONG aToRead, ULONG aTimeoutMS, ComSafeArrayOut(BYTE, aData));
|
---|
67 | STDMETHOD(Seek)(LONG64 aOffset, FileSeekType_T aType);
|
---|
68 | STDMETHOD(SetACL)(IN_BSTR aACL);
|
---|
69 | STDMETHOD(Write)(ComSafeArrayIn(BYTE, aData), ULONG aTimeoutMS, ULONG *aWritten);
|
---|
70 | STDMETHOD(WriteAt)(LONG64 aOffset, ComSafeArrayIn(BYTE, aData), ULONG aTimeoutMS, ULONG *aWritten);
|
---|
71 | /** @} */
|
---|
72 |
|
---|
73 | public:
|
---|
74 | /** @name Public internal methods.
|
---|
75 | * @{ */
|
---|
76 | static uint32_t getDispositionFromString(const Utf8Str &strDisposition);
|
---|
77 | static uint32_t getOpenModeFromString(const Utf8Str &strOpenMode);
|
---|
78 | /** @} */
|
---|
79 |
|
---|
80 | private:
|
---|
81 |
|
---|
82 | struct Data
|
---|
83 | {
|
---|
84 | /** The associate session this file belongs to. */
|
---|
85 | GuestSession *mSession;
|
---|
86 | uint32_t mCreationMode;
|
---|
87 | uint32_t mDisposition;
|
---|
88 | Utf8Str mFileName;
|
---|
89 | int64_t mInitialSize;
|
---|
90 | uint32_t mOpenMode;
|
---|
91 | int64_t mOffset;
|
---|
92 | } mData;
|
---|
93 | };
|
---|
94 |
|
---|
95 | #endif /* !____H_GUESTFILEIMPL */
|
---|
96 |
|
---|