upravy opravy
This commit is contained in:
@@ -20,9 +20,19 @@ const BYTE cnibblescount = 32;
|
||||
|
||||
const string cidFilePath = "";
|
||||
|
||||
struct SDCardInfo
|
||||
{
|
||||
uint32_t cardSize {};
|
||||
uint32_t serialNumber {};
|
||||
string date = "";
|
||||
uint8_t manufacturerID {};
|
||||
char oemID[2] = {};
|
||||
char name[5] = {};
|
||||
bool isLoaded = false;
|
||||
};
|
||||
|
||||
class SDCard
|
||||
{
|
||||
|
||||
struct SDCardData
|
||||
{
|
||||
uint8_t isCorrectLoad = 0; // SD karta je korektne nactena //bool vs byte ?
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include <map>
|
||||
#include <stdint.h>
|
||||
|
||||
using namespace std;
|
||||
@@ -51,9 +52,9 @@ enum class GeneralError
|
||||
|
||||
enum class ELCType
|
||||
{
|
||||
ELC1 = 1, //starý původní licenční soubor
|
||||
ELC2 = 2, //modifikovaný starý licenční soubor umoznující modifikace dle paramatetrů
|
||||
ELC3 = 3 //budoucí softwarový licenční soubor, který není zalození na existenci CID a CSD
|
||||
ELC1 = 1, //starý původní licenční soubor zalozený na CID a CSD
|
||||
ELC2 = 2, //modifikovaný starý licenční soubor umoznující modifikace (šifrování, název) dle parametrů
|
||||
ELC3 = 3 //budoucí softwarový licenční soubor, který není zalozený na existenci CID a CSD, ale na unikátním ID instalace linuxu
|
||||
};
|
||||
enum class ELCSubType
|
||||
{
|
||||
@@ -110,7 +111,6 @@ struct LicenceIdentification
|
||||
LicenceType licLicenceType;
|
||||
string licTypeName = "";
|
||||
PlcType licPlcType;
|
||||
|
||||
uint8_t licenceVersion = 1; // verze licence, určuje kodování, pojmenování souborů
|
||||
uint8_t licenceIndex = 0; //index licenčního souboru v případě, ze jich je víc
|
||||
uint8_t revision;
|
||||
@@ -123,15 +123,14 @@ struct LicenceIdentification
|
||||
/// @brief obecná struktura pro reader
|
||||
struct LicenceInfoGeneral
|
||||
{
|
||||
int reqDataPointsCount = 0;
|
||||
unordered_map<int, int> licences = {};
|
||||
map<DWORD, DWORD> licences = {};
|
||||
};
|
||||
|
||||
/// @brief obecná struktura polozky licence, defaultní kompatibilita
|
||||
struct LicenceItem
|
||||
{
|
||||
int protocolId = -1;
|
||||
int dataPointsCount = 0;
|
||||
DWORD protocolId {};
|
||||
DWORD dataPointsCount {};
|
||||
};
|
||||
|
||||
/* struktury pro ELC 1 */
|
||||
@@ -159,26 +158,26 @@ struct LicenceELC1Item
|
||||
//defaultní struktura pro ELC 2
|
||||
struct LicenceELC2Info
|
||||
{
|
||||
unordered_map<int, int> licences = {};
|
||||
map<DWORD, DWORD> licences = {};
|
||||
};
|
||||
|
||||
struct LicenceELC2Info_1
|
||||
{
|
||||
unordered_map<int, int> licences = {};
|
||||
};
|
||||
// struct LicenceELC2Info_1
|
||||
// {
|
||||
// map<int, int> licences = {};
|
||||
// };
|
||||
|
||||
//defaultni struktura polozky ELC 2
|
||||
struct LicenceELC2Item
|
||||
{
|
||||
int protocolId = -1;
|
||||
int dataPointsCount = 0;
|
||||
DWORD protocolId {};
|
||||
DWORD dataPointsCount {};
|
||||
};
|
||||
|
||||
//struktura polozky ELC 2,
|
||||
struct LicenceELC2Item_1
|
||||
{
|
||||
int protocolId = -1;
|
||||
int dataPointsCount = 0;
|
||||
DWORD protocolId {};
|
||||
DWORD dataPointsCount {};
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -29,22 +29,21 @@ public:
|
||||
// struct __attribute__((__packed__)) LicencePublicHeader
|
||||
struct LicenceIdentDataHeader
|
||||
{
|
||||
BYTE licenceType = 0; // EOSEOV, DRT ...
|
||||
BYTE licenceType {}; // EOSEOV, DRT ...
|
||||
BYTE licenceTypeVersion = 1; // verze licence, urcuje nuance sifrování a pojmenování souborů
|
||||
BYTE licenceIndex = 0; // puvodní post fix, identifikátor pro více licencí
|
||||
BYTE licenceIndex {}; // puvodní post fix, identifikátor pro více licencí
|
||||
BYTE compatibilityVersion = 1; // udava verzi komplet PrivateContent
|
||||
BYTE licItemCount = 0; // počet licenčních bodů
|
||||
WORD publicHeaderLength = 0; // délka veřejné hlavičy
|
||||
WORD cardSize = 0; // velikost SD karty
|
||||
DWORD serialNumber = 0; // seriove cislo karty
|
||||
BYTE licItemCount {}; // počet protokolů v linenci
|
||||
WORD publicHeaderLength {}; // délka veřejné hlavičy
|
||||
WORD cardSize {}; // velikost SD karty
|
||||
DWORD serialNumber = {}; // seriove cislo karty
|
||||
};
|
||||
|
||||
///
|
||||
struct licDataItem
|
||||
{
|
||||
WORD protoId = 0; // id protokolu pro ktery je licence
|
||||
WORD licCount = 0; // pocet datovych bodu licence
|
||||
char dummy[64] = {}; // dummy pro větší velikost licence v případě méně licenčních bodů
|
||||
DWORD protoId {}; // id protokolu pro ktery je licence
|
||||
DWORD licCount {}; // pocet datovych bodu licence
|
||||
};
|
||||
|
||||
struct PublicHeader
|
||||
@@ -57,22 +56,22 @@ public:
|
||||
|
||||
struct PrivateContent // privátní šifrovaná část
|
||||
{
|
||||
LicenceIdentDataHeader licenceIdentHeader;
|
||||
vector<licDataItem> dataItems;
|
||||
WORD crc = 0;
|
||||
LicenceIdentDataHeader licenceIdentHeader {};
|
||||
vector<licDataItem> dataItems {};
|
||||
WORD crc {};
|
||||
};
|
||||
|
||||
struct LicenceBody
|
||||
{
|
||||
LicenceId licId;
|
||||
LicenceIdentDataHeader licenceIdentHeader;
|
||||
LicenceId licId {};
|
||||
LicenceIdentDataHeader licenceIdentHeader {};
|
||||
string publicHeader = ""; // JSON
|
||||
PrivateContent privateContent;
|
||||
PrivateContent privateContent {};
|
||||
};
|
||||
|
||||
LicenceBody licBody;
|
||||
SDCard sdCard;
|
||||
LicenceIdentification lIdentification;
|
||||
LicenceBody licBody {};
|
||||
SDCard sdCard {};
|
||||
LicenceIdentification lIdentification {};
|
||||
vector<unsigned char> cryptPrivateContent(const std::vector<unsigned char> &content);
|
||||
vector<unsigned char> decryptPrivateContent(const std::vector<unsigned char> &content);
|
||||
void initVector(BYTE (&iVector)[], BYTE (&key)[]);
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
#ifndef LICENCE_GENERATOR_H_
|
||||
#define LICENCE_GENERATOR_H_
|
||||
|
||||
#define DEFAULT_LICENCE_POINTS_COUNT = 4294967295 //počet licenčních bodů pro některé protokoly např: pt_Ez_buffer a pt_Ez_webs
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include "pugixml.hpp"
|
||||
#include "licenceCommon.h"
|
||||
// #include "licenceELC11.h"
|
||||
// #include "licenceELC21.h"
|
||||
// #include "licenceELC31.h"
|
||||
|
||||
#include "licGenELC1.h"
|
||||
#include "licGenELC2.h"
|
||||
@@ -33,16 +32,17 @@ public:
|
||||
pugi::xml_document *doc;
|
||||
};
|
||||
|
||||
LicData licData;
|
||||
int elcSwitchType;
|
||||
LicData licData {};
|
||||
int elcSwitchType {};
|
||||
string operationErrors = "";
|
||||
pugi::xml_document doc;
|
||||
pugi::xml_document doc {} ;
|
||||
bool argumentsCorrect = false;
|
||||
ErrorMessage error;
|
||||
ErrorMessage error {};
|
||||
// LicenceELC11 *licence11;
|
||||
// LicenceELC21 *licence21;
|
||||
// LicenceELC31 *licence31;
|
||||
Mapping mapping;
|
||||
Mapping mapping {};
|
||||
SDCard sdCard {};
|
||||
|
||||
LicenceGenerator();
|
||||
~LicenceGenerator();
|
||||
@@ -50,7 +50,7 @@ public:
|
||||
|
||||
void createLicenceFile();
|
||||
|
||||
LicenceInfoGeneral licenceInfo;
|
||||
LicenceInfoGeneral licenceInfo {};
|
||||
|
||||
private:
|
||||
LicenceIdentification licIdentification;
|
||||
|
||||
@@ -21,7 +21,6 @@ namespace Reader
|
||||
|
||||
bool readLicence(LicenceInfoGeneral *licences);
|
||||
bool getLicenceInfo(void *ptr);
|
||||
bool getLicenceItemInfo(int protocolId, void *returnItemStructure);
|
||||
void getLicenceItems();
|
||||
|
||||
};
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#define LICENCE_READER_H_
|
||||
|
||||
#include "utils.h"
|
||||
#include "SDCard.h"
|
||||
#include "licReaderELC1.h"
|
||||
#include "licReaderELC2.h"
|
||||
#include "licReaderELC3.h"
|
||||
@@ -28,24 +29,22 @@ public:
|
||||
string operationErrors = "";
|
||||
bool argumentsCorrect = false;
|
||||
ErrorMessage error;
|
||||
Licence2 *licence2;
|
||||
Licence1 *licence1;
|
||||
|
||||
|
||||
SDCardInfo sdCardInfo {};
|
||||
|
||||
LicenceReader();
|
||||
~LicenceReader();
|
||||
bool init(int elcType, InitStructure &initStructure);
|
||||
bool initread(int elcType, InitStructure &initStructure);
|
||||
bool getLicenceInfo(void *returnStructure);
|
||||
bool getLicenceItemInfo(int protocolId, void *returnItemStructure);
|
||||
|
||||
LicenceInfoGeneral licenceInfo;
|
||||
bool getLicenceInfo(void *returnStructure); //vrací informace o všech licenčních bodech základě předané návratové struktury
|
||||
bool getLicenceItemInfo(int protocolId, void *returnItemStructure); //vrací informace o licenčím bodu na základě id protocolu a předané návratové struktury
|
||||
LicenceInfoGeneral licenceInfo {}; //pole licencí
|
||||
|
||||
private:
|
||||
LicenceIdentification licIdentification;
|
||||
Licence2 *licence2 {}; //interní struktura pro zpracování licence ELC2
|
||||
Licence1 *licence1 {}; //interní struktura pro zpracování licence ELC1
|
||||
LicenceIdentification licIdentification {};
|
||||
string configFileName = "";
|
||||
void *licence = nullptr;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user