Interest ns-3 packet
diff --git a/model/ndn_interestpacket.cc b/model/ndn_interestpacket.cc
index 3c9d962..fdda4cf 100644
--- a/model/ndn_interestpacket.cc
+++ b/model/ndn_interestpacket.cc
@@ -9,5 +9,62 @@
namespace ns3
{
-
+namespace NDNabstraction
+{
+ InterestPacket::InterestPacket(unsigned char *name, uint32_t size):Packet ((uint8_t const *)name,size)
+ {
+ maxNameLength = 10240;
+ }
+
+ uint32_t
+ InterestPacket::GetName(unsigned char *name)
+ {
+ //uint32_t Packet::CopyData (uint8_t *buffer, uint32_t size) const
+ return CopyData((uint8_t*) name, maxNameLength);
+ }
+
+ void
+ InterestPacket::AddTimeout(uint32_t milliseconds)
+ {
+ TimeoutHeader tHeader (milliseconds);
+ AddHeader (tHeader);
+ }
+
+ uint32_t
+ InterestPacket::GetTimeout(void)
+ {
+ TimeoutHeader tHeader;
+ PeekHeader(tHeader);
+ return tHeader.GetValue();
+ }
+
+ void
+ InterestPacket::RemoveTimeout(void)
+ {
+ TimeoutHeader tHeader;
+ RemoveHeader(tHeader);
+ }
+
+ void
+ InterestPacket::AddNonce(uint32_t nonce)
+ {
+ NonceHeader tHeader (nonce);
+ AddHeader (tHeader);
+ }
+
+ uint32_t
+ InterestPacket::GetNonce(void)
+ {
+ NonceHeader tHeader;
+ PeekHeader(tHeader);
+ return tHeader.GetValue();
+ }
+
+ void
+ InterestPacket::RemoveNonce(void)
+ {
+ NonceHeader tHeader;
+ RemoveHeader(tHeader);
+ }
+}
}
\ No newline at end of file
diff --git a/model/ndn_interestpacket.h b/model/ndn_interestpacket.h
index fddc136..71a156a 100644
--- a/model/ndn_interestpacket.h
+++ b/model/ndn_interestpacket.h
@@ -13,13 +13,32 @@
#include "ns3/header.h"
#include <ns3/packet.h>
+#include <string>
+#include "ndn_timeoutheader.h"
+#include "ndn_nonceheader.h"
namespace ns3
{
+namespace NDNabstraction
+{
class InterestPacket : public Packet
{
+ public:
+ InterestPacket(unsigned char *name, uint32_t size);
+
+ uint32_t GetName(unsigned char *name);
+ void AddTimeout(uint32_t milliseconds);
+ uint32_t GetTimeout(void);
+ void RemoveTimeout(void);
+
+ void AddNonce(uint32_t nonce);
+ uint32_t GetNonce(void);
+ void RemoveNonce(void);
+
+ uint32_t maxNameLength;
};
}
+}
#endif
\ No newline at end of file