1998-02-13 13:46:18 +00:00
|
|
|
#ifndef __DONGLE_H
|
|
|
|
#define __DONGLE_H
|
|
|
|
|
2011-09-22 15:24:04 +00:00
|
|
|
#ifndef __ARRAY_H
|
|
|
|
#include <array.h>
|
|
|
|
#endif
|
|
|
|
|
1998-02-13 13:46:18 +00:00
|
|
|
#ifndef __DATE_H
|
|
|
|
#include <date.h>
|
|
|
|
#endif
|
|
|
|
|
2012-04-10 07:44:40 +00:00
|
|
|
#ifndef __MODAUT_H
|
|
|
|
#include <modaut.h>
|
|
|
|
#endif
|
|
|
|
|
1998-02-13 13:46:18 +00:00
|
|
|
#ifndef __STRINGS_H
|
|
|
|
#include <strings.h>
|
|
|
|
#endif
|
|
|
|
|
2012-02-22 17:03:39 +00:00
|
|
|
enum TDongleHardware { _dongle_unknown, _dongle_hardlock, _dongle_eutron, _dongle_network, _dongle_ssa };
|
2007-02-23 08:17:38 +00:00
|
|
|
enum TDongleType { _no_dongle, _user_dongle, _developer_dongle, _aga_dongle };
|
1998-02-13 13:46:18 +00:00
|
|
|
|
|
|
|
class TDongle : public TObject
|
|
|
|
{
|
|
|
|
TDongleHardware _hardware;
|
|
|
|
TDongleType _type;
|
1999-05-24 13:34:11 +00:00
|
|
|
|
2009-01-15 16:55:07 +00:00
|
|
|
TString _admin, _admpwd, _reseller, _product, _shortname;
|
2009-05-20 15:36:38 +00:00
|
|
|
int _OEM;
|
1998-02-13 13:46:18 +00:00
|
|
|
|
|
|
|
word _serno, _max_users, _year_assist;
|
|
|
|
word _eprom[64];
|
|
|
|
TDate _last_update;
|
|
|
|
TBit_array _module;
|
2007-06-01 09:44:03 +00:00
|
|
|
TBit_array _shown;
|
1998-02-13 13:46:18 +00:00
|
|
|
bool _dirty;
|
1999-03-22 15:55:50 +00:00
|
|
|
|
2006-12-13 16:22:33 +00:00
|
|
|
TString_array _info; // Informazioni sui moduli
|
1998-02-13 13:46:18 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
bool already_programmed() const;
|
2006-12-13 16:22:33 +00:00
|
|
|
void set_developer_permissions();
|
1998-02-13 13:46:18 +00:00
|
|
|
bool hardlock_login(bool test_all_dongles);
|
|
|
|
bool eutron_login(bool test_all_dongles);
|
2010-12-23 09:24:46 +00:00
|
|
|
bool network_login(bool test_all_dongles);
|
2012-02-22 17:03:39 +00:00
|
|
|
|
|
|
|
bool ssa_login(const char* mod);
|
|
|
|
bool ssa_test_module(const char* mod);
|
|
|
|
bool ssa_logout();
|
1998-02-13 13:46:18 +00:00
|
|
|
|
|
|
|
bool burn_hardlock();
|
|
|
|
bool burn_eutron();
|
1998-05-28 10:09:12 +00:00
|
|
|
|
|
|
|
int can_try_server() const;
|
2006-12-13 16:22:33 +00:00
|
|
|
const TString_array& info() const; // Array di coppie modulo|descrizione
|
1998-02-13 13:46:18 +00:00
|
|
|
|
|
|
|
public: // TObject
|
|
|
|
virtual bool ok() const
|
2010-10-06 13:32:08 +00:00
|
|
|
{ return _hardware != _dongle_unknown && _type != _no_dongle && _serno != 0xFFFF; }
|
1998-02-13 13:46:18 +00:00
|
|
|
|
|
|
|
public:
|
2006-12-13 16:22:33 +00:00
|
|
|
bool login(bool test_all_dongles = false);
|
2012-02-22 17:03:39 +00:00
|
|
|
bool login(const char* module);
|
1998-02-13 13:46:18 +00:00
|
|
|
bool logout();
|
|
|
|
|
|
|
|
word number() const { return _serno; }
|
|
|
|
word max_users() const { return _max_users; }
|
|
|
|
word year_assist() const { return _year_assist; }
|
|
|
|
|
|
|
|
void garble(word* data) const;
|
|
|
|
|
|
|
|
// Solo per un po' di tempo, poi diverranno protected (servono a ba1500 old style)
|
|
|
|
bool read_words(word reg, word len, word *data) const;
|
|
|
|
bool write_words(word reg, word len, word *data) const;
|
|
|
|
|
|
|
|
TDongleType type() const { return _type; }
|
|
|
|
|
2006-12-13 16:22:33 +00:00
|
|
|
bool active(word module) const;
|
|
|
|
bool activate(word module, bool on = true);
|
|
|
|
void deactivate(word module) { activate(module, false); }
|
|
|
|
void set_max_users(word u) { _max_users = u; _dirty = true; }
|
|
|
|
void set_year_assist(word y) { _year_assist = y; _dirty = true; }
|
1998-02-13 13:46:18 +00:00
|
|
|
const TDate& last_update() const { return _last_update; }
|
|
|
|
|
|
|
|
bool dirty() const { return _dirty; }
|
|
|
|
bool burn();
|
|
|
|
|
|
|
|
TDongleHardware hardware() const { return _hardware; }
|
2012-03-01 14:03:42 +00:00
|
|
|
bool local() const { return _hardware != _dongle_network && ok(); }
|
1998-02-13 13:46:18 +00:00
|
|
|
bool network() const { return _hardware == _dongle_network; }
|
2006-12-13 16:22:33 +00:00
|
|
|
const TString& administrator(TString* pwd = NULL) const;
|
2009-05-20 15:36:38 +00:00
|
|
|
int oem() const;
|
2006-12-13 16:22:33 +00:00
|
|
|
const TString& reseller() const;
|
2009-01-15 15:08:18 +00:00
|
|
|
const TString& product() const;
|
2010-02-09 10:11:25 +00:00
|
|
|
const TString& short_name() const;
|
|
|
|
const TString& server_name() const;
|
2006-12-13 16:22:33 +00:00
|
|
|
|
|
|
|
word module_name2code(const char* module) const; // Converte un nome di due lettere in numero
|
|
|
|
const TString& module_code2name(word module) const; // ... e viceversa
|
|
|
|
const TString& module_code2desc(word module) const; // Descrizione estesa del modulo
|
2009-02-23 11:37:37 +00:00
|
|
|
const TString& module_name2desc(const char* mod) const; // Converte un nome di due lettere in descrizione
|
|
|
|
|
2006-12-13 16:22:33 +00:00
|
|
|
bool shown(word module) const; // Stabilisce se un modulo e' visibile in installazione
|
|
|
|
bool hidden(word module) const { return !shown(module); } // Modulo invisibile
|
2009-10-28 10:19:18 +00:00
|
|
|
bool demo() const;
|
2006-12-13 16:22:33 +00:00
|
|
|
|
1998-02-13 13:46:18 +00:00
|
|
|
TDongle();
|
|
|
|
virtual ~TDongle();
|
|
|
|
};
|
|
|
|
|
2010-01-04 10:08:35 +00:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Tdninst
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
class Tdninst : public TObject
|
|
|
|
{
|
|
|
|
int _year_assist;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
int assistance_year2solar(int ay) const;
|
2010-01-18 15:40:27 +00:00
|
|
|
int parse_date(const TString& line, TString& key, TDate& d) const;
|
2010-12-23 09:24:46 +00:00
|
|
|
bool compare_cmdline(const TString& cmdline, const TString& pattern) const;
|
2010-01-04 10:08:35 +00:00
|
|
|
|
|
|
|
public:
|
2011-09-30 16:15:11 +00:00
|
|
|
virtual bool ok() const { return _year_assist >= 2091; }
|
2010-01-04 10:08:35 +00:00
|
|
|
int assist_year() const { return _year_assist; }
|
|
|
|
int solar_year() const { return assistance_year2solar(_year_assist); }
|
|
|
|
int test_cmdline(const TString& cmdline, bool key_must_exist, TString& msg) const;
|
2010-01-26 11:06:08 +00:00
|
|
|
bool can_I_run(const bool is_personal_program = false) const;
|
2011-04-06 14:07:23 +00:00
|
|
|
bool find_serno() const;
|
2010-01-04 10:08:35 +00:00
|
|
|
bool find_killed(TToken_string& kill_list) const;
|
2011-04-06 14:07:23 +00:00
|
|
|
bool find_expiring(int days, TString& module, TDate& expires) const;
|
2011-09-22 15:24:04 +00:00
|
|
|
int check_customer() const;
|
|
|
|
|
|
|
|
bool decode(const TString& txt) const; // dninst.zip -> dninst.txt
|
|
|
|
bool encode(const TString& txt) const; // dninst.txt -> dninst.zip
|
2011-04-06 14:07:23 +00:00
|
|
|
|
2010-01-04 10:08:35 +00:00
|
|
|
Tdninst();
|
|
|
|
};
|
|
|
|
|
1998-02-13 13:46:18 +00:00
|
|
|
TDongle& dongle();
|
|
|
|
bool destroy_dongle();
|
|
|
|
|
2010-10-06 13:32:08 +00:00
|
|
|
#endif
|