• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdecore
 

tdecore

  • tdecore
  • tdehw
tdestoragedevice.h
1/* This file is part of the TDE libraries
2 Copyright (C) 2012 Timothy Pearson <kb9vqf@pearsoncomputing.net>
3 (C) 2013 Golubev Alexander <fatzer2@gmail.com>
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License version 2 as published by the Free Software Foundation.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
18*/
19
20#ifndef _TDESTORAGEDEVICE_H
21#define _TDESTORAGEDEVICE_H
22
23#include "tdegenericdevice.h"
24#include "tqvariant.h"
25#include "tdemacros.h"
26
27struct crypt_device;
28
29// Keep readDiskDeviceSubtypeFromString() in tdehardwaredevices.cpp in sync with this enum
30namespace TDEDiskDeviceType {
31enum TDEDiskDeviceType : unsigned long long {
32 Null = 0x0000000000000000ULL,
33 MediaDevice = 0x0000000000000001ULL,
34 Floppy = 0x0000000000000002ULL,
35 CDROM = 0x0000000000000004ULL,
36 CDR = 0x0000000000000008ULL,
37 CDRW = 0x0000000000000010ULL,
38 CDMO = 0x0000000000000020ULL,
39 CDMRRW = 0x0000000000000040ULL,
40 CDMRRWW = 0x0000000000000080ULL,
41 DVDROM = 0x0000000000000100ULL,
42 DVDRAM = 0x0000000000000200ULL,
43 DVDR = 0x0000000000000400ULL,
44 DVDRW = 0x0000000000000800ULL,
45 DVDRDL = 0x0000000000001000ULL,
46 DVDRWDL = 0x0000000000002000ULL,
47 DVDPLUSR = 0x0000000000004000ULL,
48 DVDPLUSRW = 0x0000000000008000ULL,
49 DVDPLUSRDL = 0x0000000000010000ULL,
50 DVDPLUSRWDL = 0x0000000000020000ULL,
51 BDROM = 0x0000000000040000ULL,
52 BDR = 0x0000000000080000ULL,
53 BDRW = 0x0000000000100000ULL,
54 HDDVDROM = 0x0000000000200000ULL,
55 HDDVDR = 0x0000000000400000ULL,
56 HDDVDRW = 0x0000000000800000ULL,
57 Zip = 0x0000000001000000ULL,
58 Jaz = 0x0000000002000000ULL,
59 Camera = 0x0000000004000000ULL,
60 LUKS = 0x0000000008000000ULL,
61 OtherCrypted = 0x0000000010000000ULL,
62 CDAudio = 0x0000000020000000ULL,
63 CDVideo = 0x0000000040000000ULL,
64 DVDVideo = 0x0000000080000000ULL,
65 BDVideo = 0x0000000100000000ULL,
66 Flash = 0x0000000200000000ULL,
67 USB = 0x0000000400000000ULL,
68 Tape = 0x0000000800000000ULL,
69 HDD = 0x0000001000000000ULL,
70 Optical = 0x0000002000000000ULL,
71 RAM = 0x0000004000000000ULL,
72 Loop = 0x0000008000000000ULL,
73 CompactFlash = 0x0000010000000000ULL,
74 MemoryStick = 0x0000020000000000ULL,
75 SmartMedia = 0x0000040000000000ULL,
76 SDMMC = 0x0000080000000000ULL,
77 UnlockedCrypt = 0x0000100000000000ULL,
78 Other = 0x8000000000000000ULL
79};
80
81inline TDEDiskDeviceType operator|(TDEDiskDeviceType a, TDEDiskDeviceType b)
82{
83 return static_cast<TDEDiskDeviceType>(static_cast<unsigned long long>(a) | static_cast<unsigned long long>(b));
84}
85
86inline TDEDiskDeviceType operator&(TDEDiskDeviceType a, TDEDiskDeviceType b)
87{
88 return static_cast<TDEDiskDeviceType>(static_cast<unsigned long long>(a) & static_cast<unsigned long long>(b));
89}
90
91inline TDEDiskDeviceType operator~(TDEDiskDeviceType a)
92{
93 return static_cast<TDEDiskDeviceType>(~static_cast<unsigned long long>(a));
94}
95};
96
97namespace TDEDiskDeviceStatus {
98enum TDEDiskDeviceStatus {
99 Null = 0x00000000,
100 Mountable = 0x00000001,
101 Removable = 0x00000002,
102 Inserted = 0x00000004,
103 Blank = 0x00000008,
104 UsedByDevice = 0x00000010,
105 UsesDevice = 0x00000020,
106 ContainsFilesystem = 0x00000040,
107 // Do not use 0x00000080, it was `Hotpluggable` up to the R14.1.x series
108 Hidden = 0x00000100,
109 Other = 0x80000000
110};
111
112inline TDEDiskDeviceStatus operator|(TDEDiskDeviceStatus a, TDEDiskDeviceStatus b)
113{
114 return static_cast<TDEDiskDeviceStatus>(static_cast<int>(a) | static_cast<int>(b));
115}
116
117inline TDEDiskDeviceStatus operator&(TDEDiskDeviceStatus a, TDEDiskDeviceStatus b)
118{
119 return static_cast<TDEDiskDeviceStatus>(static_cast<int>(a) & static_cast<int>(b));
120}
121
122inline TDEDiskDeviceStatus operator~(TDEDiskDeviceStatus a)
123{
124 return static_cast<TDEDiskDeviceStatus>(~static_cast<int>(a));
125}
126};
127
128namespace TDELUKSKeySlotStatus {
129enum TDELUKSKeySlotStatus {
130 Invalid = 0x00000000,
131 Inactive = 0x00000001,
132 Active = 0x00000002,
133 Last = 0x00000004,
134 Other = 0x80000000
135};
136
137inline TDELUKSKeySlotStatus operator|(TDELUKSKeySlotStatus a, TDELUKSKeySlotStatus b)
138{
139 return static_cast<TDELUKSKeySlotStatus>(static_cast<int>(a) | static_cast<int>(b));
140}
141
142inline TDELUKSKeySlotStatus operator&(TDELUKSKeySlotStatus a, TDELUKSKeySlotStatus b)
143{
144 return static_cast<TDELUKSKeySlotStatus>(static_cast<int>(a) & static_cast<int>(b));
145}
146
147inline TDELUKSKeySlotStatus operator~(TDELUKSKeySlotStatus a)
148{
149 return static_cast<TDELUKSKeySlotStatus>(~static_cast<int>(a));
150}
151};
152
153typedef TQValueList<TDELUKSKeySlotStatus::TDELUKSKeySlotStatus> TDELUKSKeySlotStatusList;
154
155namespace TDELUKSResult {
156enum TDELUKSResult {
157 Invalid = 0x00000000,
158 Success = 0x00000001,
159 LUKSNotSupported = 0x00000002,
160 LUKSNotFound = 0x00000003,
161 InvalidKeyslot = 0x00000004,
162 KeyslotOpFailed = 0x00000005,
163 Other = 0x80000000
164};
165};
166
167typedef TQMap<TQString, TQString> TDEStorageMountOptions;
168
169class TDECORE_EXPORT TDEStorageDevice : public TDEGenericDevice
170{
171 public:
176 TDEStorageDevice(TDEGenericDeviceType::TDEGenericDeviceType dt, TQString dn=TQString::null);
177
181 ~TDEStorageDevice();
182
186 TQString diskLabel();
187
191 TQString diskUUID();
192
196 TQString mappedName();
197
201 TDEDiskDeviceType::TDEDiskDeviceType diskType();
202
206 TDEDiskDeviceStatus::TDEDiskDeviceStatus diskStatus();
207
211 bool mediaInserted();
212
216 TQString fileSystemName();
217
221 TQString fileSystemUsage();
222
226 TQStringList holdingDevices();
227
231 TQStringList slaveDevices();
232
241 TQStringVariantMap mountDevice(TQString mediaName = TQString::null,
242 TDEStorageMountOptions mountOptions = TDEStorageMountOptions());
243
249 TQStringVariantMap unmountDevice();
250
258 TQStringVariantMap unlockDevice(const TQString &passphrase);
259
265 TQStringVariantMap lockDevice();
266
270 TQString mountPath();
271
275 unsigned long long deviceSize();
276
280 TQString deviceFriendlySize();
281
289 TQPixmap icon(TDEIcon::StdSizes size);
290
296 TQString friendlyName();
297
303 TQString detailedFriendlyName();
304
310 TQString friendlyDeviceType();
311
315 bool isDiskOfType(TDEDiskDeviceType::TDEDiskDeviceType tf);
316
320 bool checkDiskStatus(TDEDiskDeviceStatus::TDEDiskDeviceStatus sf);
321
328 bool lockDriveMedia(bool lock);
329
335 bool ejectDriveMedia();
336
342 TQStringVariantMap ejectDrive();
343
350 void cryptSetOperationsUnlockPassword(TQByteArray password);
351
356 void cryptClearOperationsUnlockPassword();
357
363 bool cryptOperationsUnlockPasswordSet();
364
375 TDELUKSResult::TDELUKSResult cryptCheckKey(unsigned int keyslot);
376
388 TDELUKSResult::TDELUKSResult cryptAddKey(unsigned int keyslot, TQByteArray password);
389
398 TDELUKSResult::TDELUKSResult cryptDelKey(unsigned int keyslot);
399
403 unsigned int cryptKeySlotCount();
404
408 TDELUKSKeySlotStatusList cryptKeySlotStatus();
409
414 TQString cryptKeySlotFriendlyName(TDELUKSKeySlotStatus::TDELUKSKeySlotStatus status);
415
416 protected:
423 void internalSetDeviceNode(TQString dn);
424
429 void internalSetDiskLabel(TQString dn);
430
435 void internalSetDiskUUID(TQString id);
436
441 void internalSetDiskType(TDEDiskDeviceType::TDEDiskDeviceType tf);
442
447 void internalSetDiskStatus(TDEDiskDeviceStatus::TDEDiskDeviceStatus st);
448
453 void internalSetMediaInserted(bool inserted);
454
459 void internalSetFileSystemName(TQString fn);
460
465 void internalSetFileSystemUsage(TQString fu);
466
471 void internalSetHoldingDevices(TQStringList hd);
472
477 void internalSetSlaveDevices(TQStringList sd);
478
482 void internalInitializeLUKSIfNeeded();
483
487 void internalGetLUKSKeySlotStatus();
488
492 void internalUpdateMappedName();
493
497 void internalUpdateMountPath();
498
499 private:
500 TQString m_mappedName; // Alternative name for a mapped device
501 TDEDiskDeviceType::TDEDiskDeviceType m_diskType;
502 TDEDiskDeviceStatus::TDEDiskDeviceStatus m_diskStatus;
503 TQString m_diskName;
504 TQString m_diskUUID;
505 TQString m_fileSystemName;
506 TQString m_fileSystemUsage;
507 bool m_mediaInserted;
508 TQString m_mountPath;
509 TQStringList m_holdingDevices;
510 TQStringList m_slaveDevices;
511 struct crypt_device* m_cryptDevice;
512 TQByteArray m_cryptDevicePassword;
513 TQString m_cryptDeviceType;
514 unsigned int m_cryptKeySlotCount;
515 TDELUKSKeySlotStatusList m_cryptKeyslotStatus;
516
517 friend class TDEHardwareDevices;
518};
519
520#endif // _TDESTORAGEDEVICE_H
TDEIcon::StdSizes
StdSizes
These are the standard sizes for icons.
Definition: kicontheme.h:112

tdecore

Skip menu "tdecore"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

tdecore

Skip menu "tdecore"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdecore by doxygen 1.9.4
This website is maintained by Timothy Pearson.