1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 /* 3 * Copyright (c) 2007,2008 INRIA 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License version 2 as 7 * published by the Free Software Foundation; 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program; if not, write to the Free Software 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 * 18 * Author: Jahanzeb Farooq <jahanzeb.farooq@sophia.inria.fr> 19 */ 20 21 #ifndef PACKET_BURST_H 22 #define PACKET_BURST_H 23 24 #include <stdint.h> 25 #include <list> 26 #include "ns3/object.h" 27 28 namespace ns3 { 29 30 class Packet; 31 32 /** 33 * \brief this class implement a burst as a list of packets 34 */ 35 class PacketBurst : public Object 36 { 37 public: 38 /** 39 * \brief Get the type ID. 40 * \return the object TypeId 41 */ 42 static TypeId GetTypeId (void); 43 PacketBurst (void); 44 virtual ~PacketBurst (void); 45 /** 46 * \return a copy the packetBurst 47 */ 48 Ptr<PacketBurst> Copy (void) const; 49 /** 50 * \brief add a packet to the list of packet 51 * \param packet the packet to add 52 */ 53 void AddPacket (Ptr<Packet> packet); 54 /** 55 * \return the list of packet of this burst 56 */ 57 std::list<Ptr<Packet> > GetPackets (void) const; 58 /** 59 * \return the number of packet in the burst 60 */ 61 uint32_t GetNPackets (void) const; 62 /** 63 * \return the size of the burst in byte (the size of all packets) 64 */ 65 uint32_t GetSize (void) const; 66 67 /** 68 * \brief Returns an iterator to the begin of the burst 69 * \return iterator to the burst list start 70 */ 71 std::list<Ptr<Packet> >::const_iterator Begin (void) const; 72 /** 73 * \brief Returns an iterator to the end of the burst 74 * \return iterator to the burst list end 75 */ 76 std::list<Ptr<Packet> >::const_iterator End (void) const; 77 78 /** 79 * TracedCallback signature for Ptr<PacketBurst> 80 * 81 * \param [in] burst The PacketBurst 82 */ 83 typedef void (* TracedCallback)(Ptr<const PacketBurst> burst); 84 85 86 private: 87 void DoDispose (void); 88 std::list<Ptr<Packet> > m_packets; //!< the list of packets in the burst 89 }; 90 } // namespace ns3 91 92 #endif /* PACKET_BURST */ 93