Alexander Afanasyev | c4f8828 | 2012-01-03 11:27:20 -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 IPV4_APP_TRACER_H |
| 22 | #define IPV4_APP_TRACER_H |
| 23 | |
| 24 | #include "ns3/ptr.h" |
| 25 | #include "ns3/simple-ref-count.h" |
| 26 | #include "ns3/ipv4.h" |
| 27 | |
| 28 | namespace ns3 { |
| 29 | |
| 30 | class Ipv4Header; |
| 31 | |
Alexander Afanasyev | 7920651 | 2013-07-27 16:49:12 -0700 | [diff] [blame] | 32 | /** |
| 33 | * @ingroup ndn-tracers |
| 34 | * @brief Base class for IPv4/TCP based applications |
| 35 | */ |
Alexander Afanasyev | c4f8828 | 2012-01-03 11:27:20 -0800 | [diff] [blame] | 36 | class Ipv4AppTracer : public SimpleRefCount<Ipv4AppTracer> |
| 37 | { |
| 38 | public: |
Alexander Afanasyev | fc8425c | 2013-01-31 13:33:49 -0800 | [diff] [blame] | 39 | Ipv4AppTracer (Ptr<Node> node); |
Alexander Afanasyev | c4f8828 | 2012-01-03 11:27:20 -0800 | [diff] [blame] | 40 | virtual ~Ipv4AppTracer () { }; |
| 41 | |
| 42 | void |
| 43 | Connect (); |
| 44 | |
| 45 | virtual void |
| 46 | PrintHeader (std::ostream &os) const = 0; |
Alexander Afanasyev | fc8425c | 2013-01-31 13:33:49 -0800 | [diff] [blame] | 47 | |
Alexander Afanasyev | c4f8828 | 2012-01-03 11:27:20 -0800 | [diff] [blame] | 48 | virtual void |
| 49 | Print (std::ostream &os) const = 0; |
| 50 | |
| 51 | virtual void |
| 52 | Rx (std::string context, |
| 53 | const Ipv4Header &, Ptr<const Packet>, uint32_t) = 0; |
Alexander Afanasyev | fc8425c | 2013-01-31 13:33:49 -0800 | [diff] [blame] | 54 | |
Alexander Afanasyev | c4f8828 | 2012-01-03 11:27:20 -0800 | [diff] [blame] | 55 | virtual void |
| 56 | Tx (std::string context, |
| 57 | const Ipv4Header &, Ptr<const Packet>, uint32_t) = 0; |
Alexander Afanasyev | fc8425c | 2013-01-31 13:33:49 -0800 | [diff] [blame] | 58 | |
Alexander Afanasyev | c4f8828 | 2012-01-03 11:27:20 -0800 | [diff] [blame] | 59 | protected: |
Alexander Afanasyev | c4f8828 | 2012-01-03 11:27:20 -0800 | [diff] [blame] | 60 | std::string m_node; |
| 61 | Ptr<Node> m_nodePtr; |
| 62 | }; |
| 63 | |
| 64 | inline std::ostream& |
| 65 | operator << (std::ostream &os, const Ipv4AppTracer &tracer) |
| 66 | { |
| 67 | os << "# "; |
| 68 | tracer.PrintHeader (os); |
| 69 | os << "\n"; |
| 70 | tracer.Print (os); |
| 71 | return os; |
| 72 | } |
| 73 | |
| 74 | } // namespace ns3 |
| 75 | |
| 76 | #endif // IPV4_APP_TRACER_H |