define a TypeId for each Header/Trailer.
This commit is contained in:
@@ -19,11 +19,13 @@ public:
|
||||
void SetData (uint16_t data);
|
||||
uint16_t GetData (void) const;
|
||||
|
||||
static TypeId GetTypeId (void);
|
||||
virtual TypeId GetInstanceTypeId (void) const;
|
||||
std::string GetName (void) const;
|
||||
void Print (std::ostream &os) const;
|
||||
void Serialize (Buffer::Iterator start) const;
|
||||
uint32_t Deserialize (Buffer::Iterator start);
|
||||
uint32_t GetSerializedSize (void) const;
|
||||
virtual void Serialize (Buffer::Iterator start) const;
|
||||
virtual uint32_t Deserialize (Buffer::Iterator start);
|
||||
virtual uint32_t GetSerializedSize (void) const;
|
||||
private:
|
||||
uint16_t m_data;
|
||||
};
|
||||
@@ -36,6 +38,20 @@ MyHeader::MyHeader ()
|
||||
MyHeader::~MyHeader ()
|
||||
{}
|
||||
|
||||
TypeId
|
||||
MyHeader::GetTypeId (void)
|
||||
{
|
||||
static TypeId tid = TypeId ("ns3::MyHeader")
|
||||
.SetParent<Header> ()
|
||||
;
|
||||
return tid;
|
||||
}
|
||||
TypeId
|
||||
MyHeader::GetInstanceTypeId (void) const
|
||||
{
|
||||
return GetTypeId ();
|
||||
}
|
||||
|
||||
uint32_t
|
||||
MyHeader::GetUid (void)
|
||||
{
|
||||
|
||||
@@ -2,7 +2,18 @@
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
NS_OBJECT_ENSURE_REGISTERED (Header);
|
||||
|
||||
Header::~Header ()
|
||||
{}
|
||||
|
||||
TypeId
|
||||
Header::GetTypeId (void)
|
||||
{
|
||||
static TypeId tid = TypeId ("ns3::Header")
|
||||
.SetParent<ObjectBase> ()
|
||||
;
|
||||
return tid;
|
||||
}
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#define HEADER_H
|
||||
|
||||
#include "chunk-registry.h"
|
||||
#include "ns3/object-base.h"
|
||||
|
||||
/**
|
||||
* \relates ns3::Header
|
||||
@@ -75,9 +76,10 @@ namespace ns3 {
|
||||
* Sample code which shows how to create a new type of Header, and how to use it,
|
||||
* is shown in the sample file samples/main-packet-header.cc
|
||||
*/
|
||||
class Header
|
||||
class Header : public ObjectBase
|
||||
{
|
||||
public:
|
||||
static TypeId GetTypeId (void);
|
||||
virtual ~Header ();
|
||||
/**
|
||||
* \returns the expected size of the header.
|
||||
|
||||
@@ -34,6 +34,8 @@ template <int N>
|
||||
class HistoryHeader : public Header
|
||||
{
|
||||
public:
|
||||
static TypeId GetTypeId (void);
|
||||
virtual TypeId GetInstanceTypeId (void) const;
|
||||
static uint32_t GetUid (void);
|
||||
HistoryHeader ();
|
||||
bool IsOk (void) const;
|
||||
@@ -46,6 +48,25 @@ private:
|
||||
bool m_ok;
|
||||
};
|
||||
|
||||
template <int N>
|
||||
TypeId
|
||||
HistoryHeader<N>::GetTypeId (void)
|
||||
{
|
||||
std::ostringstream oss;
|
||||
oss << "ns3::HistoryHeader<"<<N<<">";
|
||||
static TypeId tid = TypeId (oss.str ().c_str ())
|
||||
.SetParent<Header> ()
|
||||
;
|
||||
return tid;
|
||||
}
|
||||
|
||||
template <int N>
|
||||
TypeId
|
||||
HistoryHeader<N>::GetInstanceTypeId (void) const
|
||||
{
|
||||
return GetTypeId ();
|
||||
}
|
||||
|
||||
template <int N>
|
||||
uint32_t
|
||||
HistoryHeader<N>::GetUid (void)
|
||||
@@ -114,6 +135,8 @@ template <int N>
|
||||
class HistoryTrailer : public Trailer
|
||||
{
|
||||
public:
|
||||
static TypeId GetTypeId (void);
|
||||
virtual TypeId GetInstanceTypeId (void) const;
|
||||
static uint32_t GetUid (void);
|
||||
HistoryTrailer ();
|
||||
bool IsOk (void) const;
|
||||
@@ -126,6 +149,26 @@ private:
|
||||
bool m_ok;
|
||||
};
|
||||
|
||||
|
||||
template <int N>
|
||||
TypeId
|
||||
HistoryTrailer<N>::GetTypeId (void)
|
||||
{
|
||||
std::ostringstream oss;
|
||||
oss << "ns3::HistoryTrailer<"<<N<<">";
|
||||
static TypeId tid = TypeId (oss.str ().c_str ())
|
||||
.SetParent<Trailer> ()
|
||||
;
|
||||
return tid;
|
||||
}
|
||||
|
||||
template <int N>
|
||||
TypeId
|
||||
HistoryTrailer<N>::GetInstanceTypeId (void) const
|
||||
{
|
||||
return GetTypeId ();
|
||||
}
|
||||
|
||||
template <int N>
|
||||
uint32_t
|
||||
HistoryTrailer<N>::GetUid (void)
|
||||
|
||||
@@ -2,7 +2,18 @@
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
NS_OBJECT_ENSURE_REGISTERED (Trailer);
|
||||
|
||||
Trailer::~Trailer ()
|
||||
{}
|
||||
|
||||
TypeId
|
||||
Trailer::GetTypeId (void)
|
||||
{
|
||||
static TypeId tid = TypeId ("ns3::Trailer")
|
||||
.SetParent<ObjectBase> ()
|
||||
;
|
||||
return tid;
|
||||
}
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#ifndef TRAILER_H
|
||||
#define TRAILER_H
|
||||
|
||||
#include "ns3/object-base.h"
|
||||
#include "chunk-registry.h"
|
||||
#include "buffer.h"
|
||||
#include <stdint.h>
|
||||
@@ -74,9 +75,10 @@ namespace ns3 {
|
||||
* single word as all capitalized letters.
|
||||
*
|
||||
*/
|
||||
class Trailer
|
||||
class Trailer : public ObjectBase
|
||||
{
|
||||
public:
|
||||
static TypeId GetTypeId (void);
|
||||
virtual ~Trailer ();
|
||||
/**
|
||||
* \returns the expected size of the trailer.
|
||||
|
||||
@@ -27,6 +27,8 @@ namespace ns3 {
|
||||
* Probe Request
|
||||
***********************************************************/
|
||||
|
||||
NS_OBJECT_ENSURE_REGISTERED (MgtProbeRequestHeader);
|
||||
|
||||
MgtProbeRequestHeader::~MgtProbeRequestHeader ()
|
||||
{}
|
||||
|
||||
@@ -59,6 +61,19 @@ MgtProbeRequestHeader::GetSerializedSize (void) const
|
||||
size += m_rates.GetSerializedSize ();
|
||||
return size;
|
||||
}
|
||||
TypeId
|
||||
MgtProbeRequestHeader::GetTypeId (void)
|
||||
{
|
||||
static TypeId tid = TypeId ("ns3::MgtProbeRequestHeader")
|
||||
.SetParent<Header> ()
|
||||
;
|
||||
return tid;
|
||||
}
|
||||
TypeId
|
||||
MgtProbeRequestHeader::GetInstanceTypeId (void) const
|
||||
{
|
||||
return GetTypeId ();
|
||||
}
|
||||
uint32_t
|
||||
MgtProbeRequestHeader::GetUid (void)
|
||||
{
|
||||
@@ -97,6 +112,8 @@ MgtProbeRequestHeader::Deserialize (Buffer::Iterator start)
|
||||
* Probe Response
|
||||
***********************************************************/
|
||||
|
||||
NS_OBJECT_ENSURE_REGISTERED (MgtProbeResponseHeader);
|
||||
|
||||
MgtProbeResponseHeader::MgtProbeResponseHeader ()
|
||||
{}
|
||||
MgtProbeResponseHeader::~MgtProbeResponseHeader ()
|
||||
@@ -133,6 +150,19 @@ MgtProbeResponseHeader::SetSupportedRates (SupportedRates rates)
|
||||
{
|
||||
m_rates = rates;
|
||||
}
|
||||
TypeId
|
||||
MgtProbeResponseHeader::GetTypeId (void)
|
||||
{
|
||||
static TypeId tid = TypeId ("ns3::MgtProbeResponseHeader")
|
||||
.SetParent<Header> ()
|
||||
;
|
||||
return tid;
|
||||
}
|
||||
TypeId
|
||||
MgtProbeResponseHeader::GetInstanceTypeId (void) const
|
||||
{
|
||||
return GetTypeId ();
|
||||
}
|
||||
uint32_t
|
||||
MgtProbeResponseHeader::GetUid (void)
|
||||
{
|
||||
@@ -198,6 +228,11 @@ MgtProbeResponseHeader::Deserialize (Buffer::Iterator start)
|
||||
return i.GetDistanceFrom (start);
|
||||
}
|
||||
|
||||
/***********************************************************
|
||||
* Assoc Request
|
||||
***********************************************************/
|
||||
|
||||
NS_OBJECT_ENSURE_REGISTERED (MgtAssocRequestHeader);
|
||||
|
||||
MgtAssocRequestHeader::MgtAssocRequestHeader ()
|
||||
{}
|
||||
@@ -234,6 +269,20 @@ MgtAssocRequestHeader::GetListenInterval (void) const
|
||||
{
|
||||
return m_listenInterval;
|
||||
}
|
||||
|
||||
TypeId
|
||||
MgtAssocRequestHeader::GetTypeId (void)
|
||||
{
|
||||
static TypeId tid = TypeId ("ns3::MgtAssocRequestHeader")
|
||||
.SetParent<Header> ()
|
||||
;
|
||||
return tid;
|
||||
}
|
||||
TypeId
|
||||
MgtAssocRequestHeader::GetInstanceTypeId (void) const
|
||||
{
|
||||
return GetTypeId ();
|
||||
}
|
||||
uint32_t
|
||||
MgtAssocRequestHeader::GetUid (void)
|
||||
{
|
||||
@@ -281,6 +330,12 @@ MgtAssocRequestHeader::Deserialize (Buffer::Iterator start)
|
||||
return i.GetDistanceFrom (start);
|
||||
}
|
||||
|
||||
/***********************************************************
|
||||
* Assoc Response
|
||||
***********************************************************/
|
||||
|
||||
NS_OBJECT_ENSURE_REGISTERED (MgtAssocResponseHeader);
|
||||
|
||||
MgtAssocResponseHeader::MgtAssocResponseHeader ()
|
||||
{}
|
||||
MgtAssocResponseHeader::~MgtAssocResponseHeader ()
|
||||
@@ -307,6 +362,19 @@ MgtAssocResponseHeader::SetSupportedRates (SupportedRates rates)
|
||||
m_rates = rates;
|
||||
}
|
||||
|
||||
TypeId
|
||||
MgtAssocResponseHeader::GetTypeId (void)
|
||||
{
|
||||
static TypeId tid = TypeId ("ns3::MgtAssocResponseHeader")
|
||||
.SetParent<Header> ()
|
||||
;
|
||||
return tid;
|
||||
}
|
||||
TypeId
|
||||
MgtAssocResponseHeader::GetInstanceTypeId (void) const
|
||||
{
|
||||
return GetTypeId ();
|
||||
}
|
||||
uint32_t
|
||||
MgtAssocResponseHeader::GetUid (void)
|
||||
{
|
||||
|
||||
@@ -44,12 +44,14 @@ public:
|
||||
SupportedRates GetSupportedRates (void) const;
|
||||
uint16_t GetListenInterval (void) const;
|
||||
|
||||
static TypeId GetTypeId (void);
|
||||
virtual TypeId GetInstanceTypeId (void) const;
|
||||
static uint32_t GetUid (void);
|
||||
std::string GetName (void) const;
|
||||
void Print (std::ostream &os) const;
|
||||
uint32_t GetSerializedSize (void) const;
|
||||
void Serialize (Buffer::Iterator start) const;
|
||||
uint32_t Deserialize (Buffer::Iterator start);
|
||||
virtual uint32_t GetSerializedSize (void) const;
|
||||
virtual void Serialize (Buffer::Iterator start) const;
|
||||
virtual uint32_t Deserialize (Buffer::Iterator start);
|
||||
|
||||
private:
|
||||
Ssid m_ssid;
|
||||
@@ -69,12 +71,14 @@ public:
|
||||
void SetSupportedRates (SupportedRates rates);
|
||||
void SetStatusCode (StatusCode code);
|
||||
|
||||
static TypeId GetTypeId (void);
|
||||
virtual TypeId GetInstanceTypeId (void) const;
|
||||
static uint32_t GetUid (void);
|
||||
std::string GetName (void) const;
|
||||
void Print (std::ostream &os) const;
|
||||
uint32_t GetSerializedSize (void) const;
|
||||
void Serialize (Buffer::Iterator start) const;
|
||||
uint32_t Deserialize (Buffer::Iterator start);
|
||||
virtual uint32_t GetSerializedSize (void) const;
|
||||
virtual void Serialize (Buffer::Iterator start) const;
|
||||
virtual uint32_t Deserialize (Buffer::Iterator start);
|
||||
|
||||
private:
|
||||
SupportedRates m_rates;
|
||||
@@ -92,12 +96,14 @@ public:
|
||||
Ssid GetSsid (void) const;
|
||||
SupportedRates GetSupportedRates (void) const;
|
||||
|
||||
static TypeId GetTypeId (void);
|
||||
virtual TypeId GetInstanceTypeId (void) const;
|
||||
static uint32_t GetUid (void);
|
||||
std::string GetName (void) const;
|
||||
void Print (std::ostream &os) const;
|
||||
uint32_t GetSerializedSize (void) const;
|
||||
void Serialize (Buffer::Iterator start) const;
|
||||
uint32_t Deserialize (Buffer::Iterator start);
|
||||
virtual uint32_t GetSerializedSize (void) const;
|
||||
virtual void Serialize (Buffer::Iterator start) const;
|
||||
virtual uint32_t Deserialize (Buffer::Iterator start);
|
||||
private:
|
||||
|
||||
Ssid m_ssid;
|
||||
@@ -117,12 +123,14 @@ public:
|
||||
void SetBeaconIntervalUs (uint64_t us);
|
||||
void SetSupportedRates (SupportedRates rates);
|
||||
|
||||
static TypeId GetTypeId (void);
|
||||
virtual TypeId GetInstanceTypeId (void) const;
|
||||
static uint32_t GetUid (void);
|
||||
std::string GetName (void) const;
|
||||
void Print (std::ostream &os) const;
|
||||
uint32_t GetSerializedSize (void) const;
|
||||
void Serialize (Buffer::Iterator start) const;
|
||||
uint32_t Deserialize (Buffer::Iterator start);
|
||||
virtual uint32_t GetSerializedSize (void) const;
|
||||
virtual void Serialize (Buffer::Iterator start) const;
|
||||
virtual uint32_t Deserialize (Buffer::Iterator start);
|
||||
|
||||
private:
|
||||
Ssid m_ssid;
|
||||
|
||||
@@ -34,6 +34,8 @@ std::Cout << "MAC80211HEADER " << x << std::Endl;
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
NS_OBJECT_ENSURE_REGISTERED (WifiMacHeader);
|
||||
|
||||
enum {
|
||||
TYPE_MGT = 0,
|
||||
TYPE_CTL = 1,
|
||||
@@ -766,6 +768,19 @@ case WIFI_MAC_ ## x: \
|
||||
return "BIG_ERROR";
|
||||
}
|
||||
|
||||
TypeId
|
||||
WifiMacHeader::GetTypeId (void)
|
||||
{
|
||||
static TypeId tid = TypeId ("ns3::WifiMacHeader")
|
||||
.SetParent<Header> ()
|
||||
;
|
||||
return tid;
|
||||
}
|
||||
TypeId
|
||||
WifiMacHeader::GetInstanceTypeId (void) const
|
||||
{
|
||||
return GetTypeId ();
|
||||
}
|
||||
uint32_t
|
||||
WifiMacHeader::GetUid (void)
|
||||
{
|
||||
|
||||
@@ -65,14 +65,18 @@ enum WifiMacType_e {
|
||||
class WifiMacHeader : public Header
|
||||
{
|
||||
public:
|
||||
|
||||
WifiMacHeader ();
|
||||
~WifiMacHeader ();
|
||||
|
||||
static TypeId GetTypeId (void);
|
||||
virtual TypeId GetInstanceTypeId (void) const;
|
||||
static uint32_t GetUid (void);
|
||||
std::string GetName (void) const;
|
||||
void Print (std::ostream &os) const;
|
||||
uint32_t GetSerializedSize (void) const;
|
||||
void Serialize (Buffer::Iterator start) const;
|
||||
uint32_t Deserialize (Buffer::Iterator start);
|
||||
virtual uint32_t GetSerializedSize (void) const;
|
||||
virtual void Serialize (Buffer::Iterator start) const;
|
||||
virtual uint32_t Deserialize (Buffer::Iterator start);
|
||||
|
||||
|
||||
void SetAssocReq (void);
|
||||
|
||||
@@ -22,12 +22,28 @@
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
NS_OBJECT_ENSURE_REGISTERED (WifiMacTrailer);
|
||||
|
||||
WifiMacTrailer::WifiMacTrailer ()
|
||||
{}
|
||||
|
||||
WifiMacTrailer::~WifiMacTrailer ()
|
||||
{}
|
||||
|
||||
TypeId
|
||||
WifiMacTrailer::GetTypeId (void)
|
||||
{
|
||||
static TypeId tid = TypeId ("ns3::WifiMacTrailer")
|
||||
.SetParent<Trailer> ()
|
||||
;
|
||||
return tid;
|
||||
}
|
||||
TypeId
|
||||
WifiMacTrailer::GetInstanceTypeId (void) const
|
||||
{
|
||||
return GetTypeId ();
|
||||
}
|
||||
|
||||
uint32_t
|
||||
WifiMacTrailer::GetUid (void)
|
||||
{
|
||||
|
||||
@@ -31,12 +31,14 @@ public:
|
||||
WifiMacTrailer ();
|
||||
~WifiMacTrailer ();
|
||||
|
||||
static TypeId GetTypeId (void);
|
||||
virtual TypeId GetInstanceTypeId (void) const;
|
||||
static uint32_t GetUid (void);
|
||||
std::string GetName (void) const;
|
||||
void Print (std::ostream &os) const;
|
||||
uint32_t GetSerializedSize (void) const;
|
||||
void Serialize (Buffer::Iterator start) const;
|
||||
uint32_t Deserialize (Buffer::Iterator start);
|
||||
virtual uint32_t GetSerializedSize (void) const;
|
||||
virtual void Serialize (Buffer::Iterator start) const;
|
||||
virtual uint32_t Deserialize (Buffer::Iterator start);
|
||||
};
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
@@ -26,6 +26,21 @@
|
||||
namespace ns3 {
|
||||
|
||||
NS_HEADER_ENSURE_REGISTERED (ArpHeader);
|
||||
NS_OBJECT_ENSURE_REGISTERED (ArpHeader);
|
||||
|
||||
TypeId
|
||||
ArpHeader::GetTypeId (void)
|
||||
{
|
||||
static TypeId tid = TypeId ("ns3::ArpHeader")
|
||||
.SetParent<Header> ()
|
||||
;
|
||||
return tid;
|
||||
}
|
||||
TypeId
|
||||
ArpHeader::GetInstanceTypeId (void) const
|
||||
{
|
||||
return GetTypeId ();
|
||||
}
|
||||
|
||||
uint32_t
|
||||
ArpHeader::GetUid (void)
|
||||
|
||||
@@ -34,6 +34,8 @@ namespace ns3 {
|
||||
class ArpHeader : public Header
|
||||
{
|
||||
public:
|
||||
static TypeId GetTypeId (void);
|
||||
virtual TypeId GetInstanceTypeId (void) const;
|
||||
static uint32_t GetUid (void);
|
||||
|
||||
void SetRequest (Address sourceHardwareAddress,
|
||||
|
||||
@@ -29,9 +29,24 @@ NS_LOG_COMPONENT_DEFINE ("Ipv4Header");
|
||||
namespace ns3 {
|
||||
|
||||
NS_HEADER_ENSURE_REGISTERED (Ipv4Header);
|
||||
NS_OBJECT_ENSURE_REGISTERED (Ipv4Header);
|
||||
|
||||
bool Ipv4Header::m_calcChecksum = false;
|
||||
|
||||
TypeId
|
||||
Ipv4Header::GetTypeId (void)
|
||||
{
|
||||
static TypeId tid = TypeId ("ns3::Ipv4Header")
|
||||
.SetParent<Header> ()
|
||||
;
|
||||
return tid;
|
||||
}
|
||||
TypeId
|
||||
Ipv4Header::GetInstanceTypeId (void) const
|
||||
{
|
||||
return GetTypeId ();
|
||||
}
|
||||
|
||||
uint32_t
|
||||
Ipv4Header::GetUid (void)
|
||||
{
|
||||
|
||||
@@ -32,6 +32,8 @@ namespace ns3 {
|
||||
class Ipv4Header : public Header
|
||||
{
|
||||
public:
|
||||
static TypeId GetTypeId (void);
|
||||
virtual TypeId GetInstanceTypeId (void) const;
|
||||
static uint32_t GetUid (void);
|
||||
/**
|
||||
* \brief Construct a null IPv4 header
|
||||
@@ -142,9 +144,9 @@ public:
|
||||
|
||||
std::string GetName (void) const;
|
||||
void Print (std::ostream &os) const;
|
||||
uint32_t GetSerializedSize (void) const;
|
||||
void Serialize (Buffer::Iterator start) const;
|
||||
uint32_t Deserialize (Buffer::Iterator start);
|
||||
virtual uint32_t GetSerializedSize (void) const;
|
||||
virtual void Serialize (Buffer::Iterator start) const;
|
||||
virtual uint32_t Deserialize (Buffer::Iterator start);
|
||||
private:
|
||||
|
||||
enum FlagsE {
|
||||
|
||||
@@ -27,9 +27,24 @@
|
||||
namespace ns3 {
|
||||
|
||||
NS_HEADER_ENSURE_REGISTERED (TcpHeader);
|
||||
NS_OBJECT_ENSURE_REGISTERED (TcpHeader);
|
||||
|
||||
bool TcpHeader::m_calcChecksum = false;
|
||||
|
||||
TypeId
|
||||
TcpHeader::GetTypeId (void)
|
||||
{
|
||||
static TypeId tid = TypeId ("ns3::TcpHeader")
|
||||
.SetParent<Header> ()
|
||||
;
|
||||
return tid;
|
||||
}
|
||||
TypeId
|
||||
TcpHeader::GetInstanceTypeId (void) const
|
||||
{
|
||||
return GetTypeId ();
|
||||
}
|
||||
|
||||
uint32_t
|
||||
TcpHeader::GetUid (void)
|
||||
{
|
||||
|
||||
@@ -30,8 +30,11 @@
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
class TcpHeader : public Header {
|
||||
class TcpHeader : public Header
|
||||
{
|
||||
public:
|
||||
static TypeId GetTypeId (void);
|
||||
virtual TypeId GetInstanceTypeId (void) const;
|
||||
static uint32_t GetUid (void);
|
||||
|
||||
TcpHeader ();
|
||||
@@ -138,9 +141,9 @@ public:
|
||||
|
||||
std::string GetName (void) const;
|
||||
void Print (std::ostream &os) const;
|
||||
uint32_t GetSerializedSize (void) const;
|
||||
void Serialize (Buffer::Iterator start) const;
|
||||
uint32_t Deserialize (Buffer::Iterator start);
|
||||
virtual uint32_t GetSerializedSize (void) const;
|
||||
virtual void Serialize (Buffer::Iterator start) const;
|
||||
virtual uint32_t Deserialize (Buffer::Iterator start);
|
||||
|
||||
private:
|
||||
uint16_t m_sourcePort;
|
||||
|
||||
@@ -25,9 +25,24 @@
|
||||
namespace ns3 {
|
||||
|
||||
NS_HEADER_ENSURE_REGISTERED (UdpHeader);
|
||||
NS_OBJECT_ENSURE_REGISTERED (UdpHeader);
|
||||
|
||||
bool UdpHeader::m_calcChecksum = false;
|
||||
|
||||
TypeId
|
||||
UdpHeader::GetTypeId (void)
|
||||
{
|
||||
static TypeId tid = TypeId ("ns3::UdpHeader")
|
||||
.SetParent<Header> ()
|
||||
;
|
||||
return tid;
|
||||
}
|
||||
TypeId
|
||||
UdpHeader::GetInstanceTypeId (void) const
|
||||
{
|
||||
return GetTypeId ();
|
||||
}
|
||||
|
||||
uint32_t
|
||||
UdpHeader::GetUid (void)
|
||||
{
|
||||
|
||||
@@ -34,6 +34,8 @@ namespace ns3 {
|
||||
class UdpHeader : public Header
|
||||
{
|
||||
public:
|
||||
static TypeId GetTypeId (void);
|
||||
virtual TypeId GetInstanceTypeId (void) const;
|
||||
static uint32_t GetUid (void);
|
||||
|
||||
/**
|
||||
@@ -86,9 +88,9 @@ public:
|
||||
|
||||
std::string GetName (void) const;
|
||||
void Print (std::ostream &os) const;
|
||||
uint32_t GetSerializedSize (void) const;
|
||||
void Serialize (Buffer::Iterator start) const;
|
||||
uint32_t Deserialize (Buffer::Iterator start);
|
||||
virtual uint32_t GetSerializedSize (void) const;
|
||||
virtual void Serialize (Buffer::Iterator start) const;
|
||||
virtual uint32_t Deserialize (Buffer::Iterator start);
|
||||
|
||||
private:
|
||||
uint16_t m_sourcePort;
|
||||
|
||||
@@ -32,6 +32,21 @@ NS_LOG_COMPONENT_DEFINE ("EthernetHeader");
|
||||
namespace ns3 {
|
||||
|
||||
NS_HEADER_ENSURE_REGISTERED (EthernetHeader);
|
||||
NS_OBJECT_ENSURE_REGISTERED (EthernetHeader);
|
||||
|
||||
TypeId
|
||||
EthernetHeader::GetTypeId (void)
|
||||
{
|
||||
static TypeId tid = TypeId ("ns3::EthernetHeader")
|
||||
.SetParent<Header> ()
|
||||
;
|
||||
return tid;
|
||||
}
|
||||
TypeId
|
||||
EthernetHeader::GetInstanceTypeId (void) const
|
||||
{
|
||||
return GetTypeId ();
|
||||
}
|
||||
|
||||
uint32_t
|
||||
EthernetHeader::GetUid (void)
|
||||
|
||||
@@ -49,6 +49,8 @@ namespace ns3 {
|
||||
class EthernetHeader : public Header
|
||||
{
|
||||
public:
|
||||
static TypeId GetTypeId (void);
|
||||
virtual TypeId GetInstanceTypeId (void) const;
|
||||
static uint32_t GetUid (void);
|
||||
|
||||
/**
|
||||
@@ -105,9 +107,9 @@ public:
|
||||
|
||||
std::string GetName (void) const;
|
||||
void Print (std::ostream &os) const;
|
||||
uint32_t GetSerializedSize (void) const;
|
||||
void Serialize (Buffer::Iterator start) const;
|
||||
uint32_t Deserialize (Buffer::Iterator start);
|
||||
virtual uint32_t GetSerializedSize (void) const;
|
||||
virtual void Serialize (Buffer::Iterator start) const;
|
||||
virtual uint32_t Deserialize (Buffer::Iterator start);
|
||||
private:
|
||||
static const int PREAMBLE_SIZE = 8; /// size of the preamble_sfd header field
|
||||
static const int LENGTH_SIZE = 2; /// size of the length_type header field
|
||||
|
||||
@@ -29,9 +29,24 @@ NS_LOG_COMPONENT_DEFINE ("EthernetTrailer");
|
||||
namespace ns3 {
|
||||
|
||||
NS_TRAILER_ENSURE_REGISTERED (EthernetTrailer);
|
||||
NS_OBJECT_ENSURE_REGISTERED (EthernetTrailer);
|
||||
|
||||
bool EthernetTrailer::m_calcFcs = false;
|
||||
|
||||
TypeId
|
||||
EthernetTrailer::GetTypeId (void)
|
||||
{
|
||||
static TypeId tid = TypeId ("ns3::EthernetTrailer")
|
||||
.SetParent<Trailer> ()
|
||||
;
|
||||
return tid;
|
||||
}
|
||||
TypeId
|
||||
EthernetTrailer::GetInstanceTypeId (void) const
|
||||
{
|
||||
return GetTypeId ();
|
||||
}
|
||||
|
||||
uint32_t
|
||||
EthernetTrailer::GetUid (void)
|
||||
{
|
||||
|
||||
@@ -39,6 +39,8 @@ class Packet;
|
||||
class EthernetTrailer : public Trailer
|
||||
{
|
||||
public:
|
||||
static TypeId GetTypeId (void);
|
||||
virtual TypeId GetInstanceTypeId (void) const;
|
||||
static uint32_t GetUid (void);
|
||||
|
||||
/**
|
||||
|
||||
@@ -26,6 +26,21 @@
|
||||
namespace ns3 {
|
||||
|
||||
NS_HEADER_ENSURE_REGISTERED (LlcSnapHeader);
|
||||
NS_OBJECT_ENSURE_REGISTERED (LlcSnapHeader);
|
||||
|
||||
TypeId
|
||||
LlcSnapHeader::GetTypeId (void)
|
||||
{
|
||||
static TypeId tid = TypeId ("ns3::LlcSnapHeader")
|
||||
.SetParent<Header> ()
|
||||
;
|
||||
return tid;
|
||||
}
|
||||
TypeId
|
||||
LlcSnapHeader::GetInstanceTypeId (void) const
|
||||
{
|
||||
return GetTypeId ();
|
||||
}
|
||||
|
||||
uint32_t
|
||||
LlcSnapHeader::GetUid (void)
|
||||
|
||||
@@ -31,6 +31,8 @@ namespace ns3 {
|
||||
class LlcSnapHeader : public Header
|
||||
{
|
||||
public:
|
||||
static TypeId GetTypeId (void);
|
||||
virtual TypeId GetInstanceTypeId (void) const;
|
||||
static uint32_t GetUid (void);
|
||||
|
||||
LlcSnapHeader ();
|
||||
@@ -40,9 +42,9 @@ public:
|
||||
|
||||
std::string GetName (void) const;
|
||||
void Print (std::ostream &os) const;
|
||||
uint32_t GetSerializedSize (void) const;
|
||||
void Serialize (Buffer::Iterator start) const;
|
||||
uint32_t Deserialize (Buffer::Iterator start);
|
||||
virtual uint32_t GetSerializedSize (void) const;
|
||||
virtual void Serialize (Buffer::Iterator start) const;
|
||||
virtual uint32_t Deserialize (Buffer::Iterator start);
|
||||
private:
|
||||
uint16_t m_etherType;
|
||||
};
|
||||
|
||||
@@ -33,7 +33,6 @@ namespace olsr {
|
||||
|
||||
NS_LOG_COMPONENT_DEFINE("OlsrHeader");
|
||||
|
||||
|
||||
/// Scaling factor used in RFC 3626.
|
||||
#define OLSR_C 0.0625
|
||||
|
||||
@@ -95,12 +94,28 @@ EmfToSeconds (uint8_t olsrFormat)
|
||||
|
||||
// ---------------- OLSR Packet -------------------------------
|
||||
|
||||
NS_OBJECT_ENSURE_REGISTERED (PacketHeader);
|
||||
|
||||
PacketHeader::PacketHeader ()
|
||||
{}
|
||||
|
||||
PacketHeader::~PacketHeader ()
|
||||
{}
|
||||
|
||||
TypeId
|
||||
PacketHeader::GetTypeId (void)
|
||||
{
|
||||
static TypeId tid = TypeId ("ns3::olsr::PacketHeader")
|
||||
.SetParent<Header> ()
|
||||
;
|
||||
return tid;
|
||||
}
|
||||
TypeId
|
||||
PacketHeader::GetInstanceTypeId (void) const
|
||||
{
|
||||
return GetTypeId ();
|
||||
}
|
||||
|
||||
uint32_t
|
||||
PacketHeader::GetUid (void)
|
||||
{
|
||||
@@ -141,6 +156,8 @@ PacketHeader::Deserialize (Buffer::Iterator start)
|
||||
|
||||
// ---------------- OLSR Message -------------------------------
|
||||
|
||||
NS_OBJECT_ENSURE_REGISTERED (MessageHeader);
|
||||
|
||||
MessageHeader::MessageHeader ()
|
||||
: m_messageType (MessageHeader::MessageType (0))
|
||||
{}
|
||||
@@ -148,6 +165,20 @@ MessageHeader::MessageHeader ()
|
||||
MessageHeader::~MessageHeader ()
|
||||
{}
|
||||
|
||||
TypeId
|
||||
MessageHeader::GetTypeId (void)
|
||||
{
|
||||
static TypeId tid = TypeId ("ns3::olsr::MessageHeader")
|
||||
.SetParent<Header> ()
|
||||
;
|
||||
return tid;
|
||||
}
|
||||
TypeId
|
||||
MessageHeader::GetInstanceTypeId (void) const
|
||||
{
|
||||
return GetTypeId ();
|
||||
}
|
||||
|
||||
uint32_t
|
||||
MessageHeader::GetUid (void)
|
||||
{
|
||||
|
||||
@@ -95,6 +95,8 @@ private:
|
||||
uint16_t m_packetSequenceNumber;
|
||||
|
||||
public:
|
||||
static TypeId GetTypeId (void);
|
||||
virtual TypeId GetInstanceTypeId (void) const;
|
||||
static uint32_t GetUid (void);
|
||||
virtual void Print (std::ostream &os) const;
|
||||
virtual uint32_t GetSerializedSize (void) const;
|
||||
@@ -200,6 +202,8 @@ private:
|
||||
uint16_t m_messageSize;
|
||||
|
||||
public:
|
||||
static TypeId GetTypeId (void);
|
||||
virtual TypeId GetInstanceTypeId (void) const;
|
||||
static uint32_t GetUid (void);
|
||||
virtual void Print (std::ostream &os) const;
|
||||
virtual uint32_t GetSerializedSize (void) const;
|
||||
|
||||
@@ -33,13 +33,14 @@ public:
|
||||
BenchHeader ();
|
||||
bool IsOk (void) const;
|
||||
|
||||
static TypeId GetTypeId (void);
|
||||
virtual TypeId GetInstanceTypeId (void) const;
|
||||
static uint32_t GetUid (void);
|
||||
|
||||
static std::string GetName (void);
|
||||
void Print (std::ostream &os) const;
|
||||
uint32_t GetSerializedSize (void) const;
|
||||
void Serialize (Buffer::Iterator start) const;
|
||||
uint32_t Deserialize (Buffer::Iterator start);
|
||||
virtual uint32_t GetSerializedSize (void) const;
|
||||
virtual void Serialize (Buffer::Iterator start) const;
|
||||
virtual uint32_t Deserialize (Buffer::Iterator start);
|
||||
private:
|
||||
bool m_ok;
|
||||
};
|
||||
@@ -56,6 +57,24 @@ BenchHeader<N>::IsOk (void) const
|
||||
return m_ok;
|
||||
}
|
||||
|
||||
template <int N>
|
||||
TypeId
|
||||
BenchHeader<N>::GetTypeId (void)
|
||||
{
|
||||
std::ostringstream oss;
|
||||
oss << "ns3::BenchHeader<"<<N<<">";
|
||||
static TypeId tid = TypeId (oss.str ().c_str ())
|
||||
.SetParent<Header> ()
|
||||
;
|
||||
return tid;
|
||||
}
|
||||
template <int N>
|
||||
TypeId
|
||||
BenchHeader<N>::GetInstanceTypeId (void) const
|
||||
{
|
||||
return GetTypeId ();
|
||||
}
|
||||
|
||||
template <int N>
|
||||
uint32_t
|
||||
BenchHeader<N>::GetUid (void)
|
||||
|
||||
Reference in New Issue
Block a user