socket: allow applications to set seq numbers
refs: #4032
Change-Id: I4ed379baaebc1643abf5864f7b674724f901e0e6
diff --git a/src/socket.cpp b/src/socket.cpp
index dad1125..4a947d7 100644
--- a/src/socket.cpp
+++ b/src/socket.cpp
@@ -107,6 +107,13 @@
}
void
+Socket::publishData(const uint8_t* buf, size_t len, const ndn::time::milliseconds& freshness,
+ const uint64_t& seqNo, const Name& prefix)
+{
+ publishData(ndn::encoding::makeBinaryBlock(ndn::tlv::Content, buf, len), freshness, seqNo, prefix);
+}
+
+void
Socket::publishData(const Block& content, const ndn::time::milliseconds& freshness,
const Name& prefix)
{
@@ -130,6 +137,29 @@
}
void
+Socket::publishData(const Block& content, const ndn::time::milliseconds& freshness,
+ const uint64_t& seqNo, const Name& prefix)
+{
+ shared_ptr<Data> data = make_shared<Data>();
+ data->setContent(content);
+ data->setFreshnessPeriod(freshness);
+
+ SeqNo newSeq = seqNo;
+ Name dataName;
+ dataName.append(m_logic.getSessionName(prefix)).appendNumber(newSeq);
+ data->setName(dataName);
+
+ if (m_signingId.empty())
+ m_keyChain.sign(*data);
+ else
+ m_keyChain.signByIdentity(*data, m_signingId);
+
+ m_ims.insert(*data);
+
+ m_logic.updateSeqNo(newSeq, prefix);
+}
+
+void
Socket::fetchData(const Name& sessionName, const SeqNo& seqNo,
const ndn::OnDataValidated& dataCallback,
int nRetries)