My favorites | Sign in
Project Home Downloads Source
Checkout   Browse   Changes    
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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
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
#ifndef _ProtectClient_h_
#define _ProtectClient_h_

#include <Web/Web.h>
#include <Cypher/Cypher.h>

#include<ProductVersion/ProductVersion.h>

#include "ProtectStatus.h"

NAMESPACE_UPP

class ProtectClient
{
private:

// the HTTP client
HttpClient client;

// last error code for failed operations
int lastError;

// the cypher -- can be changed between available
// in Cypher package
One<Cypher>cypher;

// client id -- got from server upon connection
dword clientID;

// user data
String userEMail;

String userName;
String userSurname;
String userZone;
String userCountry;
String userZIP;
String userTown;
String userAddress;
String userPhone;
String userFax;
String userCell;

// license expire time and number of them
Time expireTime;
int numLicenses;

// activation key -- given once from server
// upon activation request on this machine
String activationKey;

// version of current app installed
ProductVersion currentVersion;

// maximum allowable version for this client
ProductVersion maxAllowedVersion;

// key for encrypted communication
String communicationKey;

// user configuration path
String userConfigPath;

// flag indicating that config has been loaded
// (we must delay loda because of settable userConfigPath)
bool configLoaded;

protected:

// sends a VectorMap to server in encrypted form
// and gets its response also in VectorMap form
VectorMap<String, Value> SendMap(VectorMap<String, Value> const &v);

public:

// constructor
ProtectClient();

// destructor
~ProtectClient();

// stores/retrieve config data from stream
void Xmlize(XmlIO xml);
bool StoreConfig(void);
bool LoadConfig(void);

// sets user configuration path
ProtectClient &SetUserConfigPath(String const &path) { userConfigPath = path; return *this; }

// sets the encrypting engine
// default Cypher at startup is Snow2
// WARNING -- takes Cypher ownership
void SetCypher(Cypher *c);

// sets server's URL
ProtectClient &SetURL(String const &url) { client.URL(url); return *this; }

// sets communication key
ProtectClient &SetCommunicationKey(String const &_key) { communicationKey = _key; return *this; }

// read last error code and message
int GetLastError(void) { return lastError; }
String GetLastErrorMsg(void) { return ProtectMessage(lastError); }

// create a persistent link to server
bool Connect(void);

// disconnect from server
bool Disconnect(void);

// refresh server connection
bool Refresh(void);

// get license key
String GetLicenseKey(void);

// gets license info
bool GetLicenseInfo(void);

// updates user data on server
bool UpdateUserData(void);

// register app
bool Register(void);

// set user data -- for registration
// filled automatically by GETLICENSEINFO request
ProtectClient &SetUserEMail(String const &mail) { userEMail = mail; return *this; }
ProtectClient &SetUserName(String const &name) { userName = name; return *this; }
ProtectClient &SetUserSurname(String const &surname) { userSurname = surname; return *this; }
ProtectClient &SetUserZone(String zone) { userZone = zone; return *this; }
ProtectClient &SetUserCountry(String const &country) { userCountry = country; return *this; }
ProtectClient &SetUserZip(String const &zip) { userZIP = zip; return *this; }
ProtectClient &SetUserTown(String const &town) { userTown = town; return *this; }
ProtectClient &SetUserAddress(String const &address) { userAddress = address; return *this; }
ProtectClient &SetUserPhone(String const &phone) { userPhone = phone; return *this; }
ProtectClient &SetUserFax(String const &fax) { userFax = fax; return *this; }
ProtectClient &SetUserCell(String const &cell) { userCell = cell; return *this; }
ProtectClient &SetCurrentVersion(ProductVersion const &v) { currentVersion = v; return *this; }
ProtectClient &SetActivationKey(String const &key) { activationKey = key; StoreConfig(); return *this; }

String GetUserEMail(void) { return userEMail; }
String GetUserName(void) { return userName; }
String GetUserSurname(void) { return userSurname; }
String GetUserZone(void) { return userZone; }
String GetUserCountry(void) { return userCountry; }
String GetUserZip(void) { return userZIP; }
String GetUserTown(void) { return userTown; }
String GetUserAddress(void) { return userAddress; }
String GetUserPhone(void) { return userPhone; }
String GetUserFax(void) { return userFax; }
String GetUserCell(void) { return userCell; }
ProductVersion GetCurrentVersion(void) { return currentVersion; }
ProductVersion GetMaxAllowedVersion(void) { return maxAllowedVersion; }
String GetActivationKey(void) { LoadConfig(); return activationKey; }
Time GetExpireTime(void) { return expireTime; }
};

END_UPP_NAMESPACE

#endif

Change log

r4587 by micio on Feb 13, 2012   Diff
Bazaar/Protect : Added some fields to
users database
Go to: 
Project members, sign in to write a code review

Older revisions

r3190 by micio on Feb 10, 2011   Diff
Bazaar/Protect : fixed Expire field
name in license info
r3126 by micio on Jan 30, 2011   Diff
Bazaar/Protect : added some statistic
fields do client/server part
r3119 by micio on Jan 29, 2011   Diff
Bazaar / Protect : Removed Updater
dependency, added ProductVersion one
Start changing authentication method
All revisions of this file

File info

Size: 4990 bytes, 161 lines
Powered by Google Project Hosting