blob: 65fed465672d9801fe68d26f72bf37a7b5ee03e7 [file] [log] [blame]
Alexander Afanasyevc74a6022011-08-15 20:01:35 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
Alexander Afanasyev08d984e2011-08-13 19:20:22 -07002/*
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 Afanasyev45b92d42011-08-14 23:11:38 -070026#include "ns3/ptr.h"
Alexander Afanasyev08d984e2011-08-13 19:20:22 -070027#include "ns3/simple-ref-count.h"
Ilya Moiseenkod26e6822011-08-23 17:48:38 -070028#include "ns3/ccnx-name-components.h"
Alexander Afanasyev08d984e2011-08-13 19:20:22 -070029
30namespace ns3 {
31
Alexander Afanasyev98256102011-08-14 01:00:02 -070032class CcnxFace;
Alexander Afanasyev08d984e2011-08-13 19:20:22 -070033
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 */
42class CcnxRoute : public SimpleRefCount<CcnxRoute>
43{
44public:
45 CcnxRoute ();
46
47 /**
48 * \param dest Destination CcnxAddress
49 */
Ilya Moiseenko2bd1bc32011-08-23 16:01:35 -070050 void SetPrefix (const Ptr<CcnxNameComponents> &dest);
Alexander Afanasyev08d984e2011-08-13 19:20:22 -070051 /**
52 * \return Destination CcnxAddress of the route
53 */
Ilya Moiseenko2bd1bc32011-08-23 16:01:35 -070054 const CcnxNameComponents& GetPrefix (void) const;
Alexander Afanasyev08d984e2011-08-13 19:20:22 -070055
56 /**
57 * Equivalent in Linux to dst_entry.dev
58 *
59 * \param outputDevice pointer to NetDevice for outgoing packets
60 */
Alexander Afanasyev98256102011-08-14 01:00:02 -070061 void SetOutputFace (Ptr<CcnxFace> outputDevice);
Alexander Afanasyev08d984e2011-08-13 19:20:22 -070062 /**
63 * \return pointer to NetDevice for outgoing packets
64 */
Alexander Afanasyev98256102011-08-14 01:00:02 -070065 Ptr<CcnxFace> GetOutputFace (void) const;
Alexander Afanasyev08d984e2011-08-13 19:20:22 -070066
67private:
Ilya Moiseenko2bd1bc32011-08-23 16:01:35 -070068 Ptr<CcnxNameComponents> m_prefix;
Alexander Afanasyev98256102011-08-14 01:00:02 -070069 Ptr<CcnxFace> m_outputFace;
Alexander Afanasyev08d984e2011-08-13 19:20:22 -070070};
71
72std::ostream& operator<< (std::ostream& os, CcnxRoute const& route);
73
Alexander Afanasyev08d984e2011-08-13 19:20:22 -070074} //namespace ns3
75
76#endif /* CCNX_ROUTE_H */