ACSMDownloader

ACSMDownloader Commit Details

Date:2021-04-29 16:48:29 (2 months 28 days ago)
Author:Grégory Soutadé
Commit:1f582f55f35b3a6898ced8d388e043ee81168bd1
Parents: 07c7427753dccde0cc00a56b2bc7f94a7d1d84fd
Message:First clean working version

Changes:
Minclude/log.h (1 diff)
Minclude/rmsdk/adept.h (10 diffs)
Minclude/rmsdk/dp.h (3 diffs)
Minclude/rmsdk/dpdrm.h (3 diffs)
Minclude/rmsdk/librmsdk.h (1 diff)
Minclude/rmsdk/mdom.h (21 diffs)
Minclude/rmsdk/uft.h (11 diffs)
Minclude/rmsdk/xpath.h (1 diff)
Minclude/rmsdk_wrapper.h (7 diffs)
Msrc/main.cpp (9 diffs)

File differences

include/log.h
1111
1212
1313
14
14
1515
1616
17
1718
TRACE
};
#define LOG(lvl, msg) if (lvl <= verbose) std::cout << msg << std::endl;
#define LOG(lvl, msg) if (lvl <= verbose) {std::cout << msg << std::endl;}
#define LOG_FUNC() LOG(TRACE, __FUNCTION__)
#endif
include/rmsdk/adept.h
1818
1919
2020
21
2122
2223
2324
......
9091
9192
9293
93
94
95
96
94
95
96
97
9798
98
99
100
101
102
99
100
101
102
103
103104
104
105
105106
106107
107108
......
194195
195196
196197
197
198
198199
199200
200201
201202
202203
203
204
204205
205206
206207
......
353354
354355
355356
356
357
357358
358359
359360
......
367368
368369
369370
370
371
372
373
374
371
372
373
374
375
375376
376377
377378
......
383384
384385
385386
386
387
387
388
388389
389390
390391
......
530531
531532
532533
533
534
535
536
534
535
536
537
537538
538
539
540
541
542
539
540
541
542
543
543544
544
545
545546
546547
547548
......
619620
620621
621622
622
623
624
625
623
624
625
626
626627
627
628
629
630
631
628
629
630
631
632
632633
633
634
634635
635636
636637
......
771772
772773
773774
774
775
775776
776777
777778
......
781782
782783
783784
784
785
785
786
786787
787788
788789
#include <dpcrypt.h>
class MockDevice;
class MetroWisDOM;
namespace adept {
};
class ActivationList: public dp::List<dpdrm::Activation>
{
public:
ActivationList(uft::Vector const&);
// class ActivationList: public dp::List<dpdrm::Activation>
// {
// public:
// ActivationList(uft::Vector const&);
virtual ~ActivationList();
virtual void addRef();
virtual void release();
virtual void length();
virtual void operator[](unsigned int);
// virtual ~ActivationList();
// virtual void addRef();
// virtual void release();
// virtual int length();
// virtual uft::sref<dpdrm::Activation> operator[](unsigned int);
};
// };
class ActivationRecord
{
virtual void initLoanReturnWorkflow(dp::String const&);
virtual void initUpdateLoansWorkflow(dp::String const&, dp::String const&);
virtual void initJoinAccountsWorkflow(dp::String const&, dp::String const&, dp::String const&);
virtual void startWorkflows(unsigned int);
virtual int startWorkflows(unsigned int);
virtual void providePasshash(dp::Data const&);
virtual void provideInput(dp::Data const&);
virtual void provideConfirmation(dp::String const&, int);
virtual void transferLoanTokensFrom(dpdev::Device*);
virtual void transferCredentialsFrom(dpdev::Device*, dp::String const&, bool);
virtual void getFulfillmentItems();
virtual dp::list<dpdrm::FulfillmentItem> getFulfillmentItems();
virtual void getFulfillmentID();
virtual void isReturnable();
virtual void addPasshash(dp::String const&, dp::Data const&);
void* operator new(unsigned int, uft::Value&);
void query(uft::Value const&, void*);
void staticInit();
void toString() const;
uft::String toString() const;
void* s_descriptor;
virtual ~FulfillmentItemImpl();
virtual void addRef();
virtual void release();
virtual void getRights();
virtual void getMetadata(dp::String const&);
virtual void getDownloadMethod();
virtual void getDownloadURL();
virtual void getPostData();
virtual dp::String getRights();
virtual dp::String getMetadata(dp::String const&);
virtual dp::String getDownloadMethod();
virtual dp::String getDownloadURL();
virtual dp::Data getPostData();
};
virtual ~FulfillmentItemList();
virtual void addRef();
virtual void release();
virtual void length();
virtual void operator[](unsigned int);
virtual int length();
virtual dp::ref<dpdrm::FulfillmentItem> operator[](unsigned int);
};
};
class LicenseList: public dp::List<dpdrm::License>
{
public:
LicenseList(uft::Vector const&);
// class LicenseList: public dp::List<dpdrm::License>
// {
// public:
// LicenseList(uft::Vector const&);
virtual ~LicenseList();
virtual void addRef();
virtual void release();
virtual void length();
virtual void operator[](unsigned int);
// virtual ~LicenseList();
// virtual void addRef();
// virtual void release();
// virtual int length();
// virtual uft::sref<dpdrm::License> operator[](unsigned int);
};
// };
class LicenseRequestInfo
{
};
class PermissionList: public dp::List<dpdrm::Permission>
{
public:
PermissionList(uft::String const&, uft::Vector const&);
// class PermissionList: public dp::List<dpdrm::Permission>
// {
// public:
// PermissionList(uft::String const&, uft::Vector const&);
virtual ~PermissionList();
virtual void addRef();
virtual void release();
virtual void length();
virtual void operator[](unsigned int);
// virtual ~PermissionList();
// virtual void addRef();
// virtual void release();
// virtual int length();
// virtual uft::sref<dpdrm::Permission> operator[](unsigned int);
};
// };
class Permissions
{
void findUserByName(uft::Dict const&, uft::String const&);
void getActivationService(dpdev::Device*, uft::String const&);
void getBase64EncodedContent(mdom::Node);
void getChildValue(mdom::Node const&, unsigned int);
uft::String getChildValue(mdom::Node const& node, unsigned int nodeType);
void getLicense(mdom::Node const&, uft::String const&, uft::Vector const&, dpdev::Device*, uft::ErrorHandler*);
void getLicenses(mdom::Node const&, uft::String const&, uft::Vector const&, dpdev::Device*, bool, uft::ErrorHandler*);
void getValidUsers(dpdev::Device*, uft::ErrorHandler*);
void mergeIn(mdom::Node const&, char const*, uft::ErrorHandler*);
void mergeInLoanTokenNode(mdom::DOM*, uft::sref<adept::LoanToken> const&, mdom::Node const&);
void nodeToString(mdom::Node const&);
void parseXML(char const*);
void parseXML(dp::Data const&);
MetroWisDOM* parseXML(char const*);
MetroWisDOM* parseXML(dp::Data const&);
void removeChildren(mdom::Node const&, unsigned int, unsigned int, uft::String, unsigned int, uft::Buffer);
void removeChildren(mdom::Node const&, unsigned int, unsigned int, unsigned int*, uft::String*, unsigned int, unsigned int*, uft::Buffer*);
void renderFPH(uft::Buffer const&);
include/rmsdk/dp.h
163163
164164
165165
166
166
167167
168168
169169
170
171
170
171
172
172173
173174
174175
......
244245
245246
246247
247
248
249
248250
249251
250252
251253
252254
253
255
254256
255257
256
258
257259
258260
259261
......
342344
343345
344346
345
347
348
349
350
351
352
353
354
355
346356
347357
348
358
359
360
361
362
363
364
365
366
367
368
369
370
371
349372
350373
351
374
375
376
377
378
379
380
381
382
383
352384
353385
354386
355387
356
388
357389
358390
359391
~Data();
unsigned char* data(unsigned int*size=0) const;
unsigned char* data(unsigned int *size=0) const;
bool isNull() const;
unsigned int length() const;
operator uft::Buffer() const;
void operator=(dp::Data const&);
Data& operator=(dp::Data const&);
protected:
void* data0;
void* data1;
};
String(uft::String const&);
String(unsigned short const*);
String(unsigned short const*, unsigned int);
String(const String& o) : Data(o) {}
~String();
void base64Decode(dp::String const&);
void base64Encode(dp::Data const&);
operator uft::String() const;
void operator=(dp::String const&);
String& operator=(dp::String const&);
void stringToTime(dp::String const&);
void timeToString(unsigned long long);
void uft() const;
uft::String uft() const;
void urlDecode(dp::String const&);
void urlEncode(dp::String const&);
char* utf8() const;
};
template<typename T>
class ref{};
class ref{
public:
operator bool() const;
T* operator->() const {return m;}
ref(T* m):m(m){}
ref(const ref<T>&);
void release();
T* m;
};
template<typename T>
class List{};
class List: public dp::RefCounted
{
public:
virtual ~List();
virtual void* getInterfaceID();
virtual void* getOptionalInterface(char const*);
virtual void addRef() = 0;
virtual void release() = 0;
virtual int length() = 0;
virtual dp::ref<T> operator[](unsigned int) = 0;
List();
};
template<typename T>
class list{};
class list {
public:
list(dp::List<T>* p) :m(p){}
int length() {return m->length();}
dp::ref<T> operator[](unsigned int idx) {return (*m)[idx];}
list<T> operator=(const list<T>& other);
list(const list<T>& other);
private:
dp::List<T>* m;
};
void broadcast(dp::String const&, dp::Data const&);
void coreInit();
void cryptRegisterOpenSSL();
void decodeBase64(char const*, unsigned char*, unsigned int);
int decodeBase64(char const* in, unsigned char* out, unsigned int outSize);
void decodeURLEncoding(char const*, unsigned char*, unsigned int);
void deviceMountRemovablePartitions();
void deviceRegisterExternal();
include/rmsdk/dpdrm.h
1010
1111
1212
13
14
15
1316
1417
1518
......
5962
6063
6164
62
65
6366
6467
6568
6669
6770
68
71
6972
7073
7174
......
102105
103106
104107
105
106
107
108
109
108
109
110
111
112
110113
111114
112115
#include <dpio.h>
#include <dpdev.h>
namespace adept {
class FulfillmentItemList;
}
namespace dpdrm {
virtual void initLoanReturnWorkflow(dp::String const&) = 0;
virtual void initUpdateLoansWorkflow(dp::String const&, dp::String const&) = 0;
virtual void initJoinAccountsWorkflow(dp::String const&, dp::String const&, dp::String const&) = 0;
virtual void startWorkflows(unsigned int) = 0;
virtual int 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 void getFulfillmentItems() = 0;
virtual dp::list<dpdrm::FulfillmentItem> getFulfillmentItems() = 0;
virtual void getFulfillmentID() = 0;
virtual void isReturnable() = 0;
virtual void addPasshash(dp::String const&, dp::Data const&) = 0;
virtual void* getInterfaceID();
virtual void addRef() = 0;
virtual void release() = 0;
virtual void getRights() = 0;
virtual void getMetadata(dp::String const&) = 0;
virtual void getDownloadMethod() = 0;
virtual void getDownloadURL() = 0;
virtual void getPostData() = 0;
virtual dp::String getRights() = 0;
virtual dp::String getMetadata(dp::String const&) = 0;
virtual dp::String getDownloadMethod() = 0;
virtual dp::String getDownloadURL() = 0;
virtual dp::Data getPostData() = 0;
};
include/rmsdk/librmsdk.h
77
88
99
10
11
10
11
1212
1313
1414
1515
1616
1717
18
19
20
21
22
23
24
25
26
27
28
1829
1930
2031
2132
2233
2334
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
24273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
25305
306
26307
27308
#define _LIBRMSDK_H
// #include <xpath.h>
// #include <mdom.h>
// #include <uft.h>
#include <mdom.h>
#include <uft.h>
//#include <mrend.h>
//#include <cssparser.h>
//#include <tahoecss.h>
//#include <xda.h>
#include <adept.h>
#define WORKFLOW_AUTH_SIGN_IN 0x2
#define WORKFLOW_ADD_SIGN_IN 0x4
#define WORKFLOW_ACTIVATION 0x10
#define WORKFLOW_FULFILLMENT 0x20
#define WORKFLOW_LOAN_RETURN 0x80
#define WORKFLOW_UPDATE_LOAD 0x100
#define WORKFLOW_DOWNLOAD 0x200
#define WORKFLOW_JOIN_ACCOUNTS 0x400
#define WORKFLOW_GET_CREDENTIAL_LIST 0x800
#define WORKFLOW_NOTIFICATION 0x1000
namespace rmsdk {
adept::DRMProviderImpl* getProvider();
}
class MetroWisDOM: public mdom::DOM, public mdom::DataSink
{
public:
MetroWisDOM(MetroWisDOM&);
MetroWisDOM(MetroWisDOM&, bool);
MetroWisDOM(uft::ErrorHandler*, int);
virtual ~MetroWisDOM();
virtual void getDOMId();
virtual void getDOMCaps();
virtual void query(uft::Value const&, void*);
virtual void setElementConfigs(mdom::Node const&, mdom::ElementConfig const*, unsigned int);
virtual void setPreParser(uft::ValueParser*);
virtual mdom::Node getRoot();
virtual void getResource(uft::URL const&);
virtual void attachDOMListener(unsigned int, mdom::DOMListener*);
virtual void clearChanges();
virtual void cloneConfig();
virtual void setDOMHost(mdom::DOMHost*);
virtual void setMasterURL(uft::URL const&);
virtual void writeData(uft::URL const&, unsigned char const*, unsigned int, mdom::ParseException*, mdom::ExternalEntityResolver*);
virtual void xformsProcessorHalted();
virtual void xformsFatalError(uft::String);
};
class WisDOMTraversal;
class WisDOMTree;
class WDLinkSnapshot{};
class WDIdAttrValue{};
class WisDOM_NodeTypes{};
class WDNodeReference;
class WDNodeClass;
class WDLinkAttrValue
{
public:
WDLinkAttrValue(uft::sref<mdom::AttrConfig> const&, uft::Value const&, WisDOMTraversal*, int, WisDOMTraversal*, int);
void query(uft::Value const&, void*);
void staticInit();
void* s_descriptor;
};
class WDNodeParserContext: public uft::ParserContext
{
public:
WDNodeParserContext(mdom::Node const&, unsigned int);
virtual void resolveNSPrefix(uft::String const&);
virtual void prefixBindingsChanged();
virtual void getNodeType();
};
class WDSelectorLink
{
public:
WDSelectorLink(uft::Value const&, xpath::Expression const&, mdom::Node&, uft::sref<mdom::AttrConfig> const&);
void staticInit();
void* s_descriptor;
};
class WDStringHash
{
public:
WDStringHash(WDStringHash&);
WDStringHash(WisDOMTree*, unsigned long);
virtual ~WDStringHash();
void get(unsigned long) const;
void hash(char const*, unsigned long);
void lookup(char const*, unsigned long*, unsigned long) const;
void minimizeHash(int*);
void put(char const*);
};
class WisDOMMemory
{
public:
WisDOMMemory();
~WisDOMMemory();
void Alloc(unsigned int);
void Free(void*);
void Realloc(void*, unsigned int);
void appendCommentChars(char*, int, int);
void appendDataChars(char*, int, int, bool);
void getCommentStringBuffer(int);
void getDataStringBuffer(int);
void trimCommentChars();
void trimDataChars();
};
class WisDOMTraversal: public mdom::Traversal
{
public:
WisDOMTraversal(MetroWisDOM*, WisDOMTraversal const&);
WisDOMTraversal(MetroWisDOM*, uft::URL const&);
WisDOMTraversal(WisDOMTraversal const&, WisDOMTree*);
virtual void incRef(mdom::NodeData*);
virtual void decRef(mdom::NodeData*);
virtual void getDOM();
virtual void owner(mdom::Node*);
virtual void parent(mdom::Node*);
virtual void child(mdom::Node*, int, bool);
virtual void sibling(mdom::Node*, int, bool);
virtual void childCount(mdom::Node const*, bool);
virtual void nextLink(mdom::Node const*, unsigned int, unsigned int, mdom::Node*, uft::Value const**);
virtual void finishLinkIteration(mdom::Node const*, unsigned int, unsigned int);
virtual void create(mdom::Node*, int, uft::Value const&);
virtual void clone(mdom::Node*, bool);
virtual void insertBefore(mdom::Node const*, mdom::Node const*, mdom::Node const*);
virtual void remove(mdom::Node const*);
virtual void getNodeType(mdom::Node const*);
virtual uft::String getNodeName(mdom::Node const*);
virtual uft::Value getNodeValue(mdom::Node const*, unsigned int, unsigned int);
virtual void changeNodeValue(mdom::Node const*, unsigned int, unsigned int, uft::Value const&);
virtual void resolvePrefix(mdom::Node const*, uft::String const&);
virtual void getBaseURL(mdom::Node const*);
virtual void nextAttribute(mdom::Node const*, unsigned int, unsigned int, uft::Value const**, uft::Value const**);
virtual void finishAttributeIteration(mdom::Node const*, unsigned int, unsigned int);
virtual void getAttribute(mdom::Node const*, uft::Value const&);
virtual void setAttribute(mdom::Node const*, uft::Value const&, uft::Value const&);
virtual void compareNodes(mdom::Node const*, mdom::Node const*);
virtual void evaluate(xpath::Expression const&, mdom::Node const*, xpath::Context*, xpath::ResultType);
virtual void iterate(xpath::Expression const&, xpath::Context*, mdom::Node*);
virtual void finishIteration(xpath::Expression const&, xpath::Context*);
virtual void getChangeFlags(mdom::Node const*);
virtual void invalidate(mdom::Node const*, unsigned int);
virtual void iterateChangedAttributes(mdom::Node const*, unsigned int, uft::Value*, uft::Value*);
virtual void finishChangedAttributeIteration(mdom::Node const*, unsigned int);
virtual void iterateNodeValueChanges(mdom::Node const*, unsigned int, mdom::TextChangeRecord*);
virtual void finishNodeValueChangeIteration(mdom::Node const*, unsigned int);
virtual void iterateRemovedChildren(mdom::Node const*, unsigned int, mdom::RemovedChildRecord*);
virtual void finishRemovedChildIteration(mdom::Node const*, unsigned int);
virtual void getAttachment(mdom::Node const*, uft::Value const&);
virtual void setAttachment(mdom::Node const*, uft::Value const&, uft::Value const&);
virtual void getAttachment(uft::Value const&);
virtual void setAttachment(uft::Value const&, uft::Value const&);
virtual void getReference(mdom::Node const*, bool);
virtual void destroy();
virtual ~WisDOMTraversal();
virtual void nextNamespaceDecl(mdom::Node const*, unsigned int, unsigned int, uft::Value const**);
virtual void finishNamespaceIteration(mdom::Node const*, unsigned int, unsigned int);
void addRulesToList(mdom::Node const*, uft::Vector const&, uft::Value const&);
void afterInsertion(int);
void afterRemoval(int);
void afterShadowInsertion(int, uft::Dict&);
void allocLinkSnap();
void beforeInsertion(int, uft::Dict&);
void beforeRemoval(int, uft::Dict&);
void cacheChangedAttribute(int, uft::Value const&, uft::Value const&);
void cacheChangedValue(int, uft::Value const&);
void characterData(char const*, int);
void clearChangeCaches();
void clearChanges();
void cloneChildren(int, int, int, int);
void cloneNode(int);
void comment(char const*, bool);
void createElementWithQName(uft::QName const&, char const**, bool);
void createSelectorLink(mdom::Node*, mdom::Reference, uft::Value const&);
void createTextNode(bool);
void deleteLinkSnap(WDLinkSnapshot*);
void detachChildren(int, int, int);
void detachNode(int);
void docTypeName(char const*);
void docTypePublicID(char const*);
void docTypeSystemID(char const*);
void endCDATASection();
void endElement(char const*);
void endNamespace(char const*);
void ensureNSStackCapacity();
void filterAndAddRulesToList(mdom::Node const*, uft::Vector const&, uft::Value const&);
void findDOMInsertIndex(int, int, int);
void findFragInsertIndex(int, int, int, int*, int*, int*);
void findLinkAttr(xpath::Expression const&, int, uft::sref<WDLinkAttrValue> const&);
void findUnattachedNodeIdx(int, int*, int*);
void getAttributeByName(int, uft::Value const&);
void getAttributeConfig(int, uft::Value const&);
void getBranchRoot(int);
void getChangedValue(int, unsigned int);
void getDOMTree();
void getIdAttr(int);
void getIdAttrFromMap(int, uft::String const&);
void getIdMap();
void getLinkCache(int);
void getLocalizedIdMap(int);
void getNode(WDNodeReference*);
void getRoot();
void getSelectorLink(int);
void initDocumentModel(bool);
void internalEntity(char const*, char const*, int);
void newAttribute(int, uft::Value const&, uft::Value const&);
void parsedAttribute(int, WDNodeClass*, uft::Value const&, uft::Value const&);
void processSimpleMatch(xpath::SimpleMatch const&, uft::Value const&, bool);
void processingInstruction(char const*, char const*, bool);
void reconfigureAttribute(mdom::Node*, int, int, uft::QName const&, WDNodeClass*, bool);
void reconfigureElement(mdom::Node*, int, WDNodeClass*, bool);
void registerId(uft::Dict&, uft::sref<WDIdAttrValue> const&);
void registerLink(int, uft::sref<WDLinkAttrValue> const&);
void remapFromDocIndex(int);
void removeAttribute(int, int);
void removeSelectorLink(mdom::Node*, mdom::Reference, uft::Value const&);
void resolvePrefixLocal(int, uft::String const&);
void setDirtyBits(int, unsigned int);
void startCDATASection();
void startElement(char const*, char const**, bool);
void startNamespace(char const*, char const*);
void staticInit();
void unregisterId(uft::Dict&, uft::sref<WDIdAttrValue> const&);
void unregisterLink(int, uft::sref<WDLinkAttrValue> const&);
void updateSelectorLinks();
void writeData(unsigned char const*, unsigned int, mdom::ParseException*, mdom::ExternalEntityResolver*);
void* s_descriptor;
};
class WisDOMTree
{
public:
WisDOMTree(WisDOMTraversal*, int);
WisDOMTree(WisDOMTree&);
WisDOMTree(int);
~WisDOMTree();
void addAttribute(int, uft::Value const&, uft::Value const&);
void addDynamicAttribute(int, uft::Value const&, uft::Value const&, int);
void addNamespace(int, uft::Value const&);
void addNode(WisDOM_NodeTypes, int, int, int, uft::Value const&, bool);
void appendHashKey(char const*, int, int);
void cacheUnattachedNode(int);
void clearChanges();
void closeElements(_IO_FILE*, int);
void copyAttribute(int, uft::Value, uft::Value);
void copyNode(int);
void ensureAttributeCapacity();
void ensureDynamicAttributeCapacity();
void ensureNamespaceCapacity();
void ensureNodeCapacity();
void ensurePriorIndex();
void freePriorIndex();
void getRoot();
void initDocumentModel(bool);
void insertUnattachedNode(int, int, int);
void isUsingNamespaces();
void makePriorIndex();
void makeSerialIndex();
void serializeAttribute(_IO_FILE*, uft::Value, uft::Value);
void serializeComment(_IO_FILE*, int);
void serializeDOM(_IO_FILE*);
void serializeElement(_IO_FILE*, int);
void serializeNamespace(_IO_FILE*, int);
void serializePI(_IO_FILE*, int);
void serializeText(_IO_FILE*, int);
void setTraversal(WisDOMTraversal*);
void writeData(unsigned char const*, unsigned int, mdom::ParseException*, mdom::ExternalEntityResolver*);
};
#endif // _LIBRMSDK_H
include/rmsdk/mdom.h
2626
2727
2828
29
3029
3130
3231
......
106105
107106
108107
109
108
110109
111110
112111
......
116115
117116
118117
119
120
118
119
121120
122121
123122
......
168167
169168
170169
171
170
172171
173172
174173
......
178177
179178
180179
181
182
180
181
183182
184183
185184
......
234233
235234
236235
237
236
238237
239238
240239
......
244243
245244
246245
247
248
246
247
249248
250249
251250
......
295294
296295
297296
298
297
299298
300299
301300
......
305304
306305
307306
308
309
307
308
310309
311310
312311
......
350349
351350
352351
353
352
354353
355354
356355
......
429428
430429
431430
432
433
434
435
436
437
438
439
440
441
431
432
433
434
435
436
437
438
439
442440
443441
444442
......
447445
448446
449447
450
451
452
453
454
455
456
457
458
459
448
449
450
451
452
453
454
455
456
457
460458
461459
462460
......
484482
485483
486484
487
485
488486
489487
490488
......
571569
572570
573571
574
572
575573
576574
577575
......
581579
582580
583581
584
585
582
583
586584
587585
588586
......
680678
681679
682680
683
681
684682
685683
686684
......
690688
691689
692690
693
694
691
692
695693
696694
697695
......
724722
725723
726724
725
726
727
728
729
730
731
732
733
727734
728735
729736
......
742749
743750
744751
745
746
752
753
747754
748755
749756
......
753760
754761
755762
756
763
757764
758765
759766
760767
761
768
762769
763770
764771
......
775782
776783
777784
778
779
780
781
782
783
784
785
786
787785
788786
789787
class DocumentHandler;
class DOMSerializer;
class DataSink;
class DataSink* mdom;
class DelegatingDOM;
class DelegatingDOMLink;
class LinkAccessor;
virtual void childCount(mdom::Node const*, bool);
virtual void getChildrenCountsToNode(mdom::Node const*, mdom::Node const*, unsigned int*, unsigned int*);
virtual void getChildrenCountsToElement(mdom::Node const*, uft::String, unsigned int*, unsigned int*, mdom::Node*, unsigned int);
virtual void iterateBranch(mdom::Node const*, mdom::Node*, unsigned int);
virtual int iterateBranch(mdom::Node const*, mdom::Node*, unsigned int);
virtual void iterateDirtyBranch(mdom::Node const*, mdom::Node*, unsigned int);
virtual void nextLink(mdom::Node const*, unsigned int, unsigned int, mdom::Node*, uft::Value const**) = 0;
virtual void finishLinkIteration(mdom::Node const*, unsigned int, unsigned int) = 0;
virtual void insertBefore(mdom::Node const*, mdom::Node const*, mdom::Node const*) = 0;
virtual void remove(mdom::Node const*) = 0;
virtual void getNodeType(mdom::Node const*) = 0;
virtual void getNodeName(mdom::Node const*) = 0;
virtual void getNodeValue(mdom::Node const*, unsigned int, unsigned int) = 0;
virtual uft::String getNodeName(mdom::Node const*) = 0;
virtual uft::Value getNodeValue(mdom::Node const*, unsigned int, unsigned int) = 0;
virtual void changeNodeValue(mdom::Node const*, unsigned int, unsigned int, uft::Value const&) = 0;
virtual void resolvePrefix(mdom::Node const*, uft::String const&) = 0;
virtual void getBaseURL(mdom::Node const*) = 0;
virtual void childCount(mdom::Node const*, bool);
virtual void getChildrenCountsToNode(mdom::Node const*, mdom::Node const*, unsigned int*, unsigned int*);
virtual void getChildrenCountsToElement(mdom::Node const*, uft::String, unsigned int*, unsigned int*, mdom::Node*, unsigned int);
virtual void iterateBranch(mdom::Node const*, mdom::Node*, unsigned int);
virtual int iterateBranch(mdom::Node const*, mdom::Node*, unsigned int);
virtual void iterateDirtyBranch(mdom::Node const*, mdom::Node*, unsigned int);
virtual void nextLink(mdom::Node const*, unsigned int, unsigned int, mdom::Node*, uft::Value const**);
virtual void finishLinkIteration(mdom::Node const*, unsigned int, unsigned int);
virtual void insertBefore(mdom::Node const*, mdom::Node const*, mdom::Node const*);
virtual void remove(mdom::Node const*);
virtual void getNodeType(mdom::Node const*);
virtual void getNodeName(mdom::Node const*);
virtual void getNodeValue(mdom::Node const*, unsigned int, unsigned int);
virtual uft::String getNodeName(mdom::Node const*);
virtual uft::Value getNodeValue(mdom::Node const*, unsigned int, unsigned int);
virtual void changeNodeValue(mdom::Node const*, unsigned int, unsigned int, uft::Value const&);
virtual void resolvePrefix(mdom::Node const*, uft::String const&);
virtual void getBaseURL(mdom::Node const*);
virtual void childCount(mdom::Node const*, bool);
virtual void getChildrenCountsToNode(mdom::Node const*, mdom::Node const*, unsigned int*, unsigned int*);
virtual void getChildrenCountsToElement(mdom::Node const*, uft::String, unsigned int*, unsigned int*, mdom::Node*, unsigned int);
virtual void iterateBranch(mdom::Node const*, mdom::Node*, unsigned int);
virtual int iterateBranch(mdom::Node const*, mdom::Node*, unsigned int);
virtual void iterateDirtyBranch(mdom::Node const*, mdom::Node*, unsigned int);
virtual void nextLink(mdom::Node const*, unsigned int, unsigned int, mdom::Node*, uft::Value const**);
virtual void finishLinkIteration(mdom::Node const*, unsigned int, unsigned int);
virtual void insertBefore(mdom::Node const*, mdom::Node const*, mdom::Node const*);
virtual void remove(mdom::Node const*);
virtual void getNodeType(mdom::Node const*);
virtual void getNodeName(mdom::Node const*);
virtual void getNodeValue(mdom::Node const*, unsigned int, unsigned int);
virtual uft::String getNodeName(mdom::Node const*);
virtual uft::Value getNodeValue(mdom::Node const*, unsigned int, unsigned int);
virtual void changeNodeValue(mdom::Node const*, unsigned int, unsigned int, uft::Value const&);
virtual void resolvePrefix(mdom::Node const*, uft::String const&);
virtual void getBaseURL(mdom::Node const*);
virtual void childCount(mdom::Node const*, bool);
virtual void getChildrenCountsToNode(mdom::Node const*, mdom::Node const*, unsigned int*, unsigned int*);
virtual void getChildrenCountsToElement(mdom::Node const*, uft::String, unsigned int*, unsigned int*, mdom::Node*, unsigned int);
virtual void iterateBranch(mdom::Node const*, mdom::Node*, unsigned int);
virtual int iterateBranch(mdom::Node const*, mdom::Node*, unsigned int);
virtual void iterateDirtyBranch(mdom::Node const*, mdom::Node*, unsigned int);
virtual void nextLink(mdom::Node const*, unsigned int, unsigned int, mdom::Node*, uft::Value const**);
virtual void finishLinkIteration(mdom::Node const*, unsigned int, unsigned int);
virtual void insertBefore(mdom::Node const*, mdom::Node const*, mdom::Node const*);
virtual void remove(mdom::Node const*);
virtual void getNodeType(mdom::Node const*);
virtual void getNodeName(mdom::Node const*);
virtual void getNodeValue(mdom::Node const*, unsigned int, unsigned int);
virtual uft::String getNodeName(mdom::Node const*);
virtual uft::Value getNodeValue(mdom::Node const*, unsigned int, unsigned int);
virtual void changeNodeValue(mdom::Node const*, unsigned int, unsigned int, uft::Value const&);
virtual void resolvePrefix(mdom::Node const*, uft::String const&);
virtual void getBaseURL(mdom::Node const*);
virtual void query(uft::Value const&, void*) = 0;
virtual void setElementConfigs(mdom::Node const&, mdom::ElementConfig const*, unsigned int) = 0;
virtual void setPreParser(uft::ValueParser*) = 0;
virtual void getRoot() = 0;
virtual mdom::Node getRoot() = 0;
virtual void getResource(uft::URL const&) = 0;
virtual void attachDOMListener(unsigned int, mdom::DOMListener*) = 0;
virtual void getErrorHandler();
DocumentHandler();
virtual ~DocumentHandler();
virtual void characters(uft::Value const&) = 0;
virtual void comment(uft::Value const&) = 0;
virtual void endDocument() = 0;
virtual void endElement(uft::Value const&, uft::Value const&, uft::Value const&) = 0;
virtual void endEntity(uft::Value const&) = 0;
virtual void processingInstruction(uft::Value const&, uft::Value const&) = 0;
virtual void startDocument() = 0;
virtual void startElement(mdom::Node const&, uft::Value const&, uft::Value const&, uft::Value const&, mdom::NameValueIterator*) = 0;
virtual void startEntity(uft::Value const&) = 0;
virtual bool characters(uft::Value const&) = 0;
virtual bool comment(uft::Value const&) = 0;
virtual bool endDocument() = 0;
virtual bool endElement(uft::Value const&, uft::Value const&, uft::Value const&) = 0;
virtual bool endEntity(uft::Value const&) = 0;
virtual bool processingInstruction(uft::Value const&, uft::Value const&) = 0;
virtual bool startDocument() = 0;
virtual bool startElement(mdom::Node const&, uft::Value const&, uft::Value const&, uft::Value const&, mdom::NameValueIterator*) = 0;
virtual bool startEntity(uft::Value const&) = 0;
};
class DOMSerializer: public mdom::DocumentHandler
DOMSerializer();
virtual ~DOMSerializer();
virtual void characters(uft::Value const&);
virtual void comment(uft::Value const&);
virtual void endDocument();
virtual void endElement(uft::Value const&, uft::Value const&, uft::Value const&);
virtual void endEntity(uft::Value const&);
virtual void processingInstruction(uft::Value const&, uft::Value const&);
virtual void startDocument();
virtual void startElement(mdom::Node const&, uft::Value const&, uft::Value const&, uft::Value const&, mdom::NameValueIterator*);
virtual void startEntity(uft::Value const&);
virtual void getOutputString();
virtual bool characters(uft::Value const&);
virtual bool comment(uft::Value const&);
virtual bool endDocument();
virtual bool endElement(uft::Value const&, uft::Value const&, uft::Value const&);
virtual bool endEntity(uft::Value const&);
virtual bool processingInstruction(uft::Value const&, uft::Value const&);
virtual bool startDocument();
virtual bool startElement(mdom::Node const&, uft::Value const&, uft::Value const&, uft::Value const&, mdom::NameValueIterator*);
virtual bool startEntity(uft::Value const&);
virtual bool getOutputString();
void appendValue(uft::Value const&, unsigned int);
void lookupAutogenNSStack(uft::String&, uft::String&);
virtual void query(uft::Value const&, void*) = 0;
virtual void setElementConfigs(mdom::Node const&, mdom::ElementConfig const*, unsigned int);
virtual void setPreParser(uft::ValueParser*);
virtual void getRoot();
virtual mdom::Node getRoot();
virtual void getResource(uft::URL const&);
virtual void attachDOMListener(unsigned int, mdom::DOMListener*);
virtual void getErrorHandler();
virtual void childCount(mdom::Node const*, bool);
virtual void getChildrenCountsToNode(mdom::Node const*, mdom::Node const*, unsigned int*, unsigned int*);
virtual void getChildrenCountsToElement(mdom::Node const*, uft::String, unsigned int*, unsigned int*, mdom::Node*, unsigned int);
virtual void iterateBranch(mdom::Node const*, mdom::Node*, unsigned int);
virtual int iterateBranch(mdom::Node const*, mdom::Node*, unsigned int);
virtual void iterateDirtyBranch(mdom::Node const*, mdom::Node*, unsigned int);
virtual void nextLink(mdom::Node const*, unsigned int, unsigned int, mdom::Node*, uft::Value const**);
virtual void finishLinkIteration(mdom::Node const*, unsigned int, unsigned int);
virtual void insertBefore(mdom::Node const*, mdom::Node const*, mdom::Node const*);
virtual void remove(mdom::Node const*);
virtual void getNodeType(mdom::Node const*);
virtual void getNodeName(mdom::Node const*);
virtual void getNodeValue(mdom::Node const*, unsigned int, unsigned int);
virtual uft::String getNodeName(mdom::Node const*);
virtual uft::Value getNodeValue(mdom::Node const*, unsigned int, unsigned int);
virtual void changeNodeValue(mdom::Node const*, unsigned int, unsigned int, uft::Value const&);
virtual void resolvePrefix(mdom::Node const*, uft::String const&);
virtual void getBaseURL(mdom::Node const*);
virtual void childCount(mdom::Node const*, bool);
virtual void getChildrenCountsToNode(mdom::Node const*, mdom::Node const*, unsigned int*, unsigned int*);
virtual void getChildrenCountsToElement(mdom::Node const*, uft::String, unsigned int*, unsigned int*, mdom::Node*, unsigned int);
virtual void iterateBranch(mdom::Node const*, mdom::Node*, unsigned int);
virtual int iterateBranch(mdom::Node const*, mdom::Node*, unsigned int);
virtual void iterateDirtyBranch(mdom::Node const*, mdom::Node*, unsigned int);
virtual void nextLink(mdom::Node const*, unsigned int, unsigned int, mdom::Node*, uft::Value const**);
virtual void finishLinkIteration(mdom::Node const*, unsigned int, unsigned int);
virtual void insertBefore(mdom::Node const*, mdom::Node const*, mdom::Node const*);
virtual void remove(mdom::Node const*);
virtual void getNodeType(mdom::Node const*);
virtual void getNodeName(mdom::Node const*);
virtual void getNodeValue(mdom::Node const*, unsigned int, unsigned int);
virtual uft::String getNodeName(mdom::Node const*);
virtual uft::Value getNodeValue(mdom::Node const*, unsigned int, unsigned int);
virtual void changeNodeValue(mdom::Node const*, unsigned int, unsigned int, uft::Value const&);
virtual void resolvePrefix(mdom::Node const*, uft::String const&);
virtual void getBaseURL(mdom::Node const*);
};
class NodeIterator
{
public:
virtual ~NodeIterator();
virtual void next() = 0;
virtual void current() = 0;
};
class Node
{
public:
void createTextNode(uft::String const&) const;
void finishIteration(xpath::Expression const&, xpath::Context*);
void getAttribute(uft::Value const&) const;
void getFirstChild() const;
void getFirstChildElement() const;
mdom::Node_firstChild getFirstChild() const;
mdom::Node_firstChildElement getFirstChildElement() const;
void getLastChildElement() const;
void getNextSibling() const;
void getNodeType() const;
void inPlaceCreate(int, uft::Value const&);
void isValid() const;
void iterate(xpath::Expression const&, xpath::Context*);
void iterateBranch(mdom::Node const&, unsigned int*);
mdom::NodeIterator* iterateBranch(mdom::Node const&, unsigned int*);
void operator=(mdom::Node const&);
void remove() const;
void setAttribute(uft::Value const&, uft::Value const&) const;
void toChild(int, bool);
void toFirstChild();
Node toFirstChild();
void toFirstChildElement();
void toLastChildElement();
void toNextSibling();
public:
};
class NodeIterator
{
public:
virtual ~NodeIterator();
virtual void next() = 0;
virtual void current() = 0;
};
class NodeLine
{
public:
include/rmsdk/uft.h
88
99
1010
11
1211
1312
1413
......
430429
431430
432431
433
432
434433
435434
436435
......
882881
883882
884883
885
884
886885
887886
888887
......
909908
910909
911910
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
932931
933932
934933
......
942941
943942
944943
945
944
946945
947946
948947
949948
950949
951950
952
951
953952
954953
955954
......
961960
962961
963962
964
963
965964
966965
967966
......
12351234
12361235
12371236
1238
1237
12391238
12401239
12411240
12421241
12431242
12441243
1245
1244
12461245
12471246
12481247
......
12541253
12551254
12561255
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
12671266
1268
1269
1267
1268
12701269
12711270
12721271
12731272
1274
1275
1273
1274
12761275
12771276
12781277
......
12991298
13001299
13011300
1301
1302
13021303
13031304
13041305
......
13121313
13131314
13141315
1315
1316
13161317
13171318
1318
1319
1319
1320
13201321
13211322
13221323
......
13511352
13521353
13531354
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
13551366
13561367
13571368
#include <rib.h>
namespace uft {
class ADEPTName;
void nextKey(unsigned int, uft::Value const**, uft::Value**) const;
void setCapacity(unsigned int, bool);
void sort();
void toString() const;
uft::String toString() const;
};
void atom(char const*, unsigned int);
void atom(unsigned int);
void atomID() const;
void c_str() const;
char* c_str() const;
void compare(char const*) const;
void compare(uft::String const&) const;
void compareRegion(unsigned int, char const*, unsigned int) const;
void indexOf(uft::String const&, unsigned int, unsigned int) const;
void indexOf(uft::StringBuffer const&, unsigned int, unsigned int) const;
void initUTF16(unsigned short const*, unsigned int);
void isEmpty() const;
void isInstanceOf(uft::Value const&);
void isXMLName(char const*, unsigned int);
void lastIndexOf(char const*, unsigned int) const;
void lastIndexOf(char const*, unsigned int, unsigned int, unsigned int) const;
void lastIndexOf(char, unsigned int, unsigned int) const;
void lastIndexOf(uft::String const&, unsigned int, unsigned int) const;
void lastIndexOf(uft::StringBuffer const&, unsigned int, unsigned int) const;
void length() const;
void lowercase() const;
void nullValue();
void operator!=(char const*) const;
void operator!=(uft::String const&) const;
void operator+(char const*) const;
void operator+(int) const;
void operator+(uft::String const&) const;
void operator+(uft::Value const&) const;
void operator=(uft::String const&);
void operator==(char const*) const;
void operator==(uft::String const&) const;
bool isEmpty() const;
bool isInstanceOf(uft::Value const&);
bool isXMLName(char const*, unsigned int);
int lastIndexOf(char const* token, unsigned int endCharacterIdx) const;
int lastIndexOf(char const*, unsigned int, unsigned int, unsigned int) const;
int lastIndexOf(char, unsigned int, unsigned int) const;
int lastIndexOf(uft::String const&, unsigned int, unsigned int) const;
int lastIndexOf(uft::StringBuffer const&, unsigned int, unsigned int) const;
int length() const;
uft::String lowercase() const;
uft::String nullValue();
bool operator!=(char const*) const;
bool operator!=(uft::String const&) const;
uft::TransientStringBuffer operator+(char const*) const;
uft::TransientStringBuffer operator+(int) const;
uft::TransientStringBuffer operator+(uft::String const&) const;
uft::TransientStringBuffer operator+(uft::Value const&) const;
String operator=(uft::String const&);
bool operator==(char const*) const;
bool operator==(uft::String const&) const;
void parseASCIIIdent(char const*, uft::String*, bool, char const*);
void parseDouble(char const*, double*, char const*);
void parseFloat(char const*, float*, char const*);
void skipWhitespaceOrComma(char const*, bool*, char const*);
void startsWith(char const*) const;
void startsWith(uft::String const&) const;
void substr(unsigned int, unsigned int) const;
uft::TransientStringBuffer substr(unsigned int start, unsigned int end) const;
void toString(double);
void toString(float);
void toString(int);
void toString(long long);
void uppercase() const;
void utf16length() const;
void utf8() const;
char* utf8() const;
void utf8RoundOffLen(char const*, unsigned int);
void utf8count(char const*, unsigned int, unsigned int);
{
public:
void atomID() const;
void utf8();
char* utf8();
};
void addRefStructPtr(void*);
void allocStruct(uft::StructDescriptor const*);
void clone() const;
Value clone() const;
void createdCircularReference(uft::Value const&);
void destroy();
void enterCircularReferenceCleanup(void*);
void exitCircularReferenceCleanup(void*);
void extractValue() const;
void fromStructPtr(void*);
void getBlock() const;
BlockHead* getBlock() const;
void getNumber() const;
void getStructDescriptor() const;
void init(char const*);
void init(uft::Value const&);
void init(unsigned short const*);
void init(unsigned short const*, unsigned int);
void isAtom() const;
void isFalse() const;
void isInstanceOf(uft::StructDescriptor const*) const;
void isNull() const;
void isNumber() const;
void isRefCounted() const;
void isString() const;
void isStringBuffer() const;
void isStruct() const;
void isTrue() const;
bool isAtom() const;
bool isFalse() const;
bool isInstanceOf(uft::StructDescriptor const*) const;
bool isNull() const;
bool isNumber() const;
bool isRefCounted() const;
bool isString() const;
bool isStringBuffer() const;
bool isStruct() const;
bool isTrue() const;
void makeNumber(double);
void nullValue();
void operator=(uft::Value const&);
Value nullValue();
Value operator=(uft::Value const&);
void ptrEq(uft::Value const&) const;
void query(uft::Value const&, void*) const;
void releaseStructPtr(void*);
void setNull();
void toString() const;
void toStringOrNull() const;
uft::String toString() const;
void* toStringOrNull() const;
void uniqueRef();
void* sNull;
~Vector();
virtual void vectorfn0(void) {}
virtual void vectorfn1(void) {}
void append(uft::Value const&) const;
void appendElements(uft::Tuple const&) const;
void appendElements(uft::Tuple const&, unsigned int, unsigned int) const;
void isInstanceOf(uft::Value const&);
void lastElement() const;
void lcs(uft::Vector const&);
void length() const;
int length() const;
void makeEmpty() const;
void nullValue();
void operator=(uft::Vector const&);
void operator[](unsigned int) const;
Vector operator=(uft::Vector const&);
uft::Value operator[](unsigned int) const;
void pop() const;
void range(unsigned int, unsigned int) const;
void rangeToTuple(unsigned int, unsigned int) const;
};
template<typename T>
class sref{};
class sref{
public:
~sref();
bool isInstanceOf(uft::Value const&);
void nullValue();
T* operator->() const;
void operator=(uft::sref<T> const&);
sref();
sref(uft::sref<T> const&);
};
class TraceFlag{};
include/rmsdk/xpath.h
498498
499499
500500
501
501
502502
503503
504504
void getSourceDOMNULL(uft::Value const&, uft::Set const&);
void isNodeInNodesetTrue(uft::Value const&, xpath::Context*, mdom::Node*);
void numericalValue(uft::Value const&);
void stringValue(mdom::Node const&, xpath::Context*);
uft::String stringValue(mdom::Node const&, xpath::Context*);
}
include/rmsdk_wrapper.h
1313
1414
1515
16
1716
1817
1918
......
2524
2625
2726
28
29
3027
3128
3229
33
30
31
32
33
34
35
36
37
3438
3539
3640
3741
3842
3943
40
41
42
43
44
45
46
47
48
49
50
51
52
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
5390
91
92
93
94
5495
5596
5697
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
57120
58121
59122
60123
61124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
62155
63156
64157
......
113206
114207
115208
116
209
210
117211
118212
119213
......
153247
154248
155249
156
157250
158251
159252
......
166259
167260
168261
169
170
171
172
173
262
263
174264
175
176
265
266
267
177268
178
179
180
181
269
182270
271
183272
184273
185274
186275
276
277
278
279
280
281
282
283
284
285
286
287
187288
188289
189290
......
196297
197298
198299
199
200
201
202
203
300
301
302
303
304
204305
205
306
206307
207308
208309
209
210
211
212
213
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
214358
215
216
217
218
219
220
221
222
223
224
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
225374
226
227
228
375
376
377
229378
230
231
379
380
232381
233
234
235
236
237
238
239
240
241
242
243
244
245
246
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
247398
248399
249
250
251
252
253
254
255
256
257
400
401
402
403
404
258405
406
259407
260408
261409
262410
263411
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281412
282413
283414
......
287418
288419
289420
290
421
291422
292423
293424
#include <dpdrm.h>
#include <dpio.h>
#include <dpdev.h>
#include <dplib.h>
#include <dpnet.h>
#include <QNetworkAccessManager>
class MockDevice;
// parseXML -> MetroWisDOM
class MockDRMProcessorClient: public dpdrm::DRMProcessorClient
{
public:
virtual ~MockDRMProcessorClient() {}
MockDRMProcessorClient(const char* output):
output(output), sourceName(0), targetName(0)
{}
virtual ~MockDRMProcessorClient() {
if (sourceName) free(sourceName);
if (targetName) free(targetName);
}
virtual void mockclientfn0() {LOG_FUNC();}
virtual void mockclientfn1() {LOG_FUNC();}
virtual void workflowFinished(unsigned int workflow, dp::String& str)
{
LOG(INFO, "Workflow finished " << workflow << " " << str.utf8());
}
virtual void workflowsDone(unsigned int workflows, dp::Data& data)
{
LOG(INFO, "Workflows done " << workflows);
if (data.data())
LOG(INFO, "Workflows done " << data.data());
}
virtual void mockclientfn4(dp::Data& xml) {LOG_FUNC();}
virtual void mockclientfn5(dp::String& code)
{
LOG_FUNC();
LOG(INFO, code.utf8());
LOG(DEBUG, "Workflow finished " << workflow << " " << str.utf8());
if (workflow & WORKFLOW_FULFILLMENT)
{
dp::list<dpdrm::FulfillmentItem> list = processor->getFulfillmentItems();
if (list.length())
{
// Downloaded file
uft::String url = list[0]->getDownloadURL().uft();
int slashIdx = url.lastIndexOf("/", url.length());
/*
Extract name without extension from url like :
http://acs.tea-ebook.com/media/a2192551-57b1-4de7-b19c-2e7f4579b91f.epub
*/
uft::String tmpName = url.substr(slashIdx+1, url.length()-5);
uft::String fullTmpName = uft::String("/tmp/") + tmpName;
sourceName = strdup(fullTmpName.utf8());
dp::String title = getMetadata(list[0], "title");
uft::String fullName;
if (output)
targetName = strdup(output);
else if (title.utf8())
{
uft::String fullName = title.uft() + ".epub";
targetName = fullName.utf8();
if (!targetName || !strlen(targetName))
targetName = (char*) "output.epub";
else
targetName = strdup(targetName);
}
else
{
uft::String fullName = tmpName + ".epub";
targetName = fullName.utf8();
if (!targetName || !strlen(targetName))
targetName = (char*) "output.epub";
else
targetName = strdup(targetName);
}
}
}
}
virtual void mockclientfn3(void) {LOG_FUNC();}
virtual void mockclientfn4(void) {LOG_FUNC();}
virtual void mockclientfn5(void) {LOG_FUNC();}
virtual void workflowProgress(unsigned int workflow, dp::String& title, double progress)
{
LOG(WARN, "Progress " << workflow << " " << title.utf8() << " " << progress << " %%");
if (workflow & WORKFLOW_DOWNLOAD)
{
if (progress == 100.0)
{
// Copy tmp file into destination
QFile file(targetName);
if (file.exists())
{
LOG(DEBUG, "Removing existant target");
file.remove();
}
if (QFile::rename(sourceName, targetName))
{
LOG(INFO, "Created \"" << targetName << "\"");
}
else
{
LOG(ERROR, "Unable to copy \"" << sourceName << "\" into \"" << targetName << "\"");
}
}
}
}
virtual void workflowError(unsigned int workflow, dp::String& error)
{
LOG(ERROR, "Workflow error " << workflow << " " << error.utf8());
}
void setProcessor(adept::DRMProcessorImpl* processor)
{ this->processor = processor; }
private:
adept::DRMProcessorImpl* processor;
const char* output;
char* sourceName;
char* targetName;
/*
Try to get metadata with :
* DC. + name
* dc. + name
* name
*/
dp::String getMetadata(dp::ref<dpdrm::FulfillmentItem> item, const char* name)
{
uft::String newName = uft::String("DC.") + name;
dp::String res = item->getMetadata(newName.utf8());
if (res.utf8())
return res;
newName = uft::String("dc.") + name;
res = item->getMetadata(newName);
if (res.utf8())
return res;
return item->getMetadata(name);
}
};
class MockPartition : public dpio::Partition
file.write((const char*)data.data(), data.length());
file.close();
callback->reportProgress(100.0);
}
virtual void removeFile( const dp::String& path, dp::Callback* callback )
virtual bool unmount(const dp::String& root)
{
LOG_FUNC();
std::cout << root.utf8() << std::endl;
return true;
}
virtual void mockproviderfn0(void) {LOG_FUNC();}
};
class MockDevice : public dpdev::Device
{
private:
unsigned char *_activationRecord;
int _activationRecordLength;
class MockDevice : public dpdev::Device, public mdom::DocumentHandler
{
public:
MockDevice(dpdrm::DRMProcessorClient* processorClient) :deviceProvider(0), processorClient(processorClient) {
partition = new MockPartition(this, 0, "root", "Fixed", "/home/soutade/kobo/mock/root", "/home/soutade/kobo/mock/root/doc", "/home/soutade/kobo/mock/root/tmp");
MockDevice(dpdrm::DRMProcessorClient* processorClient, char* deviceFile, char* activationFile, char* devkeyFile) :deviceProvider(0), processorClient(processorClient)
{
partition = new MockPartition(this, 0, "root", "Fixed", "/tmp", "/tmp", "/tmp");
_activationRecord = (unsigned char*)malloc(15*1024);
int fd = open("root/activation.xml", O_RDONLY);
_activationRecordLength = read(fd, _activationRecord, 15*1024);
close (fd);
readFile(activationFile, &activationRecord, &activationRecordLength);
/* Default values */
dp::setVersionInfo("hobbes", "9.2.38311");
dp::setVersionInfo("clientVersion", "Boo Reader");
dp::setVersionInfo("clientOS", "Linux 2.6.32 armv7l");
dp::setVersionInfo("clientLocale", "fr");
unsigned char* deviceXML;
readFile(deviceFile, &deviceXML, 0, true);
wisdom = adept::parseXML((const char*)deviceXML);
mdom::Node node = wisdom->getRoot();
node.walkBranch(this);
// deviceXML is already freed...
// delete[] deviceXML;
readFile(devkeyFile, &devkey, &devkeyLength);
}
void setProvider(dpdev::DeviceProvider* deviceProvider)
virtual void prepareDeviceKey() {LOG_FUNC();}
virtual dpdev::DeviceProvider* getProvider() {LOG_FUNC(); return deviceProvider;}
virtual int getIndex() {LOG_FUNC(); return 0;}
virtual dp::String getDeviceName();
virtual dp::Data getDeviceKey();
virtual dp::String getDeviceType();
virtual dp::Data getFingerprint();
virtual dp::Data getActivationRecord();
virtual dp::String getDeviceName() {LOG_FUNC(); return deviceName;}
virtual dp::Data getDeviceKey() {LOG_FUNC(); return dp::Data(devkey, devkeyLength);}
virtual dp::String getDeviceType() {LOG_FUNC(); return deviceType;}
virtual dp::Data getFingerprint() {LOG_FUNC(); return fingerprint;}
virtual dp::Data getActivationRecord() {LOG_FUNC(); return dp::Data(activationRecord, activationRecordLength);}
virtual void setActivationRecord(const dp::Data& data);
virtual dpio::Partition* getPartition(int index);
virtual dpio::Partition* getPartition(int index) {LOG_FUNC(); return partition;}
virtual dp::String getVersionInfo(const dp::String& name);
virtual bool isTrusted() {LOG_FUNC();return false;};
private:
dpdev::DeviceProvider* deviceProvider;
dpdrm::DRMProcessorClient* processorClient;
dpio::Partition* partition;
};
/* mdom::DocumentHandler */
virtual bool characters(uft::Value const&) {return true;}
virtual bool comment(uft::Value const&) {return true;}
virtual bool endDocument() {return true;}
virtual bool endElement(uft::Value const& p0, uft::Value const& p1, uft::Value const& p2) {return true;}
virtual bool endEntity(uft::Value const&) {return true;}
virtual bool processingInstruction(uft::Value const&, uft::Value const&) {return true;}
virtual bool startDocument() {return true;}
virtual bool startElement(mdom::Node const& node, uft::Value const& xmlns, uft::Value const& element, uft::Value const& ns, mdom::NameValueIterator* attributesIterator) {
if (!element.isNull() && element.isString())
{
int i=0;
char* name = element.toString().c_str();
uft::String value = adept::getChildValue(node, 3);
if (!strcmp(name, "deviceClass"))
deviceClass = dp::String(value.utf8());
else if (!strcmp(name, "deviceSerial"))
deviceSerial = dp::String(value.utf8());
else if (!strcmp(name, "deviceName"))
deviceName = dp::String(value.utf8());
else if (!strcmp(name, "deviceType"))
deviceType = dp::String(value.utf8());
// <adept:version name="hobbes" value="9.2.38311">
else if (!strcmp(name, "version"))
{
/* Hardcode decode because p0 is a structure */
uft::Value p0, p1;
attributesIterator->next(&p0, &p1);
char* attrName = p1.toString().c_str();
attributesIterator->next(&p0, &p1);
char* attrValue = p1.toString().c_str();
if (attrName && attrValue)
dp::setVersionInfo(attrName, attrValue);
i++;
}
else if (!strcmp(name, "fingerprint"))
{
unsigned char rawFingerprint[32];
int res = dp::decodeBase64(value.c_str(), rawFingerprint, sizeof(rawFingerprint));
fingerprint = dp::Data(rawFingerprint, res);
}
i++;
}
return true;
}
virtual bool startEntity(uft::Value const&) {return true;}
dp::String MockDevice::getDeviceName() {
LOG_FUNC();
return "Cybook Gen5";}
dp::String MockDevice::getDeviceType() {
LOG_FUNC();
return "mobile";}
dp::Data MockDevice::getFingerprint() {
LOG_FUNC();
// "dXK7MBnU3f4g5F15uogDRMADpgM=" From device.xml
static unsigned char fingerprint[] =
static int readFile(char* filePath, unsigned char** res, int* length = 0, bool addFinalZero=false)
{
int _length, fd;
QFile file(filePath);
if (!length) length = &_length;
if (addFinalZero)
*res = new unsigned char[file.size()+1];
else
*res = new unsigned char[file.size()];
fd = open(filePath, O_RDONLY);
*length = read(fd, *res, file.size());
close (fd);
if (*length > 0 && addFinalZero)
{
0x75, 0x72, 0xbb, 0x30, 0x19, 0xd4, 0xdd, 0xfe, 0x20, 0xe4, 0x5d, 0x79,
0xba, 0x88, 0x03, 0x44, 0xc0, 0x03, 0xa6, 0x03
};
(*res)[*length] = 0;
*length += 1;
}
return dp::Data(fingerprint, sizeof(fingerprint));
}
return *length;
}
dp::Data MockDevice::getDeviceKey() {
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));
}
dp::Data MockDevice::getActivationRecord() {
LOG_FUNC();
return dp::Data(_activationRecord, _activationRecordLength);
}
private:
dpdev::DeviceProvider* deviceProvider;
dpdrm::DRMProcessorClient* processorClient;
unsigned char *activationRecord;
int activationRecordLength;
unsigned char *devkey;
int devkeyLength;
dpio::Partition* partition;
dp::String deviceSerial;
dp::String deviceClass;
dp::String deviceName;
dp::String deviceType;
dp::Data fingerprint;
MetroWisDOM* wisdom;
};
void MockDevice::setActivationRecord( const dp::Data& data ) {
LOG_FUNC();
free(_activationRecord);
_activationRecordLength = data.length();
_activationRecord = (unsigned char*)malloc(_activationRecordLength);
memcpy(_activationRecord, data.data(), _activationRecordLength);
LOG(DEBUG, "New activation record :" << std::endl << _activationRecord);
}
dpio::Partition * MockDevice::getPartition( int index ) {
LOG_FUNC();
return partition;
delete[] activationRecord;
activationRecordLength = data.length();
activationRecord = new unsigned char[activationRecordLength];
memcpy(activationRecord, data.data(), activationRecordLength);
LOG(DEBUG, "New activation record :" << std::endl << activationRecord);
}
dp::String MockDevice::getVersionInfo( const dp::String& name ) {
LOG_FUNC();
LOG(DEBUG, ">>> " << name.utf8());
dp::String res = dp::getVersionInfo(name);
return res;
//return dp::String("3.19.5761");//"9.2.38311";
const char* verName = name.utf8();
if (!strcmp(verName, dp::String("hobbes").utf8()))
//return dp::String("9.2.38311");
return dp::String("<adept:version name=\"hobbes\" value=\"9.2.38311\">");
if (!strcmp(verName, dp::String("clientVersion").utf8()))
return dp::String("<adept:version name=\"clientVersion\" value=\"Boo Reader\">");
// return dp::String("Boo Reader");
if (!strcmp(verName, dp::String("clientOS").utf8()))
return dp::String("<adept:version name=\"clientOS\" value=\"Linux 2.6.32 armv7l\">");
// return dp::String("Linux 2.6.32 armv7l");
if (!strcmp(verName, dp::String("clientLocale").utf8()))
return dp::String("<adept:version name=\"clientLocale\" value=\"fr\">");
// return dp::String("fr");
else
std::cout << "UNKNOWN" << std::endl;
return dp::String("0");
}
class MockStream : public dpio::Stream {
method(method), url(url), client(client)
{
LOG(INFO, "New stream " << method.utf8() << " " << url.utf8());
LOG(DEBUG, "New stream " << method.utf8() << " " << url.utf8());
QNetworkRequest request(QUrl(url.utf8()));
request.setRawHeader("Accept", "*/*");
src/main.cpp
66
77
88
9
10
11
129
1310
1411
1512
1613
1714
18
19
15
2016
21
22
23
24
25
17
18
19
20
21
2622
2723
2824
......
3228
3329
3430
35
31
3632
3733
3834
3935
4036
4137
42
38
4339
4440
4541
......
5349
5450
5551
56
57
52
53
5854
5955
60
6156
6257
6358
......
6560
6661
6762
63
6864
6965
66
67
7068
71
69
70
7271
73
74
75
76
72
7773
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
74
9675
9776
98
99
77
10078
10179
10280
103
10481
10582
83
10684
10785
10886
......
141119
142120
143121
144
122
145123
146124
147125
......
158136
159137
160138
161
139
162140
163141
164142
......
181159
182160
183161
184
162
185163
186164
187
165
188166
189167
190
168
191169
192170
193
171
194172
195173
196
174
197175
198176
199177
......
208186
209187
210188
211
189
212190
213191
214192
215193
216194
217
218
195
196
219197
220
198
221199
222
223
200
201
224202
225203
226204
227
205
228206
229
230
207
208
231209
232210
233211
......
248226
249227
250228
251
252
253229
254230
255231
#include <QFile>
#include <QCoreApplication>
// #include <QRunnable>
// #include <QThreadPool>
#include <QThread>
#include <dp.h>
#include <rmsdk_wrapper.h>
#define ARRAY_SIZE(arr) (sizeof(arr)/sizeof(arr[0]))
int verbose = DEBUG;
// int verbose = INFO;
int verbose = INFO;
static char* device_file = 0;
static char* activation_file = 0;
static char* device_key_file = 0;
static char* acsm_file = 0;
static char* output_file = 0;
static char* deviceFile = 0;
static char* activationFile = 0;
static char* devicekeyFile = 0;
static char* acsmFile = 0;
static char* outputFile = 0;
class ACSMDownloader
{
{
}
static void* run(void* param)
{
ACSMDownloader* _this;
LOG_FUNC();
int ret = dp::platformInit(/*dp::PI_DEFAULT*/ 0xFFFFFFFF);
int ret = dp::platformInit(0xFFFFFFFF);
if (ret) {
LOG(ERROR, "Error platform init " << ret);
LOG(DEBUG, "Create Adobe objects");
MockDRMProcessorClient processorClient;
MockDevice device(&processorClient);
MockDRMProcessorClient processorClient(outputFile);
MockDevice device(&processorClient, deviceFile, activationFile, devicekeyFile);
MockProvider provider(&device);
device.setProvider(&provider);
//MockLibrary library;
dpdev::DeviceProvider::addProvider(&provider);
MockNetProvider netProvider;
adept::DRMProviderImpl* _prov = rmsdk::getProvider();
LOG(DEBUG, "Create DRM Processor");
adept::DRMProcessorImpl* drmprocessor = _prov->createDRMProcessor(&processorClient, &device);
processorClient.setProcessor(drmprocessor);
unsigned char* buffer;
int fd = open(acsm_file, O_RDONLY);
int buffer_size;
MockDevice::readFile(acsmFile, &buffer, &buffer_size, true);
QFile file(acsm_file);
buffer = new unsigned char[file.size()];
ret = read(fd, buffer, file.size());
close (fd);
LOG(DEBUG, "Init workflow ");
LOG(DEBUG, "Init workflow " << ret);
enum DRMWorkflow
{
DW_SIGN_IN = 0x0001,
DW_AUTH_SIGN_IN = 0x0002,
DW_ADD_SIGN_IN = 0x0004,
DW_ACTIVATE = 0x0010,
DW_FULFILL = 0x0020,
DW_ENABLE_CONTENT = 0x0040,
DW_LOAN_RETURN = 0x0080,
DW_UPDATE_LOANS = 0x0100,
DW_DOWNLOAD = 0x0200,
DW_NOTIFY = 0x1000,
DW_ALL_POSSIBLE = 0xFFFFFFFF
};
drmprocessor->initWorkflows(DW_NOTIFY|DW_DOWNLOAD|DW_AUTH_SIGN_IN|DW_FULFILL, dp::Data(buffer,ret));
drmprocessor->initWorkflows(WORKFLOW_AUTH_SIGN_IN|WORKFLOW_FULFILLMENT|WORKFLOW_DOWNLOAD|WORKFLOW_NOTIFICATION, dp::Data(buffer, buffer_size));
LOG(DEBUG, "Start work");
drmprocessor->startWorkflows(DW_NOTIFY|DW_DOWNLOAD|DW_AUTH_SIGN_IN|DW_FULFILL);
int res = drmprocessor->startWorkflows(WORKFLOW_AUTH_SIGN_IN|WORKFLOW_FULFILLMENT|WORKFLOW_DOWNLOAD|WORKFLOW_NOTIFICATION);
delete[] buffer;
LOG(DEBUG, "Bye bye");
;
_this->app->exit(0);
return 0;
}
std::cout << " " << "-d|--device-file" << "\t" << "device.xml file from ereader" << std::endl;
std::cout << " " << "-a|--activation-file" << "\t" << "activation.xml file from ereader" << std::endl;
std::cout << " " << "-k|--device-key-file" << "\t" << "device key file (eg devkey.bin) from ereader" << std::endl;
std::cout << " " << "-k|--device-key-file" << "\t" << "private device key file (eg devkey.bin) from ereader" << std::endl;
std::cout << " " << "-o|--output-file" << "\t" << "Optional output epub filename" << std::endl;
std::cout << " " << "-f|--acsm-file" << "\t" << "ACSM request file for epub download" << std::endl;
std::cout << " " << "-v|--verbose" << "\t\t" << "Increase verbosity, can be set multiple times" << std::endl;
{
int c;
char** files[] = {&device_key_file, &acsm_file};
char** files[] = {&devicekeyFile, &acsmFile};
while (1) {
int this_option_optind = optind ? optind : 1;
switch (c) {
case 'd':
device_file = optarg;
deviceFile = optarg;
break;
case 'a':
activation_file = optarg;
activationFile = optarg;
break;
case 'k':
device_key_file = optarg;
devicekeyFile = optarg;
break;
case 'f':
acsm_file = optarg;
acsmFile = optarg;
break;
case 'o':
output_file = optarg;
outputFile = optarg;
break;
case 'v':
verbose++;
}
}
if (!device_key_file || !acsm_file)
if (!devicekeyFile || !acsmFile)
{
usage();
return -1;
}
QString _device_file = findFile(device_file);
QString _activation_file = findFile(activation_file);
QString _deviceFile = findFile(deviceFile);
QString _activationFile = findFile(activationFile);
if (!_device_file.size())
if (!_deviceFile.size())
{
device_file = (device_file) ?: (char*)"device.xml";
LOG(ERROR, "Error : " << device_file << " not found");
deviceFile = (deviceFile) ?: (char*)"device.xml";
LOG(ERROR, "Error : " << deviceFile << " not found");
return -1;
}
if (!_activation_file.size())
if (!_activationFile.size())
{
activation_file = (activation_file) ?: (char*)"activation.xml";
LOG(ERROR, "Error : " << activation_file << " not found");
activationFile = (activationFile) ?: (char*)"activation.xml";
LOG(ERROR, "Error : " << activationFile << " not found");
return -1;
}
QCoreApplication app(argc, argv);
ACSMDownloader downloader(&app);
// QThread<void (*)(void*)>* thread = QThread::create(ACSMDownloader::run, (void*)&downloader);
// thread->start();
pthread_t thread;
pthread_create(&thread, NULL, ACSMDownloader::run, (void*)&downloader);

Archive Download the corresponding diff file

Branches