blob: c5389310824c189c45063274612df1e2d1a2df1d [file] [log] [blame]
Alexander Afanasyeve4c2ece2012-01-11 10:44:40 -08001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
2/*
3 * Copyright (c) 2012 UCLA
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: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
19 */
20
21#ifndef CCNX_CONSUMER_WINDOW_TRACER_H
22#define CCNX_CONSUMER_WINDOW_TRACER_H
23
24#include "ns3/ptr.h"
25#include "ns3/simple-ref-count.h"
26
27namespace ns3 {
28
29class Node;
30
Alexander Afanasyev06b42ec2012-01-11 19:05:36 -080031class WindowTracer : public SimpleRefCount<WindowTracer>
Alexander Afanasyeve4c2ece2012-01-11 10:44:40 -080032{
33public:
Alexander Afanasyev06b42ec2012-01-11 19:05:36 -080034 WindowTracer (std::ostream &os, Ptr<Node> node, const std::string &appId = "*");
35 virtual ~WindowTracer () { };
36
37 static void
38 PrintHeader (std::ostream &os);
Alexander Afanasyeve4c2ece2012-01-11 10:44:40 -080039
40 virtual void
Alexander Afanasyeve4c2ece2012-01-11 10:44:40 -080041 OnWindowChange (std::string context,
42 uint32_t oldValue, uint32_t newValue);
43
44protected:
45 std::string m_appId;
46 std::string m_node;
Alexander Afanasyev06b42ec2012-01-11 19:05:36 -080047 std::string m_nodeName;
Alexander Afanasyeve4c2ece2012-01-11 10:44:40 -080048 Ptr<Node> m_nodePtr;
49 std::ostream& m_os;
50};
51
Alexander Afanasyev06b42ec2012-01-11 19:05:36 -080052class CcnxConsumerWindowTracer : public WindowTracer
Alexander Afanasyeve4c2ece2012-01-11 10:44:40 -080053{
Alexander Afanasyev06b42ec2012-01-11 19:05:36 -080054public:
55 CcnxConsumerWindowTracer (std::ostream &os, Ptr<Node> node, const std::string &appId = "*")
56 : WindowTracer (os, node, appId)
57 { Connect (); }
58
59 void
60 Connect ();
61};
62
63class TcpCongestionWindowTracer : public WindowTracer
64{
65public:
66 TcpCongestionWindowTracer (std::ostream &os, Ptr<Node> node, const std::string &appId = "*")
67 : WindowTracer (os, node, appId)
68 { Connect (); }
69
70 void
71 Connect ();
72};
73
Alexander Afanasyeve4c2ece2012-01-11 10:44:40 -080074
75} // namespace ns3
76
77#endif // CCNX_CONSUMER_WINDOW_TRACER_H