blob: cfff1075644147d9674aa1516766c38cdc25e847 [file] [log] [blame]
Alexander Afanasyev141d1312011-12-18 14:58:35 -08001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
2/*
3 * Copyright (c) 2011 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_TRACE_HELPER_H
22#define CCNX_TRACE_HELPER_H
23
Alexander Afanasyevc86c2832011-12-23 02:56:22 -080024#include "ns3/nstime.h"
25#include "ns3/event-id.h"
26
Alexander Afanasyevb3e4b852011-12-23 15:58:20 -080027#include <list>
Alexander Afanasyev141d1312011-12-18 14:58:35 -080028
29namespace ns3 {
30
Alexander Afanasyev06b42ec2012-01-11 19:05:36 -080031class Node;
Alexander Afanasyevb3e4b852011-12-23 15:58:20 -080032class CcnxAppTracer;
33class CcnxL3Tracer;
Alexander Afanasyevc4f88282012-01-03 11:27:20 -080034class Ipv4AppTracer;
Alexander Afanasyev06b42ec2012-01-11 19:05:36 -080035class WindowTracer;
Alexander Afanasyevc86c2832011-12-23 02:56:22 -080036
Alexander Afanasyev141d1312011-12-18 14:58:35 -080037class CcnxTraceHelper
38{
39public:
Alexander Afanasyevc86c2832011-12-23 02:56:22 -080040 CcnxTraceHelper ();
41
Alexander Afanasyev141d1312011-12-18 14:58:35 -080042 /**
43 * @brief Destructor that invokes trace output procedures
44 */
45 ~CcnxTraceHelper ();
46
47 /**
48 * @brief Set filename to output app trace.
49 *
50 * By default, trace is output to NS_LOG_INFO stream
51 *
52 * @param file File where trace will be written to
53 */
54 void
55 SetAppTraceFile (const std::string &appTrace = "apps.log");
56
57 /**
58 * @brief Set filename to output app trace.
59 *
60 * By default, trace is output to NS_LOG_INFO stream
61 *
62 * @param file File where trace will be written to
63 */
64 void
65 SetL3TraceFile (const std::string &l3Trace = "l3.log");
Alexander Afanasyevc86c2832011-12-23 02:56:22 -080066
Alexander Afanasyev141d1312011-12-18 14:58:35 -080067 /**
Alexander Afanasyevc86c2832011-12-23 02:56:22 -080068 * @brief Enable aggregate app-level CCNx tracing on all CCNx applications
Alexander Afanasyev141d1312011-12-18 14:58:35 -080069 *
70 * @param app Class name of the application of interest
71 */
72 void
73 EnableAggregateAppAll (const std::string &app);
74
75 /**
Alexander Afanasyevc86c2832011-12-23 02:56:22 -080076 * @brief Enable aggregate network-level CCNx tracing on all CCNx node
Alexander Afanasyev141d1312011-12-18 14:58:35 -080077 */
78 void
79 EnableAggregateL3All ();
80
Alexander Afanasyevc86c2832011-12-23 02:56:22 -080081 /**
Alexander Afanasyev3183b5a2011-12-23 20:48:20 -080082 * @brief Enable network-level CCNx rate tracing on all CCNx nodes
Alexander Afanasyevc86c2832011-12-23 02:56:22 -080083 */
84 void
85 EnableRateL3All (const std::string &l3RateTrace = "l3-rate.log");
86
Alexander Afanasyev3183b5a2011-12-23 20:48:20 -080087 /**
88 * @brief Enable app-level CCNx sequence tracing on all CCNx applications
89 */
90 void
91 EnableSeqsAppAll (const std::string &app, const std::string &appSeqsTrace = "app-seqs.log");
92
Alexander Afanasyevc4f88282012-01-03 11:27:20 -080093 /**
94 * @brief Enable app-level IPv4 sequence tracing on all nodes (BulkSender + PacketSink)
95 */
96 void
97 EnableIpv4SeqsAppAll (const std::string &appSeqsTrace = "app-seqs.log");
Alexander Afanasyeve4c2ece2012-01-11 10:44:40 -080098
99 /**
100 * @brief Enable tracing of window changes in CcnxConsumerWindow
101 */
102 void
103 EnableWindowsAll (const std::string &windowTrace = "windows.log");
Alexander Afanasyev06b42ec2012-01-11 19:05:36 -0800104
105 /**
106 * @brief Enable tracing of congestion window changes in TcpNewReno
107 */
108 void
109 EnableWindowsTcpAll (const std::string &windowTrace);
110
111 void TcpConnect (Ptr<Node> node);
112
Alexander Afanasyev141d1312011-12-18 14:58:35 -0800113private:
114 std::string m_appTrace;
Alexander Afanasyevb3e4b852011-12-23 15:58:20 -0800115 std::list<Ptr<CcnxAppTracer> > m_apps;
Alexander Afanasyev141d1312011-12-18 14:58:35 -0800116
117 std::string m_l3Trace;
Alexander Afanasyevb3e4b852011-12-23 15:58:20 -0800118 std::list<Ptr<CcnxL3Tracer> > m_l3s;
Alexander Afanasyevc86c2832011-12-23 02:56:22 -0800119
Alexander Afanasyevb3e4b852011-12-23 15:58:20 -0800120 std::list<Ptr<CcnxL3Tracer> > m_l3Rates;
Alexander Afanasyevc86c2832011-12-23 02:56:22 -0800121 std::ostream *m_l3RateTrace;
Alexander Afanasyev3183b5a2011-12-23 20:48:20 -0800122
123 std::list<Ptr<CcnxAppTracer> > m_appSeqs;
124 std::ostream *m_appSeqsTrace;
Alexander Afanasyevc4f88282012-01-03 11:27:20 -0800125
126 std::list<Ptr<Ipv4AppTracer> > m_ipv4AppSeqs;
127 std::ostream *m_ipv4AppSeqsTrace;
Alexander Afanasyeve4c2ece2012-01-11 10:44:40 -0800128
Alexander Afanasyev06b42ec2012-01-11 19:05:36 -0800129 std::list<Ptr<WindowTracer> > m_windows;
Alexander Afanasyeve4c2ece2012-01-11 10:44:40 -0800130 std::ostream *m_windowsTrace;
Alexander Afanasyev06b42ec2012-01-11 19:05:36 -0800131
132 std::list<Ptr<WindowTracer> > m_windowsTcp;
133 std::ostream *m_windowsTcpTrace;
Alexander Afanasyev141d1312011-12-18 14:58:35 -0800134};
135
136
137} // namespace ns3
138
139#endif /* CCNX_TRACE_HELPER_H */