Alexander Afanasyev | 3183b5a | 2011-12-23 20:48:20 -0800 | [diff] [blame^] | 1 | /* -*- 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 | #include "ccnx-seqs-app-tracer.h" |
| 22 | #include "ns3/node.h" |
| 23 | #include "ns3/packet.h" |
| 24 | #include "ns3/config.h" |
| 25 | #include "ns3/callback.h" |
| 26 | #include "ns3/simulator.h" |
| 27 | |
| 28 | #include "ns3/ccnx-app.h" |
| 29 | #include "ns3/ccnx-face.h" |
| 30 | #include "ns3/ccnx-interest-header.h" |
| 31 | #include "ns3/ccnx-content-object-header.h" |
| 32 | |
| 33 | namespace ns3 { |
| 34 | |
| 35 | CcnxSeqsAppTracer::CcnxSeqsAppTracer (std::ostream &os, const std::string &app, Ptr<Node> node, const std::string &appId) |
| 36 | : CcnxAppTracer (app, node, appId) |
| 37 | , m_os (os) |
| 38 | { |
| 39 | } |
| 40 | |
| 41 | CcnxSeqsAppTracer::CcnxSeqsAppTracer (std::ostream &os, const std::string &app, const std::string &node, const std::string &appId) |
| 42 | : CcnxAppTracer (app, node, appId) |
| 43 | , m_os (os) |
| 44 | { |
| 45 | } |
| 46 | |
| 47 | void |
| 48 | CcnxSeqsAppTracer::Reset () |
| 49 | { |
| 50 | } |
| 51 | |
| 52 | void |
| 53 | CcnxSeqsAppTracer::PrintHeader (std::ostream &os) const |
| 54 | { |
| 55 | os << "Time\t" |
| 56 | << "Node\t" |
| 57 | << "AppName\t" |
| 58 | << "AppId\t" |
| 59 | << "Type\t" |
| 60 | << "SeqNo"; |
| 61 | } |
| 62 | |
| 63 | void |
| 64 | CcnxSeqsAppTracer::Print (std::ostream &os) const |
| 65 | { |
| 66 | } |
| 67 | |
| 68 | #define PRINTER(type) \ |
| 69 | m_os \ |
| 70 | << Simulator::Now ().ToDouble (Time::S) << "\t" \ |
| 71 | << m_node << "\t" \ |
| 72 | << m_app << "\t" \ |
| 73 | << m_appId << "\t" \ |
| 74 | << type << "\t" \ |
| 75 | << header->GetName ().GetLastComponent () << std::endl; |
| 76 | |
| 77 | void |
| 78 | CcnxSeqsAppTracer::OutInterests (std::string context, |
| 79 | Ptr<const CcnxInterestHeader> header, Ptr<CcnxApp>, Ptr<CcnxFace>) |
| 80 | { |
| 81 | PRINTER ("OutInterest"); |
| 82 | } |
| 83 | |
| 84 | void |
| 85 | CcnxSeqsAppTracer::OutData (std::string context, |
| 86 | Ptr<const CcnxContentObjectHeader> header, Ptr<const Packet>, |
| 87 | Ptr<CcnxApp>, Ptr<CcnxFace>) |
| 88 | { |
| 89 | PRINTER ("OutData"); |
| 90 | } |
| 91 | |
| 92 | void |
| 93 | CcnxSeqsAppTracer::InInterests (std::string context, |
| 94 | Ptr<const CcnxInterestHeader> header, |
| 95 | Ptr<CcnxApp>, Ptr<CcnxFace>) |
| 96 | { |
| 97 | PRINTER ("InInterest"); |
| 98 | } |
| 99 | |
| 100 | void |
| 101 | CcnxSeqsAppTracer::InNacks (std::string context, |
| 102 | Ptr<const CcnxInterestHeader> header, |
| 103 | Ptr<CcnxApp>, Ptr<CcnxFace>) |
| 104 | { |
| 105 | PRINTER ("InNacks"); |
| 106 | } |
| 107 | |
| 108 | void |
| 109 | CcnxSeqsAppTracer::InData (std::string context, |
| 110 | Ptr<const CcnxContentObjectHeader> header, Ptr<const Packet>, |
| 111 | Ptr<CcnxApp>, Ptr<CcnxFace>) |
| 112 | { |
| 113 | PRINTER ("InData"); |
| 114 | } |
| 115 | |
| 116 | } // namespace ns3 |