LibLogicalAccess  2.5.0
An Open Source RFID Library
Loading...
Searching...
No Matches
atrparser.hpp
Go to the documentation of this file.
1#ifndef LIBLOGICALACCESS_ATRPARSER_HPP
2#define LIBLOGICALACCESS_ATRPARSER_HPP
3
4
6#include <cstddef>
7#include <cstdint>
8#include <map>
9#include <string>
10#include <vector>
11
12namespace logicalaccess
13{
18class LLA_READERS_PCSC_API ATRParser
19{
20 public:
21 explicit ATRParser(const ByteVector &atr);
22
26 static std::string guessCardType(const ByteVector &atr,
27 PCSCReaderUnitType reader_type);
28 static std::string guessCardType(uint8_t *atr, size_t atrlen,
29 PCSCReaderUnitType reader_type);
30
35 static std::string guessCardType(const std::string &atr_str,
36 PCSCReaderUnitType reader_type);
37
41 static std::string guessCardType(const ByteVector &atr);
42 static std::string guessCardType(uint8_t *atr, size_t atrlen);
43
48 static std::string guessCardType(const std::string &atr_str);
49
50 private:
51 std::string parse(bool ignore_reader_type,
52 const PCSCReaderUnitType &reader_type) const;
53 std::string check_hardcoded(bool ignore_reader_type,
54 const PCSCReaderUnitType &reader_type) const;
55
56 std::string check_from_atr() const;
57 std::string check_generic_from_atr() const;
58
62 static std::string atr_x_to_type(uint8_t code);
63
69 void register_hardcoded_atr(const std::string &atr, const std::string &card_type,
70 PCSCReaderUnitType reader_type);
71
75 void register_hardcoded_atr(const std::string &atr, const std::string &card_type);
76
77 struct ATRInfo
78 {
79 std::string card_type;
84 std::vector<PCSCReaderUnitType> reader_type;
85 };
86
88
93 std::map<ByteVector, ATRInfo> hardcoded_atr_to_type_;
94};
95}
96
97#endif // LIBLOGICALACCESS_ATRPARSER_HPP
Definition: atrparser.hpp:19
std::map< ByteVector, ATRInfo > hardcoded_atr_to_type_
Definition: atrparser.hpp:93
ByteVector atr_
Definition: atrparser.hpp:87
std::vector< uint8_t > ByteVector
Definition: lla_fwd.hpp:80
Definition: asn1.hpp:9
PCSCReaderUnitType
The reader unit types.
Definition: pcscreaderunitconfiguration.hpp:54
PC/SC Reader unit configuration.
Definition: atrparser.hpp:78
std::vector< PCSCReaderUnitType > reader_type
Definition: atrparser.hpp:84
std::string card_type
Definition: atrparser.hpp:79