29 :
Error(
"Expecting "s + expectedType +
" element, but TLV has type " +
to_string(actualType))
38 return os <<
"DigestSha256";
40 return os <<
"SignatureSha256WithRsa";
42 return os <<
"SignatureSha256WithEcdsa";
44 return os <<
"SignatureHmacWithSha256";
46 return os <<
"SignatureEd25519";
48 return os <<
"NullSignature";
50 return os <<
"Unknown(" <<
static_cast<uint32_t
>(st) <<
')';
66 return os <<
"Manifest";
68 return os <<
"PrefixAnn";
76 else if (ct >= 9000 && ct <= 9999) {
77 os <<
"Experimental(";
82 return os << static_cast<uint32_t>(ct) <<
')';
89 os.put(
static_cast<char>(number));
92 else if (number <= std::numeric_limits<uint16_t>::max()) {
93 os.put(
static_cast<char>(253));
94 uint16_t value = boost::endian::native_to_big(
static_cast<uint16_t
>(number));
95 os.write(
reinterpret_cast<const char*
>(&value), 2);
98 else if (number <= std::numeric_limits<uint32_t>::max()) {
99 os.put(
static_cast<char>(254));
100 uint32_t value = boost::endian::native_to_big(
static_cast<uint32_t
>(number));
101 os.write(
reinterpret_cast<const char*
>(&value), 4);
105 os.put(
static_cast<char>(255));
106 uint64_t value = boost::endian::native_to_big(number);
107 os.write(
reinterpret_cast<const char*
>(&value), 8);
115 if (integer <= std::numeric_limits<uint8_t>::max()) {
116 os.put(
static_cast<char>(integer));
119 else if (integer <= std::numeric_limits<uint16_t>::max()) {
120 uint16_t value = boost::endian::native_to_big(
static_cast<uint16_t
>(integer));
121 os.write(
reinterpret_cast<const char*
>(&value), 2);
124 else if (integer <= std::numeric_limits<uint32_t>::max()) {
125 uint32_t value = boost::endian::native_to_big(
static_cast<uint32_t
>(integer));
126 os.write(
reinterpret_cast<const char*
>(&value), 4);
130 uint64_t value = boost::endian::native_to_big(integer);
131 os.write(
reinterpret_cast<const char*
>(&value), 8);
Represents an error in TLV encoding or decoding.
Error(const char *expectedType, uint32_t actualType)
std::string to_string(const errinfo_stacktrace &x)
Contains constants and low-level functions related to the NDN packet format.
ContentTypeValue
ContentType values.
@ ContentType_Key
public key, certificate
@ ContentType_Link
another name that identifies the actual data content
@ ContentType_Blob
payload
@ ContentType_Flic
File-Like ICN Collection.
@ ContentType_PrefixAnn
prefix announcement
@ ContentType_Nack
application-level nack
size_t writeNonNegativeInteger(std::ostream &os, uint64_t integer)
Write a NonNegativeInteger to the specified stream.
std::ostream & operator<<(std::ostream &os, SignatureTypeValue st)
size_t writeVarNumber(std::ostream &os, uint64_t number)
Write VAR-NUMBER to the specified stream.
SignatureTypeValue
SignatureType values.
@ SignatureHmacWithSha256
@ SignatureSha256WithEcdsa