21 #include "ns3/packet.h"
22 #include "ns3/uinteger.h"
31 static TypeId GetTypeId (
void);
32 virtual TypeId GetInstanceTypeId (
void)
const;
33 virtual uint32_t GetSerializedSize (
void)
const;
34 virtual void Serialize (
TagBuffer i)
const;
36 virtual void Print (std::ostream &os)
const;
39 void SetSimpleValue (uint8_t value);
40 uint8_t GetSimpleValue (
void)
const;
50 .AddConstructor<MyTag> ()
51 .AddAttribute (
"SimpleValue",
55 MakeUintegerChecker<uint8_t> ())
77 m_simpleValue = i.
ReadU8 ();
82 os <<
"v=" << (uint32_t)m_simpleValue;
87 m_simpleValue = value;
96 int main (
int argc,
char *argv[])
117 std::cout << std::endl;
void PrintPacketTags(std::ostream &os) const
Print the list of packet tags.
static TypeId GetTypeId(void)
void AddPacketTag(const Tag &tag) const
Add a packet tag.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
TAG_BUFFER_INLINE uint8_t ReadU8(void)
void SetSimpleValue(uint8_t value)
bool PeekPacketTag(Tag &tag) const
Search a matching tag and call Tag::Deserialize if it is found.
A class for an empty attribute value.
virtual void Serialize(TagBuffer i) const
Ptr< Packet > Copy(void) const
performs a COW copy of the packet.
tag a set of bytes in a packet
Every class exported by the ns3 library is enclosed in the ns3 namespace.
virtual uint32_t GetSerializedSize(void) const
TAG_BUFFER_INLINE void WriteU8(uint8_t v)
virtual void Deserialize(TagBuffer i)
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
a unique identifier for an interface.
virtual void Print(std::ostream &os) const
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
TypeId SetParent(TypeId tid)
uint8_t GetSimpleValue(void) const