blob: 53c9d04b0d59d7a2e1ce559f26bc2f7ae83e3f6d [file] [log] [blame]
Alexander Afanasyevad3757f2012-04-17 10:27:59 -07001/* -*- 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_GLOBAL_ROUTER_H
22#define CCNX_GLOBAL_ROUTER_H
23
24#include "ns3/object.h"
25#include "ns3/ptr.h"
26
27#include <list>
28#include <boost/tuple/tuple.hpp>
29
30namespace ns3 {
31
32class Channel;
33class Ccnx;
34class CcnxFace;
35class CcnxNameComponents;
36
37class CcnxGlobalRouter : public Object
38{
39public:
40 typedef boost::tuple< Ptr< CcnxGlobalRouter >, Ptr< CcnxFace >, Ptr< CcnxGlobalRouter > > Incidency;
41 typedef std::list< Incidency > IncidencyList;
Alexander Afanasyev8e2f1122012-04-17 15:01:11 -070042 typedef std::list< Ptr<CcnxNameComponents> > LocalPrefixList;
Alexander Afanasyevad3757f2012-04-17 10:27:59 -070043
44 /**
45 * \brief Interface ID
46 *
47 * \return interface ID
48 */
49 static TypeId
50 GetTypeId ();
51
52 CcnxGlobalRouter ();
53
54 uint32_t
55 GetId () const;
56
57 Ptr<Ccnx>
58 GetCcnx () const;
59
60 void
61 AddLocalPrefix (Ptr< CcnxNameComponents > prefix);
62
63 /**
64 *
65 */
66 void
67 AddIncidency (Ptr< CcnxFace > face, Ptr< CcnxGlobalRouter > ccnx);
68
69 IncidencyList &
70 GetIncidencies ();
71
Alexander Afanasyev8e2f1122012-04-17 15:01:11 -070072 const LocalPrefixList &
73 GetLocalPrefixes () const;
74
Alexander Afanasyevad3757f2012-04-17 10:27:59 -070075 // ??
76protected:
77 virtual void
78 NotifyNewAggregate ();
79
80private:
81 uint32_t m_id;
82
83 Ptr<Ccnx> m_ccnx;
Alexander Afanasyev8e2f1122012-04-17 15:01:11 -070084 LocalPrefixList m_localPrefixes;
Alexander Afanasyevad3757f2012-04-17 10:27:59 -070085 IncidencyList m_incidencies;
86
87 static uint32_t m_idCounter;
88};
89
90inline bool
91operator == (const CcnxGlobalRouter::Incidency &a,
92 const CcnxGlobalRouter::Incidency &b)
93{
94 return a.get<0> () == b.get<0> () &&
95 a.get<1> () == b.get<1> () &&
96 a.get<2> () == b.get<2> ();
97}
98
99inline bool
100operator != (const CcnxGlobalRouter::Incidency &a,
101 const CcnxGlobalRouter::Incidency &b)
102{
103 return ! (a == b);
104}
105
106}
107
108#endif // CCNX_GLOBAL_ROUTER_H