• 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
26struct crypt_device;
27
28// Keep readDiskDeviceSubtypeFromString() in tdehardwaredevices.cpp in sync with this enum
29namespace TDEDiskDeviceType {
30#if __cplusplus >= 201103L
31enum TDEDiskDeviceType : unsigned long long {
32#else
33enum TDEDiskDeviceType {
34#endif
35 Null = 0x0000000000000000ULL,
36 MediaDevice = 0x0000000000000001ULL,
37 Floppy = 0x0000000000000002ULL,
38 CDROM = 0x0000000000000004ULL,
39 CDR = 0x0000000000000008ULL,
40 CDRW = 0x0000000000000010ULL,
41 CDMO = 0x0000000000000020ULL,
42 CDMRRW = 0x0000000000000040ULL,
43 CDMRRWW = 0x0000000000000080ULL,
44 DVDROM = 0x0000000000000100ULL,
45 DVDRAM = 0x0000000000000200ULL,
46 DVDR = 0x0000000000000400ULL,
47 DVDRW = 0x0000000000000800ULL,
48 DVDRDL = 0x0000000000001000ULL,
49 DVDRWDL = 0x0000000000002000ULL,
50 DVDPLUSR = 0x0000000000004000ULL,
51 DVDPLUSRW = 0x0000000000008000ULL,
52 DVDPLUSRDL = 0x0000000000010000ULL,
53 DVDPLUSRWDL = 0x0000000000020000ULL,
54 BDROM = 0x0000000000040000ULL,
55 BDR = 0x0000000000080000ULL,
56 BDRW = 0x0000000000100000ULL,
57 HDDVDROM = 0x0000000000200000ULL,
58 HDDVDR = 0x0000000000400000ULL,
59 HDDVDRW = 0x0000000000800000ULL,
60 Zip = 0x0000000001000000ULL,
61 Jaz = 0x0000000002000000ULL,
62 Camera = 0x0000000004000000ULL,
63 LUKS = 0x0000000008000000ULL,
64 OtherCrypted = 0x0000000010000000ULL,
65 CDAudio = 0x0000000020000000ULL,
66 CDVideo = 0x0000000040000000ULL,
67 DVDVideo = 0x0000000080000000ULL,
68 BDVideo = 0x0000000100000000ULL,
69 Flash = 0x0000000200000000ULL,
70 USB = 0x0000000400000000ULL,
71 Tape = 0x0000000800000000ULL,
72 HDD = 0x0000001000000000ULL,
73 Optical = 0x0000002000000000ULL,
74 RAM = 0x0000004000000000ULL,
75 Loop = 0x0000008000000000ULL,
76 CompactFlash = 0x0000010000000000ULL,
77 MemoryStick = 0x0000020000000000ULL,
78 SmartMedia = 0x0000040000000000ULL,
79 SDMMC = 0x0000080000000000ULL,
80 UnlockedCrypt = 0x0000100000000000ULL,
81 Other = 0x8000000000000000ULL
82};
83
84inline TDEDiskDeviceType operator|(TDEDiskDeviceType a, TDEDiskDeviceType b)
85{
86 return static_cast<TDEDiskDeviceType>(static_cast<unsigned long long>(a) | static_cast<unsigned long long>(b));
87}
88
89inline TDEDiskDeviceType operator&(TDEDiskDeviceType a, TDEDiskDeviceType b)
90{
91 return static_cast<TDEDiskDeviceType>(static_cast<unsigned long long>(a) & static_cast<unsigned long long>(b));
92}
93
94inline TDEDiskDeviceType operator~(TDEDiskDeviceType a)
95{
96 return static_cast<TDEDiskDeviceType>(~static_cast<unsigned long long>(a));
97}
98};
99
100namespace TDEDiskDeviceStatus {
101enum TDEDiskDeviceStatus {
102 Null = 0x00000000,
103 Mountable = 0x00000001,
104 Removable = 0x00000002,
105 Inserted = 0x00000004,
106 Blank = 0x00000008,
107 UsedByDevice = 0x00000010,
108 UsesDevice = 0x00000020,
109 ContainsFilesystem = 0x00000040,
110 Hotpluggable = 0x00000080,
111 Hidden = 0x00000100,
112 Other = 0x80000000
113};
114
115inline TDEDiskDeviceStatus operator|(TDEDiskDeviceStatus a, TDEDiskDeviceStatus b)
116{
117 return static_cast<TDEDiskDeviceStatus>(static_cast<int>(a) | static_cast<int>(b));
118}
119
120inline TDEDiskDeviceStatus operator&(TDEDiskDeviceStatus a, TDEDiskDeviceStatus b)
121{
122 return static_cast<TDEDiskDeviceStatus>(static_cast<int>(a) & static_cast<int>(b));
123}
124
125inline TDEDiskDeviceStatus operator~(TDEDiskDeviceStatus a)
126{
127 return static_cast<TDEDiskDeviceStatus>(~static_cast<int>(a));
128}
129};
130
131namespace TDELUKSKeySlotStatus {
132enum TDELUKSKeySlotStatus {
133 Invalid = 0x00000000,
134 Inactive = 0x00000001,
135 Active = 0x00000002,
136 Last = 0x00000004,
137 Other = 0x80000000
138};
139
140inline TDELUKSKeySlotStatus operator|(TDELUKSKeySlotStatus a, TDELUKSKeySlotStatus b)
141{
142 return static_cast<TDELUKSKeySlotStatus>(static_cast<int>(a) | static_cast<int>(b));
143}
144
145inline TDELUKSKeySlotStatus operator&(TDELUKSKeySlotStatus a, TDELUKSKeySlotStatus b)
146{
147 return static_cast<TDELUKSKeySlotStatus>(static_cast<int>(a) & static_cast<int>(b));
148}
149
150inline TDELUKSKeySlotStatus operator~(TDELUKSKeySlotStatus a)
151{
152 return static_cast<TDELUKSKeySlotStatus>(~static_cast<int>(a));
153}
154};
155
156typedef TQValueList<TDELUKSKeySlotStatus::TDELUKSKeySlotStatus> TDELUKSKeySlotStatusList;
157
158namespace TDELUKSResult {
159enum TDELUKSResult {
160 Invalid = 0x00000000,
161 Success = 0x00000001,
162 LUKSNotSupported = 0x00000002,
163 LUKSNotFound = 0x00000003,
164 InvalidKeyslot = 0x00000004,
165 KeyslotOpFailed = 0x00000005,
166 Other = 0x80000000
167};
168};
169
170typedef TQMap<TQString, TQString> TDEStorageMountOptions;
171
172class TDECORE_EXPORT TDEStorageDevice : public TDEGenericDevice
173{
174 public:
179 TDEStorageDevice(TDEGenericDeviceType::TDEGenericDeviceType dt, TQString dn=TQString::null);
180
184 ~TDEStorageDevice();
185
189 TQString diskLabel();
190
194 TQString diskUUID();
195
199 TQString mappedName();
200
204 TDEDiskDeviceType::TDEDiskDeviceType diskType();
205
209 TDEDiskDeviceStatus::TDEDiskDeviceStatus diskStatus();
210
214 bool mediaInserted();
215
219 TQString fileSystemName();
220
224 TQString fileSystemUsage();
225
229 TQStringList holdingDevices();
230
234 TQStringList slaveDevices();
235
244 TQStringVariantMap mountDevice(TQString mediaName = TQString::null,
245 TDEStorageMountOptions mountOptions = TDEStorageMountOptions());
246
252 TQStringVariantMap unmountDevice();
253
261 TQStringVariantMap unlockDevice(const TQString &passphrase);
262
268 TQStringVariantMap lockDevice();
269
273 TQString mountPath();
274
278 unsigned long long deviceSize();
279
283 TQString deviceFriendlySize();
284
292 TQPixmap icon(TDEIcon::StdSizes size);
293
299 TQString friendlyName();
300
306 TQString detailedFriendlyName();
307
313 TQString friendlyDeviceType();
314
318 bool isDiskOfType(TDEDiskDeviceType::TDEDiskDeviceType tf);
319
323 bool checkDiskStatus(TDEDiskDeviceStatus::TDEDiskDeviceStatus sf);
324
331 bool lockDriveMedia(bool lock);
332
338 bool ejectDriveMedia();
339
345 TQStringVariantMap ejectDrive();
346
353 void cryptSetOperationsUnlockPassword(TQByteArray password);
354
359 void cryptClearOperationsUnlockPassword();
360
366 bool cryptOperationsUnlockPasswordSet();
367
378 TDELUKSResult::TDELUKSResult cryptCheckKey(unsigned int keyslot);
379
391 TDELUKSResult::TDELUKSResult cryptAddKey(unsigned int keyslot, TQByteArray password);
392
401 TDELUKSResult::TDELUKSResult cryptDelKey(unsigned int keyslot);
402
406 unsigned int cryptKeySlotCount();
407
411 TDELUKSKeySlotStatusList cryptKeySlotStatus();
412
417 TQString cryptKeySlotFriendlyName(TDELUKSKeySlotStatus::TDELUKSKeySlotStatus status);
418
419 protected:
426 void internalSetDeviceNode(TQString dn);
427
432 void internalSetDiskLabel(TQString dn);
433
438 void internalSetDiskUUID(TQString id);
439
444 void internalSetDiskType(TDEDiskDeviceType::TDEDiskDeviceType tf);
445
450 void internalSetDiskStatus(TDEDiskDeviceStatus::TDEDiskDeviceStatus st);
451
456 void internalSetMediaInserted(bool inserted);
457
462 void internalSetFileSystemName(TQString fn);
463
468 void internalSetFileSystemUsage(TQString fu);
469
474 void internalSetHoldingDevices(TQStringList hd);
475
480 void internalSetSlaveDevices(TQStringList sd);
481
485 void internalInitializeLUKSIfNeeded();
486
490 void internalGetLUKSKeySlotStatus();
491
495 void internalUpdateMappedName();
496
500 void internalUpdateMountPath();
501
502 private:
503 TQString m_mappedName; // Alternative name for a mapped device
504 TDEDiskDeviceType::TDEDiskDeviceType m_diskType;
505 TDEDiskDeviceStatus::TDEDiskDeviceStatus m_diskStatus;
506 TQString m_diskName;
507 TQString m_diskUUID;
508 TQString m_fileSystemName;
509 TQString m_fileSystemUsage;
510 bool m_mediaInserted;
511 TQString m_mountPath;
512 TQStringList m_holdingDevices;
513 TQStringList m_slaveDevices;
514 struct crypt_device* m_cryptDevice;
515 TQByteArray m_cryptDevicePassword;
516 TQString m_cryptDeviceType;
517 unsigned int m_cryptKeySlotCount;
518 TDELUKSKeySlotStatusList m_cryptKeyslotStatus;
519
520 friend class TDEHardwareDevices;
521};
522
523#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.