NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: 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 
41 {
42 public:
44 
46  : m_lastTimestamp(time::toUnixTimestamp(time::system_clock::now()))
47  {
48  }
49 
50  virtual
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
69  const Name& certificateName /*= Name()*/)
70 {
71  if (certificateName.empty())
72  m_keyChain.sign(interest);
73  else
74  m_keyChain.sign(interest,
76  certificateName));
77 }
78 
79 inline void
81 {
82  m_keyChain.sign(interest,
84 }
85 
86 
87 } // namespace ndn
88 
89 #endif // NDN_HELPERS_COMMAND_INTEREST_GENERATOR_HPP
Copyright (c) 2011-2015 Regents of the University of California.
void generate(Interest &interest, const Name &certificateName=Name())
Helper class to generate CommandInterests.
represents an Interest packet
Definition: interest.hpp:45
Signing parameters passed to KeyChain.
Name abstraction to represent an absolute name.
Definition: name.hpp:46
signer is a certificate, use it directly
milliseconds toUnixTimestamp(const system_clock::TimePoint &point)
Convert system_clock::TimePoint to UNIX timestamp.
Definition: time.cpp:118
bool empty() const
Check if name is emtpy.
Definition: name.hpp:398
signer is an identity, use its default key and default certificate
void generateWithIdentity(Interest &interest, const Name &identity)