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