A Discrete-Event Network Simulator
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
16namespace ns3
17{
18
19/**
20 * \ingroup packet
21 *
22 * \brief abstract base class for ns3::Header and ns3::Trailer
23 */
24class 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 */
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 */
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 */
iterator in a Buffer instance
Definition buffer.h:89
abstract base class for ns3::Header and ns3::Trailer
Definition chunk.h:25
virtual uint32_t Deserialize(Buffer::Iterator start)=0
Deserialize the object from a buffer iterator.
static TypeId GetTypeId()
Get the type ID.
Definition chunk.cc:17
virtual void Print(std::ostream &os) const =0
Print the object contents.
Anchor the ns-3 type and attribute system.
a unique identifier for an interface.
Definition type-id.h:48
Every class exported by the ns3 library is enclosed in the ns3 namespace.