A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
packet-burst.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2007,2008 INRIA
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Jahanzeb Farooq <jahanzeb.farooq@sophia.inria.fr>
7 */
8
9#ifndef PACKET_BURST_H
10#define PACKET_BURST_H
11
12#include "ns3/object.h"
13
14#include <list>
15#include <stdint.h>
16
17namespace ns3
18{
19
20class Packet;
21
22/**
23 * \brief this class implement a burst as a list of packets
24 */
25class PacketBurst : public Object
26{
27 public:
28 /**
29 * \brief Get the type ID.
30 * \return the object TypeId
31 */
32 static TypeId GetTypeId();
34 ~PacketBurst() override;
35 /**
36 * \return a copy the packetBurst
37 */
38 Ptr<PacketBurst> Copy() const;
39 /**
40 * \brief add a packet to the list of packet
41 * \param packet the packet to add
42 */
43 void AddPacket(Ptr<Packet> packet);
44 /**
45 * \return the list of packet of this burst
46 */
47 std::list<Ptr<Packet>> GetPackets() const;
48 /**
49 * \return the number of packet in the burst
50 */
51 uint32_t GetNPackets() const;
52 /**
53 * \return the size of the burst in byte (the size of all packets)
54 */
55 uint32_t GetSize() const;
56
57 /**
58 * \brief Returns an iterator to the begin of the burst
59 * \return iterator to the burst list start
60 */
61 std::list<Ptr<Packet>>::const_iterator Begin() const;
62 /**
63 * \brief Returns an iterator to the end of the burst
64 * \return iterator to the burst list end
65 */
66 std::list<Ptr<Packet>>::const_iterator End() const;
67
68 /**
69 * TracedCallback signature for Ptr<PacketBurst>
70 *
71 * \param [in] burst The PacketBurst
72 */
73 typedef void (*TracedCallback)(Ptr<const PacketBurst> burst);
74
75 private:
76 void DoDispose() override;
77 std::list<Ptr<Packet>> m_packets; //!< the list of packets in the burst
78};
79} // namespace ns3
80
81#endif /* PACKET_BURST */
A base class which provides memory management and object aggregation.
Definition object.h:78
this class implement a burst as a list of packets
~PacketBurst() override
std::list< Ptr< Packet > >::const_iterator End() const
Returns an iterator to the end of the burst.
static TypeId GetTypeId()
Get the type ID.
std::list< Ptr< Packet > > m_packets
the list of packets in the burst
std::list< Ptr< Packet > >::const_iterator Begin() const
Returns an iterator to the begin of the burst.
Ptr< PacketBurst > Copy() const
uint32_t GetNPackets() const
std::list< Ptr< Packet > > GetPackets() const
uint32_t GetSize() const
void DoDispose() override
Destructor implementation.
void AddPacket(Ptr< Packet > packet)
add a packet to the list of packet
Smart pointer class similar to boost::intrusive_ptr.
Forward calls to a chain of Callback.
a unique identifier for an interface.
Definition type-id.h:48
Every class exported by the ns3 library is enclosed in the ns3 namespace.