A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
packet-loss-counter.h
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2007,2008,2009 INRIA, UDCAST
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: Amine Ismail <amine.ismail@sophia.inria.fr>
19  * <amine.ismail@udcast.com>
20  *
21  */
22 
23 #ifndef PACKET_LOSS_COUNTER_H
24 #define PACKET_LOSS_COUNTER_H
25 
26 #include "ns3/application.h"
27 #include "ns3/event-id.h"
28 #include "ns3/ptr.h"
29 #include "ns3/address.h"
30 
31 namespace ns3 {
32 
33 class Socket;
34 class Packet;
35 
37 {
38 public:
39  PacketLossCounter (uint8_t bitmapSize);
41  void NotifyReceived (uint32_t seq);
42  uint32_t GetLost (void) const;
43  uint16_t GetBitMapSize (void) const;
44  void SetBitMapSize (uint16_t size);
45 private:
46  bool GetBit (uint32_t seqNum);
47  void SetBit (uint32_t seqNum, bool val);
48 
49  uint32_t m_lost;
50  uint16_t m_bitMapSize;
51  uint32_t m_lastMaxSeqNum;
52  uint8_t * m_receiveBitMap;
53 };
54 }
55 
56 #endif /* PACKET_LOSS_COUNTER_H */