blob: 5a64a5a7e1c39dbbfa5806e1dbb45805559c2fde [file] [log] [blame]
Alexander Afanasyevc4f88282012-01-03 11:27:20 -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 IPV4_SEQS_APP_TRACER_H
22#define IPV4_SEQS_APP_TRACER_H
23
Alexander Afanasyev49165862013-01-31 00:38:20 -080024#include "ipv4-app-tracer.h"
Alexander Afanasyevfc8425c2013-01-31 13:33:49 -080025#include <boost/shared_ptr.hpp>
26#include <boost/tuple/tuple.hpp>
Alexander Afanasyevc4f88282012-01-03 11:27:20 -080027
28namespace ns3 {
29
Alexander Afanasyev79206512013-07-27 16:49:12 -070030/**
31 * @ingroup ndn-tracers
32 * @brief Helper to track application-level sequence numbers (approximated from TCP ACKs)
33 */
Alexander Afanasyevc4f88282012-01-03 11:27:20 -080034class Ipv4SeqsAppTracer : public Ipv4AppTracer
35{
36public:
Alexander Afanasyevfc8425c2013-01-31 13:33:49 -080037 Ipv4SeqsAppTracer (boost::shared_ptr<std::ostream> os, Ptr<Node> node);
Alexander Afanasyevc4f88282012-01-03 11:27:20 -080038 virtual ~Ipv4SeqsAppTracer () { };
39
Alexander Afanasyevfc8425c2013-01-31 13:33:49 -080040 /**
41 * @brief Helper method to install tracers on all simulation nodes
42 *
43 * @param file File to which traces will be written
44 *
45 * @returns a tuple of reference to output stream and list of tracers. !!! Attention !!! This tuple needs to be preserved
46 * for the lifetime of simulation, otherwise SEGFAULTs are inevitable
47 *
48 */
49 static boost::tuple< boost::shared_ptr<std::ostream>, std::list<Ptr<Ipv4SeqsAppTracer> > >
50 InstallAll (const std::string &file);
51
52
Alexander Afanasyevc4f88282012-01-03 11:27:20 -080053 virtual void
54 PrintHeader (std::ostream &os) const;
55
56 virtual void
57 Print (std::ostream &os) const;
58
59 virtual void
60 Rx (std::string context,
61 const Ipv4Header &, Ptr<const Packet>, uint32_t);
Alexander Afanasyev49165862013-01-31 00:38:20 -080062
Alexander Afanasyevc4f88282012-01-03 11:27:20 -080063 virtual void
64 Tx (std::string context,
65 const Ipv4Header &, Ptr<const Packet>, uint32_t);
66
67protected:
68 void
69 Reset ();
70
71protected:
Alexander Afanasyevfc8425c2013-01-31 13:33:49 -080072 boost::shared_ptr<std::ostream> m_os;
Alexander Afanasyevc4f88282012-01-03 11:27:20 -080073};
74
75} // namespace ns3
76
77#endif // IPV4_AGGREGATE_APP_TRACER_H