equal
deleted
inserted
replaced
15 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
15 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
16 */ |
16 */ |
17 #pragma once |
17 #pragma once |
18 |
18 |
19 #include <memory> |
19 #include <memory> |
|
20 #include <vector> |
20 |
21 |
21 #include "ASN1Reader.h" |
22 #include "ASN1Reader.h" |
22 |
23 |
23 namespace relpipe { |
24 namespace relpipe { |
24 namespace in { |
25 namespace in { |
27 |
28 |
28 /** |
29 /** |
29 * Reads ASN.1 data encoded as BER (DER, CER). |
30 * Reads ASN.1 data encoded as BER (DER, CER). |
30 */ |
31 */ |
31 class BasicASN1Reader : public ASN1Reader { |
32 class BasicASN1Reader : public ASN1Reader { |
32 public: |
|
33 virtual ~BasicASN1Reader() = default; |
|
34 |
|
35 virtual void addHandler(std::shared_ptr<ASN1ContentHandler> handler) { |
|
36 }; |
|
37 |
|
38 virtual void process() { |
|
39 }; |
|
40 |
|
41 static ASN1Reader* create(std::istream& input) { |
|
42 return new BasicASN1Reader(); |
|
43 } |
|
44 |
|
45 private: |
33 private: |
46 |
34 |
47 enum class State { |
35 enum class State { |
48 A, |
36 A, |
49 B, |
37 B, |
55 protected: |
43 protected: |
56 |
44 |
57 void update() override { |
45 void update() override { |
58 |
46 |
59 if (state == State::A) { |
47 if (state == State::A) { |
60 |
48 |
61 } else if (state == State::B) { |
49 } else if (state == State::B) { |
62 |
50 |
63 } else if (state == State::C) { |
51 } else if (state == State::C) { |
64 |
52 |
65 } |
53 } |
66 |
54 |
67 |
55 |
68 |
56 |
69 } |
57 } |