A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
Loading...
Searching...
No Matches
tag.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2008 INRIA
3
*
4
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
7
*/
8
#ifndef TAG_H
9
#define TAG_H
10
11
#include "
tag-buffer.h
"
12
13
#include "ns3/object-base.h"
14
15
#include <stdint.h>
16
17
namespace
ns3
18
{
19
20
/**
21
* @ingroup packet
22
*
23
* @brief tag a set of bytes in a packet
24
*
25
* New kinds of tags can be created by subclassing from this abstract base class.
26
*/
27
class
Tag
:
public
ObjectBase
28
{
29
public
:
30
/**
31
* @brief Get the type ID.
32
* @return the object TypeId
33
*/
34
static
TypeId
GetTypeId
();
35
36
/**
37
* @returns the number of bytes required to serialize the data of the tag.
38
*
39
* This method is typically invoked by Packet::AddPacketTag or Packet::AddByteTag
40
* just prior to calling Tag::Serialize.
41
*/
42
virtual
uint32_t
GetSerializedSize
()
const
= 0;
43
/**
44
* @param i the buffer to write data into.
45
*
46
* Write the content of the tag in the provided tag buffer.
47
* DO NOT attempt to write more bytes than you requested
48
* with Tag::GetSerializedSize.
49
*/
50
virtual
void
Serialize
(
TagBuffer
i)
const
= 0;
51
/**
52
* @param i the buffer to read data from.
53
*
54
* Read the content of the tag from the provided tag buffer.
55
* DO NOT attempt to read more bytes than you wrote with
56
* Tag::Serialize.
57
*/
58
virtual
void
Deserialize
(
TagBuffer
i) = 0;
59
60
/**
61
* @param os the stream to print to
62
*
63
* This method is typically invoked from the Packet::PrintByteTags
64
* or Packet::PrintPacketTags methods.
65
*/
66
virtual
void
Print
(std::ostream& os)
const
= 0;
67
};
68
69
}
// namespace ns3
70
71
#endif
/* TAG_H */
ns3::ObjectBase
Anchor the ns-3 type and attribute system.
Definition
object-base.h:162
ns3::TagBuffer
read and write tag data
Definition
tag-buffer.h:41
ns3::Tag
tag a set of bytes in a packet
Definition
tag.h:28
ns3::Tag::GetSerializedSize
virtual uint32_t GetSerializedSize() const =0
ns3::Tag::Serialize
virtual void Serialize(TagBuffer i) const =0
ns3::Tag::Print
virtual void Print(std::ostream &os) const =0
ns3::Tag::Deserialize
virtual void Deserialize(TagBuffer i)=0
ns3::Tag::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition
tag.cc:16
ns3::TypeId
a unique identifier for an interface.
Definition
type-id.h:48
uint32_t
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
tag-buffer.h
src
network
model
tag.h
Generated on Tue Dec 10 2024 18:20:46 for ns-3 by
1.11.0