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
chunk.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@cutebugs.net>
7
*/
8
9
#ifndef CHUNK_H
10
#define CHUNK_H
11
12
#include "
buffer.h
"
13
14
#include "ns3/object-base.h"
15
16
namespace
ns3
17
{
18
19
/**
20
* \ingroup packet
21
*
22
* \brief abstract base class for ns3::Header and ns3::Trailer
23
*/
24
class
Chunk
:
public
ObjectBase
25
{
26
public
:
27
/**
28
* \brief Get the type ID.
29
* \return the object TypeId
30
*/
31
static
TypeId
GetTypeId
();
32
33
/**
34
* \brief Deserialize the object from a buffer iterator
35
*
36
* This version of Deserialize can be used when the Chunk has a fixed
37
* size. It should not be called for variable-sized Chunk derived types
38
* (but must be implemented, for historical reasons).
39
*
40
* \param start the buffer iterator
41
* \returns the number of deserialized bytes
42
*/
43
virtual
uint32_t
Deserialize
(
Buffer::Iterator
start) = 0;
44
45
/**
46
* \brief Deserialize the object from a buffer iterator
47
*
48
* This version of Deserialize must be used when the Chunk has a variable
49
* size, because the bounds of the Chunk may not be known at the point
50
* of deserialization (e.g. a sequence of TLV fields).
51
*
52
* The size of the chunk should be start.GetDistanceFrom (end);
53
*
54
* \param start the starting point
55
* \param end the ending point
56
* \returns the number of deserialized bytes
57
*/
58
virtual
uint32_t
Deserialize
(
Buffer::Iterator
start,
Buffer::Iterator
end);
59
60
/**
61
* \brief Print the object contents
62
* \param os the output stream
63
*/
64
virtual
void
Print
(std::ostream& os)
const
= 0;
65
};
66
67
}
// namespace ns3
68
69
#endif
/* CHUNK_H */
buffer.h
ns3::Buffer::Iterator
iterator in a Buffer instance
Definition
buffer.h:89
ns3::Chunk
abstract base class for ns3::Header and ns3::Trailer
Definition
chunk.h:25
ns3::Chunk::Deserialize
virtual uint32_t Deserialize(Buffer::Iterator start)=0
Deserialize the object from a buffer iterator.
ns3::Chunk::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition
chunk.cc:17
ns3::Chunk::Print
virtual void Print(std::ostream &os) const =0
Print the object contents.
ns3::ObjectBase
Anchor the ns-3 type and attribute system.
Definition
object-base.h:162
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.
src
network
model
chunk.h
Generated on Fri Nov 8 2024 13:59:04 for ns-3 by
1.11.0