src/lib/BasicASN1Reader.h
branchv_0
changeset 35 bf2c546f49d1
parent 34 c15dc8762bdb
child 36 caed9146f72f
--- a/src/lib/BasicASN1Reader.h	Sat Jul 17 20:38:03 2021 +0200
+++ b/src/lib/BasicASN1Reader.h	Sun Jul 18 12:37:40 2021 +0200
@@ -253,24 +253,10 @@
 		} else {
 			// TODO: do not skip, parse
 			// TODO: check available bytes before allocating buffer
-			std::vector<uint8_t> temp(typeHeader.length, 0);
-			read(temp.data(), typeHeader.length);
-			// TODO: recover transaction?
-
-			std::stringstream description;
-			description << "UNKNOWN:"
-					<< " tag = " << typeHeader.tag
-					<< " tagClass = " << (int) typeHeader.tagClass
-					<< " pc = " << (int) typeHeader.pc
-					<< " length = " << typeHeader.length
-					<< " definite = " << (typeHeader.definiteLength ? "true" : "false")
-					<< " hex = ";
-			description << std::hex << std::setfill('0');
-			for (uint8_t b : temp) description << std::setw(2) << (int) b;
-			description << " ascii = ";
-			for (uint8_t b : temp) description << (b >= 32 && b < 127 ? (char) b : '.');
-			// TODO: special event for unparsed? (instead of a text string)
-			handlers->writeTextString(typeHeader, description.str());
+			std::string s;
+			s.resize(typeHeader.length);
+			read((uint8_t*) s.data(), typeHeader.length);
+			handlers->writeSpecific(typeHeader, s);
 		}
 
 		commit();