define a TypeId for each Header/Trailer.
This commit is contained in:
1 parent
5779a9145c
commit
be79c178e4
29 files changed
+416
-44
No files matched your search
@@ -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;
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user