ACSMDownloader

ACSMDownloader Commit Details

Date:2021-04-23 18:02:40 (3 months 4 days ago)
Author:Grégory Soutadé
Commit:07c7427753dccde0cc00a56b2bc7f94a7d1d84fd
Parents: 27e3126701d9dd2871f56421388120af9e8e8e84
Message:Little cleanup

Changes:
Minclude/rmsdk_wrapper.h (11 diffs)

File differences

include/rmsdk_wrapper.h
1818
1919
2020
21
2221
2322
2423
......
2827
2928
3029
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
9630
9731
9832
......
11145
11246
11347
114
48
11549
11650
11751
......
12155
12256
12357
124
58
12559
126
60
12761
12862
12963
13064
13165
13266
133
134
135
136
137
138
139
67
68
69
70
71
72
73
14074
14175
14276
......
14781
14882
14983
150
151
152
84
85
86
15387
154
88
15589
15690
15791
15892
159
93
16094
16195
16296
163
97
16498
16599
166
167
100
168101
169
102
170103
171104
172105
173106
174107
175
108
176109
177110
178111
179
112
180113
181114
182115
183116
184117
185118
186
119
187120
188121
189122
......
193126
194127
195128
196
197
198
129
130
131
199132
200133
201134
202135
203136
204137
205
138
206139
207140
208141
......
254187
255188
256189
257
190
258191
259192
260
193
261194
262195
263
264
265196
266
267
197
198
268199
269200
270
271201
272202
273
274
275
276
277
278
279
280
281
282203
283204
284205
......
359280
360281
361282
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425283
426284
427285
......
447305
448306
449307
450
451
452
453
308
454309
455310
456311
......
466321
467322
468323
469
470324
325
471326
472327
473328
......
523378
524379
525380
526
527
528
529
530
531
532
533381
534382
535383
536
384
385
537386
538387
539388
540
541389
390
542391
543392
544393
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include <QEventLoop>
#include <QCoreApplication>
#include <QFile>
// parseXML -> MetroWisDOM
// namespace adept {
// class DRMProcessorImpl;
// class DRMProviderImpl {
// protected:
// virtual ~DRMProviderImpl() = 0;
// public:
// virtual dp::String getInterfaceID();
// virtual dp::String getOptionalInterface(char const*) = 0;
// virtual DRMProcessorImpl * createDRMProcessor( dpdrm::DRMProcessorClient * client, MockDevice * device );
// };
// class DRMProcessorImpl
// {
// protected:
// virtual ~DRMProcessorImpl() {}
// public:
// virtual dp::String getInterfaceID() = 0;
// virtual dp::String getOptionalInterface(char const*) = 0;
// virtual void release() = 0;
// virtual dp::list<dpdrm::Activation> getActivations() = 0;
// virtual void setUser(dp::String const&) = 0;
// virtual void setPartition(dpio::Partition*) = 0;
// virtual void reset() = 0;
// virtual unsigned int initWorkflows(unsigned int, dp::Data const&) = 0;
// virtual unsigned int initSignInWorkflowCommon(unsigned int) = 0;
// virtual unsigned int initSignInWorkflow(unsigned int, dp::String const&, dp::String const&, dp::Data const&) = 0;
// virtual unsigned int initLoanReturnWorkflow(dp::String const&) = 0;
// virtual unsigned int initUpdateLoansWorkflow(dp::String const&, dp::String const&) = 0;
// virtual unsigned int initJoinAccountsWorkflow(dp::String const&, dp::String const&, dp::String const&) = 0;
// virtual void startWorkflows(unsigned int) = 0;
// virtual void providePasshash(dp::Data const&) = 0;
// virtual void provideInput(dp::Data const&) = 0;
// virtual void provideConfirmation(dp::String const&, int) = 0;
// virtual void transferLoanTokensFrom(dpdev::Device*) = 0;
// virtual void transferCredentialsFrom(dpdev::Device*, dp::String const&, bool) = 0;
// virtual dp::list<dpdrm::FulfillmentItem> getFulfillmentItems() = 0;
// virtual dp::String getFulfillmentID() = 0;
// virtual bool isReturnable() = 0;
// virtual int addPasshash(dp::String const&, dp::Data const&) = 0;
// virtual int removePasshash(dp::String const&, dp::Data const&) = 0;
// virtual dp::Data calculatePasshash(dp::String const&, dp::String const&) = 0;
// virtual void getInterfaceVersion() = 0;
// virtual void getResourceStream(dp::String const&, unsigned int) = 0;
// virtual void canContinueProcessing(int) = 0;
// virtual void reportLoadingState(int) = 0;
// virtual void reportDocumentError(dp::String const&) = 0;
// virtual void reportErrorListChange() = 0;
// virtual void requestLicense(dp::String const&, dp::String const&, dp::Data const&) = 0;
// virtual void requestDocumentPassword() = 0;
// virtual void documentSerialized() = 0;
// virtual void reportStateError(uft::String const&) = 0;
// virtual void reportProcessError(uft::String const&) = 0;
// virtual void setURLString(uft::String const&) = 0;
// virtual void getURLString() = 0;
// virtual void changeURL(uft::String const&) = 0;
// void operatorAuthResp(uft::String const&, uft::Buffer const&);
// };
// };
// namespace rmsdk{
// adept::DRMProviderImpl* getProvider();
// };
class MockDRMProcessorClient: public dpdrm::DRMProcessorClient
{
public:
if (data.data())
LOG(INFO, "Workflows done " << data.data());
}
virtual void mockclientfn4(dp::Data& inputXHTML) {LOG_FUNC();}
virtual void mockclientfn4(dp::Data& xml) {LOG_FUNC();}
virtual void mockclientfn5(dp::String& code)
{
LOG_FUNC();
{
LOG(WARN, "Progress " << workflow << " " << title.utf8() << " " << progress << " %%");
}
virtual void workflowError(unsigned int workflow, dp::String& errorCode)
virtual void workflowError(unsigned int workflow, dp::String& error)
{
LOG(ERROR, "Workflow error " << workflow << " " << errorCode.utf8());
LOG(ERROR, "Workflow error " << workflow << " " << error.utf8());
}
};
class MockPartition : public dpio::Partition
{
public:
MockPartition(dpdev::Device * owningDevice, int index,
const dp::String& name, const dp::String& type,
const dp::String& rootFolderURL, const dp::String& docFolderURL,
const dp::String& tempFolderURL):
device(owningDevice), index(index), name(name), type(type),
rootFolderURL(rootFolderURL), docFolderURL(docFolderURL),
tempFolderURL(tempFolderURL)
MockPartition(dpdev::Device* device, int index,
dp::String name, dp::String type,
dp::String rootPath, dp::String docPath,
dp::String tempPath):
device(device), index(index), name(name), type(type),
rootPath(rootPath), docPath(docPath),
tempPath(tempPath)
{
}
virtual int getIndex() {LOG_FUNC(); return index;}
virtual dp::String getPartitionName() {LOG_FUNC(); return name;}
virtual dp::String getPartitionType() {LOG_FUNC(); return type;}
virtual dp::String getRootURL() {LOG_FUNC(); return rootFolderURL;}
virtual dp::String getDocumentFolderURL() {LOG_FUNC(); return docFolderURL;}
virtual dp::String getTemporaryFolderURL() {LOG_FUNC(); return tempFolderURL;}
virtual dp::String getRootURL() {LOG_FUNC(); return rootPath;}
virtual dp::String getDocumentFolderURL() {LOG_FUNC(); return docPath;}
virtual dp::String getTemporaryFolderURL() {LOG_FUNC(); return tempPath;}
virtual dpio::Stream * readFile( const dp::String& fileURL, dpio::StreamClient * client, unsigned int caps )
virtual dpio::Stream * readFile( const dp::String& path, dpio::StreamClient* client, unsigned int p2 )
{
LOG_FUNC();
return 0;
}
virtual void createUniqueFile( const dp::String& baseURL, const dp::String& suffix, dp::Callback * callback )
virtual void createUniqueFile( const dp::String& path, const dp::String& p2, dp::Callback* callback )
{
LOG_FUNC();
}
virtual void writeFile( const dp::String& fileURL, dpio::Stream * streamToWrite, dp::Callback * callback )
virtual void writeFile( const dp::String& path, dpio::Stream* streamData, dp::Callback* callback )
{
LOG_FUNC();
std::cout << fileURL.utf8() << std::endl;
QFile file(fileURL.utf8());
QFile file(path.utf8());
dp::Data data = streamToWrite->readSynchronousStream(streamToWrite);
dp::Data data = streamData->readSynchronousStream(streamData);
LOG(DEBUG, "Read from stream " << data.length() << " bytes");
bool ret = file.open(QIODevice::WriteOnly|QIODevice::Truncate);
if (!ret)
{
LOG(ERROR, "Unable to open file " << fileURL.utf8());
LOG(ERROR, "Unable to open file " << path.utf8());
return;
}
else
LOG(WARN, "Write file " << fileURL.utf8());
LOG(WARN, "Write file " << path.utf8());
file.write((const char*)data.data(), data.length());
file.close();
}
virtual void removeFile( const dp::String& fileURL, dp::Callback * callback )
virtual void removeFile( const dp::String& path, dp::Callback* callback )
{
LOG_FUNC();
}
int index;
dp::String name;
dp::String type;
dp::String rootFolderURL;
dp::String docFolderURL;
dp::String tempFolderURL;
dp::String rootPath;
dp::String docPath;
dp::String tempPath;
};
class MockProvider : public dpdev::DeviceProvider
{
public:
MockProvider(dpdev::Device * device):device(device) {}
MockProvider(dpdev::Device* device):device(device) {}
void getIdentifier() {LOG_FUNC();}
virtual int getIndex() {LOG_FUNC(); return 0;}
virtual dpdev::Device* getDevice( int index ){
}
void setProvider(dpdev::DeviceProvider* deviceProvider)
{this->deviceProvider=deviceProvider;}
{this->deviceProvider = deviceProvider;}
void setProcessorClient(dpdrm::DRMProcessorClient* processorClient)
{this->processorClient=processorClient;}
{this->processorClient = processorClient;}
virtual void * getOptionalInterface( const char * name ) {LOG_FUNC(); return 0;}
// virtual void mockdevfn0() {LOG_FUNC();};
// virtual void mockdevfn1() {LOG_FUNC();};
virtual void prepareDeviceKey() {LOG_FUNC();}
virtual dpdev::DeviceProvider* getProvider() {LOG_FUNC();return deviceProvider;}
virtual int getIndex() {LOG_FUNC();return 0;}
virtual dpdev::DeviceProvider* getProvider() {LOG_FUNC(); return deviceProvider;}
virtual int getIndex() {LOG_FUNC(); return 0;}
virtual dp::String getDeviceName();
virtual dp::Data getDeviceKey();
// virtual int reset(int p0) {LOG_FUNC(); return 0;}
virtual dp::String getDeviceType();
virtual dp::Data getFingerprint();
virtual dp::Data getPrivateDeviceKey(void) {
LOG_FUNC();
// devkey.bin
const unsigned char userid[] = {
0x50, 0xae, 0x74, 0xde, 0x45, 0xb0, 0x8e, 0xf1, 0xe8, 0x2a, 0x40, 0xe8,
0x87, 0xd8, 0xad, 0x29
};
return dp::Data(userid, sizeof(userid));
}
virtual dp::Data getActivationRecord();
virtual void setActivationRecord(const dp::Data& data);
virtual dpio::Partition* getPartition(int index);
return dp::String("0");
}
// class MockLibrary: public dplib::Library
// {
// virtual dpio::Partition * getPartition() {
// LOG_FUNC();
// return 0;
// }
// virtual bool isLoaded() {
// LOG_FUNC();
// return true;
// }
// virtual dp::ref<dplib::ContentRecord> createContentRecord( const dp::String& contentURL )
// {
// LOG_FUNC();
// return 0;
// }
// virtual dp::ref<dplib::ContentRecord> cloneContentRecord( const dp::ref<dplib::ContentRecord>& existingCR, const dp::String& newContentURL )
// {
// LOG_FUNC();
// return 0;
// }
// virtual dp::ref<dplib::ContentRecord> getContentRecordByURL( const dp::String& url )
// {
// LOG_FUNC();
// return 0;
// }
// virtual void removeContentRecord( const dp::ref<dplib::ContentRecord>& contentRecord )
// {
// LOG_FUNC();
// }
// virtual dp::list<dplib::ContentTag> getTags( const dp::ref<dplib::ContentTag>& parent )
// {
// LOG_FUNC();
// return 0;
// }
// virtual dp::list<dplib::ContentRecord> getContentRecords( const dp::ref<dplib::ContentTag>& tag )
// {
// LOG_FUNC();
// return 0;
// }
// virtual dp::ref<dplib::ContentTag> getTagByID( const dp::String& tag )
// {
// LOG_FUNC();
// return 0;
// }
// virtual void removeTag( const dp::ref<dplib::ContentTag>& tag )
// {
// LOG_FUNC();
// }
// virtual void addListener( dplib::LibraryListener * listener )
// {
// LOG_FUNC();
// }
// virtual void removeListener( dplib::LibraryListener * listener )
// {
// LOG_FUNC();
// }
// };
class MockStream : public dpio::Stream {
public:
MockStream(const dp::String& method, const dp::String& url, dpio::StreamClient* client,
reply = networkManager.get(request);
}
}
// virtual void streamfn0(void) {LOG_FUNC();}
// virtual void streamfn1(void) {LOG_FUNC();}
virtual void release() {LOG_FUNC();}
virtual void setStreamClient(dpio::StreamClient * client)
{
{
LOG_FUNC();
networkManager.moveToThread(QCoreApplication::instance()->thread());
QCoreApplication* app = QCoreApplication::instance();
networkManager.moveToThread(app->thread());
while (!reply->isFinished())
app->processEvents();
requestBytes(0, -1);
class MockNetProvider : public dpnet::NetProvider
{
virtual dpio::Stream * open(dp::String& method, dp::String& url, dpio::StreamClient* client,
unsigned int p3, dpio::Stream* p4) {
LOG(INFO, "New net stream " << method.utf8() << " " << url.utf8());
return 0;
}
virtual void netfn0() {LOG_FUNC();}
virtual void netfn1() {LOG_FUNC();}
virtual void netfn2() {LOG_FUNC();}
virtual dpio::Stream * netfn3(dp::String& method, dp::String& url, adept::UrlLoader<adept::DRMProcessorImpl>* client, unsigned int param1, dpio::Stream* stream) {
virtual void netfn3() {LOG_FUNC();}
virtual dpio::Stream * netfn4(dp::String& method, dp::String& url, adept::UrlLoader<adept::DRMProcessorImpl>* client, unsigned int param1, dpio::Stream* stream) {
LOG_FUNC();
return new MockStream(method, url, (dpio::StreamClient*)(client), stream);
}
virtual void netfn4() {LOG_FUNC();}
virtual void netfn5() {LOG_FUNC();}
virtual void netfn6() {LOG_FUNC();}
};
#endif

Archive Download the corresponding diff file

Branches