Alexander Afanasyev | e4c2ece | 2012-01-11 10:44:40 -0800 | [diff] [blame] | 1 | /* -*- 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 | |
| 27 | namespace ns3 { |
| 28 | |
| 29 | class Node; |
| 30 | |
Alexander Afanasyev | 06b42ec | 2012-01-11 19:05:36 -0800 | [diff] [blame] | 31 | class WindowTracer : public SimpleRefCount<WindowTracer> |
Alexander Afanasyev | e4c2ece | 2012-01-11 10:44:40 -0800 | [diff] [blame] | 32 | { |
| 33 | public: |
Alexander Afanasyev | 06b42ec | 2012-01-11 19:05:36 -0800 | [diff] [blame] | 34 | WindowTracer (std::ostream &os, Ptr<Node> node, const std::string &appId = "*"); |
| 35 | virtual ~WindowTracer () { }; |
| 36 | |
| 37 | static void |
| 38 | PrintHeader (std::ostream &os); |
Alexander Afanasyev | e4c2ece | 2012-01-11 10:44:40 -0800 | [diff] [blame] | 39 | |
| 40 | virtual void |
Alexander Afanasyev | e4c2ece | 2012-01-11 10:44:40 -0800 | [diff] [blame] | 41 | OnWindowChange (std::string context, |
| 42 | uint32_t oldValue, uint32_t newValue); |
| 43 | |
| 44 | protected: |
| 45 | std::string m_appId; |
| 46 | std::string m_node; |
Alexander Afanasyev | 06b42ec | 2012-01-11 19:05:36 -0800 | [diff] [blame] | 47 | std::string m_nodeName; |
Alexander Afanasyev | e4c2ece | 2012-01-11 10:44:40 -0800 | [diff] [blame] | 48 | Ptr<Node> m_nodePtr; |
| 49 | std::ostream& m_os; |
| 50 | }; |
| 51 | |
Alexander Afanasyev | 06b42ec | 2012-01-11 19:05:36 -0800 | [diff] [blame] | 52 | class CcnxConsumerWindowTracer : public WindowTracer |
Alexander Afanasyev | e4c2ece | 2012-01-11 10:44:40 -0800 | [diff] [blame] | 53 | { |
Alexander Afanasyev | 06b42ec | 2012-01-11 19:05:36 -0800 | [diff] [blame] | 54 | public: |
| 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 | |
| 63 | class TcpCongestionWindowTracer : public WindowTracer |
| 64 | { |
| 65 | public: |
| 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 Afanasyev | e4c2ece | 2012-01-11 10:44:40 -0800 | [diff] [blame] | 74 | |
| 75 | } // namespace ns3 |
| 76 | |
| 77 | #endif // CCNX_CONSUMER_WINDOW_TRACER_H |