NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
tlv.cpp
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2013-2020 Regents of the University of California.
4
*
5
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
6
*
7
* ndn-cxx library is free software: you can redistribute it and/or modify it under the
8
* terms of the GNU Lesser General Public License as published by the Free Software
9
* Foundation, either version 3 of the License, or (at your option) any later version.
10
*
11
* ndn-cxx library is distributed in the hope that it will be useful, but WITHOUT ANY
12
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
13
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
14
*
15
* You should have received copies of the GNU General Public License and GNU Lesser
16
* General Public License along with ndn-cxx, e.g., in COPYING.md file. If not, see
17
* <http://www.gnu.org/licenses/>.
18
*
19
* See AUTHORS.md for complete list of ndn-cxx authors and contributors.
20
*/
21
22
#include "
ndn-cxx/encoding/tlv.hpp
"
23
24
namespace
ndn
{
25
namespace
tlv {
26
27
Error::Error
(
const
char
* expectedType, uint32_t actualType)
28
:
Error
(
"Expecting "
s + expectedType +
" element, but TLV has type "
+
to_string
(actualType))
29
{
30
}
31
32
std::ostream&
33
operator<<
(std::ostream& os,
SignatureTypeValue
st)
34
{
35
switch
(st) {
36
case
DigestSha256
:
37
return
os <<
"DigestSha256"
;
38
case
SignatureSha256WithRsa
:
39
return
os <<
"SignatureSha256WithRsa"
;
40
case
SignatureSha256WithEcdsa
:
41
return
os <<
"SignatureSha256WithEcdsa"
;
42
case
SignatureHmacWithSha256
:
43
return
os <<
"SignatureHmacWithSha256"
;
44
case
NullSignature
:
45
return
os <<
"NullSignature"
;
46
}
47
return
os <<
"Unknown("
<<
static_cast<
uint32_t
>
(st) <<
')'
;
48
}
49
50
std::ostream&
51
operator<<
(std::ostream& os,
ContentTypeValue
ct)
52
{
53
switch
(ct) {
54
case
ContentType_Blob
:
55
return
os <<
"Blob"
;
56
case
ContentType_Link
:
57
return
os <<
"Link"
;
58
case
ContentType_Key
:
59
return
os <<
"Key"
;
60
case
ContentType_Nack
:
61
return
os <<
"Nack"
;
62
case
ContentType_Manifest
:
63
return
os <<
"Manifest"
;
64
case
ContentType_PrefixAnn
:
65
return
os <<
"PrefixAnn"
;
66
case
ContentType_Flic
:
67
return
os <<
"FLIC"
;
68
}
69
70
if
(ct <= 1023) {
71
os <<
"Reserved("
;
72
}
73
else
if
(ct >= 9000 && ct <= 9999) {
74
os <<
"Experimental("
;
75
}
76
else
{
77
os <<
"Unknown("
;
78
}
79
return
os << static_cast<uint32_t>(ct) <<
')'
;
80
}
81
82
}
// namespace tlv
83
}
// namespace ndn
tlv.hpp
ndn
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-strategy-choice-helper.hpp:34
ndn::tlv::operator<<
std::ostream & operator<<(std::ostream &os, SignatureTypeValue st)
Definition:
tlv.cpp:33
ndn::tlv::DigestSha256
Definition:
tlv.hpp:133
ndn::to_string
std::string to_string(const T &val)
Definition:
backports.hpp:86
ndn::tlv::SignatureSha256WithRsa
Definition:
tlv.hpp:134
ndn::tlv::ContentType_Key
public key, certificate
Definition:
tlv.hpp:163
ndn::tlv::ContentType_PrefixAnn
prefix announcement
Definition:
tlv.hpp:166
ndn::tlv::ContentType_Manifest
Definition:
tlv.hpp:165
ndn::tlv::ContentType_Flic
File-Like ICN Collection.
Definition:
tlv.hpp:167
ndn::tlv::ContentType_Link
another name that identifies the actual data content
Definition:
tlv.hpp:162
ndn::tlv::ContentTypeValue
ContentTypeValue
ContentType values.
Definition:
tlv.hpp:160
ndn::tlv::SignatureSha256WithEcdsa
Definition:
tlv.hpp:135
ndn::tlv::SignatureHmacWithSha256
Definition:
tlv.hpp:136
ndn::tlv::SignatureTypeValue
SignatureTypeValue
SignatureType values.
Definition:
tlv.hpp:132
ndn::tlv::ContentType_Nack
application-level nack
Definition:
tlv.hpp:164
ndn::tlv::ContentType_Blob
payload
Definition:
tlv.hpp:161
ndn::tlv::NullSignature
Definition:
tlv.hpp:137
ndn::tlv::Error::Error
Error(const char *expectedType, uint32_t actualType)
Definition:
tlv.cpp:27
ndn::tlv::Error
represents an error in TLV encoding or decoding
Definition:
tlv.hpp:52
ndnSIM
ndn-cxx
ndn-cxx
encoding
tlv.cpp
Generated on Fri May 6 2022 12:34:12 for ndnSIM by
1.8.13