remove dead code.
--- a/samples/main-packet-header.cc Mon Mar 17 14:01:55 2008 -0700
+++ b/samples/main-packet-header.cc Mon Mar 17 14:49:52 2008 -0700
@@ -11,7 +11,6 @@
class MyHeader : public Header
{
public:
- static uint32_t GetUid (void);
MyHeader ();
virtual ~MyHeader ();
@@ -21,8 +20,7 @@
static TypeId GetTypeId (void);
virtual TypeId GetInstanceTypeId (void) const;
- std::string GetName (void) const;
- void Print (std::ostream &os) const;
+ virtual void Print (std::ostream &os) const;
virtual void Serialize (Buffer::Iterator start) const;
virtual uint32_t Deserialize (Buffer::Iterator start);
virtual uint32_t GetSerializedSize (void) const;
@@ -52,24 +50,6 @@
return GetTypeId ();
}
-uint32_t
-MyHeader::GetUid (void)
-{
- // This string is used by the internals of the packet
- // code to keep track of the packet metadata.
- // You need to make sure that this string is absolutely
- // unique. The code will detect any duplicate string.
- static uint32_t uid = AllocateUid<MyHeader> ("MyHeader.test.nsnam.org");
- return uid;
-}
-
-std::string
-MyHeader::GetName (void) const
-{
- // This string is used to identify the type of
- // my header by the packet printing routines.
- return "MYHEADER";
-}
void
MyHeader::Print (std::ostream &os) const
{
--- a/src/common/chunk-registry.cc Mon Mar 17 14:01:55 2008 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,117 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2005 INRIA
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
- */
-
-#include "chunk-registry.h"
-#include "ns3/assert.h"
-
-namespace ns3 {
-
-ChunkRegistry::InfoVector *
-ChunkRegistry::GetInfoVector (void)
-{
- static InfoVector vec;
- return &vec;
-}
-
-std::string
-ChunkRegistry::GetUidStringFromUid (uint32_t uid)
-{
- InfoVector *vec = GetInfoVector ();
- NS_ASSERT (uid >= 1 && uid <= vec->size ());
- Info info = (*vec)[uid - 1];
- return info.uidString;
-}
-uint32_t
-ChunkRegistry::GetUidFromUidString (std::string uidString)
-{
- uint32_t uid = 1;
- InfoVector *vec = GetInfoVector ();
- for (InfoVector::iterator i = vec->begin (); i != vec->end (); i++)
- {
- if (i->uidString == uidString)
- {
- return uid;
- }
- uid++;
- }
- NS_FATAL_ERROR ("Trying to access a non-registered Header or Trailer: \"" << uidString << "\". "<<
- "You could try calling NS_HEADER_ENSURE_REGISTER somewhere.");
- return 0;
-}
-
-uint8_t *
-ChunkRegistry::GetStaticInstance (uint32_t uid)
-{
- InfoVector *vec = GetInfoVector ();
- NS_ASSERT (uid >= 1 && uid <= vec->size ());
- Info info = (*vec)[uid - 1];
- return info.getStaticInstance ();
-}
-bool
-ChunkRegistry::IsHeader (uint32_t uid)
-{
- InfoVector *vec = GetInfoVector ();
- NS_ASSERT (uid >= 1 && uid <= vec->size ());
- Info info = (*vec)[uid - 1];
- return info.isHeader;
-}
-bool
-ChunkRegistry::IsTrailer (uint32_t uid)
-{
- return !IsHeader (uid);
-}
-uint32_t
-ChunkRegistry::Deserialize (uint32_t uid, uint8_t *instance, Buffer::Iterator i)
-{
- InfoVector *vec = GetInfoVector ();
- NS_ASSERT (uid >= 1 && uid <= vec->size ());
- Info info = (*vec)[uid - 1];
- return info.deserialize (instance, i);
-}
-void
-ChunkRegistry::Print (uint32_t uid, uint8_t *instance, std::ostream &os)
-{
- InfoVector *vec = GetInfoVector ();
- NS_ASSERT (uid >= 1 && uid <= vec->size ());
- Info info = (*vec)[uid - 1];
- return info.print (instance, os);
-}
-std::string
-ChunkRegistry::GetName (uint32_t uid, uint8_t *instance)
-{
- InfoVector *vec = GetInfoVector ();
- NS_ASSERT (uid >= 1 && uid <= vec->size ());
- Info info = (*vec)[uid - 1];
- return info.getName (instance);
-}
-void
-ChunkRegistry::InvokePrintCallback (uint32_t uid, uint8_t *instance, std::ostream &os,
- uint32_t packetUid, uint32_t size,
- CallbackBase callback)
-{
- InfoVector *vec = GetInfoVector ();
- NS_ASSERT (uid >= 1 && uid <= vec->size ());
- Info info = (*vec)[uid - 1];
- info.invokePrintCallback (instance, os, packetUid, size, callback);
-}
-
-
-} // namespace ns3
--- a/src/common/chunk-registry.h Mon Mar 17 14:01:55 2008 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,180 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2005 INRIA
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
- */
-
-#ifndef CHUNK_REGISTRY_H
-#define CHUNK_REGISTRY_H
-
-#include <stdint.h>
-#include <ostream>
-#include "buffer.h"
-#include "ns3/ptr.h"
-#include "ns3/callback.h"
-
-namespace ns3 {
-
-/**
- * \brief this registry keeps track of all different
- * types of headers and trailers and assigns to each of them
- * a unique integer.
- * \internal
- */
-class ChunkRegistry
-{
-public:
- template <typename T>
- static uint32_t RegisterHeader (std::string uuid);
- template <typename T>
- static uint32_t RegisterTrailer (std::string uuid);
-
- static std::string GetUidStringFromUid (uint32_t uid);
- static uint32_t GetUidFromUidString (std::string uidString);
- static uint8_t *GetStaticInstance (uint32_t uid);
- static uint32_t Deserialize (uint32_t uid, uint8_t *instance, Buffer::Iterator i);
- static void Print (uint32_t uid, uint8_t *instance, std::ostream &os);
- static std::string GetName (uint32_t uid, uint8_t *instance);
- static bool IsHeader (uint32_t uid);
- static bool IsTrailer (uint32_t uid);
- static void InvokePrintCallback (uint32_t uid, uint8_t *instance, std::ostream &os,
- uint32_t packetUid, uint32_t size,
- CallbackBase callback);
-private:
- typedef uint8_t *(*GetStaticInstanceCb) (void);
- typedef uint32_t (*DeserializeCb) (uint8_t *, Buffer::Iterator);
- typedef void (*PrintCb) (uint8_t *,std::ostream &);
- typedef std::string (*GetNameCb) (uint8_t *);
- typedef void (*InvokePrintCallbackCb) (uint8_t *instance, std::ostream &os,
- uint32_t packetUid, uint32_t size,
- CallbackBase callback);
- struct Info {
- std::string uidString;
- bool isHeader;
- GetStaticInstanceCb getStaticInstance;
- DeserializeCb deserialize;
- PrintCb print;
- GetNameCb getName;
- InvokePrintCallbackCb invokePrintCallback;
- };
- typedef std::vector<struct Info> InfoVector;
- static InfoVector *GetInfoVector (void);
- template <typename T>
- static uint8_t *DoGetStaticInstance (void);
- template <typename T>
- static uint32_t DoDeserialize (uint8_t *instance, Buffer::Iterator i);
- template <typename T>
- static void DoPrint (uint8_t *instance, std::ostream &os);
- template <typename T>
- static std::string DoGetName (uint8_t *instance);
- template <typename T>
- static void DoInvokePrintCallback (uint8_t *instance, std::ostream &os,
- uint32_t packetUid, uint32_t size,
- CallbackBase callback);
- template <typename T>
- static uint32_t GetUid (bool isHeader, std::string uidString);
-
-};
-
-
-} // namespace ns3
-
-namespace ns3 {
-
-template <typename T>
-uint32_t
-ChunkRegistry::RegisterHeader (std::string uuid)
-{
- return GetUid<T> (true, uuid);
-}
-template <typename T>
-uint32_t
-ChunkRegistry::RegisterTrailer (std::string uuid)
-{
- return GetUid<T> (false, uuid);
-}
-
-template <typename T>
-uint32_t
-ChunkRegistry::GetUid (bool isHeader, std::string uidString)
-{
- InfoVector *vec = GetInfoVector ();
- uint32_t uid = 1;
- for (InfoVector::iterator i = vec->begin (); i != vec->end (); i++)
- {
- if (i->uidString == uidString)
- {
- return uid;
- }
- uid++;
- }
- Info info;
- info.getStaticInstance = &ChunkRegistry::DoGetStaticInstance<T>;
- info.print = &ChunkRegistry::DoPrint<T>;
- info.getName = &ChunkRegistry::DoGetName<T>;
- info.deserialize = &ChunkRegistry::DoDeserialize<T>;
- info.invokePrintCallback = &ChunkRegistry::DoInvokePrintCallback<T>;
- info.uidString = uidString;
- info.isHeader = isHeader;
- vec->push_back (info);
- return vec->size ();
-}
-
-template <typename T>
-uint8_t *
-ChunkRegistry::DoGetStaticInstance ()
-{
- static T instance;
- return reinterpret_cast<uint8_t *> (&instance);
-}
-template <typename T>
-uint32_t
-ChunkRegistry::DoDeserialize (uint8_t *instance, Buffer::Iterator i)
-{
- T *obj = reinterpret_cast<T *> (instance);
- return obj->Deserialize (i);
-}
-template <typename T>
-void
-ChunkRegistry::DoPrint (uint8_t *instance, std::ostream &os)
-{
- T *obj = reinterpret_cast<T *> (instance);
- obj->Print (os);
-}
-template <typename T>
-std::string
-ChunkRegistry::DoGetName (uint8_t *instance)
-{
- T *obj = reinterpret_cast<T *> (instance);
- return obj->GetName ();
-}
-template <typename T>
-void
-ChunkRegistry::DoInvokePrintCallback (uint8_t *instance, std::ostream &os,
- uint32_t packetUid, uint32_t size,
- CallbackBase callback)
-{
- T *obj = reinterpret_cast<T *> (instance);
- Callback<void,std::ostream&,uint32_t,uint32_t,const T*> cb;
- cb.Assign (callback);
- cb (os, packetUid, size, obj);
-}
-
-} // namespace ns3
-
-#endif /* CHUNK_H */
--- a/src/common/header.cc Mon Mar 17 14:01:55 2008 -0700
+++ b/src/common/header.cc Mon Mar 17 14:49:52 2008 -0700
@@ -16,4 +16,10 @@
return tid;
}
+std::ostream & operator << (std::ostream &os, const Header &header)
+{
+ header.Print (os);
+ return os;
+}
+
} // namespace ns3
--- a/src/common/header.h Mon Mar 17 14:01:55 2008 -0700
+++ b/src/common/header.h Mon Mar 17 14:49:52 2008 -0700
@@ -22,30 +22,9 @@
#ifndef HEADER_H
#define HEADER_H
-#include "chunk-registry.h"
#include "ns3/object-base.h"
-
-/**
- * \relates ns3::Header
- * \brief this macro should be instantiated exactly once for each
- * new type of Header
- *
- * This macro will ensure that your new Header type is registered
- * within the packet header registry. In most cases, this macro
- * is not really needed but, for safety, please, use it all the
- * time.
- *
- * Note: This macro is _absolutely_ needed if you try to run a
- * distributed simulation.
- */
-#define NS_HEADER_ENSURE_REGISTERED(x) \
-static class thisisaveryverylongclassname ##x \
-{ \
- public: \
- thisisaveryverylongclassname ##x () \
- { uint32_t uid; uid = x::GetUid ();} \
-} g_thisisanotherveryveryverylongname ## x;
-
+#include "buffer.h"
+#include <stdint.h>
namespace ns3 {
@@ -57,21 +36,6 @@
* implement the following public methods:
* - a default constructor: is used by the internal implementation
* if the Packet class.
- * - a static method named GetUid: is used to uniquely identify
- * the type of each header. This method shall return a unique
- * integer allocated with Header::AllocateUid.
- * - a method named Print: is used by Packet::Print to print the
- * content of a header as ascii data to a c++ output stream.
- * Although the header is free to format its output as it
- * wishes, it is recommended to follow a few rules to integrate
- * with the packet pretty printer: start with flags, small field
- * values located between a pair of parens. Values should be separated
- * by whitespace. Follow the parens with the important fields,
- * separated by whitespace.
- * i.e.: (field1 val1 field2 val2 field3 val3) field4 val4 field5 val5
- * - a method named GetName: is used by Packet::Print to print
- * header fragments. This method should return a user-readable
- * single word as all capitalized letters.
*
* 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
@@ -113,21 +77,21 @@
* networks.
*/
virtual uint32_t Deserialize (Buffer::Iterator start) = 0;
-protected:
- template <typename T>
- static uint32_t AllocateUid (std::string uuid);
+ /**
+ * This method is used by Packet::Print to print the
+ * content of a trailer as ascii data to a c++ output stream.
+ * Although the trailer is free to format its output as it
+ * wishes, it is recommended to follow a few rules to integrate
+ * with the packet pretty printer: start with flags, small field
+ * values located between a pair of parens. Values should be separated
+ * by whitespace. Follow the parens with the important fields,
+ * separated by whitespace.
+ * i.e.: (field1 val1 field2 val2 field3 val3) field4 val4 field5 val5
+ */
+ virtual void Print (std::ostream &os) const = 0;
};
-} // namespace ns3
-
-namespace ns3 {
-
-template <typename T>
-uint32_t
-Header::AllocateUid (std::string uuid)
-{
- return ChunkRegistry::RegisterHeader<T> (uuid);
-}
+std::ostream & operator << (std::ostream &os, const Header &header);
} // namespace ns3
--- a/src/common/packet-metadata-test.cc Mon Mar 17 14:01:55 2008 -0700
+++ b/src/common/packet-metadata-test.cc Mon Mar 17 14:49:52 2008 -0700
@@ -34,13 +34,11 @@
class HistoryHeader : public Header
{
public:
+ HistoryHeader ();
+ bool IsOk (void) const;
static TypeId GetTypeId (void);
virtual TypeId GetInstanceTypeId (void) const;
- static uint32_t GetUid (void);
- HistoryHeader ();
- bool IsOk (void) const;
- std::string GetName (void) const;
- void Print (std::ostream &os) const;
+ virtual void Print (std::ostream &os) const;
virtual uint32_t GetSerializedSize (void) const;
virtual void Serialize (Buffer::Iterator start) const;
virtual uint32_t Deserialize (Buffer::Iterator start);
@@ -49,6 +47,18 @@
};
template <int N>
+HistoryHeader<N>::HistoryHeader ()
+ : m_ok (false)
+{}
+
+template <int N>
+bool
+HistoryHeader<N>::IsOk (void) const
+{
+ return m_ok;
+}
+
+template <int N>
TypeId
HistoryHeader<N>::GetTypeId (void)
{
@@ -66,38 +76,6 @@
{
return GetTypeId ();
}
-
-template <int N>
-uint32_t
-HistoryHeader<N>::GetUid (void)
-{
- std::ostringstream oss;
- oss << N << "HistoryHeader.ns3";
- static uint32_t uid = AllocateUid<HistoryHeader<N> > (oss.str());
- return uid;
-}
-
-template <int N>
-HistoryHeader<N>::HistoryHeader ()
- : m_ok (false)
-{}
-
-template <int N>
-bool
-HistoryHeader<N>::IsOk (void) const
-{
- return m_ok;
-}
-
-template <int N>
-std::string
-HistoryHeader<N>::GetName (void) const
-{
- std::ostringstream oss;
- oss << N;
- return oss.str ();
-}
-
template <int N>
void
HistoryHeader<N>::Print (std::ostream &os) const
@@ -135,13 +113,12 @@
class HistoryTrailer : public Trailer
{
public:
+ HistoryTrailer ();
+ bool IsOk (void) const;
+
static TypeId GetTypeId (void);
virtual TypeId GetInstanceTypeId (void) const;
- static uint32_t GetUid (void);
- HistoryTrailer ();
- bool IsOk (void) const;
- std::string GetName (void) const;
- void Print (std::ostream &os) const;
+ virtual void Print (std::ostream &os) const;
virtual uint32_t GetSerializedSize (void) const;
virtual void Serialize (Buffer::Iterator start) const;
virtual uint32_t Deserialize (Buffer::Iterator start);
@@ -149,6 +126,17 @@
bool m_ok;
};
+template <int N>
+HistoryTrailer<N>::HistoryTrailer ()
+ : m_ok (false)
+{}
+
+template <int N>
+bool
+HistoryTrailer<N>::IsOk (void) const
+{
+ return m_ok;
+}
template <int N>
TypeId
@@ -168,38 +156,6 @@
{
return GetTypeId ();
}
-
-template <int N>
-uint32_t
-HistoryTrailer<N>::GetUid (void)
-{
- std::ostringstream oss;
- oss << N << "HistoryTrailer.ns3";
- static uint32_t uid = AllocateUid<HistoryTrailer<N> > (oss.str ());
- return uid;
-}
-
-
-template <int N>
-HistoryTrailer<N>::HistoryTrailer ()
- : m_ok (false)
-{}
-
-template <int N>
-bool
-HistoryTrailer<N>::IsOk (void) const
-{
- return m_ok;
-}
-
-template <int N>
-std::string
-HistoryTrailer<N>::GetName (void) const
-{
- std::ostringstream oss;
- oss << N;
- return oss.str ();
-}
template <int N>
void
HistoryTrailer<N>::Print (std::ostream &os) const
--- a/src/common/trailer.cc Mon Mar 17 14:01:55 2008 -0700
+++ b/src/common/trailer.cc Mon Mar 17 14:49:52 2008 -0700
@@ -16,4 +16,10 @@
return tid;
}
+std::ostream & operator << (std::ostream &os, const Trailer &trailer)
+{
+ trailer.Print (os);
+ return os;
+}
+
} // namespace ns3
--- a/src/common/trailer.h Mon Mar 17 14:01:55 2008 -0700
+++ b/src/common/trailer.h Mon Mar 17 14:49:52 2008 -0700
@@ -23,30 +23,9 @@
#define TRAILER_H
#include "ns3/object-base.h"
-#include "chunk-registry.h"
#include "buffer.h"
#include <stdint.h>
-/**
- * \relates ns3::Trailer
- * \brief this macro should be instantiated exactly once for each
- * new type of Trailer
- *
- * This macro will ensure that your new Trailer type is registered
- * within the packet trailer registry. In most cases, this macro
- * is not really needed but, for safety, please, use it all the
- * time.
- *
- * Note: This macro is _absolutely_ needed if you try to run a
- * distributed simulation.
- */
-#define NS_TRAILER_ENSURE_REGISTERED(x) \
-static class thisisaveryverylongclassname ##x \
-{ \
- public: \
- thisisaveryverylongclassname ##x () \
- { uint32_t uid; uid = x::GetUid ();} \
-} g_thisisanotherveryveryverylongname ##x;
namespace ns3 {
@@ -58,22 +37,6 @@
* implement the following public methods:
* - a default constructor: is used by the internal implementation
* if the Packet class.
- * - a static method named GetUid: is used to uniquely identify
- * the type of each trailer. This method shall return a unique
- * integer allocated with Trailer::AllocateUid.
- * - a method named Print: is used by Packet::Print to print the
- * content of a trailer as ascii data to a c++ output stream.
- * Although the trailer is free to format its output as it
- * wishes, it is recommended to follow a few rules to integrate
- * with the packet pretty printer: start with flags, small field
- * values located between a pair of parens. Values should be separated
- * by whitespace. Follow the parens with the important fields,
- * separated by whitespace.
- * i.e.: (field1 val1 field2 val2 field3 val3) field4 val4 field5 val5
- * - a method named GetName: is used by Packet::Print to print
- * trailer fragments. This method should return a user-readable
- * single word as all capitalized letters.
- *
*/
class Trailer : public ObjectBase
{
@@ -116,22 +79,21 @@
* Buffer::Iterator::Prev prio to actually reading any data.
*/
virtual uint32_t Deserialize (Buffer::Iterator end) = 0;
-protected:
- template <typename T>
- static uint32_t AllocateUid (std::string uidString);
+ /**
+ * This method is used by Packet::Print to print the
+ * content of a trailer as ascii data to a c++ output stream.
+ * Although the trailer is free to format its output as it
+ * wishes, it is recommended to follow a few rules to integrate
+ * with the packet pretty printer: start with flags, small field
+ * values located between a pair of parens. Values should be separated
+ * by whitespace. Follow the parens with the important fields,
+ * separated by whitespace.
+ * i.e.: (field1 val1 field2 val2 field3 val3) field4 val4 field5 val5
+ */
+ virtual void Print (std::ostream &os) const = 0;
};
-} // namespace ns3
-
-namespace ns3 {
-
-template <typename T>
-uint32_t
-Trailer::AllocateUid (std::string uidString)
-{
- return ChunkRegistry::RegisterTrailer<T> (uidString);
-}
-
+std::ostream & operator << (std::ostream &os, const Trailer &trailer);
} // namespace ns3
--- a/src/common/wscript Mon Mar 17 14:01:55 2008 -0700
+++ b/src/common/wscript Mon Mar 17 14:49:52 2008 -0700
@@ -4,7 +4,6 @@
common = bld.create_ns3_module('common', ['core', 'simulator'])
common.source = [
'buffer.cc',
- 'chunk-registry.cc',
'packet-metadata.cc',
'packet-metadata-test.cc',
'packet.cc',
@@ -21,7 +20,6 @@
headers.module = 'common'
headers.source = [
'buffer.h',
- 'chunk-registry.h',
'header.h',
'trailer.h',
'tags.h',
--- a/src/devices/wifi/mgt-headers.cc Mon Mar 17 14:01:55 2008 -0700
+++ b/src/devices/wifi/mgt-headers.cc Mon Mar 17 14:49:52 2008 -0700
@@ -74,17 +74,6 @@
{
return GetTypeId ();
}
-uint32_t
-MgtProbeRequestHeader::GetUid (void)
-{
- static uint32_t uid = AllocateUid<MgtProbeRequestHeader> ("MgtProbeRequestHeader.ns3.inria.fr");
- return uid;
-}
-std::string
-MgtProbeRequestHeader::GetName (void) const
-{
- return "PROBEREQ";
-}
void
MgtProbeRequestHeader::Print (std::ostream &os) const
{
@@ -164,17 +153,6 @@
return GetTypeId ();
}
uint32_t
-MgtProbeResponseHeader::GetUid (void)
-{
- static uint32_t uid = AllocateUid<MgtProbeResponseHeader> ("MgtProbeResponseHeader.ns3.inria.fr");
- return uid;
-}
-std::string
-MgtProbeResponseHeader::GetName (void) const
-{
- return "PROBERESP";
-}
-uint32_t
MgtProbeResponseHeader::GetSerializedSize (void) const
{
uint32_t size = 0;
@@ -283,17 +261,6 @@
{
return GetTypeId ();
}
-uint32_t
-MgtAssocRequestHeader::GetUid (void)
-{
- static uint32_t uid = AllocateUid<MgtAssocRequestHeader> ("MgtAssocRequestHeader.ns3.inria.fr");
- return uid;
-}
-std::string
-MgtAssocRequestHeader::GetName (void) const
-{
- return "ASSOCREQ";
-}
uint32_t
MgtAssocRequestHeader::GetSerializedSize (void) const
{
@@ -376,17 +343,6 @@
return GetTypeId ();
}
uint32_t
-MgtAssocResponseHeader::GetUid (void)
-{
- static uint32_t uid = AllocateUid<MgtAssocResponseHeader> ("MgtAssocResponseHeader.ns3.inria.fr");
- return uid;
-}
-std::string
-MgtAssocResponseHeader::GetName (void) const
-{
- return "ASSOCRESP";
-}
-uint32_t
MgtAssocResponseHeader::GetSerializedSize (void) const
{
uint32_t size = 0;
--- a/src/devices/wifi/mgt-headers.h Mon Mar 17 14:01:55 2008 -0700
+++ b/src/devices/wifi/mgt-headers.h Mon Mar 17 14:49:52 2008 -0700
@@ -46,9 +46,7 @@
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;
+ virtual void Print (std::ostream &os) const;
virtual uint32_t GetSerializedSize (void) const;
virtual void Serialize (Buffer::Iterator start) const;
virtual uint32_t Deserialize (Buffer::Iterator start);
@@ -73,9 +71,7 @@
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;
+ virtual void Print (std::ostream &os) const;
virtual uint32_t GetSerializedSize (void) const;
virtual void Serialize (Buffer::Iterator start) const;
virtual uint32_t Deserialize (Buffer::Iterator start);
@@ -98,9 +94,7 @@
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;
+ virtual void Print (std::ostream &os) const;
virtual uint32_t GetSerializedSize (void) const;
virtual void Serialize (Buffer::Iterator start) const;
virtual uint32_t Deserialize (Buffer::Iterator start);
@@ -125,9 +119,7 @@
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;
+ virtual void Print (std::ostream &os) const;
virtual uint32_t GetSerializedSize (void) const;
virtual void Serialize (Buffer::Iterator start) const;
virtual uint32_t Deserialize (Buffer::Iterator start);
--- a/src/devices/wifi/wifi-mac-header.cc Mon Mar 17 14:01:55 2008 -0700
+++ b/src/devices/wifi/wifi-mac-header.cc Mon Mar 17 14:49:52 2008 -0700
@@ -781,18 +781,6 @@
{
return GetTypeId ();
}
-uint32_t
-WifiMacHeader::GetUid (void)
-{
- static uint32_t uid = AllocateUid<WifiMacHeader> ("WifiMacHeader.ns3.inria.fr");
- return uid;
-}
-
-std::string
-WifiMacHeader::GetName (void) const
-{
- return "802.11";
-}
void
WifiMacHeader::PrintFrameControl (std::ostream &os) const
--- a/src/devices/wifi/wifi-mac-header.h Mon Mar 17 14:01:55 2008 -0700
+++ b/src/devices/wifi/wifi-mac-header.h Mon Mar 17 14:49:52 2008 -0700
@@ -71,9 +71,7 @@
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;
+ virtual void Print (std::ostream &os) const;
virtual uint32_t GetSerializedSize (void) const;
virtual void Serialize (Buffer::Iterator start) const;
virtual uint32_t Deserialize (Buffer::Iterator start);
--- a/src/devices/wifi/wifi-mac-trailer.cc Mon Mar 17 14:01:55 2008 -0700
+++ b/src/devices/wifi/wifi-mac-trailer.cc Mon Mar 17 14:49:52 2008 -0700
@@ -44,19 +44,6 @@
return GetTypeId ();
}
-uint32_t
-WifiMacTrailer::GetUid (void)
-{
- static uint32_t uid = AllocateUid<WifiMacTrailer> ("WifiMacTrailer.ns3.inria.fr");
- return uid;
-}
-
-std::string
-WifiMacTrailer::GetName (void) const
-{
- return "802.11 FCS";
-}
-
void
WifiMacTrailer::Print (std::ostream &os) const
{}
--- a/src/devices/wifi/wifi-mac-trailer.h Mon Mar 17 14:01:55 2008 -0700
+++ b/src/devices/wifi/wifi-mac-trailer.h Mon Mar 17 14:49:52 2008 -0700
@@ -33,9 +33,7 @@
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;
+ virtual void Print (std::ostream &os) const;
virtual uint32_t GetSerializedSize (void) const;
virtual void Serialize (Buffer::Iterator start) const;
virtual uint32_t Deserialize (Buffer::Iterator start);
--- a/src/internet-node/arp-header.cc Mon Mar 17 14:01:55 2008 -0700
+++ b/src/internet-node/arp-header.cc Mon Mar 17 14:49:52 2008 -0700
@@ -25,30 +25,8 @@
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)
-{
- static uint32_t uid = AllocateUid<ArpHeader> ("ArpHeader.ns3");
- return uid;
-}
-
void
ArpHeader::SetRequest (Address sourceHardwareAddress,
Ipv4Address sourceProtocolAddress,
@@ -104,12 +82,20 @@
return m_ipv4Dest;
}
-std::string
-ArpHeader::GetName (void) const
+
+TypeId
+ArpHeader::GetTypeId (void)
{
- return "ARP";
+ static TypeId tid = TypeId ("ns3::ArpHeader")
+ .SetParent<Header> ()
+ ;
+ return tid;
}
-
+TypeId
+ArpHeader::GetInstanceTypeId (void) const
+{
+ return GetTypeId ();
+}
void
ArpHeader::Print (std::ostream &os) const
{
--- a/src/internet-node/arp-header.h Mon Mar 17 14:01:55 2008 -0700
+++ b/src/internet-node/arp-header.h Mon Mar 17 14:49:52 2008 -0700
@@ -34,10 +34,6 @@
class ArpHeader : public Header
{
public:
- static TypeId GetTypeId (void);
- virtual TypeId GetInstanceTypeId (void) const;
- static uint32_t GetUid (void);
-
void SetRequest (Address sourceHardwareAddress,
Ipv4Address sourceProtocolAddress,
Address destinationHardwareAddress,
@@ -53,11 +49,12 @@
Ipv4Address GetSourceIpv4Address (void);
Ipv4Address GetDestinationIpv4Address (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);
+ static TypeId GetTypeId (void);
+ virtual TypeId GetInstanceTypeId (void) const;
+ virtual void Print (std::ostream &os) const;
+ virtual uint32_t GetSerializedSize (void) const;
+ virtual void Serialize (Buffer::Iterator start) const;
+ virtual uint32_t Deserialize (Buffer::Iterator start);
enum ArpType_e {
ARP_TYPE_REQUEST = 1,
--- a/src/internet-node/ipv4-header.cc Mon Mar 17 14:01:55 2008 -0700
+++ b/src/internet-node/ipv4-header.cc Mon Mar 17 14:49:52 2008 -0700
@@ -28,32 +28,10 @@
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)
-{
- static uint32_t uid = AllocateUid<Ipv4Header> ("Ipv4Header.ns3");
- return uid;
-}
-
Ipv4Header::Ipv4Header ()
: m_payloadSize (0),
m_identification (0),
@@ -201,12 +179,20 @@
return m_goodChecksum;
}
-std::string
-Ipv4Header::GetName (void) const
+
+TypeId
+Ipv4Header::GetTypeId (void)
{
- return "IPV4";
+ static TypeId tid = TypeId ("ns3::Ipv4Header")
+ .SetParent<Header> ()
+ ;
+ return tid;
}
-
+TypeId
+Ipv4Header::GetInstanceTypeId (void) const
+{
+ return GetTypeId ();
+}
void
Ipv4Header::Print (std::ostream &os) const
{
--- a/src/internet-node/ipv4-header.h Mon Mar 17 14:01:55 2008 -0700
+++ b/src/internet-node/ipv4-header.h Mon Mar 17 14:49:52 2008 -0700
@@ -32,9 +32,6 @@
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,8 +139,9 @@
*/
bool IsChecksumOk (void) const;
- std::string GetName (void) const;
- void Print (std::ostream &os) const;
+ static TypeId GetTypeId (void);
+ virtual TypeId GetInstanceTypeId (void) const;
+ virtual void Print (std::ostream &os) const;
virtual uint32_t GetSerializedSize (void) const;
virtual void Serialize (Buffer::Iterator start) const;
virtual uint32_t Deserialize (Buffer::Iterator start);
--- a/src/internet-node/tcp-header.cc Mon Mar 17 14:01:55 2008 -0700
+++ b/src/internet-node/tcp-header.cc Mon Mar 17 14:49:52 2008 -0700
@@ -26,32 +26,10 @@
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)
-{
- static uint32_t uid = AllocateUid<TcpHeader> ("TcpHeader.ns3");
- return uid;
-}
-
TcpHeader::TcpHeader ()
: m_sourcePort (0),
m_destinationPort (0),
@@ -156,12 +134,19 @@
//XXX requires peeking into IP to get length of the TCP segment
}
-std::string
-TcpHeader::GetName (void) const
+TypeId
+TcpHeader::GetTypeId (void)
{
- return "TCP";
+ static TypeId tid = TypeId ("ns3::TcpHeader")
+ .SetParent<Header> ()
+ ;
+ return tid;
}
-
+TypeId
+TcpHeader::GetInstanceTypeId (void) const
+{
+ return GetTypeId ();
+}
void TcpHeader::Print (std::ostream &os) const
{
//XXX
--- a/src/internet-node/tcp-header.h Mon Mar 17 14:01:55 2008 -0700
+++ b/src/internet-node/tcp-header.h Mon Mar 17 14:49:52 2008 -0700
@@ -33,10 +33,6 @@
class TcpHeader : public Header
{
public:
- static TypeId GetTypeId (void);
- virtual TypeId GetInstanceTypeId (void) const;
- static uint32_t GetUid (void);
-
TcpHeader ();
virtual ~TcpHeader ();
@@ -139,8 +135,9 @@
typedef enum { NONE = 0, FIN = 1, SYN = 2, RST = 4, PSH = 8, ACK = 16,
URG = 32} Flags_t;
- std::string GetName (void) const;
- void Print (std::ostream &os) const;
+ static TypeId GetTypeId (void);
+ virtual TypeId GetInstanceTypeId (void) const;
+ virtual void Print (std::ostream &os) const;
virtual uint32_t GetSerializedSize (void) const;
virtual void Serialize (Buffer::Iterator start) const;
virtual uint32_t Deserialize (Buffer::Iterator start);
--- a/src/internet-node/udp-header.cc Mon Mar 17 14:01:55 2008 -0700
+++ b/src/internet-node/udp-header.cc Mon Mar 17 14:49:52 2008 -0700
@@ -24,32 +24,10 @@
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)
-{
- static uint32_t uid = AllocateUid<UdpHeader> ("UdpHeader.ns3");
- return uid;
-}
-
/* The magic values below are used only for debugging.
* They can be used to easily detect memory corruption
* problems so you can see the patterns in memory.
@@ -115,12 +93,19 @@
m_initialChecksum = Ipv4ChecksumCalculate (0, buf, 12);
}
-std::string
-UdpHeader::GetName (void) const
+TypeId
+UdpHeader::GetTypeId (void)
{
- return "UDP";
+ static TypeId tid = TypeId ("ns3::UdpHeader")
+ .SetParent<Header> ()
+ ;
+ return tid;
}
-
+TypeId
+UdpHeader::GetInstanceTypeId (void) const
+{
+ return GetTypeId ();
+}
void
UdpHeader::Print (std::ostream &os) const
{
--- a/src/internet-node/udp-header.h Mon Mar 17 14:01:55 2008 -0700
+++ b/src/internet-node/udp-header.h Mon Mar 17 14:49:52 2008 -0700
@@ -34,9 +34,6 @@
class UdpHeader : public Header
{
public:
- static TypeId GetTypeId (void);
- virtual TypeId GetInstanceTypeId (void) const;
- static uint32_t GetUid (void);
/**
* \brief Constructor
@@ -86,8 +83,9 @@
Ipv4Address destination,
uint8_t protocol);
- std::string GetName (void) const;
- void Print (std::ostream &os) const;
+ static TypeId GetTypeId (void);
+ virtual TypeId GetInstanceTypeId (void) const;
+ virtual void Print (std::ostream &os) const;
virtual uint32_t GetSerializedSize (void) const;
virtual void Serialize (Buffer::Iterator start) const;
virtual uint32_t Deserialize (Buffer::Iterator start);
--- a/src/node/ethernet-header.cc Mon Mar 17 14:01:55 2008 -0700
+++ b/src/node/ethernet-header.cc Mon Mar 17 14:49:52 2008 -0700
@@ -31,30 +31,8 @@
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)
-{
- static uint32_t uid = AllocateUid<EthernetHeader> ("EthernetHeader.ns3");
- return uid;
-}
-
EthernetHeader::EthernetHeader (bool hasPreamble)
: m_enPreambleSfd (hasPreamble),
m_lengthType (0)
@@ -121,12 +99,20 @@
return GetSerializedSize();
}
-std::string
-EthernetHeader::GetName (void) const
+
+TypeId
+EthernetHeader::GetTypeId (void)
{
- return "ETHERNET";
+ static TypeId tid = TypeId ("ns3::EthernetHeader")
+ .SetParent<Header> ()
+ ;
+ return tid;
}
-
+TypeId
+EthernetHeader::GetInstanceTypeId (void) const
+{
+ return GetTypeId ();
+}
void
EthernetHeader::Print (std::ostream &os) const
{
--- a/src/node/ethernet-header.h Mon Mar 17 14:01:55 2008 -0700
+++ b/src/node/ethernet-header.h Mon Mar 17 14:49:52 2008 -0700
@@ -49,9 +49,6 @@
class EthernetHeader : public Header
{
public:
- static TypeId GetTypeId (void);
- virtual TypeId GetInstanceTypeId (void) const;
- static uint32_t GetUid (void);
/**
* \brief Construct a null ethernet header
@@ -105,8 +102,9 @@
*/
uint32_t GetHeaderSize() const;
- std::string GetName (void) const;
- void Print (std::ostream &os) const;
+ static TypeId GetTypeId (void);
+ virtual TypeId GetInstanceTypeId (void) const;
+ virtual void Print (std::ostream &os) const;
virtual uint32_t GetSerializedSize (void) const;
virtual void Serialize (Buffer::Iterator start) const;
virtual uint32_t Deserialize (Buffer::Iterator start);
--- a/src/node/ethernet-trailer.cc Mon Mar 17 14:01:55 2008 -0700
+++ b/src/node/ethernet-trailer.cc Mon Mar 17 14:49:52 2008 -0700
@@ -28,32 +28,10 @@
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)
-{
- static uint32_t uid = AllocateUid<EthernetTrailer> ("EthernetTrailer.ns3");
- return uid;
-}
-
EthernetTrailer::EthernetTrailer ()
{
Init();
@@ -76,7 +54,9 @@
if (!m_calcFcs)
{
return true;
- } else {
+ }
+ else
+ {
NS_LOG_WARN ("FCS calculation is not yet enabled");
return false;
}
@@ -105,12 +85,20 @@
{
return GetSerializedSize();
}
-std::string
-EthernetTrailer::GetName (void) const
+
+TypeId
+EthernetTrailer::GetTypeId (void)
{
- return "ETHERNET";
+ static TypeId tid = TypeId ("ns3::EthernetTrailer")
+ .SetParent<Trailer> ()
+ ;
+ return tid;
}
-
+TypeId
+EthernetTrailer::GetInstanceTypeId (void) const
+{
+ return GetTypeId ();
+}
void
EthernetTrailer::Print (std::ostream &os) const
{
--- a/src/node/ethernet-trailer.h Mon Mar 17 14:01:55 2008 -0700
+++ b/src/node/ethernet-trailer.h Mon Mar 17 14:49:52 2008 -0700
@@ -39,10 +39,6 @@
class EthernetTrailer : public Trailer
{
public:
- static TypeId GetTypeId (void);
- virtual TypeId GetInstanceTypeId (void) const;
- static uint32_t GetUid (void);
-
/**
* \brief Construct a null ethernet trailer
*/
@@ -85,11 +81,12 @@
*/
uint32_t GetTrailerSize() const;
- std::string GetName (void) const;
- void Print (std::ostream &os) const;
- uint32_t GetSerializedSize (void) const;
- void Serialize (Buffer::Iterator end) const;
- uint32_t Deserialize (Buffer::Iterator end);
+ static TypeId GetTypeId (void);
+ virtual TypeId GetInstanceTypeId (void) const;
+ virtual void Print (std::ostream &os) const;
+ virtual uint32_t GetSerializedSize (void) const;
+ virtual void Serialize (Buffer::Iterator end) const;
+ virtual uint32_t Deserialize (Buffer::Iterator end);
private:
/**
--- a/src/node/llc-snap-header.cc Mon Mar 17 14:01:55 2008 -0700
+++ b/src/node/llc-snap-header.cc Mon Mar 17 14:49:52 2008 -0700
@@ -25,30 +25,8 @@
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)
-{
- static uint32_t uid = AllocateUid<LlcSnapHeader> ("LlcSnapHeader.ns3");
- return uid;
-}
-
LlcSnapHeader::LlcSnapHeader ()
{}
@@ -69,12 +47,19 @@
return 1 + 1 + 1 + 3 + 2;
}
-std::string
-LlcSnapHeader::GetName (void) const
+TypeId
+LlcSnapHeader::GetTypeId (void)
{
- return "LLCSNAP";
+ static TypeId tid = TypeId ("ns3::LlcSnapHeader")
+ .SetParent<Header> ()
+ ;
+ return tid;
}
-
+TypeId
+LlcSnapHeader::GetInstanceTypeId (void) const
+{
+ return GetTypeId ();
+}
void
LlcSnapHeader::Print (std::ostream &os) const
{
--- a/src/node/llc-snap-header.h Mon Mar 17 14:01:55 2008 -0700
+++ b/src/node/llc-snap-header.h Mon Mar 17 14:49:52 2008 -0700
@@ -31,17 +31,14 @@
class LlcSnapHeader : public Header
{
public:
- static TypeId GetTypeId (void);
- virtual TypeId GetInstanceTypeId (void) const;
- static uint32_t GetUid (void);
-
LlcSnapHeader ();
void SetType (uint16_t type);
uint16_t GetType (void);
- std::string GetName (void) const;
- void Print (std::ostream &os) const;
+ static TypeId GetTypeId (void);
+ virtual TypeId GetInstanceTypeId (void) const;
+ virtual void Print (std::ostream &os) const;
virtual uint32_t GetSerializedSize (void) const;
virtual void Serialize (Buffer::Iterator start) const;
virtual uint32_t Deserialize (Buffer::Iterator start);
--- a/src/routing/olsr/olsr-header.cc Mon Mar 17 14:01:55 2008 -0700
+++ b/src/routing/olsr/olsr-header.cc Mon Mar 17 14:49:52 2008 -0700
@@ -116,14 +116,6 @@
return GetTypeId ();
}
-uint32_t
-PacketHeader::GetUid (void)
-{
- static uint32_t uid = AllocateUid<PacketHeader>
- ("PacketHeader.nsnam.org");
- return uid;
-}
-
uint32_t
PacketHeader::GetSerializedSize (void) const
{
@@ -180,14 +172,6 @@
}
uint32_t
-MessageHeader::GetUid (void)
-{
- static uint32_t uid = AllocateUid<MessageHeader>
- ("MessageHeader.nsnam.org");
- return uid;
-}
-
-uint32_t
MessageHeader::GetSerializedSize (void) const
{
uint32_t size = OLSR_MSG_HEADER_SIZE;
--- a/src/routing/olsr/olsr-header.h Mon Mar 17 14:01:55 2008 -0700
+++ b/src/routing/olsr/olsr-header.h Mon Mar 17 14:49:52 2008 -0700
@@ -97,12 +97,10 @@
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;
virtual void Serialize (Buffer::Iterator start) const;
virtual uint32_t Deserialize (Buffer::Iterator start);
- virtual std::string GetName (void) const { return "OlsrPacket"; }
};
@@ -204,12 +202,10 @@
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;
virtual void Serialize (Buffer::Iterator start) const;
virtual uint32_t Deserialize (Buffer::Iterator start);
- virtual std::string GetName (void) const { return "OlsrMessage"; }
// 5.1. MID Message Format
//
--- a/utils/bench-packets.cc Mon Mar 17 14:01:55 2008 -0700
+++ b/utils/bench-packets.cc Mon Mar 17 14:49:52 2008 -0700
@@ -35,9 +35,7 @@
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;
+ virtual void Print (std::ostream &os) const;
virtual uint32_t GetSerializedSize (void) const;
virtual void Serialize (Buffer::Iterator start) const;
virtual uint32_t Deserialize (Buffer::Iterator start);
@@ -76,23 +74,6 @@
}
template <int N>
-uint32_t
-BenchHeader<N>::GetUid (void)
-{
- static uint32_t uid = AllocateUid<BenchHeader<N> > (GetName ());
- return uid;
-}
-
-template <int N>
-std::string
-BenchHeader<N>::GetName (void)
-{
- std::ostringstream oss;
- oss << "BenchHeader" << N;
- return oss.str ();
-}
-
-template <int N>
void
BenchHeader<N>::Print (std::ostream &os) const
{