Alexander Afanasyev | c74a602 | 2011-08-15 20:01:35 -0700 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ |
Alexander Afanasyev | 08d984e | 2011-08-13 19:20:22 -0700 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (c) 2009 University of Washington |
| 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 | */ |
| 19 | #ifndef CCNX_ROUTE_H |
| 20 | #define CCNX_ROUTE_H |
| 21 | |
| 22 | #include <list> |
| 23 | #include <map> |
| 24 | #include <ostream> |
| 25 | |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 26 | #include "ns3/ptr.h" |
Alexander Afanasyev | 08d984e | 2011-08-13 19:20:22 -0700 | [diff] [blame] | 27 | #include "ns3/simple-ref-count.h" |
Ilya Moiseenko | d26e682 | 2011-08-23 17:48:38 -0700 | [diff] [blame] | 28 | #include "ns3/ccnx-name-components.h" |
Alexander Afanasyev | 08d984e | 2011-08-13 19:20:22 -0700 | [diff] [blame] | 29 | |
| 30 | namespace ns3 { |
| 31 | |
Alexander Afanasyev | 9825610 | 2011-08-14 01:00:02 -0700 | [diff] [blame] | 32 | class CcnxFace; |
Alexander Afanasyev | 08d984e | 2011-08-13 19:20:22 -0700 | [diff] [blame] | 33 | |
| 34 | /** |
| 35 | * \ingroup ccnxRouting |
| 36 | * |
| 37 | *\brief Ccnx route cache entry (similar to Linux struct rtable) |
| 38 | * |
| 39 | * This is a reference counted object. In the future, we will add other |
| 40 | * entries from struct dst_entry, struct rtable, and struct dst_ops as needed. |
| 41 | */ |
| 42 | class CcnxRoute : public SimpleRefCount<CcnxRoute> |
| 43 | { |
| 44 | public: |
| 45 | CcnxRoute (); |
| 46 | |
| 47 | /** |
| 48 | * \param dest Destination CcnxAddress |
| 49 | */ |
Ilya Moiseenko | 2bd1bc3 | 2011-08-23 16:01:35 -0700 | [diff] [blame] | 50 | void SetPrefix (const Ptr<CcnxNameComponents> &dest); |
Alexander Afanasyev | 08d984e | 2011-08-13 19:20:22 -0700 | [diff] [blame] | 51 | /** |
| 52 | * \return Destination CcnxAddress of the route |
| 53 | */ |
Ilya Moiseenko | 2bd1bc3 | 2011-08-23 16:01:35 -0700 | [diff] [blame] | 54 | const CcnxNameComponents& GetPrefix (void) const; |
Alexander Afanasyev | 08d984e | 2011-08-13 19:20:22 -0700 | [diff] [blame] | 55 | |
| 56 | /** |
| 57 | * Equivalent in Linux to dst_entry.dev |
| 58 | * |
| 59 | * \param outputDevice pointer to NetDevice for outgoing packets |
| 60 | */ |
Alexander Afanasyev | 9825610 | 2011-08-14 01:00:02 -0700 | [diff] [blame] | 61 | void SetOutputFace (Ptr<CcnxFace> outputDevice); |
Alexander Afanasyev | 08d984e | 2011-08-13 19:20:22 -0700 | [diff] [blame] | 62 | /** |
| 63 | * \return pointer to NetDevice for outgoing packets |
| 64 | */ |
Alexander Afanasyev | 9825610 | 2011-08-14 01:00:02 -0700 | [diff] [blame] | 65 | Ptr<CcnxFace> GetOutputFace (void) const; |
Alexander Afanasyev | 08d984e | 2011-08-13 19:20:22 -0700 | [diff] [blame] | 66 | |
| 67 | private: |
Ilya Moiseenko | 2bd1bc3 | 2011-08-23 16:01:35 -0700 | [diff] [blame] | 68 | Ptr<CcnxNameComponents> m_prefix; |
Alexander Afanasyev | 9825610 | 2011-08-14 01:00:02 -0700 | [diff] [blame] | 69 | Ptr<CcnxFace> m_outputFace; |
Alexander Afanasyev | 08d984e | 2011-08-13 19:20:22 -0700 | [diff] [blame] | 70 | }; |
| 71 | |
| 72 | std::ostream& operator<< (std::ostream& os, CcnxRoute const& route); |
| 73 | |
Alexander Afanasyev | 08d984e | 2011-08-13 19:20:22 -0700 | [diff] [blame] | 74 | } //namespace ns3 |
| 75 | |
| 76 | #endif /* CCNX_ROUTE_H */ |