7 #ifndef NDN_HELPERS_COMMAND_INTEREST_GENERATOR_HPP
8 #define NDN_HELPERS_COMMAND_INTEREST_GENERATOR_HPP
10 #include "../interest.hpp"
11 #include "../security/key-chain.hpp"
12 #include "../util/time.hpp"
13 #include "../util/random.hpp"
44 time::milliseconds m_lastTimestamp;
51 const Name& certificateName )
54 while(timestamp <= m_lastTimestamp)
56 timestamp += time::milliseconds(1);
63 interest.
setName(commandInterestName);
65 if (certificateName.
empty())
66 m_keyChain.
sign(interest);
68 m_keyChain.
sign(interest, certificateName);
70 m_lastTimestamp = timestamp;
77 while(timestamp <= m_lastTimestamp)
79 timestamp += time::milliseconds(1);
86 interest.
setName(commandInterestName);
90 m_lastTimestamp = timestamp;
96 #endif // NDN_HELPERS_COMMAND_INTEREST_GENERATOR_HPP
static Component fromNumber(uint64_t number)
Create a component encoded as nonNegativeInteger.
const Name & getName() const
void generate(Interest &interest, const Name &certificateName=Name())
Helper class to generate CommandInterests.
void signByIdentity(T &packet, const Name &identityName)
Sign packet using the default certificate of a particular identity.
An Interest holds a Name and other fields for an interest.
CommandInterestGenerator()
void sign(T &packet)
Sign packet with default identity.
Interest & setName(const Name &name)
virtual ~CommandInterestGenerator()
A Name holds an array of Name::Component and represents an NDN name.
uint64_t generateWord64()
static const Name DEFAULT_CERTIFICATE_NAME
milliseconds toUnixTimestamp(const system_clock::TimePoint &point)
Convert system_clock::TimePoint to UNIX timestamp.
Name & append(const uint8_t *value, size_t valueLength)
Append a new component, copying from value of length valueLength.
bool empty() const
Check if name is emtpy.
void generateWithIdentity(Interest &interest, const Name &identity)