NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
command-interest-generator.hpp
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
22
#ifndef NDN_HELPERS_COMMAND_INTEREST_GENERATOR_HPP
23
#define NDN_HELPERS_COMMAND_INTEREST_GENERATOR_HPP
24
25
#include "../interest.hpp"
26
#include "../security/key-chain.hpp"
27
#include "../util/time.hpp"
28
#include "../util/random.hpp"
29
30
namespace
ndn
{
31
40
class
CommandInterestGenerator
41
{
42
public
:
43
static
const
Name
DEFAULT_CERTIFICATE_NAME
;
44
45
CommandInterestGenerator
()
46
: m_lastTimestamp(
time
::
toUnixTimestamp
(
time
::system_clock::now()))
47
{
48
}
49
50
virtual
51
~CommandInterestGenerator
()
52
{
53
}
54
55
void
56
generate
(
Interest
& interest,
const
Name
& certificateName =
Name
());
57
58
void
59
generateWithIdentity
(
Interest
& interest,
const
Name
& identity);
60
61
private
:
62
time::milliseconds m_lastTimestamp;
63
KeyChain
m_keyChain;
64
};
65
66
67
inline
void
68
CommandInterestGenerator::generate
(
Interest
& interest,
69
const
Name
& certificateName
/*= Name()*/
)
70
{
71
if
(certificateName.
empty
())
72
m_keyChain.
sign
(interest);
73
else
74
m_keyChain.
sign
(interest,
75
security::SigningInfo
(
security::SigningInfo::SIGNER_TYPE_CERT
,
76
certificateName));
77
}
78
79
inline
void
80
CommandInterestGenerator::generateWithIdentity
(
Interest
& interest,
const
Name
& identity)
81
{
82
m_keyChain.
sign
(interest,
83
security::SigningInfo
(
security::SigningInfo::SIGNER_TYPE_ID
, identity));
84
}
85
86
87
}
// namespace ndn
88
89
#endif // NDN_HELPERS_COMMAND_INTEREST_GENERATOR_HPP
ndn
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-strategy-choice-helper.hpp:34
ndn::CommandInterestGenerator::generate
void generate(Interest &interest, const Name &certificateName=Name())
Definition:
command-interest-generator.hpp:68
ndn::CommandInterestGenerator
Helper class to generate CommandInterests.
Definition:
command-interest-generator.hpp:40
ndn::security::KeyChain
The packet signing interface.
Definition:
key-chain.hpp:48
ndn::Interest
represents an Interest packet
Definition:
interest.hpp:45
ndn::security::KeyChain::sign
void sign(Data &data, const SigningInfo ¶ms=DEFAULT_SIGNING_INFO)
Sign data according to the supplied signing information.
Definition:
key-chain.cpp:517
ndn::security::SigningInfo
Signing parameters passed to KeyChain.
Definition:
signing-info.hpp:36
ndn::time
Definition:
time-custom-clock.hpp:28
ndn::CommandInterestGenerator::CommandInterestGenerator
CommandInterestGenerator()
Definition:
command-interest-generator.hpp:45
ns3::ndn::Name
Name
Definition:
ndn-common.cpp:25
ndn::CommandInterestGenerator::~CommandInterestGenerator
virtual ~CommandInterestGenerator()
Definition:
command-interest-generator.hpp:51
ndn::Name
Name abstraction to represent an absolute name.
Definition:
name.hpp:46
ndn::security::SigningInfo::SIGNER_TYPE_CERT
signer is a certificate, use it directly
Definition:
signing-info.hpp:57
ndn::CommandInterestGenerator::DEFAULT_CERTIFICATE_NAME
static const Name DEFAULT_CERTIFICATE_NAME
Definition:
command-interest-generator.hpp:43
ndn::time::toUnixTimestamp
milliseconds toUnixTimestamp(const system_clock::TimePoint &point)
Convert system_clock::TimePoint to UNIX timestamp.
Definition:
time.cpp:118
ndn::security::SigningInfo::SIGNER_TYPE_ID
signer is an identity, use its default key and default certificate
Definition:
signing-info.hpp:53
ndn::Name::empty
bool empty() const
Check if name is emtpy.
Definition:
name.hpp:398
ndn::CommandInterestGenerator::generateWithIdentity
void generateWithIdentity(Interest &interest, const Name &identity)
Definition:
command-interest-generator.hpp:80
ndnSIM
ndn-cxx
src
util
command-interest-generator.hpp
Generated on Fri Feb 23 2018 12:30:55 for ndnSIM by
1.8.14