Alexander Afanasyev | b3e4b85 | 2011-12-23 15:58: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 | #ifndef CCNX_APP_TRACER_H |
| 22 | #define CCNX_APP_TRACER_H |
| 23 | |
| 24 | #include "ns3/ptr.h" |
| 25 | #include "ns3/simple-ref-count.h" |
| 26 | #include "ns3/ccnx.h" |
| 27 | |
| 28 | namespace ns3 { |
| 29 | |
| 30 | class CcnxApp; |
| 31 | |
| 32 | class CcnxAppTracer : public SimpleRefCount<CcnxAppTracer> |
| 33 | { |
| 34 | public: |
| 35 | CcnxAppTracer (const std::string &app, Ptr<Node> node, const std::string &appId = "*"); |
| 36 | CcnxAppTracer (const std::string &app, const std::string &node, const std::string &appId = "*"); |
| 37 | virtual ~CcnxAppTracer () { }; |
| 38 | |
| 39 | void |
| 40 | Connect (); |
| 41 | |
| 42 | virtual void |
| 43 | PrintHeader (std::ostream &os) const = 0; |
| 44 | |
| 45 | virtual void |
| 46 | Print (std::ostream &os) const = 0; |
| 47 | |
| 48 | virtual void |
| 49 | OutInterests (std::string context, |
| 50 | Ptr<const CcnxInterestHeader>, Ptr<CcnxApp>, Ptr<CcnxFace>) = 0; |
| 51 | |
| 52 | virtual void |
| 53 | InInterests (std::string context, |
| 54 | Ptr<const CcnxInterestHeader>, Ptr<CcnxApp>, Ptr<CcnxFace>) = 0; |
| 55 | |
| 56 | virtual void |
| 57 | InNacks (std::string context, |
| 58 | Ptr<const CcnxInterestHeader>, Ptr<CcnxApp>, Ptr<CcnxFace>) = 0; |
| 59 | |
| 60 | virtual void |
| 61 | OutData (std::string context, |
| 62 | Ptr<const CcnxContentObjectHeader>, Ptr<const Packet>, Ptr<CcnxApp>, Ptr<CcnxFace>) = 0; |
| 63 | |
| 64 | virtual void |
| 65 | InData (std::string context, |
| 66 | Ptr<const CcnxContentObjectHeader>, Ptr<const Packet>, Ptr<CcnxApp>, Ptr<CcnxFace>) = 0; |
| 67 | |
| 68 | protected: |
| 69 | std::string m_app; |
| 70 | std::string m_appId; |
| 71 | std::string m_node; |
| 72 | Ptr<Node> m_nodePtr; |
| 73 | }; |
| 74 | |
| 75 | inline std::ostream& |
| 76 | operator << (std::ostream &os, const CcnxAppTracer &tracer) |
| 77 | { |
| 78 | os << "# "; |
| 79 | tracer.PrintHeader (os); |
| 80 | os << "\n"; |
| 81 | tracer.Print (os); |
| 82 | return os; |
| 83 | } |
| 84 | |
| 85 | } // namespace ns3 |
| 86 | |
| 87 | #endif // CCNX_APP_TRACER_H |